| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018 |
- this["wp"] = this["wp"] || {}; this["wp"]["data"] =
- /******/ (function(modules) { // webpackBootstrap
- /******/ // The module cache
- /******/ var installedModules = {};
- /******/
- /******/ // The require function
- /******/ function __webpack_require__(moduleId) {
- /******/
- /******/ // Check if module is in cache
- /******/ if(installedModules[moduleId]) {
- /******/ return installedModules[moduleId].exports;
- /******/ }
- /******/ // Create a new module (and put it into the cache)
- /******/ var module = installedModules[moduleId] = {
- /******/ i: moduleId,
- /******/ l: false,
- /******/ exports: {}
- /******/ };
- /******/
- /******/ // Execute the module function
- /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
- /******/
- /******/ // Flag the module as loaded
- /******/ module.l = true;
- /******/
- /******/ // Return the exports of the module
- /******/ return module.exports;
- /******/ }
- /******/
- /******/
- /******/ // expose the modules object (__webpack_modules__)
- /******/ __webpack_require__.m = modules;
- /******/
- /******/ // expose the module cache
- /******/ __webpack_require__.c = installedModules;
- /******/
- /******/ // define getter function for harmony exports
- /******/ __webpack_require__.d = function(exports, name, getter) {
- /******/ if(!__webpack_require__.o(exports, name)) {
- /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
- /******/ }
- /******/ };
- /******/
- /******/ // define __esModule on exports
- /******/ __webpack_require__.r = function(exports) {
- /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
- /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
- /******/ }
- /******/ Object.defineProperty(exports, '__esModule', { value: true });
- /******/ };
- /******/
- /******/ // create a fake namespace object
- /******/ // mode & 1: value is a module id, require it
- /******/ // mode & 2: merge all properties of value into the ns
- /******/ // mode & 4: return value when already ns object
- /******/ // mode & 8|1: behave like require
- /******/ __webpack_require__.t = function(value, mode) {
- /******/ if(mode & 1) value = __webpack_require__(value);
- /******/ if(mode & 8) return value;
- /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
- /******/ var ns = Object.create(null);
- /******/ __webpack_require__.r(ns);
- /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
- /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
- /******/ return ns;
- /******/ };
- /******/
- /******/ // getDefaultExport function for compatibility with non-harmony modules
- /******/ __webpack_require__.n = function(module) {
- /******/ var getter = module && module.__esModule ?
- /******/ function getDefault() { return module['default']; } :
- /******/ function getModuleExports() { return module; };
- /******/ __webpack_require__.d(getter, 'a', getter);
- /******/ return getter;
- /******/ };
- /******/
- /******/ // Object.prototype.hasOwnProperty.call
- /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
- /******/
- /******/ // __webpack_public_path__
- /******/ __webpack_require__.p = "";
- /******/
- /******/
- /******/ // Load entry module and return exports
- /******/ return __webpack_require__(__webpack_require__.s = "pfJ3");
- /******/ })
- /************************************************************************/
- /******/ ({
- /***/ "8mpt":
- /***/ (function(module, exports) {
- function combineReducers( reducers ) {
- var keys = Object.keys( reducers ),
- getNextState;
- getNextState = ( function() {
- var fn, i, key;
- fn = 'return {';
- for ( i = 0; i < keys.length; i++ ) {
- // Rely on Quoted escaping of JSON.stringify with guarantee that
- // each member of Object.keys is a string.
- //
- // "If Type(value) is String, then return the result of calling the
- // abstract operation Quote with argument value. [...] The abstract
- // operation Quote(value) wraps a String value in double quotes and
- // escapes characters within it."
- //
- // https://www.ecma-international.org/ecma-262/5.1/#sec-15.12.3
- key = JSON.stringify( keys[ i ] );
- fn += key + ':r[' + key + '](s[' + key + '],a),';
- }
- fn += '}';
- return new Function( 'r,s,a', fn );
- } )();
- return function combinedReducer( state, action ) {
- var nextState, i, key;
- // Assumed changed if initial state.
- if ( state === undefined ) {
- return getNextState( reducers, {}, action );
- }
- nextState = getNextState( reducers, state, action );
- // Determine whether state has changed.
- i = keys.length;
- while ( i-- ) {
- key = keys[ i ];
- if ( state[ key ] !== nextState[ key ] ) {
- // Return immediately if a changed value is encountered.
- return nextState;
- }
- }
- return state;
- };
- }
- module.exports = combineReducers;
- /***/ }),
- /***/ "FtRg":
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- function _typeof(obj) {
- if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
- _typeof = function (obj) {
- return typeof obj;
- };
- } else {
- _typeof = function (obj) {
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
- };
- }
- return _typeof(obj);
- }
- function _classCallCheck(instance, Constructor) {
- if (!(instance instanceof Constructor)) {
- throw new TypeError("Cannot call a class as a function");
- }
- }
- function _defineProperties(target, props) {
- for (var i = 0; i < props.length; i++) {
- var descriptor = props[i];
- descriptor.enumerable = descriptor.enumerable || false;
- descriptor.configurable = true;
- if ("value" in descriptor) descriptor.writable = true;
- Object.defineProperty(target, descriptor.key, descriptor);
- }
- }
- function _createClass(Constructor, protoProps, staticProps) {
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
- if (staticProps) _defineProperties(Constructor, staticProps);
- return Constructor;
- }
- /**
- * Given an instance of EquivalentKeyMap, returns its internal value pair tuple
- * for a key, if one exists. The tuple members consist of the last reference
- * value for the key (used in efficient subsequent lookups) and the value
- * assigned for the key at the leaf node.
- *
- * @param {EquivalentKeyMap} instance EquivalentKeyMap instance.
- * @param {*} key The key for which to return value pair.
- *
- * @return {?Array} Value pair, if exists.
- */
- function getValuePair(instance, key) {
- var _map = instance._map,
- _arrayTreeMap = instance._arrayTreeMap,
- _objectTreeMap = instance._objectTreeMap; // Map keeps a reference to the last object-like key used to set the
- // value, which can be used to shortcut immediately to the value.
- if (_map.has(key)) {
- return _map.get(key);
- } // Sort keys to ensure stable retrieval from tree.
- var properties = Object.keys(key).sort(); // Tree by type to avoid conflicts on numeric object keys, empty value.
- var map = Array.isArray(key) ? _arrayTreeMap : _objectTreeMap;
- for (var i = 0; i < properties.length; i++) {
- var property = properties[i];
- map = map.get(property);
- if (map === undefined) {
- return;
- }
- var propertyValue = key[property];
- map = map.get(propertyValue);
- if (map === undefined) {
- return;
- }
- }
- var valuePair = map.get('_ekm_value');
- if (!valuePair) {
- return;
- } // If reached, it implies that an object-like key was set with another
- // reference, so delete the reference and replace with the current.
- _map.delete(valuePair[0]);
- valuePair[0] = key;
- map.set('_ekm_value', valuePair);
- _map.set(key, valuePair);
- return valuePair;
- }
- /**
- * Variant of a Map object which enables lookup by equivalent (deeply equal)
- * object and array keys.
- */
- var EquivalentKeyMap =
- /*#__PURE__*/
- function () {
- /**
- * Constructs a new instance of EquivalentKeyMap.
- *
- * @param {Iterable.<*>} iterable Initial pair of key, value for map.
- */
- function EquivalentKeyMap(iterable) {
- _classCallCheck(this, EquivalentKeyMap);
- this.clear();
- if (iterable instanceof EquivalentKeyMap) {
- // Map#forEach is only means of iterating with support for IE11.
- var iterablePairs = [];
- iterable.forEach(function (value, key) {
- iterablePairs.push([key, value]);
- });
- iterable = iterablePairs;
- }
- if (iterable != null) {
- for (var i = 0; i < iterable.length; i++) {
- this.set(iterable[i][0], iterable[i][1]);
- }
- }
- }
- /**
- * Accessor property returning the number of elements.
- *
- * @return {number} Number of elements.
- */
- _createClass(EquivalentKeyMap, [{
- key: "set",
- /**
- * Add or update an element with a specified key and value.
- *
- * @param {*} key The key of the element to add.
- * @param {*} value The value of the element to add.
- *
- * @return {EquivalentKeyMap} Map instance.
- */
- value: function set(key, value) {
- // Shortcut non-object-like to set on internal Map.
- if (key === null || _typeof(key) !== 'object') {
- this._map.set(key, value);
- return this;
- } // Sort keys to ensure stable assignment into tree.
- var properties = Object.keys(key).sort();
- var valuePair = [key, value]; // Tree by type to avoid conflicts on numeric object keys, empty value.
- var map = Array.isArray(key) ? this._arrayTreeMap : this._objectTreeMap;
- for (var i = 0; i < properties.length; i++) {
- var property = properties[i];
- if (!map.has(property)) {
- map.set(property, new EquivalentKeyMap());
- }
- map = map.get(property);
- var propertyValue = key[property];
- if (!map.has(propertyValue)) {
- map.set(propertyValue, new EquivalentKeyMap());
- }
- map = map.get(propertyValue);
- } // If an _ekm_value exists, there was already an equivalent key. Before
- // overriding, ensure that the old key reference is removed from map to
- // avoid memory leak of accumulating equivalent keys. This is, in a
- // sense, a poor man's WeakMap, while still enabling iterability.
- var previousValuePair = map.get('_ekm_value');
- if (previousValuePair) {
- this._map.delete(previousValuePair[0]);
- }
- map.set('_ekm_value', valuePair);
- this._map.set(key, valuePair);
- return this;
- }
- /**
- * Returns a specified element.
- *
- * @param {*} key The key of the element to return.
- *
- * @return {?*} The element associated with the specified key or undefined
- * if the key can't be found.
- */
- }, {
- key: "get",
- value: function get(key) {
- // Shortcut non-object-like to get from internal Map.
- if (key === null || _typeof(key) !== 'object') {
- return this._map.get(key);
- }
- var valuePair = getValuePair(this, key);
- if (valuePair) {
- return valuePair[1];
- }
- }
- /**
- * Returns a boolean indicating whether an element with the specified key
- * exists or not.
- *
- * @param {*} key The key of the element to test for presence.
- *
- * @return {boolean} Whether an element with the specified key exists.
- */
- }, {
- key: "has",
- value: function has(key) {
- if (key === null || _typeof(key) !== 'object') {
- return this._map.has(key);
- } // Test on the _presence_ of the pair, not its value, as even undefined
- // can be a valid member value for a key.
- return getValuePair(this, key) !== undefined;
- }
- /**
- * Removes the specified element.
- *
- * @param {*} key The key of the element to remove.
- *
- * @return {boolean} Returns true if an element existed and has been
- * removed, or false if the element does not exist.
- */
- }, {
- key: "delete",
- value: function _delete(key) {
- if (!this.has(key)) {
- return false;
- } // This naive implementation will leave orphaned child trees. A better
- // implementation should traverse and remove orphans.
- this.set(key, undefined);
- return true;
- }
- /**
- * Executes a provided function once per each key/value pair, in insertion
- * order.
- *
- * @param {Function} callback Function to execute for each element.
- * @param {*} thisArg Value to use as `this` when executing
- * `callback`.
- */
- }, {
- key: "forEach",
- value: function forEach(callback) {
- var _this = this;
- var thisArg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this;
- this._map.forEach(function (value, key) {
- // Unwrap value from object-like value pair.
- if (key !== null && _typeof(key) === 'object') {
- value = value[1];
- }
- callback.call(thisArg, value, key, _this);
- });
- }
- /**
- * Removes all elements.
- */
- }, {
- key: "clear",
- value: function clear() {
- this._map = new Map();
- this._arrayTreeMap = new Map();
- this._objectTreeMap = new Map();
- }
- }, {
- key: "size",
- get: function get() {
- return this._map.size;
- }
- }]);
- return EquivalentKeyMap;
- }();
- module.exports = EquivalentKeyMap;
- /***/ }),
- /***/ "GRId":
- /***/ (function(module, exports) {
- (function() { module.exports = window["wp"]["element"]; }());
- /***/ }),
- /***/ "JlUD":
- /***/ (function(module, exports) {
- module.exports = isPromise;
- module.exports.default = isPromise;
- function isPromise(obj) {
- return !!obj && (typeof obj === 'object' || typeof obj === 'function') && typeof obj.then === 'function';
- }
- /***/ }),
- /***/ "K9lf":
- /***/ (function(module, exports) {
- (function() { module.exports = window["wp"]["compose"]; }());
- /***/ }),
- /***/ "NMb1":
- /***/ (function(module, exports) {
- (function() { module.exports = window["wp"]["deprecated"]; }());
- /***/ }),
- /***/ "XI5e":
- /***/ (function(module, exports) {
- (function() { module.exports = window["wp"]["priorityQueue"]; }());
- /***/ }),
- /***/ "XIDh":
- /***/ (function(module, exports) {
- (function() { module.exports = window["wp"]["reduxRoutine"]; }());
- /***/ }),
- /***/ "YLtl":
- /***/ (function(module, exports) {
- (function() { module.exports = window["lodash"]; }());
- /***/ }),
- /***/ "cDcd":
- /***/ (function(module, exports) {
- (function() { module.exports = window["React"]; }());
- /***/ }),
- /***/ "mHlH":
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* unused harmony export useCallback */
- /* unused harmony export useCallbackOne */
- /* unused harmony export useMemo */
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return useMemoOne; });
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("cDcd");
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
- function areInputsEqual(newInputs, lastInputs) {
- if (newInputs.length !== lastInputs.length) {
- return false;
- }
- for (var i = 0; i < newInputs.length; i++) {
- if (newInputs[i] !== lastInputs[i]) {
- return false;
- }
- }
- return true;
- }
- function useMemoOne(getResult, inputs) {
- var initial = Object(react__WEBPACK_IMPORTED_MODULE_0__["useState"])(function () {
- return {
- inputs: inputs,
- result: getResult()
- };
- })[0];
- var isFirstRun = Object(react__WEBPACK_IMPORTED_MODULE_0__["useRef"])(true);
- var committed = Object(react__WEBPACK_IMPORTED_MODULE_0__["useRef"])(initial);
- var useCache = isFirstRun.current || Boolean(inputs && committed.current.inputs && areInputsEqual(inputs, committed.current.inputs));
- var cache = useCache ? committed.current : {
- inputs: inputs,
- result: getResult()
- };
- Object(react__WEBPACK_IMPORTED_MODULE_0__["useEffect"])(function () {
- isFirstRun.current = false;
- committed.current = cache;
- }, [cache]);
- return cache.result;
- }
- function useCallbackOne(callback, inputs) {
- return useMemoOne(function () {
- return callback;
- }, inputs);
- }
- var useMemo = useMemoOne;
- var useCallback = useCallbackOne;
- /***/ }),
- /***/ "pfJ3":
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- // ESM COMPAT FLAG
- __webpack_require__.r(__webpack_exports__);
- // EXPORTS
- __webpack_require__.d(__webpack_exports__, "withSelect", function() { return /* reexport */ with_select; });
- __webpack_require__.d(__webpack_exports__, "withDispatch", function() { return /* reexport */ with_dispatch; });
- __webpack_require__.d(__webpack_exports__, "withRegistry", function() { return /* reexport */ with_registry; });
- __webpack_require__.d(__webpack_exports__, "RegistryProvider", function() { return /* reexport */ context; });
- __webpack_require__.d(__webpack_exports__, "RegistryConsumer", function() { return /* reexport */ RegistryConsumer; });
- __webpack_require__.d(__webpack_exports__, "useRegistry", function() { return /* reexport */ useRegistry; });
- __webpack_require__.d(__webpack_exports__, "useSelect", function() { return /* reexport */ useSelect; });
- __webpack_require__.d(__webpack_exports__, "useDispatch", function() { return /* reexport */ use_dispatch; });
- __webpack_require__.d(__webpack_exports__, "AsyncModeProvider", function() { return /* reexport */ async_mode_provider_context; });
- __webpack_require__.d(__webpack_exports__, "createRegistry", function() { return /* reexport */ createRegistry; });
- __webpack_require__.d(__webpack_exports__, "createRegistrySelector", function() { return /* reexport */ createRegistrySelector; });
- __webpack_require__.d(__webpack_exports__, "createRegistryControl", function() { return /* reexport */ createRegistryControl; });
- __webpack_require__.d(__webpack_exports__, "controls", function() { return /* reexport */ controls_controls; });
- __webpack_require__.d(__webpack_exports__, "createReduxStore", function() { return /* reexport */ createReduxStore; });
- __webpack_require__.d(__webpack_exports__, "plugins", function() { return /* reexport */ plugins_namespaceObject; });
- __webpack_require__.d(__webpack_exports__, "combineReducers", function() { return /* reexport */ turbo_combine_reducers_default.a; });
- __webpack_require__.d(__webpack_exports__, "select", function() { return /* binding */ build_module_select; });
- __webpack_require__.d(__webpack_exports__, "resolveSelect", function() { return /* binding */ build_module_resolveSelect; });
- __webpack_require__.d(__webpack_exports__, "dispatch", function() { return /* binding */ build_module_dispatch; });
- __webpack_require__.d(__webpack_exports__, "subscribe", function() { return /* binding */ build_module_subscribe; });
- __webpack_require__.d(__webpack_exports__, "registerGenericStore", function() { return /* binding */ build_module_registerGenericStore; });
- __webpack_require__.d(__webpack_exports__, "registerStore", function() { return /* binding */ registerStore; });
- __webpack_require__.d(__webpack_exports__, "use", function() { return /* binding */ build_module_use; });
- __webpack_require__.d(__webpack_exports__, "register", function() { return /* binding */ build_module_register; });
- // NAMESPACE OBJECT: ./node_modules/@wordpress/data/build-module/redux-store/metadata/selectors.js
- var selectors_namespaceObject = {};
- __webpack_require__.r(selectors_namespaceObject);
- __webpack_require__.d(selectors_namespaceObject, "getIsResolving", function() { return getIsResolving; });
- __webpack_require__.d(selectors_namespaceObject, "hasStartedResolution", function() { return hasStartedResolution; });
- __webpack_require__.d(selectors_namespaceObject, "hasFinishedResolution", function() { return hasFinishedResolution; });
- __webpack_require__.d(selectors_namespaceObject, "isResolving", function() { return isResolving; });
- __webpack_require__.d(selectors_namespaceObject, "getCachedResolvers", function() { return getCachedResolvers; });
- // NAMESPACE OBJECT: ./node_modules/@wordpress/data/build-module/redux-store/metadata/actions.js
- var actions_namespaceObject = {};
- __webpack_require__.r(actions_namespaceObject);
- __webpack_require__.d(actions_namespaceObject, "startResolution", function() { return startResolution; });
- __webpack_require__.d(actions_namespaceObject, "finishResolution", function() { return finishResolution; });
- __webpack_require__.d(actions_namespaceObject, "startResolutions", function() { return startResolutions; });
- __webpack_require__.d(actions_namespaceObject, "finishResolutions", function() { return finishResolutions; });
- __webpack_require__.d(actions_namespaceObject, "invalidateResolution", function() { return invalidateResolution; });
- __webpack_require__.d(actions_namespaceObject, "invalidateResolutionForStore", function() { return invalidateResolutionForStore; });
- __webpack_require__.d(actions_namespaceObject, "invalidateResolutionForStoreSelector", function() { return invalidateResolutionForStoreSelector; });
- // NAMESPACE OBJECT: ./node_modules/@wordpress/data/build-module/plugins/index.js
- var plugins_namespaceObject = {};
- __webpack_require__.r(plugins_namespaceObject);
- __webpack_require__.d(plugins_namespaceObject, "controls", function() { return plugins_controls; });
- __webpack_require__.d(plugins_namespaceObject, "persistence", function() { return plugins_persistence; });
- // EXTERNAL MODULE: ./node_modules/turbo-combine-reducers/index.js
- var turbo_combine_reducers = __webpack_require__("8mpt");
- var turbo_combine_reducers_default = /*#__PURE__*/__webpack_require__.n(turbo_combine_reducers);
- // EXTERNAL MODULE: external "lodash"
- var external_lodash_ = __webpack_require__("YLtl");
- // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js
- function _defineProperty(obj, key, value) {
- if (key in obj) {
- Object.defineProperty(obj, key, {
- value: value,
- enumerable: true,
- configurable: true,
- writable: true
- });
- } else {
- obj[key] = value;
- }
- return obj;
- }
- // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/objectSpread2.js
- function ownKeys(object, enumerableOnly) {
- var keys = Object.keys(object);
- if (Object.getOwnPropertySymbols) {
- var symbols = Object.getOwnPropertySymbols(object);
- if (enumerableOnly) {
- symbols = symbols.filter(function (sym) {
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
- });
- }
- keys.push.apply(keys, symbols);
- }
- return keys;
- }
- function _objectSpread2(target) {
- for (var i = 1; i < arguments.length; i++) {
- var source = arguments[i] != null ? arguments[i] : {};
- if (i % 2) {
- ownKeys(Object(source), true).forEach(function (key) {
- _defineProperty(target, key, source[key]);
- });
- } else if (Object.getOwnPropertyDescriptors) {
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
- } else {
- ownKeys(Object(source)).forEach(function (key) {
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
- });
- }
- }
- return target;
- }
- // CONCATENATED MODULE: ./node_modules/redux/es/redux.js
- /**
- * Adapted from React: https://github.com/facebook/react/blob/master/packages/shared/formatProdErrorMessage.js
- *
- * Do not require this module directly! Use normal throw error calls. These messages will be replaced with error codes
- * during build.
- * @param {number} code
- */
- function formatProdErrorMessage(code) {
- return "Minified Redux error #" + code + "; visit https://redux.js.org/Errors?code=" + code + " for the full message or " + 'use the non-minified dev environment for full errors. ';
- }
- // Inlined version of the `symbol-observable` polyfill
- var $$observable = (function () {
- return typeof Symbol === 'function' && Symbol.observable || '@@observable';
- })();
- /**
- * These are private action types reserved by Redux.
- * For any unknown actions, you must return the current state.
- * If the current state is undefined, you must return the initial state.
- * Do not reference these action types directly in your code.
- */
- var randomString = function randomString() {
- return Math.random().toString(36).substring(7).split('').join('.');
- };
- var ActionTypes = {
- INIT: "@@redux/INIT" + randomString(),
- REPLACE: "@@redux/REPLACE" + randomString(),
- PROBE_UNKNOWN_ACTION: function PROBE_UNKNOWN_ACTION() {
- return "@@redux/PROBE_UNKNOWN_ACTION" + randomString();
- }
- };
- /**
- * @param {any} obj The object to inspect.
- * @returns {boolean} True if the argument appears to be a plain object.
- */
- function isPlainObject(obj) {
- if (typeof obj !== 'object' || obj === null) return false;
- var proto = obj;
- while (Object.getPrototypeOf(proto) !== null) {
- proto = Object.getPrototypeOf(proto);
- }
- return Object.getPrototypeOf(obj) === proto;
- }
- // Inlined / shortened version of `kindOf` from https://github.com/jonschlinkert/kind-of
- function miniKindOf(val) {
- if (val === void 0) return 'undefined';
- if (val === null) return 'null';
- var type = typeof val;
- switch (type) {
- case 'boolean':
- case 'string':
- case 'number':
- case 'symbol':
- case 'function':
- {
- return type;
- }
- }
- if (Array.isArray(val)) return 'array';
- if (isDate(val)) return 'date';
- if (isError(val)) return 'error';
- var constructorName = ctorName(val);
- switch (constructorName) {
- case 'Symbol':
- case 'Promise':
- case 'WeakMap':
- case 'WeakSet':
- case 'Map':
- case 'Set':
- return constructorName;
- } // other
- return type.slice(8, -1).toLowerCase().replace(/\s/g, '');
- }
- function ctorName(val) {
- return typeof val.constructor === 'function' ? val.constructor.name : null;
- }
- function isError(val) {
- return val instanceof Error || typeof val.message === 'string' && val.constructor && typeof val.constructor.stackTraceLimit === 'number';
- }
- function isDate(val) {
- if (val instanceof Date) return true;
- return typeof val.toDateString === 'function' && typeof val.getDate === 'function' && typeof val.setDate === 'function';
- }
- function kindOf(val) {
- var typeOfVal = typeof val;
- if (false) {}
- return typeOfVal;
- }
- /**
- * Creates a Redux store that holds the state tree.
- * The only way to change the data in the store is to call `dispatch()` on it.
- *
- * There should only be a single store in your app. To specify how different
- * parts of the state tree respond to actions, you may combine several reducers
- * into a single reducer function by using `combineReducers`.
- *
- * @param {Function} reducer A function that returns the next state tree, given
- * the current state tree and the action to handle.
- *
- * @param {any} [preloadedState] The initial state. You may optionally specify it
- * to hydrate the state from the server in universal apps, or to restore a
- * previously serialized user session.
- * If you use `combineReducers` to produce the root reducer function, this must be
- * an object with the same shape as `combineReducers` keys.
- *
- * @param {Function} [enhancer] The store enhancer. You may optionally specify it
- * to enhance the store with third-party capabilities such as middleware,
- * time travel, persistence, etc. The only store enhancer that ships with Redux
- * is `applyMiddleware()`.
- *
- * @returns {Store} A Redux store that lets you read the state, dispatch actions
- * and subscribe to changes.
- */
- function redux_createStore(reducer, preloadedState, enhancer) {
- var _ref2;
- if (typeof preloadedState === 'function' && typeof enhancer === 'function' || typeof enhancer === 'function' && typeof arguments[3] === 'function') {
- throw new Error( true ? formatProdErrorMessage(0) : undefined);
- }
- if (typeof preloadedState === 'function' && typeof enhancer === 'undefined') {
- enhancer = preloadedState;
- preloadedState = undefined;
- }
- if (typeof enhancer !== 'undefined') {
- if (typeof enhancer !== 'function') {
- throw new Error( true ? formatProdErrorMessage(1) : undefined);
- }
- return enhancer(redux_createStore)(reducer, preloadedState);
- }
- if (typeof reducer !== 'function') {
- throw new Error( true ? formatProdErrorMessage(2) : undefined);
- }
- var currentReducer = reducer;
- var currentState = preloadedState;
- var currentListeners = [];
- var nextListeners = currentListeners;
- var isDispatching = false;
- /**
- * This makes a shallow copy of currentListeners so we can use
- * nextListeners as a temporary list while dispatching.
- *
- * This prevents any bugs around consumers calling
- * subscribe/unsubscribe in the middle of a dispatch.
- */
- function ensureCanMutateNextListeners() {
- if (nextListeners === currentListeners) {
- nextListeners = currentListeners.slice();
- }
- }
- /**
- * Reads the state tree managed by the store.
- *
- * @returns {any} The current state tree of your application.
- */
- function getState() {
- if (isDispatching) {
- throw new Error( true ? formatProdErrorMessage(3) : undefined);
- }
- return currentState;
- }
- /**
- * Adds a change listener. It will be called any time an action is dispatched,
- * and some part of the state tree may potentially have changed. You may then
- * call `getState()` to read the current state tree inside the callback.
- *
- * You may call `dispatch()` from a change listener, with the following
- * caveats:
- *
- * 1. The subscriptions are snapshotted just before every `dispatch()` call.
- * If you subscribe or unsubscribe while the listeners are being invoked, this
- * will not have any effect on the `dispatch()` that is currently in progress.
- * However, the next `dispatch()` call, whether nested or not, will use a more
- * recent snapshot of the subscription list.
- *
- * 2. The listener should not expect to see all state changes, as the state
- * might have been updated multiple times during a nested `dispatch()` before
- * the listener is called. It is, however, guaranteed that all subscribers
- * registered before the `dispatch()` started will be called with the latest
- * state by the time it exits.
- *
- * @param {Function} listener A callback to be invoked on every dispatch.
- * @returns {Function} A function to remove this change listener.
- */
- function subscribe(listener) {
- if (typeof listener !== 'function') {
- throw new Error( true ? formatProdErrorMessage(4) : undefined);
- }
- if (isDispatching) {
- throw new Error( true ? formatProdErrorMessage(5) : undefined);
- }
- var isSubscribed = true;
- ensureCanMutateNextListeners();
- nextListeners.push(listener);
- return function unsubscribe() {
- if (!isSubscribed) {
- return;
- }
- if (isDispatching) {
- throw new Error( true ? formatProdErrorMessage(6) : undefined);
- }
- isSubscribed = false;
- ensureCanMutateNextListeners();
- var index = nextListeners.indexOf(listener);
- nextListeners.splice(index, 1);
- currentListeners = null;
- };
- }
- /**
- * Dispatches an action. It is the only way to trigger a state change.
- *
- * The `reducer` function, used to create the store, will be called with the
- * current state tree and the given `action`. Its return value will
- * be considered the **next** state of the tree, and the change listeners
- * will be notified.
- *
- * The base implementation only supports plain object actions. If you want to
- * dispatch a Promise, an Observable, a thunk, or something else, you need to
- * wrap your store creating function into the corresponding middleware. For
- * example, see the documentation for the `redux-thunk` package. Even the
- * middleware will eventually dispatch plain object actions using this method.
- *
- * @param {Object} action A plain object representing “what changed”. It is
- * a good idea to keep actions serializable so you can record and replay user
- * sessions, or use the time travelling `redux-devtools`. An action must have
- * a `type` property which may not be `undefined`. It is a good idea to use
- * string constants for action types.
- *
- * @returns {Object} For convenience, the same action object you dispatched.
- *
- * Note that, if you use a custom middleware, it may wrap `dispatch()` to
- * return something else (for example, a Promise you can await).
- */
- function dispatch(action) {
- if (!isPlainObject(action)) {
- throw new Error( true ? formatProdErrorMessage(7) : undefined);
- }
- if (typeof action.type === 'undefined') {
- throw new Error( true ? formatProdErrorMessage(8) : undefined);
- }
- if (isDispatching) {
- throw new Error( true ? formatProdErrorMessage(9) : undefined);
- }
- try {
- isDispatching = true;
- currentState = currentReducer(currentState, action);
- } finally {
- isDispatching = false;
- }
- var listeners = currentListeners = nextListeners;
- for (var i = 0; i < listeners.length; i++) {
- var listener = listeners[i];
- listener();
- }
- return action;
- }
- /**
- * Replaces the reducer currently used by the store to calculate the state.
- *
- * You might need this if your app implements code splitting and you want to
- * load some of the reducers dynamically. You might also need this if you
- * implement a hot reloading mechanism for Redux.
- *
- * @param {Function} nextReducer The reducer for the store to use instead.
- * @returns {void}
- */
- function replaceReducer(nextReducer) {
- if (typeof nextReducer !== 'function') {
- throw new Error( true ? formatProdErrorMessage(10) : undefined);
- }
- currentReducer = nextReducer; // This action has a similiar effect to ActionTypes.INIT.
- // Any reducers that existed in both the new and old rootReducer
- // will receive the previous state. This effectively populates
- // the new state tree with any relevant data from the old one.
- dispatch({
- type: ActionTypes.REPLACE
- });
- }
- /**
- * Interoperability point for observable/reactive libraries.
- * @returns {observable} A minimal observable of state changes.
- * For more information, see the observable proposal:
- * https://github.com/tc39/proposal-observable
- */
- function observable() {
- var _ref;
- var outerSubscribe = subscribe;
- return _ref = {
- /**
- * The minimal observable subscription method.
- * @param {Object} observer Any object that can be used as an observer.
- * The observer object should have a `next` method.
- * @returns {subscription} An object with an `unsubscribe` method that can
- * be used to unsubscribe the observable from the store, and prevent further
- * emission of values from the observable.
- */
- subscribe: function subscribe(observer) {
- if (typeof observer !== 'object' || observer === null) {
- throw new Error( true ? formatProdErrorMessage(11) : undefined);
- }
- function observeState() {
- if (observer.next) {
- observer.next(getState());
- }
- }
- observeState();
- var unsubscribe = outerSubscribe(observeState);
- return {
- unsubscribe: unsubscribe
- };
- }
- }, _ref[$$observable] = function () {
- return this;
- }, _ref;
- } // When a store is created, an "INIT" action is dispatched so that every
- // reducer returns their initial state. This effectively populates
- // the initial state tree.
- dispatch({
- type: ActionTypes.INIT
- });
- return _ref2 = {
- dispatch: dispatch,
- subscribe: subscribe,
- getState: getState,
- replaceReducer: replaceReducer
- }, _ref2[$$observable] = observable, _ref2;
- }
- /**
- * Prints a warning in the console if it exists.
- *
- * @param {String} message The warning message.
- * @returns {void}
- */
- function warning(message) {
- /* eslint-disable no-console */
- if (typeof console !== 'undefined' && typeof console.error === 'function') {
- console.error(message);
- }
- /* eslint-enable no-console */
- try {
- // This error was thrown as a convenience so that if you enable
- // "break on all exceptions" in your console,
- // it would pause the execution at this line.
- throw new Error(message);
- } catch (e) {} // eslint-disable-line no-empty
- }
- function getUnexpectedStateShapeWarningMessage(inputState, reducers, action, unexpectedKeyCache) {
- var reducerKeys = Object.keys(reducers);
- var argumentName = action && action.type === ActionTypes.INIT ? 'preloadedState argument passed to createStore' : 'previous state received by the reducer';
- if (reducerKeys.length === 0) {
- return 'Store does not have a valid reducer. Make sure the argument passed ' + 'to combineReducers is an object whose values are reducers.';
- }
- if (!isPlainObject(inputState)) {
- return "The " + argumentName + " has unexpected type of \"" + kindOf(inputState) + "\". Expected argument to be an object with the following " + ("keys: \"" + reducerKeys.join('", "') + "\"");
- }
- var unexpectedKeys = Object.keys(inputState).filter(function (key) {
- return !reducers.hasOwnProperty(key) && !unexpectedKeyCache[key];
- });
- unexpectedKeys.forEach(function (key) {
- unexpectedKeyCache[key] = true;
- });
- if (action && action.type === ActionTypes.REPLACE) return;
- if (unexpectedKeys.length > 0) {
- return "Unexpected " + (unexpectedKeys.length > 1 ? 'keys' : 'key') + " " + ("\"" + unexpectedKeys.join('", "') + "\" found in " + argumentName + ". ") + "Expected to find one of the known reducer keys instead: " + ("\"" + reducerKeys.join('", "') + "\". Unexpected keys will be ignored.");
- }
- }
- function assertReducerShape(reducers) {
- Object.keys(reducers).forEach(function (key) {
- var reducer = reducers[key];
- var initialState = reducer(undefined, {
- type: ActionTypes.INIT
- });
- if (typeof initialState === 'undefined') {
- throw new Error( true ? formatProdErrorMessage(12) : undefined);
- }
- if (typeof reducer(undefined, {
- type: ActionTypes.PROBE_UNKNOWN_ACTION()
- }) === 'undefined') {
- throw new Error( true ? formatProdErrorMessage(13) : undefined);
- }
- });
- }
- /**
- * Turns an object whose values are different reducer functions, into a single
- * reducer function. It will call every child reducer, and gather their results
- * into a single state object, whose keys correspond to the keys of the passed
- * reducer functions.
- *
- * @param {Object} reducers An object whose values correspond to different
- * reducer functions that need to be combined into one. One handy way to obtain
- * it is to use ES6 `import * as reducers` syntax. The reducers may never return
- * undefined for any action. Instead, they should return their initial state
- * if the state passed to them was undefined, and the current state for any
- * unrecognized action.
- *
- * @returns {Function} A reducer function that invokes every reducer inside the
- * passed object, and builds a state object with the same shape.
- */
- function combineReducers(reducers) {
- var reducerKeys = Object.keys(reducers);
- var finalReducers = {};
- for (var i = 0; i < reducerKeys.length; i++) {
- var key = reducerKeys[i];
- if (false) {}
- if (typeof reducers[key] === 'function') {
- finalReducers[key] = reducers[key];
- }
- }
- var finalReducerKeys = Object.keys(finalReducers); // This is used to make sure we don't warn about the same
- // keys multiple times.
- var unexpectedKeyCache;
- if (false) {}
- var shapeAssertionError;
- try {
- assertReducerShape(finalReducers);
- } catch (e) {
- shapeAssertionError = e;
- }
- return function combination(state, action) {
- if (state === void 0) {
- state = {};
- }
- if (shapeAssertionError) {
- throw shapeAssertionError;
- }
- if (false) { var warningMessage; }
- var hasChanged = false;
- var nextState = {};
- for (var _i = 0; _i < finalReducerKeys.length; _i++) {
- var _key = finalReducerKeys[_i];
- var reducer = finalReducers[_key];
- var previousStateForKey = state[_key];
- var nextStateForKey = reducer(previousStateForKey, action);
- if (typeof nextStateForKey === 'undefined') {
- var actionType = action && action.type;
- throw new Error( true ? formatProdErrorMessage(14) : undefined);
- }
- nextState[_key] = nextStateForKey;
- hasChanged = hasChanged || nextStateForKey !== previousStateForKey;
- }
- hasChanged = hasChanged || finalReducerKeys.length !== Object.keys(state).length;
- return hasChanged ? nextState : state;
- };
- }
- function bindActionCreator(actionCreator, dispatch) {
- return function () {
- return dispatch(actionCreator.apply(this, arguments));
- };
- }
- /**
- * Turns an object whose values are action creators, into an object with the
- * same keys, but with every function wrapped into a `dispatch` call so they
- * may be invoked directly. This is just a convenience method, as you can call
- * `store.dispatch(MyActionCreators.doSomething())` yourself just fine.
- *
- * For convenience, you can also pass an action creator as the first argument,
- * and get a dispatch wrapped function in return.
- *
- * @param {Function|Object} actionCreators An object whose values are action
- * creator functions. One handy way to obtain it is to use ES6 `import * as`
- * syntax. You may also pass a single function.
- *
- * @param {Function} dispatch The `dispatch` function available on your Redux
- * store.
- *
- * @returns {Function|Object} The object mimicking the original object, but with
- * every action creator wrapped into the `dispatch` call. If you passed a
- * function as `actionCreators`, the return value will also be a single
- * function.
- */
- function bindActionCreators(actionCreators, dispatch) {
- if (typeof actionCreators === 'function') {
- return bindActionCreator(actionCreators, dispatch);
- }
- if (typeof actionCreators !== 'object' || actionCreators === null) {
- throw new Error( true ? formatProdErrorMessage(16) : undefined);
- }
- var boundActionCreators = {};
- for (var key in actionCreators) {
- var actionCreator = actionCreators[key];
- if (typeof actionCreator === 'function') {
- boundActionCreators[key] = bindActionCreator(actionCreator, dispatch);
- }
- }
- return boundActionCreators;
- }
- /**
- * Composes single-argument functions from right to left. The rightmost
- * function can take multiple arguments as it provides the signature for
- * the resulting composite function.
- *
- * @param {...Function} funcs The functions to compose.
- * @returns {Function} A function obtained by composing the argument functions
- * from right to left. For example, compose(f, g, h) is identical to doing
- * (...args) => f(g(h(...args))).
- */
- function compose() {
- for (var _len = arguments.length, funcs = new Array(_len), _key = 0; _key < _len; _key++) {
- funcs[_key] = arguments[_key];
- }
- if (funcs.length === 0) {
- return function (arg) {
- return arg;
- };
- }
- if (funcs.length === 1) {
- return funcs[0];
- }
- return funcs.reduce(function (a, b) {
- return function () {
- return a(b.apply(void 0, arguments));
- };
- });
- }
- /**
- * Creates a store enhancer that applies middleware to the dispatch method
- * of the Redux store. This is handy for a variety of tasks, such as expressing
- * asynchronous actions in a concise manner, or logging every action payload.
- *
- * See `redux-thunk` package as an example of the Redux middleware.
- *
- * Because middleware is potentially asynchronous, this should be the first
- * store enhancer in the composition chain.
- *
- * Note that each middleware will be given the `dispatch` and `getState` functions
- * as named arguments.
- *
- * @param {...Function} middlewares The middleware chain to be applied.
- * @returns {Function} A store enhancer applying the middleware.
- */
- function applyMiddleware() {
- for (var _len = arguments.length, middlewares = new Array(_len), _key = 0; _key < _len; _key++) {
- middlewares[_key] = arguments[_key];
- }
- return function (createStore) {
- return function () {
- var store = createStore.apply(void 0, arguments);
- var _dispatch = function dispatch() {
- throw new Error( true ? formatProdErrorMessage(15) : undefined);
- };
- var middlewareAPI = {
- getState: store.getState,
- dispatch: function dispatch() {
- return _dispatch.apply(void 0, arguments);
- }
- };
- var chain = middlewares.map(function (middleware) {
- return middleware(middlewareAPI);
- });
- _dispatch = compose.apply(void 0, chain)(store.dispatch);
- return _objectSpread2(_objectSpread2({}, store), {}, {
- dispatch: _dispatch
- });
- };
- };
- }
- /*
- * This is a dummy function to check if the function name has been altered by minification.
- * If the function has been minified and NODE_ENV !== 'production', warn the user.
- */
- function isCrushed() {}
- if (false) {}
- // EXTERNAL MODULE: ./node_modules/equivalent-key-map/equivalent-key-map.js
- var equivalent_key_map = __webpack_require__("FtRg");
- var equivalent_key_map_default = /*#__PURE__*/__webpack_require__.n(equivalent_key_map);
- // EXTERNAL MODULE: external ["wp","reduxRoutine"]
- var external_wp_reduxRoutine_ = __webpack_require__("XIDh");
- var external_wp_reduxRoutine_default = /*#__PURE__*/__webpack_require__.n(external_wp_reduxRoutine_);
- // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/factory.js
- /**
- * Creates a selector function that takes additional curried argument with the
- * registry `select` function. While a regular selector has signature
- * ```js
- * ( state, ...selectorArgs ) => ( result )
- * ```
- * that allows to select data from the store's `state`, a registry selector
- * has signature:
- * ```js
- * ( select ) => ( state, ...selectorArgs ) => ( result )
- * ```
- * that supports also selecting from other registered stores.
- *
- * @example
- * ```js
- * const getCurrentPostId = createRegistrySelector( ( select ) => ( state ) => {
- * return select( 'core/editor' ).getCurrentPostId();
- * } );
- *
- * const getPostEdits = createRegistrySelector( ( select ) => ( state ) => {
- * // calling another registry selector just like any other function
- * const postType = getCurrentPostType( state );
- * const postId = getCurrentPostId( state );
- * return select( 'core' ).getEntityRecordEdits( 'postType', postType, postId );
- * } );
- * ```
- *
- * Note how the `getCurrentPostId` selector can be called just like any other function,
- * (it works even inside a regular non-registry selector) and we don't need to pass the
- * registry as argument. The registry binding happens automatically when registering the selector
- * with a store.
- *
- * @param {Function} registrySelector Function receiving a registry `select`
- * function and returning a state selector.
- *
- * @return {Function} Registry selector that can be registered with a store.
- */
- function createRegistrySelector(registrySelector) {
- // create a selector function that is bound to the registry referenced by `selector.registry`
- // and that has the same API as a regular selector. Binding it in such a way makes it
- // possible to call the selector directly from another selector.
- const selector = (...args) => registrySelector(selector.registry.select)(...args);
- /**
- * Flag indicating that the selector is a registry selector that needs the correct registry
- * reference to be assigned to `selecto.registry` to make it work correctly.
- * be mapped as a registry selector.
- *
- * @type {boolean}
- */
- selector.isRegistrySelector = true;
- return selector;
- }
- /**
- * Creates a control function that takes additional curried argument with the `registry` object.
- * While a regular control has signature
- * ```js
- * ( action ) => ( iteratorOrPromise )
- * ```
- * where the control works with the `action` that it's bound to, a registry control has signature:
- * ```js
- * ( registry ) => ( action ) => ( iteratorOrPromise )
- * ```
- * A registry control is typically used to select data or dispatch an action to a registered
- * store.
- *
- * When registering a control created with `createRegistryControl` with a store, the store
- * knows which calling convention to use when executing the control.
- *
- * @param {Function} registryControl Function receiving a registry object and returning a control.
- *
- * @return {Function} Registry control that can be registered with a store.
- */
- function createRegistryControl(registryControl) {
- registryControl.isRegistryControl = true;
- return registryControl;
- }
- // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/controls.js
- /**
- * Internal dependencies
- */
- const SELECT = '@@data/SELECT';
- const RESOLVE_SELECT = '@@data/RESOLVE_SELECT';
- const DISPATCH = '@@data/DISPATCH';
- /**
- * Dispatches a control action for triggering a synchronous registry select.
- *
- * Note: This control synchronously returns the current selector value, triggering the
- * resolution, but not waiting for it.
- *
- * @param {string} storeKey The key for the store the selector belongs to.
- * @param {string} selectorName The name of the selector.
- * @param {Array} args Arguments for the selector.
- *
- * @example
- * ```js
- * import { controls } from '@wordpress/data';
- *
- * // Action generator using `select`.
- * export function* myAction() {
- * const isEditorSideBarOpened = yield controls.select( 'core/edit-post', 'isEditorSideBarOpened' );
- * // Do stuff with the result from the `select`.
- * }
- * ```
- *
- * @return {Object} The control descriptor.
- */
- function controls_select(storeKey, selectorName, ...args) {
- return {
- type: SELECT,
- storeKey,
- selectorName,
- args
- };
- }
- /**
- * Dispatches a control action for triggering and resolving a registry select.
- *
- * Note: when this control action is handled, it automatically considers
- * selectors that may have a resolver. In such case, it will return a `Promise` that resolves
- * after the selector finishes resolving, with the final result value.
- *
- * @param {string} storeKey The key for the store the selector belongs to
- * @param {string} selectorName The name of the selector
- * @param {Array} args Arguments for the selector.
- *
- * @example
- * ```js
- * import { controls } from '@wordpress/data';
- *
- * // Action generator using resolveSelect
- * export function* myAction() {
- * const isSidebarOpened = yield controls.resolveSelect( 'core/edit-post', 'isEditorSideBarOpened' );
- * // do stuff with the result from the select.
- * }
- * ```
- *
- * @return {Object} The control descriptor.
- */
- function controls_resolveSelect(storeKey, selectorName, ...args) {
- return {
- type: RESOLVE_SELECT,
- storeKey,
- selectorName,
- args
- };
- }
- /**
- * Dispatches a control action for triggering a registry dispatch.
- *
- * @param {string} storeKey The key for the store the action belongs to
- * @param {string} actionName The name of the action to dispatch
- * @param {Array} args Arguments for the dispatch action.
- *
- * @example
- * ```js
- * import { controls } from '@wordpress/data-controls';
- *
- * // Action generator using dispatch
- * export function* myAction() {
- * yield controls.dispatch( 'core/edit-post', 'togglePublishSidebar' );
- * // do some other things.
- * }
- * ```
- *
- * @return {Object} The control descriptor.
- */
- function controls_dispatch(storeKey, actionName, ...args) {
- return {
- type: DISPATCH,
- storeKey,
- actionName,
- args
- };
- }
- const controls_controls = {
- select: controls_select,
- resolveSelect: controls_resolveSelect,
- dispatch: controls_dispatch
- };
- const builtinControls = {
- [SELECT]: createRegistryControl(registry => ({
- storeKey,
- selectorName,
- args
- }) => registry.select(storeKey)[selectorName](...args)),
- [RESOLVE_SELECT]: createRegistryControl(registry => ({
- storeKey,
- selectorName,
- args
- }) => {
- const method = registry.select(storeKey)[selectorName].hasResolver ? 'resolveSelect' : 'select';
- return registry[method](storeKey)[selectorName](...args);
- }),
- [DISPATCH]: createRegistryControl(registry => ({
- storeKey,
- actionName,
- args
- }) => registry.dispatch(storeKey)[actionName](...args))
- };
- // EXTERNAL MODULE: ./node_modules/is-promise/index.js
- var is_promise = __webpack_require__("JlUD");
- var is_promise_default = /*#__PURE__*/__webpack_require__.n(is_promise);
- // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/promise-middleware.js
- /**
- * External dependencies
- */
- /**
- * Simplest possible promise redux middleware.
- *
- * @return {Function} middleware.
- */
- const promiseMiddleware = () => next => action => {
- if (is_promise_default()(action)) {
- return action.then(resolvedAction => {
- if (resolvedAction) {
- return next(resolvedAction);
- }
- });
- }
- return next(action);
- };
- /* harmony default export */ var promise_middleware = (promiseMiddleware);
- // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/resolvers-cache-middleware.js
- /**
- * External dependencies
- */
- /** @typedef {import('./registry').WPDataRegistry} WPDataRegistry */
- /**
- * Creates a middleware handling resolvers cache invalidation.
- *
- * @param {WPDataRegistry} registry The registry reference for which to create
- * the middleware.
- * @param {string} reducerKey The namespace for which to create the
- * middleware.
- *
- * @return {Function} Middleware function.
- */
- const createResolversCacheMiddleware = (registry, reducerKey) => () => next => action => {
- const resolvers = registry.select('core/data').getCachedResolvers(reducerKey);
- Object.entries(resolvers).forEach(([selectorName, resolversByArgs]) => {
- const resolver = Object(external_lodash_["get"])(registry.stores, [reducerKey, 'resolvers', selectorName]);
- if (!resolver || !resolver.shouldInvalidate) {
- return;
- }
- resolversByArgs.forEach((value, args) => {
- // resolversByArgs is the map Map([ args ] => boolean) storing the cache resolution status for a given selector.
- // If the value is false it means this resolver has finished its resolution which means we need to invalidate it,
- // if it's true it means it's inflight and the invalidation is not necessary.
- if (value !== false || !resolver.shouldInvalidate(action, ...args)) {
- return;
- } // Trigger cache invalidation
- registry.dispatch('core/data').invalidateResolution(reducerKey, selectorName, args);
- });
- });
- return next(action);
- };
- /* harmony default export */ var resolvers_cache_middleware = (createResolversCacheMiddleware);
- // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/redux-store/thunk-middleware.js
- function createThunkMiddleware(args) {
- return () => next => action => {
- if (typeof action === 'function') {
- return action(args);
- }
- return next(action);
- };
- }
- // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/redux-store/metadata/utils.js
- /**
- * Higher-order reducer creator which creates a combined reducer object, keyed
- * by a property on the action object.
- *
- * @param {string} actionProperty Action property by which to key object.
- *
- * @return {Function} Higher-order reducer.
- */
- const onSubKey = actionProperty => reducer => (state = {}, action) => {
- // Retrieve subkey from action. Do not track if undefined; useful for cases
- // where reducer is scoped by action shape.
- const key = action[actionProperty];
- if (key === undefined) {
- return state;
- } // Avoid updating state if unchanged. Note that this also accounts for a
- // reducer which returns undefined on a key which is not yet tracked.
- const nextKeyState = reducer(state[key], action);
- if (nextKeyState === state[key]) {
- return state;
- }
- return { ...state,
- [key]: nextKeyState
- };
- };
- // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/redux-store/metadata/reducer.js
- /**
- * External dependencies
- */
- /**
- * Internal dependencies
- */
- /**
- * Reducer function returning next state for selector resolution of
- * subkeys, object form:
- *
- * selectorName -> EquivalentKeyMap<Array,boolean>
- *
- * @param {Object} state Current state.
- * @param {Object} action Dispatched action.
- *
- * @return {Object} Next state.
- */
- const subKeysIsResolved = onSubKey('selectorName')((state = new equivalent_key_map_default.a(), action) => {
- switch (action.type) {
- case 'START_RESOLUTION':
- case 'FINISH_RESOLUTION':
- {
- const isStarting = action.type === 'START_RESOLUTION';
- const nextState = new equivalent_key_map_default.a(state);
- nextState.set(action.args, isStarting);
- return nextState;
- }
- case 'START_RESOLUTIONS':
- case 'FINISH_RESOLUTIONS':
- {
- const isStarting = action.type === 'START_RESOLUTIONS';
- const nextState = new equivalent_key_map_default.a(state);
- for (const resolutionArgs of action.args) {
- nextState.set(resolutionArgs, isStarting);
- }
- return nextState;
- }
- case 'INVALIDATE_RESOLUTION':
- {
- const nextState = new equivalent_key_map_default.a(state);
- nextState.delete(action.args);
- return nextState;
- }
- }
- return state;
- });
- /**
- * Reducer function returning next state for selector resolution, object form:
- *
- * selectorName -> EquivalentKeyMap<Array, boolean>
- *
- * @param {Object} state Current state.
- * @param {Object} action Dispatched action.
- *
- * @return {Object} Next state.
- */
- const isResolved = (state = {}, action) => {
- switch (action.type) {
- case 'INVALIDATE_RESOLUTION_FOR_STORE':
- return {};
- case 'INVALIDATE_RESOLUTION_FOR_STORE_SELECTOR':
- return Object(external_lodash_["has"])(state, [action.selectorName]) ? Object(external_lodash_["omit"])(state, [action.selectorName]) : state;
- case 'START_RESOLUTION':
- case 'FINISH_RESOLUTION':
- case 'START_RESOLUTIONS':
- case 'FINISH_RESOLUTIONS':
- case 'INVALIDATE_RESOLUTION':
- return subKeysIsResolved(state, action);
- }
- return state;
- };
- /* harmony default export */ var metadata_reducer = (isResolved);
- // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/redux-store/metadata/selectors.js
- /**
- * External dependencies
- */
- /**
- * Returns the raw `isResolving` value for a given selector name,
- * and arguments set. May be undefined if the selector has never been resolved
- * or not resolved for the given set of arguments, otherwise true or false for
- * resolution started and completed respectively.
- *
- * @param {Object} state Data state.
- * @param {string} selectorName Selector name.
- * @param {Array} args Arguments passed to selector.
- *
- * @return {?boolean} isResolving value.
- */
- function getIsResolving(state, selectorName, args) {
- const map = Object(external_lodash_["get"])(state, [selectorName]);
- if (!map) {
- return;
- }
- return map.get(args);
- }
- /**
- * Returns true if resolution has already been triggered for a given
- * selector name, and arguments set.
- *
- * @param {Object} state Data state.
- * @param {string} selectorName Selector name.
- * @param {?Array} args Arguments passed to selector (default `[]`).
- *
- * @return {boolean} Whether resolution has been triggered.
- */
- function hasStartedResolution(state, selectorName, args = []) {
- return getIsResolving(state, selectorName, args) !== undefined;
- }
- /**
- * Returns true if resolution has completed for a given selector
- * name, and arguments set.
- *
- * @param {Object} state Data state.
- * @param {string} selectorName Selector name.
- * @param {?Array} args Arguments passed to selector.
- *
- * @return {boolean} Whether resolution has completed.
- */
- function hasFinishedResolution(state, selectorName, args = []) {
- return getIsResolving(state, selectorName, args) === false;
- }
- /**
- * Returns true if resolution has been triggered but has not yet completed for
- * a given selector name, and arguments set.
- *
- * @param {Object} state Data state.
- * @param {string} selectorName Selector name.
- * @param {?Array} args Arguments passed to selector.
- *
- * @return {boolean} Whether resolution is in progress.
- */
- function isResolving(state, selectorName, args = []) {
- return getIsResolving(state, selectorName, args) === true;
- }
- /**
- * Returns the list of the cached resolvers.
- *
- * @param {Object} state Data state.
- *
- * @return {Object} Resolvers mapped by args and selectorName.
- */
- function getCachedResolvers(state) {
- return state;
- }
- // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/redux-store/metadata/actions.js
- /**
- * Returns an action object used in signalling that selector resolution has
- * started.
- *
- * @param {string} selectorName Name of selector for which resolver triggered.
- * @param {...*} args Arguments to associate for uniqueness.
- *
- * @return {Object} Action object.
- */
- function startResolution(selectorName, args) {
- return {
- type: 'START_RESOLUTION',
- selectorName,
- args
- };
- }
- /**
- * Returns an action object used in signalling that selector resolution has
- * completed.
- *
- * @param {string} selectorName Name of selector for which resolver triggered.
- * @param {...*} args Arguments to associate for uniqueness.
- *
- * @return {Object} Action object.
- */
- function finishResolution(selectorName, args) {
- return {
- type: 'FINISH_RESOLUTION',
- selectorName,
- args
- };
- }
- /**
- * Returns an action object used in signalling that a batch of selector resolutions has
- * started.
- *
- * @param {string} selectorName Name of selector for which resolver triggered.
- * @param {...*} args Array of arguments to associate for uniqueness, each item
- * is associated to a resolution.
- *
- * @return {Object} Action object.
- */
- function startResolutions(selectorName, args) {
- return {
- type: 'START_RESOLUTIONS',
- selectorName,
- args
- };
- }
- /**
- * Returns an action object used in signalling that a batch of selector resolutions has
- * completed.
- *
- * @param {string} selectorName Name of selector for which resolver triggered.
- * @param {...*} args Array of arguments to associate for uniqueness, each item
- * is associated to a resolution.
- *
- * @return {Object} Action object.
- */
- function finishResolutions(selectorName, args) {
- return {
- type: 'FINISH_RESOLUTIONS',
- selectorName,
- args
- };
- }
- /**
- * Returns an action object used in signalling that we should invalidate the resolution cache.
- *
- * @param {string} selectorName Name of selector for which resolver should be invalidated.
- * @param {Array} args Arguments to associate for uniqueness.
- *
- * @return {Object} Action object.
- */
- function invalidateResolution(selectorName, args) {
- return {
- type: 'INVALIDATE_RESOLUTION',
- selectorName,
- args
- };
- }
- /**
- * Returns an action object used in signalling that the resolution
- * should be invalidated.
- *
- * @return {Object} Action object.
- */
- function invalidateResolutionForStore() {
- return {
- type: 'INVALIDATE_RESOLUTION_FOR_STORE'
- };
- }
- /**
- * Returns an action object used in signalling that the resolution cache for a
- * given selectorName should be invalidated.
- *
- * @param {string} selectorName Name of selector for which all resolvers should
- * be invalidated.
- *
- * @return {Object} Action object.
- */
- function invalidateResolutionForStoreSelector(selectorName) {
- return {
- type: 'INVALIDATE_RESOLUTION_FOR_STORE_SELECTOR',
- selectorName
- };
- }
- // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/redux-store/index.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- /** @typedef {import('../types').WPDataRegistry} WPDataRegistry */
- /** @typedef {import('../types').WPDataStore} WPDataStore */
- /** @typedef {import('../types').WPDataReduxStoreConfig} WPDataReduxStoreConfig */
- /**
- * Create a cache to track whether resolvers started running or not.
- *
- * @return {Object} Resolvers Cache.
- */
- function createResolversCache() {
- const cache = {};
- return {
- isRunning(selectorName, args) {
- return cache[selectorName] && cache[selectorName].get(args);
- },
- clear(selectorName, args) {
- if (cache[selectorName]) {
- cache[selectorName].delete(args);
- }
- },
- markAsRunning(selectorName, args) {
- if (!cache[selectorName]) {
- cache[selectorName] = new equivalent_key_map_default.a();
- }
- cache[selectorName].set(args, true);
- }
- };
- }
- /**
- * Creates a data store definition for the provided Redux store options containing
- * properties describing reducer, actions, selectors, controls and resolvers.
- *
- * @example
- * ```js
- * import { createReduxStore } from '@wordpress/data';
- *
- * const store = createReduxStore( 'demo', {
- * reducer: ( state = 'OK' ) => state,
- * selectors: {
- * getValue: ( state ) => state,
- * },
- * } );
- * ```
- *
- * @param {string} key Unique namespace identifier.
- * @param {WPDataReduxStoreConfig} options Registered store options, with properties
- * describing reducer, actions, selectors,
- * and resolvers.
- *
- * @return {WPDataStore} Store Object.
- */
- function createReduxStore(key, options) {
- return {
- name: key,
- instantiate: registry => {
- const reducer = options.reducer;
- const thunkArgs = {
- registry,
- get dispatch() {
- return Object.assign(action => store.dispatch(action), getActions());
- },
- get select() {
- return Object.assign(selector => selector(store.__unstableOriginalGetState()), getSelectors());
- },
- get resolveSelect() {
- return getResolveSelectors();
- }
- };
- const store = instantiateReduxStore(key, options, registry, thunkArgs);
- const resolversCache = createResolversCache();
- let resolvers;
- const actions = mapActions({ ...actions_namespaceObject,
- ...options.actions
- }, store);
- let selectors = mapSelectors({ ...Object(external_lodash_["mapValues"])(selectors_namespaceObject, selector => (state, ...args) => selector(state.metadata, ...args)),
- ...Object(external_lodash_["mapValues"])(options.selectors, selector => {
- if (selector.isRegistrySelector) {
- selector.registry = registry;
- }
- return (state, ...args) => selector(state.root, ...args);
- })
- }, store);
- if (options.resolvers) {
- const result = mapResolvers(options.resolvers, selectors, store, resolversCache);
- resolvers = result.resolvers;
- selectors = result.selectors;
- }
- const resolveSelectors = mapResolveSelectors(selectors, store);
- const getSelectors = () => selectors;
- const getActions = () => actions;
- const getResolveSelectors = () => resolveSelectors; // We have some modules monkey-patching the store object
- // It's wrong to do so but until we refactor all of our effects to controls
- // We need to keep the same "store" instance here.
- store.__unstableOriginalGetState = store.getState;
- store.getState = () => store.__unstableOriginalGetState().root; // Customize subscribe behavior to call listeners only on effective change,
- // not on every dispatch.
- const subscribe = store && (listener => {
- let lastState = store.__unstableOriginalGetState();
- return store.subscribe(() => {
- const state = store.__unstableOriginalGetState();
- const hasChanged = state !== lastState;
- lastState = state;
- if (hasChanged) {
- listener();
- }
- });
- }); // This can be simplified to just { subscribe, getSelectors, getActions }
- // Once we remove the use function.
- return {
- reducer,
- store,
- actions,
- selectors,
- resolvers,
- getSelectors,
- getResolveSelectors,
- getActions,
- subscribe
- };
- }
- };
- }
- /**
- * Creates a redux store for a namespace.
- *
- * @param {string} key Unique namespace identifier.
- * @param {Object} options Registered store options, with properties
- * describing reducer, actions, selectors,
- * and resolvers.
- * @param {WPDataRegistry} registry Registry reference.
- * @param {Object} thunkArgs Argument object for the thunk middleware.
- * @return {Object} Newly created redux store.
- */
- function instantiateReduxStore(key, options, registry, thunkArgs) {
- const controls = { ...options.controls,
- ...builtinControls
- };
- const normalizedControls = Object(external_lodash_["mapValues"])(controls, control => control.isRegistryControl ? control(registry) : control);
- const middlewares = [resolvers_cache_middleware(registry, key), promise_middleware, external_wp_reduxRoutine_default()(normalizedControls)];
- if (options.__experimentalUseThunks) {
- middlewares.push(createThunkMiddleware(thunkArgs));
- }
- const enhancers = [applyMiddleware(...middlewares)];
- if (typeof window !== 'undefined' && window.__REDUX_DEVTOOLS_EXTENSION__) {
- enhancers.push(window.__REDUX_DEVTOOLS_EXTENSION__({
- name: key,
- instanceId: key
- }));
- }
- const {
- reducer,
- initialState
- } = options;
- const enhancedReducer = turbo_combine_reducers_default()({
- metadata: metadata_reducer,
- root: reducer
- });
- return redux_createStore(enhancedReducer, {
- root: initialState
- }, Object(external_lodash_["flowRight"])(enhancers));
- }
- /**
- * Maps selectors to a store.
- *
- * @param {Object} selectors Selectors to register. Keys will be used as the
- * public facing API. Selectors will get passed the
- * state as first argument.
- * @param {Object} store The store to which the selectors should be mapped.
- * @return {Object} Selectors mapped to the provided store.
- */
- function mapSelectors(selectors, store) {
- const createStateSelector = registrySelector => {
- const selector = function runSelector() {
- // This function is an optimized implementation of:
- //
- // selector( store.getState(), ...arguments )
- //
- // Where the above would incur an `Array#concat` in its application,
- // the logic here instead efficiently constructs an arguments array via
- // direct assignment.
- const argsLength = arguments.length;
- const args = new Array(argsLength + 1);
- args[0] = store.__unstableOriginalGetState();
- for (let i = 0; i < argsLength; i++) {
- args[i + 1] = arguments[i];
- }
- return registrySelector(...args);
- };
- selector.hasResolver = false;
- return selector;
- };
- return Object(external_lodash_["mapValues"])(selectors, createStateSelector);
- }
- /**
- * Maps actions to dispatch from a given store.
- *
- * @param {Object} actions Actions to register.
- * @param {Object} store The redux store to which the actions should be mapped.
- * @return {Object} Actions mapped to the redux store provided.
- */
- function mapActions(actions, store) {
- const createBoundAction = action => (...args) => {
- return Promise.resolve(store.dispatch(action(...args)));
- };
- return Object(external_lodash_["mapValues"])(actions, createBoundAction);
- }
- /**
- * Maps selectors to functions that return a resolution promise for them
- *
- * @param {Object} selectors Selectors to map.
- * @param {Object} store The redux store the selectors select from.
- * @return {Object} Selectors mapped to their resolution functions.
- */
- function mapResolveSelectors(selectors, store) {
- return Object(external_lodash_["mapValues"])(Object(external_lodash_["omit"])(selectors, ['getIsResolving', 'hasStartedResolution', 'hasFinishedResolution', 'isResolving', 'getCachedResolvers']), (selector, selectorName) => (...args) => new Promise(resolve => {
- const hasFinished = () => selectors.hasFinishedResolution(selectorName, args);
- const getResult = () => selector.apply(null, args); // trigger the selector (to trigger the resolver)
- const result = getResult();
- if (hasFinished()) {
- return resolve(result);
- }
- const unsubscribe = store.subscribe(() => {
- if (hasFinished()) {
- unsubscribe();
- resolve(getResult());
- }
- });
- }));
- }
- /**
- * Returns resolvers with matched selectors for a given namespace.
- * Resolvers are side effects invoked once per argument set of a given selector call,
- * used in ensuring that the data needs for the selector are satisfied.
- *
- * @param {Object} resolvers Resolvers to register.
- * @param {Object} selectors The current selectors to be modified.
- * @param {Object} store The redux store to which the resolvers should be mapped.
- * @param {Object} resolversCache Resolvers Cache.
- */
- function mapResolvers(resolvers, selectors, store, resolversCache) {
- // The `resolver` can be either a function that does the resolution, or, in more advanced
- // cases, an object with a `fullfill` method and other optional methods like `isFulfilled`.
- // Here we normalize the `resolver` function to an object with `fulfill` method.
- const mappedResolvers = Object(external_lodash_["mapValues"])(resolvers, resolver => {
- if (resolver.fulfill) {
- return resolver;
- }
- return { ...resolver,
- // copy the enumerable properties of the resolver function
- fulfill: resolver // add the fulfill method
- };
- });
- const mapSelector = (selector, selectorName) => {
- const resolver = resolvers[selectorName];
- if (!resolver) {
- selector.hasResolver = false;
- return selector;
- }
- const selectorResolver = (...args) => {
- async function fulfillSelector() {
- const state = store.getState();
- if (resolversCache.isRunning(selectorName, args) || typeof resolver.isFulfilled === 'function' && resolver.isFulfilled(state, ...args)) {
- return;
- }
- const {
- metadata
- } = store.__unstableOriginalGetState();
- if (hasStartedResolution(metadata, selectorName, args)) {
- return;
- }
- resolversCache.markAsRunning(selectorName, args);
- setTimeout(async () => {
- resolversCache.clear(selectorName, args);
- store.dispatch(startResolution(selectorName, args));
- await fulfillResolver(store, mappedResolvers, selectorName, ...args);
- store.dispatch(finishResolution(selectorName, args));
- });
- }
- fulfillSelector(...args);
- return selector(...args);
- };
- selectorResolver.hasResolver = true;
- return selectorResolver;
- };
- return {
- resolvers: mappedResolvers,
- selectors: Object(external_lodash_["mapValues"])(selectors, mapSelector)
- };
- }
- /**
- * Calls a resolver given arguments
- *
- * @param {Object} store Store reference, for fulfilling via resolvers
- * @param {Object} resolvers Store Resolvers
- * @param {string} selectorName Selector name to fulfill.
- * @param {Array} args Selector Arguments.
- */
- async function fulfillResolver(store, resolvers, selectorName, ...args) {
- const resolver = Object(external_lodash_["get"])(resolvers, [selectorName]);
- if (!resolver) {
- return;
- }
- const action = resolver.fulfill(...args);
- if (action) {
- await store.dispatch(action);
- }
- }
- // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/store/index.js
- function createCoreDataStore(registry) {
- const getCoreDataSelector = selectorName => (key, ...args) => {
- return registry.select(key)[selectorName](...args);
- };
- const getCoreDataAction = actionName => (key, ...args) => {
- return registry.dispatch(key)[actionName](...args);
- };
- return {
- getSelectors() {
- return ['getIsResolving', 'hasStartedResolution', 'hasFinishedResolution', 'isResolving', 'getCachedResolvers'].reduce((memo, selectorName) => ({ ...memo,
- [selectorName]: getCoreDataSelector(selectorName)
- }), {});
- },
- getActions() {
- return ['startResolution', 'finishResolution', 'invalidateResolution', 'invalidateResolutionForStore', 'invalidateResolutionForStoreSelector'].reduce((memo, actionName) => ({ ...memo,
- [actionName]: getCoreDataAction(actionName)
- }), {});
- },
- subscribe() {
- // There's no reasons to trigger any listener when we subscribe to this store
- // because there's no state stored in this store that need to retrigger selectors
- // if a change happens, the corresponding store where the tracking stated live
- // would have already triggered a "subscribe" call.
- return () => {};
- }
- };
- }
- /* harmony default export */ var build_module_store = (createCoreDataStore);
- // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/registry.js
- /**
- * External dependencies
- */
- /**
- * Internal dependencies
- */
- /** @typedef {import('./types').WPDataStore} WPDataStore */
- /**
- * @typedef {Object} WPDataRegistry An isolated orchestrator of store registrations.
- *
- * @property {Function} registerGenericStore Given a namespace key and settings
- * object, registers a new generic
- * store.
- * @property {Function} registerStore Given a namespace key and settings
- * object, registers a new namespace
- * store.
- * @property {Function} subscribe Given a function callback, invokes
- * the callback on any change to state
- * within any registered store.
- * @property {Function} select Given a namespace key, returns an
- * object of the store's registered
- * selectors.
- * @property {Function} dispatch Given a namespace key, returns an
- * object of the store's registered
- * action dispatchers.
- */
- /**
- * @typedef {Object} WPDataPlugin An object of registry function overrides.
- *
- * @property {Function} registerStore registers store.
- */
- /**
- * Creates a new store registry, given an optional object of initial store
- * configurations.
- *
- * @param {Object} storeConfigs Initial store configurations.
- * @param {Object?} parent Parent registry.
- *
- * @return {WPDataRegistry} Data registry.
- */
- function createRegistry(storeConfigs = {}, parent = null) {
- const stores = {};
- let listeners = [];
- const __experimentalListeningStores = new Set();
- /**
- * Global listener called for each store's update.
- */
- function globalListener() {
- listeners.forEach(listener => listener());
- }
- /**
- * Subscribe to changes to any data.
- *
- * @param {Function} listener Listener function.
- *
- * @return {Function} Unsubscribe function.
- */
- const subscribe = listener => {
- listeners.push(listener);
- return () => {
- listeners = Object(external_lodash_["without"])(listeners, listener);
- };
- };
- /**
- * Calls a selector given the current state and extra arguments.
- *
- * @param {string|WPDataStore} storeNameOrDefinition Unique namespace identifier for the store
- * or the store definition.
- *
- * @return {*} The selector's returned value.
- */
- function select(storeNameOrDefinition) {
- const storeName = Object(external_lodash_["isObject"])(storeNameOrDefinition) ? storeNameOrDefinition.name : storeNameOrDefinition;
- __experimentalListeningStores.add(storeName);
- const store = stores[storeName];
- if (store) {
- return store.getSelectors();
- }
- return parent && parent.select(storeName);
- }
- function __experimentalMarkListeningStores(callback, ref) {
- __experimentalListeningStores.clear();
- const result = callback.call(this);
- ref.current = Array.from(__experimentalListeningStores);
- return result;
- }
- /**
- * Given the name of a registered store, returns an object containing the store's
- * selectors pre-bound to state so that you only need to supply additional arguments,
- * and modified so that they return promises that resolve to their eventual values,
- * after any resolvers have ran.
- *
- * @param {string|WPDataStore} storeNameOrDefinition Unique namespace identifier for the store
- * or the store definition.
- *
- * @return {Object} Each key of the object matches the name of a selector.
- */
- function resolveSelect(storeNameOrDefinition) {
- const storeName = Object(external_lodash_["isObject"])(storeNameOrDefinition) ? storeNameOrDefinition.name : storeNameOrDefinition;
- __experimentalListeningStores.add(storeName);
- const store = stores[storeName];
- if (store) {
- return store.getResolveSelectors();
- }
- return parent && parent.resolveSelect(storeName);
- }
- /**
- * Returns the available actions for a part of the state.
- *
- * @param {string|WPDataStore} storeNameOrDefinition Unique namespace identifier for the store
- * or the store definition.
- *
- * @return {*} The action's returned value.
- */
- function dispatch(storeNameOrDefinition) {
- const storeName = Object(external_lodash_["isObject"])(storeNameOrDefinition) ? storeNameOrDefinition.name : storeNameOrDefinition;
- const store = stores[storeName];
- if (store) {
- return store.getActions();
- }
- return parent && parent.dispatch(storeName);
- } //
- // Deprecated
- // TODO: Remove this after `use()` is removed.
- //
- function withPlugins(attributes) {
- return Object(external_lodash_["mapValues"])(attributes, (attribute, key) => {
- if (typeof attribute !== 'function') {
- return attribute;
- }
- return function () {
- return registry[key].apply(null, arguments);
- };
- });
- }
- /**
- * Registers a generic store.
- *
- * @param {string} key Store registry key.
- * @param {Object} config Configuration (getSelectors, getActions, subscribe).
- */
- function registerGenericStore(key, config) {
- if (typeof config.getSelectors !== 'function') {
- throw new TypeError('config.getSelectors must be a function');
- }
- if (typeof config.getActions !== 'function') {
- throw new TypeError('config.getActions must be a function');
- }
- if (typeof config.subscribe !== 'function') {
- throw new TypeError('config.subscribe must be a function');
- }
- stores[key] = config;
- config.subscribe(globalListener);
- }
- /**
- * Registers a new store definition.
- *
- * @param {WPDataStore} store Store definition.
- */
- function register(store) {
- registerGenericStore(store.name, store.instantiate(registry));
- }
- /**
- * Subscribe handler to a store.
- *
- * @param {string[]} storeName The store name.
- * @param {Function} handler The function subscribed to the store.
- * @return {Function} A function to unsubscribe the handler.
- */
- function __experimentalSubscribeStore(storeName, handler) {
- if (storeName in stores) {
- return stores[storeName].subscribe(handler);
- } // Trying to access a store that hasn't been registered,
- // this is a pattern rarely used but seen in some places.
- // We fallback to regular `subscribe` here for backward-compatibility for now.
- // See https://github.com/WordPress/gutenberg/pull/27466 for more info.
- if (!parent) {
- return subscribe(handler);
- }
- return parent.__experimentalSubscribeStore(storeName, handler);
- }
- let registry = {
- registerGenericStore,
- stores,
- namespaces: stores,
- // TODO: Deprecate/remove this.
- subscribe,
- select,
- resolveSelect,
- dispatch,
- use,
- register,
- __experimentalMarkListeningStores,
- __experimentalSubscribeStore
- };
- /**
- * Registers a standard `@wordpress/data` store.
- *
- * @param {string} storeName Unique namespace identifier.
- * @param {Object} options Store description (reducer, actions, selectors, resolvers).
- *
- * @return {Object} Registered store object.
- */
- registry.registerStore = (storeName, options) => {
- if (!options.reducer) {
- throw new TypeError('Must specify store reducer');
- }
- const store = createReduxStore(storeName, options).instantiate(registry);
- registerGenericStore(storeName, store);
- return store.store;
- }; //
- // TODO:
- // This function will be deprecated as soon as it is no longer internally referenced.
- //
- function use(plugin, options) {
- registry = { ...registry,
- ...plugin(registry, options)
- };
- return registry;
- }
- registerGenericStore('core/data', build_module_store(registry));
- Object.entries(storeConfigs).forEach(([name, config]) => registry.registerStore(name, config));
- if (parent) {
- parent.subscribe(globalListener);
- }
- return withPlugins(registry);
- }
- // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/default-registry.js
- /**
- * Internal dependencies
- */
- /* harmony default export */ var default_registry = (createRegistry());
- // EXTERNAL MODULE: external ["wp","deprecated"]
- var external_wp_deprecated_ = __webpack_require__("NMb1");
- var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_);
- // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/plugins/controls/index.js
- /**
- * WordPress dependencies
- */
- /* harmony default export */ var plugins_controls = (registry => {
- external_wp_deprecated_default()('wp.data.plugins.controls', {
- since: '5.4',
- hint: 'The controls plugins is now baked-in.'
- });
- return registry;
- });
- // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/plugins/persistence/storage/object.js
- let objectStorage;
- const storage = {
- getItem(key) {
- if (!objectStorage || !objectStorage[key]) {
- return null;
- }
- return objectStorage[key];
- },
- setItem(key, value) {
- if (!objectStorage) {
- storage.clear();
- }
- objectStorage[key] = String(value);
- },
- clear() {
- objectStorage = Object.create(null);
- }
- };
- /* harmony default export */ var object = (storage);
- // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/plugins/persistence/storage/default.js
- /**
- * Internal dependencies
- */
- let default_storage;
- try {
- // Private Browsing in Safari 10 and earlier will throw an error when
- // attempting to set into localStorage. The test here is intentional in
- // causing a thrown error as condition for using fallback object storage.
- default_storage = window.localStorage;
- default_storage.setItem('__wpDataTestLocalStorage', '');
- default_storage.removeItem('__wpDataTestLocalStorage');
- } catch (error) {
- default_storage = object;
- }
- /* harmony default export */ var storage_default = (default_storage);
- // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/plugins/persistence/index.js
- /**
- * External dependencies
- */
- /**
- * Internal dependencies
- */
- /** @typedef {import('../../registry').WPDataRegistry} WPDataRegistry */
- /** @typedef {import('../../registry').WPDataPlugin} WPDataPlugin */
- /**
- * @typedef {Object} WPDataPersistencePluginOptions Persistence plugin options.
- *
- * @property {Storage} storage Persistent storage implementation. This must
- * at least implement `getItem` and `setItem` of
- * the Web Storage API.
- * @property {string} storageKey Key on which to set in persistent storage.
- *
- */
- /**
- * Default plugin storage.
- *
- * @type {Storage}
- */
- const DEFAULT_STORAGE = storage_default;
- /**
- * Default plugin storage key.
- *
- * @type {string}
- */
- const DEFAULT_STORAGE_KEY = 'WP_DATA';
- /**
- * Higher-order reducer which invokes the original reducer only if state is
- * inequal from that of the action's `nextState` property, otherwise returning
- * the original state reference.
- *
- * @param {Function} reducer Original reducer.
- *
- * @return {Function} Enhanced reducer.
- */
- const withLazySameState = reducer => (state, action) => {
- if (action.nextState === state) {
- return state;
- }
- return reducer(state, action);
- };
- /**
- * Creates a persistence interface, exposing getter and setter methods (`get`
- * and `set` respectively).
- *
- * @param {WPDataPersistencePluginOptions} options Plugin options.
- *
- * @return {Object} Persistence interface.
- */
- function createPersistenceInterface(options) {
- const {
- storage = DEFAULT_STORAGE,
- storageKey = DEFAULT_STORAGE_KEY
- } = options;
- let data;
- /**
- * Returns the persisted data as an object, defaulting to an empty object.
- *
- * @return {Object} Persisted data.
- */
- function getData() {
- if (data === undefined) {
- // If unset, getItem is expected to return null. Fall back to
- // empty object.
- const persisted = storage.getItem(storageKey);
- if (persisted === null) {
- data = {};
- } else {
- try {
- data = JSON.parse(persisted);
- } catch (error) {
- // Similarly, should any error be thrown during parse of
- // the string (malformed JSON), fall back to empty object.
- data = {};
- }
- }
- }
- return data;
- }
- /**
- * Merges an updated reducer state into the persisted data.
- *
- * @param {string} key Key to update.
- * @param {*} value Updated value.
- */
- function setData(key, value) {
- data = { ...data,
- [key]: value
- };
- storage.setItem(storageKey, JSON.stringify(data));
- }
- return {
- get: getData,
- set: setData
- };
- }
- /**
- * Data plugin to persist store state into a single storage key.
- *
- * @param {WPDataRegistry} registry Data registry.
- * @param {?WPDataPersistencePluginOptions} pluginOptions Plugin options.
- *
- * @return {WPDataPlugin} Data plugin.
- */
- function persistencePlugin(registry, pluginOptions) {
- const persistence = createPersistenceInterface(pluginOptions);
- /**
- * Creates an enhanced store dispatch function, triggering the state of the
- * given store name to be persisted when changed.
- *
- * @param {Function} getState Function which returns current state.
- * @param {string} storeName Store name.
- * @param {?Array<string>} keys Optional subset of keys to save.
- *
- * @return {Function} Enhanced dispatch function.
- */
- function createPersistOnChange(getState, storeName, keys) {
- let getPersistedState;
- if (Array.isArray(keys)) {
- // Given keys, the persisted state should by produced as an object
- // of the subset of keys. This implementation uses combineReducers
- // to leverage its behavior of returning the same object when none
- // of the property values changes. This allows a strict reference
- // equality to bypass a persistence set on an unchanging state.
- const reducers = keys.reduce((accumulator, key) => Object.assign(accumulator, {
- [key]: (state, action) => action.nextState[key]
- }), {});
- getPersistedState = withLazySameState(turbo_combine_reducers_default()(reducers));
- } else {
- getPersistedState = (state, action) => action.nextState;
- }
- let lastState = getPersistedState(undefined, {
- nextState: getState()
- });
- return () => {
- const state = getPersistedState(lastState, {
- nextState: getState()
- });
- if (state !== lastState) {
- persistence.set(storeName, state);
- lastState = state;
- }
- };
- }
- return {
- registerStore(storeName, options) {
- if (!options.persist) {
- return registry.registerStore(storeName, options);
- } // Load from persistence to use as initial state.
- const persistedState = persistence.get()[storeName];
- if (persistedState !== undefined) {
- let initialState = options.reducer(options.initialState, {
- type: '@@WP/PERSISTENCE_RESTORE'
- });
- if (Object(external_lodash_["isPlainObject"])(initialState) && Object(external_lodash_["isPlainObject"])(persistedState)) {
- // If state is an object, ensure that:
- // - Other keys are left intact when persisting only a
- // subset of keys.
- // - New keys in what would otherwise be used as initial
- // state are deeply merged as base for persisted value.
- initialState = Object(external_lodash_["merge"])({}, initialState, persistedState);
- } else {
- // If there is a mismatch in object-likeness of default
- // initial or persisted state, defer to persisted value.
- initialState = persistedState;
- }
- options = { ...options,
- initialState
- };
- }
- const store = registry.registerStore(storeName, options);
- store.subscribe(createPersistOnChange(store.getState, storeName, options.persist));
- return store;
- }
- };
- }
- /**
- * Deprecated: Remove this function and the code in WordPress Core that calls
- * it once WordPress 5.4 is released.
- */
- persistencePlugin.__unstableMigrate = pluginOptions => {
- var _state$coreEditor, _state$coreEditor$pre;
- const persistence = createPersistenceInterface(pluginOptions);
- const state = persistence.get(); // Migrate 'insertUsage' from 'core/editor' to 'core/block-editor'
- const editorInsertUsage = (_state$coreEditor = state['core/editor']) === null || _state$coreEditor === void 0 ? void 0 : (_state$coreEditor$pre = _state$coreEditor.preferences) === null || _state$coreEditor$pre === void 0 ? void 0 : _state$coreEditor$pre.insertUsage;
- if (editorInsertUsage) {
- var _state$coreBlockEdi, _state$coreBlockEdi$p;
- const blockEditorInsertUsage = (_state$coreBlockEdi = state['core/block-editor']) === null || _state$coreBlockEdi === void 0 ? void 0 : (_state$coreBlockEdi$p = _state$coreBlockEdi.preferences) === null || _state$coreBlockEdi$p === void 0 ? void 0 : _state$coreBlockEdi$p.insertUsage;
- persistence.set('core/block-editor', {
- preferences: {
- insertUsage: { ...editorInsertUsage,
- ...blockEditorInsertUsage
- }
- }
- });
- }
- let editPostState = state['core/edit-post']; // Default `fullscreenMode` to `false` if any persisted state had existed
- // and the user hadn't made an explicit choice about fullscreen mode. This
- // is needed since `fullscreenMode` previously did not have a default value
- // and was implicitly false by its absence. It is now `true` by default, but
- // this change is not intended to affect upgrades from earlier versions.
- const hadPersistedState = Object.keys(state).length > 0;
- const hadFullscreenModePreference = Object(external_lodash_["has"])(state, ['core/edit-post', 'preferences', 'features', 'fullscreenMode']);
- if (hadPersistedState && !hadFullscreenModePreference) {
- editPostState = Object(external_lodash_["merge"])({}, editPostState, {
- preferences: {
- features: {
- fullscreenMode: false
- }
- }
- });
- } // Migrate 'areTipsEnabled' from 'core/nux' to 'showWelcomeGuide' in 'core/edit-post'
- const areTipsEnabled = Object(external_lodash_["get"])(state, ['core/nux', 'preferences', 'areTipsEnabled']);
- const hasWelcomeGuide = Object(external_lodash_["has"])(state, ['core/edit-post', 'preferences', 'features', 'welcomeGuide']);
- if (areTipsEnabled !== undefined && !hasWelcomeGuide) {
- editPostState = Object(external_lodash_["merge"])({}, editPostState, {
- preferences: {
- features: {
- welcomeGuide: areTipsEnabled
- }
- }
- });
- }
- if (editPostState !== state['core/edit-post']) {
- persistence.set('core/edit-post', editPostState);
- }
- };
- /* harmony default export */ var plugins_persistence = (persistencePlugin);
- // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/plugins/index.js
- // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js
- var esm_extends = __webpack_require__("wx14");
- // EXTERNAL MODULE: external ["wp","element"]
- var external_wp_element_ = __webpack_require__("GRId");
- // EXTERNAL MODULE: external ["wp","compose"]
- var external_wp_compose_ = __webpack_require__("K9lf");
- // EXTERNAL MODULE: ./node_modules/use-memo-one/dist/use-memo-one.esm.js
- var use_memo_one_esm = __webpack_require__("mHlH");
- // EXTERNAL MODULE: external ["wp","priorityQueue"]
- var external_wp_priorityQueue_ = __webpack_require__("XI5e");
- // EXTERNAL MODULE: external ["wp","isShallowEqual"]
- var external_wp_isShallowEqual_ = __webpack_require__("rl8x");
- var external_wp_isShallowEqual_default = /*#__PURE__*/__webpack_require__.n(external_wp_isShallowEqual_);
- // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/components/registry-provider/context.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- const Context = Object(external_wp_element_["createContext"])(default_registry);
- const {
- Consumer,
- Provider
- } = Context;
- /**
- * A custom react Context consumer exposing the provided `registry` to
- * children components. Used along with the RegistryProvider.
- *
- * You can read more about the react context api here:
- * https://reactjs.org/docs/context.html#contextprovider
- *
- * @example
- * ```js
- * import {
- * RegistryProvider,
- * RegistryConsumer,
- * createRegistry
- * } from '@wordpress/data';
- *
- * const registry = createRegistry( {} );
- *
- * const App = ( { props } ) => {
- * return <RegistryProvider value={ registry }>
- * <div>Hello There</div>
- * <RegistryConsumer>
- * { ( registry ) => (
- * <ComponentUsingRegistry
- * { ...props }
- * registry={ registry }
- * ) }
- * </RegistryConsumer>
- * </RegistryProvider>
- * }
- * ```
- */
- const RegistryConsumer = Consumer;
- /**
- * A custom Context provider for exposing the provided `registry` to children
- * components via a consumer.
- *
- * See <a name="#RegistryConsumer">RegistryConsumer</a> documentation for
- * example.
- */
- /* harmony default export */ var context = (Provider);
- // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/components/registry-provider/use-registry.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- /**
- * A custom react hook exposing the registry context for use.
- *
- * This exposes the `registry` value provided via the
- * <a href="#RegistryProvider">Registry Provider</a> to a component implementing
- * this hook.
- *
- * It acts similarly to the `useContext` react hook.
- *
- * Note: Generally speaking, `useRegistry` is a low level hook that in most cases
- * won't be needed for implementation. Most interactions with the `@wordpress/data`
- * API can be performed via the `useSelect` hook, or the `withSelect` and
- * `withDispatch` higher order components.
- *
- * @example
- * ```js
- * import {
- * RegistryProvider,
- * createRegistry,
- * useRegistry,
- * } from '@wordpress/data';
- *
- * const registry = createRegistry( {} );
- *
- * const SomeChildUsingRegistry = ( props ) => {
- * const registry = useRegistry( registry );
- * // ...logic implementing the registry in other react hooks.
- * };
- *
- *
- * const ParentProvidingRegistry = ( props ) => {
- * return <RegistryProvider value={ registry }>
- * <SomeChildUsingRegistry { ...props } />
- * </RegistryProvider>
- * };
- * ```
- *
- * @return {Function} A custom react hook exposing the registry context value.
- */
- function useRegistry() {
- return Object(external_wp_element_["useContext"])(Context);
- }
- // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/components/async-mode-provider/context.js
- /**
- * WordPress dependencies
- */
- const context_Context = Object(external_wp_element_["createContext"])(false);
- const {
- Consumer: context_Consumer,
- Provider: context_Provider
- } = context_Context;
- const AsyncModeConsumer = context_Consumer;
- /**
- * Context Provider Component used to switch the data module component rerendering
- * between Sync and Async modes.
- *
- * @example
- *
- * ```js
- * import { useSelect, AsyncModeProvider } from '@wordpress/data';
- *
- * function BlockCount() {
- * const count = useSelect( ( select ) => {
- * return select( 'core/block-editor' ).getBlockCount()
- * }, [] );
- *
- * return count;
- * }
- *
- * function App() {
- * return (
- * <AsyncModeProvider value={ true }>
- * <BlockCount />
- * </AsyncModeProvider>
- * );
- * }
- * ```
- *
- * In this example, the BlockCount component is rerendered asynchronously.
- * It means if a more critical task is being performed (like typing in an input),
- * the rerendering is delayed until the browser becomes IDLE.
- * It is possible to nest multiple levels of AsyncModeProvider to fine-tune the rendering behavior.
- *
- * @param {boolean} props.value Enable Async Mode.
- * @return {WPComponent} The component to be rendered.
- */
- /* harmony default export */ var async_mode_provider_context = (context_Provider);
- // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/components/async-mode-provider/use-async-mode.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- function useAsyncMode() {
- return Object(external_wp_element_["useContext"])(context_Context);
- }
- // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/components/use-select/index.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- const renderQueue = Object(external_wp_priorityQueue_["createQueue"])();
- /** @typedef {import('./types').WPDataStore} WPDataStore */
- /**
- * Custom react hook for retrieving props from registered selectors.
- *
- * In general, this custom React hook follows the
- * [rules of hooks](https://reactjs.org/docs/hooks-rules.html).
- *
- * @param {Function|WPDataStore|string} _mapSelect Function called on every state change. The
- * returned value is exposed to the component
- * implementing this hook. The function receives
- * the `registry.select` method on the first
- * argument and the `registry` on the second
- * argument.
- * When a store key is passed, all selectors for
- * the store will be returned. This is only meant
- * for usage of these selectors in event
- * callbacks, not for data needed to create the
- * element tree.
- * @param {Array} deps If provided, this memoizes the mapSelect so the
- * same `mapSelect` is invoked on every state
- * change unless the dependencies change.
- *
- * @example
- * ```js
- * import { useSelect } from '@wordpress/data';
- *
- * function HammerPriceDisplay( { currency } ) {
- * const price = useSelect( ( select ) => {
- * return select( 'my-shop' ).getPrice( 'hammer', currency )
- * }, [ currency ] );
- * return new Intl.NumberFormat( 'en-US', {
- * style: 'currency',
- * currency,
- * } ).format( price );
- * }
- *
- * // Rendered in the application:
- * // <HammerPriceDisplay currency="USD" />
- * ```
- *
- * In the above example, when `HammerPriceDisplay` is rendered into an
- * application, the price will be retrieved from the store state using the
- * `mapSelect` callback on `useSelect`. If the currency prop changes then
- * any price in the state for that currency is retrieved. If the currency prop
- * doesn't change and other props are passed in that do change, the price will
- * not change because the dependency is just the currency.
- *
- * When data is only used in an event callback, the data should not be retrieved
- * on render, so it may be useful to get the selectors function instead.
- *
- * **Don't use `useSelect` this way when calling the selectors in the render
- * function because your component won't re-render on a data change.**
- *
- * ```js
- * import { useSelect } from '@wordpress/data';
- *
- * function Paste( { children } ) {
- * const { getSettings } = useSelect( 'my-shop' );
- * function onPaste() {
- * // Do something with the settings.
- * const settings = getSettings();
- * }
- * return <div onPaste={ onPaste }>{ children }</div>;
- * }
- * ```
- *
- * @return {Function} A custom react hook.
- */
- function useSelect(_mapSelect, deps) {
- const isWithoutMapping = typeof _mapSelect !== 'function';
- if (isWithoutMapping) {
- deps = [];
- }
- const mapSelect = Object(external_wp_element_["useCallback"])(_mapSelect, deps);
- const registry = useRegistry();
- const isAsync = useAsyncMode(); // React can sometimes clear the `useMemo` cache.
- // We use the cache-stable `useMemoOne` to avoid
- // losing queues.
- const queueContext = Object(use_memo_one_esm["a" /* useMemoOne */])(() => ({
- queue: true
- }), [registry]);
- const [, forceRender] = Object(external_wp_element_["useReducer"])(s => s + 1, 0);
- const latestMapSelect = Object(external_wp_element_["useRef"])();
- const latestIsAsync = Object(external_wp_element_["useRef"])(isAsync);
- const latestMapOutput = Object(external_wp_element_["useRef"])();
- const latestMapOutputError = Object(external_wp_element_["useRef"])();
- const isMountedAndNotUnsubscribing = Object(external_wp_element_["useRef"])(); // Keep track of the stores being selected in the mapSelect function,
- // and only subscribe to those stores later.
- const listeningStores = Object(external_wp_element_["useRef"])([]);
- const trapSelect = Object(external_wp_element_["useCallback"])(callback => registry.__experimentalMarkListeningStores(callback, listeningStores), [registry]); // Generate a "flag" for used in the effect dependency array.
- // It's different than just using `mapSelect` since deps could be undefined,
- // in that case, we would still want to memoize it.
- const depsChangedFlag = Object(external_wp_element_["useMemo"])(() => ({}), deps || []);
- let mapOutput;
- if (!isWithoutMapping) {
- try {
- if (latestMapSelect.current !== mapSelect || latestMapOutputError.current) {
- mapOutput = trapSelect(() => mapSelect(registry.select, registry));
- } else {
- mapOutput = latestMapOutput.current;
- }
- } catch (error) {
- let errorMessage = `An error occurred while running 'mapSelect': ${error.message}`;
- if (latestMapOutputError.current) {
- errorMessage += `\nThe error may be correlated with this previous error:\n`;
- errorMessage += `${latestMapOutputError.current.stack}\n\n`;
- errorMessage += 'Original stack trace:';
- } // eslint-disable-next-line no-console
- console.error(errorMessage);
- mapOutput = latestMapOutput.current;
- }
- }
- Object(external_wp_compose_["useIsomorphicLayoutEffect"])(() => {
- if (isWithoutMapping) {
- return;
- }
- latestMapSelect.current = mapSelect;
- latestMapOutput.current = mapOutput;
- latestMapOutputError.current = undefined;
- isMountedAndNotUnsubscribing.current = true; // This has to run after the other ref updates
- // to avoid using stale values in the flushed
- // callbacks or potentially overwriting a
- // changed `latestMapOutput.current`.
- if (latestIsAsync.current !== isAsync) {
- latestIsAsync.current = isAsync;
- renderQueue.flush(queueContext);
- }
- });
- Object(external_wp_compose_["useIsomorphicLayoutEffect"])(() => {
- if (isWithoutMapping) {
- return;
- }
- const onStoreChange = () => {
- if (isMountedAndNotUnsubscribing.current) {
- try {
- const newMapOutput = trapSelect(() => latestMapSelect.current(registry.select, registry));
- if (external_wp_isShallowEqual_default()(latestMapOutput.current, newMapOutput)) {
- return;
- }
- latestMapOutput.current = newMapOutput;
- } catch (error) {
- latestMapOutputError.current = error;
- }
- forceRender();
- }
- }; // catch any possible state changes during mount before the subscription
- // could be set.
- if (latestIsAsync.current) {
- renderQueue.add(queueContext, onStoreChange);
- } else {
- onStoreChange();
- }
- const onChange = () => {
- if (latestIsAsync.current) {
- renderQueue.add(queueContext, onStoreChange);
- } else {
- onStoreChange();
- }
- };
- const unsubscribers = listeningStores.current.map(storeName => registry.__experimentalSubscribeStore(storeName, onChange));
- return () => {
- isMountedAndNotUnsubscribing.current = false; // The return value of the subscribe function could be undefined if the store is a custom generic store.
- unsubscribers.forEach(unsubscribe => unsubscribe === null || unsubscribe === void 0 ? void 0 : unsubscribe());
- renderQueue.flush(queueContext);
- };
- }, [registry, trapSelect, depsChangedFlag, isWithoutMapping]);
- return isWithoutMapping ? registry.select(_mapSelect) : mapOutput;
- }
- // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/components/with-select/index.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- /**
- * Higher-order component used to inject state-derived props using registered
- * selectors.
- *
- * @param {Function} mapSelectToProps Function called on every state change,
- * expected to return object of props to
- * merge with the component's own props.
- *
- * @example
- * ```js
- * import { withSelect } from '@wordpress/data';
- *
- * function PriceDisplay( { price, currency } ) {
- * return new Intl.NumberFormat( 'en-US', {
- * style: 'currency',
- * currency,
- * } ).format( price );
- * }
- *
- * const HammerPriceDisplay = withSelect( ( select, ownProps ) => {
- * const { getPrice } = select( 'my-shop' );
- * const { currency } = ownProps;
- *
- * return {
- * price: getPrice( 'hammer', currency ),
- * };
- * } )( PriceDisplay );
- *
- * // Rendered in the application:
- * //
- * // <HammerPriceDisplay currency="USD" />
- * ```
- * In the above example, when `HammerPriceDisplay` is rendered into an
- * application, it will pass the price into the underlying `PriceDisplay`
- * component and update automatically if the price of a hammer ever changes in
- * the store.
- *
- * @return {WPComponent} Enhanced component with merged state data props.
- */
- const withSelect = mapSelectToProps => Object(external_wp_compose_["createHigherOrderComponent"])(WrappedComponent => Object(external_wp_compose_["pure"])(ownProps => {
- const mapSelect = (select, registry) => mapSelectToProps(select, ownProps, registry);
- const mergeProps = useSelect(mapSelect);
- return Object(external_wp_element_["createElement"])(WrappedComponent, Object(esm_extends["a" /* default */])({}, ownProps, mergeProps));
- }), 'withSelect');
- /* harmony default export */ var with_select = (withSelect);
- // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/components/use-dispatch/use-dispatch-with-map.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- /**
- * Custom react hook for returning aggregate dispatch actions using the provided
- * dispatchMap.
- *
- * Currently this is an internal api only and is implemented by `withDispatch`
- *
- * @param {Function} dispatchMap Receives the `registry.dispatch` function as
- * the first argument and the `registry` object
- * as the second argument. Should return an
- * object mapping props to functions.
- * @param {Array} deps An array of dependencies for the hook.
- * @return {Object} An object mapping props to functions created by the passed
- * in dispatchMap.
- */
- const useDispatchWithMap = (dispatchMap, deps) => {
- const registry = useRegistry();
- const currentDispatchMap = Object(external_wp_element_["useRef"])(dispatchMap);
- Object(external_wp_compose_["useIsomorphicLayoutEffect"])(() => {
- currentDispatchMap.current = dispatchMap;
- });
- return Object(external_wp_element_["useMemo"])(() => {
- const currentDispatchProps = currentDispatchMap.current(registry.dispatch, registry);
- return Object(external_lodash_["mapValues"])(currentDispatchProps, (dispatcher, propName) => {
- if (typeof dispatcher !== 'function') {
- // eslint-disable-next-line no-console
- console.warn(`Property ${propName} returned from dispatchMap in useDispatchWithMap must be a function.`);
- }
- return (...args) => currentDispatchMap.current(registry.dispatch, registry)[propName](...args);
- });
- }, [registry, ...deps]);
- };
- /* harmony default export */ var use_dispatch_with_map = (useDispatchWithMap);
- // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/components/with-dispatch/index.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- /**
- * Higher-order component used to add dispatch props using registered action
- * creators.
- *
- * @param {Function} mapDispatchToProps A function of returning an object of
- * prop names where value is a
- * dispatch-bound action creator, or a
- * function to be called with the
- * component's props and returning an
- * action creator.
- *
- * @example
- * ```jsx
- * function Button( { onClick, children } ) {
- * return <button type="button" onClick={ onClick }>{ children }</button>;
- * }
- *
- * import { withDispatch } from '@wordpress/data';
- *
- * const SaleButton = withDispatch( ( dispatch, ownProps ) => {
- * const { startSale } = dispatch( 'my-shop' );
- * const { discountPercent } = ownProps;
- *
- * return {
- * onClick() {
- * startSale( discountPercent );
- * },
- * };
- * } )( Button );
- *
- * // Rendered in the application:
- * //
- * // <SaleButton discountPercent="20">Start Sale!</SaleButton>
- * ```
- *
- * @example
- * In the majority of cases, it will be sufficient to use only two first params
- * passed to `mapDispatchToProps` as illustrated in the previous example.
- * However, there might be some very advanced use cases where using the
- * `registry` object might be used as a tool to optimize the performance of
- * your component. Using `select` function from the registry might be useful
- * when you need to fetch some dynamic data from the store at the time when the
- * event is fired, but at the same time, you never use it to render your
- * component. In such scenario, you can avoid using the `withSelect` higher
- * order component to compute such prop, which might lead to unnecessary
- * re-renders of your component caused by its frequent value change.
- * Keep in mind, that `mapDispatchToProps` must return an object with functions
- * only.
- *
- * ```jsx
- * function Button( { onClick, children } ) {
- * return <button type="button" onClick={ onClick }>{ children }</button>;
- * }
- *
- * import { withDispatch } from '@wordpress/data';
- *
- * const SaleButton = withDispatch( ( dispatch, ownProps, { select } ) => {
- * // Stock number changes frequently.
- * const { getStockNumber } = select( 'my-shop' );
- * const { startSale } = dispatch( 'my-shop' );
- * return {
- * onClick() {
- * const discountPercent = getStockNumber() > 50 ? 10 : 20;
- * startSale( discountPercent );
- * },
- * };
- * } )( Button );
- *
- * // Rendered in the application:
- * //
- * // <SaleButton>Start Sale!</SaleButton>
- * ```
- *
- * _Note:_ It is important that the `mapDispatchToProps` function always
- * returns an object with the same keys. For example, it should not contain
- * conditions under which a different value would be returned.
- *
- * @return {WPComponent} Enhanced component with merged dispatcher props.
- */
- const withDispatch = mapDispatchToProps => Object(external_wp_compose_["createHigherOrderComponent"])(WrappedComponent => ownProps => {
- const mapDispatch = (dispatch, registry) => mapDispatchToProps(dispatch, ownProps, registry);
- const dispatchProps = use_dispatch_with_map(mapDispatch, []);
- return Object(external_wp_element_["createElement"])(WrappedComponent, Object(esm_extends["a" /* default */])({}, ownProps, dispatchProps));
- }, 'withDispatch');
- /* harmony default export */ var with_dispatch = (withDispatch);
- // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/components/with-registry/index.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- /**
- * Higher-order component which renders the original component with the current
- * registry context passed as its `registry` prop.
- *
- * @param {WPComponent} OriginalComponent Original component.
- *
- * @return {WPComponent} Enhanced component.
- */
- const withRegistry = Object(external_wp_compose_["createHigherOrderComponent"])(OriginalComponent => props => Object(external_wp_element_["createElement"])(RegistryConsumer, null, registry => Object(external_wp_element_["createElement"])(OriginalComponent, Object(esm_extends["a" /* default */])({}, props, {
- registry: registry
- }))), 'withRegistry');
- /* harmony default export */ var with_registry = (withRegistry);
- // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/components/use-dispatch/use-dispatch.js
- /**
- * Internal dependencies
- */
- /** @typedef {import('./types').WPDataStore} WPDataStore */
- /**
- * A custom react hook returning the current registry dispatch actions creators.
- *
- * Note: The component using this hook must be within the context of a
- * RegistryProvider.
- *
- * @param {string|WPDataStore} [storeNameOrDefinition] Optionally provide the name of the
- * store or its definition from which to
- * retrieve action creators. If not
- * provided, the registry.dispatch
- * function is returned instead.
- *
- * @example
- * This illustrates a pattern where you may need to retrieve dynamic data from
- * the server via the `useSelect` hook to use in combination with the dispatch
- * action.
- *
- * ```jsx
- * import { useDispatch, useSelect } from '@wordpress/data';
- * import { useCallback } from '@wordpress/element';
- *
- * function Button( { onClick, children } ) {
- * return <button type="button" onClick={ onClick }>{ children }</button>
- * }
- *
- * const SaleButton = ( { children } ) => {
- * const { stockNumber } = useSelect(
- * ( select ) => select( 'my-shop' ).getStockNumber(),
- * []
- * );
- * const { startSale } = useDispatch( 'my-shop' );
- * const onClick = useCallback( () => {
- * const discountPercent = stockNumber > 50 ? 10: 20;
- * startSale( discountPercent );
- * }, [ stockNumber ] );
- * return <Button onClick={ onClick }>{ children }</Button>
- * }
- *
- * // Rendered somewhere in the application:
- * //
- * // <SaleButton>Start Sale!</SaleButton>
- * ```
- * @return {Function} A custom react hook.
- */
- const useDispatch = storeNameOrDefinition => {
- const {
- dispatch
- } = useRegistry();
- return storeNameOrDefinition === void 0 ? dispatch : dispatch(storeNameOrDefinition);
- };
- /* harmony default export */ var use_dispatch = (useDispatch);
- // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/index.js
- /**
- * External dependencies
- */
- /**
- * Internal dependencies
- */
- /** @typedef {import('./types').WPDataStore} WPDataStore */
- /**
- * Object of available plugins to use with a registry.
- *
- * @see [use](#use)
- *
- * @type {Object}
- */
- /**
- * The combineReducers helper function turns an object whose values are different
- * reducing functions into a single reducing function you can pass to registerReducer.
- *
- * @param {Object} reducers An object whose values correspond to different reducing
- * functions that need to be combined into one.
- *
- * @example
- * ```js
- * import { combineReducers, createReduxStore, register } from '@wordpress/data';
- *
- * const prices = ( state = {}, action ) => {
- * return action.type === 'SET_PRICE' ?
- * {
- * ...state,
- * [ action.item ]: action.price,
- * } :
- * state;
- * };
- *
- * const discountPercent = ( state = 0, action ) => {
- * return action.type === 'START_SALE' ?
- * action.discountPercent :
- * state;
- * };
- *
- * const store = createReduxStore( 'my-shop', {
- * reducer: combineReducers( {
- * prices,
- * discountPercent,
- * } ),
- * } );
- * register( store );
- * ```
- *
- * @return {Function} A reducer that invokes every reducer inside the reducers
- * object, and constructs a state object with the same shape.
- */
- /**
- * Given the name or definition of a registered store, returns an object of the store's selectors.
- * The selector functions are been pre-bound to pass the current state automatically.
- * As a consumer, you need only pass arguments of the selector, if applicable.
- *
- * @param {string|WPDataStore} storeNameOrDefinition Unique namespace identifier for the store
- * or the store definition.
- *
- * @example
- * ```js
- * import { select } from '@wordpress/data';
- *
- * select( 'my-shop' ).getPrice( 'hammer' );
- * ```
- *
- * @return {Object} Object containing the store's selectors.
- */
- const build_module_select = default_registry.select;
- /**
- * Given the name of a registered store, returns an object containing the store's
- * selectors pre-bound to state so that you only need to supply additional arguments,
- * and modified so that they return promises that resolve to their eventual values,
- * after any resolvers have ran.
- *
- * @param {string|WPDataStore} storeNameOrDefinition Unique namespace identifier for the store
- * or the store definition.
- *
- * @example
- * ```js
- * import { resolveSelect } from '@wordpress/data';
- *
- * resolveSelect( 'my-shop' ).getPrice( 'hammer' ).then(console.log)
- * ```
- *
- * @return {Object} Object containing the store's promise-wrapped selectors.
- */
- const build_module_resolveSelect = default_registry.resolveSelect;
- /**
- * Given the name of a registered store, returns an object of the store's action creators.
- * Calling an action creator will cause it to be dispatched, updating the state value accordingly.
- *
- * Note: Action creators returned by the dispatch will return a promise when
- * they are called.
- *
- * @param {string|WPDataStore} storeNameOrDefinition Unique namespace identifier for the store
- * or the store definition.
- *
- * @example
- * ```js
- * import { dispatch } from '@wordpress/data';
- *
- * dispatch( 'my-shop' ).setPrice( 'hammer', 9.75 );
- * ```
- * @return {Object} Object containing the action creators.
- */
- const build_module_dispatch = default_registry.dispatch;
- /**
- * Given a listener function, the function will be called any time the state value
- * of one of the registered stores has changed. This function returns a `unsubscribe`
- * function used to stop the subscription.
- *
- * @param {Function} listener Callback function.
- *
- * @example
- * ```js
- * import { subscribe } from '@wordpress/data';
- *
- * const unsubscribe = subscribe( () => {
- * // You could use this opportunity to test whether the derived result of a
- * // selector has subsequently changed as the result of a state update.
- * } );
- *
- * // Later, if necessary...
- * unsubscribe();
- * ```
- */
- const build_module_subscribe = default_registry.subscribe;
- /**
- * Registers a generic store.
- *
- * @deprecated Use `register` instead.
- *
- * @param {string} key Store registry key.
- * @param {Object} config Configuration (getSelectors, getActions, subscribe).
- */
- const build_module_registerGenericStore = default_registry.registerGenericStore;
- /**
- * Registers a standard `@wordpress/data` store.
- *
- * @deprecated Use `register` instead.
- *
- * @param {string} storeName Unique namespace identifier for the store.
- * @param {Object} options Store description (reducer, actions, selectors, resolvers).
- *
- * @return {Object} Registered store object.
- */
- const registerStore = default_registry.registerStore;
- /**
- * Extends a registry to inherit functionality provided by a given plugin. A
- * plugin is an object with properties aligning to that of a registry, merged
- * to extend the default registry behavior.
- *
- * @param {Object} plugin Plugin object.
- */
- const build_module_use = default_registry.use;
- /**
- * Registers a standard `@wordpress/data` store definition.
- *
- * @example
- * ```js
- * import { createReduxStore, register } from '@wordpress/data';
- *
- * const store = createReduxStore( 'demo', {
- * reducer: ( state = 'OK' ) => state,
- * selectors: {
- * getValue: ( state ) => state,
- * },
- * } );
- * register( store );
- * ```
- *
- * @param {WPDataStore} store Store definition.
- */
- const build_module_register = default_registry.register;
- /***/ }),
- /***/ "rl8x":
- /***/ (function(module, exports) {
- (function() { module.exports = window["wp"]["isShallowEqual"]; }());
- /***/ }),
- /***/ "wx14":
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _extends; });
- function _extends() {
- _extends = Object.assign || function (target) {
- for (var i = 1; i < arguments.length; i++) {
- var source = arguments[i];
- for (var key in source) {
- if (Object.prototype.hasOwnProperty.call(source, key)) {
- target[key] = source[key];
- }
- }
- }
- return target;
- };
- return _extends.apply(this, arguments);
- }
- /***/ })
- /******/ });
|