[ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
1 /******/ var __webpack_modules__ = ({ 2 3 /***/ 622: 4 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 5 6 /* harmony export */ __webpack_require__.d(__webpack_exports__, { 7 /* harmony export */ Ob: () => (/* binding */ E), 8 /* harmony export */ Qv: () => (/* binding */ D), 9 /* harmony export */ XX: () => (/* binding */ B), 10 /* harmony export */ fF: () => (/* binding */ l), 11 /* harmony export */ h: () => (/* binding */ _), 12 /* harmony export */ q6: () => (/* binding */ G), 13 /* harmony export */ uA: () => (/* binding */ k), 14 /* harmony export */ zO: () => (/* binding */ t) 15 /* harmony export */ }); 16 /* unused harmony exports Fragment, createElement, createRef, toChildArray */ 17 var n,l,u,t,i,o,r,f,e,c,s,a,h={},v=[],p=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,y=Array.isArray;function d(n,l){for(var u in l)n[u]=l[u];return n}function w(n){n&&n.parentNode&&n.parentNode.removeChild(n)}function _(l,u,t){var i,o,r,f={};for(r in u)"key"==r?i=u[r]:"ref"==r?o=u[r]:f[r]=u[r];if(arguments.length>2&&(f.children=arguments.length>3?n.call(arguments,2):t),"function"==typeof l&&null!=l.defaultProps)for(r in l.defaultProps)void 0===f[r]&&(f[r]=l.defaultProps[r]);return g(l,f,i,o,null)}function g(n,t,i,o,r){var f={type:n,props:t,key:i,ref:o,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:null==r?++u:r,__i:-1,__u:0};return null==r&&null!=l.vnode&&l.vnode(f),f}function m(){return{current:null}}function b(n){return n.children}function k(n,l){this.props=n,this.context=l}function x(n,l){if(null==l)return n.__?x(n.__,n.__i+1):null;for(var u;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e)return u.__e;return"function"==typeof n.type?x(n):null}function C(n){var l,u;if(null!=(n=n.__)&&null!=n.__c){for(n.__e=n.__c.base=null,l=0;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e){n.__e=n.__c.base=u.__e;break}return C(n)}}function S(n){(!n.__d&&(n.__d=!0)&&i.push(n)&&!M.__r++||o!==l.debounceRendering)&&((o=l.debounceRendering)||r)(M)}function M(){var n,u,t,o,r,e,c,s;for(i.sort(f);n=i.shift();)n.__d&&(u=i.length,o=void 0,e=(r=(t=n).__v).__e,c=[],s=[],t.__P&&((o=d({},r)).__v=r.__v+1,l.vnode&&l.vnode(o),O(t.__P,o,r,t.__n,t.__P.namespaceURI,32&r.__u?[e]:null,c,null==e?x(r):e,!!(32&r.__u),s),o.__v=r.__v,o.__.__k[o.__i]=o,j(c,o,s),o.__e!=e&&C(o)),i.length>u&&i.sort(f));M.__r=0}function P(n,l,u,t,i,o,r,f,e,c,s){var a,p,y,d,w,_=t&&t.__k||v,g=l.length;for(u.__d=e,$(u,l,_),e=u.__d,a=0;a<g;a++)null!=(y=u.__k[a])&&(p=-1===y.__i?h:_[y.__i]||h,y.__i=a,O(n,y,p,i,o,r,f,e,c,s),d=y.__e,y.ref&&p.ref!=y.ref&&(p.ref&&N(p.ref,null,y),s.push(y.ref,y.__c||d,y)),null==w&&null!=d&&(w=d),65536&y.__u||p.__k===y.__k?e=I(y,e,n):"function"==typeof y.type&&void 0!==y.__d?e=y.__d:d&&(e=d.nextSibling),y.__d=void 0,y.__u&=-196609);u.__d=e,u.__e=w}function $(n,l,u){var t,i,o,r,f,e=l.length,c=u.length,s=c,a=0;for(n.__k=[],t=0;t<e;t++)null!=(i=l[t])&&"boolean"!=typeof i&&"function"!=typeof i?(r=t+a,(i=n.__k[t]="string"==typeof i||"number"==typeof i||"bigint"==typeof i||i.constructor==String?g(null,i,null,null,null):y(i)?g(b,{children:i},null,null,null):void 0===i.constructor&&i.__b>0?g(i.type,i.props,i.key,i.ref?i.ref:null,i.__v):i).__=n,i.__b=n.__b+1,o=null,-1!==(f=i.__i=L(i,u,r,s))&&(s--,(o=u[f])&&(o.__u|=131072)),null==o||null===o.__v?(-1==f&&a--,"function"!=typeof i.type&&(i.__u|=65536)):f!==r&&(f==r-1?a--:f==r+1?a++:(f>r?a--:a++,i.__u|=65536))):i=n.__k[t]=null;if(s)for(t=0;t<c;t++)null!=(o=u[t])&&0==(131072&o.__u)&&(o.__e==n.__d&&(n.__d=x(o)),V(o,o))}function I(n,l,u){var t,i;if("function"==typeof n.type){for(t=n.__k,i=0;t&&i<t.length;i++)t[i]&&(t[i].__=n,l=I(t[i],l,u));return l}n.__e!=l&&(l&&n.type&&!u.contains(l)&&(l=x(n)),u.insertBefore(n.__e,l||null),l=n.__e);do{l=l&&l.nextSibling}while(null!=l&&8===l.nodeType);return l}function H(n,l){return l=l||[],null==n||"boolean"==typeof n||(y(n)?n.some(function(n){H(n,l)}):l.push(n)),l}function L(n,l,u,t){var i=n.key,o=n.type,r=u-1,f=u+1,e=l[u];if(null===e||e&&i==e.key&&o===e.type&&0==(131072&e.__u))return u;if(t>(null!=e&&0==(131072&e.__u)?1:0))for(;r>=0||f<l.length;){if(r>=0){if((e=l[r])&&0==(131072&e.__u)&&i==e.key&&o===e.type)return r;r--}if(f<l.length){if((e=l[f])&&0==(131072&e.__u)&&i==e.key&&o===e.type)return f;f++}}return-1}function T(n,l,u){"-"===l[0]?n.setProperty(l,null==u?"":u):n[l]=null==u?"":"number"!=typeof u||p.test(l)?u:u+"px"}function A(n,l,u,t,i){var o;n:if("style"===l)if("string"==typeof u)n.style.cssText=u;else{if("string"==typeof t&&(n.style.cssText=t=""),t)for(l in t)u&&l in u||T(n.style,l,"");if(u)for(l in u)t&&u[l]===t[l]||T(n.style,l,u[l])}else if("o"===l[0]&&"n"===l[1])o=l!==(l=l.replace(/(PointerCapture)$|Capture$/i,"$1")),l=l.toLowerCase()in n||"onFocusOut"===l||"onFocusIn"===l?l.toLowerCase().slice(2):l.slice(2),n.l||(n.l={}),n.l[l+o]=u,u?t?u.u=t.u:(u.u=e,n.addEventListener(l,o?s:c,o)):n.removeEventListener(l,o?s:c,o);else{if("http://www.w3.org/2000/svg"==i)l=l.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=l&&"height"!=l&&"href"!=l&&"list"!=l&&"form"!=l&&"tabIndex"!=l&&"download"!=l&&"rowSpan"!=l&&"colSpan"!=l&&"role"!=l&&"popover"!=l&&l in n)try{n[l]=null==u?"":u;break n}catch(n){}"function"==typeof u||(null==u||!1===u&&"-"!==l[4]?n.removeAttribute(l):n.setAttribute(l,"popover"==l&&1==u?"":u))}}function F(n){return function(u){if(this.l){var t=this.l[u.type+n];if(null==u.t)u.t=e++;else if(u.t<t.u)return;return t(l.event?l.event(u):u)}}}function O(n,u,t,i,o,r,f,e,c,s){var a,h,v,p,w,_,g,m,x,C,S,M,$,I,H,L,T=u.type;if(void 0!==u.constructor)return null;128&t.__u&&(c=!!(32&t.__u),r=[e=u.__e=t.__e]),(a=l.__b)&&a(u);n:if("function"==typeof T)try{if(m=u.props,x="prototype"in T&&T.prototype.render,C=(a=T.contextType)&&i[a.__c],S=a?C?C.props.value:a.__:i,t.__c?g=(h=u.__c=t.__c).__=h.__E:(x?u.__c=h=new T(m,S):(u.__c=h=new k(m,S),h.constructor=T,h.render=q),C&&C.sub(h),h.props=m,h.state||(h.state={}),h.context=S,h.__n=i,v=h.__d=!0,h.__h=[],h._sb=[]),x&&null==h.__s&&(h.__s=h.state),x&&null!=T.getDerivedStateFromProps&&(h.__s==h.state&&(h.__s=d({},h.__s)),d(h.__s,T.getDerivedStateFromProps(m,h.__s))),p=h.props,w=h.state,h.__v=u,v)x&&null==T.getDerivedStateFromProps&&null!=h.componentWillMount&&h.componentWillMount(),x&&null!=h.componentDidMount&&h.__h.push(h.componentDidMount);else{if(x&&null==T.getDerivedStateFromProps&&m!==p&&null!=h.componentWillReceiveProps&&h.componentWillReceiveProps(m,S),!h.__e&&(null!=h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(m,h.__s,S)||u.__v===t.__v)){for(u.__v!==t.__v&&(h.props=m,h.state=h.__s,h.__d=!1),u.__e=t.__e,u.__k=t.__k,u.__k.some(function(n){n&&(n.__=u)}),M=0;M<h._sb.length;M++)h.__h.push(h._sb[M]);h._sb=[],h.__h.length&&f.push(h);break n}null!=h.componentWillUpdate&&h.componentWillUpdate(m,h.__s,S),x&&null!=h.componentDidUpdate&&h.__h.push(function(){h.componentDidUpdate(p,w,_)})}if(h.context=S,h.props=m,h.__P=n,h.__e=!1,$=l.__r,I=0,x){for(h.state=h.__s,h.__d=!1,$&&$(u),a=h.render(h.props,h.state,h.context),H=0;H<h._sb.length;H++)h.__h.push(h._sb[H]);h._sb=[]}else do{h.__d=!1,$&&$(u),a=h.render(h.props,h.state,h.context),h.state=h.__s}while(h.__d&&++I<25);h.state=h.__s,null!=h.getChildContext&&(i=d(d({},i),h.getChildContext())),x&&!v&&null!=h.getSnapshotBeforeUpdate&&(_=h.getSnapshotBeforeUpdate(p,w)),P(n,y(L=null!=a&&a.type===b&&null==a.key?a.props.children:a)?L:[L],u,t,i,o,r,f,e,c,s),h.base=u.__e,u.__u&=-161,h.__h.length&&f.push(h),g&&(h.__E=h.__=null)}catch(n){if(u.__v=null,c||null!=r){for(u.__u|=c?160:128;e&&8===e.nodeType&&e.nextSibling;)e=e.nextSibling;r[r.indexOf(e)]=null,u.__e=e}else u.__e=t.__e,u.__k=t.__k;l.__e(n,u,t)}else null==r&&u.__v===t.__v?(u.__k=t.__k,u.__e=t.__e):u.__e=z(t.__e,u,t,i,o,r,f,c,s);(a=l.diffed)&&a(u)}function j(n,u,t){u.__d=void 0;for(var i=0;i<t.length;i++)N(t[i],t[++i],t[++i]);l.__c&&l.__c(u,n),n.some(function(u){try{n=u.__h,u.__h=[],n.some(function(n){n.call(u)})}catch(n){l.__e(n,u.__v)}})}function z(u,t,i,o,r,f,e,c,s){var a,v,p,d,_,g,m,b=i.props,k=t.props,C=t.type;if("svg"===C?r="http://www.w3.org/2000/svg":"math"===C?r="http://www.w3.org/1998/Math/MathML":r||(r="http://www.w3.org/1999/xhtml"),null!=f)for(a=0;a<f.length;a++)if((_=f[a])&&"setAttribute"in _==!!C&&(C?_.localName===C:3===_.nodeType)){u=_,f[a]=null;break}if(null==u){if(null===C)return document.createTextNode(k);u=document.createElementNS(r,C,k.is&&k),c&&(l.__m&&l.__m(t,f),c=!1),f=null}if(null===C)b===k||c&&u.data===k||(u.data=k);else{if(f=f&&n.call(u.childNodes),b=i.props||h,!c&&null!=f)for(b={},a=0;a<u.attributes.length;a++)b[(_=u.attributes[a]).name]=_.value;for(a in b)if(_=b[a],"children"==a);else if("dangerouslySetInnerHTML"==a)p=_;else if(!(a in k)){if("value"==a&&"defaultValue"in k||"checked"==a&&"defaultChecked"in k)continue;A(u,a,null,_,r)}for(a in k)_=k[a],"children"==a?d=_:"dangerouslySetInnerHTML"==a?v=_:"value"==a?g=_:"checked"==a?m=_:c&&"function"!=typeof _||b[a]===_||A(u,a,_,b[a],r);if(v)c||p&&(v.__html===p.__html||v.__html===u.innerHTML)||(u.innerHTML=v.__html),t.__k=[];else if(p&&(u.innerHTML=""),P(u,y(d)?d:[d],t,i,o,"foreignObject"===C?"http://www.w3.org/1999/xhtml":r,f,e,f?f[0]:i.__k&&x(i,0),c,s),null!=f)for(a=f.length;a--;)w(f[a]);c||(a="value","progress"===C&&null==g?u.removeAttribute("value"):void 0!==g&&(g!==u[a]||"progress"===C&&!g||"option"===C&&g!==b[a])&&A(u,a,g,b[a],r),a="checked",void 0!==m&&m!==u[a]&&A(u,a,m,b[a],r))}return u}function N(n,u,t){try{if("function"==typeof n){var i="function"==typeof n.__u;i&&n.__u(),i&&null==u||(n.__u=n(u))}else n.current=u}catch(n){l.__e(n,t)}}function V(n,u,t){var i,o;if(l.unmount&&l.unmount(n),(i=n.ref)&&(i.current&&i.current!==n.__e||N(i,null,u)),null!=(i=n.__c)){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(n){l.__e(n,u)}i.base=i.__P=null}if(i=n.__k)for(o=0;o<i.length;o++)i[o]&&V(i[o],u,t||"function"!=typeof n.type);t||w(n.__e),n.__c=n.__=n.__e=n.__d=void 0}function q(n,l,u){return this.constructor(n,u)}function B(u,t,i){var o,r,f,e;l.__&&l.__(u,t),r=(o="function"==typeof i)?null:i&&i.__k||t.__k,f=[],e=[],O(t,u=(!o&&i||t).__k=_(b,null,[u]),r||h,h,t.namespaceURI,!o&&i?[i]:r?null:t.firstChild?n.call(t.childNodes):null,f,!o&&i?i:r?r.__e:t.firstChild,o,e),j(f,u,e)}function D(n,l){B(n,l,D)}function E(l,u,t){var i,o,r,f,e=d({},l.props);for(r in l.type&&l.type.defaultProps&&(f=l.type.defaultProps),u)"key"==r?i=u[r]:"ref"==r?o=u[r]:e[r]=void 0===u[r]&&void 0!==f?f[r]:u[r];return arguments.length>2&&(e.children=arguments.length>3?n.call(arguments,2):t),g(l.type,e,i||l.key,o||l.ref,null)}function G(n,l){var u={__c:l="__cC"+a++,__:n,Consumer:function(n,l){return n.children(l)},Provider:function(n){var u,t;return this.getChildContext||(u=new Set,(t={})[l]=this,this.getChildContext=function(){return t},this.componentWillUnmount=function(){u=null},this.shouldComponentUpdate=function(n){this.props.value!==n.value&&u.forEach(function(n){n.__e=!0,S(n)})},this.sub=function(n){u.add(n);var l=n.componentWillUnmount;n.componentWillUnmount=function(){u&&u.delete(n),l&&l.call(n)}}),n.children}};return u.Provider.__=u.Consumer.contextType=u}n=v.slice,l={__e:function(n,l,u,t){for(var i,o,r;l=l.__;)if((i=l.__c)&&!i.__)try{if((o=i.constructor)&&null!=o.getDerivedStateFromError&&(i.setState(o.getDerivedStateFromError(n)),r=i.__d),null!=i.componentDidCatch&&(i.componentDidCatch(n,t||{}),r=i.__d),r)return i.__E=i}catch(l){n=l}throw n}},u=0,t=function(n){return null!=n&&null==n.constructor},k.prototype.setState=function(n,l){var u;u=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=d({},this.state),"function"==typeof n&&(n=n(d({},u),this.props)),n&&d(u,n),null!=n&&this.__v&&(l&&this._sb.push(l),S(this))},k.prototype.forceUpdate=function(n){this.__v&&(this.__e=!0,n&&this.__h.push(n),S(this))},k.prototype.render=b,i=[],r="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,f=function(n,l){return n.__v.__b-l.__v.__b},M.__r=0,e=0,c=F(!1),s=F(!0),a=0; 18 19 20 /***/ }) 21 22 /******/ }); 23 /************************************************************************/ 24 /******/ // The module cache 25 /******/ var __webpack_module_cache__ = {}; 26 /******/ 27 /******/ // The require function 28 /******/ function __webpack_require__(moduleId) { 29 /******/ // Check if module is in cache 30 /******/ var cachedModule = __webpack_module_cache__[moduleId]; 31 /******/ if (cachedModule !== undefined) { 32 /******/ return cachedModule.exports; 33 /******/ } 34 /******/ // Create a new module (and put it into the cache) 35 /******/ var module = __webpack_module_cache__[moduleId] = { 36 /******/ // no module.id needed 37 /******/ // no module.loaded needed 38 /******/ exports: {} 39 /******/ }; 40 /******/ 41 /******/ // Execute the module function 42 /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); 43 /******/ 44 /******/ // Return the exports of the module 45 /******/ return module.exports; 46 /******/ } 47 /******/ 48 /************************************************************************/ 49 /******/ /* webpack/runtime/define property getters */ 50 /******/ (() => { 51 /******/ // define getter functions for harmony exports 52 /******/ __webpack_require__.d = (exports, definition) => { 53 /******/ for(var key in definition) { 54 /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { 55 /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); 56 /******/ } 57 /******/ } 58 /******/ }; 59 /******/ })(); 60 /******/ 61 /******/ /* webpack/runtime/hasOwnProperty shorthand */ 62 /******/ (() => { 63 /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) 64 /******/ })(); 65 /******/ 66 /************************************************************************/ 67 var __webpack_exports__ = {}; 68 // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. 69 (() => { 70 71 // EXPORTS 72 __webpack_require__.d(__webpack_exports__, { 73 zj: () => (/* reexport */ getConfig), 74 SD: () => (/* reexport */ getContext), 75 V6: () => (/* reexport */ getElement), 76 $K: () => (/* reexport */ getServerContext), 77 vT: () => (/* reexport */ getServerState), 78 jb: () => (/* binding */ privateApis), 79 yT: () => (/* reexport */ splitTask), 80 M_: () => (/* reexport */ store), 81 hb: () => (/* reexport */ useCallback), 82 vJ: () => (/* reexport */ useEffect), 83 ip: () => (/* reexport */ useInit), 84 Nf: () => (/* reexport */ useLayoutEffect), 85 Kr: () => (/* reexport */ useMemo), 86 li: () => (/* reexport */ A), 87 J0: () => (/* reexport */ h), 88 FH: () => (/* reexport */ useWatch), 89 v4: () => (/* reexport */ withScope) 90 }); 91 92 // EXTERNAL MODULE: ./node_modules/preact/dist/preact.module.js 93 var preact_module = __webpack_require__(622); 94 ;// CONCATENATED MODULE: ./node_modules/preact/hooks/dist/hooks.module.js 95 var hooks_module_t,r,hooks_module_u,i,hooks_module_o=0,hooks_module_f=[],hooks_module_c=preact_module/* options */.fF,e=hooks_module_c.__b,a=hooks_module_c.__r,v=hooks_module_c.diffed,l=hooks_module_c.__c,m=hooks_module_c.unmount,s=hooks_module_c.__;function d(n,t){hooks_module_c.__h&&hooks_module_c.__h(r,n,hooks_module_o||t),hooks_module_o=0;var u=r.__H||(r.__H={__:[],__h:[]});return n>=u.__.length&&u.__.push({}),u.__[n]}function h(n){return hooks_module_o=1,p(D,n)}function p(n,u,i){var o=d(hooks_module_t++,2);if(o.t=n,!o.__c&&(o.__=[i?i(u):D(void 0,u),function(n){var t=o.__N?o.__N[0]:o.__[0],r=o.t(t,n);t!==r&&(o.__N=[r,o.__[1]],o.__c.setState({}))}],o.__c=r,!r.u)){var f=function(n,t,r){if(!o.__c.__H)return!0;var u=o.__c.__H.__.filter(function(n){return!!n.__c});if(u.every(function(n){return!n.__N}))return!c||c.call(this,n,t,r);var i=!1;return u.forEach(function(n){if(n.__N){var t=n.__[0];n.__=n.__N,n.__N=void 0,t!==n.__[0]&&(i=!0)}}),!(!i&&o.__c.props===n)&&(!c||c.call(this,n,t,r))};r.u=!0;var c=r.shouldComponentUpdate,e=r.componentWillUpdate;r.componentWillUpdate=function(n,t,r){if(this.__e){var u=c;c=void 0,f(n,t,r),c=u}e&&e.call(this,n,t,r)},r.shouldComponentUpdate=f}return o.__N||o.__}function y(n,u){var i=d(hooks_module_t++,3);!hooks_module_c.__s&&C(i.__H,u)&&(i.__=n,i.i=u,r.__H.__h.push(i))}function _(n,u){var i=d(hooks_module_t++,4);!hooks_module_c.__s&&C(i.__H,u)&&(i.__=n,i.i=u,r.__h.push(i))}function A(n){return hooks_module_o=5,T(function(){return{current:n}},[])}function F(n,t,r){hooks_module_o=6,_(function(){return"function"==typeof n?(n(t()),function(){return n(null)}):n?(n.current=t(),function(){return n.current=null}):void 0},null==r?r:r.concat(n))}function T(n,r){var u=d(hooks_module_t++,7);return C(u.__H,r)&&(u.__=n(),u.__H=r,u.__h=n),u.__}function q(n,t){return hooks_module_o=8,T(function(){return n},t)}function x(n){var u=r.context[n.__c],i=d(hooks_module_t++,9);return i.c=n,u?(null==i.__&&(i.__=!0,u.sub(r)),u.props.value):n.__}function P(n,t){hooks_module_c.useDebugValue&&hooks_module_c.useDebugValue(t?t(n):n)}function b(n){var u=d(hooks_module_t++,10),i=h();return u.__=n,r.componentDidCatch||(r.componentDidCatch=function(n,t){u.__&&u.__(n,t),i[1](n)}),[i[0],function(){i[1](void 0)}]}function g(){var n=d(hooks_module_t++,11);if(!n.__){for(var u=r.__v;null!==u&&!u.__m&&null!==u.__;)u=u.__;var i=u.__m||(u.__m=[0,0]);n.__="P"+i[0]+"-"+i[1]++}return n.__}function j(){for(var n;n=hooks_module_f.shift();)if(n.__P&&n.__H)try{n.__H.__h.forEach(z),n.__H.__h.forEach(B),n.__H.__h=[]}catch(t){n.__H.__h=[],hooks_module_c.__e(t,n.__v)}}hooks_module_c.__b=function(n){r=null,e&&e(n)},hooks_module_c.__=function(n,t){n&&t.__k&&t.__k.__m&&(n.__m=t.__k.__m),s&&s(n,t)},hooks_module_c.__r=function(n){a&&a(n),hooks_module_t=0;var i=(r=n.__c).__H;i&&(hooks_module_u===r?(i.__h=[],r.__h=[],i.__.forEach(function(n){n.__N&&(n.__=n.__N),n.i=n.__N=void 0})):(i.__h.forEach(z),i.__h.forEach(B),i.__h=[],hooks_module_t=0)),hooks_module_u=r},hooks_module_c.diffed=function(n){v&&v(n);var t=n.__c;t&&t.__H&&(t.__H.__h.length&&(1!==hooks_module_f.push(t)&&i===hooks_module_c.requestAnimationFrame||((i=hooks_module_c.requestAnimationFrame)||w)(j)),t.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.i=void 0})),hooks_module_u=r=null},hooks_module_c.__c=function(n,t){t.some(function(n){try{n.__h.forEach(z),n.__h=n.__h.filter(function(n){return!n.__||B(n)})}catch(r){t.some(function(n){n.__h&&(n.__h=[])}),t=[],hooks_module_c.__e(r,n.__v)}}),l&&l(n,t)},hooks_module_c.unmount=function(n){m&&m(n);var t,r=n.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{z(n)}catch(n){t=n}}),r.__H=void 0,t&&hooks_module_c.__e(t,r.__v))};var k="function"==typeof requestAnimationFrame;function w(n){var t,r=function(){clearTimeout(u),k&&cancelAnimationFrame(t),setTimeout(n)},u=setTimeout(r,100);k&&(t=requestAnimationFrame(r))}function z(n){var t=r,u=n.__c;"function"==typeof u&&(n.__c=void 0,u()),r=t}function B(n){var t=r;n.__c=n.__(),r=t}function C(n,t){return!n||n.length!==t.length||t.some(function(t,r){return t!==n[r]})}function D(n,t){return"function"==typeof t?t(n):t} 96 97 ;// CONCATENATED MODULE: ./node_modules/@preact/signals-core/dist/signals-core.module.js 98 var signals_core_module_i=Symbol.for("preact-signals");function signals_core_module_t(){if(!(signals_core_module_s>1)){var i,t=!1;while(void 0!==signals_core_module_h){var r=signals_core_module_h;signals_core_module_h=void 0;signals_core_module_f++;while(void 0!==r){var o=r.o;r.o=void 0;r.f&=-3;if(!(8&r.f)&&signals_core_module_c(r))try{r.c()}catch(r){if(!t){i=r;t=!0}}r=o}}signals_core_module_f=0;signals_core_module_s--;if(t)throw i}else signals_core_module_s--}function signals_core_module_r(i){if(signals_core_module_s>0)return i();signals_core_module_s++;try{return i()}finally{signals_core_module_t()}}var signals_core_module_o=void 0;function n(i){var t=signals_core_module_o;signals_core_module_o=void 0;try{return i()}finally{signals_core_module_o=t}}var signals_core_module_h=void 0,signals_core_module_s=0,signals_core_module_f=0,signals_core_module_v=0;function signals_core_module_e(i){if(void 0!==signals_core_module_o){var t=i.n;if(void 0===t||t.t!==signals_core_module_o){t={i:0,S:i,p:signals_core_module_o.s,n:void 0,t:signals_core_module_o,e:void 0,x:void 0,r:t};if(void 0!==signals_core_module_o.s)signals_core_module_o.s.n=t;signals_core_module_o.s=t;i.n=t;if(32&signals_core_module_o.f)i.S(t);return t}else if(-1===t.i){t.i=0;if(void 0!==t.n){t.n.p=t.p;if(void 0!==t.p)t.p.n=t.n;t.p=signals_core_module_o.s;t.n=void 0;signals_core_module_o.s.n=t;signals_core_module_o.s=t}return t}}}function signals_core_module_u(i){this.v=i;this.i=0;this.n=void 0;this.t=void 0}signals_core_module_u.prototype.brand=signals_core_module_i;signals_core_module_u.prototype.h=function(){return!0};signals_core_module_u.prototype.S=function(i){if(this.t!==i&&void 0===i.e){i.x=this.t;if(void 0!==this.t)this.t.e=i;this.t=i}};signals_core_module_u.prototype.U=function(i){if(void 0!==this.t){var t=i.e,r=i.x;if(void 0!==t){t.x=r;i.e=void 0}if(void 0!==r){r.e=t;i.x=void 0}if(i===this.t)this.t=r}};signals_core_module_u.prototype.subscribe=function(i){var t=this;return E(function(){var r=t.value,n=signals_core_module_o;signals_core_module_o=void 0;try{i(r)}finally{signals_core_module_o=n}})};signals_core_module_u.prototype.valueOf=function(){return this.value};signals_core_module_u.prototype.toString=function(){return this.value+""};signals_core_module_u.prototype.toJSON=function(){return this.value};signals_core_module_u.prototype.peek=function(){var i=signals_core_module_o;signals_core_module_o=void 0;try{return this.value}finally{signals_core_module_o=i}};Object.defineProperty(signals_core_module_u.prototype,"value",{get:function(){var i=signals_core_module_e(this);if(void 0!==i)i.i=this.i;return this.v},set:function(i){if(i!==this.v){if(signals_core_module_f>100)throw new Error("Cycle detected");this.v=i;this.i++;signals_core_module_v++;signals_core_module_s++;try{for(var r=this.t;void 0!==r;r=r.x)r.t.N()}finally{signals_core_module_t()}}}});function signals_core_module_d(i){return new signals_core_module_u(i)}function signals_core_module_c(i){for(var t=i.s;void 0!==t;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function signals_core_module_a(i){for(var t=i.s;void 0!==t;t=t.n){var r=t.S.n;if(void 0!==r)t.r=r;t.S.n=t;t.i=-1;if(void 0===t.n){i.s=t;break}}}function signals_core_module_l(i){var t=i.s,r=void 0;while(void 0!==t){var o=t.p;if(-1===t.i){t.S.U(t);if(void 0!==o)o.n=t.n;if(void 0!==t.n)t.n.p=o}else r=t;t.S.n=t.r;if(void 0!==t.r)t.r=void 0;t=o}i.s=r}function signals_core_module_y(i){signals_core_module_u.call(this,void 0);this.x=i;this.s=void 0;this.g=signals_core_module_v-1;this.f=4}(signals_core_module_y.prototype=new signals_core_module_u).h=function(){this.f&=-3;if(1&this.f)return!1;if(32==(36&this.f))return!0;this.f&=-5;if(this.g===signals_core_module_v)return!0;this.g=signals_core_module_v;this.f|=1;if(this.i>0&&!signals_core_module_c(this)){this.f&=-2;return!0}var i=signals_core_module_o;try{signals_core_module_a(this);signals_core_module_o=this;var t=this.x();if(16&this.f||this.v!==t||0===this.i){this.v=t;this.f&=-17;this.i++}}catch(i){this.v=i;this.f|=16;this.i++}signals_core_module_o=i;signals_core_module_l(this);this.f&=-2;return!0};signals_core_module_y.prototype.S=function(i){if(void 0===this.t){this.f|=36;for(var t=this.s;void 0!==t;t=t.n)t.S.S(t)}signals_core_module_u.prototype.S.call(this,i)};signals_core_module_y.prototype.U=function(i){if(void 0!==this.t){signals_core_module_u.prototype.U.call(this,i);if(void 0===this.t){this.f&=-33;for(var t=this.s;void 0!==t;t=t.n)t.S.U(t)}}};signals_core_module_y.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var i=this.t;void 0!==i;i=i.x)i.t.N()}};Object.defineProperty(signals_core_module_y.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var i=signals_core_module_e(this);this.h();if(void 0!==i)i.i=this.i;if(16&this.f)throw this.v;return this.v}});function signals_core_module_w(i){return new signals_core_module_y(i)}function signals_core_module_(i){var r=i.u;i.u=void 0;if("function"==typeof r){signals_core_module_s++;var n=signals_core_module_o;signals_core_module_o=void 0;try{r()}catch(t){i.f&=-2;i.f|=8;signals_core_module_g(i);throw t}finally{signals_core_module_o=n;signals_core_module_t()}}}function signals_core_module_g(i){for(var t=i.s;void 0!==t;t=t.n)t.S.U(t);i.x=void 0;i.s=void 0;signals_core_module_(i)}function signals_core_module_p(i){if(signals_core_module_o!==this)throw new Error("Out-of-order effect");signals_core_module_l(this);signals_core_module_o=i;this.f&=-2;if(8&this.f)signals_core_module_g(this);signals_core_module_t()}function signals_core_module_b(i){this.x=i;this.u=void 0;this.s=void 0;this.o=void 0;this.f=32}signals_core_module_b.prototype.c=function(){var i=this.S();try{if(8&this.f)return;if(void 0===this.x)return;var t=this.x();if("function"==typeof t)this.u=t}finally{i()}};signals_core_module_b.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1;this.f&=-9;signals_core_module_(this);signals_core_module_a(this);signals_core_module_s++;var i=signals_core_module_o;signals_core_module_o=this;return signals_core_module_p.bind(this,i)};signals_core_module_b.prototype.N=function(){if(!(2&this.f)){this.f|=2;this.o=signals_core_module_h;signals_core_module_h=this}};signals_core_module_b.prototype.d=function(){this.f|=8;if(!(1&this.f))signals_core_module_g(this)};function E(i){var t=new signals_core_module_b(i);try{t.c()}catch(i){t.d();throw i}return t.d.bind(t)} 99 ;// CONCATENATED MODULE: ./node_modules/@preact/signals/dist/signals.module.js 100 var signals_module_v,signals_module_s;function signals_module_l(n,i){preact_module/* options */.fF[n]=i.bind(null,preact_module/* options */.fF[n]||function(){})}function signals_module_d(n){if(signals_module_s)signals_module_s();signals_module_s=n&&n.S()}function signals_module_p(n){var r=this,f=n.data,o=useSignal(f);o.value=f;var e=T(function(){var n=r.__v;while(n=n.__)if(n.__c){n.__c.__$f|=4;break}r.__$u.c=function(){var n;if(!(0,preact_module/* isValidElement */.zO)(e.peek())&&3===(null==(n=r.base)?void 0:n.nodeType))r.base.data=e.peek();else{r.__$f|=1;r.setState({})}};return signals_core_module_w(function(){var n=o.value.value;return 0===n?0:!0===n?"":n||""})},[]);return e.value}signals_module_p.displayName="_st";Object.defineProperties(signals_core_module_u.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:signals_module_p},props:{configurable:!0,get:function(){return{data:this}}},__b:{configurable:!0,value:1}});signals_module_l("__b",function(n,r){if("string"==typeof r.type){var i,t=r.props;for(var f in t)if("children"!==f){var o=t[f];if(o instanceof signals_core_module_u){if(!i)r.__np=i={};i[f]=o;t[f]=o.peek()}}}n(r)});signals_module_l("__r",function(n,r){signals_module_d();var i,t=r.__c;if(t){t.__$f&=-2;if(void 0===(i=t.__$u))t.__$u=i=function(n){var r;E(function(){r=this});r.c=function(){t.__$f|=1;t.setState({})};return r}()}signals_module_v=t;signals_module_d(i);n(r)});signals_module_l("__e",function(n,r,i,t){signals_module_d();signals_module_v=void 0;n(r,i,t)});signals_module_l("diffed",function(n,r){signals_module_d();signals_module_v=void 0;var i;if("string"==typeof r.type&&(i=r.__e)){var t=r.__np,f=r.props;if(t){var o=i.U;if(o)for(var e in o){var u=o[e];if(void 0!==u&&!(e in t)){u.d();o[e]=void 0}}else i.U=o={};for(var a in t){var c=o[a],s=t[a];if(void 0===c){c=signals_module_(i,a,s,f);o[a]=c}else c.o(s,f)}}}n(r)});function signals_module_(n,r,i,t){var f=r in n&&void 0===n.ownerSVGElement,o=signals_core_module_d(i);return{o:function(n,r){o.value=n;t=r},d:E(function(){var i=o.value.value;if(t[r]!==i){t[r]=i;if(f)n[r]=i;else if(i)n.setAttribute(r,i);else n.removeAttribute(r)}})}}signals_module_l("unmount",function(n,r){if("string"==typeof r.type){var i=r.__e;if(i){var t=i.U;if(t){i.U=void 0;for(var f in t){var o=t[f];if(o)o.d()}}}}else{var e=r.__c;if(e){var u=e.__$u;if(u){e.__$u=void 0;u.d()}}}n(r)});signals_module_l("__h",function(n,r,i,t){if(t<3||9===t)r.__$f|=2;n(r,i,t)});preact_module/* Component */.uA.prototype.shouldComponentUpdate=function(n,r){var i=this.__$u;if(!(i&&void 0!==i.s||4&this.__$f))return!0;if(3&this.__$f)return!0;for(var t in r)return!0;for(var f in n)if("__source"!==f&&n[f]!==this.props[f])return!0;for(var o in this.props)if(!(o in n))return!0;return!1};function useSignal(n){return T(function(){return signals_core_module_d(n)},[])}function useComputed(n){var r=f(n);r.current=n;signals_module_v.__$f|=4;return t(function(){return u(function(){return r.current()})},[])}function useSignalEffect(n){var r=f(n);r.current=n;o(function(){return c(function(){return r.current()})},[])} 101 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interactivity/build-module/namespaces.js 102 const namespaceStack = []; 103 const getNamespace = () => namespaceStack.slice(-1)[0]; 104 const setNamespace = namespace => { 105 namespaceStack.push(namespace); 106 }; 107 const resetNamespace = () => { 108 namespaceStack.pop(); 109 }; 110 111 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interactivity/build-module/scopes.js 112 /** 113 * External dependencies 114 */ 115 116 /** 117 * Internal dependencies 118 */ 119 120 // Store stacks for the current scope and the default namespaces and export APIs 121 // to interact with them. 122 const scopeStack = []; 123 const getScope = () => scopeStack.slice(-1)[0]; 124 const setScope = scope => { 125 scopeStack.push(scope); 126 }; 127 const resetScope = () => { 128 scopeStack.pop(); 129 }; 130 131 // Wrap the element props to prevent modifications. 132 const immutableMap = new WeakMap(); 133 const immutableError = () => { 134 throw new Error('Please use `data-wp-bind` to modify the attributes of an element.'); 135 }; 136 const immutableHandlers = { 137 get(target, key, receiver) { 138 const value = Reflect.get(target, key, receiver); 139 return !!value && typeof value === 'object' ? deepImmutable(value) : value; 140 }, 141 set: immutableError, 142 deleteProperty: immutableError 143 }; 144 const deepImmutable = target => { 145 if (!immutableMap.has(target)) { 146 immutableMap.set(target, new Proxy(target, immutableHandlers)); 147 } 148 return immutableMap.get(target); 149 }; 150 151 /** 152 * Retrieves the context inherited by the element evaluating a function from the 153 * store. The returned value depends on the element and the namespace where the 154 * function calling `getContext()` exists. 155 * 156 * @param namespace Store namespace. By default, the namespace where the calling 157 * function exists is used. 158 * @return The context content. 159 */ 160 const getContext = namespace => { 161 const scope = getScope(); 162 if (true) { 163 if (!scope) { 164 throw Error('Cannot call `getContext()` when there is no scope. If you are using an async function, please consider using a generator instead. If you are using some sort of async callbacks, like `setTimeout`, please wrap the callback with `withScope(callback)`.'); 165 } 166 } 167 return scope.context[namespace || getNamespace()]; 168 }; 169 170 /** 171 * Retrieves a representation of the element where a function from the store 172 * is being evalutated. Such representation is read-only, and contains a 173 * reference to the DOM element, its props and a local reactive state. 174 * 175 * @return Element representation. 176 */ 177 const getElement = () => { 178 const scope = getScope(); 179 if (true) { 180 if (!scope) { 181 throw Error('Cannot call `getElement()` when there is no scope. If you are using an async function, please consider using a generator instead. If you are using some sort of async callbacks, like `setTimeout`, please wrap the callback with `withScope(callback)`.'); 182 } 183 } 184 const { 185 ref, 186 attributes 187 } = scope; 188 return Object.freeze({ 189 ref: ref.current, 190 attributes: deepImmutable(attributes) 191 }); 192 }; 193 194 /** 195 * Retrieves the part of the inherited context defined and updated from the 196 * server. 197 * 198 * The object returned is read-only, and includes the context defined in PHP 199 * with `wp_interactivity_data_wp_context()`, including the corresponding 200 * inherited properties. When `actions.navigate()` is called, this object is 201 * updated to reflect the changes in the new visited page, without affecting the 202 * context returned by `getContext()`. Directives can subscribe to those changes 203 * to update the context if needed. 204 * 205 * @example 206 * ```js 207 * store('...', { 208 * callbacks: { 209 * updateServerContext() { 210 * const context = getContext(); 211 * const serverContext = getServerContext(); 212 * // Override some property with the new value that came from the server. 213 * context.overridableProp = serverContext.overridableProp; 214 * }, 215 * }, 216 * }); 217 * ``` 218 * 219 * @param namespace Store namespace. By default, the namespace where the calling 220 * function exists is used. 221 * @return The server context content. 222 */ 223 const getServerContext = namespace => { 224 const scope = getScope(); 225 if (true) { 226 if (!scope) { 227 throw Error('Cannot call `getServerContext()` when there is no scope. If you are using an async function, please consider using a generator instead. If you are using some sort of async callbacks, like `setTimeout`, please wrap the callback with `withScope(callback)`.'); 228 } 229 } 230 return scope.serverContext[namespace || getNamespace()]; 231 }; 232 233 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interactivity/build-module/utils.js 234 /** 235 * External dependencies 236 */ 237 238 239 240 /** 241 * Internal dependencies 242 */ 243 244 245 /** 246 * Executes a callback function after the next frame is rendered. 247 * 248 * @param callback The callback function to be executed. 249 * @return A promise that resolves after the callback function is executed. 250 */ 251 const afterNextFrame = callback => { 252 return new Promise(resolve => { 253 const done = () => { 254 clearTimeout(timeout); 255 window.cancelAnimationFrame(raf); 256 setTimeout(() => { 257 callback(); 258 resolve(); 259 }); 260 }; 261 const timeout = setTimeout(done, 100); 262 const raf = window.requestAnimationFrame(done); 263 }); 264 }; 265 266 /** 267 * Returns a promise that resolves after yielding to main. 268 * 269 * @return Promise 270 */ 271 const splitTask = () => { 272 return new Promise(resolve => { 273 // TODO: Use scheduler.yield() when available. 274 setTimeout(resolve, 0); 275 }); 276 }; 277 278 /** 279 * Creates a Flusher object that can be used to flush computed values and notify listeners. 280 * 281 * Using the mangled properties: 282 * this.c: this._callback 283 * this.x: this._compute 284 * https://github.com/preactjs/signals/blob/main/mangle.json 285 * 286 * @param compute The function that computes the value to be flushed. 287 * @param notify The function that notifies listeners when the value is flushed. 288 * @return The Flusher object with `flush` and `dispose` properties. 289 */ 290 function createFlusher(compute, notify) { 291 let flush = () => undefined; 292 const dispose = E(function () { 293 flush = this.c.bind(this); 294 this.x = compute; 295 this.c = notify; 296 return compute(); 297 }); 298 return { 299 flush, 300 dispose 301 }; 302 } 303 304 /** 305 * Custom hook that executes a callback function whenever a signal is triggered. 306 * Version of `useSignalEffect` with a `useEffect`-like execution. This hook 307 * implementation comes from this PR, but we added short-cirtuiting to avoid 308 * infinite loops: https://github.com/preactjs/signals/pull/290 309 * 310 * @param callback The callback function to be executed. 311 */ 312 function utils_useSignalEffect(callback) { 313 y(() => { 314 let eff = null; 315 let isExecuting = false; 316 const notify = async () => { 317 if (eff && !isExecuting) { 318 isExecuting = true; 319 await afterNextFrame(eff.flush); 320 isExecuting = false; 321 } 322 }; 323 eff = createFlusher(callback, notify); 324 return eff.dispose; 325 }, []); 326 } 327 328 /** 329 * Returns the passed function wrapped with the current scope so it is 330 * accessible whenever the function runs. This is primarily to make the scope 331 * available inside hook callbacks. 332 * 333 * Asyncronous functions should use generators that yield promises instead of awaiting them. 334 * See the documentation for details: https://developer.wordpress.org/block-editor/reference-guides/packages/packages-interactivity/packages-interactivity-api-reference/#the-store 335 * 336 * @param func The passed function. 337 * @return The wrapped function. 338 */ 339 340 function withScope(func) { 341 const scope = getScope(); 342 const ns = getNamespace(); 343 if (func?.constructor?.name === 'GeneratorFunction') { 344 return async (...args) => { 345 const gen = func(...args); 346 let value; 347 let it; 348 while (true) { 349 setNamespace(ns); 350 setScope(scope); 351 try { 352 it = gen.next(value); 353 } finally { 354 resetScope(); 355 resetNamespace(); 356 } 357 try { 358 value = await it.value; 359 } catch (e) { 360 setNamespace(ns); 361 setScope(scope); 362 gen.throw(e); 363 } finally { 364 resetScope(); 365 resetNamespace(); 366 } 367 if (it.done) { 368 break; 369 } 370 } 371 return value; 372 }; 373 } 374 return (...args) => { 375 setNamespace(ns); 376 setScope(scope); 377 try { 378 return func(...args); 379 } finally { 380 resetNamespace(); 381 resetScope(); 382 } 383 }; 384 } 385 386 /** 387 * Accepts a function that contains imperative code which runs whenever any of 388 * the accessed _reactive_ properties (e.g., values from the global state or the 389 * context) is modified. 390 * 391 * This hook makes the element's scope available so functions like 392 * `getElement()` and `getContext()` can be used inside the passed callback. 393 * 394 * @param callback The hook callback. 395 */ 396 function useWatch(callback) { 397 utils_useSignalEffect(withScope(callback)); 398 } 399 400 /** 401 * Accepts a function that contains imperative code which runs only after the 402 * element's first render, mainly useful for intialization logic. 403 * 404 * This hook makes the element's scope available so functions like 405 * `getElement()` and `getContext()` can be used inside the passed callback. 406 * 407 * @param callback The hook callback. 408 */ 409 function useInit(callback) { 410 y(withScope(callback), []); 411 } 412 413 /** 414 * Accepts a function that contains imperative, possibly effectful code. The 415 * effects run after browser paint, without blocking it. 416 * 417 * This hook is equivalent to Preact's `useEffect` and makes the element's scope 418 * available so functions like `getElement()` and `getContext()` can be used 419 * inside the passed callback. 420 * 421 * @param callback Imperative function that can return a cleanup 422 * function. 423 * @param inputs If present, effect will only activate if the 424 * values in the list change (using `===`). 425 */ 426 function useEffect(callback, inputs) { 427 y(withScope(callback), inputs); 428 } 429 430 /** 431 * Accepts a function that contains imperative, possibly effectful code. Use 432 * this to read layout from the DOM and synchronously re-render. 433 * 434 * This hook is equivalent to Preact's `useLayoutEffect` and makes the element's 435 * scope available so functions like `getElement()` and `getContext()` can be 436 * used inside the passed callback. 437 * 438 * @param callback Imperative function that can return a cleanup 439 * function. 440 * @param inputs If present, effect will only activate if the 441 * values in the list change (using `===`). 442 */ 443 function useLayoutEffect(callback, inputs) { 444 _(withScope(callback), inputs); 445 } 446 447 /** 448 * Returns a memoized version of the callback that only changes if one of the 449 * inputs has changed (using `===`). 450 * 451 * This hook is equivalent to Preact's `useCallback` and makes the element's 452 * scope available so functions like `getElement()` and `getContext()` can be 453 * used inside the passed callback. 454 * 455 * @param callback Callback function. 456 * @param inputs If present, the callback will only be updated if the 457 * values in the list change (using `===`). 458 * 459 * @return The callback function. 460 */ 461 function useCallback(callback, inputs) { 462 return q(withScope(callback), inputs); 463 } 464 465 /** 466 * Pass a factory function and an array of inputs. `useMemo` will only recompute 467 * the memoized value when one of the inputs has changed. 468 * 469 * This hook is equivalent to Preact's `useMemo` and makes the element's scope 470 * available so functions like `getElement()` and `getContext()` can be used 471 * inside the passed factory function. 472 * 473 * @param factory Factory function that returns that value for memoization. 474 * @param inputs If present, the factory will only be run to recompute if 475 * the values in the list change (using `===`). 476 * 477 * @return The memoized value. 478 */ 479 function useMemo(factory, inputs) { 480 return T(withScope(factory), inputs); 481 } 482 483 /** 484 * Creates a root fragment by replacing a node or an array of nodes in a parent element. 485 * For wrapperless hydration. 486 * See https://gist.github.com/developit/f4c67a2ede71dc2fab7f357f39cff28c 487 * 488 * @param parent The parent element where the nodes will be replaced. 489 * @param replaceNode The node or array of nodes to replace in the parent element. 490 * @return The created root fragment. 491 */ 492 const createRootFragment = (parent, replaceNode) => { 493 replaceNode = [].concat(replaceNode); 494 const sibling = replaceNode[replaceNode.length - 1].nextSibling; 495 function insert(child, root) { 496 parent.insertBefore(child, root || sibling); 497 } 498 return parent.__k = { 499 nodeType: 1, 500 parentNode: parent, 501 firstChild: replaceNode[0], 502 childNodes: replaceNode, 503 insertBefore: insert, 504 appendChild: insert, 505 removeChild(c) { 506 parent.removeChild(c); 507 } 508 }; 509 }; 510 511 /** 512 * Transforms a kebab-case string to camelCase. 513 * 514 * @param str The kebab-case string to transform to camelCase. 515 * @return The transformed camelCase string. 516 */ 517 function kebabToCamelCase(str) { 518 return str.replace(/^-+|-+$/g, '').toLowerCase().replace(/-([a-z])/g, function (_match, group1) { 519 return group1.toUpperCase(); 520 }); 521 } 522 const logged = new Set(); 523 524 /** 525 * Shows a warning with `message` if environment is not `production`. 526 * 527 * Based on the `@wordpress/warning` package. 528 * 529 * @param message Message to show in the warning. 530 */ 531 const warn = message => { 532 if (true) { 533 if (logged.has(message)) { 534 return; 535 } 536 537 // eslint-disable-next-line no-console 538 console.warn(message); 539 540 // Throwing an error and catching it immediately to improve debugging 541 // A consumer can use 'pause on caught exceptions' 542 try { 543 throw Error(message); 544 } catch (e) { 545 // Do nothing. 546 } 547 logged.add(message); 548 } 549 }; 550 551 /** 552 * Checks if the passed `candidate` is a plain object with just the `Object` 553 * prototype. 554 * 555 * @param candidate The item to check. 556 * @return Whether `candidate` is a plain object. 557 */ 558 const isPlainObject = candidate => Boolean(candidate && typeof candidate === 'object' && candidate.constructor === Object); 559 560 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interactivity/build-module/proxies/registry.js 561 /** 562 * Proxies for each object. 563 */ 564 const objToProxy = new WeakMap(); 565 const proxyToObj = new WeakMap(); 566 567 /** 568 * Namespaces for each created proxy. 569 */ 570 const proxyToNs = new WeakMap(); 571 572 /** 573 * Object types that can be proxied. 574 */ 575 const supported = new Set([Object, Array]); 576 577 /** 578 * Returns a proxy to the passed object with the given handlers, assigning the 579 * specified namespace to it. If a proxy for the passed object was created 580 * before, that proxy is returned. 581 * 582 * @param namespace The namespace that will be associated to this proxy. 583 * @param obj The object to proxify. 584 * @param handlers Handlers that the proxy will use. 585 * 586 * @throws Error if the object cannot be proxified. Use {@link shouldProxy} to 587 * check if a proxy can be created for a specific object. 588 * 589 * @return The created proxy. 590 */ 591 const createProxy = (namespace, obj, handlers) => { 592 if (!shouldProxy(obj)) { 593 throw Error('This object cannot be proxified.'); 594 } 595 if (!objToProxy.has(obj)) { 596 const proxy = new Proxy(obj, handlers); 597 objToProxy.set(obj, proxy); 598 proxyToObj.set(proxy, obj); 599 proxyToNs.set(proxy, namespace); 600 } 601 return objToProxy.get(obj); 602 }; 603 604 /** 605 * Returns the proxy for the given object. If there is no associated proxy, the 606 * function returns `undefined`. 607 * 608 * @param obj Object from which to know the proxy. 609 * @return Associated proxy or `undefined`. 610 */ 611 const getProxyFromObject = obj => objToProxy.get(obj); 612 613 /** 614 * Gets the namespace associated with the given proxy. 615 * 616 * Proxies have a namespace assigned upon creation. See {@link createProxy}. 617 * 618 * @param proxy Proxy. 619 * @return Namespace. 620 */ 621 const getNamespaceFromProxy = proxy => proxyToNs.get(proxy); 622 623 /** 624 * Checks if a given object can be proxied. 625 * 626 * @param candidate Object to know whether it can be proxied. 627 * @return True if the passed instance can be proxied. 628 */ 629 const shouldProxy = candidate => { 630 if (typeof candidate !== 'object' || candidate === null) { 631 return false; 632 } 633 return !proxyToNs.has(candidate) && supported.has(candidate.constructor); 634 }; 635 636 /** 637 * Returns the target object for the passed proxy. If the passed object is not a registered proxy, the 638 * function returns `undefined`. 639 * 640 * @param proxy Proxy from which to know the target. 641 * @return The target object or `undefined`. 642 */ 643 const getObjectFromProxy = proxy => proxyToObj.get(proxy); 644 645 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interactivity/build-module/proxies/signals.js 646 /** 647 * External dependencies 648 */ 649 650 651 /** 652 * Internal dependencies 653 */ 654 655 656 657 658 659 /** 660 * Identifier for property computeds not associated to any scope. 661 */ 662 const NO_SCOPE = {}; 663 664 /** 665 * Structure that manages reactivity for a property in a state object. It uses 666 * signals to keep track of property value or getter modifications. 667 */ 668 class PropSignal { 669 /** 670 * Proxy that holds the property this PropSignal is associated with. 671 */ 672 673 /** 674 * Relation of computeds by scope. These computeds are read-only signals 675 * that depend on whether the property is a value or a getter and, 676 * therefore, can return different values depending on the scope in which 677 * the getter is accessed. 678 */ 679 680 /** 681 * Signal with the value assigned to the related property. 682 */ 683 684 /** 685 * Signal with the getter assigned to the related property. 686 */ 687 688 /** 689 * Structure that manages reactivity for a property in a state object, using 690 * signals to keep track of property value or getter modifications. 691 * 692 * @param owner Proxy that holds the property this instance is associated 693 * with. 694 */ 695 constructor(owner) { 696 this.owner = owner; 697 this.computedsByScope = new WeakMap(); 698 } 699 700 /** 701 * Changes the internal value. If a getter was set before, it is set to 702 * `undefined`. 703 * 704 * @param value New value. 705 */ 706 setValue(value) { 707 this.update({ 708 value 709 }); 710 } 711 712 /** 713 * Changes the internal getter. If a value was set before, it is set to 714 * `undefined`. 715 * 716 * @param getter New getter. 717 */ 718 setGetter(getter) { 719 this.update({ 720 get: getter 721 }); 722 } 723 724 /** 725 * Returns the computed that holds the result of evaluating the prop in the 726 * current scope. 727 * 728 * These computeds are read-only signals that depend on whether the property 729 * is a value or a getter and, therefore, can return different values 730 * depending on the scope in which the getter is accessed. 731 * 732 * @return Computed that depends on the scope. 733 */ 734 getComputed() { 735 const scope = getScope() || NO_SCOPE; 736 if (!this.valueSignal && !this.getterSignal) { 737 this.update({}); 738 } 739 if (!this.computedsByScope.has(scope)) { 740 const callback = () => { 741 const getter = this.getterSignal?.value; 742 return getter ? getter.call(this.owner) : this.valueSignal?.value; 743 }; 744 setNamespace(getNamespaceFromProxy(this.owner)); 745 this.computedsByScope.set(scope, signals_core_module_w(withScope(callback))); 746 resetNamespace(); 747 } 748 return this.computedsByScope.get(scope); 749 } 750 751 /** 752 * Update the internal signals for the value and the getter of the 753 * corresponding prop. 754 * 755 * @param param0 756 * @param param0.get New getter. 757 * @param param0.value New value. 758 */ 759 update({ 760 get, 761 value 762 }) { 763 if (!this.valueSignal) { 764 this.valueSignal = signals_core_module_d(value); 765 this.getterSignal = signals_core_module_d(get); 766 } else if (value !== this.valueSignal.peek() || get !== this.getterSignal.peek()) { 767 signals_core_module_r(() => { 768 this.valueSignal.value = value; 769 this.getterSignal.value = get; 770 }); 771 } 772 } 773 } 774 775 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interactivity/build-module/proxies/state.js 776 /** 777 * External dependencies 778 */ 779 780 781 /** 782 * Internal dependencies 783 */ 784 785 786 787 788 789 /** 790 * Set of built-in symbols. 791 */ 792 const wellKnownSymbols = new Set(Object.getOwnPropertyNames(Symbol).map(key => Symbol[key]).filter(value => typeof value === 'symbol')); 793 794 /** 795 * Relates each proxy with a map of {@link PropSignal} instances, representing 796 * the proxy's accessed properties. 797 */ 798 const proxyToProps = new WeakMap(); 799 800 /** 801 * Checks wether a {@link PropSignal | `PropSignal`} instance exists for the 802 * given property in the passed proxy. 803 * 804 * @param proxy Proxy of a state object or array. 805 * @param key The property key. 806 * @return `true` when it exists; false otherwise. 807 */ 808 const hasPropSignal = (proxy, key) => proxyToProps.has(proxy) && proxyToProps.get(proxy).has(key); 809 const readOnlyProxies = new WeakSet(); 810 811 /** 812 * Returns the {@link PropSignal | `PropSignal`} instance associated with the 813 * specified prop in the passed proxy. 814 * 815 * The `PropSignal` instance is generated if it doesn't exist yet, using the 816 * `initial` parameter to initialize the internal signals. 817 * 818 * @param proxy Proxy of a state object or array. 819 * @param key The property key. 820 * @param initial Initial data for the `PropSignal` instance. 821 * @return The `PropSignal` instance. 822 */ 823 const getPropSignal = (proxy, key, initial) => { 824 if (!proxyToProps.has(proxy)) { 825 proxyToProps.set(proxy, new Map()); 826 } 827 key = typeof key === 'number' ? `$key}` : key; 828 const props = proxyToProps.get(proxy); 829 if (!props.has(key)) { 830 const ns = getNamespaceFromProxy(proxy); 831 const prop = new PropSignal(proxy); 832 props.set(key, prop); 833 if (initial) { 834 const { 835 get, 836 value 837 } = initial; 838 if (get) { 839 prop.setGetter(get); 840 } else { 841 const readOnly = readOnlyProxies.has(proxy); 842 prop.setValue(shouldProxy(value) ? proxifyState(ns, value, { 843 readOnly 844 }) : value); 845 } 846 } 847 } 848 return props.get(key); 849 }; 850 851 /** 852 * Relates each proxied object (i.e., the original object) with a signal that 853 * tracks changes in the number of properties. 854 */ 855 const objToIterable = new WeakMap(); 856 857 /** 858 * When this flag is `true`, it avoids any signal subscription, overriding state 859 * props' "reactive" behavior. 860 */ 861 let peeking = false; 862 863 /** 864 * Handlers for reactive objects and arrays in the state. 865 */ 866 const stateHandlers = { 867 get(target, key, receiver) { 868 /* 869 * The property should not be reactive for the following cases: 870 * 1. While using the `peek` function to read the property. 871 * 2. The property exists but comes from the Object or Array prototypes. 872 * 3. The property key is a known symbol. 873 */ 874 if (peeking || !target.hasOwnProperty(key) && key in target || typeof key === 'symbol' && wellKnownSymbols.has(key)) { 875 return Reflect.get(target, key, receiver); 876 } 877 878 // At this point, the property should be reactive. 879 const desc = Object.getOwnPropertyDescriptor(target, key); 880 const prop = getPropSignal(receiver, key, desc); 881 const result = prop.getComputed().value; 882 883 /* 884 * Check if the property is a synchronous function. If it is, set the 885 * default namespace. Synchronous functions always run in the proper scope, 886 * which is set by the Directives component. 887 */ 888 if (typeof result === 'function') { 889 const ns = getNamespaceFromProxy(receiver); 890 return (...args) => { 891 setNamespace(ns); 892 try { 893 return result.call(receiver, ...args); 894 } finally { 895 resetNamespace(); 896 } 897 }; 898 } 899 return result; 900 }, 901 set(target, key, value, receiver) { 902 if (readOnlyProxies.has(receiver)) { 903 return false; 904 } 905 setNamespace(getNamespaceFromProxy(receiver)); 906 try { 907 return Reflect.set(target, key, value, receiver); 908 } finally { 909 resetNamespace(); 910 } 911 }, 912 defineProperty(target, key, desc) { 913 if (readOnlyProxies.has(getProxyFromObject(target))) { 914 return false; 915 } 916 const isNew = !(key in target); 917 const result = Reflect.defineProperty(target, key, desc); 918 if (result) { 919 const receiver = getProxyFromObject(target); 920 const prop = getPropSignal(receiver, key); 921 const { 922 get, 923 value 924 } = desc; 925 if (get) { 926 prop.setGetter(get); 927 } else { 928 const ns = getNamespaceFromProxy(receiver); 929 prop.setValue(shouldProxy(value) ? proxifyState(ns, value) : value); 930 } 931 if (isNew && objToIterable.has(target)) { 932 objToIterable.get(target).value++; 933 } 934 935 /* 936 * Modify the `length` property value only if the related 937 * `PropSignal` exists, which means that there are subscriptions to 938 * this property. 939 */ 940 if (Array.isArray(target) && proxyToProps.get(receiver)?.has('length')) { 941 const length = getPropSignal(receiver, 'length'); 942 length.setValue(target.length); 943 } 944 } 945 return result; 946 }, 947 deleteProperty(target, key) { 948 if (readOnlyProxies.has(getProxyFromObject(target))) { 949 return false; 950 } 951 const result = Reflect.deleteProperty(target, key); 952 if (result) { 953 const prop = getPropSignal(getProxyFromObject(target), key); 954 prop.setValue(undefined); 955 if (objToIterable.has(target)) { 956 objToIterable.get(target).value++; 957 } 958 } 959 return result; 960 }, 961 ownKeys(target) { 962 if (!objToIterable.has(target)) { 963 objToIterable.set(target, signals_core_module_d(0)); 964 } 965 /* 966 *This subscribes to the signal while preventing the minifier from 967 * deleting this line in production. 968 */ 969 objToIterable._ = objToIterable.get(target).value; 970 return Reflect.ownKeys(target); 971 } 972 }; 973 974 /** 975 * Returns the proxy associated with the given state object, creating it if it 976 * does not exist. 977 * 978 * @param namespace The namespace that will be associated to this proxy. 979 * @param obj The object to proxify. 980 * @param options Options. 981 * @param options.readOnly Read-only. 982 * 983 * @throws Error if the object cannot be proxified. Use {@link shouldProxy} to 984 * check if a proxy can be created for a specific object. 985 * 986 * @return The associated proxy. 987 */ 988 const proxifyState = (namespace, obj, options) => { 989 const proxy = createProxy(namespace, obj, stateHandlers); 990 if (options?.readOnly) { 991 readOnlyProxies.add(proxy); 992 } 993 return proxy; 994 }; 995 996 /** 997 * Reads the value of the specified property without subscribing to it. 998 * 999 * @param obj The object to read the property from. 1000 * @param key The property key. 1001 * @return The property value. 1002 */ 1003 const peek = (obj, key) => { 1004 peeking = true; 1005 try { 1006 return obj[key]; 1007 } finally { 1008 peeking = false; 1009 } 1010 }; 1011 1012 /** 1013 * Internal recursive implementation for {@link deepMerge | `deepMerge`}. 1014 * 1015 * @param target The target object. 1016 * @param source The source object containing new values and props. 1017 * @param override Whether existing props should be overwritten or not (`true` 1018 * by default). 1019 */ 1020 const deepMergeRecursive = (target, source, override = true) => { 1021 if (!(isPlainObject(target) && isPlainObject(source))) { 1022 return; 1023 } 1024 let hasNewKeys = false; 1025 for (const key in source) { 1026 const isNew = !(key in target); 1027 hasNewKeys = hasNewKeys || isNew; 1028 const desc = Object.getOwnPropertyDescriptor(source, key); 1029 const proxy = getProxyFromObject(target); 1030 const propSignal = !!proxy && hasPropSignal(proxy, key) && getPropSignal(proxy, key); 1031 if (typeof desc.get === 'function' || typeof desc.set === 'function') { 1032 if (override || isNew) { 1033 Object.defineProperty(target, key, { 1034 ...desc, 1035 configurable: true, 1036 enumerable: true 1037 }); 1038 if (desc.get && propSignal) { 1039 propSignal.setGetter(desc.get); 1040 } 1041 } 1042 } else if (isPlainObject(source[key])) { 1043 if (isNew || override && !isPlainObject(target[key])) { 1044 target[key] = {}; 1045 if (propSignal) { 1046 const ns = getNamespaceFromProxy(proxy); 1047 propSignal.setValue(proxifyState(ns, target[key])); 1048 } 1049 } 1050 if (isPlainObject(target[key])) { 1051 deepMergeRecursive(target[key], source[key], override); 1052 } 1053 } else if (override || isNew) { 1054 Object.defineProperty(target, key, desc); 1055 if (propSignal) { 1056 const { 1057 value 1058 } = desc; 1059 const ns = getNamespaceFromProxy(proxy); 1060 propSignal.setValue(shouldProxy(value) ? proxifyState(ns, value) : value); 1061 } 1062 } 1063 } 1064 if (hasNewKeys && objToIterable.has(target)) { 1065 objToIterable.get(target).value++; 1066 } 1067 }; 1068 1069 /** 1070 * Recursively update prop values inside the passed `target` and nested plain 1071 * objects, using the values present in `source`. References to plain objects 1072 * are kept, only updating props containing primitives or arrays. Arrays are 1073 * replaced instead of merged or concatenated. 1074 * 1075 * If the `override` parameter is set to `false`, then all values in `target` 1076 * are preserved, and only new properties from `source` are added. 1077 * 1078 * @param target The target object. 1079 * @param source The source object containing new values and props. 1080 * @param override Whether existing props should be overwritten or not (`true` 1081 * by default). 1082 */ 1083 const deepMerge = (target, source, override = true) => signals_core_module_r(() => deepMergeRecursive(getObjectFromProxy(target) || target, source, override)); 1084 1085 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interactivity/build-module/proxies/store.js 1086 /** 1087 * Internal dependencies 1088 */ 1089 1090 /** 1091 * External dependencies 1092 */ 1093 1094 1095 1096 /** 1097 * Identifies the store proxies handling the root objects of each store. 1098 */ 1099 const storeRoots = new WeakSet(); 1100 1101 /** 1102 * Handlers for store proxies. 1103 */ 1104 const storeHandlers = { 1105 get: (target, key, receiver) => { 1106 const result = Reflect.get(target, key); 1107 const ns = getNamespaceFromProxy(receiver); 1108 1109 /* 1110 * Check if the proxy is the store root and no key with that name exist. In 1111 * that case, return an empty object for the requested key. 1112 */ 1113 if (typeof result === 'undefined' && storeRoots.has(receiver)) { 1114 const obj = {}; 1115 Reflect.set(target, key, obj); 1116 return proxifyStore(ns, obj, false); 1117 } 1118 1119 /* 1120 * Check if the property is a function. If it is, add the store 1121 * namespace to the stack and wrap the function with the current scope. 1122 * The `withScope` util handles both synchronous functions and generator 1123 * functions. 1124 */ 1125 if (typeof result === 'function') { 1126 setNamespace(ns); 1127 const scoped = withScope(result); 1128 resetNamespace(); 1129 return scoped; 1130 } 1131 1132 // Check if the property is an object. If it is, proxyify it. 1133 if (isPlainObject(result) && shouldProxy(result)) { 1134 return proxifyStore(ns, result, false); 1135 } 1136 return result; 1137 } 1138 }; 1139 1140 /** 1141 * Returns the proxy associated with the given store object, creating it if it 1142 * does not exist. 1143 * 1144 * @param namespace The namespace that will be associated to this proxy. 1145 * @param obj The object to proxify. 1146 * 1147 * @param isRoot Whether the passed object is the store root object. 1148 * @throws Error if the object cannot be proxified. Use {@link shouldProxy} to 1149 * check if a proxy can be created for a specific object. 1150 * 1151 * @return The associated proxy. 1152 */ 1153 const proxifyStore = (namespace, obj, isRoot = true) => { 1154 const proxy = createProxy(namespace, obj, storeHandlers); 1155 if (proxy && isRoot) { 1156 storeRoots.add(proxy); 1157 } 1158 return proxy; 1159 }; 1160 1161 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interactivity/build-module/proxies/context.js 1162 const contextObjectToProxy = new WeakMap(); 1163 const contextObjectToFallback = new WeakMap(); 1164 const contextProxies = new WeakSet(); 1165 const descriptor = Reflect.getOwnPropertyDescriptor; 1166 1167 // TODO: Use the proxy registry to avoid multiple proxies on the same object. 1168 const contextHandlers = { 1169 get: (target, key) => { 1170 const fallback = contextObjectToFallback.get(target); 1171 // Always subscribe to prop changes in the current context. 1172 const currentProp = target[key]; 1173 1174 /* 1175 * Return the value from `target` if it exists, or from `fallback` 1176 * otherwise. This way, in the case the property doesn't exist either in 1177 * `target` or `fallback`, it also subscribes to changes in the parent 1178 * context. 1179 */ 1180 return key in target ? currentProp : fallback[key]; 1181 }, 1182 set: (target, key, value) => { 1183 const fallback = contextObjectToFallback.get(target); 1184 1185 // If the property exists in the current context, modify it. Otherwise, 1186 // add it to the current context. 1187 const obj = key in target || !(key in fallback) ? target : fallback; 1188 obj[key] = value; 1189 return true; 1190 }, 1191 ownKeys: target => [...new Set([...Object.keys(contextObjectToFallback.get(target)), ...Object.keys(target)])], 1192 getOwnPropertyDescriptor: (target, key) => descriptor(target, key) || descriptor(contextObjectToFallback.get(target), key) 1193 }; 1194 1195 /** 1196 * Wrap a context object with a proxy to reproduce the context stack. The proxy 1197 * uses the passed `inherited` context as a fallback to look up for properties 1198 * that don't exist in the given context. Also, updated properties are modified 1199 * where they are defined, or added to the main context when they don't exist. 1200 * 1201 * @param current Current context. 1202 * @param inherited Inherited context, used as fallback. 1203 * 1204 * @return The wrapped context object. 1205 */ 1206 const proxifyContext = (current, inherited = {}) => { 1207 if (contextProxies.has(current)) { 1208 throw Error('This object cannot be proxified.'); 1209 } 1210 // Update the fallback object reference when it changes. 1211 contextObjectToFallback.set(current, inherited); 1212 if (!contextObjectToProxy.has(current)) { 1213 const proxy = new Proxy(current, contextHandlers); 1214 contextObjectToProxy.set(current, proxy); 1215 contextProxies.add(proxy); 1216 } 1217 return contextObjectToProxy.get(current); 1218 }; 1219 1220 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interactivity/build-module/proxies/index.js 1221 /** 1222 * Internal dependencies 1223 */ 1224 1225 1226 1227 1228 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interactivity/build-module/store.js 1229 /** 1230 * Internal dependencies 1231 */ 1232 1233 /** 1234 * External dependencies 1235 */ 1236 1237 1238 const stores = new Map(); 1239 const rawStores = new Map(); 1240 const storeLocks = new Map(); 1241 const storeConfigs = new Map(); 1242 const serverStates = new Map(); 1243 1244 /** 1245 * Get the defined config for the store with the passed namespace. 1246 * 1247 * @param namespace Store's namespace from which to retrieve the config. 1248 * @return Defined config for the given namespace. 1249 */ 1250 const getConfig = namespace => storeConfigs.get(namespace || getNamespace()) || {}; 1251 1252 /** 1253 * Get the part of the state defined and updated from the server. 1254 * 1255 * The object returned is read-only, and includes the state defined in PHP with 1256 * `wp_interactivity_state()`. When using `actions.navigate()`, this object is 1257 * updated to reflect the changes in its properites, without affecting the state 1258 * returned by `store()`. Directives can subscribe to those changes to update 1259 * the state if needed. 1260 * 1261 * @example 1262 * ```js 1263 * const { state } = store('myStore', { 1264 * callbacks: { 1265 * updateServerState() { 1266 * const serverState = getServerState(); 1267 * // Override some property with the new value that came from the server. 1268 * state.overridableProp = serverState.overridableProp; 1269 * }, 1270 * }, 1271 * }); 1272 * ``` 1273 * 1274 * @param namespace Store's namespace from which to retrieve the server state. 1275 * @return The server state for the given namespace. 1276 */ 1277 const getServerState = namespace => { 1278 const ns = namespace || getNamespace(); 1279 if (!serverStates.has(ns)) { 1280 serverStates.set(ns, proxifyState(ns, {}, { 1281 readOnly: true 1282 })); 1283 } 1284 return serverStates.get(ns); 1285 }; 1286 const universalUnlock = 'I acknowledge that using a private store means my plugin will inevitably break on the next store release.'; 1287 1288 /** 1289 * Extends the Interactivity API global store adding the passed properties to 1290 * the given namespace. It also returns stable references to the namespace 1291 * content. 1292 * 1293 * These props typically consist of `state`, which is the reactive part of the 1294 * store ― which means that any directive referencing a state property will be 1295 * re-rendered anytime it changes ― and function properties like `actions` and 1296 * `callbacks`, mostly used for event handlers. These props can then be 1297 * referenced by any directive to make the HTML interactive. 1298 * 1299 * @example 1300 * ```js 1301 * const { state } = store( 'counter', { 1302 * state: { 1303 * value: 0, 1304 * get double() { return state.value * 2; }, 1305 * }, 1306 * actions: { 1307 * increment() { 1308 * state.value += 1; 1309 * }, 1310 * }, 1311 * } ); 1312 * ``` 1313 * 1314 * The code from the example above allows blocks to subscribe and interact with 1315 * the store by using directives in the HTML, e.g.: 1316 * 1317 * ```html 1318 * <div data-wp-interactive="counter"> 1319 * <button 1320 * data-wp-text="state.double" 1321 * data-wp-on--click="actions.increment" 1322 * > 1323 * 0 1324 * </button> 1325 * </div> 1326 * ``` 1327 * @param namespace The store namespace to interact with. 1328 * @param storePart Properties to add to the store namespace. 1329 * @param options Options for the given namespace. 1330 * 1331 * @return A reference to the namespace content. 1332 */ 1333 1334 function store(namespace, { 1335 state = {}, 1336 ...block 1337 } = {}, { 1338 lock = false 1339 } = {}) { 1340 if (!stores.has(namespace)) { 1341 // Lock the store if the passed lock is different from the universal 1342 // unlock. Once the lock is set (either false, true, or a given string), 1343 // it cannot change. 1344 if (lock !== universalUnlock) { 1345 storeLocks.set(namespace, lock); 1346 } 1347 const rawStore = { 1348 state: proxifyState(namespace, isPlainObject(state) ? state : {}), 1349 ...block 1350 }; 1351 const proxifiedStore = proxifyStore(namespace, rawStore); 1352 rawStores.set(namespace, rawStore); 1353 stores.set(namespace, proxifiedStore); 1354 } else { 1355 // Lock the store if it wasn't locked yet and the passed lock is 1356 // different from the universal unlock. If no lock is given, the store 1357 // will be public and won't accept any lock from now on. 1358 if (lock !== universalUnlock && !storeLocks.has(namespace)) { 1359 storeLocks.set(namespace, lock); 1360 } else { 1361 const storeLock = storeLocks.get(namespace); 1362 const isLockValid = lock === universalUnlock || lock !== true && lock === storeLock; 1363 if (!isLockValid) { 1364 if (!storeLock) { 1365 throw Error('Cannot lock a public store'); 1366 } else { 1367 throw Error('Cannot unlock a private store with an invalid lock code'); 1368 } 1369 } 1370 } 1371 const target = rawStores.get(namespace); 1372 deepMerge(target, block); 1373 deepMerge(target.state, state); 1374 } 1375 return stores.get(namespace); 1376 } 1377 const parseServerData = (dom = document) => { 1378 var _dom$getElementById; 1379 const jsonDataScriptTag = // Preferred Script Module data passing form 1380 (_dom$getElementById = dom.getElementById('wp-script-module-data-@wordpress/interactivity')) !== null && _dom$getElementById !== void 0 ? _dom$getElementById : 1381 // Legacy form 1382 dom.getElementById('wp-interactivity-data'); 1383 if (jsonDataScriptTag?.textContent) { 1384 try { 1385 return JSON.parse(jsonDataScriptTag.textContent); 1386 } catch {} 1387 } 1388 return {}; 1389 }; 1390 const populateServerData = data => { 1391 if (isPlainObject(data?.state)) { 1392 Object.entries(data.state).forEach(([namespace, state]) => { 1393 const st = store(namespace, {}, { 1394 lock: universalUnlock 1395 }); 1396 deepMerge(st.state, state, false); 1397 deepMerge(getServerState(namespace), state); 1398 }); 1399 } 1400 if (isPlainObject(data?.config)) { 1401 Object.entries(data.config).forEach(([namespace, config]) => { 1402 storeConfigs.set(namespace, config); 1403 }); 1404 } 1405 }; 1406 1407 // Parse and populate the initial state and config. 1408 const data = parseServerData(); 1409 populateServerData(data); 1410 1411 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interactivity/build-module/hooks.js 1412 // eslint-disable-next-line eslint-comments/disable-enable-pair 1413 /* eslint-disable react-hooks/exhaustive-deps */ 1414 1415 /** 1416 * External dependencies 1417 */ 1418 1419 1420 /** 1421 * Internal dependencies 1422 */ 1423 1424 1425 1426 function isNonDefaultDirectiveSuffix(entry) { 1427 return entry.suffix !== null; 1428 } 1429 function isDefaultDirectiveSuffix(entry) { 1430 return entry.suffix === null; 1431 } 1432 // Main context. 1433 const context = (0,preact_module/* createContext */.q6)({ 1434 client: {}, 1435 server: {} 1436 }); 1437 1438 // WordPress Directives. 1439 const directiveCallbacks = {}; 1440 const directivePriorities = {}; 1441 1442 /** 1443 * Register a new directive type in the Interactivity API runtime. 1444 * 1445 * @example 1446 * ```js 1447 * directive( 1448 * 'alert', // Name without the `data-wp-` prefix. 1449 * ( { directives: { alert }, element, evaluate } ) => { 1450 * const defaultEntry = alert.find( isDefaultDirectiveSuffix ); 1451 * element.props.onclick = () => { alert( evaluate( defaultEntry ) ); } 1452 * } 1453 * ) 1454 * ``` 1455 * 1456 * The previous code registers a custom directive type for displaying an alert 1457 * message whenever an element using it is clicked. The message text is obtained 1458 * from the store under the inherited namespace, using `evaluate`. 1459 * 1460 * When the HTML is processed by the Interactivity API, any element containing 1461 * the `data-wp-alert` directive will have the `onclick` event handler, e.g., 1462 * 1463 * ```html 1464 * <div data-wp-interactive="messages"> 1465 * <button data-wp-alert="state.alert">Click me!</button> 1466 * </div> 1467 * ``` 1468 * Note that, in the previous example, the directive callback gets the path 1469 * value (`state.alert`) from the directive entry with suffix `null`. A 1470 * custom suffix can also be specified by appending `--` to the directive 1471 * attribute, followed by the suffix, like in the following HTML snippet: 1472 * 1473 * ```html 1474 * <div data-wp-interactive="myblock"> 1475 * <button 1476 * data-wp-color--text="state.text" 1477 * data-wp-color--background="state.background" 1478 * >Click me!</button> 1479 * </div> 1480 * ``` 1481 * 1482 * This could be an hypothetical implementation of the custom directive used in 1483 * the snippet above. 1484 * 1485 * @example 1486 * ```js 1487 * directive( 1488 * 'color', // Name without prefix and suffix. 1489 * ( { directives: { color: colors }, ref, evaluate } ) => 1490 * colors.forEach( ( color ) => { 1491 * if ( color.suffix = 'text' ) { 1492 * ref.style.setProperty( 1493 * 'color', 1494 * evaluate( color.text ) 1495 * ); 1496 * } 1497 * if ( color.suffix = 'background' ) { 1498 * ref.style.setProperty( 1499 * 'background-color', 1500 * evaluate( color.background ) 1501 * ); 1502 * } 1503 * } ); 1504 * } 1505 * ) 1506 * ``` 1507 * 1508 * @param name Directive name, without the `data-wp-` prefix. 1509 * @param callback Function that runs the directive logic. 1510 * @param options Options object. 1511 * @param options.priority Option to control the directive execution order. The 1512 * lesser, the highest priority. Default is `10`. 1513 */ 1514 const directive = (name, callback, { 1515 priority = 10 1516 } = {}) => { 1517 directiveCallbacks[name] = callback; 1518 directivePriorities[name] = priority; 1519 }; 1520 1521 // Resolve the path to some property of the store object. 1522 const resolve = (path, namespace) => { 1523 if (!namespace) { 1524 warn(`Namespace missing for "$path}". The value for that path won't be resolved.`); 1525 return; 1526 } 1527 let resolvedStore = stores.get(namespace); 1528 if (typeof resolvedStore === 'undefined') { 1529 resolvedStore = store(namespace, undefined, { 1530 lock: universalUnlock 1531 }); 1532 } 1533 const current = { 1534 ...resolvedStore, 1535 context: getScope().context[namespace] 1536 }; 1537 try { 1538 // TODO: Support lazy/dynamically initialized stores 1539 return path.split('.').reduce((acc, key) => acc[key], current); 1540 } catch (e) {} 1541 }; 1542 1543 // Generate the evaluate function. 1544 const getEvaluate = ({ 1545 scope 1546 }) => (entry, ...args) => { 1547 let { 1548 value: path, 1549 namespace 1550 } = entry; 1551 if (typeof path !== 'string') { 1552 throw new Error('The `value` prop should be a string path'); 1553 } 1554 // If path starts with !, remove it and save a flag. 1555 const hasNegationOperator = path[0] === '!' && !!(path = path.slice(1)); 1556 setScope(scope); 1557 const value = resolve(path, namespace); 1558 const result = typeof value === 'function' ? value(...args) : value; 1559 resetScope(); 1560 return hasNegationOperator ? !result : result; 1561 }; 1562 1563 // Separate directives by priority. The resulting array contains objects 1564 // of directives grouped by same priority, and sorted in ascending order. 1565 const getPriorityLevels = directives => { 1566 const byPriority = Object.keys(directives).reduce((obj, name) => { 1567 if (directiveCallbacks[name]) { 1568 const priority = directivePriorities[name]; 1569 (obj[priority] = obj[priority] || []).push(name); 1570 } 1571 return obj; 1572 }, {}); 1573 return Object.entries(byPriority).sort(([p1], [p2]) => parseInt(p1) - parseInt(p2)).map(([, arr]) => arr); 1574 }; 1575 1576 // Component that wraps each priority level of directives of an element. 1577 const Directives = ({ 1578 directives, 1579 priorityLevels: [currentPriorityLevel, ...nextPriorityLevels], 1580 element, 1581 originalProps, 1582 previousScope 1583 }) => { 1584 // Initialize the scope of this element. These scopes are different per each 1585 // level because each level has a different context, but they share the same 1586 // element ref, state and props. 1587 const scope = A({}).current; 1588 scope.evaluate = q(getEvaluate({ 1589 scope 1590 }), []); 1591 const { 1592 client, 1593 server 1594 } = x(context); 1595 scope.context = client; 1596 scope.serverContext = server; 1597 /* eslint-disable react-hooks/rules-of-hooks */ 1598 scope.ref = previousScope?.ref || A(null); 1599 /* eslint-enable react-hooks/rules-of-hooks */ 1600 1601 // Create a fresh copy of the vnode element and add the props to the scope, 1602 // named as attributes (HTML Attributes). 1603 element = (0,preact_module/* cloneElement */.Ob)(element, { 1604 ref: scope.ref 1605 }); 1606 scope.attributes = element.props; 1607 1608 // Recursively render the wrapper for the next priority level. 1609 const children = nextPriorityLevels.length > 0 ? (0,preact_module.h)(Directives, { 1610 directives, 1611 priorityLevels: nextPriorityLevels, 1612 element, 1613 originalProps, 1614 previousScope: scope 1615 }) : element; 1616 const props = { 1617 ...originalProps, 1618 children 1619 }; 1620 const directiveArgs = { 1621 directives, 1622 props, 1623 element, 1624 context, 1625 evaluate: scope.evaluate 1626 }; 1627 setScope(scope); 1628 for (const directiveName of currentPriorityLevel) { 1629 const wrapper = directiveCallbacks[directiveName]?.(directiveArgs); 1630 if (wrapper !== undefined) { 1631 props.children = wrapper; 1632 } 1633 } 1634 resetScope(); 1635 return props.children; 1636 }; 1637 1638 // Preact Options Hook called each time a vnode is created. 1639 const old = preact_module/* options */.fF.vnode; 1640 preact_module/* options */.fF.vnode = vnode => { 1641 if (vnode.props.__directives) { 1642 const props = vnode.props; 1643 const directives = props.__directives; 1644 if (directives.key) { 1645 vnode.key = directives.key.find(isDefaultDirectiveSuffix).value; 1646 } 1647 delete props.__directives; 1648 const priorityLevels = getPriorityLevels(directives); 1649 if (priorityLevels.length > 0) { 1650 vnode.props = { 1651 directives, 1652 priorityLevels, 1653 originalProps: props, 1654 type: vnode.type, 1655 element: (0,preact_module.h)(vnode.type, props), 1656 top: true 1657 }; 1658 vnode.type = Directives; 1659 } 1660 } 1661 if (old) { 1662 old(vnode); 1663 } 1664 }; 1665 1666 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interactivity/build-module/directives.js 1667 // eslint-disable-next-line eslint-comments/disable-enable-pair 1668 /* eslint-disable react-hooks/exhaustive-deps */ 1669 1670 /** 1671 * External dependencies 1672 */ 1673 1674 1675 1676 /** 1677 * Internal dependencies 1678 */ 1679 1680 1681 1682 1683 1684 /** 1685 * Recursively clone the passed object. 1686 * 1687 * @param source Source object. 1688 * @return Cloned object. 1689 */ 1690 function deepClone(source) { 1691 if (isPlainObject(source)) { 1692 return Object.fromEntries(Object.entries(source).map(([key, value]) => [key, deepClone(value)])); 1693 } 1694 if (Array.isArray(source)) { 1695 return source.map(i => deepClone(i)); 1696 } 1697 return source; 1698 } 1699 const newRule = /(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g; 1700 const ruleClean = /\/\*[^]*?\*\/| +/g; 1701 const ruleNewline = /\n+/g; 1702 const empty = ' '; 1703 1704 /** 1705 * Convert a css style string into a object. 1706 * 1707 * Made by Cristian Bote (@cristianbote) for Goober. 1708 * https://unpkg.com/browse/goober@2.1.13/src/core/astish.js 1709 * 1710 * @param val CSS string. 1711 * @return CSS object. 1712 */ 1713 const cssStringToObject = val => { 1714 const tree = [{}]; 1715 let block, left; 1716 while (block = newRule.exec(val.replace(ruleClean, ''))) { 1717 if (block[4]) { 1718 tree.shift(); 1719 } else if (block[3]) { 1720 left = block[3].replace(ruleNewline, empty).trim(); 1721 tree.unshift(tree[0][left] = tree[0][left] || {}); 1722 } else { 1723 tree[0][block[1]] = block[2].replace(ruleNewline, empty).trim(); 1724 } 1725 } 1726 return tree[0]; 1727 }; 1728 1729 /** 1730 * Creates a directive that adds an event listener to the global window or 1731 * document object. 1732 * 1733 * @param type 'window' or 'document' 1734 */ 1735 const getGlobalEventDirective = type => { 1736 return ({ 1737 directives, 1738 evaluate 1739 }) => { 1740 directives[`on-$type}`].filter(isNonDefaultDirectiveSuffix).forEach(entry => { 1741 const eventName = entry.suffix.split('--', 1)[0]; 1742 useInit(() => { 1743 const cb = event => evaluate(entry, event); 1744 const globalVar = type === 'window' ? window : document; 1745 globalVar.addEventListener(eventName, cb); 1746 return () => globalVar.removeEventListener(eventName, cb); 1747 }); 1748 }); 1749 }; 1750 }; 1751 1752 /** 1753 * Creates a directive that adds an async event listener to the global window or 1754 * document object. 1755 * 1756 * @param type 'window' or 'document' 1757 */ 1758 const getGlobalAsyncEventDirective = type => { 1759 return ({ 1760 directives, 1761 evaluate 1762 }) => { 1763 directives[`on-async-$type}`].filter(isNonDefaultDirectiveSuffix).forEach(entry => { 1764 const eventName = entry.suffix.split('--', 1)[0]; 1765 useInit(() => { 1766 const cb = async event => { 1767 await splitTask(); 1768 evaluate(entry, event); 1769 }; 1770 const globalVar = type === 'window' ? window : document; 1771 globalVar.addEventListener(eventName, cb, { 1772 passive: true 1773 }); 1774 return () => globalVar.removeEventListener(eventName, cb); 1775 }); 1776 }); 1777 }; 1778 }; 1779 /* harmony default export */ const directives = (() => { 1780 // data-wp-context 1781 directive('context', ({ 1782 directives: { 1783 context 1784 }, 1785 props: { 1786 children 1787 }, 1788 context: inheritedContext 1789 }) => { 1790 const { 1791 Provider 1792 } = inheritedContext; 1793 const defaultEntry = context.find(isDefaultDirectiveSuffix); 1794 const { 1795 client: inheritedClient, 1796 server: inheritedServer 1797 } = x(inheritedContext); 1798 const ns = defaultEntry.namespace; 1799 const client = A(proxifyState(ns, {})); 1800 const server = A(proxifyState(ns, {}, { 1801 readOnly: true 1802 })); 1803 1804 // No change should be made if `defaultEntry` does not exist. 1805 const contextStack = T(() => { 1806 const result = { 1807 client: { 1808 ...inheritedClient 1809 }, 1810 server: { 1811 ...inheritedServer 1812 } 1813 }; 1814 if (defaultEntry) { 1815 const { 1816 namespace, 1817 value 1818 } = defaultEntry; 1819 // Check that the value is a JSON object. Send a console warning if not. 1820 if (!isPlainObject(value)) { 1821 warn(`The value of data-wp-context in "$namespace}" store must be a valid stringified JSON object.`); 1822 } 1823 deepMerge(client.current, deepClone(value), false); 1824 deepMerge(server.current, deepClone(value)); 1825 result.client[namespace] = proxifyContext(client.current, inheritedClient[namespace]); 1826 result.server[namespace] = proxifyContext(server.current, inheritedServer[namespace]); 1827 } 1828 return result; 1829 }, [defaultEntry, inheritedClient, inheritedServer]); 1830 return (0,preact_module.h)(Provider, { 1831 value: contextStack 1832 }, children); 1833 }, { 1834 priority: 5 1835 }); 1836 1837 // data-wp-watch--[name] 1838 directive('watch', ({ 1839 directives: { 1840 watch 1841 }, 1842 evaluate 1843 }) => { 1844 watch.forEach(entry => { 1845 useWatch(() => { 1846 let start; 1847 if (false) {} 1848 const result = evaluate(entry); 1849 if (false) {} 1850 return result; 1851 }); 1852 }); 1853 }); 1854 1855 // data-wp-init--[name] 1856 directive('init', ({ 1857 directives: { 1858 init 1859 }, 1860 evaluate 1861 }) => { 1862 init.forEach(entry => { 1863 // TODO: Replace with useEffect to prevent unneeded scopes. 1864 useInit(() => { 1865 let start; 1866 if (false) {} 1867 const result = evaluate(entry); 1868 if (false) {} 1869 return result; 1870 }); 1871 }); 1872 }); 1873 1874 // data-wp-on--[event] 1875 directive('on', ({ 1876 directives: { 1877 on 1878 }, 1879 element, 1880 evaluate 1881 }) => { 1882 const events = new Map(); 1883 on.filter(isNonDefaultDirectiveSuffix).forEach(entry => { 1884 const event = entry.suffix.split('--')[0]; 1885 if (!events.has(event)) { 1886 events.set(event, new Set()); 1887 } 1888 events.get(event).add(entry); 1889 }); 1890 events.forEach((entries, eventType) => { 1891 const existingHandler = element.props[`on$eventType}`]; 1892 element.props[`on$eventType}`] = event => { 1893 entries.forEach(entry => { 1894 if (existingHandler) { 1895 existingHandler(event); 1896 } 1897 let start; 1898 if (false) {} 1899 evaluate(entry, event); 1900 if (false) {} 1901 }); 1902 }; 1903 }); 1904 }); 1905 1906 // data-wp-on-async--[event] 1907 directive('on-async', ({ 1908 directives: { 1909 'on-async': onAsync 1910 }, 1911 element, 1912 evaluate 1913 }) => { 1914 const events = new Map(); 1915 onAsync.filter(isNonDefaultDirectiveSuffix).forEach(entry => { 1916 const event = entry.suffix.split('--')[0]; 1917 if (!events.has(event)) { 1918 events.set(event, new Set()); 1919 } 1920 events.get(event).add(entry); 1921 }); 1922 events.forEach((entries, eventType) => { 1923 const existingHandler = element.props[`on$eventType}`]; 1924 element.props[`on$eventType}`] = event => { 1925 if (existingHandler) { 1926 existingHandler(event); 1927 } 1928 entries.forEach(async entry => { 1929 await splitTask(); 1930 evaluate(entry, event); 1931 }); 1932 }; 1933 }); 1934 }); 1935 1936 // data-wp-on-window--[event] 1937 directive('on-window', getGlobalEventDirective('window')); 1938 // data-wp-on-document--[event] 1939 directive('on-document', getGlobalEventDirective('document')); 1940 1941 // data-wp-on-async-window--[event] 1942 directive('on-async-window', getGlobalAsyncEventDirective('window')); 1943 // data-wp-on-async-document--[event] 1944 directive('on-async-document', getGlobalAsyncEventDirective('document')); 1945 1946 // data-wp-class--[classname] 1947 directive('class', ({ 1948 directives: { 1949 class: classNames 1950 }, 1951 element, 1952 evaluate 1953 }) => { 1954 classNames.filter(isNonDefaultDirectiveSuffix).forEach(entry => { 1955 const className = entry.suffix; 1956 const result = evaluate(entry); 1957 const currentClass = element.props.class || ''; 1958 const classFinder = new RegExp(`(^|\\s)$className}(\\s|$)`, 'g'); 1959 if (!result) { 1960 element.props.class = currentClass.replace(classFinder, ' ').trim(); 1961 } else if (!classFinder.test(currentClass)) { 1962 element.props.class = currentClass ? `$currentClass} $className}` : className; 1963 } 1964 useInit(() => { 1965 /* 1966 * This seems necessary because Preact doesn't change the class 1967 * names on the hydration, so we have to do it manually. It doesn't 1968 * need deps because it only needs to do it the first time. 1969 */ 1970 if (!result) { 1971 element.ref.current.classList.remove(className); 1972 } else { 1973 element.ref.current.classList.add(className); 1974 } 1975 }); 1976 }); 1977 }); 1978 1979 // data-wp-style--[style-prop] 1980 directive('style', ({ 1981 directives: { 1982 style 1983 }, 1984 element, 1985 evaluate 1986 }) => { 1987 style.filter(isNonDefaultDirectiveSuffix).forEach(entry => { 1988 const styleProp = entry.suffix; 1989 const result = evaluate(entry); 1990 element.props.style = element.props.style || {}; 1991 if (typeof element.props.style === 'string') { 1992 element.props.style = cssStringToObject(element.props.style); 1993 } 1994 if (!result) { 1995 delete element.props.style[styleProp]; 1996 } else { 1997 element.props.style[styleProp] = result; 1998 } 1999 useInit(() => { 2000 /* 2001 * This seems necessary because Preact doesn't change the styles on 2002 * the hydration, so we have to do it manually. It doesn't need deps 2003 * because it only needs to do it the first time. 2004 */ 2005 if (!result) { 2006 element.ref.current.style.removeProperty(styleProp); 2007 } else { 2008 element.ref.current.style[styleProp] = result; 2009 } 2010 }); 2011 }); 2012 }); 2013 2014 // data-wp-bind--[attribute] 2015 directive('bind', ({ 2016 directives: { 2017 bind 2018 }, 2019 element, 2020 evaluate 2021 }) => { 2022 bind.filter(isNonDefaultDirectiveSuffix).forEach(entry => { 2023 const attribute = entry.suffix; 2024 const result = evaluate(entry); 2025 element.props[attribute] = result; 2026 2027 /* 2028 * This is necessary because Preact doesn't change the attributes on the 2029 * hydration, so we have to do it manually. It only needs to do it the 2030 * first time. After that, Preact will handle the changes. 2031 */ 2032 useInit(() => { 2033 const el = element.ref.current; 2034 2035 /* 2036 * We set the value directly to the corresponding HTMLElement instance 2037 * property excluding the following special cases. We follow Preact's 2038 * logic: https://github.com/preactjs/preact/blob/ea49f7a0f9d1ff2c98c0bdd66aa0cbc583055246/src/diff/props.js#L110-L129 2039 */ 2040 if (attribute === 'style') { 2041 if (typeof result === 'string') { 2042 el.style.cssText = result; 2043 } 2044 return; 2045 } else if (attribute !== 'width' && attribute !== 'height' && attribute !== 'href' && attribute !== 'list' && attribute !== 'form' && 2046 /* 2047 * The value for `tabindex` follows the parsing rules for an 2048 * integer. If that fails, or if the attribute isn't present, then 2049 * the browsers should "follow platform conventions to determine if 2050 * the element should be considered as a focusable area", 2051 * practically meaning that most elements get a default of `-1` (not 2052 * focusable), but several also get a default of `0` (focusable in 2053 * order after all elements with a positive `tabindex` value). 2054 * 2055 * @see https://html.spec.whatwg.org/#tabindex-value 2056 */ 2057 attribute !== 'tabIndex' && attribute !== 'download' && attribute !== 'rowSpan' && attribute !== 'colSpan' && attribute !== 'role' && attribute in el) { 2058 try { 2059 el[attribute] = result === null || result === undefined ? '' : result; 2060 return; 2061 } catch (err) {} 2062 } 2063 /* 2064 * aria- and data- attributes have no boolean representation. 2065 * A `false` value is different from the attribute not being 2066 * present, so we can't remove it. 2067 * We follow Preact's logic: https://github.com/preactjs/preact/blob/ea49f7a0f9d1ff2c98c0bdd66aa0cbc583055246/src/diff/props.js#L131C24-L136 2068 */ 2069 if (result !== null && result !== undefined && (result !== false || attribute[4] === '-')) { 2070 el.setAttribute(attribute, result); 2071 } else { 2072 el.removeAttribute(attribute); 2073 } 2074 }); 2075 }); 2076 }); 2077 2078 // data-wp-ignore 2079 directive('ignore', ({ 2080 element: { 2081 type: Type, 2082 props: { 2083 innerHTML, 2084 ...rest 2085 } 2086 } 2087 }) => { 2088 // Preserve the initial inner HTML. 2089 const cached = T(() => innerHTML, []); 2090 return (0,preact_module.h)(Type, { 2091 dangerouslySetInnerHTML: { 2092 __html: cached 2093 }, 2094 ...rest 2095 }); 2096 }); 2097 2098 // data-wp-text 2099 directive('text', ({ 2100 directives: { 2101 text 2102 }, 2103 element, 2104 evaluate 2105 }) => { 2106 const entry = text.find(isDefaultDirectiveSuffix); 2107 if (!entry) { 2108 element.props.children = null; 2109 return; 2110 } 2111 try { 2112 const result = evaluate(entry); 2113 element.props.children = typeof result === 'object' ? null : result.toString(); 2114 } catch (e) { 2115 element.props.children = null; 2116 } 2117 }); 2118 2119 // data-wp-run 2120 directive('run', ({ 2121 directives: { 2122 run 2123 }, 2124 evaluate 2125 }) => { 2126 run.forEach(entry => evaluate(entry)); 2127 }); 2128 2129 // data-wp-each--[item] 2130 directive('each', ({ 2131 directives: { 2132 each, 2133 'each-key': eachKey 2134 }, 2135 context: inheritedContext, 2136 element, 2137 evaluate 2138 }) => { 2139 if (element.type !== 'template') { 2140 return; 2141 } 2142 const { 2143 Provider 2144 } = inheritedContext; 2145 const inheritedValue = x(inheritedContext); 2146 const [entry] = each; 2147 const { 2148 namespace 2149 } = entry; 2150 const list = evaluate(entry); 2151 const itemProp = isNonDefaultDirectiveSuffix(entry) ? kebabToCamelCase(entry.suffix) : 'item'; 2152 return list.map(item => { 2153 const itemContext = proxifyContext(proxifyState(namespace, {}), inheritedValue.client[namespace]); 2154 const mergedContext = { 2155 client: { 2156 ...inheritedValue.client, 2157 [namespace]: itemContext 2158 }, 2159 server: { 2160 ...inheritedValue.server 2161 } 2162 }; 2163 2164 // Set the item after proxifying the context. 2165 mergedContext.client[namespace][itemProp] = item; 2166 const scope = { 2167 ...getScope(), 2168 context: mergedContext.client, 2169 serverContext: mergedContext.server 2170 }; 2171 const key = eachKey ? getEvaluate({ 2172 scope 2173 })(eachKey[0]) : item; 2174 return (0,preact_module.h)(Provider, { 2175 value: mergedContext, 2176 key 2177 }, element.props.content); 2178 }); 2179 }, { 2180 priority: 20 2181 }); 2182 directive('each-child', () => null, { 2183 priority: 1 2184 }); 2185 }); 2186 2187 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interactivity/build-module/constants.js 2188 const directivePrefix = 'wp'; 2189 2190 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interactivity/build-module/vdom.js 2191 /** 2192 * External dependencies 2193 */ 2194 2195 /** 2196 * Internal dependencies 2197 */ 2198 2199 2200 const ignoreAttr = `data-$directivePrefix}-ignore`; 2201 const islandAttr = `data-$directivePrefix}-interactive`; 2202 const fullPrefix = `data-$directivePrefix}-`; 2203 const namespaces = []; 2204 const currentNamespace = () => { 2205 var _namespaces; 2206 return (_namespaces = namespaces[namespaces.length - 1]) !== null && _namespaces !== void 0 ? _namespaces : null; 2207 }; 2208 const isObject = item => Boolean(item && typeof item === 'object' && item.constructor === Object); 2209 2210 // Regular expression for directive parsing. 2211 const directiveParser = new RegExp(`^data-$directivePrefix}-` + 2212 // ${p} must be a prefix string, like 'wp'. 2213 // Match alphanumeric characters including hyphen-separated 2214 // segments. It excludes underscore intentionally to prevent confusion. 2215 // E.g., "custom-directive". 2216 '([a-z0-9]+(?:-[a-z0-9]+)*)' + 2217 // (Optional) Match '--' followed by any alphanumeric charachters. It 2218 // excludes underscore intentionally to prevent confusion, but it can 2219 // contain multiple hyphens. E.g., "--custom-prefix--with-more-info". 2220 '(?:--([a-z0-9_-]+))?$', 'i' // Case insensitive. 2221 ); 2222 2223 // Regular expression for reference parsing. It can contain a namespace before 2224 // the reference, separated by `::`, like `some-namespace::state.somePath`. 2225 // Namespaces can contain any alphanumeric characters, hyphens, underscores or 2226 // forward slashes. References don't have any restrictions. 2227 const nsPathRegExp = /^([\w_\/-]+)::(.+)$/; 2228 const hydratedIslands = new WeakSet(); 2229 2230 /** 2231 * Recursive function that transforms a DOM tree into vDOM. 2232 * 2233 * @param root The root element or node to start traversing on. 2234 * @return The resulting vDOM tree. 2235 */ 2236 function toVdom(root) { 2237 const treeWalker = document.createTreeWalker(root, 205 // TEXT + CDATA_SECTION + COMMENT + PROCESSING_INSTRUCTION + ELEMENT 2238 ); 2239 function walk(node) { 2240 const { 2241 nodeType 2242 } = node; 2243 2244 // TEXT_NODE (3) 2245 if (nodeType === 3) { 2246 return [node.data]; 2247 } 2248 2249 // CDATA_SECTION_NODE (4) 2250 if (nodeType === 4) { 2251 var _nodeValue; 2252 const next = treeWalker.nextSibling(); 2253 node.replaceWith(new window.Text((_nodeValue = node.nodeValue) !== null && _nodeValue !== void 0 ? _nodeValue : '')); 2254 return [node.nodeValue, next]; 2255 } 2256 2257 // COMMENT_NODE (8) || PROCESSING_INSTRUCTION_NODE (7) 2258 if (nodeType === 8 || nodeType === 7) { 2259 const next = treeWalker.nextSibling(); 2260 node.remove(); 2261 return [null, next]; 2262 } 2263 const elementNode = node; 2264 const { 2265 attributes 2266 } = elementNode; 2267 const localName = elementNode.localName; 2268 const props = {}; 2269 const children = []; 2270 const directives = []; 2271 let ignore = false; 2272 let island = false; 2273 for (let i = 0; i < attributes.length; i++) { 2274 const attributeName = attributes[i].name; 2275 const attributeValue = attributes[i].value; 2276 if (attributeName[fullPrefix.length] && attributeName.slice(0, fullPrefix.length) === fullPrefix) { 2277 if (attributeName === ignoreAttr) { 2278 ignore = true; 2279 } else { 2280 var _regexResult$, _regexResult$2; 2281 const regexResult = nsPathRegExp.exec(attributeValue); 2282 const namespace = (_regexResult$ = regexResult?.[1]) !== null && _regexResult$ !== void 0 ? _regexResult$ : null; 2283 let value = (_regexResult$2 = regexResult?.[2]) !== null && _regexResult$2 !== void 0 ? _regexResult$2 : attributeValue; 2284 try { 2285 const parsedValue = JSON.parse(value); 2286 value = isObject(parsedValue) ? parsedValue : value; 2287 } catch {} 2288 if (attributeName === islandAttr) { 2289 island = true; 2290 const islandNamespace = 2291 // eslint-disable-next-line no-nested-ternary 2292 typeof value === 'string' ? value : typeof value?.namespace === 'string' ? value.namespace : null; 2293 namespaces.push(islandNamespace); 2294 } else { 2295 directives.push([attributeName, namespace, value]); 2296 } 2297 } 2298 } else if (attributeName === 'ref') { 2299 continue; 2300 } 2301 props[attributeName] = attributeValue; 2302 } 2303 if (ignore && !island) { 2304 return [(0,preact_module.h)(localName, { 2305 ...props, 2306 innerHTML: elementNode.innerHTML, 2307 __directives: { 2308 ignore: true 2309 } 2310 })]; 2311 } 2312 if (island) { 2313 hydratedIslands.add(elementNode); 2314 } 2315 if (directives.length) { 2316 props.__directives = directives.reduce((obj, [name, ns, value]) => { 2317 const directiveMatch = directiveParser.exec(name); 2318 if (directiveMatch === null) { 2319 warn(`Found malformed directive name: $name}.`); 2320 return obj; 2321 } 2322 const prefix = directiveMatch[1] || ''; 2323 const suffix = directiveMatch[2] || null; 2324 obj[prefix] = obj[prefix] || []; 2325 obj[prefix].push({ 2326 namespace: ns !== null && ns !== void 0 ? ns : currentNamespace(), 2327 value: value, 2328 suffix 2329 }); 2330 return obj; 2331 }, {}); 2332 } 2333 2334 // @ts-expect-error Fixed in upcoming preact release https://github.com/preactjs/preact/pull/4334 2335 if (localName === 'template') { 2336 props.content = [...elementNode.content.childNodes].map(childNode => toVdom(childNode)); 2337 } else { 2338 let child = treeWalker.firstChild(); 2339 if (child) { 2340 while (child) { 2341 const [vnode, nextChild] = walk(child); 2342 if (vnode) { 2343 children.push(vnode); 2344 } 2345 child = nextChild || treeWalker.nextSibling(); 2346 } 2347 treeWalker.parentNode(); 2348 } 2349 } 2350 2351 // Restore previous namespace. 2352 if (island) { 2353 namespaces.pop(); 2354 } 2355 return [(0,preact_module.h)(localName, props, children)]; 2356 } 2357 return walk(treeWalker.currentNode); 2358 } 2359 2360 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interactivity/build-module/init.js 2361 /** 2362 * External dependencies 2363 */ 2364 2365 /** 2366 * Internal dependencies 2367 */ 2368 2369 2370 2371 2372 // Keep the same root fragment for each interactive region node. 2373 const regionRootFragments = new WeakMap(); 2374 const getRegionRootFragment = region => { 2375 if (!region.parentElement) { 2376 throw Error('The passed region should be an element with a parent.'); 2377 } 2378 if (!regionRootFragments.has(region)) { 2379 regionRootFragments.set(region, createRootFragment(region.parentElement, region)); 2380 } 2381 return regionRootFragments.get(region); 2382 }; 2383 2384 // Initial vDOM regions associated with its DOM element. 2385 const initialVdom = new WeakMap(); 2386 2387 // Initialize the router with the initial DOM. 2388 const init = async () => { 2389 const nodes = document.querySelectorAll(`[data-$directivePrefix}-interactive]`); 2390 for (const node of nodes) { 2391 if (!hydratedIslands.has(node)) { 2392 await splitTask(); 2393 const fragment = getRegionRootFragment(node); 2394 const vdom = toVdom(node); 2395 initialVdom.set(node, vdom); 2396 await splitTask(); 2397 (0,preact_module/* hydrate */.Qv)(vdom, fragment); 2398 } 2399 } 2400 }; 2401 2402 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interactivity/build-module/index.js 2403 /** 2404 * External dependencies 2405 */ 2406 2407 2408 2409 /** 2410 * Internal dependencies 2411 */ 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 const requiredConsent = 'I acknowledge that using private APIs means my theme or plugin will inevitably break in the next version of WordPress.'; 2425 const privateApis = lock => { 2426 if (lock === requiredConsent) { 2427 return { 2428 directivePrefix: directivePrefix, 2429 getRegionRootFragment: getRegionRootFragment, 2430 initialVdom: initialVdom, 2431 toVdom: toVdom, 2432 directive: directive, 2433 getNamespace: getNamespace, 2434 h: preact_module.h, 2435 cloneElement: preact_module/* cloneElement */.Ob, 2436 render: preact_module/* render */.XX, 2437 proxifyState: proxifyState, 2438 parseServerData: parseServerData, 2439 populateServerData: populateServerData, 2440 batch: signals_core_module_r 2441 }; 2442 } 2443 throw new Error('Forbidden access.'); 2444 }; 2445 directives(); 2446 init(); 2447 2448 })(); 2449 2450 var __webpack_exports__getConfig = __webpack_exports__.zj; 2451 var __webpack_exports__getContext = __webpack_exports__.SD; 2452 var __webpack_exports__getElement = __webpack_exports__.V6; 2453 var __webpack_exports__getServerContext = __webpack_exports__.$K; 2454 var __webpack_exports__getServerState = __webpack_exports__.vT; 2455 var __webpack_exports__privateApis = __webpack_exports__.jb; 2456 var __webpack_exports__splitTask = __webpack_exports__.yT; 2457 var __webpack_exports__store = __webpack_exports__.M_; 2458 var __webpack_exports__useCallback = __webpack_exports__.hb; 2459 var __webpack_exports__useEffect = __webpack_exports__.vJ; 2460 var __webpack_exports__useInit = __webpack_exports__.ip; 2461 var __webpack_exports__useLayoutEffect = __webpack_exports__.Nf; 2462 var __webpack_exports__useMemo = __webpack_exports__.Kr; 2463 var __webpack_exports__useRef = __webpack_exports__.li; 2464 var __webpack_exports__useState = __webpack_exports__.J0; 2465 var __webpack_exports__useWatch = __webpack_exports__.FH; 2466 var __webpack_exports__withScope = __webpack_exports__.v4; 2467 export { __webpack_exports__getConfig as getConfig, __webpack_exports__getContext as getContext, __webpack_exports__getElement as getElement, __webpack_exports__getServerContext as getServerContext, __webpack_exports__getServerState as getServerState, __webpack_exports__privateApis as privateApis, __webpack_exports__splitTask as splitTask, __webpack_exports__store as store, __webpack_exports__useCallback as useCallback, __webpack_exports__useEffect as useEffect, __webpack_exports__useInit as useInit, __webpack_exports__useLayoutEffect as useLayoutEffect, __webpack_exports__useMemo as useMemo, __webpack_exports__useRef as useRef, __webpack_exports__useState as useState, __webpack_exports__useWatch as useWatch, __webpack_exports__withScope as withScope };
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated : Thu Nov 21 08:20:01 2024 | Cross-referenced by PHPXref |