import{wixContext as l}from"@wix/sdk-context";function d(i,t){return{...i,...Object.fromEntries(t.map(n=>[n,(...e)=>{let o=r();if(!o)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return o.initWixModules(i)[n].apply(void 0,e)}]))}}function c(i,t){return(...n)=>{let e=r();return e?e.initWixModules(i,t).apply(void 0,n):i.apply(void 0,n)}}function r(){let i=typeof $wixContext<"u"&&$wixContext.initWixModules?$wixContext.initWixModules:typeof globalThis.__wix_context__<"u"&&globalThis.__wix_context__.initWixModules?globalThis.__wix_context__.initWixModules:void 0;if(i)return{initWixModules(e,o){return u(()=>i(e,o))},fetchWithAuth(){throw new Error("fetchWithAuth is not available in this context")},graphql(){throw new Error("graphql is not available in this context")}};let t=typeof $wixContext<"u"?$wixContext.client:typeof l.client<"u"?l.client:typeof globalThis.__wix_context__<"u"?globalThis.__wix_context__.client:void 0,n=typeof $wixContext<"u"?$wixContext.elevatedClient:typeof l.elevatedClient<"u"?l.elevatedClient:typeof globalThis.__wix_context__<"u"?globalThis.__wix_context__.elevatedClient:void 0;if(!(!t&&!n))return{initWixModules(e,o){if(o){if(!n)throw new Error("An elevated client is required to use elevated modules. Make sure to initialize the Wix context with an elevated client before using elevated SDK modules");return u(()=>n.use(e))}if(!t)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return u(()=>t.use(e))},fetchWithAuth:(e,o)=>{if(!t)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return t.fetchWithAuth(e,o)},getAuth(){if(!t)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return t.auth},async graphql(e,o,x){if(!t)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return t.graphql(e,o,x)}}}function u(i){let t=globalThis.__wix_context__,n={client:l.client,elevatedClient:l.elevatedClient},e;globalThis.__wix_context__=void 0,l.client=void 0,l.elevatedClient=void 0,typeof $wixContext<"u"&&(e={client:$wixContext?.client,elevatedClient:$wixContext?.elevatedClient},delete $wixContext.client,delete $wixContext.elevatedClient);try{return i()}finally{globalThis.__wix_context__=t,l.client=n.client,l.elevatedClient=n.elevatedClient,typeof $wixContext<"u"&&($wixContext.client=e.client,$wixContext.elevatedClient=e.elevatedClient)}}export{d as a,c as b,u as c};
//# sourceMappingURL=chunk-NHYZDMR5.js.map