import{r as i,j as _}from"./wp-i18n-shim-DUX0OV_V.js";function $(e,x=[]){let o=[];function C(r,n){const t=i.createContext(n);t.displayName=r+"Context";const s=o.length;o=[...o,n];const m=a=>{var l;const{scope:c,children:S,...p}=a,d=((l=c==null?void 0:c[e])==null?void 0:l[s])||t,v=i.useMemo(()=>p,Object.values(p));return _.jsx(d.Provider,{value:v,children:S})};m.displayName=r+"Provider";function f(a,c){var d;const S=((d=c==null?void 0:c[e])==null?void 0:d[s])||t,p=i.useContext(S);if(p)return p;if(n!==void 0)return n;throw new Error(`\`${a}\` must be used within \`${r}\``)}return[m,f]}const u=()=>{const r=o.map(n=>i.createContext(n));return function(t){const s=(t==null?void 0:t[e])||r;return i.useMemo(()=>({[`__scope${e}`]:{...t,[e]:s}}),[t,s])}};return u.scopeName=e,[C,h(u,...x)]}function h(...e){const x=e[0];if(e.length===1)return x;const o=()=>{const C=e.map(u=>({useScope:u(),scopeName:u.scopeName}));return function(r){const n=C.reduce((t,{useScope:s,scopeName:m})=>{const a=s(r)[`__scope${m}`];return{...t,...a}},{});return i.useMemo(()=>({[`__scope${x.scopeName}`]:n}),[n])}};return o.scopeName=x.scopeName,o}export{$ as c};
//# sourceMappingURL=index-BrYiunaL.js.map
