edit-widgets.js 162 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755
  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. var nativeCodeString = '[native code]';
  15. function classNames() {
  16. var classes = [];
  17. for (var i = 0; i < arguments.length; i++) {
  18. var arg = arguments[i];
  19. if (!arg) continue;
  20. var argType = typeof arg;
  21. if (argType === 'string' || argType === 'number') {
  22. classes.push(arg);
  23. } else if (Array.isArray(arg)) {
  24. if (arg.length) {
  25. var inner = classNames.apply(null, arg);
  26. if (inner) {
  27. classes.push(inner);
  28. }
  29. }
  30. } else if (argType === 'object') {
  31. if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {
  32. classes.push(arg.toString());
  33. continue;
  34. }
  35. for (var key in arg) {
  36. if (hasOwn.call(arg, key) && arg[key]) {
  37. classes.push(key);
  38. }
  39. }
  40. }
  41. }
  42. return classes.join(' ');
  43. }
  44. if ( true && module.exports) {
  45. classNames.default = classNames;
  46. module.exports = classNames;
  47. } else if (true) {
  48. // register as 'classnames', consistent with npm package name
  49. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () {
  50. return classNames;
  51. }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  52. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  53. } else {}
  54. }());
  55. /***/ })
  56. /******/ });
  57. /************************************************************************/
  58. /******/ // The module cache
  59. /******/ var __webpack_module_cache__ = {};
  60. /******/
  61. /******/ // The require function
  62. /******/ function __webpack_require__(moduleId) {
  63. /******/ // Check if module is in cache
  64. /******/ var cachedModule = __webpack_module_cache__[moduleId];
  65. /******/ if (cachedModule !== undefined) {
  66. /******/ return cachedModule.exports;
  67. /******/ }
  68. /******/ // Create a new module (and put it into the cache)
  69. /******/ var module = __webpack_module_cache__[moduleId] = {
  70. /******/ // no module.id needed
  71. /******/ // no module.loaded needed
  72. /******/ exports: {}
  73. /******/ };
  74. /******/
  75. /******/ // Execute the module function
  76. /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
  77. /******/
  78. /******/ // Return the exports of the module
  79. /******/ return module.exports;
  80. /******/ }
  81. /******/
  82. /************************************************************************/
  83. /******/ /* webpack/runtime/compat get default export */
  84. /******/ !function() {
  85. /******/ // getDefaultExport function for compatibility with non-harmony modules
  86. /******/ __webpack_require__.n = function(module) {
  87. /******/ var getter = module && module.__esModule ?
  88. /******/ function() { return module['default']; } :
  89. /******/ function() { return module; };
  90. /******/ __webpack_require__.d(getter, { a: getter });
  91. /******/ return getter;
  92. /******/ };
  93. /******/ }();
  94. /******/
  95. /******/ /* webpack/runtime/define property getters */
  96. /******/ !function() {
  97. /******/ // define getter functions for harmony exports
  98. /******/ __webpack_require__.d = function(exports, definition) {
  99. /******/ for(var key in definition) {
  100. /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
  101. /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
  102. /******/ }
  103. /******/ }
  104. /******/ };
  105. /******/ }();
  106. /******/
  107. /******/ /* webpack/runtime/hasOwnProperty shorthand */
  108. /******/ !function() {
  109. /******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
  110. /******/ }();
  111. /******/
  112. /******/ /* webpack/runtime/make namespace object */
  113. /******/ !function() {
  114. /******/ // define __esModule on exports
  115. /******/ __webpack_require__.r = function(exports) {
  116. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  117. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  118. /******/ }
  119. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  120. /******/ };
  121. /******/ }();
  122. /******/
  123. /************************************************************************/
  124. var __webpack_exports__ = {};
  125. // This entry need to be wrapped in an IIFE because it need to be in strict mode.
  126. !function() {
  127. "use strict";
  128. // ESM COMPAT FLAG
  129. __webpack_require__.r(__webpack_exports__);
  130. // EXPORTS
  131. __webpack_require__.d(__webpack_exports__, {
  132. "initialize": function() { return /* binding */ initialize; },
  133. "reinitializeEditor": function() { return /* binding */ reinitializeEditor; }
  134. });
  135. // NAMESPACE OBJECT: ./node_modules/@wordpress/interface/build-module/store/actions.js
  136. var actions_namespaceObject = {};
  137. __webpack_require__.r(actions_namespaceObject);
  138. __webpack_require__.d(actions_namespaceObject, {
  139. "disableComplementaryArea": function() { return disableComplementaryArea; },
  140. "enableComplementaryArea": function() { return enableComplementaryArea; },
  141. "pinItem": function() { return pinItem; },
  142. "setDefaultComplementaryArea": function() { return setDefaultComplementaryArea; },
  143. "setFeatureDefaults": function() { return setFeatureDefaults; },
  144. "setFeatureValue": function() { return setFeatureValue; },
  145. "toggleFeature": function() { return toggleFeature; },
  146. "unpinItem": function() { return unpinItem; }
  147. });
  148. // NAMESPACE OBJECT: ./node_modules/@wordpress/interface/build-module/store/selectors.js
  149. var selectors_namespaceObject = {};
  150. __webpack_require__.r(selectors_namespaceObject);
  151. __webpack_require__.d(selectors_namespaceObject, {
  152. "getActiveComplementaryArea": function() { return getActiveComplementaryArea; },
  153. "isFeatureActive": function() { return isFeatureActive; },
  154. "isItemPinned": function() { return isItemPinned; }
  155. });
  156. // NAMESPACE OBJECT: ./node_modules/@wordpress/edit-widgets/build-module/store/actions.js
  157. var store_actions_namespaceObject = {};
  158. __webpack_require__.r(store_actions_namespaceObject);
  159. __webpack_require__.d(store_actions_namespaceObject, {
  160. "closeGeneralSidebar": function() { return closeGeneralSidebar; },
  161. "moveBlockToWidgetArea": function() { return moveBlockToWidgetArea; },
  162. "persistStubPost": function() { return persistStubPost; },
  163. "saveEditedWidgetAreas": function() { return saveEditedWidgetAreas; },
  164. "saveWidgetArea": function() { return saveWidgetArea; },
  165. "saveWidgetAreas": function() { return saveWidgetAreas; },
  166. "setIsInserterOpened": function() { return setIsInserterOpened; },
  167. "setIsListViewOpened": function() { return setIsListViewOpened; },
  168. "setIsWidgetAreaOpen": function() { return setIsWidgetAreaOpen; },
  169. "setWidgetAreasOpenState": function() { return setWidgetAreasOpenState; },
  170. "setWidgetIdForClientId": function() { return setWidgetIdForClientId; }
  171. });
  172. // NAMESPACE OBJECT: ./node_modules/@wordpress/edit-widgets/build-module/store/resolvers.js
  173. var resolvers_namespaceObject = {};
  174. __webpack_require__.r(resolvers_namespaceObject);
  175. __webpack_require__.d(resolvers_namespaceObject, {
  176. "getWidgetAreas": function() { return getWidgetAreas; },
  177. "getWidgets": function() { return getWidgets; }
  178. });
  179. // NAMESPACE OBJECT: ./node_modules/@wordpress/edit-widgets/build-module/store/selectors.js
  180. var store_selectors_namespaceObject = {};
  181. __webpack_require__.r(store_selectors_namespaceObject);
  182. __webpack_require__.d(store_selectors_namespaceObject, {
  183. "__experimentalGetInsertionPoint": function() { return __experimentalGetInsertionPoint; },
  184. "canInsertBlockInWidgetArea": function() { return canInsertBlockInWidgetArea; },
  185. "getEditedWidgetAreas": function() { return getEditedWidgetAreas; },
  186. "getIsWidgetAreaOpen": function() { return getIsWidgetAreaOpen; },
  187. "getParentWidgetAreaBlock": function() { return getParentWidgetAreaBlock; },
  188. "getReferenceWidgetBlocks": function() { return getReferenceWidgetBlocks; },
  189. "getWidget": function() { return getWidget; },
  190. "getWidgetAreaForWidgetId": function() { return getWidgetAreaForWidgetId; },
  191. "getWidgetAreas": function() { return selectors_getWidgetAreas; },
  192. "getWidgets": function() { return selectors_getWidgets; },
  193. "isInserterOpened": function() { return isInserterOpened; },
  194. "isListViewOpened": function() { return isListViewOpened; },
  195. "isSavingWidgetAreas": function() { return isSavingWidgetAreas; }
  196. });
  197. // NAMESPACE OBJECT: ./node_modules/@wordpress/edit-widgets/build-module/blocks/widget-area/index.js
  198. var widget_area_namespaceObject = {};
  199. __webpack_require__.r(widget_area_namespaceObject);
  200. __webpack_require__.d(widget_area_namespaceObject, {
  201. "metadata": function() { return metadata; },
  202. "name": function() { return widget_area_name; },
  203. "settings": function() { return settings; }
  204. });
  205. ;// CONCATENATED MODULE: external ["wp","element"]
  206. var external_wp_element_namespaceObject = window["wp"]["element"];
  207. ;// CONCATENATED MODULE: external ["wp","blocks"]
  208. var external_wp_blocks_namespaceObject = window["wp"]["blocks"];
  209. ;// CONCATENATED MODULE: external ["wp","data"]
  210. var external_wp_data_namespaceObject = window["wp"]["data"];
  211. ;// CONCATENATED MODULE: external ["wp","blockLibrary"]
  212. var external_wp_blockLibrary_namespaceObject = window["wp"]["blockLibrary"];
  213. ;// CONCATENATED MODULE: external ["wp","coreData"]
  214. var external_wp_coreData_namespaceObject = window["wp"]["coreData"];
  215. ;// CONCATENATED MODULE: external ["wp","widgets"]
  216. var external_wp_widgets_namespaceObject = window["wp"]["widgets"];
  217. ;// CONCATENATED MODULE: external ["wp","preferences"]
  218. var external_wp_preferences_namespaceObject = window["wp"]["preferences"];
  219. ;// CONCATENATED MODULE: external ["wp","apiFetch"]
  220. var external_wp_apiFetch_namespaceObject = window["wp"]["apiFetch"];
  221. var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_wp_apiFetch_namespaceObject);
  222. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/store/reducer.js
  223. /**
  224. * WordPress dependencies
  225. */
  226. /**
  227. * Controls the open state of the widget areas.
  228. *
  229. * @param {Object} state Redux state.
  230. * @param {Object} action Redux action.
  231. *
  232. * @return {Array} Updated state.
  233. */
  234. function widgetAreasOpenState() {
  235. let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  236. let action = arguments.length > 1 ? arguments[1] : undefined;
  237. const {
  238. type
  239. } = action;
  240. switch (type) {
  241. case 'SET_WIDGET_AREAS_OPEN_STATE':
  242. {
  243. return action.widgetAreasOpenState;
  244. }
  245. case 'SET_IS_WIDGET_AREA_OPEN':
  246. {
  247. const {
  248. clientId,
  249. isOpen
  250. } = action;
  251. return { ...state,
  252. [clientId]: isOpen
  253. };
  254. }
  255. default:
  256. {
  257. return state;
  258. }
  259. }
  260. }
  261. /**
  262. * Reducer to set the block inserter panel open or closed.
  263. *
  264. * Note: this reducer interacts with the list view panel reducer
  265. * to make sure that only one of the two panels is open at the same time.
  266. *
  267. * @param {Object} state Current state.
  268. * @param {Object} action Dispatched action.
  269. */
  270. function blockInserterPanel() {
  271. let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  272. let action = arguments.length > 1 ? arguments[1] : undefined;
  273. switch (action.type) {
  274. case 'SET_IS_LIST_VIEW_OPENED':
  275. return action.isOpen ? false : state;
  276. case 'SET_IS_INSERTER_OPENED':
  277. return action.value;
  278. }
  279. return state;
  280. }
  281. /**
  282. * Reducer to set the list view panel open or closed.
  283. *
  284. * Note: this reducer interacts with the inserter panel reducer
  285. * to make sure that only one of the two panels is open at the same time.
  286. *
  287. * @param {Object} state Current state.
  288. * @param {Object} action Dispatched action.
  289. */
  290. function listViewPanel() {
  291. let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  292. let action = arguments.length > 1 ? arguments[1] : undefined;
  293. switch (action.type) {
  294. case 'SET_IS_INSERTER_OPENED':
  295. return action.value ? false : state;
  296. case 'SET_IS_LIST_VIEW_OPENED':
  297. return action.isOpen;
  298. }
  299. return state;
  300. }
  301. /* harmony default export */ var reducer = ((0,external_wp_data_namespaceObject.combineReducers)({
  302. blockInserterPanel,
  303. listViewPanel,
  304. widgetAreasOpenState
  305. }));
  306. ;// CONCATENATED MODULE: external ["wp","i18n"]
  307. var external_wp_i18n_namespaceObject = window["wp"]["i18n"];
  308. ;// CONCATENATED MODULE: external ["wp","notices"]
  309. var external_wp_notices_namespaceObject = window["wp"]["notices"];
  310. ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js
  311. function _extends() {
  312. _extends = Object.assign ? Object.assign.bind() : function (target) {
  313. for (var i = 1; i < arguments.length; i++) {
  314. var source = arguments[i];
  315. for (var key in source) {
  316. if (Object.prototype.hasOwnProperty.call(source, key)) {
  317. target[key] = source[key];
  318. }
  319. }
  320. }
  321. return target;
  322. };
  323. return _extends.apply(this, arguments);
  324. }
  325. // EXTERNAL MODULE: ./node_modules/classnames/index.js
  326. var classnames = __webpack_require__(4403);
  327. var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames);
  328. ;// CONCATENATED MODULE: external ["wp","components"]
  329. var external_wp_components_namespaceObject = window["wp"]["components"];
  330. ;// CONCATENATED MODULE: external ["wp","primitives"]
  331. var external_wp_primitives_namespaceObject = window["wp"]["primitives"];
  332. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/check.js
  333. /**
  334. * WordPress dependencies
  335. */
  336. const check = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  337. xmlns: "http://www.w3.org/2000/svg",
  338. viewBox: "0 0 24 24"
  339. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  340. d: "M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"
  341. }));
  342. /* harmony default export */ var library_check = (check);
  343. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/star-filled.js
  344. /**
  345. * WordPress dependencies
  346. */
  347. const starFilled = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  348. xmlns: "http://www.w3.org/2000/svg",
  349. viewBox: "0 0 24 24"
  350. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  351. d: "M11.776 4.454a.25.25 0 01.448 0l2.069 4.192a.25.25 0 00.188.137l4.626.672a.25.25 0 01.139.426l-3.348 3.263a.25.25 0 00-.072.222l.79 4.607a.25.25 0 01-.362.263l-4.138-2.175a.25.25 0 00-.232 0l-4.138 2.175a.25.25 0 01-.363-.263l.79-4.607a.25.25 0 00-.071-.222L4.754 9.881a.25.25 0 01.139-.426l4.626-.672a.25.25 0 00.188-.137l2.069-4.192z"
  352. }));
  353. /* harmony default export */ var star_filled = (starFilled);
  354. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/star-empty.js
  355. /**
  356. * WordPress dependencies
  357. */
  358. const starEmpty = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  359. xmlns: "http://www.w3.org/2000/svg",
  360. viewBox: "0 0 24 24"
  361. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  362. fillRule: "evenodd",
  363. d: "M9.706 8.646a.25.25 0 01-.188.137l-4.626.672a.25.25 0 00-.139.427l3.348 3.262a.25.25 0 01.072.222l-.79 4.607a.25.25 0 00.362.264l4.138-2.176a.25.25 0 01.233 0l4.137 2.175a.25.25 0 00.363-.263l-.79-4.607a.25.25 0 01.072-.222l3.347-3.262a.25.25 0 00-.139-.427l-4.626-.672a.25.25 0 01-.188-.137l-2.069-4.192a.25.25 0 00-.448 0L9.706 8.646zM12 7.39l-.948 1.921a1.75 1.75 0 01-1.317.957l-2.12.308 1.534 1.495c.412.402.6.982.503 1.55l-.362 2.11 1.896-.997a1.75 1.75 0 011.629 0l1.895.997-.362-2.11a1.75 1.75 0 01.504-1.55l1.533-1.495-2.12-.308a1.75 1.75 0 01-1.317-.957L12 7.39z",
  364. clipRule: "evenodd"
  365. }));
  366. /* harmony default export */ var star_empty = (starEmpty);
  367. ;// CONCATENATED MODULE: external ["wp","viewport"]
  368. var external_wp_viewport_namespaceObject = window["wp"]["viewport"];
  369. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/close-small.js
  370. /**
  371. * WordPress dependencies
  372. */
  373. const closeSmall = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  374. xmlns: "http://www.w3.org/2000/svg",
  375. viewBox: "0 0 24 24"
  376. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  377. 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"
  378. }));
  379. /* harmony default export */ var close_small = (closeSmall);
  380. ;// CONCATENATED MODULE: external ["wp","deprecated"]
  381. var external_wp_deprecated_namespaceObject = window["wp"]["deprecated"];
  382. var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_namespaceObject);
  383. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/actions.js
  384. /**
  385. * WordPress dependencies
  386. */
  387. /**
  388. * Set a default complementary area.
  389. *
  390. * @param {string} scope Complementary area scope.
  391. * @param {string} area Area identifier.
  392. *
  393. * @return {Object} Action object.
  394. */
  395. const setDefaultComplementaryArea = (scope, area) => ({
  396. type: 'SET_DEFAULT_COMPLEMENTARY_AREA',
  397. scope,
  398. area
  399. });
  400. /**
  401. * Enable the complementary area.
  402. *
  403. * @param {string} scope Complementary area scope.
  404. * @param {string} area Area identifier.
  405. */
  406. const enableComplementaryArea = (scope, area) => _ref => {
  407. let {
  408. registry,
  409. dispatch
  410. } = _ref;
  411. // Return early if there's no area.
  412. if (!area) {
  413. return;
  414. }
  415. const isComplementaryAreaVisible = registry.select(external_wp_preferences_namespaceObject.store).get(scope, 'isComplementaryAreaVisible');
  416. if (!isComplementaryAreaVisible) {
  417. registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, 'isComplementaryAreaVisible', true);
  418. }
  419. dispatch({
  420. type: 'ENABLE_COMPLEMENTARY_AREA',
  421. scope,
  422. area
  423. });
  424. };
  425. /**
  426. * Disable the complementary area.
  427. *
  428. * @param {string} scope Complementary area scope.
  429. */
  430. const disableComplementaryArea = scope => _ref2 => {
  431. let {
  432. registry
  433. } = _ref2;
  434. const isComplementaryAreaVisible = registry.select(external_wp_preferences_namespaceObject.store).get(scope, 'isComplementaryAreaVisible');
  435. if (isComplementaryAreaVisible) {
  436. registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, 'isComplementaryAreaVisible', false);
  437. }
  438. };
  439. /**
  440. * Pins an item.
  441. *
  442. * @param {string} scope Item scope.
  443. * @param {string} item Item identifier.
  444. *
  445. * @return {Object} Action object.
  446. */
  447. const pinItem = (scope, item) => _ref3 => {
  448. let {
  449. registry
  450. } = _ref3;
  451. // Return early if there's no item.
  452. if (!item) {
  453. return;
  454. }
  455. const pinnedItems = registry.select(external_wp_preferences_namespaceObject.store).get(scope, 'pinnedItems'); // The item is already pinned, there's nothing to do.
  456. if ((pinnedItems === null || pinnedItems === void 0 ? void 0 : pinnedItems[item]) === true) {
  457. return;
  458. }
  459. registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, 'pinnedItems', { ...pinnedItems,
  460. [item]: true
  461. });
  462. };
  463. /**
  464. * Unpins an item.
  465. *
  466. * @param {string} scope Item scope.
  467. * @param {string} item Item identifier.
  468. */
  469. const unpinItem = (scope, item) => _ref4 => {
  470. let {
  471. registry
  472. } = _ref4;
  473. // Return early if there's no item.
  474. if (!item) {
  475. return;
  476. }
  477. const pinnedItems = registry.select(external_wp_preferences_namespaceObject.store).get(scope, 'pinnedItems');
  478. registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, 'pinnedItems', { ...pinnedItems,
  479. [item]: false
  480. });
  481. };
  482. /**
  483. * Returns an action object used in signalling that a feature should be toggled.
  484. *
  485. * @param {string} scope The feature scope (e.g. core/edit-post).
  486. * @param {string} featureName The feature name.
  487. */
  488. function toggleFeature(scope, featureName) {
  489. return function (_ref5) {
  490. let {
  491. registry
  492. } = _ref5;
  493. external_wp_deprecated_default()(`dispatch( 'core/interface' ).toggleFeature`, {
  494. since: '6.0',
  495. alternative: `dispatch( 'core/preferences' ).toggle`
  496. });
  497. registry.dispatch(external_wp_preferences_namespaceObject.store).toggle(scope, featureName);
  498. };
  499. }
  500. /**
  501. * Returns an action object used in signalling that a feature should be set to
  502. * a true or false value
  503. *
  504. * @param {string} scope The feature scope (e.g. core/edit-post).
  505. * @param {string} featureName The feature name.
  506. * @param {boolean} value The value to set.
  507. *
  508. * @return {Object} Action object.
  509. */
  510. function setFeatureValue(scope, featureName, value) {
  511. return function (_ref6) {
  512. let {
  513. registry
  514. } = _ref6;
  515. external_wp_deprecated_default()(`dispatch( 'core/interface' ).setFeatureValue`, {
  516. since: '6.0',
  517. alternative: `dispatch( 'core/preferences' ).set`
  518. });
  519. registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, featureName, !!value);
  520. };
  521. }
  522. /**
  523. * Returns an action object used in signalling that defaults should be set for features.
  524. *
  525. * @param {string} scope The feature scope (e.g. core/edit-post).
  526. * @param {Object<string, boolean>} defaults A key/value map of feature names to values.
  527. *
  528. * @return {Object} Action object.
  529. */
  530. function setFeatureDefaults(scope, defaults) {
  531. return function (_ref7) {
  532. let {
  533. registry
  534. } = _ref7;
  535. external_wp_deprecated_default()(`dispatch( 'core/interface' ).setFeatureDefaults`, {
  536. since: '6.0',
  537. alternative: `dispatch( 'core/preferences' ).setDefaults`
  538. });
  539. registry.dispatch(external_wp_preferences_namespaceObject.store).setDefaults(scope, defaults);
  540. };
  541. }
  542. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/selectors.js
  543. /**
  544. * WordPress dependencies
  545. */
  546. /**
  547. * Returns the complementary area that is active in a given scope.
  548. *
  549. * @param {Object} state Global application state.
  550. * @param {string} scope Item scope.
  551. *
  552. * @return {string | null | undefined} The complementary area that is active in the given scope.
  553. */
  554. const getActiveComplementaryArea = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, scope) => {
  555. var _state$complementaryA;
  556. const isComplementaryAreaVisible = select(external_wp_preferences_namespaceObject.store).get(scope, 'isComplementaryAreaVisible'); // Return `undefined` to indicate that the user has never toggled
  557. // visibility, this is the vanilla default. Other code relies on this
  558. // nuance in the return value.
  559. if (isComplementaryAreaVisible === undefined) {
  560. return undefined;
  561. } // Return `null` to indicate the user hid the complementary area.
  562. if (!isComplementaryAreaVisible) {
  563. return null;
  564. }
  565. return state === null || state === void 0 ? void 0 : (_state$complementaryA = state.complementaryAreas) === null || _state$complementaryA === void 0 ? void 0 : _state$complementaryA[scope];
  566. });
  567. /**
  568. * Returns a boolean indicating if an item is pinned or not.
  569. *
  570. * @param {Object} state Global application state.
  571. * @param {string} scope Scope.
  572. * @param {string} item Item to check.
  573. *
  574. * @return {boolean} True if the item is pinned and false otherwise.
  575. */
  576. const isItemPinned = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, scope, item) => {
  577. var _pinnedItems$item;
  578. const pinnedItems = select(external_wp_preferences_namespaceObject.store).get(scope, 'pinnedItems');
  579. return (_pinnedItems$item = pinnedItems === null || pinnedItems === void 0 ? void 0 : pinnedItems[item]) !== null && _pinnedItems$item !== void 0 ? _pinnedItems$item : true;
  580. });
  581. /**
  582. * Returns a boolean indicating whether a feature is active for a particular
  583. * scope.
  584. *
  585. * @param {Object} state The store state.
  586. * @param {string} scope The scope of the feature (e.g. core/edit-post).
  587. * @param {string} featureName The name of the feature.
  588. *
  589. * @return {boolean} Is the feature enabled?
  590. */
  591. const isFeatureActive = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, scope, featureName) => {
  592. external_wp_deprecated_default()(`select( 'core/interface' ).isFeatureActive( scope, featureName )`, {
  593. since: '6.0',
  594. alternative: `select( 'core/preferences' ).get( scope, featureName )`
  595. });
  596. return !!select(external_wp_preferences_namespaceObject.store).get(scope, featureName);
  597. });
  598. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/reducer.js
  599. /**
  600. * WordPress dependencies
  601. */
  602. function complementaryAreas() {
  603. let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  604. let action = arguments.length > 1 ? arguments[1] : undefined;
  605. switch (action.type) {
  606. case 'SET_DEFAULT_COMPLEMENTARY_AREA':
  607. {
  608. const {
  609. scope,
  610. area
  611. } = action; // If there's already an area, don't overwrite it.
  612. if (state[scope]) {
  613. return state;
  614. }
  615. return { ...state,
  616. [scope]: area
  617. };
  618. }
  619. case 'ENABLE_COMPLEMENTARY_AREA':
  620. {
  621. const {
  622. scope,
  623. area
  624. } = action;
  625. return { ...state,
  626. [scope]: area
  627. };
  628. }
  629. }
  630. return state;
  631. }
  632. /* harmony default export */ var store_reducer = ((0,external_wp_data_namespaceObject.combineReducers)({
  633. complementaryAreas
  634. }));
  635. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/constants.js
  636. /**
  637. * The identifier for the data store.
  638. *
  639. * @type {string}
  640. */
  641. const STORE_NAME = 'core/interface';
  642. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/index.js
  643. /**
  644. * WordPress dependencies
  645. */
  646. /**
  647. * Internal dependencies
  648. */
  649. /**
  650. * Store definition for the interface namespace.
  651. *
  652. * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore
  653. *
  654. * @type {Object}
  655. */
  656. const store = (0,external_wp_data_namespaceObject.createReduxStore)(STORE_NAME, {
  657. reducer: store_reducer,
  658. actions: actions_namespaceObject,
  659. selectors: selectors_namespaceObject
  660. }); // Once we build a more generic persistence plugin that works across types of stores
  661. // we'd be able to replace this with a register call.
  662. (0,external_wp_data_namespaceObject.register)(store);
  663. ;// CONCATENATED MODULE: external ["wp","plugins"]
  664. var external_wp_plugins_namespaceObject = window["wp"]["plugins"];
  665. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/complementary-area-context/index.js
  666. /**
  667. * WordPress dependencies
  668. */
  669. /* harmony default export */ var complementary_area_context = ((0,external_wp_plugins_namespaceObject.withPluginContext)((context, ownProps) => {
  670. return {
  671. icon: ownProps.icon || context.icon,
  672. identifier: ownProps.identifier || `${context.name}/${ownProps.name}`
  673. };
  674. }));
  675. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/complementary-area-toggle/index.js
  676. /**
  677. * WordPress dependencies
  678. */
  679. /**
  680. * Internal dependencies
  681. */
  682. function ComplementaryAreaToggle(_ref) {
  683. let {
  684. as = external_wp_components_namespaceObject.Button,
  685. scope,
  686. identifier,
  687. icon,
  688. selectedIcon,
  689. name,
  690. ...props
  691. } = _ref;
  692. const ComponentToUse = as;
  693. const isSelected = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getActiveComplementaryArea(scope) === identifier, [identifier]);
  694. const {
  695. enableComplementaryArea,
  696. disableComplementaryArea
  697. } = (0,external_wp_data_namespaceObject.useDispatch)(store);
  698. return (0,external_wp_element_namespaceObject.createElement)(ComponentToUse, _extends({
  699. icon: selectedIcon && isSelected ? selectedIcon : icon,
  700. onClick: () => {
  701. if (isSelected) {
  702. disableComplementaryArea(scope);
  703. } else {
  704. enableComplementaryArea(scope, identifier);
  705. }
  706. }
  707. }, props));
  708. }
  709. /* harmony default export */ var complementary_area_toggle = (complementary_area_context(ComplementaryAreaToggle));
  710. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/complementary-area-header/index.js
  711. /**
  712. * External dependencies
  713. */
  714. /**
  715. * WordPress dependencies
  716. */
  717. /**
  718. * Internal dependencies
  719. */
  720. const ComplementaryAreaHeader = _ref => {
  721. let {
  722. smallScreenTitle,
  723. children,
  724. className,
  725. toggleButtonProps
  726. } = _ref;
  727. const toggleButton = (0,external_wp_element_namespaceObject.createElement)(complementary_area_toggle, _extends({
  728. icon: close_small
  729. }, toggleButtonProps));
  730. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("div", {
  731. className: "components-panel__header interface-complementary-area-header__small"
  732. }, smallScreenTitle && (0,external_wp_element_namespaceObject.createElement)("span", {
  733. className: "interface-complementary-area-header__small-title"
  734. }, smallScreenTitle), toggleButton), (0,external_wp_element_namespaceObject.createElement)("div", {
  735. className: classnames_default()('components-panel__header', 'interface-complementary-area-header', className),
  736. tabIndex: -1
  737. }, children, toggleButton));
  738. };
  739. /* harmony default export */ var complementary_area_header = (ComplementaryAreaHeader);
  740. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/action-item/index.js
  741. /**
  742. * WordPress dependencies
  743. */
  744. const noop = () => {};
  745. function ActionItemSlot(_ref) {
  746. let {
  747. name,
  748. as: Component = external_wp_components_namespaceObject.ButtonGroup,
  749. fillProps = {},
  750. bubblesVirtually,
  751. ...props
  752. } = _ref;
  753. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Slot, {
  754. name: name,
  755. bubblesVirtually: bubblesVirtually,
  756. fillProps: fillProps
  757. }, fills => {
  758. if (!external_wp_element_namespaceObject.Children.toArray(fills).length) {
  759. return null;
  760. } // Special handling exists for backward compatibility.
  761. // It ensures that menu items created by plugin authors aren't
  762. // duplicated with automatically injected menu items coming
  763. // from pinnable plugin sidebars.
  764. // @see https://github.com/WordPress/gutenberg/issues/14457
  765. const initializedByPlugins = [];
  766. external_wp_element_namespaceObject.Children.forEach(fills, _ref2 => {
  767. let {
  768. props: {
  769. __unstableExplicitMenuItem,
  770. __unstableTarget
  771. }
  772. } = _ref2;
  773. if (__unstableTarget && __unstableExplicitMenuItem) {
  774. initializedByPlugins.push(__unstableTarget);
  775. }
  776. });
  777. const children = external_wp_element_namespaceObject.Children.map(fills, child => {
  778. if (!child.props.__unstableExplicitMenuItem && initializedByPlugins.includes(child.props.__unstableTarget)) {
  779. return null;
  780. }
  781. return child;
  782. });
  783. return (0,external_wp_element_namespaceObject.createElement)(Component, props, children);
  784. });
  785. }
  786. function ActionItem(_ref3) {
  787. let {
  788. name,
  789. as: Component = external_wp_components_namespaceObject.Button,
  790. onClick,
  791. ...props
  792. } = _ref3;
  793. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Fill, {
  794. name: name
  795. }, _ref4 => {
  796. let {
  797. onClick: fpOnClick
  798. } = _ref4;
  799. return (0,external_wp_element_namespaceObject.createElement)(Component, _extends({
  800. onClick: onClick || fpOnClick ? function () {
  801. (onClick || noop)(...arguments);
  802. (fpOnClick || noop)(...arguments);
  803. } : undefined
  804. }, props));
  805. });
  806. }
  807. ActionItem.Slot = ActionItemSlot;
  808. /* harmony default export */ var action_item = (ActionItem);
  809. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/complementary-area-more-menu-item/index.js
  810. /**
  811. * WordPress dependencies
  812. */
  813. /**
  814. * Internal dependencies
  815. */
  816. const PluginsMenuItem = _ref => {
  817. let {
  818. // Menu item is marked with unstable prop for backward compatibility.
  819. // They are removed so they don't leak to DOM elements.
  820. // @see https://github.com/WordPress/gutenberg/issues/14457
  821. __unstableExplicitMenuItem,
  822. __unstableTarget,
  823. ...restProps
  824. } = _ref;
  825. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, restProps);
  826. };
  827. function ComplementaryAreaMoreMenuItem(_ref2) {
  828. let {
  829. scope,
  830. target,
  831. __unstableExplicitMenuItem,
  832. ...props
  833. } = _ref2;
  834. return (0,external_wp_element_namespaceObject.createElement)(complementary_area_toggle, _extends({
  835. as: toggleProps => {
  836. return (0,external_wp_element_namespaceObject.createElement)(action_item, _extends({
  837. __unstableExplicitMenuItem: __unstableExplicitMenuItem,
  838. __unstableTarget: `${scope}/${target}`,
  839. as: PluginsMenuItem,
  840. name: `${scope}/plugin-more-menu`
  841. }, toggleProps));
  842. },
  843. role: "menuitemcheckbox",
  844. selectedIcon: library_check,
  845. name: target,
  846. scope: scope
  847. }, props));
  848. }
  849. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/pinned-items/index.js
  850. /**
  851. * External dependencies
  852. */
  853. /**
  854. * WordPress dependencies
  855. */
  856. function PinnedItems(_ref) {
  857. let {
  858. scope,
  859. ...props
  860. } = _ref;
  861. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Fill, _extends({
  862. name: `PinnedItems/${scope}`
  863. }, props));
  864. }
  865. function PinnedItemsSlot(_ref2) {
  866. let {
  867. scope,
  868. className,
  869. ...props
  870. } = _ref2;
  871. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Slot, _extends({
  872. name: `PinnedItems/${scope}`
  873. }, props), fills => (fills === null || fills === void 0 ? void 0 : fills.length) > 0 && (0,external_wp_element_namespaceObject.createElement)("div", {
  874. className: classnames_default()(className, 'interface-pinned-items')
  875. }, fills));
  876. }
  877. PinnedItems.Slot = PinnedItemsSlot;
  878. /* harmony default export */ var pinned_items = (PinnedItems);
  879. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/complementary-area/index.js
  880. /**
  881. * External dependencies
  882. */
  883. /**
  884. * WordPress dependencies
  885. */
  886. /**
  887. * Internal dependencies
  888. */
  889. function ComplementaryAreaSlot(_ref) {
  890. let {
  891. scope,
  892. ...props
  893. } = _ref;
  894. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Slot, _extends({
  895. name: `ComplementaryArea/${scope}`
  896. }, props));
  897. }
  898. function ComplementaryAreaFill(_ref2) {
  899. let {
  900. scope,
  901. children,
  902. className
  903. } = _ref2;
  904. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Fill, {
  905. name: `ComplementaryArea/${scope}`
  906. }, (0,external_wp_element_namespaceObject.createElement)("div", {
  907. className: className
  908. }, children));
  909. }
  910. function useAdjustComplementaryListener(scope, identifier, activeArea, isActive, isSmall) {
  911. const previousIsSmall = (0,external_wp_element_namespaceObject.useRef)(false);
  912. const shouldOpenWhenNotSmall = (0,external_wp_element_namespaceObject.useRef)(false);
  913. const {
  914. enableComplementaryArea,
  915. disableComplementaryArea
  916. } = (0,external_wp_data_namespaceObject.useDispatch)(store);
  917. (0,external_wp_element_namespaceObject.useEffect)(() => {
  918. // If the complementary area is active and the editor is switching from a big to a small window size.
  919. if (isActive && isSmall && !previousIsSmall.current) {
  920. // Disable the complementary area.
  921. disableComplementaryArea(scope); // Flag the complementary area to be reopened when the window size goes from small to big.
  922. shouldOpenWhenNotSmall.current = true;
  923. } else if ( // If there is a flag indicating the complementary area should be enabled when we go from small to big window size
  924. // and we are going from a small to big window size.
  925. shouldOpenWhenNotSmall.current && !isSmall && previousIsSmall.current) {
  926. // Remove the flag indicating the complementary area should be enabled.
  927. shouldOpenWhenNotSmall.current = false; // Enable the complementary area.
  928. enableComplementaryArea(scope, identifier);
  929. } else if ( // If the flag is indicating the current complementary should be reopened but another complementary area becomes active,
  930. // remove the flag.
  931. shouldOpenWhenNotSmall.current && activeArea && activeArea !== identifier) {
  932. shouldOpenWhenNotSmall.current = false;
  933. }
  934. if (isSmall !== previousIsSmall.current) {
  935. previousIsSmall.current = isSmall;
  936. }
  937. }, [isActive, isSmall, scope, identifier, activeArea]);
  938. }
  939. function ComplementaryArea(_ref3) {
  940. let {
  941. children,
  942. className,
  943. closeLabel = (0,external_wp_i18n_namespaceObject.__)('Close plugin'),
  944. identifier,
  945. header,
  946. headerClassName,
  947. icon,
  948. isPinnable = true,
  949. panelClassName,
  950. scope,
  951. name,
  952. smallScreenTitle,
  953. title,
  954. toggleShortcut,
  955. isActiveByDefault,
  956. showIconLabels = false
  957. } = _ref3;
  958. const {
  959. isActive,
  960. isPinned,
  961. activeArea,
  962. isSmall,
  963. isLarge
  964. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  965. const {
  966. getActiveComplementaryArea,
  967. isItemPinned
  968. } = select(store);
  969. const _activeArea = getActiveComplementaryArea(scope);
  970. return {
  971. isActive: _activeArea === identifier,
  972. isPinned: isItemPinned(scope, identifier),
  973. activeArea: _activeArea,
  974. isSmall: select(external_wp_viewport_namespaceObject.store).isViewportMatch('< medium'),
  975. isLarge: select(external_wp_viewport_namespaceObject.store).isViewportMatch('large')
  976. };
  977. }, [identifier, scope]);
  978. useAdjustComplementaryListener(scope, identifier, activeArea, isActive, isSmall);
  979. const {
  980. enableComplementaryArea,
  981. disableComplementaryArea,
  982. pinItem,
  983. unpinItem
  984. } = (0,external_wp_data_namespaceObject.useDispatch)(store);
  985. (0,external_wp_element_namespaceObject.useEffect)(() => {
  986. if (isActiveByDefault && activeArea === undefined && !isSmall) {
  987. enableComplementaryArea(scope, identifier);
  988. }
  989. }, [activeArea, isActiveByDefault, scope, identifier, isSmall]);
  990. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, isPinnable && (0,external_wp_element_namespaceObject.createElement)(pinned_items, {
  991. scope: scope
  992. }, isPinned && (0,external_wp_element_namespaceObject.createElement)(complementary_area_toggle, {
  993. scope: scope,
  994. identifier: identifier,
  995. isPressed: isActive && (!showIconLabels || isLarge),
  996. "aria-expanded": isActive,
  997. label: title,
  998. icon: showIconLabels ? library_check : icon,
  999. showTooltip: !showIconLabels,
  1000. variant: showIconLabels ? 'tertiary' : undefined
  1001. })), name && isPinnable && (0,external_wp_element_namespaceObject.createElement)(ComplementaryAreaMoreMenuItem, {
  1002. target: name,
  1003. scope: scope,
  1004. icon: icon
  1005. }, title), isActive && (0,external_wp_element_namespaceObject.createElement)(ComplementaryAreaFill, {
  1006. className: classnames_default()('interface-complementary-area', className),
  1007. scope: scope
  1008. }, (0,external_wp_element_namespaceObject.createElement)(complementary_area_header, {
  1009. className: headerClassName,
  1010. closeLabel: closeLabel,
  1011. onClose: () => disableComplementaryArea(scope),
  1012. smallScreenTitle: smallScreenTitle,
  1013. toggleButtonProps: {
  1014. label: closeLabel,
  1015. shortcut: toggleShortcut,
  1016. scope,
  1017. identifier
  1018. }
  1019. }, header || (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("strong", null, title), isPinnable && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  1020. className: "interface-complementary-area__pin-unpin-item",
  1021. icon: isPinned ? star_filled : star_empty,
  1022. label: isPinned ? (0,external_wp_i18n_namespaceObject.__)('Unpin from toolbar') : (0,external_wp_i18n_namespaceObject.__)('Pin to toolbar'),
  1023. onClick: () => (isPinned ? unpinItem : pinItem)(scope, identifier),
  1024. isPressed: isPinned,
  1025. "aria-expanded": isPinned
  1026. }))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Panel, {
  1027. className: panelClassName
  1028. }, children)));
  1029. }
  1030. const ComplementaryAreaWrapped = complementary_area_context(ComplementaryArea);
  1031. ComplementaryAreaWrapped.Slot = ComplementaryAreaSlot;
  1032. /* harmony default export */ var complementary_area = (ComplementaryAreaWrapped);
  1033. ;// CONCATENATED MODULE: external ["wp","compose"]
  1034. var external_wp_compose_namespaceObject = window["wp"]["compose"];
  1035. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/interface-skeleton/index.js
  1036. /**
  1037. * External dependencies
  1038. */
  1039. /**
  1040. * WordPress dependencies
  1041. */
  1042. function useHTMLClass(className) {
  1043. (0,external_wp_element_namespaceObject.useEffect)(() => {
  1044. const element = document && document.querySelector(`html:not(.${className})`);
  1045. if (!element) {
  1046. return;
  1047. }
  1048. element.classList.toggle(className);
  1049. return () => {
  1050. element.classList.toggle(className);
  1051. };
  1052. }, [className]);
  1053. }
  1054. function InterfaceSkeleton(_ref, ref) {
  1055. let {
  1056. footer,
  1057. header,
  1058. sidebar,
  1059. secondarySidebar,
  1060. notices,
  1061. content,
  1062. drawer,
  1063. actions,
  1064. labels,
  1065. className,
  1066. shortcuts
  1067. } = _ref;
  1068. const navigateRegionsProps = (0,external_wp_components_namespaceObject.__unstableUseNavigateRegions)(shortcuts);
  1069. useHTMLClass('interface-interface-skeleton__html-container');
  1070. const defaultLabels = {
  1071. /* translators: accessibility text for the nav bar landmark region. */
  1072. drawer: (0,external_wp_i18n_namespaceObject.__)('Drawer'),
  1073. /* translators: accessibility text for the top bar landmark region. */
  1074. header: (0,external_wp_i18n_namespaceObject.__)('Header'),
  1075. /* translators: accessibility text for the content landmark region. */
  1076. body: (0,external_wp_i18n_namespaceObject.__)('Content'),
  1077. /* translators: accessibility text for the secondary sidebar landmark region. */
  1078. secondarySidebar: (0,external_wp_i18n_namespaceObject.__)('Block Library'),
  1079. /* translators: accessibility text for the settings landmark region. */
  1080. sidebar: (0,external_wp_i18n_namespaceObject.__)('Settings'),
  1081. /* translators: accessibility text for the publish landmark region. */
  1082. actions: (0,external_wp_i18n_namespaceObject.__)('Publish'),
  1083. /* translators: accessibility text for the footer landmark region. */
  1084. footer: (0,external_wp_i18n_namespaceObject.__)('Footer')
  1085. };
  1086. const mergedLabels = { ...defaultLabels,
  1087. ...labels
  1088. };
  1089. return (0,external_wp_element_namespaceObject.createElement)("div", _extends({}, navigateRegionsProps, {
  1090. ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([ref, navigateRegionsProps.ref]),
  1091. className: classnames_default()(className, 'interface-interface-skeleton', navigateRegionsProps.className, !!footer && 'has-footer')
  1092. }), !!drawer && (0,external_wp_element_namespaceObject.createElement)("div", {
  1093. className: "interface-interface-skeleton__drawer",
  1094. role: "region",
  1095. "aria-label": mergedLabels.drawer,
  1096. tabIndex: "-1"
  1097. }, drawer), (0,external_wp_element_namespaceObject.createElement)("div", {
  1098. className: "interface-interface-skeleton__editor"
  1099. }, !!header && (0,external_wp_element_namespaceObject.createElement)("div", {
  1100. className: "interface-interface-skeleton__header",
  1101. role: "region",
  1102. "aria-label": mergedLabels.header,
  1103. tabIndex: "-1"
  1104. }, header), (0,external_wp_element_namespaceObject.createElement)("div", {
  1105. className: "interface-interface-skeleton__body"
  1106. }, !!secondarySidebar && (0,external_wp_element_namespaceObject.createElement)("div", {
  1107. className: "interface-interface-skeleton__secondary-sidebar",
  1108. role: "region",
  1109. "aria-label": mergedLabels.secondarySidebar,
  1110. tabIndex: "-1"
  1111. }, secondarySidebar), !!notices && (0,external_wp_element_namespaceObject.createElement)("div", {
  1112. className: "interface-interface-skeleton__notices"
  1113. }, notices), (0,external_wp_element_namespaceObject.createElement)("div", {
  1114. className: "interface-interface-skeleton__content",
  1115. role: "region",
  1116. "aria-label": mergedLabels.body,
  1117. tabIndex: "-1"
  1118. }, content), !!sidebar && (0,external_wp_element_namespaceObject.createElement)("div", {
  1119. className: "interface-interface-skeleton__sidebar",
  1120. role: "region",
  1121. "aria-label": mergedLabels.sidebar,
  1122. tabIndex: "-1"
  1123. }, sidebar), !!actions && (0,external_wp_element_namespaceObject.createElement)("div", {
  1124. className: "interface-interface-skeleton__actions",
  1125. role: "region",
  1126. "aria-label": mergedLabels.actions,
  1127. tabIndex: "-1"
  1128. }, actions))), !!footer && (0,external_wp_element_namespaceObject.createElement)("div", {
  1129. className: "interface-interface-skeleton__footer",
  1130. role: "region",
  1131. "aria-label": mergedLabels.footer,
  1132. tabIndex: "-1"
  1133. }, footer));
  1134. }
  1135. /* harmony default export */ var interface_skeleton = ((0,external_wp_element_namespaceObject.forwardRef)(InterfaceSkeleton));
  1136. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/more-vertical.js
  1137. /**
  1138. * WordPress dependencies
  1139. */
  1140. const moreVertical = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  1141. xmlns: "http://www.w3.org/2000/svg",
  1142. viewBox: "0 0 24 24"
  1143. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  1144. d: "M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z"
  1145. }));
  1146. /* harmony default export */ var more_vertical = (moreVertical);
  1147. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/more-menu-dropdown/index.js
  1148. /**
  1149. * External dependencies
  1150. */
  1151. /**
  1152. * WordPress dependencies
  1153. */
  1154. function MoreMenuDropdown(_ref) {
  1155. let {
  1156. as: DropdownComponent = external_wp_components_namespaceObject.DropdownMenu,
  1157. className,
  1158. /* translators: button label text should, if possible, be under 16 characters. */
  1159. label = (0,external_wp_i18n_namespaceObject.__)('Options'),
  1160. popoverProps,
  1161. toggleProps,
  1162. children
  1163. } = _ref;
  1164. return (0,external_wp_element_namespaceObject.createElement)(DropdownComponent, {
  1165. className: classnames_default()('interface-more-menu-dropdown', className),
  1166. icon: more_vertical,
  1167. label: label,
  1168. popoverProps: {
  1169. position: 'bottom left',
  1170. ...popoverProps,
  1171. className: classnames_default()('interface-more-menu-dropdown__content', popoverProps === null || popoverProps === void 0 ? void 0 : popoverProps.className)
  1172. },
  1173. toggleProps: {
  1174. tooltipPosition: 'bottom',
  1175. ...toggleProps
  1176. }
  1177. }, onClose => children(onClose));
  1178. }
  1179. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/index.js
  1180. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/index.js
  1181. ;// CONCATENATED MODULE: external ["wp","blockEditor"]
  1182. var external_wp_blockEditor_namespaceObject = window["wp"]["blockEditor"];
  1183. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/store/transformers.js
  1184. /**
  1185. * WordPress dependencies
  1186. */
  1187. /**
  1188. * Converts a widget entity record into a block.
  1189. *
  1190. * @param {Object} widget The widget entity record.
  1191. * @return {Object} a block (converted from the entity record).
  1192. */
  1193. function transformWidgetToBlock(widget) {
  1194. if (widget.id_base === 'block') {
  1195. const parsedBlocks = (0,external_wp_blocks_namespaceObject.parse)(widget.instance.raw.content, {
  1196. __unstableSkipAutop: true
  1197. });
  1198. if (!parsedBlocks.length) {
  1199. return (0,external_wp_widgets_namespaceObject.addWidgetIdToBlock)((0,external_wp_blocks_namespaceObject.createBlock)('core/paragraph', {}, []), widget.id);
  1200. }
  1201. return (0,external_wp_widgets_namespaceObject.addWidgetIdToBlock)(parsedBlocks[0], widget.id);
  1202. }
  1203. let attributes;
  1204. if (widget._embedded.about[0].is_multi) {
  1205. attributes = {
  1206. idBase: widget.id_base,
  1207. instance: widget.instance
  1208. };
  1209. } else {
  1210. attributes = {
  1211. id: widget.id
  1212. };
  1213. }
  1214. return (0,external_wp_widgets_namespaceObject.addWidgetIdToBlock)((0,external_wp_blocks_namespaceObject.createBlock)('core/legacy-widget', attributes, []), widget.id);
  1215. }
  1216. /**
  1217. * Converts a block to a widget entity record.
  1218. *
  1219. * @param {Object} block The block.
  1220. * @param {Object?} relatedWidget A related widget entity record from the API (optional).
  1221. * @return {Object} the widget object (converted from block).
  1222. */
  1223. function transformBlockToWidget(block) {
  1224. let relatedWidget = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  1225. let widget;
  1226. const isValidLegacyWidgetBlock = block.name === 'core/legacy-widget' && (block.attributes.id || block.attributes.instance);
  1227. if (isValidLegacyWidgetBlock) {
  1228. var _block$attributes$id, _block$attributes$idB, _block$attributes$ins;
  1229. widget = { ...relatedWidget,
  1230. id: (_block$attributes$id = block.attributes.id) !== null && _block$attributes$id !== void 0 ? _block$attributes$id : relatedWidget.id,
  1231. id_base: (_block$attributes$idB = block.attributes.idBase) !== null && _block$attributes$idB !== void 0 ? _block$attributes$idB : relatedWidget.id_base,
  1232. instance: (_block$attributes$ins = block.attributes.instance) !== null && _block$attributes$ins !== void 0 ? _block$attributes$ins : relatedWidget.instance
  1233. };
  1234. } else {
  1235. widget = { ...relatedWidget,
  1236. id_base: 'block',
  1237. instance: {
  1238. raw: {
  1239. content: (0,external_wp_blocks_namespaceObject.serialize)(block)
  1240. }
  1241. }
  1242. };
  1243. } // Delete read-only properties.
  1244. delete widget.rendered;
  1245. delete widget.rendered_form;
  1246. return widget;
  1247. }
  1248. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/store/utils.js
  1249. /**
  1250. * "Kind" of the navigation post.
  1251. *
  1252. * @type {string}
  1253. */
  1254. const KIND = 'root';
  1255. /**
  1256. * "post type" of the navigation post.
  1257. *
  1258. * @type {string}
  1259. */
  1260. const WIDGET_AREA_ENTITY_TYPE = 'sidebar';
  1261. /**
  1262. * "post type" of the widget area post.
  1263. *
  1264. * @type {string}
  1265. */
  1266. const POST_TYPE = 'postType';
  1267. /**
  1268. * Builds an ID for a new widget area post.
  1269. *
  1270. * @param {number} widgetAreaId Widget area id.
  1271. * @return {string} An ID.
  1272. */
  1273. const buildWidgetAreaPostId = widgetAreaId => `widget-area-${widgetAreaId}`;
  1274. /**
  1275. * Builds an ID for a global widget areas post.
  1276. *
  1277. * @return {string} An ID.
  1278. */
  1279. const buildWidgetAreasPostId = () => `widget-areas`;
  1280. /**
  1281. * Builds a query to resolve sidebars.
  1282. *
  1283. * @return {Object} Query.
  1284. */
  1285. function buildWidgetAreasQuery() {
  1286. return {
  1287. per_page: -1
  1288. };
  1289. }
  1290. /**
  1291. * Builds a query to resolve widgets.
  1292. *
  1293. * @return {Object} Query.
  1294. */
  1295. function buildWidgetsQuery() {
  1296. return {
  1297. per_page: -1,
  1298. _embed: 'about'
  1299. };
  1300. }
  1301. /**
  1302. * Creates a stub post with given id and set of blocks. Used as a governing entity records
  1303. * for all widget areas.
  1304. *
  1305. * @param {string} id Post ID.
  1306. * @param {Array} blocks The list of blocks.
  1307. * @return {Object} A stub post object formatted in compliance with the data layer.
  1308. */
  1309. const createStubPost = (id, blocks) => ({
  1310. id,
  1311. slug: id,
  1312. status: 'draft',
  1313. type: 'page',
  1314. blocks,
  1315. meta: {
  1316. widgetAreaId: id
  1317. }
  1318. });
  1319. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/store/constants.js
  1320. /**
  1321. * Module Constants
  1322. */
  1323. const constants_STORE_NAME = 'core/edit-widgets';
  1324. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/store/actions.js
  1325. /**
  1326. * WordPress dependencies
  1327. */
  1328. /**
  1329. * Internal dependencies
  1330. */
  1331. /**
  1332. * Persists a stub post with given ID to core data store. The post is meant to be in-memory only and
  1333. * shouldn't be saved via the API.
  1334. *
  1335. * @param {string} id Post ID.
  1336. * @param {Array} blocks Blocks the post should consist of.
  1337. * @return {Object} The post object.
  1338. */
  1339. const persistStubPost = (id, blocks) => _ref => {
  1340. let {
  1341. registry
  1342. } = _ref;
  1343. const stubPost = createStubPost(id, blocks);
  1344. registry.dispatch(external_wp_coreData_namespaceObject.store).receiveEntityRecords(KIND, POST_TYPE, stubPost, {
  1345. id: stubPost.id
  1346. }, false);
  1347. return stubPost;
  1348. };
  1349. /**
  1350. * Converts all the blocks from edited widget areas into widgets,
  1351. * and submits a batch request to save everything at once.
  1352. *
  1353. * Creates a snackbar notice on either success or error.
  1354. *
  1355. * @return {Function} An action creator.
  1356. */
  1357. const saveEditedWidgetAreas = () => async _ref2 => {
  1358. let {
  1359. select,
  1360. dispatch,
  1361. registry
  1362. } = _ref2;
  1363. const editedWidgetAreas = select.getEditedWidgetAreas();
  1364. if (!(editedWidgetAreas !== null && editedWidgetAreas !== void 0 && editedWidgetAreas.length)) {
  1365. return;
  1366. }
  1367. try {
  1368. await dispatch.saveWidgetAreas(editedWidgetAreas);
  1369. registry.dispatch(external_wp_notices_namespaceObject.store).createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Widgets saved.'), {
  1370. type: 'snackbar'
  1371. });
  1372. } catch (e) {
  1373. registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice(
  1374. /* translators: %s: The error message. */
  1375. (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('There was an error. %s'), e.message), {
  1376. type: 'snackbar'
  1377. });
  1378. }
  1379. };
  1380. /**
  1381. * Converts all the blocks from specified widget areas into widgets,
  1382. * and submits a batch request to save everything at once.
  1383. *
  1384. * @param {Object[]} widgetAreas Widget areas to save.
  1385. * @return {Function} An action creator.
  1386. */
  1387. const saveWidgetAreas = widgetAreas => async _ref3 => {
  1388. let {
  1389. dispatch,
  1390. registry
  1391. } = _ref3;
  1392. try {
  1393. for (const widgetArea of widgetAreas) {
  1394. await dispatch.saveWidgetArea(widgetArea.id);
  1395. }
  1396. } finally {
  1397. // saveEditedEntityRecord resets the resolution status, let's fix it manually.
  1398. await registry.dispatch(external_wp_coreData_namespaceObject.store).finishResolution('getEntityRecord', KIND, WIDGET_AREA_ENTITY_TYPE, buildWidgetAreasQuery());
  1399. }
  1400. };
  1401. /**
  1402. * Converts all the blocks from a widget area specified by ID into widgets,
  1403. * and submits a batch request to save everything at once.
  1404. *
  1405. * @param {string} widgetAreaId ID of the widget area to process.
  1406. * @return {Function} An action creator.
  1407. */
  1408. const saveWidgetArea = widgetAreaId => async _ref4 => {
  1409. let {
  1410. dispatch,
  1411. select,
  1412. registry
  1413. } = _ref4;
  1414. const widgets = select.getWidgets();
  1415. const post = registry.select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord(KIND, POST_TYPE, buildWidgetAreaPostId(widgetAreaId)); // Get all widgets from this area
  1416. const areaWidgets = Object.values(widgets).filter(_ref5 => {
  1417. let {
  1418. sidebar
  1419. } = _ref5;
  1420. return sidebar === widgetAreaId;
  1421. }); // Remove all duplicate reference widget instances for legacy widgets.
  1422. // Why? We filter out the widgets with duplicate IDs to prevent adding more than one instance of a widget
  1423. // implemented using a function. WordPress doesn't support having more than one instance of these, if you try to
  1424. // save multiple instances of these in different sidebars you will run into undefined behaviors.
  1425. const usedReferenceWidgets = [];
  1426. const widgetsBlocks = post.blocks.filter(block => {
  1427. const {
  1428. id
  1429. } = block.attributes;
  1430. if (block.name === 'core/legacy-widget' && id) {
  1431. if (usedReferenceWidgets.includes(id)) {
  1432. return false;
  1433. }
  1434. usedReferenceWidgets.push(id);
  1435. }
  1436. return true;
  1437. }); // Determine which widgets have been deleted. We can tell if a widget is
  1438. // deleted and not just moved to a different area by looking to see if
  1439. // getWidgetAreaForWidgetId() finds something.
  1440. const deletedWidgets = [];
  1441. for (const widget of areaWidgets) {
  1442. const widgetsNewArea = select.getWidgetAreaForWidgetId(widget.id);
  1443. if (!widgetsNewArea) {
  1444. deletedWidgets.push(widget);
  1445. }
  1446. }
  1447. const batchMeta = [];
  1448. const batchTasks = [];
  1449. const sidebarWidgetsIds = [];
  1450. for (let i = 0; i < widgetsBlocks.length; i++) {
  1451. const block = widgetsBlocks[i];
  1452. const widgetId = (0,external_wp_widgets_namespaceObject.getWidgetIdFromBlock)(block);
  1453. const oldWidget = widgets[widgetId];
  1454. const widget = transformBlockToWidget(block, oldWidget); // We'll replace the null widgetId after save, but we track it here
  1455. // since order is important.
  1456. sidebarWidgetsIds.push(widgetId); // Check oldWidget as widgetId might refer to an ID which has been
  1457. // deleted, e.g. if a deleted block is restored via undo after saving.
  1458. if (oldWidget) {
  1459. // Update an existing widget.
  1460. registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord('root', 'widget', widgetId, { ...widget,
  1461. sidebar: widgetAreaId
  1462. }, {
  1463. undoIgnore: true
  1464. });
  1465. const hasEdits = registry.select(external_wp_coreData_namespaceObject.store).hasEditsForEntityRecord('root', 'widget', widgetId);
  1466. if (!hasEdits) {
  1467. continue;
  1468. }
  1469. batchTasks.push(_ref6 => {
  1470. let {
  1471. saveEditedEntityRecord
  1472. } = _ref6;
  1473. return saveEditedEntityRecord('root', 'widget', widgetId);
  1474. });
  1475. } else {
  1476. // Create a new widget.
  1477. batchTasks.push(_ref7 => {
  1478. let {
  1479. saveEntityRecord
  1480. } = _ref7;
  1481. return saveEntityRecord('root', 'widget', { ...widget,
  1482. sidebar: widgetAreaId
  1483. });
  1484. });
  1485. }
  1486. batchMeta.push({
  1487. block,
  1488. position: i,
  1489. clientId: block.clientId
  1490. });
  1491. }
  1492. for (const widget of deletedWidgets) {
  1493. batchTasks.push(_ref8 => {
  1494. let {
  1495. deleteEntityRecord
  1496. } = _ref8;
  1497. return deleteEntityRecord('root', 'widget', widget.id, {
  1498. force: true
  1499. });
  1500. });
  1501. }
  1502. const records = await registry.dispatch(external_wp_coreData_namespaceObject.store).__experimentalBatch(batchTasks);
  1503. const preservedRecords = records.filter(record => !record.hasOwnProperty('deleted'));
  1504. const failedWidgetNames = [];
  1505. for (let i = 0; i < preservedRecords.length; i++) {
  1506. const widget = preservedRecords[i];
  1507. const {
  1508. block,
  1509. position
  1510. } = batchMeta[i]; // Set __internalWidgetId on the block. This will be persisted to the
  1511. // store when we dispatch receiveEntityRecords( post ) below.
  1512. post.blocks[position].attributes.__internalWidgetId = widget.id;
  1513. const error = registry.select(external_wp_coreData_namespaceObject.store).getLastEntitySaveError('root', 'widget', widget.id);
  1514. if (error) {
  1515. var _block$attributes;
  1516. failedWidgetNames.push(((_block$attributes = block.attributes) === null || _block$attributes === void 0 ? void 0 : _block$attributes.name) || (block === null || block === void 0 ? void 0 : block.name));
  1517. }
  1518. if (!sidebarWidgetsIds[position]) {
  1519. sidebarWidgetsIds[position] = widget.id;
  1520. }
  1521. }
  1522. if (failedWidgetNames.length) {
  1523. throw new Error((0,external_wp_i18n_namespaceObject.sprintf)(
  1524. /* translators: %s: List of widget names */
  1525. (0,external_wp_i18n_namespaceObject.__)('Could not save the following widgets: %s.'), failedWidgetNames.join(', ')));
  1526. }
  1527. registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord(KIND, WIDGET_AREA_ENTITY_TYPE, widgetAreaId, {
  1528. widgets: sidebarWidgetsIds
  1529. }, {
  1530. undoIgnore: true
  1531. });
  1532. dispatch(trySaveWidgetArea(widgetAreaId));
  1533. registry.dispatch(external_wp_coreData_namespaceObject.store).receiveEntityRecords(KIND, POST_TYPE, post, undefined);
  1534. };
  1535. const trySaveWidgetArea = widgetAreaId => _ref9 => {
  1536. let {
  1537. registry
  1538. } = _ref9;
  1539. registry.dispatch(external_wp_coreData_namespaceObject.store).saveEditedEntityRecord(KIND, WIDGET_AREA_ENTITY_TYPE, widgetAreaId, {
  1540. throwOnError: true
  1541. });
  1542. };
  1543. /**
  1544. * Sets the clientId stored for a particular widgetId.
  1545. *
  1546. * @param {number} clientId Client id.
  1547. * @param {number} widgetId Widget id.
  1548. *
  1549. * @return {Object} Action.
  1550. */
  1551. function setWidgetIdForClientId(clientId, widgetId) {
  1552. return {
  1553. type: 'SET_WIDGET_ID_FOR_CLIENT_ID',
  1554. clientId,
  1555. widgetId
  1556. };
  1557. }
  1558. /**
  1559. * Sets the open state of all the widget areas.
  1560. *
  1561. * @param {Object} widgetAreasOpenState The open states of all the widget areas.
  1562. *
  1563. * @return {Object} Action.
  1564. */
  1565. function setWidgetAreasOpenState(widgetAreasOpenState) {
  1566. return {
  1567. type: 'SET_WIDGET_AREAS_OPEN_STATE',
  1568. widgetAreasOpenState
  1569. };
  1570. }
  1571. /**
  1572. * Sets the open state of the widget area.
  1573. *
  1574. * @param {string} clientId The clientId of the widget area.
  1575. * @param {boolean} isOpen Whether the widget area should be opened.
  1576. *
  1577. * @return {Object} Action.
  1578. */
  1579. function setIsWidgetAreaOpen(clientId, isOpen) {
  1580. return {
  1581. type: 'SET_IS_WIDGET_AREA_OPEN',
  1582. clientId,
  1583. isOpen
  1584. };
  1585. }
  1586. /**
  1587. * Returns an action object used to open/close the inserter.
  1588. *
  1589. * @param {boolean|Object} value Whether the inserter should be
  1590. * opened (true) or closed (false).
  1591. * To specify an insertion point,
  1592. * use an object.
  1593. * @param {string} value.rootClientId The root client ID to insert at.
  1594. * @param {number} value.insertionIndex The index to insert at.
  1595. *
  1596. * @return {Object} Action object.
  1597. */
  1598. function setIsInserterOpened(value) {
  1599. return {
  1600. type: 'SET_IS_INSERTER_OPENED',
  1601. value
  1602. };
  1603. }
  1604. /**
  1605. * Returns an action object used to open/close the list view.
  1606. *
  1607. * @param {boolean} isOpen A boolean representing whether the list view should be opened or closed.
  1608. * @return {Object} Action object.
  1609. */
  1610. function setIsListViewOpened(isOpen) {
  1611. return {
  1612. type: 'SET_IS_LIST_VIEW_OPENED',
  1613. isOpen
  1614. };
  1615. }
  1616. /**
  1617. * Returns an action object signalling that the user closed the sidebar.
  1618. *
  1619. * @return {Object} Action creator.
  1620. */
  1621. const closeGeneralSidebar = () => _ref10 => {
  1622. let {
  1623. registry
  1624. } = _ref10;
  1625. registry.dispatch(store).disableComplementaryArea(constants_STORE_NAME);
  1626. };
  1627. /**
  1628. * Action that handles moving a block between widget areas
  1629. *
  1630. * @param {string} clientId The clientId of the block to move.
  1631. * @param {string} widgetAreaId The id of the widget area to move the block to.
  1632. */
  1633. const moveBlockToWidgetArea = (clientId, widgetAreaId) => async _ref11 => {
  1634. let {
  1635. dispatch,
  1636. select,
  1637. registry
  1638. } = _ref11;
  1639. const sourceRootClientId = registry.select(external_wp_blockEditor_namespaceObject.store).getBlockRootClientId([clientId]); // Search the top level blocks (widget areas) for the one with the matching
  1640. // id attribute. Makes the assumption that all top-level blocks are widget
  1641. // areas.
  1642. const widgetAreas = registry.select(external_wp_blockEditor_namespaceObject.store).getBlocks();
  1643. const destinationWidgetAreaBlock = widgetAreas.find(_ref12 => {
  1644. let {
  1645. attributes
  1646. } = _ref12;
  1647. return attributes.id === widgetAreaId;
  1648. });
  1649. const destinationRootClientId = destinationWidgetAreaBlock.clientId; // Get the index for moving to the end of the destination widget area.
  1650. const destinationInnerBlocksClientIds = registry.select(external_wp_blockEditor_namespaceObject.store).getBlockOrder(destinationRootClientId);
  1651. const destinationIndex = destinationInnerBlocksClientIds.length; // Reveal the widget area, if it's not open.
  1652. const isDestinationWidgetAreaOpen = select.getIsWidgetAreaOpen(destinationRootClientId);
  1653. if (!isDestinationWidgetAreaOpen) {
  1654. dispatch.setIsWidgetAreaOpen(destinationRootClientId, true);
  1655. } // Move the block.
  1656. registry.dispatch(external_wp_blockEditor_namespaceObject.store).moveBlocksToPosition([clientId], sourceRootClientId, destinationRootClientId, destinationIndex);
  1657. };
  1658. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/store/resolvers.js
  1659. /**
  1660. * WordPress dependencies
  1661. */
  1662. /**
  1663. * Internal dependencies
  1664. */
  1665. /**
  1666. * Creates a "stub" widgets post reflecting all available widget areas. The
  1667. * post is meant as a convenient to only exists in runtime and should never be saved. It
  1668. * enables a convenient way of editing the widgets by using a regular post editor.
  1669. *
  1670. * Fetches all widgets from all widgets aras, converts them into blocks, and hydrates a new post with them.
  1671. *
  1672. * @return {Function} An action creator.
  1673. */
  1674. const getWidgetAreas = () => async _ref => {
  1675. let {
  1676. dispatch,
  1677. registry
  1678. } = _ref;
  1679. const query = buildWidgetAreasQuery();
  1680. const widgetAreas = await registry.resolveSelect(external_wp_coreData_namespaceObject.store).getEntityRecords(KIND, WIDGET_AREA_ENTITY_TYPE, query);
  1681. const widgetAreaBlocks = [];
  1682. const sortedWidgetAreas = widgetAreas.sort((a, b) => {
  1683. if (a.id === 'wp_inactive_widgets') {
  1684. return 1;
  1685. }
  1686. if (b.id === 'wp_inactive_widgets') {
  1687. return -1;
  1688. }
  1689. return 0;
  1690. });
  1691. for (const widgetArea of sortedWidgetAreas) {
  1692. widgetAreaBlocks.push((0,external_wp_blocks_namespaceObject.createBlock)('core/widget-area', {
  1693. id: widgetArea.id,
  1694. name: widgetArea.name
  1695. }));
  1696. if (!widgetArea.widgets.length) {
  1697. // If this widget area has no widgets, it won't get a post setup by
  1698. // the getWidgets resolver.
  1699. dispatch(persistStubPost(buildWidgetAreaPostId(widgetArea.id), []));
  1700. }
  1701. }
  1702. const widgetAreasOpenState = {};
  1703. widgetAreaBlocks.forEach((widgetAreaBlock, index) => {
  1704. // Defaults to open the first widget area.
  1705. widgetAreasOpenState[widgetAreaBlock.clientId] = index === 0;
  1706. });
  1707. dispatch(setWidgetAreasOpenState(widgetAreasOpenState));
  1708. dispatch(persistStubPost(buildWidgetAreasPostId(), widgetAreaBlocks));
  1709. };
  1710. /**
  1711. * Fetches all widgets from all widgets ares, and groups them by widget area Id.
  1712. *
  1713. * @return {Function} An action creator.
  1714. */
  1715. const getWidgets = () => async _ref2 => {
  1716. let {
  1717. dispatch,
  1718. registry
  1719. } = _ref2;
  1720. const query = buildWidgetsQuery();
  1721. const widgets = await registry.resolveSelect(external_wp_coreData_namespaceObject.store).getEntityRecords('root', 'widget', query);
  1722. const groupedBySidebar = {};
  1723. for (const widget of widgets) {
  1724. const block = transformWidgetToBlock(widget);
  1725. groupedBySidebar[widget.sidebar] = groupedBySidebar[widget.sidebar] || [];
  1726. groupedBySidebar[widget.sidebar].push(block);
  1727. }
  1728. for (const sidebarId in groupedBySidebar) {
  1729. if (groupedBySidebar.hasOwnProperty(sidebarId)) {
  1730. // Persist the actual post containing the widget block
  1731. dispatch(persistStubPost(buildWidgetAreaPostId(sidebarId), groupedBySidebar[sidebarId]));
  1732. }
  1733. }
  1734. };
  1735. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/store/selectors.js
  1736. /**
  1737. * WordPress dependencies
  1738. */
  1739. /**
  1740. * Internal dependencies
  1741. */
  1742. /**
  1743. * Returns all API widgets.
  1744. *
  1745. * @return {Object[]} API List of widgets.
  1746. */
  1747. const selectors_getWidgets = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => {
  1748. const widgets = select(external_wp_coreData_namespaceObject.store).getEntityRecords('root', 'widget', buildWidgetsQuery());
  1749. return (// Key widgets by their ID.
  1750. (widgets === null || widgets === void 0 ? void 0 : widgets.reduce((allWidgets, widget) => ({ ...allWidgets,
  1751. [widget.id]: widget
  1752. }), {})) || {}
  1753. );
  1754. });
  1755. /**
  1756. * Returns API widget data for a particular widget ID.
  1757. *
  1758. * @param {number} id Widget ID.
  1759. *
  1760. * @return {Object} API widget data for a particular widget ID.
  1761. */
  1762. const getWidget = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, id) => {
  1763. const widgets = select(constants_STORE_NAME).getWidgets();
  1764. return widgets[id];
  1765. });
  1766. /**
  1767. * Returns all API widget areas.
  1768. *
  1769. * @return {Object[]} API List of widget areas.
  1770. */
  1771. const selectors_getWidgetAreas = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => {
  1772. const query = buildWidgetAreasQuery();
  1773. return select(external_wp_coreData_namespaceObject.store).getEntityRecords(KIND, WIDGET_AREA_ENTITY_TYPE, query);
  1774. });
  1775. /**
  1776. * Returns widgetArea containing a block identify by given widgetId
  1777. *
  1778. * @param {string} widgetId The ID of the widget.
  1779. * @return {Object} Containing widget area.
  1780. */
  1781. const getWidgetAreaForWidgetId = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, widgetId) => {
  1782. const widgetAreas = select(constants_STORE_NAME).getWidgetAreas();
  1783. return widgetAreas.find(widgetArea => {
  1784. const post = select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord(KIND, POST_TYPE, buildWidgetAreaPostId(widgetArea.id));
  1785. const blockWidgetIds = post.blocks.map(block => (0,external_wp_widgets_namespaceObject.getWidgetIdFromBlock)(block));
  1786. return blockWidgetIds.includes(widgetId);
  1787. });
  1788. });
  1789. /**
  1790. * Given a child client id, returns the parent widget area block.
  1791. *
  1792. * @param {string} clientId The client id of a block in a widget area.
  1793. *
  1794. * @return {WPBlock} The widget area block.
  1795. */
  1796. const getParentWidgetAreaBlock = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, clientId) => {
  1797. const {
  1798. getBlock,
  1799. getBlockName,
  1800. getBlockParents
  1801. } = select(external_wp_blockEditor_namespaceObject.store);
  1802. const blockParents = getBlockParents(clientId);
  1803. const widgetAreaClientId = blockParents.find(parentClientId => getBlockName(parentClientId) === 'core/widget-area');
  1804. return getBlock(widgetAreaClientId);
  1805. });
  1806. /**
  1807. * Returns all edited widget area entity records.
  1808. *
  1809. * @return {Object[]} List of edited widget area entity records.
  1810. */
  1811. const getEditedWidgetAreas = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, ids) => {
  1812. let widgetAreas = select(constants_STORE_NAME).getWidgetAreas();
  1813. if (!widgetAreas) {
  1814. return [];
  1815. }
  1816. if (ids) {
  1817. widgetAreas = widgetAreas.filter(_ref => {
  1818. let {
  1819. id
  1820. } = _ref;
  1821. return ids.includes(id);
  1822. });
  1823. }
  1824. return widgetAreas.filter(_ref2 => {
  1825. let {
  1826. id
  1827. } = _ref2;
  1828. return select(external_wp_coreData_namespaceObject.store).hasEditsForEntityRecord(KIND, POST_TYPE, buildWidgetAreaPostId(id));
  1829. }).map(_ref3 => {
  1830. let {
  1831. id
  1832. } = _ref3;
  1833. return select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord(KIND, WIDGET_AREA_ENTITY_TYPE, id);
  1834. });
  1835. });
  1836. /**
  1837. * Returns all blocks representing reference widgets.
  1838. *
  1839. * @param {string} referenceWidgetName Optional. If given, only reference widgets with this name will be returned.
  1840. * @return {Array} List of all blocks representing reference widgets
  1841. */
  1842. const getReferenceWidgetBlocks = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => function (state) {
  1843. let referenceWidgetName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  1844. const results = [];
  1845. const widgetAreas = select(constants_STORE_NAME).getWidgetAreas();
  1846. for (const _widgetArea of widgetAreas) {
  1847. const post = select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord(KIND, POST_TYPE, buildWidgetAreaPostId(_widgetArea.id));
  1848. for (const block of post.blocks) {
  1849. var _block$attributes;
  1850. if (block.name === 'core/legacy-widget' && (!referenceWidgetName || ((_block$attributes = block.attributes) === null || _block$attributes === void 0 ? void 0 : _block$attributes.referenceWidgetName) === referenceWidgetName)) {
  1851. results.push(block);
  1852. }
  1853. }
  1854. }
  1855. return results;
  1856. });
  1857. /**
  1858. * Returns true if any widget area is currently being saved.
  1859. *
  1860. * @return {boolean} True if any widget area is currently being saved. False otherwise.
  1861. */
  1862. const isSavingWidgetAreas = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => {
  1863. var _select$getWidgetArea;
  1864. const widgetAreasIds = (_select$getWidgetArea = select(constants_STORE_NAME).getWidgetAreas()) === null || _select$getWidgetArea === void 0 ? void 0 : _select$getWidgetArea.map(_ref4 => {
  1865. let {
  1866. id
  1867. } = _ref4;
  1868. return id;
  1869. });
  1870. if (!widgetAreasIds) {
  1871. return false;
  1872. }
  1873. for (const id of widgetAreasIds) {
  1874. const isSaving = select(external_wp_coreData_namespaceObject.store).isSavingEntityRecord(KIND, WIDGET_AREA_ENTITY_TYPE, id);
  1875. if (isSaving) {
  1876. return true;
  1877. }
  1878. }
  1879. const widgetIds = [...Object.keys(select(constants_STORE_NAME).getWidgets()), undefined // account for new widgets without an ID
  1880. ];
  1881. for (const id of widgetIds) {
  1882. const isSaving = select(external_wp_coreData_namespaceObject.store).isSavingEntityRecord('root', 'widget', id);
  1883. if (isSaving) {
  1884. return true;
  1885. }
  1886. }
  1887. return false;
  1888. });
  1889. /**
  1890. * Gets whether the widget area is opened.
  1891. *
  1892. * @param {Array} state The open state of the widget areas.
  1893. * @param {string} clientId The clientId of the widget area.
  1894. *
  1895. * @return {boolean} True if the widget area is open.
  1896. */
  1897. const getIsWidgetAreaOpen = (state, clientId) => {
  1898. const {
  1899. widgetAreasOpenState
  1900. } = state;
  1901. return !!widgetAreasOpenState[clientId];
  1902. };
  1903. /**
  1904. * Returns true if the inserter is opened.
  1905. *
  1906. * @param {Object} state Global application state.
  1907. *
  1908. * @return {boolean} Whether the inserter is opened.
  1909. */
  1910. function isInserterOpened(state) {
  1911. return !!state.blockInserterPanel;
  1912. }
  1913. /**
  1914. * Get the insertion point for the inserter.
  1915. *
  1916. * @param {Object} state Global application state.
  1917. *
  1918. * @return {Object} The root client ID and index to insert at.
  1919. */
  1920. function __experimentalGetInsertionPoint(state) {
  1921. const {
  1922. rootClientId,
  1923. insertionIndex
  1924. } = state.blockInserterPanel;
  1925. return {
  1926. rootClientId,
  1927. insertionIndex
  1928. };
  1929. }
  1930. /**
  1931. * Returns true if a block can be inserted into a widget area.
  1932. *
  1933. * @param {Array} state The open state of the widget areas.
  1934. * @param {string} blockName The name of the block being inserted.
  1935. *
  1936. * @return {boolean} True if the block can be inserted in a widget area.
  1937. */
  1938. const canInsertBlockInWidgetArea = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, blockName) => {
  1939. // Widget areas are always top-level blocks, which getBlocks will return.
  1940. const widgetAreas = select(external_wp_blockEditor_namespaceObject.store).getBlocks(); // Makes an assumption that a block that can be inserted into one
  1941. // widget area can be inserted into any widget area. Uses the first
  1942. // widget area for testing whether the block can be inserted.
  1943. const [firstWidgetArea] = widgetAreas;
  1944. return select(external_wp_blockEditor_namespaceObject.store).canInsertBlockType(blockName, firstWidgetArea.clientId);
  1945. });
  1946. /**
  1947. * Returns true if the list view is opened.
  1948. *
  1949. * @param {Object} state Global application state.
  1950. *
  1951. * @return {boolean} Whether the list view is opened.
  1952. */
  1953. function isListViewOpened(state) {
  1954. return state.listViewPanel;
  1955. }
  1956. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/store/index.js
  1957. /**
  1958. * WordPress dependencies
  1959. */
  1960. /**
  1961. * Internal dependencies
  1962. */
  1963. /**
  1964. * Block editor data store configuration.
  1965. *
  1966. * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#register
  1967. *
  1968. * @type {Object}
  1969. */
  1970. const storeConfig = {
  1971. reducer: reducer,
  1972. selectors: store_selectors_namespaceObject,
  1973. resolvers: resolvers_namespaceObject,
  1974. actions: store_actions_namespaceObject
  1975. };
  1976. /**
  1977. * Store definition for the edit widgets namespace.
  1978. *
  1979. * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore
  1980. *
  1981. * @type {Object}
  1982. */
  1983. const store_store = (0,external_wp_data_namespaceObject.createReduxStore)(constants_STORE_NAME, storeConfig);
  1984. (0,external_wp_data_namespaceObject.register)(store_store); // This package uses a few in-memory post types as wrappers for convenience.
  1985. // This middleware prevents any network requests related to these types as they are
  1986. // bound to fail anyway.
  1987. external_wp_apiFetch_default().use(function (options, next) {
  1988. var _options$path;
  1989. if (((_options$path = options.path) === null || _options$path === void 0 ? void 0 : _options$path.indexOf('/wp/v2/types/widget-area')) === 0) {
  1990. return Promise.resolve({});
  1991. }
  1992. return next(options);
  1993. });
  1994. ;// CONCATENATED MODULE: external ["wp","hooks"]
  1995. var external_wp_hooks_namespaceObject = window["wp"]["hooks"];
  1996. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/filters/move-to-widget-area.js
  1997. /**
  1998. * WordPress dependencies
  1999. */
  2000. /**
  2001. * Internal dependencies
  2002. */
  2003. const withMoveToWidgetAreaToolbarItem = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(BlockEdit => props => {
  2004. const {
  2005. clientId,
  2006. name: blockName
  2007. } = props;
  2008. const {
  2009. widgetAreas,
  2010. currentWidgetAreaId,
  2011. canInsertBlockInWidgetArea
  2012. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  2013. var _widgetAreaBlock$attr;
  2014. // Component won't display for a widget area, so don't run selectors.
  2015. if (blockName === 'core/widget-area') {
  2016. return {};
  2017. }
  2018. const selectors = select(store_store);
  2019. const widgetAreaBlock = selectors.getParentWidgetAreaBlock(clientId);
  2020. return {
  2021. widgetAreas: selectors.getWidgetAreas(),
  2022. currentWidgetAreaId: widgetAreaBlock === null || widgetAreaBlock === void 0 ? void 0 : (_widgetAreaBlock$attr = widgetAreaBlock.attributes) === null || _widgetAreaBlock$attr === void 0 ? void 0 : _widgetAreaBlock$attr.id,
  2023. canInsertBlockInWidgetArea: selectors.canInsertBlockInWidgetArea(blockName)
  2024. };
  2025. }, [clientId, blockName]);
  2026. const {
  2027. moveBlockToWidgetArea
  2028. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  2029. const hasMultipleWidgetAreas = (widgetAreas === null || widgetAreas === void 0 ? void 0 : widgetAreas.length) > 1;
  2030. const isMoveToWidgetAreaVisible = blockName !== 'core/widget-area' && hasMultipleWidgetAreas && canInsertBlockInWidgetArea;
  2031. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(BlockEdit, props), isMoveToWidgetAreaVisible && (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_widgets_namespaceObject.MoveToWidgetArea, {
  2032. widgetAreas: widgetAreas,
  2033. currentWidgetAreaId: currentWidgetAreaId,
  2034. onSelect: widgetAreaId => {
  2035. moveBlockToWidgetArea(props.clientId, widgetAreaId);
  2036. }
  2037. })));
  2038. }, 'withMoveToWidgetAreaToolbarItem');
  2039. (0,external_wp_hooks_namespaceObject.addFilter)('editor.BlockEdit', 'core/edit-widgets/block-edit', withMoveToWidgetAreaToolbarItem);
  2040. ;// CONCATENATED MODULE: external ["wp","mediaUtils"]
  2041. var external_wp_mediaUtils_namespaceObject = window["wp"]["mediaUtils"];
  2042. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/filters/replace-media-upload.js
  2043. /**
  2044. * WordPress dependencies
  2045. */
  2046. const replaceMediaUpload = () => external_wp_mediaUtils_namespaceObject.MediaUpload;
  2047. (0,external_wp_hooks_namespaceObject.addFilter)('editor.MediaUpload', 'core/edit-widgets/replace-media-upload', replaceMediaUpload);
  2048. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/filters/index.js
  2049. /**
  2050. * Internal dependencies
  2051. */
  2052. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/blocks/widget-area/edit/use-is-dragging-within.js
  2053. /**
  2054. * WordPress dependencies
  2055. */
  2056. /** @typedef {import('@wordpress/element').RefObject} RefObject */
  2057. /**
  2058. * A React hook to determine if it's dragging within the target element.
  2059. *
  2060. * @param {RefObject<HTMLElement>} elementRef The target elementRef object.
  2061. *
  2062. * @return {boolean} Is dragging within the target element.
  2063. */
  2064. const useIsDraggingWithin = elementRef => {
  2065. const [isDraggingWithin, setIsDraggingWithin] = (0,external_wp_element_namespaceObject.useState)(false);
  2066. (0,external_wp_element_namespaceObject.useEffect)(() => {
  2067. const {
  2068. ownerDocument
  2069. } = elementRef.current;
  2070. function handleDragStart(event) {
  2071. // Check the first time when the dragging starts.
  2072. handleDragEnter(event);
  2073. } // Set to false whenever the user cancel the drag event by either releasing the mouse or press Escape.
  2074. function handleDragEnd() {
  2075. setIsDraggingWithin(false);
  2076. }
  2077. function handleDragEnter(event) {
  2078. // Check if the current target is inside the item element.
  2079. if (elementRef.current.contains(event.target)) {
  2080. setIsDraggingWithin(true);
  2081. } else {
  2082. setIsDraggingWithin(false);
  2083. }
  2084. } // Bind these events to the document to catch all drag events.
  2085. // Ideally, we can also use `event.relatedTarget`, but sadly that doesn't work in Safari.
  2086. ownerDocument.addEventListener('dragstart', handleDragStart);
  2087. ownerDocument.addEventListener('dragend', handleDragEnd);
  2088. ownerDocument.addEventListener('dragenter', handleDragEnter);
  2089. return () => {
  2090. ownerDocument.removeEventListener('dragstart', handleDragStart);
  2091. ownerDocument.removeEventListener('dragend', handleDragEnd);
  2092. ownerDocument.removeEventListener('dragenter', handleDragEnter);
  2093. };
  2094. }, []);
  2095. return isDraggingWithin;
  2096. };
  2097. /* harmony default export */ var use_is_dragging_within = (useIsDraggingWithin);
  2098. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/blocks/widget-area/edit/inner-blocks.js
  2099. /**
  2100. * External dependencies
  2101. */
  2102. /**
  2103. * WordPress dependencies
  2104. */
  2105. /**
  2106. * Internal dependencies
  2107. */
  2108. function WidgetAreaInnerBlocks(_ref) {
  2109. let {
  2110. id
  2111. } = _ref;
  2112. const [blocks, onInput, onChange] = (0,external_wp_coreData_namespaceObject.useEntityBlockEditor)('root', 'postType');
  2113. const innerBlocksRef = (0,external_wp_element_namespaceObject.useRef)();
  2114. const isDraggingWithinInnerBlocks = use_is_dragging_within(innerBlocksRef);
  2115. const shouldHighlightDropZone = isDraggingWithinInnerBlocks; // Using the experimental hook so that we can control the className of the element.
  2116. const innerBlocksProps = (0,external_wp_blockEditor_namespaceObject.useInnerBlocksProps)({
  2117. ref: innerBlocksRef
  2118. }, {
  2119. value: blocks,
  2120. onInput,
  2121. onChange,
  2122. templateLock: false,
  2123. renderAppender: external_wp_blockEditor_namespaceObject.InnerBlocks.ButtonBlockAppender
  2124. });
  2125. return (0,external_wp_element_namespaceObject.createElement)("div", {
  2126. "data-widget-area-id": id,
  2127. className: classnames_default()('wp-block-widget-area__inner-blocks block-editor-inner-blocks editor-styles-wrapper', {
  2128. 'wp-block-widget-area__highlight-drop-zone': shouldHighlightDropZone
  2129. })
  2130. }, (0,external_wp_element_namespaceObject.createElement)("div", innerBlocksProps));
  2131. }
  2132. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/blocks/widget-area/edit/index.js
  2133. /**
  2134. * WordPress dependencies
  2135. */
  2136. /**
  2137. * Internal dependencies
  2138. */
  2139. /** @typedef {import('@wordpress/element').RefObject} RefObject */
  2140. function WidgetAreaEdit(_ref) {
  2141. let {
  2142. clientId,
  2143. className,
  2144. attributes: {
  2145. id,
  2146. name
  2147. }
  2148. } = _ref;
  2149. const isOpen = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getIsWidgetAreaOpen(clientId), [clientId]);
  2150. const {
  2151. setIsWidgetAreaOpen
  2152. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  2153. const wrapper = (0,external_wp_element_namespaceObject.useRef)();
  2154. const setOpen = (0,external_wp_element_namespaceObject.useCallback)(openState => setIsWidgetAreaOpen(clientId, openState), [clientId]);
  2155. const isDragging = useIsDragging(wrapper);
  2156. const isDraggingWithin = use_is_dragging_within(wrapper);
  2157. const [openedWhileDragging, setOpenedWhileDragging] = (0,external_wp_element_namespaceObject.useState)(false);
  2158. (0,external_wp_element_namespaceObject.useEffect)(() => {
  2159. if (!isDragging) {
  2160. setOpenedWhileDragging(false);
  2161. return;
  2162. }
  2163. if (isDraggingWithin && !isOpen) {
  2164. setOpen(true);
  2165. setOpenedWhileDragging(true);
  2166. } else if (!isDraggingWithin && isOpen && openedWhileDragging) {
  2167. setOpen(false);
  2168. }
  2169. }, [isOpen, isDragging, isDraggingWithin, openedWhileDragging]);
  2170. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Panel, {
  2171. className: className,
  2172. ref: wrapper
  2173. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
  2174. title: name,
  2175. opened: isOpen,
  2176. onToggle: () => {
  2177. setIsWidgetAreaOpen(clientId, !isOpen);
  2178. },
  2179. scrollAfterOpen: !isDragging
  2180. }, _ref2 => {
  2181. let {
  2182. opened
  2183. } = _ref2;
  2184. return (// This is required to ensure LegacyWidget blocks are not
  2185. // unmounted when the panel is collapsed. Unmounting legacy
  2186. // widgets may have unintended consequences (e.g. TinyMCE
  2187. // not being properly reinitialized)
  2188. (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableDisclosureContent, {
  2189. className: "wp-block-widget-area__panel-body-content",
  2190. visible: opened
  2191. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_coreData_namespaceObject.EntityProvider, {
  2192. kind: "root",
  2193. type: "postType",
  2194. id: `widget-area-${id}`
  2195. }, (0,external_wp_element_namespaceObject.createElement)(WidgetAreaInnerBlocks, {
  2196. id: id
  2197. })))
  2198. );
  2199. }));
  2200. }
  2201. /**
  2202. * A React hook to determine if dragging is active.
  2203. *
  2204. * @param {RefObject<HTMLElement>} elementRef The target elementRef object.
  2205. *
  2206. * @return {boolean} Is dragging within the entire document.
  2207. */
  2208. const useIsDragging = elementRef => {
  2209. const [isDragging, setIsDragging] = (0,external_wp_element_namespaceObject.useState)(false);
  2210. (0,external_wp_element_namespaceObject.useEffect)(() => {
  2211. const {
  2212. ownerDocument
  2213. } = elementRef.current;
  2214. function handleDragStart() {
  2215. setIsDragging(true);
  2216. }
  2217. function handleDragEnd() {
  2218. setIsDragging(false);
  2219. }
  2220. ownerDocument.addEventListener('dragstart', handleDragStart);
  2221. ownerDocument.addEventListener('dragend', handleDragEnd);
  2222. return () => {
  2223. ownerDocument.removeEventListener('dragstart', handleDragStart);
  2224. ownerDocument.removeEventListener('dragend', handleDragEnd);
  2225. };
  2226. }, []);
  2227. return isDragging;
  2228. };
  2229. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/blocks/widget-area/index.js
  2230. /**
  2231. * WordPress dependencies
  2232. */
  2233. /**
  2234. * Internal dependencies
  2235. */
  2236. const metadata = {
  2237. name: "core/widget-area",
  2238. category: "widgets",
  2239. attributes: {
  2240. id: {
  2241. type: "string"
  2242. },
  2243. name: {
  2244. type: "string"
  2245. }
  2246. },
  2247. supports: {
  2248. html: false,
  2249. inserter: false,
  2250. customClassName: false,
  2251. reusable: false,
  2252. __experimentalToolbar: false,
  2253. __experimentalParentSelector: false,
  2254. __experimentalDisableBlockOverlay: true
  2255. },
  2256. editorStyle: "wp-block-widget-area-editor",
  2257. style: "wp-block-widget-area"
  2258. };
  2259. const {
  2260. name: widget_area_name
  2261. } = metadata;
  2262. const settings = {
  2263. title: (0,external_wp_i18n_namespaceObject.__)('Widget Area'),
  2264. description: (0,external_wp_i18n_namespaceObject.__)('A widget area container.'),
  2265. __experimentalLabel: _ref => {
  2266. let {
  2267. name: label
  2268. } = _ref;
  2269. return label;
  2270. },
  2271. edit: WidgetAreaEdit
  2272. };
  2273. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/components/error-boundary/index.js
  2274. /**
  2275. * WordPress dependencies
  2276. */
  2277. function CopyButton(_ref) {
  2278. let {
  2279. text,
  2280. children
  2281. } = _ref;
  2282. const ref = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(text);
  2283. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  2284. variant: "secondary",
  2285. ref: ref
  2286. }, children);
  2287. }
  2288. class ErrorBoundary extends external_wp_element_namespaceObject.Component {
  2289. constructor() {
  2290. super(...arguments);
  2291. this.reboot = this.reboot.bind(this);
  2292. this.state = {
  2293. error: null
  2294. };
  2295. }
  2296. componentDidCatch(error) {
  2297. this.setState({
  2298. error
  2299. });
  2300. (0,external_wp_hooks_namespaceObject.doAction)('editor.ErrorBoundary.errorLogged', error);
  2301. }
  2302. reboot() {
  2303. this.props.onError();
  2304. }
  2305. render() {
  2306. const {
  2307. error
  2308. } = this.state;
  2309. if (!error) {
  2310. return this.props.children;
  2311. }
  2312. return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.Warning, {
  2313. className: "edit-widgets-error-boundary",
  2314. actions: [(0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  2315. key: "recovery",
  2316. onClick: this.reboot,
  2317. variant: "secondary"
  2318. }, (0,external_wp_i18n_namespaceObject.__)('Attempt Recovery')), (0,external_wp_element_namespaceObject.createElement)(CopyButton, {
  2319. key: "copy-error",
  2320. text: error.stack
  2321. }, (0,external_wp_i18n_namespaceObject.__)('Copy Error'))]
  2322. }, (0,external_wp_i18n_namespaceObject.__)('The editor has encountered an unexpected error.'));
  2323. }
  2324. }
  2325. ;// CONCATENATED MODULE: external ["wp","reusableBlocks"]
  2326. var external_wp_reusableBlocks_namespaceObject = window["wp"]["reusableBlocks"];
  2327. ;// CONCATENATED MODULE: external ["wp","keyboardShortcuts"]
  2328. var external_wp_keyboardShortcuts_namespaceObject = window["wp"]["keyboardShortcuts"];
  2329. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/components/keyboard-shortcuts/index.js
  2330. /**
  2331. * WordPress dependencies
  2332. */
  2333. /**
  2334. * Internal dependencies
  2335. */
  2336. function KeyboardShortcuts() {
  2337. const {
  2338. redo,
  2339. undo
  2340. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
  2341. const {
  2342. saveEditedWidgetAreas
  2343. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  2344. (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-widgets/undo', event => {
  2345. undo();
  2346. event.preventDefault();
  2347. });
  2348. (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-widgets/redo', event => {
  2349. redo();
  2350. event.preventDefault();
  2351. });
  2352. (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-widgets/save', event => {
  2353. event.preventDefault();
  2354. saveEditedWidgetAreas();
  2355. });
  2356. return null;
  2357. }
  2358. function KeyboardShortcutsRegister() {
  2359. // Registering the shortcuts.
  2360. const {
  2361. registerShortcut
  2362. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_keyboardShortcuts_namespaceObject.store);
  2363. (0,external_wp_element_namespaceObject.useEffect)(() => {
  2364. registerShortcut({
  2365. name: 'core/edit-widgets/undo',
  2366. category: 'global',
  2367. description: (0,external_wp_i18n_namespaceObject.__)('Undo your last changes.'),
  2368. keyCombination: {
  2369. modifier: 'primary',
  2370. character: 'z'
  2371. }
  2372. });
  2373. registerShortcut({
  2374. name: 'core/edit-widgets/redo',
  2375. category: 'global',
  2376. description: (0,external_wp_i18n_namespaceObject.__)('Redo your last undo.'),
  2377. keyCombination: {
  2378. modifier: 'primaryShift',
  2379. character: 'z'
  2380. }
  2381. });
  2382. registerShortcut({
  2383. name: 'core/edit-widgets/save',
  2384. category: 'global',
  2385. description: (0,external_wp_i18n_namespaceObject.__)('Save your changes.'),
  2386. keyCombination: {
  2387. modifier: 'primary',
  2388. character: 's'
  2389. }
  2390. });
  2391. registerShortcut({
  2392. name: 'core/edit-widgets/keyboard-shortcuts',
  2393. category: 'main',
  2394. description: (0,external_wp_i18n_namespaceObject.__)('Display these keyboard shortcuts.'),
  2395. keyCombination: {
  2396. modifier: 'access',
  2397. character: 'h'
  2398. }
  2399. });
  2400. registerShortcut({
  2401. name: 'core/edit-widgets/next-region',
  2402. category: 'global',
  2403. description: (0,external_wp_i18n_namespaceObject.__)('Navigate to the next part of the editor.'),
  2404. keyCombination: {
  2405. modifier: 'ctrl',
  2406. character: '`'
  2407. },
  2408. aliases: [{
  2409. modifier: 'access',
  2410. character: 'n'
  2411. }]
  2412. });
  2413. registerShortcut({
  2414. name: 'core/edit-widgets/previous-region',
  2415. category: 'global',
  2416. description: (0,external_wp_i18n_namespaceObject.__)('Navigate to the previous part of the editor.'),
  2417. keyCombination: {
  2418. modifier: 'ctrlShift',
  2419. character: '`'
  2420. },
  2421. aliases: [{
  2422. modifier: 'access',
  2423. character: 'p'
  2424. }]
  2425. });
  2426. }, [registerShortcut]);
  2427. return null;
  2428. }
  2429. KeyboardShortcuts.Register = KeyboardShortcutsRegister;
  2430. /* harmony default export */ var keyboard_shortcuts = (KeyboardShortcuts);
  2431. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/hooks/use-last-selected-widget-area.js
  2432. /**
  2433. * WordPress dependencies
  2434. */
  2435. /**
  2436. * Internal dependencies
  2437. */
  2438. /**
  2439. * A react hook that returns the client id of the last widget area to have
  2440. * been selected, or to have a selected block within it.
  2441. *
  2442. * @return {string} clientId of the widget area last selected.
  2443. */
  2444. const useLastSelectedWidgetArea = () => (0,external_wp_data_namespaceObject.useSelect)(select => {
  2445. var _widgetAreasPost$bloc;
  2446. const {
  2447. getBlockSelectionEnd,
  2448. getBlockName
  2449. } = select(external_wp_blockEditor_namespaceObject.store);
  2450. const selectionEndClientId = getBlockSelectionEnd(); // If the selected block is a widget area, return its clientId.
  2451. if (getBlockName(selectionEndClientId) === 'core/widget-area') {
  2452. return selectionEndClientId;
  2453. }
  2454. const {
  2455. getParentWidgetAreaBlock
  2456. } = select(store_store);
  2457. const widgetAreaBlock = getParentWidgetAreaBlock(selectionEndClientId);
  2458. const widgetAreaBlockClientId = widgetAreaBlock === null || widgetAreaBlock === void 0 ? void 0 : widgetAreaBlock.clientId;
  2459. if (widgetAreaBlockClientId) {
  2460. return widgetAreaBlockClientId;
  2461. } // If no widget area has been selected, return the clientId of the first
  2462. // area.
  2463. const {
  2464. getEntityRecord
  2465. } = select(external_wp_coreData_namespaceObject.store);
  2466. const widgetAreasPost = getEntityRecord(KIND, POST_TYPE, buildWidgetAreasPostId());
  2467. return widgetAreasPost === null || widgetAreasPost === void 0 ? void 0 : (_widgetAreasPost$bloc = widgetAreasPost.blocks[0]) === null || _widgetAreasPost$bloc === void 0 ? void 0 : _widgetAreasPost$bloc.clientId;
  2468. }, []);
  2469. /* harmony default export */ var use_last_selected_widget_area = (useLastSelectedWidgetArea);
  2470. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/constants.js
  2471. const ALLOW_REUSABLE_BLOCKS = false;
  2472. const ENABLE_EXPERIMENTAL_FSE_BLOCKS = false;
  2473. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/components/widget-areas-block-editor-provider/index.js
  2474. /**
  2475. * WordPress dependencies
  2476. */
  2477. /**
  2478. * Internal dependencies
  2479. */
  2480. function WidgetAreasBlockEditorProvider(_ref) {
  2481. let {
  2482. blockEditorSettings,
  2483. children,
  2484. ...props
  2485. } = _ref;
  2486. const mediaPermissions = (0,external_wp_coreData_namespaceObject.useResourcePermissions)('media');
  2487. const {
  2488. reusableBlocks,
  2489. isFixedToolbarActive,
  2490. keepCaretInsideBlock
  2491. } = (0,external_wp_data_namespaceObject.useSelect)(select => ({
  2492. widgetAreas: select(store_store).getWidgetAreas(),
  2493. widgets: select(store_store).getWidgets(),
  2494. reusableBlocks: ALLOW_REUSABLE_BLOCKS ? select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', 'wp_block') : [],
  2495. isFixedToolbarActive: !!select(external_wp_preferences_namespaceObject.store).get('core/edit-widgets', 'fixedToolbar'),
  2496. keepCaretInsideBlock: !!select(external_wp_preferences_namespaceObject.store).get('core/edit-widgets', 'keepCaretInsideBlock')
  2497. }), []);
  2498. const {
  2499. setIsInserterOpened
  2500. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  2501. const settings = (0,external_wp_element_namespaceObject.useMemo)(() => {
  2502. let mediaUploadBlockEditor;
  2503. if (mediaPermissions.canCreate) {
  2504. mediaUploadBlockEditor = _ref2 => {
  2505. let {
  2506. onError,
  2507. ...argumentsObject
  2508. } = _ref2;
  2509. (0,external_wp_mediaUtils_namespaceObject.uploadMedia)({
  2510. wpAllowedMimeTypes: blockEditorSettings.allowedMimeTypes,
  2511. onError: _ref3 => {
  2512. let {
  2513. message
  2514. } = _ref3;
  2515. return onError(message);
  2516. },
  2517. ...argumentsObject
  2518. });
  2519. };
  2520. }
  2521. return { ...blockEditorSettings,
  2522. __experimentalReusableBlocks: reusableBlocks,
  2523. hasFixedToolbar: isFixedToolbarActive,
  2524. keepCaretInsideBlock,
  2525. mediaUpload: mediaUploadBlockEditor,
  2526. templateLock: 'all',
  2527. __experimentalSetIsInserterOpened: setIsInserterOpened
  2528. };
  2529. }, [blockEditorSettings, isFixedToolbarActive, keepCaretInsideBlock, mediaPermissions.canCreate, reusableBlocks, setIsInserterOpened]);
  2530. const widgetAreaId = use_last_selected_widget_area();
  2531. const [blocks, onInput, onChange] = (0,external_wp_coreData_namespaceObject.useEntityBlockEditor)(KIND, POST_TYPE, {
  2532. id: buildWidgetAreasPostId()
  2533. });
  2534. return (0,external_wp_element_namespaceObject.createElement)(external_wp_keyboardShortcuts_namespaceObject.ShortcutProvider, 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)(external_wp_components_namespaceObject.SlotFillProvider, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockEditorProvider, _extends({
  2535. value: blocks,
  2536. onInput: onInput,
  2537. onChange: onChange,
  2538. settings: settings,
  2539. useSubRegistry: false
  2540. }, props), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.CopyHandler, null, children), (0,external_wp_element_namespaceObject.createElement)(external_wp_reusableBlocks_namespaceObject.ReusableBlocksMenuItems, {
  2541. rootClientId: widgetAreaId
  2542. }))));
  2543. }
  2544. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/cog.js
  2545. /**
  2546. * WordPress dependencies
  2547. */
  2548. const cog = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  2549. xmlns: "http://www.w3.org/2000/svg",
  2550. viewBox: "0 0 24 24"
  2551. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  2552. fillRule: "evenodd",
  2553. d: "M10.289 4.836A1 1 0 0111.275 4h1.306a1 1 0 01.987.836l.244 1.466c.787.26 1.503.679 2.108 1.218l1.393-.522a1 1 0 011.216.437l.653 1.13a1 1 0 01-.23 1.273l-1.148.944a6.025 6.025 0 010 2.435l1.149.946a1 1 0 01.23 1.272l-.653 1.13a1 1 0 01-1.216.437l-1.394-.522c-.605.54-1.32.958-2.108 1.218l-.244 1.466a1 1 0 01-.987.836h-1.306a1 1 0 01-.986-.836l-.244-1.466a5.995 5.995 0 01-2.108-1.218l-1.394.522a1 1 0 01-1.217-.436l-.653-1.131a1 1 0 01.23-1.272l1.149-.946a6.026 6.026 0 010-2.435l-1.148-.944a1 1 0 01-.23-1.272l.653-1.131a1 1 0 011.217-.437l1.393.522a5.994 5.994 0 012.108-1.218l.244-1.466zM14.929 12a3 3 0 11-6 0 3 3 0 016 0z",
  2554. clipRule: "evenodd"
  2555. }));
  2556. /* harmony default export */ var library_cog = (cog);
  2557. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/block-default.js
  2558. /**
  2559. * WordPress dependencies
  2560. */
  2561. const blockDefault = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  2562. xmlns: "http://www.w3.org/2000/svg",
  2563. viewBox: "0 0 24 24"
  2564. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  2565. d: "M19 8h-1V6h-5v2h-2V6H6v2H5c-1.1 0-2 .9-2 2v8c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-8c0-1.1-.9-2-2-2zm.5 10c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5v-8c0-.3.2-.5.5-.5h14c.3 0 .5.2.5.5v8z"
  2566. }));
  2567. /* harmony default export */ var block_default = (blockDefault);
  2568. ;// CONCATENATED MODULE: external ["wp","url"]
  2569. var external_wp_url_namespaceObject = window["wp"]["url"];
  2570. ;// CONCATENATED MODULE: external ["wp","dom"]
  2571. var external_wp_dom_namespaceObject = window["wp"]["dom"];
  2572. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/components/sidebar/widget-areas.js
  2573. /**
  2574. * WordPress dependencies
  2575. */
  2576. /**
  2577. * Internal dependencies
  2578. */
  2579. function WidgetAreas(_ref) {
  2580. let {
  2581. selectedWidgetAreaId
  2582. } = _ref;
  2583. const widgetAreas = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getWidgetAreas(), []);
  2584. const selectedWidgetArea = (0,external_wp_element_namespaceObject.useMemo)(() => selectedWidgetAreaId && (widgetAreas === null || widgetAreas === void 0 ? void 0 : widgetAreas.find(widgetArea => widgetArea.id === selectedWidgetAreaId)), [selectedWidgetAreaId, widgetAreas]);
  2585. let description;
  2586. if (!selectedWidgetArea) {
  2587. description = (0,external_wp_i18n_namespaceObject.__)('Widget Areas are global parts in your site’s layout that can accept blocks. These vary by theme, but are typically parts like your Sidebar or Footer.');
  2588. } else if (selectedWidgetAreaId === 'wp_inactive_widgets') {
  2589. description = (0,external_wp_i18n_namespaceObject.__)('Blocks in this Widget Area will not be displayed in your site.');
  2590. } else {
  2591. description = selectedWidgetArea.description;
  2592. }
  2593. return (0,external_wp_element_namespaceObject.createElement)("div", {
  2594. className: "edit-widgets-widget-areas"
  2595. }, (0,external_wp_element_namespaceObject.createElement)("div", {
  2596. className: "edit-widgets-widget-areas__top-container"
  2597. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockIcon, {
  2598. icon: block_default
  2599. }), (0,external_wp_element_namespaceObject.createElement)("div", null, (0,external_wp_element_namespaceObject.createElement)("p", {
  2600. // Use `dangerouslySetInnerHTML` to keep backwards
  2601. // compatibility. Basic markup in the description is an
  2602. // established feature of WordPress.
  2603. // @see https://github.com/WordPress/gutenberg/issues/33106
  2604. dangerouslySetInnerHTML: {
  2605. __html: (0,external_wp_dom_namespaceObject.safeHTML)(description)
  2606. }
  2607. }), (widgetAreas === null || widgetAreas === void 0 ? void 0 : widgetAreas.length) === 0 && (0,external_wp_element_namespaceObject.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('Your theme does not contain any Widget Areas.')), !selectedWidgetArea && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  2608. href: (0,external_wp_url_namespaceObject.addQueryArgs)('customize.php', {
  2609. 'autofocus[panel]': 'widgets',
  2610. return: window.location.pathname
  2611. }),
  2612. variant: "tertiary"
  2613. }, (0,external_wp_i18n_namespaceObject.__)('Manage with live preview')))));
  2614. }
  2615. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/components/sidebar/index.js
  2616. /**
  2617. * External dependencies
  2618. */
  2619. /**
  2620. * WordPress dependencies
  2621. */
  2622. const SIDEBAR_ACTIVE_BY_DEFAULT = external_wp_element_namespaceObject.Platform.select({
  2623. web: true,
  2624. native: false
  2625. });
  2626. const BLOCK_INSPECTOR_IDENTIFIER = 'edit-widgets/block-inspector'; // Widget areas were one called block areas, so use 'edit-widgets/block-areas'
  2627. // for backwards compatibility.
  2628. const WIDGET_AREAS_IDENTIFIER = 'edit-widgets/block-areas';
  2629. /**
  2630. * Internal dependencies
  2631. */
  2632. function ComplementaryAreaTab(_ref) {
  2633. let {
  2634. identifier,
  2635. label,
  2636. isActive
  2637. } = _ref;
  2638. const {
  2639. enableComplementaryArea
  2640. } = (0,external_wp_data_namespaceObject.useDispatch)(store);
  2641. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  2642. onClick: () => enableComplementaryArea(store_store.name, identifier),
  2643. className: classnames_default()('edit-widgets-sidebar__panel-tab', {
  2644. 'is-active': isActive
  2645. }),
  2646. "aria-label": isActive ? // translators: %s: sidebar label e.g: "Widget Areas".
  2647. (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('%s (selected)'), label) : label,
  2648. "data-label": label
  2649. }, label);
  2650. }
  2651. function Sidebar() {
  2652. const {
  2653. enableComplementaryArea
  2654. } = (0,external_wp_data_namespaceObject.useDispatch)(store);
  2655. const {
  2656. currentArea,
  2657. hasSelectedNonAreaBlock,
  2658. isGeneralSidebarOpen,
  2659. selectedWidgetAreaBlock
  2660. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  2661. const {
  2662. getSelectedBlock,
  2663. getBlock,
  2664. getBlockParentsByBlockName
  2665. } = select(external_wp_blockEditor_namespaceObject.store);
  2666. const {
  2667. getActiveComplementaryArea
  2668. } = select(store);
  2669. const selectedBlock = getSelectedBlock();
  2670. const activeArea = getActiveComplementaryArea(store_store.name);
  2671. let currentSelection = activeArea;
  2672. if (!currentSelection) {
  2673. if (selectedBlock) {
  2674. currentSelection = BLOCK_INSPECTOR_IDENTIFIER;
  2675. } else {
  2676. currentSelection = WIDGET_AREAS_IDENTIFIER;
  2677. }
  2678. }
  2679. let widgetAreaBlock;
  2680. if (selectedBlock) {
  2681. if (selectedBlock.name === 'core/widget-area') {
  2682. widgetAreaBlock = selectedBlock;
  2683. } else {
  2684. widgetAreaBlock = getBlock(getBlockParentsByBlockName(selectedBlock.clientId, 'core/widget-area')[0]);
  2685. }
  2686. }
  2687. return {
  2688. currentArea: currentSelection,
  2689. hasSelectedNonAreaBlock: !!(selectedBlock && selectedBlock.name !== 'core/widget-area'),
  2690. isGeneralSidebarOpen: !!activeArea,
  2691. selectedWidgetAreaBlock: widgetAreaBlock
  2692. };
  2693. }, []); // currentArea, and isGeneralSidebarOpen are intentionally left out from the dependencies,
  2694. // because we want to run the effect when a block is selected/unselected and not when the sidebar state changes.
  2695. (0,external_wp_element_namespaceObject.useEffect)(() => {
  2696. if (hasSelectedNonAreaBlock && currentArea === WIDGET_AREAS_IDENTIFIER && isGeneralSidebarOpen) {
  2697. enableComplementaryArea('core/edit-widgets', BLOCK_INSPECTOR_IDENTIFIER);
  2698. }
  2699. if (!hasSelectedNonAreaBlock && currentArea === BLOCK_INSPECTOR_IDENTIFIER && isGeneralSidebarOpen) {
  2700. enableComplementaryArea('core/edit-widgets', WIDGET_AREAS_IDENTIFIER);
  2701. }
  2702. }, [hasSelectedNonAreaBlock, enableComplementaryArea]);
  2703. return (0,external_wp_element_namespaceObject.createElement)(complementary_area, {
  2704. className: "edit-widgets-sidebar",
  2705. header: (0,external_wp_element_namespaceObject.createElement)("ul", null, (0,external_wp_element_namespaceObject.createElement)("li", null, (0,external_wp_element_namespaceObject.createElement)(ComplementaryAreaTab, {
  2706. identifier: WIDGET_AREAS_IDENTIFIER,
  2707. label: selectedWidgetAreaBlock ? selectedWidgetAreaBlock.attributes.name : (0,external_wp_i18n_namespaceObject.__)('Widget Areas'),
  2708. isActive: currentArea === WIDGET_AREAS_IDENTIFIER
  2709. })), (0,external_wp_element_namespaceObject.createElement)("li", null, (0,external_wp_element_namespaceObject.createElement)(ComplementaryAreaTab, {
  2710. identifier: BLOCK_INSPECTOR_IDENTIFIER,
  2711. label: (0,external_wp_i18n_namespaceObject.__)('Block'),
  2712. isActive: currentArea === BLOCK_INSPECTOR_IDENTIFIER
  2713. }))),
  2714. headerClassName: "edit-widgets-sidebar__panel-tabs"
  2715. /* translators: button label text should, if possible, be under 16 characters. */
  2716. ,
  2717. title: (0,external_wp_i18n_namespaceObject.__)('Settings'),
  2718. closeLabel: (0,external_wp_i18n_namespaceObject.__)('Close settings'),
  2719. scope: "core/edit-widgets",
  2720. identifier: currentArea,
  2721. icon: library_cog,
  2722. isActiveByDefault: SIDEBAR_ACTIVE_BY_DEFAULT
  2723. }, currentArea === WIDGET_AREAS_IDENTIFIER && (0,external_wp_element_namespaceObject.createElement)(WidgetAreas, {
  2724. selectedWidgetAreaId: selectedWidgetAreaBlock === null || selectedWidgetAreaBlock === void 0 ? void 0 : selectedWidgetAreaBlock.attributes.id
  2725. }), currentArea === BLOCK_INSPECTOR_IDENTIFIER && (hasSelectedNonAreaBlock ? (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockInspector, null) : // Pretend that Widget Areas are part of the UI by not
  2726. // showing the Block Inspector when one is selected.
  2727. (0,external_wp_element_namespaceObject.createElement)("span", {
  2728. className: "block-editor-block-inspector__no-blocks"
  2729. }, (0,external_wp_i18n_namespaceObject.__)('No block selected.'))));
  2730. }
  2731. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/plus.js
  2732. /**
  2733. * WordPress dependencies
  2734. */
  2735. const plus = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  2736. xmlns: "http://www.w3.org/2000/svg",
  2737. viewBox: "0 0 24 24"
  2738. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  2739. d: "M18 11.2h-5.2V6h-1.6v5.2H6v1.6h5.2V18h1.6v-5.2H18z"
  2740. }));
  2741. /* harmony default export */ var library_plus = (plus);
  2742. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/list-view.js
  2743. /**
  2744. * WordPress dependencies
  2745. */
  2746. const listView = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  2747. viewBox: "0 0 24 24",
  2748. xmlns: "http://www.w3.org/2000/svg"
  2749. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  2750. d: "M13.8 5.2H3v1.5h10.8V5.2zm-3.6 12v1.5H21v-1.5H10.2zm7.2-6H6.6v1.5h10.8v-1.5z"
  2751. }));
  2752. /* harmony default export */ var list_view = (listView);
  2753. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/components/save-button/index.js
  2754. /**
  2755. * WordPress dependencies
  2756. */
  2757. /**
  2758. * Internal dependencies
  2759. */
  2760. function SaveButton() {
  2761. const {
  2762. hasEditedWidgetAreaIds,
  2763. isSaving
  2764. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  2765. var _getEditedWidgetAreas;
  2766. const {
  2767. getEditedWidgetAreas,
  2768. isSavingWidgetAreas
  2769. } = select(store_store);
  2770. return {
  2771. hasEditedWidgetAreaIds: ((_getEditedWidgetAreas = getEditedWidgetAreas()) === null || _getEditedWidgetAreas === void 0 ? void 0 : _getEditedWidgetAreas.length) > 0,
  2772. isSaving: isSavingWidgetAreas()
  2773. };
  2774. }, []);
  2775. const {
  2776. saveEditedWidgetAreas
  2777. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  2778. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  2779. variant: "primary",
  2780. isBusy: isSaving,
  2781. "aria-disabled": isSaving,
  2782. onClick: isSaving ? undefined : saveEditedWidgetAreas,
  2783. disabled: !hasEditedWidgetAreaIds
  2784. }, isSaving ? (0,external_wp_i18n_namespaceObject.__)('Saving…') : (0,external_wp_i18n_namespaceObject.__)('Update'));
  2785. }
  2786. /* harmony default export */ var save_button = (SaveButton);
  2787. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/undo.js
  2788. /**
  2789. * WordPress dependencies
  2790. */
  2791. const undo = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  2792. xmlns: "http://www.w3.org/2000/svg",
  2793. viewBox: "0 0 24 24"
  2794. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  2795. 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"
  2796. }));
  2797. /* harmony default export */ var library_undo = (undo);
  2798. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/redo.js
  2799. /**
  2800. * WordPress dependencies
  2801. */
  2802. const redo = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  2803. xmlns: "http://www.w3.org/2000/svg",
  2804. viewBox: "0 0 24 24"
  2805. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  2806. 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"
  2807. }));
  2808. /* harmony default export */ var library_redo = (redo);
  2809. ;// CONCATENATED MODULE: external ["wp","keycodes"]
  2810. var external_wp_keycodes_namespaceObject = window["wp"]["keycodes"];
  2811. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/components/header/undo-redo/undo.js
  2812. /**
  2813. * WordPress dependencies
  2814. */
  2815. function UndoButton() {
  2816. const hasUndo = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).hasUndo(), []);
  2817. const {
  2818. undo
  2819. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
  2820. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, {
  2821. icon: !(0,external_wp_i18n_namespaceObject.isRTL)() ? library_undo : library_redo,
  2822. label: (0,external_wp_i18n_namespaceObject.__)('Undo'),
  2823. shortcut: external_wp_keycodes_namespaceObject.displayShortcut.primary('z') // If there are no undo levels we don't want to actually disable this
  2824. // button, because it will remove focus for keyboard users.
  2825. // See: https://github.com/WordPress/gutenberg/issues/3486
  2826. ,
  2827. "aria-disabled": !hasUndo,
  2828. onClick: hasUndo ? undo : undefined
  2829. });
  2830. }
  2831. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/components/header/undo-redo/redo.js
  2832. /**
  2833. * WordPress dependencies
  2834. */
  2835. function RedoButton() {
  2836. const shortcut = (0,external_wp_keycodes_namespaceObject.isAppleOS)() ? external_wp_keycodes_namespaceObject.displayShortcut.primaryShift('z') : external_wp_keycodes_namespaceObject.displayShortcut.primary('y');
  2837. const hasRedo = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).hasRedo(), []);
  2838. const {
  2839. redo
  2840. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
  2841. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, {
  2842. icon: !(0,external_wp_i18n_namespaceObject.isRTL)() ? library_redo : library_undo,
  2843. label: (0,external_wp_i18n_namespaceObject.__)('Redo'),
  2844. shortcut: shortcut // If there are no undo levels we don't want to actually disable this
  2845. // button, because it will remove focus for keyboard users.
  2846. // See: https://github.com/WordPress/gutenberg/issues/3486
  2847. ,
  2848. "aria-disabled": !hasRedo,
  2849. onClick: hasRedo ? redo : undefined
  2850. });
  2851. }
  2852. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/external.js
  2853. /**
  2854. * WordPress dependencies
  2855. */
  2856. const external = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  2857. xmlns: "http://www.w3.org/2000/svg",
  2858. viewBox: "0 0 24 24"
  2859. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  2860. 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"
  2861. }));
  2862. /* harmony default export */ var library_external = (external);
  2863. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/components/keyboard-shortcut-help-modal/config.js
  2864. /**
  2865. * WordPress dependencies
  2866. */
  2867. const textFormattingShortcuts = [{
  2868. keyCombination: {
  2869. modifier: 'primary',
  2870. character: 'b'
  2871. },
  2872. description: (0,external_wp_i18n_namespaceObject.__)('Make the selected text bold.')
  2873. }, {
  2874. keyCombination: {
  2875. modifier: 'primary',
  2876. character: 'i'
  2877. },
  2878. description: (0,external_wp_i18n_namespaceObject.__)('Make the selected text italic.')
  2879. }, {
  2880. keyCombination: {
  2881. modifier: 'primary',
  2882. character: 'k'
  2883. },
  2884. description: (0,external_wp_i18n_namespaceObject.__)('Convert the selected text into a link.')
  2885. }, {
  2886. keyCombination: {
  2887. modifier: 'primaryShift',
  2888. character: 'k'
  2889. },
  2890. description: (0,external_wp_i18n_namespaceObject.__)('Remove a link.')
  2891. }, {
  2892. keyCombination: {
  2893. character: '[['
  2894. },
  2895. description: (0,external_wp_i18n_namespaceObject.__)('Insert a link to a post or page')
  2896. }, {
  2897. keyCombination: {
  2898. modifier: 'primary',
  2899. character: 'u'
  2900. },
  2901. description: (0,external_wp_i18n_namespaceObject.__)('Underline the selected text.')
  2902. }, {
  2903. keyCombination: {
  2904. modifier: 'access',
  2905. character: 'd'
  2906. },
  2907. description: (0,external_wp_i18n_namespaceObject.__)('Strikethrough the selected text.')
  2908. }, {
  2909. keyCombination: {
  2910. modifier: 'access',
  2911. character: 'x'
  2912. },
  2913. description: (0,external_wp_i18n_namespaceObject.__)('Make the selected text inline code.')
  2914. }];
  2915. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/components/keyboard-shortcut-help-modal/shortcut.js
  2916. /**
  2917. * WordPress dependencies
  2918. */
  2919. function KeyCombination(_ref) {
  2920. let {
  2921. keyCombination,
  2922. forceAriaLabel
  2923. } = _ref;
  2924. const shortcut = keyCombination.modifier ? external_wp_keycodes_namespaceObject.displayShortcutList[keyCombination.modifier](keyCombination.character) : keyCombination.character;
  2925. const ariaLabel = keyCombination.modifier ? external_wp_keycodes_namespaceObject.shortcutAriaLabel[keyCombination.modifier](keyCombination.character) : keyCombination.character;
  2926. const shortcuts = Array.isArray(shortcut) ? shortcut : [shortcut];
  2927. return (0,external_wp_element_namespaceObject.createElement)("kbd", {
  2928. className: "edit-widgets-keyboard-shortcut-help-modal__shortcut-key-combination",
  2929. "aria-label": forceAriaLabel || ariaLabel
  2930. }, shortcuts.map((character, index) => {
  2931. if (character === '+') {
  2932. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, {
  2933. key: index
  2934. }, character);
  2935. }
  2936. return (0,external_wp_element_namespaceObject.createElement)("kbd", {
  2937. key: index,
  2938. className: "edit-widgets-keyboard-shortcut-help-modal__shortcut-key"
  2939. }, character);
  2940. }));
  2941. }
  2942. function Shortcut(_ref2) {
  2943. let {
  2944. description,
  2945. keyCombination,
  2946. aliases = [],
  2947. ariaLabel
  2948. } = _ref2;
  2949. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("div", {
  2950. className: "edit-widgets-keyboard-shortcut-help-modal__shortcut-description"
  2951. }, description), (0,external_wp_element_namespaceObject.createElement)("div", {
  2952. className: "edit-widgets-keyboard-shortcut-help-modal__shortcut-term"
  2953. }, (0,external_wp_element_namespaceObject.createElement)(KeyCombination, {
  2954. keyCombination: keyCombination,
  2955. forceAriaLabel: ariaLabel
  2956. }), aliases.map((alias, index) => (0,external_wp_element_namespaceObject.createElement)(KeyCombination, {
  2957. keyCombination: alias,
  2958. forceAriaLabel: ariaLabel,
  2959. key: index
  2960. }))));
  2961. }
  2962. /* harmony default export */ var keyboard_shortcut_help_modal_shortcut = (Shortcut);
  2963. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js
  2964. /**
  2965. * WordPress dependencies
  2966. */
  2967. /**
  2968. * Internal dependencies
  2969. */
  2970. function DynamicShortcut(_ref) {
  2971. let {
  2972. name
  2973. } = _ref;
  2974. const {
  2975. keyCombination,
  2976. description,
  2977. aliases
  2978. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  2979. const {
  2980. getShortcutKeyCombination,
  2981. getShortcutDescription,
  2982. getShortcutAliases
  2983. } = select(external_wp_keyboardShortcuts_namespaceObject.store);
  2984. return {
  2985. keyCombination: getShortcutKeyCombination(name),
  2986. aliases: getShortcutAliases(name),
  2987. description: getShortcutDescription(name)
  2988. };
  2989. }, [name]);
  2990. if (!keyCombination) {
  2991. return null;
  2992. }
  2993. return (0,external_wp_element_namespaceObject.createElement)(keyboard_shortcut_help_modal_shortcut, {
  2994. keyCombination: keyCombination,
  2995. description: description,
  2996. aliases: aliases
  2997. });
  2998. }
  2999. /* harmony default export */ var dynamic_shortcut = (DynamicShortcut);
  3000. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/components/keyboard-shortcut-help-modal/index.js
  3001. /**
  3002. * External dependencies
  3003. */
  3004. /**
  3005. * WordPress dependencies
  3006. */
  3007. /**
  3008. * Internal dependencies
  3009. */
  3010. const ShortcutList = _ref => {
  3011. let {
  3012. shortcuts
  3013. } = _ref;
  3014. return (
  3015. /*
  3016. * Disable reason: The `list` ARIA role is redundant but
  3017. * Safari+VoiceOver won't announce the list otherwise.
  3018. */
  3019. /* eslint-disable jsx-a11y/no-redundant-roles */
  3020. (0,external_wp_element_namespaceObject.createElement)("ul", {
  3021. className: "edit-widgets-keyboard-shortcut-help-modal__shortcut-list",
  3022. role: "list"
  3023. }, shortcuts.map((shortcut, index) => (0,external_wp_element_namespaceObject.createElement)("li", {
  3024. className: "edit-widgets-keyboard-shortcut-help-modal__shortcut",
  3025. key: index
  3026. }, typeof shortcut === 'string' ? (0,external_wp_element_namespaceObject.createElement)(dynamic_shortcut, {
  3027. name: shortcut
  3028. }) : (0,external_wp_element_namespaceObject.createElement)(keyboard_shortcut_help_modal_shortcut, shortcut))))
  3029. /* eslint-enable jsx-a11y/no-redundant-roles */
  3030. );
  3031. };
  3032. const ShortcutSection = _ref2 => {
  3033. let {
  3034. title,
  3035. shortcuts,
  3036. className
  3037. } = _ref2;
  3038. return (0,external_wp_element_namespaceObject.createElement)("section", {
  3039. className: classnames_default()('edit-widgets-keyboard-shortcut-help-modal__section', className)
  3040. }, !!title && (0,external_wp_element_namespaceObject.createElement)("h2", {
  3041. className: "edit-widgets-keyboard-shortcut-help-modal__section-title"
  3042. }, title), (0,external_wp_element_namespaceObject.createElement)(ShortcutList, {
  3043. shortcuts: shortcuts
  3044. }));
  3045. };
  3046. const ShortcutCategorySection = _ref3 => {
  3047. let {
  3048. title,
  3049. categoryName,
  3050. additionalShortcuts = []
  3051. } = _ref3;
  3052. const categoryShortcuts = (0,external_wp_data_namespaceObject.useSelect)(select => {
  3053. return select(external_wp_keyboardShortcuts_namespaceObject.store).getCategoryShortcuts(categoryName);
  3054. }, [categoryName]);
  3055. return (0,external_wp_element_namespaceObject.createElement)(ShortcutSection, {
  3056. title: title,
  3057. shortcuts: categoryShortcuts.concat(additionalShortcuts)
  3058. });
  3059. };
  3060. function KeyboardShortcutHelpModal(_ref4) {
  3061. let {
  3062. isModalActive,
  3063. toggleModal
  3064. } = _ref4;
  3065. (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-widgets/keyboard-shortcuts', toggleModal, {
  3066. bindGlobal: true
  3067. });
  3068. if (!isModalActive) {
  3069. return null;
  3070. }
  3071. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, {
  3072. className: "edit-widgets-keyboard-shortcut-help-modal",
  3073. title: (0,external_wp_i18n_namespaceObject.__)('Keyboard shortcuts'),
  3074. closeLabel: (0,external_wp_i18n_namespaceObject.__)('Close'),
  3075. onRequestClose: toggleModal
  3076. }, (0,external_wp_element_namespaceObject.createElement)(ShortcutSection, {
  3077. className: "edit-widgets-keyboard-shortcut-help-modal__main-shortcuts",
  3078. shortcuts: ['core/edit-widgets/keyboard-shortcuts']
  3079. }), (0,external_wp_element_namespaceObject.createElement)(ShortcutCategorySection, {
  3080. title: (0,external_wp_i18n_namespaceObject.__)('Global shortcuts'),
  3081. categoryName: "global"
  3082. }), (0,external_wp_element_namespaceObject.createElement)(ShortcutCategorySection, {
  3083. title: (0,external_wp_i18n_namespaceObject.__)('Selection shortcuts'),
  3084. categoryName: "selection"
  3085. }), (0,external_wp_element_namespaceObject.createElement)(ShortcutCategorySection, {
  3086. title: (0,external_wp_i18n_namespaceObject.__)('Block shortcuts'),
  3087. categoryName: "block",
  3088. additionalShortcuts: [{
  3089. keyCombination: {
  3090. character: '/'
  3091. },
  3092. description: (0,external_wp_i18n_namespaceObject.__)('Change the block type after adding a new paragraph.'),
  3093. /* translators: The forward-slash character. e.g. '/'. */
  3094. ariaLabel: (0,external_wp_i18n_namespaceObject.__)('Forward-slash')
  3095. }]
  3096. }), (0,external_wp_element_namespaceObject.createElement)(ShortcutSection, {
  3097. title: (0,external_wp_i18n_namespaceObject.__)('Text formatting'),
  3098. shortcuts: textFormattingShortcuts
  3099. }));
  3100. }
  3101. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/components/more-menu/tools-more-menu-group.js
  3102. /**
  3103. * WordPress dependencies
  3104. */
  3105. const {
  3106. Fill: ToolsMoreMenuGroup,
  3107. Slot
  3108. } = (0,external_wp_components_namespaceObject.createSlotFill)('EditWidgetsToolsMoreMenuGroup');
  3109. ToolsMoreMenuGroup.Slot = _ref => {
  3110. let {
  3111. fillProps
  3112. } = _ref;
  3113. return (0,external_wp_element_namespaceObject.createElement)(Slot, {
  3114. fillProps: fillProps
  3115. }, fills => fills.length > 0 && fills);
  3116. };
  3117. /* harmony default export */ var tools_more_menu_group = (ToolsMoreMenuGroup);
  3118. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/components/more-menu/index.js
  3119. /**
  3120. * WordPress dependencies
  3121. */
  3122. /**
  3123. * Internal dependencies
  3124. */
  3125. function MoreMenu() {
  3126. const [isKeyboardShortcutsModalActive, setIsKeyboardShortcutsModalVisible] = (0,external_wp_element_namespaceObject.useState)(false);
  3127. const toggleKeyboardShortcutsModal = () => setIsKeyboardShortcutsModalVisible(!isKeyboardShortcutsModalActive);
  3128. (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-widgets/keyboard-shortcuts', toggleKeyboardShortcutsModal);
  3129. const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium');
  3130. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(MoreMenuDropdown, null, onClose => (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, isLargeViewport && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, {
  3131. label: (0,external_wp_i18n_namespaceObject._x)('View', 'noun')
  3132. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, {
  3133. scope: "core/edit-widgets",
  3134. name: "fixedToolbar",
  3135. label: (0,external_wp_i18n_namespaceObject.__)('Top toolbar'),
  3136. info: (0,external_wp_i18n_namespaceObject.__)('Access all block and document tools in a single place'),
  3137. messageActivated: (0,external_wp_i18n_namespaceObject.__)('Top toolbar activated'),
  3138. messageDeactivated: (0,external_wp_i18n_namespaceObject.__)('Top toolbar deactivated')
  3139. })), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, {
  3140. label: (0,external_wp_i18n_namespaceObject.__)('Tools')
  3141. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
  3142. onClick: () => {
  3143. setIsKeyboardShortcutsModalVisible(true);
  3144. },
  3145. shortcut: external_wp_keycodes_namespaceObject.displayShortcut.access('h')
  3146. }, (0,external_wp_i18n_namespaceObject.__)('Keyboard shortcuts')), (0,external_wp_element_namespaceObject.createElement)(external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, {
  3147. scope: "core/edit-widgets",
  3148. name: "welcomeGuide",
  3149. label: (0,external_wp_i18n_namespaceObject.__)('Welcome Guide')
  3150. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
  3151. role: "menuitem",
  3152. icon: library_external,
  3153. href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/support/article/block-based-widgets-editor/'),
  3154. target: "_blank",
  3155. rel: "noopener noreferrer"
  3156. }, (0,external_wp_i18n_namespaceObject.__)('Help'), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, {
  3157. as: "span"
  3158. },
  3159. /* translators: accessibility text */
  3160. (0,external_wp_i18n_namespaceObject.__)('(opens in a new tab)'))), (0,external_wp_element_namespaceObject.createElement)(tools_more_menu_group.Slot, {
  3161. fillProps: {
  3162. onClose
  3163. }
  3164. })), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, {
  3165. label: (0,external_wp_i18n_namespaceObject.__)('Preferences')
  3166. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, {
  3167. scope: "core/edit-widgets",
  3168. name: "keepCaretInsideBlock",
  3169. label: (0,external_wp_i18n_namespaceObject.__)('Contain text cursor inside block'),
  3170. info: (0,external_wp_i18n_namespaceObject.__)('Aids screen readers by stopping text caret from leaving blocks.'),
  3171. messageActivated: (0,external_wp_i18n_namespaceObject.__)('Contain text cursor inside block activated'),
  3172. messageDeactivated: (0,external_wp_i18n_namespaceObject.__)('Contain text cursor inside block deactivated')
  3173. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, {
  3174. scope: "core/edit-widgets",
  3175. name: "themeStyles",
  3176. info: (0,external_wp_i18n_namespaceObject.__)('Make the editor look like your theme.'),
  3177. label: (0,external_wp_i18n_namespaceObject.__)('Use theme styles')
  3178. }), isLargeViewport && (0,external_wp_element_namespaceObject.createElement)(external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, {
  3179. scope: "core/edit-widgets",
  3180. name: "showBlockBreadcrumbs",
  3181. label: (0,external_wp_i18n_namespaceObject.__)('Display block breadcrumbs'),
  3182. info: (0,external_wp_i18n_namespaceObject.__)('Shows block breadcrumbs at the bottom of the editor.'),
  3183. messageActivated: (0,external_wp_i18n_namespaceObject.__)('Display block breadcrumbs activated'),
  3184. messageDeactivated: (0,external_wp_i18n_namespaceObject.__)('Display block breadcrumbs deactivated')
  3185. })))), (0,external_wp_element_namespaceObject.createElement)(KeyboardShortcutHelpModal, {
  3186. isModalActive: isKeyboardShortcutsModalActive,
  3187. toggleModal: toggleKeyboardShortcutsModal
  3188. }));
  3189. }
  3190. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/components/header/index.js
  3191. /**
  3192. * WordPress dependencies
  3193. */
  3194. /**
  3195. * Internal dependencies
  3196. */
  3197. function Header() {
  3198. const isMediumViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium');
  3199. const inserterButton = (0,external_wp_element_namespaceObject.useRef)();
  3200. const widgetAreaClientId = use_last_selected_widget_area();
  3201. const isLastSelectedWidgetAreaOpen = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getIsWidgetAreaOpen(widgetAreaClientId), [widgetAreaClientId]);
  3202. const {
  3203. isInserterOpen,
  3204. isListViewOpen
  3205. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  3206. const {
  3207. isInserterOpened,
  3208. isListViewOpened
  3209. } = select(store_store);
  3210. return {
  3211. isInserterOpen: isInserterOpened(),
  3212. isListViewOpen: isListViewOpened()
  3213. };
  3214. }, []);
  3215. const {
  3216. setIsWidgetAreaOpen,
  3217. setIsInserterOpened,
  3218. setIsListViewOpened
  3219. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  3220. const {
  3221. selectBlock
  3222. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
  3223. const handleClick = () => {
  3224. if (isInserterOpen) {
  3225. // Focusing the inserter button closes the inserter popover.
  3226. setIsInserterOpened(false);
  3227. } else {
  3228. if (!isLastSelectedWidgetAreaOpen) {
  3229. // Select the last selected block if hasn't already.
  3230. selectBlock(widgetAreaClientId); // Open the last selected widget area when opening the inserter.
  3231. setIsWidgetAreaOpen(widgetAreaClientId, true);
  3232. } // The DOM updates resulting from selectBlock() and setIsInserterOpened() calls are applied the
  3233. // same tick and pretty much in a random order. The inserter is closed if any other part of the
  3234. // app receives focus. If selectBlock() happens to take effect after setIsInserterOpened() then
  3235. // the inserter is visible for a brief moment and then gets auto-closed due to focus moving to
  3236. // the selected block.
  3237. window.requestAnimationFrame(() => setIsInserterOpened(true));
  3238. }
  3239. };
  3240. const toggleListView = (0,external_wp_element_namespaceObject.useCallback)(() => setIsListViewOpened(!isListViewOpen), [setIsListViewOpened, isListViewOpen]);
  3241. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("div", {
  3242. className: "edit-widgets-header"
  3243. }, (0,external_wp_element_namespaceObject.createElement)("div", {
  3244. className: "edit-widgets-header__navigable-toolbar-wrapper"
  3245. }, isMediumViewport && (0,external_wp_element_namespaceObject.createElement)("h1", {
  3246. className: "edit-widgets-header__title"
  3247. }, (0,external_wp_i18n_namespaceObject.__)('Widgets')), !isMediumViewport && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, {
  3248. as: "h1",
  3249. className: "edit-widgets-header__title"
  3250. }, (0,external_wp_i18n_namespaceObject.__)('Widgets')), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.NavigableToolbar, {
  3251. className: "edit-widgets-header-toolbar",
  3252. "aria-label": (0,external_wp_i18n_namespaceObject.__)('Document tools')
  3253. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarItem, {
  3254. ref: inserterButton,
  3255. as: external_wp_components_namespaceObject.Button,
  3256. className: "edit-widgets-header-toolbar__inserter-toggle",
  3257. variant: "primary",
  3258. isPressed: isInserterOpen,
  3259. onMouseDown: event => {
  3260. event.preventDefault();
  3261. },
  3262. onClick: handleClick,
  3263. icon: library_plus
  3264. /* translators: button label text should, if possible, be under 16
  3265. characters. */
  3266. ,
  3267. label: (0,external_wp_i18n_namespaceObject._x)('Toggle block inserter', 'Generic label for block inserter button')
  3268. }), isMediumViewport && (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(UndoButton, null), (0,external_wp_element_namespaceObject.createElement)(RedoButton, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarItem, {
  3269. as: external_wp_components_namespaceObject.Button,
  3270. className: "edit-widgets-header-toolbar__list-view-toggle",
  3271. icon: list_view,
  3272. isPressed: isListViewOpen
  3273. /* translators: button label text should, if possible, be under 16 characters. */
  3274. ,
  3275. label: (0,external_wp_i18n_namespaceObject.__)('List View'),
  3276. onClick: toggleListView
  3277. })))), (0,external_wp_element_namespaceObject.createElement)("div", {
  3278. className: "edit-widgets-header__actions"
  3279. }, (0,external_wp_element_namespaceObject.createElement)(save_button, null), (0,external_wp_element_namespaceObject.createElement)(pinned_items.Slot, {
  3280. scope: "core/edit-widgets"
  3281. }), (0,external_wp_element_namespaceObject.createElement)(MoreMenu, null))));
  3282. }
  3283. /* harmony default export */ var header = (Header);
  3284. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/components/notices/index.js
  3285. /**
  3286. * WordPress dependencies
  3287. */
  3288. function Notices() {
  3289. const {
  3290. removeNotice
  3291. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
  3292. const {
  3293. notices
  3294. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  3295. return {
  3296. notices: select(external_wp_notices_namespaceObject.store).getNotices()
  3297. };
  3298. }, []);
  3299. const dismissibleNotices = notices.filter(_ref => {
  3300. let {
  3301. isDismissible,
  3302. type
  3303. } = _ref;
  3304. return isDismissible && type === 'default';
  3305. });
  3306. const nonDismissibleNotices = notices.filter(_ref2 => {
  3307. let {
  3308. isDismissible,
  3309. type
  3310. } = _ref2;
  3311. return !isDismissible && type === 'default';
  3312. });
  3313. const snackbarNotices = notices.filter(_ref3 => {
  3314. let {
  3315. type
  3316. } = _ref3;
  3317. return type === 'snackbar';
  3318. });
  3319. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.NoticeList, {
  3320. notices: nonDismissibleNotices,
  3321. className: "edit-widgets-notices__pinned"
  3322. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.NoticeList, {
  3323. notices: dismissibleNotices,
  3324. className: "edit-widgets-notices__dismissible",
  3325. onRemove: removeNotice
  3326. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SnackbarList, {
  3327. notices: snackbarNotices,
  3328. className: "edit-widgets-notices__snackbar",
  3329. onRemove: removeNotice
  3330. }));
  3331. }
  3332. /* harmony default export */ var notices = (Notices);
  3333. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/components/widget-areas-block-editor-content/index.js
  3334. /**
  3335. * WordPress dependencies
  3336. */
  3337. /**
  3338. * Internal dependencies
  3339. */
  3340. function WidgetAreasBlockEditorContent(_ref) {
  3341. let {
  3342. blockEditorSettings
  3343. } = _ref;
  3344. const hasThemeStyles = (0,external_wp_data_namespaceObject.useSelect)(select => !!select(external_wp_preferences_namespaceObject.store).get('core/edit-widgets', 'themeStyles'), []);
  3345. const styles = (0,external_wp_element_namespaceObject.useMemo)(() => {
  3346. return hasThemeStyles ? blockEditorSettings.styles : [];
  3347. }, [blockEditorSettings, hasThemeStyles]);
  3348. return (0,external_wp_element_namespaceObject.createElement)("div", {
  3349. className: "edit-widgets-block-editor"
  3350. }, (0,external_wp_element_namespaceObject.createElement)(notices, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockTools, null, (0,external_wp_element_namespaceObject.createElement)(keyboard_shortcuts, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__unstableEditorStyles, {
  3351. styles: styles
  3352. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockSelectionClearer, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.WritingFlow, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.ObserveTyping, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockList, {
  3353. className: "edit-widgets-main-block-list"
  3354. }))))));
  3355. }
  3356. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/close.js
  3357. /**
  3358. * WordPress dependencies
  3359. */
  3360. const close_close = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  3361. xmlns: "http://www.w3.org/2000/svg",
  3362. viewBox: "0 0 24 24"
  3363. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  3364. d: "M13 11.8l6.1-6.3-1-1-6.1 6.2-6.1-6.2-1 1 6.1 6.3-6.5 6.7 1 1 6.5-6.6 6.5 6.6 1-1z"
  3365. }));
  3366. /* harmony default export */ var library_close = (close_close);
  3367. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/hooks/use-widget-library-insertion-point.js
  3368. /**
  3369. * WordPress dependencies
  3370. */
  3371. /**
  3372. * Internal dependencies
  3373. */
  3374. const useWidgetLibraryInsertionPoint = () => {
  3375. const firstRootId = (0,external_wp_data_namespaceObject.useSelect)(select => {
  3376. var _widgetAreasPost$bloc;
  3377. // Default to the first widget area
  3378. const {
  3379. getEntityRecord
  3380. } = select(external_wp_coreData_namespaceObject.store);
  3381. const widgetAreasPost = getEntityRecord(KIND, POST_TYPE, buildWidgetAreasPostId());
  3382. return widgetAreasPost === null || widgetAreasPost === void 0 ? void 0 : (_widgetAreasPost$bloc = widgetAreasPost.blocks[0]) === null || _widgetAreasPost$bloc === void 0 ? void 0 : _widgetAreasPost$bloc.clientId;
  3383. }, []);
  3384. return (0,external_wp_data_namespaceObject.useSelect)(select => {
  3385. const {
  3386. getBlockRootClientId,
  3387. getBlockSelectionEnd,
  3388. getBlockOrder,
  3389. getBlockIndex
  3390. } = select(external_wp_blockEditor_namespaceObject.store);
  3391. const insertionPoint = select(store_store).__experimentalGetInsertionPoint(); // "Browse all" in the quick inserter will set the rootClientId to the current block.
  3392. // Otherwise, it will just be undefined, and we'll have to handle it differently below.
  3393. if (insertionPoint.rootClientId) {
  3394. return insertionPoint;
  3395. }
  3396. const clientId = getBlockSelectionEnd() || firstRootId;
  3397. const rootClientId = getBlockRootClientId(clientId); // If the selected block is at the root level, it's a widget area and
  3398. // blocks can't be inserted here. Return this block as the root and the
  3399. // last child clientId indicating insertion at the end.
  3400. if (clientId && rootClientId === '') {
  3401. return {
  3402. rootClientId: clientId,
  3403. insertionIndex: getBlockOrder(clientId).length
  3404. };
  3405. }
  3406. return {
  3407. rootClientId,
  3408. insertionIndex: getBlockIndex(clientId) + 1
  3409. };
  3410. }, [firstRootId]);
  3411. };
  3412. /* harmony default export */ var use_widget_library_insertion_point = (useWidgetLibraryInsertionPoint);
  3413. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/components/secondary-sidebar/inserter-sidebar.js
  3414. /**
  3415. * WordPress dependencies
  3416. */
  3417. /**
  3418. * Internal dependencies
  3419. */
  3420. function InserterSidebar() {
  3421. const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<');
  3422. const {
  3423. rootClientId,
  3424. insertionIndex
  3425. } = use_widget_library_insertion_point();
  3426. const {
  3427. setIsInserterOpened
  3428. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  3429. const closeInserter = (0,external_wp_element_namespaceObject.useCallback)(() => {
  3430. return setIsInserterOpened(false);
  3431. }, [setIsInserterOpened]);
  3432. const TagName = !isMobileViewport ? external_wp_components_namespaceObject.VisuallyHidden : 'div';
  3433. const [inserterDialogRef, inserterDialogProps] = (0,external_wp_compose_namespaceObject.__experimentalUseDialog)({
  3434. onClose: closeInserter,
  3435. focusOnMount: null
  3436. });
  3437. const libraryRef = (0,external_wp_element_namespaceObject.useRef)();
  3438. (0,external_wp_element_namespaceObject.useEffect)(() => {
  3439. libraryRef.current.focusSearch();
  3440. }, []);
  3441. return (0,external_wp_element_namespaceObject.createElement)("div", _extends({
  3442. ref: inserterDialogRef
  3443. }, inserterDialogProps, {
  3444. className: "edit-widgets-layout__inserter-panel"
  3445. }), (0,external_wp_element_namespaceObject.createElement)(TagName, {
  3446. className: "edit-widgets-layout__inserter-panel-header"
  3447. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  3448. icon: library_close,
  3449. onClick: closeInserter,
  3450. label: (0,external_wp_i18n_namespaceObject.__)('Close block inserter')
  3451. })), (0,external_wp_element_namespaceObject.createElement)("div", {
  3452. className: "edit-widgets-layout__inserter-panel-content"
  3453. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalLibrary, {
  3454. showInserterHelpPanel: true,
  3455. shouldFocusBlock: isMobileViewport,
  3456. rootClientId: rootClientId,
  3457. __experimentalInsertionIndex: insertionIndex,
  3458. ref: libraryRef
  3459. })));
  3460. }
  3461. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/components/secondary-sidebar/list-view-sidebar.js
  3462. /**
  3463. * WordPress dependencies
  3464. */
  3465. /**
  3466. * Internal dependencies
  3467. */
  3468. function ListViewSidebar() {
  3469. const {
  3470. setIsListViewOpened
  3471. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  3472. const focusOnMountRef = (0,external_wp_compose_namespaceObject.useFocusOnMount)('firstElement');
  3473. const headerFocusReturnRef = (0,external_wp_compose_namespaceObject.useFocusReturn)();
  3474. const contentFocusReturnRef = (0,external_wp_compose_namespaceObject.useFocusReturn)();
  3475. function closeOnEscape(event) {
  3476. if (event.keyCode === external_wp_keycodes_namespaceObject.ESCAPE && !event.defaultPrevented) {
  3477. event.preventDefault();
  3478. setIsListViewOpened(false);
  3479. }
  3480. }
  3481. const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(ListViewSidebar);
  3482. const labelId = `edit-widgets-editor__list-view-panel-label-${instanceId}`;
  3483. return (// eslint-disable-next-line jsx-a11y/no-static-element-interactions
  3484. (0,external_wp_element_namespaceObject.createElement)("div", {
  3485. "aria-labelledby": labelId,
  3486. className: "edit-widgets-editor__list-view-panel",
  3487. onKeyDown: closeOnEscape
  3488. }, (0,external_wp_element_namespaceObject.createElement)("div", {
  3489. className: "edit-widgets-editor__list-view-panel-header",
  3490. ref: headerFocusReturnRef
  3491. }, (0,external_wp_element_namespaceObject.createElement)("strong", {
  3492. id: labelId
  3493. }, (0,external_wp_i18n_namespaceObject.__)('List View')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  3494. icon: close_small,
  3495. label: (0,external_wp_i18n_namespaceObject.__)('Close List View Sidebar'),
  3496. onClick: () => setIsListViewOpened(false)
  3497. })), (0,external_wp_element_namespaceObject.createElement)("div", {
  3498. className: "edit-widgets-editor__list-view-panel-content",
  3499. ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([contentFocusReturnRef, focusOnMountRef])
  3500. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalListView, null)))
  3501. );
  3502. }
  3503. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/components/secondary-sidebar/index.js
  3504. /**
  3505. * WordPress dependencies
  3506. */
  3507. /**
  3508. * Internal dependencies
  3509. */
  3510. /**
  3511. * Internal dependencies
  3512. */
  3513. function SecondarySidebar() {
  3514. const {
  3515. isInserterOpen,
  3516. isListViewOpen
  3517. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  3518. const {
  3519. isInserterOpened,
  3520. isListViewOpened
  3521. } = select(store_store);
  3522. return {
  3523. isInserterOpen: isInserterOpened(),
  3524. isListViewOpen: isListViewOpened()
  3525. };
  3526. }, []);
  3527. if (isInserterOpen) {
  3528. return (0,external_wp_element_namespaceObject.createElement)(InserterSidebar, null);
  3529. }
  3530. if (isListViewOpen) {
  3531. return (0,external_wp_element_namespaceObject.createElement)(ListViewSidebar, null);
  3532. }
  3533. return null;
  3534. }
  3535. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/components/layout/interface.js
  3536. /**
  3537. * WordPress dependencies
  3538. */
  3539. /**
  3540. * Internal dependencies
  3541. */
  3542. const interfaceLabels = {
  3543. /* translators: accessibility text for the widgets screen top bar landmark region. */
  3544. header: (0,external_wp_i18n_namespaceObject.__)('Widgets top bar'),
  3545. /* translators: accessibility text for the widgets screen content landmark region. */
  3546. body: (0,external_wp_i18n_namespaceObject.__)('Widgets and blocks'),
  3547. /* translators: accessibility text for the widgets screen settings landmark region. */
  3548. sidebar: (0,external_wp_i18n_namespaceObject.__)('Widgets settings'),
  3549. /* translators: accessibility text for the widgets screen footer landmark region. */
  3550. footer: (0,external_wp_i18n_namespaceObject.__)('Widgets footer')
  3551. };
  3552. function Interface(_ref) {
  3553. let {
  3554. blockEditorSettings
  3555. } = _ref;
  3556. const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<');
  3557. const isHugeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('huge', '>=');
  3558. const {
  3559. setIsInserterOpened,
  3560. setIsListViewOpened,
  3561. closeGeneralSidebar
  3562. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  3563. const {
  3564. hasBlockBreadCrumbsEnabled,
  3565. hasSidebarEnabled,
  3566. isInserterOpened,
  3567. isListViewOpened,
  3568. previousShortcut,
  3569. nextShortcut
  3570. } = (0,external_wp_data_namespaceObject.useSelect)(select => ({
  3571. hasSidebarEnabled: !!select(store).getActiveComplementaryArea(store_store.name),
  3572. isInserterOpened: !!select(store_store).isInserterOpened(),
  3573. isListViewOpened: !!select(store_store).isListViewOpened(),
  3574. hasBlockBreadCrumbsEnabled: !!select(external_wp_preferences_namespaceObject.store).get('core/edit-widgets', 'showBlockBreadcrumbs'),
  3575. previousShortcut: select(external_wp_keyboardShortcuts_namespaceObject.store).getAllShortcutKeyCombinations('core/edit-widgets/previous-region'),
  3576. nextShortcut: select(external_wp_keyboardShortcuts_namespaceObject.store).getAllShortcutKeyCombinations('core/edit-widgets/next-region')
  3577. }), []); // Inserter and Sidebars are mutually exclusive
  3578. (0,external_wp_element_namespaceObject.useEffect)(() => {
  3579. if (hasSidebarEnabled && !isHugeViewport) {
  3580. setIsInserterOpened(false);
  3581. setIsListViewOpened(false);
  3582. }
  3583. }, [hasSidebarEnabled, isHugeViewport]);
  3584. (0,external_wp_element_namespaceObject.useEffect)(() => {
  3585. if ((isInserterOpened || isListViewOpened) && !isHugeViewport) {
  3586. closeGeneralSidebar();
  3587. }
  3588. }, [isInserterOpened, isListViewOpened, isHugeViewport]);
  3589. const secondarySidebarLabel = isListViewOpened ? (0,external_wp_i18n_namespaceObject.__)('List View') : (0,external_wp_i18n_namespaceObject.__)('Block Library');
  3590. const hasSecondarySidebar = isListViewOpened || isInserterOpened;
  3591. return (0,external_wp_element_namespaceObject.createElement)(interface_skeleton, {
  3592. labels: { ...interfaceLabels,
  3593. secondarySidebar: secondarySidebarLabel
  3594. },
  3595. header: (0,external_wp_element_namespaceObject.createElement)(header, null),
  3596. secondarySidebar: hasSecondarySidebar && (0,external_wp_element_namespaceObject.createElement)(SecondarySidebar, null),
  3597. sidebar: hasSidebarEnabled && (0,external_wp_element_namespaceObject.createElement)(complementary_area.Slot, {
  3598. scope: "core/edit-widgets"
  3599. }),
  3600. content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(WidgetAreasBlockEditorContent, {
  3601. blockEditorSettings: blockEditorSettings
  3602. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockStyles.Slot, {
  3603. scope: "core/block-inspector"
  3604. })),
  3605. footer: hasBlockBreadCrumbsEnabled && !isMobileViewport && (0,external_wp_element_namespaceObject.createElement)("div", {
  3606. className: "edit-widgets-layout__footer"
  3607. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockBreadcrumb, {
  3608. rootLabelText: (0,external_wp_i18n_namespaceObject.__)('Widgets')
  3609. })),
  3610. shortcuts: {
  3611. previous: previousShortcut,
  3612. next: nextShortcut
  3613. }
  3614. });
  3615. }
  3616. /* harmony default export */ var layout_interface = (Interface);
  3617. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/components/layout/unsaved-changes-warning.js
  3618. /**
  3619. * WordPress dependencies
  3620. */
  3621. /**
  3622. * Internal dependencies
  3623. */
  3624. /**
  3625. * Warns the user if there are unsaved changes before leaving the editor.
  3626. *
  3627. * This is a duplicate of the component implemented in the editor package.
  3628. * Duplicated here as edit-widgets doesn't depend on editor.
  3629. *
  3630. * @return {WPComponent} The component.
  3631. */
  3632. function UnsavedChangesWarning() {
  3633. const isDirty = (0,external_wp_data_namespaceObject.useSelect)(select => {
  3634. const {
  3635. getEditedWidgetAreas
  3636. } = select(store_store);
  3637. const editedWidgetAreas = getEditedWidgetAreas();
  3638. return (editedWidgetAreas === null || editedWidgetAreas === void 0 ? void 0 : editedWidgetAreas.length) > 0;
  3639. }, []);
  3640. (0,external_wp_element_namespaceObject.useEffect)(() => {
  3641. /**
  3642. * Warns the user if there are unsaved changes before leaving the editor.
  3643. *
  3644. * @param {Event} event `beforeunload` event.
  3645. *
  3646. * @return {?string} Warning prompt message, if unsaved changes exist.
  3647. */
  3648. const warnIfUnsavedChanges = event => {
  3649. if (isDirty) {
  3650. event.returnValue = (0,external_wp_i18n_namespaceObject.__)('You have unsaved changes. If you proceed, they will be lost.');
  3651. return event.returnValue;
  3652. }
  3653. };
  3654. window.addEventListener('beforeunload', warnIfUnsavedChanges);
  3655. return () => {
  3656. window.removeEventListener('beforeunload', warnIfUnsavedChanges);
  3657. };
  3658. }, [isDirty]);
  3659. return null;
  3660. }
  3661. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/components/welcome-guide/index.js
  3662. /**
  3663. * WordPress dependencies
  3664. */
  3665. /**
  3666. * Internal dependencies
  3667. */
  3668. function WelcomeGuide() {
  3669. var _widgetAreas$filter$l;
  3670. const isActive = (0,external_wp_data_namespaceObject.useSelect)(select => !!select(external_wp_preferences_namespaceObject.store).get('core/edit-widgets', 'welcomeGuide'), []);
  3671. const {
  3672. toggle
  3673. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store);
  3674. const widgetAreas = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getWidgetAreas({
  3675. per_page: -1
  3676. }), []);
  3677. if (!isActive) {
  3678. return null;
  3679. }
  3680. const isEntirelyBlockWidgets = widgetAreas === null || widgetAreas === void 0 ? void 0 : widgetAreas.every(widgetArea => widgetArea.id === 'wp_inactive_widgets' || widgetArea.widgets.every(widgetId => widgetId.startsWith('block-')));
  3681. const numWidgetAreas = (_widgetAreas$filter$l = widgetAreas === null || widgetAreas === void 0 ? void 0 : widgetAreas.filter(widgetArea => widgetArea.id !== 'wp_inactive_widgets').length) !== null && _widgetAreas$filter$l !== void 0 ? _widgetAreas$filter$l : 0;
  3682. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Guide, {
  3683. className: "edit-widgets-welcome-guide",
  3684. contentLabel: (0,external_wp_i18n_namespaceObject.__)('Welcome to block Widgets'),
  3685. finishButtonText: (0,external_wp_i18n_namespaceObject.__)('Get started'),
  3686. onFinish: () => toggle('core/edit-widgets', 'welcomeGuide'),
  3687. pages: [{
  3688. image: (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideImage, {
  3689. nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-canvas.svg",
  3690. animatedSrc: "https://s.w.org/images/block-editor/welcome-canvas.gif"
  3691. }),
  3692. content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("h1", {
  3693. className: "edit-widgets-welcome-guide__heading"
  3694. }, (0,external_wp_i18n_namespaceObject.__)('Welcome to block Widgets')), isEntirelyBlockWidgets ? (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("p", {
  3695. className: "edit-widgets-welcome-guide__text"
  3696. }, (0,external_wp_i18n_namespaceObject.sprintf)( // Translators: %s: Number of block areas in the current theme.
  3697. (0,external_wp_i18n_namespaceObject._n)('Your theme provides %s “block” area 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.', 'Your theme provides %s 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.', numWidgetAreas), numWidgetAreas))) : (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("p", {
  3698. className: "edit-widgets-welcome-guide__text"
  3699. }, (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)("p", {
  3700. className: "edit-widgets-welcome-guide__text"
  3701. }, (0,external_wp_element_namespaceObject.createElement)("strong", null, (0,external_wp_i18n_namespaceObject.__)('Want to stick with the old widgets?')), ' ', (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ExternalLink, {
  3702. href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/plugins/classic-widgets/')
  3703. }, (0,external_wp_i18n_namespaceObject.__)('Get the Classic Widgets plugin.')))))
  3704. }, {
  3705. image: (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideImage, {
  3706. nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-editor.svg",
  3707. animatedSrc: "https://s.w.org/images/block-editor/welcome-editor.gif"
  3708. }),
  3709. content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("h1", {
  3710. className: "edit-widgets-welcome-guide__heading"
  3711. }, (0,external_wp_i18n_namespaceObject.__)('Make each block your own')), (0,external_wp_element_namespaceObject.createElement)("p", {
  3712. className: "edit-widgets-welcome-guide__text"
  3713. }, (0,external_wp_i18n_namespaceObject.__)('Each block comes with its own set of controls for changing things like color, width, and alignment. These will show and hide automatically when you have a block selected.')))
  3714. }, {
  3715. image: (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideImage, {
  3716. nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-library.svg",
  3717. animatedSrc: "https://s.w.org/images/block-editor/welcome-library.gif"
  3718. }),
  3719. content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("h1", {
  3720. className: "edit-widgets-welcome-guide__heading"
  3721. }, (0,external_wp_i18n_namespaceObject.__)('Get to know the block library')), (0,external_wp_element_namespaceObject.createElement)("p", {
  3722. className: "edit-widgets-welcome-guide__text"
  3723. }, (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.__)('All of the blocks available to you live in the block library. You’ll find it wherever you see the <InserterIconImage /> icon.'), {
  3724. InserterIconImage: (0,external_wp_element_namespaceObject.createElement)("img", {
  3725. className: "edit-widgets-welcome-guide__inserter-icon",
  3726. alt: (0,external_wp_i18n_namespaceObject.__)('inserter'),
  3727. src: "data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 18 18' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='18' height='18' rx='2' fill='%231E1E1E'/%3E%3Cpath d='M9.22727 4V14M4 8.77273H14' stroke='white' stroke-width='1.5'/%3E%3C/svg%3E%0A"
  3728. })
  3729. })))
  3730. }, {
  3731. image: (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideImage, {
  3732. nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.svg",
  3733. animatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.gif"
  3734. }),
  3735. content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("h1", {
  3736. className: "edit-widgets-welcome-guide__heading"
  3737. }, (0,external_wp_i18n_namespaceObject.__)('Learn how to use the block editor')), (0,external_wp_element_namespaceObject.createElement)("p", {
  3738. className: "edit-widgets-welcome-guide__text"
  3739. }, (0,external_wp_i18n_namespaceObject.__)('New to the block editor? Want to learn more about using it? '), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ExternalLink, {
  3740. href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/support/article/wordpress-editor/')
  3741. }, (0,external_wp_i18n_namespaceObject.__)("Here's a detailed guide."))))
  3742. }]
  3743. });
  3744. }
  3745. function WelcomeGuideImage(_ref) {
  3746. let {
  3747. nonAnimatedSrc,
  3748. animatedSrc
  3749. } = _ref;
  3750. return (0,external_wp_element_namespaceObject.createElement)("picture", {
  3751. className: "edit-widgets-welcome-guide__image"
  3752. }, (0,external_wp_element_namespaceObject.createElement)("source", {
  3753. srcSet: nonAnimatedSrc,
  3754. media: "(prefers-reduced-motion: reduce)"
  3755. }), (0,external_wp_element_namespaceObject.createElement)("img", {
  3756. src: animatedSrc,
  3757. width: "312",
  3758. height: "240",
  3759. alt: ""
  3760. }));
  3761. }
  3762. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/components/layout/index.js
  3763. /**
  3764. * WordPress dependencies
  3765. */
  3766. /**
  3767. * Internal dependencies
  3768. */
  3769. function Layout(_ref) {
  3770. let {
  3771. blockEditorSettings,
  3772. onError
  3773. } = _ref;
  3774. const {
  3775. createErrorNotice
  3776. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
  3777. function onPluginAreaError(name) {
  3778. createErrorNotice((0,external_wp_i18n_namespaceObject.sprintf)(
  3779. /* translators: %s: plugin name */
  3780. (0,external_wp_i18n_namespaceObject.__)('The "%s" plugin has encountered an error and cannot be rendered.'), name));
  3781. }
  3782. return (0,external_wp_element_namespaceObject.createElement)(ErrorBoundary, {
  3783. onError: onError
  3784. }, (0,external_wp_element_namespaceObject.createElement)(WidgetAreasBlockEditorProvider, {
  3785. blockEditorSettings: blockEditorSettings
  3786. }, (0,external_wp_element_namespaceObject.createElement)(layout_interface, {
  3787. blockEditorSettings: blockEditorSettings
  3788. }), (0,external_wp_element_namespaceObject.createElement)(Sidebar, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Popover.Slot, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_plugins_namespaceObject.PluginArea, {
  3789. onError: onPluginAreaError
  3790. }), (0,external_wp_element_namespaceObject.createElement)(UnsavedChangesWarning, null), (0,external_wp_element_namespaceObject.createElement)(WelcomeGuide, null)));
  3791. }
  3792. /* harmony default export */ var layout = (Layout);
  3793. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/index.js
  3794. /**
  3795. * WordPress dependencies
  3796. */
  3797. /**
  3798. * Internal dependencies
  3799. */
  3800. const disabledBlocks = ['core/more', 'core/freeform', 'core/template-part', ...(ALLOW_REUSABLE_BLOCKS ? [] : ['core/block'])];
  3801. /**
  3802. * Reinitializes the editor after the user chooses to reboot the editor after
  3803. * an unhandled error occurs, replacing previously mounted editor element using
  3804. * an initial state from prior to the crash.
  3805. *
  3806. * @param {Element} target DOM node in which editor is rendered.
  3807. * @param {?Object} settings Editor settings object.
  3808. */
  3809. function reinitializeEditor(target, settings) {
  3810. (0,external_wp_element_namespaceObject.unmountComponentAtNode)(target);
  3811. const reboot = reinitializeEditor.bind(null, target, settings);
  3812. (0,external_wp_element_namespaceObject.render)((0,external_wp_element_namespaceObject.createElement)(layout, {
  3813. blockEditorSettings: settings,
  3814. onError: reboot
  3815. }), target);
  3816. }
  3817. /**
  3818. * Initializes the block editor in the widgets screen.
  3819. *
  3820. * @param {string} id ID of the root element to render the screen in.
  3821. * @param {Object} settings Block editor settings.
  3822. */
  3823. function initialize(id, settings) {
  3824. const target = document.getElementById(id);
  3825. const reboot = reinitializeEditor.bind(null, target, settings);
  3826. const coreBlocks = (0,external_wp_blockLibrary_namespaceObject.__experimentalGetCoreBlocks)().filter(block => {
  3827. return !(disabledBlocks.includes(block.name) || block.name.startsWith('core/post') || block.name.startsWith('core/query') || block.name.startsWith('core/site') || block.name.startsWith('core/navigation'));
  3828. });
  3829. (0,external_wp_data_namespaceObject.dispatch)(external_wp_preferences_namespaceObject.store).setDefaults('core/edit-widgets', {
  3830. fixedToolbar: false,
  3831. welcomeGuide: true,
  3832. showBlockBreadcrumbs: true,
  3833. themeStyles: true
  3834. });
  3835. (0,external_wp_data_namespaceObject.dispatch)(external_wp_blocks_namespaceObject.store).__experimentalReapplyBlockTypeFilters();
  3836. (0,external_wp_blockLibrary_namespaceObject.registerCoreBlocks)(coreBlocks);
  3837. (0,external_wp_widgets_namespaceObject.registerLegacyWidgetBlock)();
  3838. if (false) {}
  3839. (0,external_wp_widgets_namespaceObject.registerLegacyWidgetVariations)(settings);
  3840. registerBlock(widget_area_namespaceObject);
  3841. (0,external_wp_widgets_namespaceObject.registerWidgetGroupBlock)();
  3842. settings.__experimentalFetchLinkSuggestions = (search, searchOptions) => (0,external_wp_coreData_namespaceObject.__experimentalFetchLinkSuggestions)(search, searchOptions, settings); // As we are unregistering `core/freeform` to avoid the Classic block, we must
  3843. // replace it with something as the default freeform content handler. Failure to
  3844. // do this will result in errors in the default block parser.
  3845. // see: https://github.com/WordPress/gutenberg/issues/33097
  3846. (0,external_wp_blocks_namespaceObject.setFreeformContentHandlerName)('core/html');
  3847. (0,external_wp_element_namespaceObject.render)((0,external_wp_element_namespaceObject.createElement)(layout, {
  3848. blockEditorSettings: settings,
  3849. onError: reboot
  3850. }), target);
  3851. }
  3852. /**
  3853. * Function to register an individual block.
  3854. *
  3855. * @param {Object} block The block to be registered.
  3856. *
  3857. */
  3858. const registerBlock = block => {
  3859. if (!block) {
  3860. return;
  3861. }
  3862. const {
  3863. metadata,
  3864. settings,
  3865. name
  3866. } = block;
  3867. if (metadata) {
  3868. (0,external_wp_blocks_namespaceObject.unstable__bootstrapServerSideBlockDefinitions)({
  3869. [name]: metadata
  3870. });
  3871. }
  3872. (0,external_wp_blocks_namespaceObject.registerBlockType)(name, settings);
  3873. };
  3874. }();
  3875. (window.wp = window.wp || {}).editWidgets = __webpack_exports__;
  3876. /******/ })()
  3877. ;