customize-widgets.js 102 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085
  1. /******/ (function() { // webpackBootstrap
  2. /******/ var __webpack_modules__ = ({
  3. /***/ 4403:
  4. /***/ (function(module, exports) {
  5. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
  6. Copyright (c) 2018 Jed Watson.
  7. Licensed under the MIT License (MIT), see
  8. http://jedwatson.github.io/classnames
  9. */
  10. /* global define */
  11. (function () {
  12. 'use strict';
  13. var hasOwn = {}.hasOwnProperty;
  14. function classNames() {
  15. var classes = [];
  16. for (var i = 0; i < arguments.length; i++) {
  17. var arg = arguments[i];
  18. if (!arg) continue;
  19. var argType = typeof arg;
  20. if (argType === 'string' || argType === 'number') {
  21. classes.push(arg);
  22. } else if (Array.isArray(arg)) {
  23. if (arg.length) {
  24. var inner = classNames.apply(null, arg);
  25. if (inner) {
  26. classes.push(inner);
  27. }
  28. }
  29. } else if (argType === 'object') {
  30. if (arg.toString === Object.prototype.toString) {
  31. for (var key in arg) {
  32. if (hasOwn.call(arg, key) && arg[key]) {
  33. classes.push(key);
  34. }
  35. }
  36. } else {
  37. classes.push(arg.toString());
  38. }
  39. }
  40. }
  41. return classes.join(' ');
  42. }
  43. if ( true && module.exports) {
  44. classNames.default = classNames;
  45. module.exports = classNames;
  46. } else if (true) {
  47. // register as 'classnames', consistent with npm package name
  48. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () {
  49. return classNames;
  50. }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  51. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  52. } else {}
  53. }());
  54. /***/ })
  55. /******/ });
  56. /************************************************************************/
  57. /******/ // The module cache
  58. /******/ var __webpack_module_cache__ = {};
  59. /******/
  60. /******/ // The require function
  61. /******/ function __webpack_require__(moduleId) {
  62. /******/ // Check if module is in cache
  63. /******/ var cachedModule = __webpack_module_cache__[moduleId];
  64. /******/ if (cachedModule !== undefined) {
  65. /******/ return cachedModule.exports;
  66. /******/ }
  67. /******/ // Create a new module (and put it into the cache)
  68. /******/ var module = __webpack_module_cache__[moduleId] = {
  69. /******/ // no module.id needed
  70. /******/ // no module.loaded needed
  71. /******/ exports: {}
  72. /******/ };
  73. /******/
  74. /******/ // Execute the module function
  75. /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
  76. /******/
  77. /******/ // Return the exports of the module
  78. /******/ return module.exports;
  79. /******/ }
  80. /******/
  81. /************************************************************************/
  82. /******/ /* webpack/runtime/compat get default export */
  83. /******/ !function() {
  84. /******/ // getDefaultExport function for compatibility with non-harmony modules
  85. /******/ __webpack_require__.n = function(module) {
  86. /******/ var getter = module && module.__esModule ?
  87. /******/ function() { return module['default']; } :
  88. /******/ function() { return module; };
  89. /******/ __webpack_require__.d(getter, { a: getter });
  90. /******/ return getter;
  91. /******/ };
  92. /******/ }();
  93. /******/
  94. /******/ /* webpack/runtime/define property getters */
  95. /******/ !function() {
  96. /******/ // define getter functions for harmony exports
  97. /******/ __webpack_require__.d = function(exports, definition) {
  98. /******/ for(var key in definition) {
  99. /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
  100. /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
  101. /******/ }
  102. /******/ }
  103. /******/ };
  104. /******/ }();
  105. /******/
  106. /******/ /* webpack/runtime/hasOwnProperty shorthand */
  107. /******/ !function() {
  108. /******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
  109. /******/ }();
  110. /******/
  111. /******/ /* webpack/runtime/make namespace object */
  112. /******/ !function() {
  113. /******/ // define __esModule on exports
  114. /******/ __webpack_require__.r = function(exports) {
  115. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  116. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  117. /******/ }
  118. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  119. /******/ };
  120. /******/ }();
  121. /******/
  122. /************************************************************************/
  123. var __webpack_exports__ = {};
  124. // This entry need to be wrapped in an IIFE because it need to be in strict mode.
  125. !function() {
  126. "use strict";
  127. // ESM COMPAT FLAG
  128. __webpack_require__.r(__webpack_exports__);
  129. // EXPORTS
  130. __webpack_require__.d(__webpack_exports__, {
  131. "initialize": function() { return /* binding */ initialize; }
  132. });
  133. // NAMESPACE OBJECT: ./node_modules/@wordpress/customize-widgets/build-module/store/selectors.js
  134. var selectors_namespaceObject = {};
  135. __webpack_require__.r(selectors_namespaceObject);
  136. __webpack_require__.d(selectors_namespaceObject, {
  137. "__experimentalGetInsertionPoint": function() { return __experimentalGetInsertionPoint; },
  138. "isInserterOpened": function() { return isInserterOpened; }
  139. });
  140. // NAMESPACE OBJECT: ./node_modules/@wordpress/customize-widgets/build-module/store/actions.js
  141. var actions_namespaceObject = {};
  142. __webpack_require__.r(actions_namespaceObject);
  143. __webpack_require__.d(actions_namespaceObject, {
  144. "setIsInserterOpened": function() { return setIsInserterOpened; }
  145. });
  146. // NAMESPACE OBJECT: ./node_modules/@wordpress/interface/build-module/store/actions.js
  147. var store_actions_namespaceObject = {};
  148. __webpack_require__.r(store_actions_namespaceObject);
  149. __webpack_require__.d(store_actions_namespaceObject, {
  150. "disableComplementaryArea": function() { return disableComplementaryArea; },
  151. "enableComplementaryArea": function() { return enableComplementaryArea; },
  152. "pinItem": function() { return pinItem; },
  153. "setFeatureDefaults": function() { return setFeatureDefaults; },
  154. "setFeatureValue": function() { return setFeatureValue; },
  155. "toggleFeature": function() { return toggleFeature; },
  156. "unpinItem": function() { return unpinItem; }
  157. });
  158. // NAMESPACE OBJECT: ./node_modules/@wordpress/interface/build-module/store/selectors.js
  159. var store_selectors_namespaceObject = {};
  160. __webpack_require__.r(store_selectors_namespaceObject);
  161. __webpack_require__.d(store_selectors_namespaceObject, {
  162. "getActiveComplementaryArea": function() { return getActiveComplementaryArea; },
  163. "isFeatureActive": function() { return isFeatureActive; },
  164. "isItemPinned": function() { return isItemPinned; }
  165. });
  166. ;// CONCATENATED MODULE: external ["wp","element"]
  167. var external_wp_element_namespaceObject = window["wp"]["element"];
  168. ;// CONCATENATED MODULE: external ["wp","blockLibrary"]
  169. var external_wp_blockLibrary_namespaceObject = window["wp"]["blockLibrary"];
  170. ;// CONCATENATED MODULE: external ["wp","widgets"]
  171. var external_wp_widgets_namespaceObject = window["wp"]["widgets"];
  172. ;// CONCATENATED MODULE: external ["wp","blocks"]
  173. var external_wp_blocks_namespaceObject = window["wp"]["blocks"];
  174. ;// CONCATENATED MODULE: external ["wp","data"]
  175. var external_wp_data_namespaceObject = window["wp"]["data"];
  176. ;// CONCATENATED MODULE: external ["wp","preferences"]
  177. var external_wp_preferences_namespaceObject = window["wp"]["preferences"];
  178. ;// CONCATENATED MODULE: external ["wp","components"]
  179. var external_wp_components_namespaceObject = window["wp"]["components"];
  180. ;// CONCATENATED MODULE: external ["wp","keyboardShortcuts"]
  181. var external_wp_keyboardShortcuts_namespaceObject = window["wp"]["keyboardShortcuts"];
  182. ;// CONCATENATED MODULE: external ["wp","i18n"]
  183. var external_wp_i18n_namespaceObject = window["wp"]["i18n"];
  184. ;// CONCATENATED MODULE: external ["wp","blockEditor"]
  185. var external_wp_blockEditor_namespaceObject = window["wp"]["blockEditor"];
  186. ;// CONCATENATED MODULE: external ["wp","compose"]
  187. var external_wp_compose_namespaceObject = window["wp"]["compose"];
  188. ;// CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/components/error-boundary/index.js
  189. /**
  190. * WordPress dependencies
  191. */
  192. function CopyButton(_ref) {
  193. let {
  194. text,
  195. children
  196. } = _ref;
  197. const ref = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(text);
  198. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  199. variant: "secondary",
  200. ref: ref
  201. }, children);
  202. }
  203. class ErrorBoundary extends external_wp_element_namespaceObject.Component {
  204. constructor() {
  205. super(...arguments);
  206. this.state = {
  207. error: null
  208. };
  209. }
  210. componentDidCatch(error) {
  211. this.setState({
  212. error
  213. });
  214. }
  215. render() {
  216. const {
  217. error
  218. } = this.state;
  219. if (!error) {
  220. return this.props.children;
  221. }
  222. return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.Warning, {
  223. className: "customize-widgets-error-boundary",
  224. actions: [(0,external_wp_element_namespaceObject.createElement)(CopyButton, {
  225. key: "copy-error",
  226. text: error.stack
  227. }, (0,external_wp_i18n_namespaceObject.__)('Copy Error'))]
  228. }, (0,external_wp_i18n_namespaceObject.__)('The editor has encountered an unexpected error.'));
  229. }
  230. }
  231. ;// CONCATENATED MODULE: external "lodash"
  232. var external_lodash_namespaceObject = window["lodash"];
  233. ;// CONCATENATED MODULE: external ["wp","coreData"]
  234. var external_wp_coreData_namespaceObject = window["wp"]["coreData"];
  235. ;// CONCATENATED MODULE: external ["wp","mediaUtils"]
  236. var external_wp_mediaUtils_namespaceObject = window["wp"]["mediaUtils"];
  237. ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js
  238. function _extends() {
  239. _extends = Object.assign ? Object.assign.bind() : function (target) {
  240. for (var i = 1; i < arguments.length; i++) {
  241. var source = arguments[i];
  242. for (var key in source) {
  243. if (Object.prototype.hasOwnProperty.call(source, key)) {
  244. target[key] = source[key];
  245. }
  246. }
  247. }
  248. return target;
  249. };
  250. return _extends.apply(this, arguments);
  251. }
  252. ;// CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/components/block-inspector-button/index.js
  253. /**
  254. * WordPress dependencies
  255. */
  256. function BlockInspectorButton(_ref) {
  257. let {
  258. inspector,
  259. closeMenu,
  260. ...props
  261. } = _ref;
  262. const selectedBlockClientId = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blockEditor_namespaceObject.store).getSelectedBlockClientId(), []);
  263. const selectedBlock = (0,external_wp_element_namespaceObject.useMemo)(() => document.getElementById(`block-${selectedBlockClientId}`), [selectedBlockClientId]);
  264. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, _extends({
  265. onClick: () => {
  266. // Open the inspector.
  267. inspector.open({
  268. returnFocusWhenClose: selectedBlock
  269. }); // Then close the dropdown menu.
  270. closeMenu();
  271. }
  272. }, props), (0,external_wp_i18n_namespaceObject.__)('Show more settings'));
  273. }
  274. /* harmony default export */ var block_inspector_button = (BlockInspectorButton);
  275. // EXTERNAL MODULE: ./node_modules/classnames/index.js
  276. var classnames = __webpack_require__(4403);
  277. var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames);
  278. ;// CONCATENATED MODULE: external ["wp","keycodes"]
  279. var external_wp_keycodes_namespaceObject = window["wp"]["keycodes"];
  280. ;// CONCATENATED MODULE: external ["wp","primitives"]
  281. var external_wp_primitives_namespaceObject = window["wp"]["primitives"];
  282. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/undo.js
  283. /**
  284. * WordPress dependencies
  285. */
  286. const undo = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  287. xmlns: "http://www.w3.org/2000/svg",
  288. viewBox: "0 0 24 24"
  289. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  290. d: "M18.3 11.7c-.6-.6-1.4-.9-2.3-.9H6.7l2.9-3.3-1.1-1-4.5 5L8.5 16l1-1-2.7-2.7H16c.5 0 .9.2 1.3.5 1 1 1 3.4 1 4.5v.3h1.5v-.2c0-1.5 0-4.3-1.5-5.7z"
  291. }));
  292. /* harmony default export */ var library_undo = (undo);
  293. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/redo.js
  294. /**
  295. * WordPress dependencies
  296. */
  297. const redo = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  298. xmlns: "http://www.w3.org/2000/svg",
  299. viewBox: "0 0 24 24"
  300. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  301. d: "M15.6 6.5l-1.1 1 2.9 3.3H8c-.9 0-1.7.3-2.3.9-1.4 1.5-1.4 4.2-1.4 5.6v.2h1.5v-.3c0-1.1 0-3.5 1-4.5.3-.3.7-.5 1.3-.5h9.2L14.5 15l1.1 1.1 4.6-4.6-4.6-5z"
  302. }));
  303. /* harmony default export */ var library_redo = (redo);
  304. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/plus.js
  305. /**
  306. * WordPress dependencies
  307. */
  308. const plus = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  309. xmlns: "http://www.w3.org/2000/svg",
  310. viewBox: "0 0 24 24"
  311. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  312. d: "M18 11.2h-5.2V6h-1.6v5.2H6v1.6h5.2V18h1.6v-5.2H18z"
  313. }));
  314. /* harmony default export */ var library_plus = (plus);
  315. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/close-small.js
  316. /**
  317. * WordPress dependencies
  318. */
  319. const closeSmall = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  320. xmlns: "http://www.w3.org/2000/svg",
  321. viewBox: "0 0 24 24"
  322. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  323. d: "M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z"
  324. }));
  325. /* harmony default export */ var close_small = (closeSmall);
  326. ;// CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/store/reducer.js
  327. /**
  328. * WordPress dependencies
  329. */
  330. /**
  331. * Reducer tracking whether the inserter is open.
  332. *
  333. * @param {boolean|Object} state
  334. * @param {Object} action
  335. */
  336. function blockInserterPanel() {
  337. let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  338. let action = arguments.length > 1 ? arguments[1] : undefined;
  339. switch (action.type) {
  340. case 'SET_IS_INSERTER_OPENED':
  341. return action.value;
  342. }
  343. return state;
  344. }
  345. /* harmony default export */ var reducer = ((0,external_wp_data_namespaceObject.combineReducers)({
  346. blockInserterPanel
  347. }));
  348. ;// CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/store/selectors.js
  349. /**
  350. * Returns true if the inserter is opened.
  351. *
  352. * @param {Object} state Global application state.
  353. *
  354. * @return {boolean} Whether the inserter is opened.
  355. */
  356. function isInserterOpened(state) {
  357. return !!state.blockInserterPanel;
  358. }
  359. /**
  360. * Get the insertion point for the inserter.
  361. *
  362. * @param {Object} state Global application state.
  363. *
  364. * @return {Object} The root client ID and index to insert at.
  365. */
  366. function __experimentalGetInsertionPoint(state) {
  367. const {
  368. rootClientId,
  369. insertionIndex
  370. } = state.blockInserterPanel;
  371. return {
  372. rootClientId,
  373. insertionIndex
  374. };
  375. }
  376. ;// CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/store/actions.js
  377. /**
  378. * Returns an action object used to open/close the inserter.
  379. *
  380. * @param {boolean|Object} value Whether the inserter should be
  381. * opened (true) or closed (false).
  382. * To specify an insertion point,
  383. * use an object.
  384. * @param {string} value.rootClientId The root client ID to insert at.
  385. * @param {number} value.insertionIndex The index to insert at.
  386. *
  387. * @return {Object} Action object.
  388. */
  389. function setIsInserterOpened(value) {
  390. return {
  391. type: 'SET_IS_INSERTER_OPENED',
  392. value
  393. };
  394. }
  395. ;// CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/store/constants.js
  396. /**
  397. * Module Constants
  398. */
  399. const STORE_NAME = 'core/customize-widgets';
  400. ;// CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/store/index.js
  401. /**
  402. * WordPress dependencies
  403. */
  404. /**
  405. * Internal dependencies
  406. */
  407. /**
  408. * Block editor data store configuration.
  409. *
  410. * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#registering-a-store
  411. *
  412. * @type {Object}
  413. */
  414. const storeConfig = {
  415. reducer: reducer,
  416. selectors: selectors_namespaceObject,
  417. actions: actions_namespaceObject
  418. };
  419. /**
  420. * Store definition for the edit widgets namespace.
  421. *
  422. * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore
  423. *
  424. * @type {Object}
  425. */
  426. const store = (0,external_wp_data_namespaceObject.createReduxStore)(STORE_NAME, storeConfig);
  427. (0,external_wp_data_namespaceObject.register)(store);
  428. ;// CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/components/inserter/index.js
  429. /**
  430. * WordPress dependencies
  431. */
  432. /**
  433. * Internal dependencies
  434. */
  435. function Inserter(_ref) {
  436. let {
  437. setIsOpened
  438. } = _ref;
  439. const inserterTitleId = (0,external_wp_compose_namespaceObject.useInstanceId)(Inserter, 'customize-widget-layout__inserter-panel-title');
  440. const insertionPoint = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).__experimentalGetInsertionPoint(), []);
  441. return (0,external_wp_element_namespaceObject.createElement)("div", {
  442. className: "customize-widgets-layout__inserter-panel",
  443. "aria-labelledby": inserterTitleId
  444. }, (0,external_wp_element_namespaceObject.createElement)("div", {
  445. className: "customize-widgets-layout__inserter-panel-header"
  446. }, (0,external_wp_element_namespaceObject.createElement)("h2", {
  447. id: inserterTitleId,
  448. className: "customize-widgets-layout__inserter-panel-header-title"
  449. }, (0,external_wp_i18n_namespaceObject.__)('Add a block')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  450. className: "customize-widgets-layout__inserter-panel-header-close-button",
  451. icon: close_small,
  452. onClick: () => setIsOpened(false),
  453. "aria-label": (0,external_wp_i18n_namespaceObject.__)('Close inserter')
  454. })), (0,external_wp_element_namespaceObject.createElement)("div", {
  455. className: "customize-widgets-layout__inserter-panel-content"
  456. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalLibrary, {
  457. rootClientId: insertionPoint.rootClientId,
  458. __experimentalInsertionIndex: insertionPoint.insertionIndex,
  459. showInserterHelpPanel: true,
  460. onSelect: () => setIsOpened(false)
  461. })));
  462. }
  463. /* harmony default export */ var components_inserter = (Inserter);
  464. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/external.js
  465. /**
  466. * WordPress dependencies
  467. */
  468. const external = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  469. xmlns: "http://www.w3.org/2000/svg",
  470. viewBox: "0 0 24 24"
  471. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  472. d: "M18.2 17c0 .7-.6 1.2-1.2 1.2H7c-.7 0-1.2-.6-1.2-1.2V7c0-.7.6-1.2 1.2-1.2h3.2V4.2H7C5.5 4.2 4.2 5.5 4.2 7v10c0 1.5 1.2 2.8 2.8 2.8h10c1.5 0 2.8-1.2 2.8-2.8v-3.6h-1.5V17zM14.9 3v1.5h3.7l-6.4 6.4 1.1 1.1 6.4-6.4v3.7h1.5V3h-6.3z"
  473. }));
  474. /* harmony default export */ var library_external = (external);
  475. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/more-vertical.js
  476. /**
  477. * WordPress dependencies
  478. */
  479. const moreVertical = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  480. xmlns: "http://www.w3.org/2000/svg",
  481. viewBox: "0 0 24 24"
  482. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  483. d: "M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z"
  484. }));
  485. /* harmony default export */ var more_vertical = (moreVertical);
  486. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/more-menu-dropdown/index.js
  487. /**
  488. * External dependencies
  489. */
  490. /**
  491. * WordPress dependencies
  492. */
  493. function MoreMenuDropdown(_ref) {
  494. let {
  495. as: DropdownComponent = external_wp_components_namespaceObject.DropdownMenu,
  496. className,
  497. /* translators: button label text should, if possible, be under 16 characters. */
  498. label = (0,external_wp_i18n_namespaceObject.__)('Options'),
  499. popoverProps,
  500. toggleProps,
  501. children
  502. } = _ref;
  503. return (0,external_wp_element_namespaceObject.createElement)(DropdownComponent, {
  504. className: classnames_default()('interface-more-menu-dropdown', className),
  505. icon: more_vertical,
  506. label: label,
  507. popoverProps: {
  508. position: 'bottom left',
  509. ...popoverProps,
  510. className: classnames_default()('interface-more-menu-dropdown__content', popoverProps === null || popoverProps === void 0 ? void 0 : popoverProps.className)
  511. },
  512. toggleProps: {
  513. tooltipPosition: 'bottom',
  514. ...toggleProps
  515. }
  516. }, onClose => children(onClose));
  517. }
  518. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/index.js
  519. ;// CONCATENATED MODULE: external ["wp","deprecated"]
  520. var external_wp_deprecated_namespaceObject = window["wp"]["deprecated"];
  521. var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_namespaceObject);
  522. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/actions.js
  523. /**
  524. * WordPress dependencies
  525. */
  526. /**
  527. * Enable the complementary area.
  528. *
  529. * @param {string} scope Complementary area scope.
  530. * @param {string} area Area identifier.
  531. */
  532. const enableComplementaryArea = (scope, area) => _ref => {
  533. let {
  534. registry
  535. } = _ref;
  536. // Return early if there's no area.
  537. if (!area) {
  538. return;
  539. }
  540. registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, 'complementaryArea', area);
  541. };
  542. /**
  543. * Disable the complementary area.
  544. *
  545. * @param {string} scope Complementary area scope.
  546. */
  547. const disableComplementaryArea = scope => _ref2 => {
  548. let {
  549. registry
  550. } = _ref2;
  551. registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, 'complementaryArea', null);
  552. };
  553. /**
  554. * Pins an item.
  555. *
  556. * @param {string} scope Item scope.
  557. * @param {string} item Item identifier.
  558. *
  559. * @return {Object} Action object.
  560. */
  561. const pinItem = (scope, item) => _ref3 => {
  562. let {
  563. registry
  564. } = _ref3;
  565. // Return early if there's no item.
  566. if (!item) {
  567. return;
  568. }
  569. const pinnedItems = registry.select(external_wp_preferences_namespaceObject.store).get(scope, 'pinnedItems'); // The item is already pinned, there's nothing to do.
  570. if ((pinnedItems === null || pinnedItems === void 0 ? void 0 : pinnedItems[item]) === true) {
  571. return;
  572. }
  573. registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, 'pinnedItems', { ...pinnedItems,
  574. [item]: true
  575. });
  576. };
  577. /**
  578. * Unpins an item.
  579. *
  580. * @param {string} scope Item scope.
  581. * @param {string} item Item identifier.
  582. */
  583. const unpinItem = (scope, item) => _ref4 => {
  584. let {
  585. registry
  586. } = _ref4;
  587. // Return early if there's no item.
  588. if (!item) {
  589. return;
  590. }
  591. const pinnedItems = registry.select(external_wp_preferences_namespaceObject.store).get(scope, 'pinnedItems');
  592. registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, 'pinnedItems', { ...pinnedItems,
  593. [item]: false
  594. });
  595. };
  596. /**
  597. * Returns an action object used in signalling that a feature should be toggled.
  598. *
  599. * @param {string} scope The feature scope (e.g. core/edit-post).
  600. * @param {string} featureName The feature name.
  601. */
  602. function toggleFeature(scope, featureName) {
  603. return function (_ref5) {
  604. let {
  605. registry
  606. } = _ref5;
  607. external_wp_deprecated_default()(`dispatch( 'core/interface' ).toggleFeature`, {
  608. since: '6.0',
  609. alternative: `dispatch( 'core/preferences' ).toggle`
  610. });
  611. registry.dispatch(external_wp_preferences_namespaceObject.store).toggle(scope, featureName);
  612. };
  613. }
  614. /**
  615. * Returns an action object used in signalling that a feature should be set to
  616. * a true or false value
  617. *
  618. * @param {string} scope The feature scope (e.g. core/edit-post).
  619. * @param {string} featureName The feature name.
  620. * @param {boolean} value The value to set.
  621. *
  622. * @return {Object} Action object.
  623. */
  624. function setFeatureValue(scope, featureName, value) {
  625. return function (_ref6) {
  626. let {
  627. registry
  628. } = _ref6;
  629. external_wp_deprecated_default()(`dispatch( 'core/interface' ).setFeatureValue`, {
  630. since: '6.0',
  631. alternative: `dispatch( 'core/preferences' ).set`
  632. });
  633. registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, featureName, !!value);
  634. };
  635. }
  636. /**
  637. * Returns an action object used in signalling that defaults should be set for features.
  638. *
  639. * @param {string} scope The feature scope (e.g. core/edit-post).
  640. * @param {Object<string, boolean>} defaults A key/value map of feature names to values.
  641. *
  642. * @return {Object} Action object.
  643. */
  644. function setFeatureDefaults(scope, defaults) {
  645. return function (_ref7) {
  646. let {
  647. registry
  648. } = _ref7;
  649. external_wp_deprecated_default()(`dispatch( 'core/interface' ).setFeatureDefaults`, {
  650. since: '6.0',
  651. alternative: `dispatch( 'core/preferences' ).setDefaults`
  652. });
  653. registry.dispatch(external_wp_preferences_namespaceObject.store).setDefaults(scope, defaults);
  654. };
  655. }
  656. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/selectors.js
  657. /**
  658. * WordPress dependencies
  659. */
  660. /**
  661. * Returns the complementary area that is active in a given scope.
  662. *
  663. * @param {Object} state Global application state.
  664. * @param {string} scope Item scope.
  665. *
  666. * @return {string} The complementary area that is active in the given scope.
  667. */
  668. const getActiveComplementaryArea = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, scope) => {
  669. return select(external_wp_preferences_namespaceObject.store).get(scope, 'complementaryArea');
  670. });
  671. /**
  672. * Returns a boolean indicating if an item is pinned or not.
  673. *
  674. * @param {Object} state Global application state.
  675. * @param {string} scope Scope.
  676. * @param {string} item Item to check.
  677. *
  678. * @return {boolean} True if the item is pinned and false otherwise.
  679. */
  680. const isItemPinned = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, scope, item) => {
  681. var _pinnedItems$item;
  682. const pinnedItems = select(external_wp_preferences_namespaceObject.store).get(scope, 'pinnedItems');
  683. return (_pinnedItems$item = pinnedItems === null || pinnedItems === void 0 ? void 0 : pinnedItems[item]) !== null && _pinnedItems$item !== void 0 ? _pinnedItems$item : true;
  684. });
  685. /**
  686. * Returns a boolean indicating whether a feature is active for a particular
  687. * scope.
  688. *
  689. * @param {Object} state The store state.
  690. * @param {string} scope The scope of the feature (e.g. core/edit-post).
  691. * @param {string} featureName The name of the feature.
  692. *
  693. * @return {boolean} Is the feature enabled?
  694. */
  695. const isFeatureActive = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, scope, featureName) => {
  696. external_wp_deprecated_default()(`select( 'core/interface' ).isFeatureActive( scope, featureName )`, {
  697. since: '6.0',
  698. alternative: `select( 'core/preferences' ).get( scope, featureName )`
  699. });
  700. return !!select(external_wp_preferences_namespaceObject.store).get(scope, featureName);
  701. });
  702. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/constants.js
  703. /**
  704. * The identifier for the data store.
  705. *
  706. * @type {string}
  707. */
  708. const constants_STORE_NAME = 'core/interface';
  709. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/index.js
  710. /**
  711. * WordPress dependencies
  712. */
  713. /**
  714. * Internal dependencies
  715. */
  716. /**
  717. * Store definition for the interface namespace.
  718. *
  719. * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore
  720. *
  721. * @type {Object}
  722. */
  723. const store_store = (0,external_wp_data_namespaceObject.createReduxStore)(constants_STORE_NAME, {
  724. reducer: () => {},
  725. actions: store_actions_namespaceObject,
  726. selectors: store_selectors_namespaceObject
  727. }); // Once we build a more generic persistence plugin that works across types of stores
  728. // we'd be able to replace this with a register call.
  729. (0,external_wp_data_namespaceObject.register)(store_store);
  730. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/index.js
  731. ;// CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/components/keyboard-shortcut-help-modal/config.js
  732. /**
  733. * WordPress dependencies
  734. */
  735. const textFormattingShortcuts = [{
  736. keyCombination: {
  737. modifier: 'primary',
  738. character: 'b'
  739. },
  740. description: (0,external_wp_i18n_namespaceObject.__)('Make the selected text bold.')
  741. }, {
  742. keyCombination: {
  743. modifier: 'primary',
  744. character: 'i'
  745. },
  746. description: (0,external_wp_i18n_namespaceObject.__)('Make the selected text italic.')
  747. }, {
  748. keyCombination: {
  749. modifier: 'primary',
  750. character: 'k'
  751. },
  752. description: (0,external_wp_i18n_namespaceObject.__)('Convert the selected text into a link.')
  753. }, {
  754. keyCombination: {
  755. modifier: 'primaryShift',
  756. character: 'k'
  757. },
  758. description: (0,external_wp_i18n_namespaceObject.__)('Remove a link.')
  759. }, {
  760. keyCombination: {
  761. modifier: 'primary',
  762. character: 'u'
  763. },
  764. description: (0,external_wp_i18n_namespaceObject.__)('Underline the selected text.')
  765. }];
  766. ;// CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/components/keyboard-shortcut-help-modal/shortcut.js
  767. /**
  768. * External dependencies
  769. */
  770. /**
  771. * WordPress dependencies
  772. */
  773. function KeyCombination(_ref) {
  774. let {
  775. keyCombination,
  776. forceAriaLabel
  777. } = _ref;
  778. const shortcut = keyCombination.modifier ? external_wp_keycodes_namespaceObject.displayShortcutList[keyCombination.modifier](keyCombination.character) : keyCombination.character;
  779. const ariaLabel = keyCombination.modifier ? external_wp_keycodes_namespaceObject.shortcutAriaLabel[keyCombination.modifier](keyCombination.character) : keyCombination.character;
  780. return (0,external_wp_element_namespaceObject.createElement)("kbd", {
  781. className: "customize-widgets-keyboard-shortcut-help-modal__shortcut-key-combination",
  782. "aria-label": forceAriaLabel || ariaLabel
  783. }, (0,external_lodash_namespaceObject.castArray)(shortcut).map((character, index) => {
  784. if (character === '+') {
  785. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, {
  786. key: index
  787. }, character);
  788. }
  789. return (0,external_wp_element_namespaceObject.createElement)("kbd", {
  790. key: index,
  791. className: "customize-widgets-keyboard-shortcut-help-modal__shortcut-key"
  792. }, character);
  793. }));
  794. }
  795. function Shortcut(_ref2) {
  796. let {
  797. description,
  798. keyCombination,
  799. aliases = [],
  800. ariaLabel
  801. } = _ref2;
  802. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("div", {
  803. className: "customize-widgets-keyboard-shortcut-help-modal__shortcut-description"
  804. }, description), (0,external_wp_element_namespaceObject.createElement)("div", {
  805. className: "customize-widgets-keyboard-shortcut-help-modal__shortcut-term"
  806. }, (0,external_wp_element_namespaceObject.createElement)(KeyCombination, {
  807. keyCombination: keyCombination,
  808. forceAriaLabel: ariaLabel
  809. }), aliases.map((alias, index) => (0,external_wp_element_namespaceObject.createElement)(KeyCombination, {
  810. keyCombination: alias,
  811. forceAriaLabel: ariaLabel,
  812. key: index
  813. }))));
  814. }
  815. /* harmony default export */ var keyboard_shortcut_help_modal_shortcut = (Shortcut);
  816. ;// CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js
  817. /**
  818. * WordPress dependencies
  819. */
  820. /**
  821. * Internal dependencies
  822. */
  823. function DynamicShortcut(_ref) {
  824. let {
  825. name
  826. } = _ref;
  827. const {
  828. keyCombination,
  829. description,
  830. aliases
  831. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  832. const {
  833. getShortcutKeyCombination,
  834. getShortcutDescription,
  835. getShortcutAliases
  836. } = select(external_wp_keyboardShortcuts_namespaceObject.store);
  837. return {
  838. keyCombination: getShortcutKeyCombination(name),
  839. aliases: getShortcutAliases(name),
  840. description: getShortcutDescription(name)
  841. };
  842. }, [name]);
  843. if (!keyCombination) {
  844. return null;
  845. }
  846. return (0,external_wp_element_namespaceObject.createElement)(keyboard_shortcut_help_modal_shortcut, {
  847. keyCombination: keyCombination,
  848. description: description,
  849. aliases: aliases
  850. });
  851. }
  852. /* harmony default export */ var dynamic_shortcut = (DynamicShortcut);
  853. ;// CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/components/keyboard-shortcut-help-modal/index.js
  854. /**
  855. * External dependencies
  856. */
  857. /**
  858. * WordPress dependencies
  859. */
  860. /**
  861. * Internal dependencies
  862. */
  863. const ShortcutList = _ref => {
  864. let {
  865. shortcuts
  866. } = _ref;
  867. return (
  868. /*
  869. * Disable reason: The `list` ARIA role is redundant but
  870. * Safari+VoiceOver won't announce the list otherwise.
  871. */
  872. /* eslint-disable jsx-a11y/no-redundant-roles */
  873. (0,external_wp_element_namespaceObject.createElement)("ul", {
  874. className: "customize-widgets-keyboard-shortcut-help-modal__shortcut-list",
  875. role: "list"
  876. }, shortcuts.map((shortcut, index) => (0,external_wp_element_namespaceObject.createElement)("li", {
  877. className: "customize-widgets-keyboard-shortcut-help-modal__shortcut",
  878. key: index
  879. }, (0,external_lodash_namespaceObject.isString)(shortcut) ? (0,external_wp_element_namespaceObject.createElement)(dynamic_shortcut, {
  880. name: shortcut
  881. }) : (0,external_wp_element_namespaceObject.createElement)(keyboard_shortcut_help_modal_shortcut, shortcut))))
  882. /* eslint-enable jsx-a11y/no-redundant-roles */
  883. );
  884. };
  885. const ShortcutSection = _ref2 => {
  886. let {
  887. title,
  888. shortcuts,
  889. className
  890. } = _ref2;
  891. return (0,external_wp_element_namespaceObject.createElement)("section", {
  892. className: classnames_default()('customize-widgets-keyboard-shortcut-help-modal__section', className)
  893. }, !!title && (0,external_wp_element_namespaceObject.createElement)("h2", {
  894. className: "customize-widgets-keyboard-shortcut-help-modal__section-title"
  895. }, title), (0,external_wp_element_namespaceObject.createElement)(ShortcutList, {
  896. shortcuts: shortcuts
  897. }));
  898. };
  899. const ShortcutCategorySection = _ref3 => {
  900. let {
  901. title,
  902. categoryName,
  903. additionalShortcuts = []
  904. } = _ref3;
  905. const categoryShortcuts = (0,external_wp_data_namespaceObject.useSelect)(select => {
  906. return select(external_wp_keyboardShortcuts_namespaceObject.store).getCategoryShortcuts(categoryName);
  907. }, [categoryName]);
  908. return (0,external_wp_element_namespaceObject.createElement)(ShortcutSection, {
  909. title: title,
  910. shortcuts: categoryShortcuts.concat(additionalShortcuts)
  911. });
  912. };
  913. function KeyboardShortcutHelpModal(_ref4) {
  914. let {
  915. isModalActive,
  916. toggleModal
  917. } = _ref4;
  918. const {
  919. registerShortcut
  920. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_keyboardShortcuts_namespaceObject.store);
  921. registerShortcut({
  922. name: 'core/customize-widgets/keyboard-shortcuts',
  923. category: 'main',
  924. description: (0,external_wp_i18n_namespaceObject.__)('Display these keyboard shortcuts.'),
  925. keyCombination: {
  926. modifier: 'access',
  927. character: 'h'
  928. }
  929. });
  930. (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/customize-widgets/keyboard-shortcuts', toggleModal);
  931. if (!isModalActive) {
  932. return null;
  933. }
  934. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, {
  935. className: "customize-widgets-keyboard-shortcut-help-modal",
  936. title: (0,external_wp_i18n_namespaceObject.__)('Keyboard shortcuts'),
  937. closeLabel: (0,external_wp_i18n_namespaceObject.__)('Close'),
  938. onRequestClose: toggleModal
  939. }, (0,external_wp_element_namespaceObject.createElement)(ShortcutSection, {
  940. className: "customize-widgets-keyboard-shortcut-help-modal__main-shortcuts",
  941. shortcuts: ['core/customize-widgets/keyboard-shortcuts']
  942. }), (0,external_wp_element_namespaceObject.createElement)(ShortcutCategorySection, {
  943. title: (0,external_wp_i18n_namespaceObject.__)('Global shortcuts'),
  944. categoryName: "global"
  945. }), (0,external_wp_element_namespaceObject.createElement)(ShortcutCategorySection, {
  946. title: (0,external_wp_i18n_namespaceObject.__)('Selection shortcuts'),
  947. categoryName: "selection"
  948. }), (0,external_wp_element_namespaceObject.createElement)(ShortcutCategorySection, {
  949. title: (0,external_wp_i18n_namespaceObject.__)('Block shortcuts'),
  950. categoryName: "block",
  951. additionalShortcuts: [{
  952. keyCombination: {
  953. character: '/'
  954. },
  955. description: (0,external_wp_i18n_namespaceObject.__)('Change the block type after adding a new paragraph.'),
  956. /* translators: The forward-slash character. e.g. '/'. */
  957. ariaLabel: (0,external_wp_i18n_namespaceObject.__)('Forward-slash')
  958. }]
  959. }), (0,external_wp_element_namespaceObject.createElement)(ShortcutSection, {
  960. title: (0,external_wp_i18n_namespaceObject.__)('Text formatting'),
  961. shortcuts: textFormattingShortcuts
  962. }));
  963. }
  964. ;// CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/components/more-menu/index.js
  965. /**
  966. * WordPress dependencies
  967. */
  968. /**
  969. * Internal dependencies
  970. */
  971. function MoreMenu() {
  972. const [isKeyboardShortcutsModalActive, setIsKeyboardShortcutsModalVisible] = (0,external_wp_element_namespaceObject.useState)(false);
  973. const toggleKeyboardShortcutsModal = () => setIsKeyboardShortcutsModalVisible(!isKeyboardShortcutsModalActive);
  974. (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/customize-widgets/keyboard-shortcuts', toggleKeyboardShortcutsModal);
  975. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(MoreMenuDropdown, {
  976. as: external_wp_components_namespaceObject.ToolbarDropdownMenu
  977. }, () => (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, {
  978. label: (0,external_wp_i18n_namespaceObject._x)('View', 'noun')
  979. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, {
  980. scope: "core/customize-widgets",
  981. name: "fixedToolbar",
  982. label: (0,external_wp_i18n_namespaceObject.__)('Top toolbar'),
  983. info: (0,external_wp_i18n_namespaceObject.__)('Access all block and document tools in a single place'),
  984. messageActivated: (0,external_wp_i18n_namespaceObject.__)('Top toolbar activated'),
  985. messageDeactivated: (0,external_wp_i18n_namespaceObject.__)('Top toolbar deactivated')
  986. })), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, {
  987. label: (0,external_wp_i18n_namespaceObject.__)('Tools')
  988. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
  989. onClick: () => {
  990. setIsKeyboardShortcutsModalVisible(true);
  991. },
  992. shortcut: external_wp_keycodes_namespaceObject.displayShortcut.access('h')
  993. }, (0,external_wp_i18n_namespaceObject.__)('Keyboard shortcuts')), (0,external_wp_element_namespaceObject.createElement)(external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, {
  994. scope: "core/customize-widgets",
  995. name: "welcomeGuide",
  996. label: (0,external_wp_i18n_namespaceObject.__)('Welcome Guide')
  997. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
  998. role: "menuitem",
  999. icon: library_external,
  1000. href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/support/article/block-based-widgets-editor/'),
  1001. target: "_blank",
  1002. rel: "noopener noreferrer"
  1003. }, (0,external_wp_i18n_namespaceObject.__)('Help'), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, {
  1004. as: "span"
  1005. },
  1006. /* translators: accessibility text */
  1007. (0,external_wp_i18n_namespaceObject.__)('(opens in a new tab)')))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, {
  1008. label: (0,external_wp_i18n_namespaceObject.__)('Preferences')
  1009. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, {
  1010. scope: "core/customize-widgets",
  1011. name: "keepCaretInsideBlock",
  1012. label: (0,external_wp_i18n_namespaceObject.__)('Contain text cursor inside block'),
  1013. info: (0,external_wp_i18n_namespaceObject.__)('Aids screen readers by stopping text caret from leaving blocks.'),
  1014. messageActivated: (0,external_wp_i18n_namespaceObject.__)('Contain text cursor inside block activated'),
  1015. messageDeactivated: (0,external_wp_i18n_namespaceObject.__)('Contain text cursor inside block deactivated')
  1016. })))), (0,external_wp_element_namespaceObject.createElement)(KeyboardShortcutHelpModal, {
  1017. isModalActive: isKeyboardShortcutsModalActive,
  1018. toggleModal: toggleKeyboardShortcutsModal
  1019. }));
  1020. }
  1021. ;// CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/components/header/index.js
  1022. /**
  1023. * External dependencies
  1024. */
  1025. /**
  1026. * WordPress dependencies
  1027. */
  1028. /**
  1029. * Internal dependencies
  1030. */
  1031. function Header(_ref) {
  1032. let {
  1033. sidebar,
  1034. inserter,
  1035. isInserterOpened,
  1036. setIsInserterOpened,
  1037. isFixedToolbarActive
  1038. } = _ref;
  1039. const [[hasUndo, hasRedo], setUndoRedo] = (0,external_wp_element_namespaceObject.useState)([sidebar.hasUndo(), sidebar.hasRedo()]);
  1040. (0,external_wp_element_namespaceObject.useEffect)(() => {
  1041. return sidebar.subscribeHistory(() => {
  1042. setUndoRedo([sidebar.hasUndo(), sidebar.hasRedo()]);
  1043. });
  1044. }, [sidebar]);
  1045. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("div", {
  1046. className: classnames_default()('customize-widgets-header', {
  1047. 'is-fixed-toolbar-active': isFixedToolbarActive
  1048. })
  1049. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.NavigableToolbar, {
  1050. className: "customize-widgets-header-toolbar",
  1051. "aria-label": (0,external_wp_i18n_namespaceObject.__)('Document tools')
  1052. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, {
  1053. icon: !(0,external_wp_i18n_namespaceObject.isRTL)() ? library_undo : library_redo
  1054. /* translators: button label text should, if possible, be under 16 characters. */
  1055. ,
  1056. label: (0,external_wp_i18n_namespaceObject.__)('Undo'),
  1057. shortcut: external_wp_keycodes_namespaceObject.displayShortcut.primary('z') // If there are no undo levels we don't want to actually disable this
  1058. // button, because it will remove focus for keyboard users.
  1059. // See: https://github.com/WordPress/gutenberg/issues/3486
  1060. ,
  1061. "aria-disabled": !hasUndo,
  1062. onClick: sidebar.undo,
  1063. className: "customize-widgets-editor-history-button undo-button"
  1064. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, {
  1065. icon: !(0,external_wp_i18n_namespaceObject.isRTL)() ? library_redo : library_undo
  1066. /* translators: button label text should, if possible, be under 16 characters. */
  1067. ,
  1068. label: (0,external_wp_i18n_namespaceObject.__)('Redo'),
  1069. shortcut: external_wp_keycodes_namespaceObject.displayShortcut.primaryShift('z') // If there are no undo levels we don't want to actually disable this
  1070. // button, because it will remove focus for keyboard users.
  1071. // See: https://github.com/WordPress/gutenberg/issues/3486
  1072. ,
  1073. "aria-disabled": !hasRedo,
  1074. onClick: sidebar.redo,
  1075. className: "customize-widgets-editor-history-button redo-button"
  1076. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, {
  1077. className: "customize-widgets-header-toolbar__inserter-toggle",
  1078. isPressed: isInserterOpened,
  1079. variant: "primary",
  1080. icon: library_plus,
  1081. label: (0,external_wp_i18n_namespaceObject._x)('Add block', 'Generic label for block inserter button'),
  1082. onClick: () => {
  1083. setIsInserterOpened(isOpen => !isOpen);
  1084. }
  1085. }), (0,external_wp_element_namespaceObject.createElement)(MoreMenu, null))), (0,external_wp_element_namespaceObject.createPortal)((0,external_wp_element_namespaceObject.createElement)(components_inserter, {
  1086. setIsOpened: setIsInserterOpened
  1087. }), inserter.contentContainer[0]));
  1088. }
  1089. /* harmony default export */ var header = (Header);
  1090. ;// CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/components/inserter/use-inserter.js
  1091. /**
  1092. * WordPress dependencies
  1093. */
  1094. /**
  1095. * Internal dependencies
  1096. */
  1097. function useInserter(inserter) {
  1098. const isInserterOpened = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).isInserterOpened(), []);
  1099. const {
  1100. setIsInserterOpened
  1101. } = (0,external_wp_data_namespaceObject.useDispatch)(store);
  1102. (0,external_wp_element_namespaceObject.useEffect)(() => {
  1103. if (isInserterOpened) {
  1104. inserter.open();
  1105. } else {
  1106. inserter.close();
  1107. }
  1108. }, [inserter, isInserterOpened]);
  1109. return [isInserterOpened, (0,external_wp_element_namespaceObject.useCallback)(updater => {
  1110. let isOpen = updater;
  1111. if (typeof updater === 'function') {
  1112. isOpen = updater((0,external_wp_data_namespaceObject.select)(store).isInserterOpened());
  1113. }
  1114. setIsInserterOpened(isOpen);
  1115. }, [setIsInserterOpened])];
  1116. }
  1117. ;// CONCATENATED MODULE: external ["wp","isShallowEqual"]
  1118. var external_wp_isShallowEqual_namespaceObject = window["wp"]["isShallowEqual"];
  1119. var external_wp_isShallowEqual_default = /*#__PURE__*/__webpack_require__.n(external_wp_isShallowEqual_namespaceObject);
  1120. ;// CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/utils.js
  1121. // @ts-check
  1122. /**
  1123. * WordPress dependencies
  1124. */
  1125. /**
  1126. * External dependencies
  1127. */
  1128. /**
  1129. * Convert settingId to widgetId.
  1130. *
  1131. * @param {string} settingId The setting id.
  1132. * @return {string} The widget id.
  1133. */
  1134. function settingIdToWidgetId(settingId) {
  1135. const matches = settingId.match(/^widget_(.+)(?:\[(\d+)\])$/);
  1136. if (matches) {
  1137. const idBase = matches[1];
  1138. const number = parseInt(matches[2], 10);
  1139. return `${idBase}-${number}`;
  1140. }
  1141. return settingId;
  1142. }
  1143. /**
  1144. * Transform a block to a customizable widget.
  1145. *
  1146. * @param {WPBlock} block The block to be transformed from.
  1147. * @param {Object} existingWidget The widget to be extended from.
  1148. * @return {Object} The transformed widget.
  1149. */
  1150. function blockToWidget(block) {
  1151. let existingWidget = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  1152. let widget;
  1153. const isValidLegacyWidgetBlock = block.name === 'core/legacy-widget' && (block.attributes.id || block.attributes.instance);
  1154. if (isValidLegacyWidgetBlock) {
  1155. if (block.attributes.id) {
  1156. // Widget that does not extend WP_Widget.
  1157. widget = {
  1158. id: block.attributes.id
  1159. };
  1160. } else {
  1161. const {
  1162. encoded,
  1163. hash,
  1164. raw,
  1165. ...rest
  1166. } = block.attributes.instance; // Widget that extends WP_Widget.
  1167. widget = {
  1168. idBase: block.attributes.idBase,
  1169. instance: { ...(existingWidget === null || existingWidget === void 0 ? void 0 : existingWidget.instance),
  1170. // Required only for the customizer.
  1171. is_widget_customizer_js_value: true,
  1172. encoded_serialized_instance: encoded,
  1173. instance_hash_key: hash,
  1174. raw_instance: raw,
  1175. ...rest
  1176. }
  1177. };
  1178. }
  1179. } else {
  1180. const instance = {
  1181. content: (0,external_wp_blocks_namespaceObject.serialize)(block)
  1182. };
  1183. widget = {
  1184. idBase: 'block',
  1185. widgetClass: 'WP_Widget_Block',
  1186. instance: {
  1187. raw_instance: instance
  1188. }
  1189. };
  1190. }
  1191. return { ...(0,external_lodash_namespaceObject.omit)(existingWidget, ['form', 'rendered']),
  1192. ...widget
  1193. };
  1194. }
  1195. /**
  1196. * Transform a widget to a block.
  1197. *
  1198. * @param {Object} widget The widget to be transformed from.
  1199. * @param {string} widget.id The widget id.
  1200. * @param {string} widget.idBase The id base of the widget.
  1201. * @param {number} widget.number The number/index of the widget.
  1202. * @param {Object} widget.instance The instance of the widget.
  1203. * @return {WPBlock} The transformed block.
  1204. */
  1205. function widgetToBlock(_ref) {
  1206. let {
  1207. id,
  1208. idBase,
  1209. number,
  1210. instance
  1211. } = _ref;
  1212. let block;
  1213. const {
  1214. encoded_serialized_instance: encoded,
  1215. instance_hash_key: hash,
  1216. raw_instance: raw,
  1217. ...rest
  1218. } = instance;
  1219. if (idBase === 'block') {
  1220. const parsedBlocks = (0,external_wp_blocks_namespaceObject.parse)(raw.content);
  1221. block = parsedBlocks.length ? parsedBlocks[0] : (0,external_wp_blocks_namespaceObject.createBlock)('core/paragraph', {});
  1222. } else if (number) {
  1223. // Widget that extends WP_Widget.
  1224. block = (0,external_wp_blocks_namespaceObject.createBlock)('core/legacy-widget', {
  1225. idBase,
  1226. instance: {
  1227. encoded,
  1228. hash,
  1229. raw,
  1230. ...rest
  1231. }
  1232. });
  1233. } else {
  1234. // Widget that does not extend WP_Widget.
  1235. block = (0,external_wp_blocks_namespaceObject.createBlock)('core/legacy-widget', {
  1236. id
  1237. });
  1238. }
  1239. return (0,external_wp_widgets_namespaceObject.addWidgetIdToBlock)(block, id);
  1240. }
  1241. ;// CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/components/sidebar-block-editor/use-sidebar-block-editor.js
  1242. /**
  1243. * External dependencies
  1244. */
  1245. /**
  1246. * WordPress dependencies
  1247. */
  1248. /**
  1249. * Internal dependencies
  1250. */
  1251. function widgetsToBlocks(widgets) {
  1252. return widgets.map(widget => widgetToBlock(widget));
  1253. }
  1254. function useSidebarBlockEditor(sidebar) {
  1255. const [blocks, setBlocks] = (0,external_wp_element_namespaceObject.useState)(() => widgetsToBlocks(sidebar.getWidgets()));
  1256. (0,external_wp_element_namespaceObject.useEffect)(() => {
  1257. return sidebar.subscribe((prevWidgets, nextWidgets) => {
  1258. setBlocks(prevBlocks => {
  1259. const prevWidgetsMap = new Map(prevWidgets.map(widget => [widget.id, widget]));
  1260. const prevBlocksMap = new Map(prevBlocks.map(block => [(0,external_wp_widgets_namespaceObject.getWidgetIdFromBlock)(block), block]));
  1261. const nextBlocks = nextWidgets.map(nextWidget => {
  1262. const prevWidget = prevWidgetsMap.get(nextWidget.id); // Bail out updates.
  1263. if (prevWidget && prevWidget === nextWidget) {
  1264. return prevBlocksMap.get(nextWidget.id);
  1265. }
  1266. return widgetToBlock(nextWidget);
  1267. }); // Bail out updates.
  1268. if (external_wp_isShallowEqual_default()(prevBlocks, nextBlocks)) {
  1269. return prevBlocks;
  1270. }
  1271. return nextBlocks;
  1272. });
  1273. });
  1274. }, [sidebar]);
  1275. const onChangeBlocks = (0,external_wp_element_namespaceObject.useCallback)(nextBlocks => {
  1276. setBlocks(prevBlocks => {
  1277. if (external_wp_isShallowEqual_default()(prevBlocks, nextBlocks)) {
  1278. return prevBlocks;
  1279. }
  1280. const prevBlocksMap = new Map(prevBlocks.map(block => [(0,external_wp_widgets_namespaceObject.getWidgetIdFromBlock)(block), block]));
  1281. const nextWidgets = nextBlocks.map(nextBlock => {
  1282. const widgetId = (0,external_wp_widgets_namespaceObject.getWidgetIdFromBlock)(nextBlock); // Update existing widgets.
  1283. if (widgetId && prevBlocksMap.has(widgetId)) {
  1284. const prevBlock = prevBlocksMap.get(widgetId);
  1285. const prevWidget = sidebar.getWidget(widgetId); // Bail out updates by returning the previous widgets.
  1286. // Deep equality is necessary until the block editor's internals changes.
  1287. if ((0,external_lodash_namespaceObject.isEqual)(nextBlock, prevBlock) && prevWidget) {
  1288. return prevWidget;
  1289. }
  1290. return blockToWidget(nextBlock, prevWidget);
  1291. } // Add a new widget.
  1292. return blockToWidget(nextBlock);
  1293. }); // Bail out updates if the updated widgets are the same.
  1294. if (external_wp_isShallowEqual_default()(sidebar.getWidgets(), nextWidgets)) {
  1295. return prevBlocks;
  1296. }
  1297. const addedWidgetIds = sidebar.setWidgets(nextWidgets);
  1298. return nextBlocks.reduce((updatedNextBlocks, nextBlock, index) => {
  1299. const addedWidgetId = addedWidgetIds[index];
  1300. if (addedWidgetId !== null) {
  1301. // Only create a new instance if necessary to prevent
  1302. // the whole editor from re-rendering on every edit.
  1303. if (updatedNextBlocks === nextBlocks) {
  1304. updatedNextBlocks = nextBlocks.slice();
  1305. }
  1306. updatedNextBlocks[index] = (0,external_wp_widgets_namespaceObject.addWidgetIdToBlock)(nextBlock, addedWidgetId);
  1307. }
  1308. return updatedNextBlocks;
  1309. }, nextBlocks);
  1310. });
  1311. }, [sidebar]);
  1312. return [blocks, onChangeBlocks, onChangeBlocks];
  1313. }
  1314. ;// CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/components/focus-control/index.js
  1315. /**
  1316. * WordPress dependencies
  1317. */
  1318. /**
  1319. * Internal dependencies
  1320. */
  1321. const FocusControlContext = (0,external_wp_element_namespaceObject.createContext)();
  1322. function FocusControl(_ref) {
  1323. let {
  1324. api,
  1325. sidebarControls,
  1326. children
  1327. } = _ref;
  1328. const [focusedWidgetIdRef, setFocusedWidgetIdRef] = (0,external_wp_element_namespaceObject.useState)({
  1329. current: null
  1330. });
  1331. const focusWidget = (0,external_wp_element_namespaceObject.useCallback)(widgetId => {
  1332. for (const sidebarControl of sidebarControls) {
  1333. const widgets = sidebarControl.setting.get();
  1334. if (widgets.includes(widgetId)) {
  1335. sidebarControl.sectionInstance.expand({
  1336. // Schedule it after the complete callback so that
  1337. // it won't be overridden by the "Back" button focus.
  1338. completeCallback() {
  1339. // Create a "ref-like" object every time to ensure
  1340. // the same widget id can also triggers the focus control.
  1341. setFocusedWidgetIdRef({
  1342. current: widgetId
  1343. });
  1344. }
  1345. });
  1346. break;
  1347. }
  1348. }
  1349. }, [sidebarControls]);
  1350. (0,external_wp_element_namespaceObject.useEffect)(() => {
  1351. function handleFocus(settingId) {
  1352. const widgetId = settingIdToWidgetId(settingId);
  1353. focusWidget(widgetId);
  1354. }
  1355. function handleReady() {
  1356. api.previewer.preview.bind('focus-control-for-setting', handleFocus);
  1357. }
  1358. api.previewer.bind('ready', handleReady);
  1359. return () => {
  1360. api.previewer.unbind('ready', handleReady);
  1361. api.previewer.preview.unbind('focus-control-for-setting', handleFocus);
  1362. };
  1363. }, [api, focusWidget]);
  1364. const context = (0,external_wp_element_namespaceObject.useMemo)(() => [focusedWidgetIdRef, focusWidget], [focusedWidgetIdRef, focusWidget]);
  1365. return (0,external_wp_element_namespaceObject.createElement)(FocusControlContext.Provider, {
  1366. value: context
  1367. }, children);
  1368. }
  1369. const useFocusControl = () => (0,external_wp_element_namespaceObject.useContext)(FocusControlContext);
  1370. ;// CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/components/focus-control/use-blocks-focus-control.js
  1371. /**
  1372. * WordPress dependencies
  1373. */
  1374. /**
  1375. * Internal dependencies
  1376. */
  1377. function useBlocksFocusControl(blocks) {
  1378. const {
  1379. selectBlock
  1380. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
  1381. const [focusedWidgetIdRef] = useFocusControl();
  1382. const blocksRef = (0,external_wp_element_namespaceObject.useRef)(blocks);
  1383. (0,external_wp_element_namespaceObject.useEffect)(() => {
  1384. blocksRef.current = blocks;
  1385. }, [blocks]);
  1386. (0,external_wp_element_namespaceObject.useEffect)(() => {
  1387. if (focusedWidgetIdRef.current) {
  1388. const focusedBlock = blocksRef.current.find(block => (0,external_wp_widgets_namespaceObject.getWidgetIdFromBlock)(block) === focusedWidgetIdRef.current);
  1389. if (focusedBlock) {
  1390. selectBlock(focusedBlock.clientId); // If the block is already being selected, the DOM node won't
  1391. // get focused again automatically.
  1392. // We select the DOM and focus it manually here.
  1393. const blockNode = document.querySelector(`[data-block="${focusedBlock.clientId}"]`);
  1394. blockNode === null || blockNode === void 0 ? void 0 : blockNode.focus();
  1395. }
  1396. }
  1397. }, [focusedWidgetIdRef, selectBlock]);
  1398. }
  1399. ;// CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/components/sidebar-block-editor/sidebar-editor-provider.js
  1400. /**
  1401. * WordPress dependencies
  1402. */
  1403. /**
  1404. * Internal dependencies
  1405. */
  1406. function SidebarEditorProvider(_ref) {
  1407. let {
  1408. sidebar,
  1409. settings,
  1410. children
  1411. } = _ref;
  1412. const [blocks, onInput, onChange] = useSidebarBlockEditor(sidebar);
  1413. useBlocksFocusControl(blocks);
  1414. return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockEditorProvider, {
  1415. value: blocks,
  1416. onInput: onInput,
  1417. onChange: onChange,
  1418. settings: settings,
  1419. useSubRegistry: false
  1420. }, children);
  1421. }
  1422. ;// CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/components/welcome-guide/index.js
  1423. /**
  1424. * WordPress dependencies
  1425. */
  1426. function WelcomeGuide(_ref) {
  1427. let {
  1428. sidebar
  1429. } = _ref;
  1430. const {
  1431. toggle
  1432. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store);
  1433. const isEntirelyBlockWidgets = sidebar.getWidgets().every(widget => widget.id.startsWith('block-'));
  1434. return (0,external_wp_element_namespaceObject.createElement)("div", {
  1435. className: "customize-widgets-welcome-guide"
  1436. }, (0,external_wp_element_namespaceObject.createElement)("div", {
  1437. className: "customize-widgets-welcome-guide__image__wrapper"
  1438. }, (0,external_wp_element_namespaceObject.createElement)("picture", null, (0,external_wp_element_namespaceObject.createElement)("source", {
  1439. srcSet: "https://s.w.org/images/block-editor/welcome-editor.svg",
  1440. media: "(prefers-reduced-motion: reduce)"
  1441. }), (0,external_wp_element_namespaceObject.createElement)("img", {
  1442. className: "customize-widgets-welcome-guide__image",
  1443. src: "https://s.w.org/images/block-editor/welcome-editor.gif",
  1444. width: "312",
  1445. height: "240",
  1446. alt: ""
  1447. }))), (0,external_wp_element_namespaceObject.createElement)("h1", {
  1448. className: "customize-widgets-welcome-guide__heading"
  1449. }, (0,external_wp_i18n_namespaceObject.__)('Welcome to block Widgets')), (0,external_wp_element_namespaceObject.createElement)("p", {
  1450. className: "customize-widgets-welcome-guide__text"
  1451. }, isEntirelyBlockWidgets ? (0,external_wp_i18n_namespaceObject.__)('Your theme provides different “block” areas for you to add and edit content. Try adding a search bar, social icons, or other types of blocks here and see how they’ll look on your site.') : (0,external_wp_i18n_namespaceObject.__)('You can now add any block to your site’s widget areas. Don’t worry, all of your favorite widgets still work flawlessly.')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  1452. className: "customize-widgets-welcome-guide__button",
  1453. variant: "primary",
  1454. onClick: () => toggle('core/customize-widgets', 'welcomeGuide')
  1455. }, (0,external_wp_i18n_namespaceObject.__)('Got it')), (0,external_wp_element_namespaceObject.createElement)("hr", {
  1456. className: "customize-widgets-welcome-guide__separator"
  1457. }), !isEntirelyBlockWidgets && (0,external_wp_element_namespaceObject.createElement)("p", {
  1458. className: "customize-widgets-welcome-guide__more-info"
  1459. }, (0,external_wp_i18n_namespaceObject.__)('Want to stick with the old widgets?'), (0,external_wp_element_namespaceObject.createElement)("br", null), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ExternalLink, {
  1460. href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/plugins/classic-widgets/')
  1461. }, (0,external_wp_i18n_namespaceObject.__)('Get the Classic Widgets plugin.'))), (0,external_wp_element_namespaceObject.createElement)("p", {
  1462. className: "customize-widgets-welcome-guide__more-info"
  1463. }, (0,external_wp_i18n_namespaceObject.__)('New to the block editor?'), (0,external_wp_element_namespaceObject.createElement)("br", null), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ExternalLink, {
  1464. href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/support/article/wordpress-editor/')
  1465. }, (0,external_wp_i18n_namespaceObject.__)("Here's a detailed guide."))));
  1466. }
  1467. ;// CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/components/keyboard-shortcuts/index.js
  1468. /**
  1469. * WordPress dependencies
  1470. */
  1471. function KeyboardShortcuts(_ref) {
  1472. let {
  1473. undo,
  1474. redo,
  1475. save
  1476. } = _ref;
  1477. (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/customize-widgets/undo', event => {
  1478. undo();
  1479. event.preventDefault();
  1480. });
  1481. (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/customize-widgets/redo', event => {
  1482. redo();
  1483. event.preventDefault();
  1484. });
  1485. (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/customize-widgets/save', event => {
  1486. event.preventDefault();
  1487. save();
  1488. });
  1489. return null;
  1490. }
  1491. function KeyboardShortcutsRegister() {
  1492. const {
  1493. registerShortcut,
  1494. unregisterShortcut
  1495. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_keyboardShortcuts_namespaceObject.store);
  1496. (0,external_wp_element_namespaceObject.useEffect)(() => {
  1497. registerShortcut({
  1498. name: 'core/customize-widgets/undo',
  1499. category: 'global',
  1500. description: (0,external_wp_i18n_namespaceObject.__)('Undo your last changes.'),
  1501. keyCombination: {
  1502. modifier: 'primary',
  1503. character: 'z'
  1504. }
  1505. });
  1506. registerShortcut({
  1507. name: 'core/customize-widgets/redo',
  1508. category: 'global',
  1509. description: (0,external_wp_i18n_namespaceObject.__)('Redo your last undo.'),
  1510. keyCombination: {
  1511. modifier: 'primaryShift',
  1512. character: 'z'
  1513. }
  1514. });
  1515. registerShortcut({
  1516. name: 'core/customize-widgets/save',
  1517. category: 'global',
  1518. description: (0,external_wp_i18n_namespaceObject.__)('Save your changes.'),
  1519. keyCombination: {
  1520. modifier: 'primary',
  1521. character: 's'
  1522. }
  1523. });
  1524. return () => {
  1525. unregisterShortcut('core/customize-widgets/undo');
  1526. unregisterShortcut('core/customize-widgets/redo');
  1527. unregisterShortcut('core/customize-widgets/save');
  1528. };
  1529. }, [registerShortcut]);
  1530. return null;
  1531. }
  1532. KeyboardShortcuts.Register = KeyboardShortcutsRegister;
  1533. /* harmony default export */ var keyboard_shortcuts = (KeyboardShortcuts);
  1534. ;// CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/components/block-appender/index.js
  1535. /**
  1536. * WordPress dependencies
  1537. */
  1538. function BlockAppender(props) {
  1539. const ref = (0,external_wp_element_namespaceObject.useRef)();
  1540. const isBlocksListEmpty = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blockEditor_namespaceObject.store).getBlockCount() === 0); // Move the focus to the block appender to prevent focus from
  1541. // being lost when emptying the widget area.
  1542. (0,external_wp_element_namespaceObject.useEffect)(() => {
  1543. if (isBlocksListEmpty && ref.current) {
  1544. const {
  1545. ownerDocument
  1546. } = ref.current;
  1547. if (!ownerDocument.activeElement || ownerDocument.activeElement === ownerDocument.body) {
  1548. ref.current.focus();
  1549. }
  1550. }
  1551. }, [isBlocksListEmpty]);
  1552. return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.ButtonBlockAppender, _extends({}, props, {
  1553. ref: ref
  1554. }));
  1555. }
  1556. ;// CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/components/sidebar-block-editor/index.js
  1557. /**
  1558. * External dependencies
  1559. */
  1560. /**
  1561. * WordPress dependencies
  1562. */
  1563. /**
  1564. * Internal dependencies
  1565. */
  1566. function SidebarBlockEditor(_ref) {
  1567. let {
  1568. blockEditorSettings,
  1569. sidebar,
  1570. inserter,
  1571. inspector
  1572. } = _ref;
  1573. const [isInserterOpened, setIsInserterOpened] = useInserter(inserter);
  1574. const {
  1575. hasUploadPermissions,
  1576. isFixedToolbarActive,
  1577. keepCaretInsideBlock,
  1578. isWelcomeGuideActive
  1579. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  1580. const {
  1581. get
  1582. } = select(external_wp_preferences_namespaceObject.store);
  1583. return {
  1584. hasUploadPermissions: (0,external_lodash_namespaceObject.defaultTo)(select(external_wp_coreData_namespaceObject.store).canUser('create', 'media'), true),
  1585. isFixedToolbarActive: !!get('core/customize-widgets', 'fixedToolbar'),
  1586. keepCaretInsideBlock: !!get('core/customize-widgets', 'keepCaretInsideBlock'),
  1587. isWelcomeGuideActive: !!get('core/customize-widgets', 'welcomeGuide')
  1588. };
  1589. }, []);
  1590. const settings = (0,external_wp_element_namespaceObject.useMemo)(() => {
  1591. let mediaUploadBlockEditor;
  1592. if (hasUploadPermissions) {
  1593. mediaUploadBlockEditor = _ref2 => {
  1594. let {
  1595. onError,
  1596. ...argumentsObject
  1597. } = _ref2;
  1598. (0,external_wp_mediaUtils_namespaceObject.uploadMedia)({
  1599. wpAllowedMimeTypes: blockEditorSettings.allowedMimeTypes,
  1600. onError: _ref3 => {
  1601. let {
  1602. message
  1603. } = _ref3;
  1604. return onError(message);
  1605. },
  1606. ...argumentsObject
  1607. });
  1608. };
  1609. }
  1610. return { ...blockEditorSettings,
  1611. __experimentalSetIsInserterOpened: setIsInserterOpened,
  1612. mediaUpload: mediaUploadBlockEditor,
  1613. hasFixedToolbar: isFixedToolbarActive,
  1614. keepCaretInsideBlock,
  1615. __unstableHasCustomAppender: true
  1616. };
  1617. }, [hasUploadPermissions, blockEditorSettings, isFixedToolbarActive, keepCaretInsideBlock, setIsInserterOpened]);
  1618. if (isWelcomeGuideActive) {
  1619. return (0,external_wp_element_namespaceObject.createElement)(WelcomeGuide, {
  1620. sidebar: sidebar
  1621. });
  1622. }
  1623. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockEditorKeyboardShortcuts.Register, null), (0,external_wp_element_namespaceObject.createElement)(keyboard_shortcuts.Register, null), (0,external_wp_element_namespaceObject.createElement)(SidebarEditorProvider, {
  1624. sidebar: sidebar,
  1625. settings: settings
  1626. }, (0,external_wp_element_namespaceObject.createElement)(keyboard_shortcuts, {
  1627. undo: sidebar.undo,
  1628. redo: sidebar.redo,
  1629. save: sidebar.save
  1630. }), (0,external_wp_element_namespaceObject.createElement)(header, {
  1631. sidebar: sidebar,
  1632. inserter: inserter,
  1633. isInserterOpened: isInserterOpened,
  1634. setIsInserterOpened: setIsInserterOpened,
  1635. isFixedToolbarActive: isFixedToolbarActive
  1636. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.CopyHandler, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockTools, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__unstableEditorStyles, {
  1637. styles: settings.defaultEditorStyles
  1638. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockSelectionClearer, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.WritingFlow, {
  1639. className: "editor-styles-wrapper"
  1640. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.ObserveTyping, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockList, {
  1641. renderAppender: BlockAppender
  1642. })))))), (0,external_wp_element_namespaceObject.createPortal)( // This is a temporary hack to prevent button component inside <BlockInspector>
  1643. // from submitting form when type="button" is not specified.
  1644. (0,external_wp_element_namespaceObject.createElement)("form", {
  1645. onSubmit: event => event.preventDefault()
  1646. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockInspector, null)), inspector.contentContainer[0])), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__unstableBlockSettingsMenuFirstItem, null, _ref4 => {
  1647. let {
  1648. onClose
  1649. } = _ref4;
  1650. return (0,external_wp_element_namespaceObject.createElement)(block_inspector_button, {
  1651. inspector: inspector,
  1652. closeMenu: onClose
  1653. });
  1654. }));
  1655. }
  1656. ;// CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/components/sidebar-controls/index.js
  1657. /**
  1658. * WordPress dependencies
  1659. */
  1660. const SidebarControlsContext = (0,external_wp_element_namespaceObject.createContext)();
  1661. function SidebarControls(_ref) {
  1662. let {
  1663. sidebarControls,
  1664. activeSidebarControl,
  1665. children
  1666. } = _ref;
  1667. const context = (0,external_wp_element_namespaceObject.useMemo)(() => ({
  1668. sidebarControls,
  1669. activeSidebarControl
  1670. }), [sidebarControls, activeSidebarControl]);
  1671. return (0,external_wp_element_namespaceObject.createElement)(SidebarControlsContext.Provider, {
  1672. value: context
  1673. }, children);
  1674. }
  1675. function useSidebarControls() {
  1676. const {
  1677. sidebarControls
  1678. } = (0,external_wp_element_namespaceObject.useContext)(SidebarControlsContext);
  1679. return sidebarControls;
  1680. }
  1681. function useActiveSidebarControl() {
  1682. const {
  1683. activeSidebarControl
  1684. } = (0,external_wp_element_namespaceObject.useContext)(SidebarControlsContext);
  1685. return activeSidebarControl;
  1686. }
  1687. ;// CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/components/customize-widgets/use-clear-selected-block.js
  1688. /**
  1689. * WordPress dependencies
  1690. */
  1691. /**
  1692. * We can't just use <BlockSelectionClearer> because the customizer has
  1693. * many root nodes rather than just one in the post editor.
  1694. * We need to listen to the focus events in all those roots, and also in
  1695. * the preview iframe.
  1696. * This hook will clear the selected block when focusing outside the editor,
  1697. * with a few exceptions:
  1698. * 1. Focusing on popovers.
  1699. * 2. Focusing on the inspector.
  1700. * 3. Focusing on any modals/dialogs.
  1701. * These cases are normally triggered by user interactions from the editor,
  1702. * not by explicitly focusing outside the editor, hence no need for clearing.
  1703. *
  1704. * @param {Object} sidebarControl The sidebar control instance.
  1705. * @param {Object} popoverRef The ref object of the popover node container.
  1706. */
  1707. function useClearSelectedBlock(sidebarControl, popoverRef) {
  1708. const {
  1709. hasSelectedBlock,
  1710. hasMultiSelection
  1711. } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store);
  1712. const {
  1713. clearSelectedBlock
  1714. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
  1715. (0,external_wp_element_namespaceObject.useEffect)(() => {
  1716. if (popoverRef.current && sidebarControl) {
  1717. const inspector = sidebarControl.inspector;
  1718. const container = sidebarControl.container[0];
  1719. const ownerDocument = container.ownerDocument;
  1720. const ownerWindow = ownerDocument.defaultView;
  1721. function handleClearSelectedBlock(element) {
  1722. if ( // 1. Make sure there are blocks being selected.
  1723. (hasSelectedBlock() || hasMultiSelection()) && // 2. The element should exist in the DOM (not deleted).
  1724. element && ownerDocument.contains(element) && // 3. It should also not exist in the container, the popover, nor the dialog.
  1725. !container.contains(element) && !popoverRef.current.contains(element) && !element.closest('[role="dialog"]') && // 4. The inspector should not be opened.
  1726. !inspector.expanded()) {
  1727. clearSelectedBlock();
  1728. }
  1729. } // Handle mouse down in the same document.
  1730. function handleMouseDown(event) {
  1731. handleClearSelectedBlock(event.target);
  1732. } // Handle focusing outside the current document, like to iframes.
  1733. function handleBlur() {
  1734. handleClearSelectedBlock(ownerDocument.activeElement);
  1735. }
  1736. ownerDocument.addEventListener('mousedown', handleMouseDown);
  1737. ownerWindow.addEventListener('blur', handleBlur);
  1738. return () => {
  1739. ownerDocument.removeEventListener('mousedown', handleMouseDown);
  1740. ownerWindow.removeEventListener('blur', handleBlur);
  1741. };
  1742. }
  1743. }, [popoverRef, sidebarControl, hasSelectedBlock, hasMultiSelection, clearSelectedBlock]);
  1744. }
  1745. ;// CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/components/customize-widgets/index.js
  1746. /**
  1747. * WordPress dependencies
  1748. */
  1749. /**
  1750. * Internal dependencies
  1751. */
  1752. function CustomizeWidgets(_ref) {
  1753. let {
  1754. api,
  1755. sidebarControls,
  1756. blockEditorSettings
  1757. } = _ref;
  1758. const [activeSidebarControl, setActiveSidebarControl] = (0,external_wp_element_namespaceObject.useState)(null);
  1759. const parentContainer = document.getElementById('customize-theme-controls');
  1760. const popoverRef = (0,external_wp_element_namespaceObject.useRef)();
  1761. useClearSelectedBlock(activeSidebarControl, popoverRef);
  1762. (0,external_wp_element_namespaceObject.useEffect)(() => {
  1763. const unsubscribers = sidebarControls.map(sidebarControl => sidebarControl.subscribe(expanded => {
  1764. if (expanded) {
  1765. setActiveSidebarControl(sidebarControl);
  1766. }
  1767. }));
  1768. return () => {
  1769. unsubscribers.forEach(unsubscriber => unsubscriber());
  1770. };
  1771. }, [sidebarControls]);
  1772. const activeSidebar = activeSidebarControl && (0,external_wp_element_namespaceObject.createPortal)((0,external_wp_element_namespaceObject.createElement)(ErrorBoundary, null, (0,external_wp_element_namespaceObject.createElement)(SidebarBlockEditor, {
  1773. key: activeSidebarControl.id,
  1774. blockEditorSettings: blockEditorSettings,
  1775. sidebar: activeSidebarControl.sidebarAdapter,
  1776. inserter: activeSidebarControl.inserter,
  1777. inspector: activeSidebarControl.inspector
  1778. })), activeSidebarControl.container[0]); // We have to portal this to the parent of both the editor and the inspector,
  1779. // so that the popovers will appear above both of them.
  1780. const popover = parentContainer && (0,external_wp_element_namespaceObject.createPortal)((0,external_wp_element_namespaceObject.createElement)("div", {
  1781. className: "customize-widgets-popover",
  1782. ref: popoverRef
  1783. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Popover.Slot, null)), parentContainer);
  1784. return (0,external_wp_element_namespaceObject.createElement)(external_wp_keyboardShortcuts_namespaceObject.ShortcutProvider, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SlotFillProvider, null, (0,external_wp_element_namespaceObject.createElement)(SidebarControls, {
  1785. sidebarControls: sidebarControls,
  1786. activeSidebarControl: activeSidebarControl
  1787. }, (0,external_wp_element_namespaceObject.createElement)(FocusControl, {
  1788. api: api,
  1789. sidebarControls: sidebarControls
  1790. }, activeSidebar, popover))));
  1791. }
  1792. ;// CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/controls/inspector-section.js
  1793. function getInspectorSection() {
  1794. const {
  1795. wp: {
  1796. customize
  1797. }
  1798. } = window;
  1799. return class InspectorSection extends customize.Section {
  1800. constructor(id, options) {
  1801. super(id, options);
  1802. this.parentSection = options.parentSection;
  1803. this.returnFocusWhenClose = null;
  1804. this._isOpen = false;
  1805. }
  1806. get isOpen() {
  1807. return this._isOpen;
  1808. }
  1809. set isOpen(value) {
  1810. this._isOpen = value;
  1811. this.triggerActiveCallbacks();
  1812. }
  1813. ready() {
  1814. this.contentContainer[0].classList.add('customize-widgets-layout__inspector');
  1815. }
  1816. isContextuallyActive() {
  1817. return this.isOpen;
  1818. }
  1819. onChangeExpanded(expanded, args) {
  1820. super.onChangeExpanded(expanded, args);
  1821. if (this.parentSection && !args.unchanged) {
  1822. if (expanded) {
  1823. this.parentSection.collapse({
  1824. manualTransition: true
  1825. });
  1826. } else {
  1827. this.parentSection.expand({
  1828. manualTransition: true,
  1829. completeCallback: () => {
  1830. // Return focus after finishing the transition.
  1831. if (this.returnFocusWhenClose && !this.contentContainer[0].contains(this.returnFocusWhenClose)) {
  1832. this.returnFocusWhenClose.focus();
  1833. }
  1834. }
  1835. });
  1836. }
  1837. }
  1838. }
  1839. open() {
  1840. let {
  1841. returnFocusWhenClose
  1842. } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  1843. this.isOpen = true;
  1844. this.returnFocusWhenClose = returnFocusWhenClose;
  1845. this.expand({
  1846. allowMultiple: true
  1847. });
  1848. }
  1849. close() {
  1850. this.collapse({
  1851. allowMultiple: true
  1852. });
  1853. }
  1854. collapse(options) {
  1855. // Overridden collapse() function. Mostly call the parent collapse(), but also
  1856. // move our .isOpen to false.
  1857. // Initially, I tried tracking this with onChangeExpanded(), but it doesn't work
  1858. // because the block settings sidebar is a layer "on top of" the G editor sidebar.
  1859. //
  1860. // For example, when closing the block settings sidebar, the G
  1861. // editor sidebar would display, and onChangeExpanded in
  1862. // inspector-section would run with expanded=true, but I want
  1863. // isOpen to be false when the block settings is closed.
  1864. this.isOpen = false;
  1865. super.collapse(options);
  1866. }
  1867. triggerActiveCallbacks() {
  1868. // Manually fire the callbacks associated with moving this.active
  1869. // from false to true. "active" is always true for this section,
  1870. // and "isContextuallyActive" reflects if the block settings
  1871. // sidebar is currently visible, that is, it has replaced the main
  1872. // Gutenberg view.
  1873. // The WP customizer only checks ".isContextuallyActive()" when
  1874. // ".active" changes values. But our ".active" never changes value.
  1875. // The WP customizer never foresaw a section being used a way we
  1876. // fit the block settings sidebar into a section. By manually
  1877. // triggering the "this.active" callbacks, we force the WP
  1878. // customizer to query our .isContextuallyActive() function and
  1879. // update its view of our status.
  1880. this.active.callbacks.fireWith(this.active, [false, true]);
  1881. }
  1882. };
  1883. }
  1884. ;// CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/controls/sidebar-section.js
  1885. /**
  1886. * WordPress dependencies
  1887. */
  1888. /**
  1889. * Internal dependencies
  1890. */
  1891. const getInspectorSectionId = sidebarId => `widgets-inspector-${sidebarId}`;
  1892. function getSidebarSection() {
  1893. const {
  1894. wp: {
  1895. customize
  1896. }
  1897. } = window;
  1898. const reduceMotionMediaQuery = window.matchMedia('(prefers-reduced-motion: reduce)');
  1899. let isReducedMotion = reduceMotionMediaQuery.matches;
  1900. reduceMotionMediaQuery.addEventListener('change', event => {
  1901. isReducedMotion = event.matches;
  1902. });
  1903. return class SidebarSection extends customize.Section {
  1904. ready() {
  1905. const InspectorSection = getInspectorSection();
  1906. this.inspector = new InspectorSection(getInspectorSectionId(this.id), {
  1907. title: (0,external_wp_i18n_namespaceObject.__)('Block Settings'),
  1908. parentSection: this,
  1909. customizeAction: [(0,external_wp_i18n_namespaceObject.__)('Customizing'), (0,external_wp_i18n_namespaceObject.__)('Widgets'), this.params.title].join(' ▸ ')
  1910. });
  1911. customize.section.add(this.inspector);
  1912. this.contentContainer[0].classList.add('customize-widgets__sidebar-section');
  1913. }
  1914. hasSubSectionOpened() {
  1915. return this.inspector.expanded();
  1916. }
  1917. onChangeExpanded(expanded, _args) {
  1918. const controls = this.controls();
  1919. const args = { ..._args,
  1920. completeCallback() {
  1921. var _args$completeCallbac;
  1922. controls.forEach(control => {
  1923. var _control$onChangeSect;
  1924. (_control$onChangeSect = control.onChangeSectionExpanded) === null || _control$onChangeSect === void 0 ? void 0 : _control$onChangeSect.call(control, expanded, args);
  1925. });
  1926. (_args$completeCallbac = _args.completeCallback) === null || _args$completeCallbac === void 0 ? void 0 : _args$completeCallbac.call(_args);
  1927. }
  1928. };
  1929. if (args.manualTransition) {
  1930. if (expanded) {
  1931. this.contentContainer.addClass(['busy', 'open']);
  1932. this.contentContainer.removeClass('is-sub-section-open');
  1933. this.contentContainer.closest('.wp-full-overlay').addClass('section-open');
  1934. } else {
  1935. this.contentContainer.addClass(['busy', 'is-sub-section-open']);
  1936. this.contentContainer.closest('.wp-full-overlay').addClass('section-open');
  1937. this.contentContainer.removeClass('open');
  1938. }
  1939. const handleTransitionEnd = () => {
  1940. this.contentContainer.removeClass('busy');
  1941. args.completeCallback();
  1942. };
  1943. if (isReducedMotion) {
  1944. handleTransitionEnd();
  1945. } else {
  1946. this.contentContainer.one('transitionend', handleTransitionEnd);
  1947. }
  1948. } else {
  1949. super.onChangeExpanded(expanded, args);
  1950. }
  1951. }
  1952. };
  1953. }
  1954. ;// CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/components/sidebar-block-editor/sidebar-adapter.js
  1955. /**
  1956. * Internal dependencies
  1957. */
  1958. const {
  1959. wp
  1960. } = window;
  1961. function parseWidgetId(widgetId) {
  1962. const matches = widgetId.match(/^(.+)-(\d+)$/);
  1963. if (matches) {
  1964. return {
  1965. idBase: matches[1],
  1966. number: parseInt(matches[2], 10)
  1967. };
  1968. } // Likely an old single widget.
  1969. return {
  1970. idBase: widgetId
  1971. };
  1972. }
  1973. function widgetIdToSettingId(widgetId) {
  1974. const {
  1975. idBase,
  1976. number
  1977. } = parseWidgetId(widgetId);
  1978. if (number) {
  1979. return `widget_${idBase}[${number}]`;
  1980. }
  1981. return `widget_${idBase}`;
  1982. }
  1983. /**
  1984. * This is a custom debounce function to call different callbacks depending on
  1985. * whether it's the _leading_ call or not.
  1986. *
  1987. * @param {Function} leading The callback that gets called first.
  1988. * @param {Function} callback The callback that gets called after the first time.
  1989. * @param {number} timeout The debounced time in milliseconds.
  1990. * @return {Function} The debounced function.
  1991. */
  1992. function debounce(leading, callback, timeout) {
  1993. let isLeading = false;
  1994. let timerID;
  1995. function debounced() {
  1996. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  1997. args[_key] = arguments[_key];
  1998. }
  1999. const result = (isLeading ? callback : leading).apply(this, args);
  2000. isLeading = true;
  2001. clearTimeout(timerID);
  2002. timerID = setTimeout(() => {
  2003. isLeading = false;
  2004. }, timeout);
  2005. return result;
  2006. }
  2007. debounced.cancel = () => {
  2008. isLeading = false;
  2009. clearTimeout(timerID);
  2010. };
  2011. return debounced;
  2012. }
  2013. class SidebarAdapter {
  2014. constructor(setting, api) {
  2015. this.setting = setting;
  2016. this.api = api;
  2017. this.locked = false;
  2018. this.widgetsCache = new WeakMap();
  2019. this.subscribers = new Set();
  2020. this.history = [this._getWidgetIds().map(widgetId => this.getWidget(widgetId))];
  2021. this.historyIndex = 0;
  2022. this.historySubscribers = new Set(); // Debounce the input for 1 second.
  2023. this._debounceSetHistory = debounce(this._pushHistory, this._replaceHistory, 1000);
  2024. this.setting.bind(this._handleSettingChange.bind(this));
  2025. this.api.bind('change', this._handleAllSettingsChange.bind(this));
  2026. this.undo = this.undo.bind(this);
  2027. this.redo = this.redo.bind(this);
  2028. this.save = this.save.bind(this);
  2029. }
  2030. subscribe(callback) {
  2031. this.subscribers.add(callback);
  2032. return () => {
  2033. this.subscribers.delete(callback);
  2034. };
  2035. }
  2036. getWidgets() {
  2037. return this.history[this.historyIndex];
  2038. }
  2039. _emit() {
  2040. for (const callback of this.subscribers) {
  2041. callback(...arguments);
  2042. }
  2043. }
  2044. _getWidgetIds() {
  2045. return this.setting.get();
  2046. }
  2047. _pushHistory() {
  2048. this.history = [...this.history.slice(0, this.historyIndex + 1), this._getWidgetIds().map(widgetId => this.getWidget(widgetId))];
  2049. this.historyIndex += 1;
  2050. this.historySubscribers.forEach(listener => listener());
  2051. }
  2052. _replaceHistory() {
  2053. this.history[this.historyIndex] = this._getWidgetIds().map(widgetId => this.getWidget(widgetId));
  2054. }
  2055. _handleSettingChange() {
  2056. if (this.locked) {
  2057. return;
  2058. }
  2059. const prevWidgets = this.getWidgets();
  2060. this._pushHistory();
  2061. this._emit(prevWidgets, this.getWidgets());
  2062. }
  2063. _handleAllSettingsChange(setting) {
  2064. if (this.locked) {
  2065. return;
  2066. }
  2067. if (!setting.id.startsWith('widget_')) {
  2068. return;
  2069. }
  2070. const widgetId = settingIdToWidgetId(setting.id);
  2071. if (!this.setting.get().includes(widgetId)) {
  2072. return;
  2073. }
  2074. const prevWidgets = this.getWidgets();
  2075. this._pushHistory();
  2076. this._emit(prevWidgets, this.getWidgets());
  2077. }
  2078. _createWidget(widget) {
  2079. const widgetModel = wp.customize.Widgets.availableWidgets.findWhere({
  2080. id_base: widget.idBase
  2081. });
  2082. let number = widget.number;
  2083. if (widgetModel.get('is_multi') && !number) {
  2084. widgetModel.set('multi_number', widgetModel.get('multi_number') + 1);
  2085. number = widgetModel.get('multi_number');
  2086. }
  2087. const settingId = number ? `widget_${widget.idBase}[${number}]` : `widget_${widget.idBase}`;
  2088. const settingArgs = {
  2089. transport: wp.customize.Widgets.data.selectiveRefreshableWidgets[widgetModel.get('id_base')] ? 'postMessage' : 'refresh',
  2090. previewer: this.setting.previewer
  2091. };
  2092. const setting = this.api.create(settingId, settingId, '', settingArgs);
  2093. setting.set(widget.instance);
  2094. const widgetId = settingIdToWidgetId(settingId);
  2095. return widgetId;
  2096. }
  2097. _removeWidget(widget) {
  2098. const settingId = widgetIdToSettingId(widget.id);
  2099. const setting = this.api(settingId);
  2100. if (setting) {
  2101. const instance = setting.get();
  2102. this.widgetsCache.delete(instance);
  2103. }
  2104. this.api.remove(settingId);
  2105. }
  2106. _updateWidget(widget) {
  2107. const prevWidget = this.getWidget(widget.id); // Bail out update if nothing changed.
  2108. if (prevWidget === widget) {
  2109. return widget.id;
  2110. } // Update existing setting if only the widget's instance changed.
  2111. if (prevWidget.idBase && widget.idBase && prevWidget.idBase === widget.idBase) {
  2112. const settingId = widgetIdToSettingId(widget.id);
  2113. this.api(settingId).set(widget.instance);
  2114. return widget.id;
  2115. } // Otherwise delete and re-create.
  2116. this._removeWidget(widget);
  2117. return this._createWidget(widget);
  2118. }
  2119. getWidget(widgetId) {
  2120. if (!widgetId) {
  2121. return null;
  2122. }
  2123. const {
  2124. idBase,
  2125. number
  2126. } = parseWidgetId(widgetId);
  2127. const settingId = widgetIdToSettingId(widgetId);
  2128. const setting = this.api(settingId);
  2129. if (!setting) {
  2130. return null;
  2131. }
  2132. const instance = setting.get();
  2133. if (this.widgetsCache.has(instance)) {
  2134. return this.widgetsCache.get(instance);
  2135. }
  2136. const widget = {
  2137. id: widgetId,
  2138. idBase,
  2139. number,
  2140. instance
  2141. };
  2142. this.widgetsCache.set(instance, widget);
  2143. return widget;
  2144. }
  2145. _updateWidgets(nextWidgets) {
  2146. this.locked = true;
  2147. const addedWidgetIds = [];
  2148. const nextWidgetIds = nextWidgets.map(nextWidget => {
  2149. if (nextWidget.id && this.getWidget(nextWidget.id)) {
  2150. addedWidgetIds.push(null);
  2151. return this._updateWidget(nextWidget);
  2152. }
  2153. const widgetId = this._createWidget(nextWidget);
  2154. addedWidgetIds.push(widgetId);
  2155. return widgetId;
  2156. });
  2157. const deletedWidgets = this.getWidgets().filter(widget => !nextWidgetIds.includes(widget.id));
  2158. deletedWidgets.forEach(widget => this._removeWidget(widget));
  2159. this.setting.set(nextWidgetIds);
  2160. this.locked = false;
  2161. return addedWidgetIds;
  2162. }
  2163. setWidgets(nextWidgets) {
  2164. const addedWidgetIds = this._updateWidgets(nextWidgets);
  2165. this._debounceSetHistory();
  2166. return addedWidgetIds;
  2167. }
  2168. /**
  2169. * Undo/Redo related features
  2170. */
  2171. hasUndo() {
  2172. return this.historyIndex > 0;
  2173. }
  2174. hasRedo() {
  2175. return this.historyIndex < this.history.length - 1;
  2176. }
  2177. _seek(historyIndex) {
  2178. const currentWidgets = this.getWidgets();
  2179. this.historyIndex = historyIndex;
  2180. const widgets = this.history[this.historyIndex];
  2181. this._updateWidgets(widgets);
  2182. this._emit(currentWidgets, this.getWidgets());
  2183. this.historySubscribers.forEach(listener => listener());
  2184. this._debounceSetHistory.cancel();
  2185. }
  2186. undo() {
  2187. if (!this.hasUndo()) {
  2188. return;
  2189. }
  2190. this._seek(this.historyIndex - 1);
  2191. }
  2192. redo() {
  2193. if (!this.hasRedo()) {
  2194. return;
  2195. }
  2196. this._seek(this.historyIndex + 1);
  2197. }
  2198. subscribeHistory(listener) {
  2199. this.historySubscribers.add(listener);
  2200. return () => {
  2201. this.historySubscribers.delete(listener);
  2202. };
  2203. }
  2204. save() {
  2205. this.api.previewer.save();
  2206. }
  2207. }
  2208. ;// CONCATENATED MODULE: external ["wp","dom"]
  2209. var external_wp_dom_namespaceObject = window["wp"]["dom"];
  2210. ;// CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/controls/inserter-outer-section.js
  2211. /**
  2212. * WordPress dependencies
  2213. */
  2214. /**
  2215. * Internal dependencies
  2216. */
  2217. function getInserterOuterSection() {
  2218. const {
  2219. wp: {
  2220. customize
  2221. }
  2222. } = window;
  2223. const OuterSection = customize.OuterSection; // Override the OuterSection class to handle multiple outer sections.
  2224. // It closes all the other outer sections whenever one is opened.
  2225. // The result is that at most one outer section can be opened at the same time.
  2226. customize.OuterSection = class extends OuterSection {
  2227. onChangeExpanded(expanded, args) {
  2228. if (expanded) {
  2229. customize.section.each(section => {
  2230. if (section.params.type === 'outer' && section.id !== this.id) {
  2231. if (section.expanded()) {
  2232. section.collapse();
  2233. }
  2234. }
  2235. });
  2236. }
  2237. return super.onChangeExpanded(expanded, args);
  2238. }
  2239. }; // Handle constructor so that "params.type" can be correctly pointed to "outer".
  2240. customize.sectionConstructor.outer = customize.OuterSection;
  2241. return class InserterOuterSection extends customize.OuterSection {
  2242. constructor() {
  2243. super(...arguments); // This is necessary since we're creating a new class which is not identical to the original OuterSection.
  2244. // @See https://github.com/WordPress/wordpress-develop/blob/42b05c397c50d9dc244083eff52991413909d4bd/src/js/_enqueues/wp/customize/controls.js#L1427-L1436
  2245. this.params.type = 'outer';
  2246. this.activeElementBeforeExpanded = null;
  2247. const ownerWindow = this.contentContainer[0].ownerDocument.defaultView; // Handle closing the inserter when pressing the Escape key.
  2248. ownerWindow.addEventListener('keydown', event => {
  2249. if (this.expanded() && (event.keyCode === external_wp_keycodes_namespaceObject.ESCAPE || event.code === 'Escape') && !event.defaultPrevented) {
  2250. event.preventDefault();
  2251. event.stopPropagation();
  2252. (0,external_wp_data_namespaceObject.dispatch)(store).setIsInserterOpened(false);
  2253. }
  2254. }, // Use capture mode to make this run before other event listeners.
  2255. true);
  2256. this.contentContainer.addClass('widgets-inserter'); // Set a flag if the state is being changed from open() or close().
  2257. // Don't propagate the event if it's an internal action to prevent infinite loop.
  2258. this.isFromInternalAction = false;
  2259. this.expanded.bind(() => {
  2260. if (!this.isFromInternalAction) {
  2261. // Propagate the event to React to sync the state.
  2262. (0,external_wp_data_namespaceObject.dispatch)(store).setIsInserterOpened(this.expanded());
  2263. }
  2264. this.isFromInternalAction = false;
  2265. });
  2266. }
  2267. open() {
  2268. if (!this.expanded()) {
  2269. const contentContainer = this.contentContainer[0];
  2270. this.activeElementBeforeExpanded = contentContainer.ownerDocument.activeElement;
  2271. this.isFromInternalAction = true;
  2272. this.expand({
  2273. completeCallback() {
  2274. // We have to do this in a "completeCallback" or else the elements will not yet be visible/tabbable.
  2275. // The first one should be the close button,
  2276. // we want to skip it and choose the second one instead, which is the search box.
  2277. const searchBox = external_wp_dom_namespaceObject.focus.tabbable.find(contentContainer)[1];
  2278. if (searchBox) {
  2279. searchBox.focus();
  2280. }
  2281. }
  2282. });
  2283. }
  2284. }
  2285. close() {
  2286. if (this.expanded()) {
  2287. const contentContainer = this.contentContainer[0];
  2288. const activeElement = contentContainer.ownerDocument.activeElement;
  2289. this.isFromInternalAction = true;
  2290. this.collapse({
  2291. completeCallback() {
  2292. // Return back the focus when closing the inserter.
  2293. // Only do this if the active element which triggers the action is inside the inserter,
  2294. // (the close button for instance). In that case the focus will be lost.
  2295. // Otherwise, we don't hijack the focus when the user is focusing on other elements
  2296. // (like the quick inserter).
  2297. if (contentContainer.contains(activeElement)) {
  2298. // Return back the focus when closing the inserter.
  2299. if (this.activeElementBeforeExpanded) {
  2300. this.activeElementBeforeExpanded.focus();
  2301. }
  2302. }
  2303. }
  2304. });
  2305. }
  2306. }
  2307. };
  2308. }
  2309. ;// CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/controls/sidebar-control.js
  2310. /**
  2311. * WordPress dependencies
  2312. */
  2313. /**
  2314. * Internal dependencies
  2315. */
  2316. const getInserterId = controlId => `widgets-inserter-${controlId}`;
  2317. function getSidebarControl() {
  2318. const {
  2319. wp: {
  2320. customize
  2321. }
  2322. } = window;
  2323. return class SidebarControl extends customize.Control {
  2324. constructor() {
  2325. super(...arguments);
  2326. this.subscribers = new Set();
  2327. }
  2328. ready() {
  2329. const InserterOuterSection = getInserterOuterSection();
  2330. this.inserter = new InserterOuterSection(getInserterId(this.id), {});
  2331. customize.section.add(this.inserter);
  2332. this.sectionInstance = customize.section(this.section());
  2333. this.inspector = this.sectionInstance.inspector;
  2334. this.sidebarAdapter = new SidebarAdapter(this.setting, customize);
  2335. }
  2336. subscribe(callback) {
  2337. this.subscribers.add(callback);
  2338. return () => {
  2339. this.subscribers.delete(callback);
  2340. };
  2341. }
  2342. onChangeSectionExpanded(expanded, args) {
  2343. if (!args.unchanged) {
  2344. // Close the inserter when the section collapses.
  2345. if (!expanded) {
  2346. (0,external_wp_data_namespaceObject.dispatch)(store).setIsInserterOpened(false);
  2347. }
  2348. this.subscribers.forEach(subscriber => subscriber(expanded, args));
  2349. }
  2350. }
  2351. };
  2352. }
  2353. ;// CONCATENATED MODULE: external ["wp","hooks"]
  2354. var external_wp_hooks_namespaceObject = window["wp"]["hooks"];
  2355. ;// CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/filters/move-to-sidebar.js
  2356. /**
  2357. * External dependencies
  2358. */
  2359. /**
  2360. * WordPress dependencies
  2361. */
  2362. /**
  2363. * Internal dependencies
  2364. */
  2365. const withMoveToSidebarToolbarItem = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(BlockEdit => props => {
  2366. let widgetId = (0,external_wp_widgets_namespaceObject.getWidgetIdFromBlock)(props);
  2367. const sidebarControls = useSidebarControls();
  2368. const activeSidebarControl = useActiveSidebarControl();
  2369. const hasMultipleSidebars = (sidebarControls === null || sidebarControls === void 0 ? void 0 : sidebarControls.length) > 1;
  2370. const blockName = props.name;
  2371. const clientId = props.clientId;
  2372. const canInsertBlockInSidebar = (0,external_wp_data_namespaceObject.useSelect)(select => {
  2373. // Use an empty string to represent the root block list, which
  2374. // in the customizer editor represents a sidebar/widget area.
  2375. return select(external_wp_blockEditor_namespaceObject.store).canInsertBlockType(blockName, '');
  2376. }, [blockName]);
  2377. const block = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blockEditor_namespaceObject.store).getBlock(clientId), [clientId]);
  2378. const {
  2379. removeBlock
  2380. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
  2381. const [, focusWidget] = useFocusControl();
  2382. function moveToSidebar(sidebarControlId) {
  2383. const newSidebarControl = sidebarControls.find(sidebarControl => sidebarControl.id === sidebarControlId);
  2384. if (widgetId) {
  2385. /**
  2386. * If there's a widgetId, move it to the other sidebar.
  2387. */
  2388. const oldSetting = activeSidebarControl.setting;
  2389. const newSetting = newSidebarControl.setting;
  2390. oldSetting((0,external_lodash_namespaceObject.without)(oldSetting(), widgetId));
  2391. newSetting([...newSetting(), widgetId]);
  2392. } else {
  2393. /**
  2394. * If there isn't a widgetId, it's most likely a inner block.
  2395. * First, remove the block in the original sidebar,
  2396. * then, create a new widget in the new sidebar and get back its widgetId.
  2397. */
  2398. const sidebarAdapter = newSidebarControl.sidebarAdapter;
  2399. removeBlock(clientId);
  2400. const addedWidgetIds = sidebarAdapter.setWidgets([...sidebarAdapter.getWidgets(), blockToWidget(block)]); // The last non-null id is the added widget's id.
  2401. widgetId = addedWidgetIds.reverse().find(id => !!id);
  2402. } // Move focus to the moved widget and expand the sidebar.
  2403. focusWidget(widgetId);
  2404. }
  2405. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(BlockEdit, props), hasMultipleSidebars && canInsertBlockInSidebar && (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_widgets_namespaceObject.MoveToWidgetArea, {
  2406. widgetAreas: sidebarControls.map(sidebarControl => ({
  2407. id: sidebarControl.id,
  2408. name: sidebarControl.params.label,
  2409. description: sidebarControl.params.description
  2410. })),
  2411. currentWidgetAreaId: activeSidebarControl === null || activeSidebarControl === void 0 ? void 0 : activeSidebarControl.id,
  2412. onSelect: moveToSidebar
  2413. })));
  2414. }, 'withMoveToSidebarToolbarItem');
  2415. (0,external_wp_hooks_namespaceObject.addFilter)('editor.BlockEdit', 'core/customize-widgets/block-edit', withMoveToSidebarToolbarItem);
  2416. ;// CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/filters/replace-media-upload.js
  2417. /**
  2418. * WordPress dependencies
  2419. */
  2420. const replaceMediaUpload = () => external_wp_mediaUtils_namespaceObject.MediaUpload;
  2421. (0,external_wp_hooks_namespaceObject.addFilter)('editor.MediaUpload', 'core/edit-widgets/replace-media-upload', replaceMediaUpload);
  2422. ;// CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/filters/wide-widget-display.js
  2423. /**
  2424. * WordPress dependencies
  2425. */
  2426. const {
  2427. wp: wide_widget_display_wp
  2428. } = window;
  2429. const withWideWidgetDisplay = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(BlockEdit => props => {
  2430. var _wp$customize$Widgets, _wp$customize$Widgets2;
  2431. const {
  2432. idBase
  2433. } = props.attributes;
  2434. const isWide = (_wp$customize$Widgets = (_wp$customize$Widgets2 = wide_widget_display_wp.customize.Widgets.data.availableWidgets.find(widget => widget.id_base === idBase)) === null || _wp$customize$Widgets2 === void 0 ? void 0 : _wp$customize$Widgets2.is_wide) !== null && _wp$customize$Widgets !== void 0 ? _wp$customize$Widgets : false;
  2435. return (0,external_wp_element_namespaceObject.createElement)(BlockEdit, _extends({}, props, {
  2436. isWide: isWide
  2437. }));
  2438. }, 'withWideWidgetDisplay');
  2439. (0,external_wp_hooks_namespaceObject.addFilter)('editor.BlockEdit', 'core/customize-widgets/wide-widget-display', withWideWidgetDisplay);
  2440. ;// CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/filters/index.js
  2441. /**
  2442. * Internal dependencies
  2443. */
  2444. ;// CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/index.js
  2445. /**
  2446. * WordPress dependencies
  2447. */
  2448. /**
  2449. * Internal dependencies
  2450. */
  2451. const {
  2452. wp: build_module_wp
  2453. } = window;
  2454. const DISABLED_BLOCKS = ['core/more', 'core/block', 'core/freeform', 'core/template-part'];
  2455. const ENABLE_EXPERIMENTAL_FSE_BLOCKS = false;
  2456. /**
  2457. * Initializes the widgets block editor in the customizer.
  2458. *
  2459. * @param {string} editorName The editor name.
  2460. * @param {Object} blockEditorSettings Block editor settings.
  2461. */
  2462. function initialize(editorName, blockEditorSettings) {
  2463. (0,external_wp_data_namespaceObject.dispatch)(external_wp_preferences_namespaceObject.store).setDefaults('core/customize-widgets', {
  2464. fixedToolbar: false,
  2465. welcomeGuide: true
  2466. });
  2467. (0,external_wp_data_namespaceObject.dispatch)(external_wp_blocks_namespaceObject.store).__experimentalReapplyBlockTypeFilters();
  2468. const coreBlocks = (0,external_wp_blockLibrary_namespaceObject.__experimentalGetCoreBlocks)().filter(block => {
  2469. return !(DISABLED_BLOCKS.includes(block.name) || block.name.startsWith('core/post') || block.name.startsWith('core/query') || block.name.startsWith('core/site') || block.name.startsWith('core/navigation'));
  2470. });
  2471. (0,external_wp_blockLibrary_namespaceObject.registerCoreBlocks)(coreBlocks);
  2472. (0,external_wp_widgets_namespaceObject.registerLegacyWidgetBlock)();
  2473. if (false) {}
  2474. (0,external_wp_widgets_namespaceObject.registerLegacyWidgetVariations)(blockEditorSettings);
  2475. (0,external_wp_widgets_namespaceObject.registerWidgetGroupBlock)(); // As we are unregistering `core/freeform` to avoid the Classic block, we must
  2476. // replace it with something as the default freeform content handler. Failure to
  2477. // do this will result in errors in the default block parser.
  2478. // see: https://github.com/WordPress/gutenberg/issues/33097
  2479. (0,external_wp_blocks_namespaceObject.setFreeformContentHandlerName)('core/html');
  2480. const SidebarControl = getSidebarControl(blockEditorSettings);
  2481. build_module_wp.customize.sectionConstructor.sidebar = getSidebarSection();
  2482. build_module_wp.customize.controlConstructor.sidebar_block_editor = SidebarControl;
  2483. const container = document.createElement('div');
  2484. document.body.appendChild(container);
  2485. build_module_wp.customize.bind('ready', () => {
  2486. const sidebarControls = [];
  2487. build_module_wp.customize.control.each(control => {
  2488. if (control instanceof SidebarControl) {
  2489. sidebarControls.push(control);
  2490. }
  2491. });
  2492. (0,external_wp_element_namespaceObject.render)((0,external_wp_element_namespaceObject.createElement)(CustomizeWidgets, {
  2493. api: build_module_wp.customize,
  2494. sidebarControls: sidebarControls,
  2495. blockEditorSettings: blockEditorSettings
  2496. }), container);
  2497. });
  2498. }
  2499. }();
  2500. (window.wp = window.wp || {}).customizeWidgets = __webpack_exports__;
  2501. /******/ })()
  2502. ;