@wix/stores 1.0.959 → 1.0.960

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (121) hide show
  1. package/_sdk-exports/context-category-by-id-context-provider/runtime.d.ts +4026 -0
  2. package/_sdk-exports/context-category-by-id-context-provider/runtime.js +2 -0
  3. package/_sdk-exports/context-category-by-slug-context-provider/runtime.d.ts +4046 -0
  4. package/_sdk-exports/context-category-by-slug-context-provider/runtime.js +2 -0
  5. package/_sdk-exports/context-category-info-context-provider/runtime.d.ts +3530 -0
  6. package/_sdk-exports/context-category-info-context-provider/runtime.js +2 -0
  7. package/_sdk-exports/context-category-list-context-provider/runtime.d.ts +101 -0
  8. package/_sdk-exports/context-category-list-context-provider/runtime.js +2 -0
  9. package/_sdk-exports/context-product-by-id-context-provider/runtime.d.ts +4221 -0
  10. package/_sdk-exports/context-product-by-id-context-provider/runtime.js +2 -0
  11. package/_sdk-exports/context-product-by-slug-context-provider/runtime.d.ts +4217 -0
  12. package/_sdk-exports/context-product-by-slug-context-provider/runtime.js +2 -0
  13. package/_sdk-exports/context-product-context-provider/runtime.d.ts +4449 -0
  14. package/_sdk-exports/context-product-context-provider/runtime.js +2 -0
  15. package/_sdk-exports/context-product-item-context-provider/runtime.d.ts +4102 -0
  16. package/_sdk-exports/context-product-item-context-provider/runtime.js +2 -0
  17. package/_sdk-exports/context-product-list-context-provider/runtime.d.ts +3969 -0
  18. package/_sdk-exports/context-product-list-context-provider/runtime.js +2 -0
  19. package/_sdk-exports/context-promotion-item-context-provider/runtime.d.ts +85 -0
  20. package/_sdk-exports/context-promotion-item-context-provider/runtime.js +2 -0
  21. package/build/cjs/context-category-by-id-context-provider.d.ts +4026 -0
  22. package/build/cjs/context-category-by-id-context-provider.js +3572 -0
  23. package/build/cjs/context-category-by-id-context-provider.js.map +1 -0
  24. package/build/cjs/context-category-by-slug-context-provider.d.ts +4046 -0
  25. package/build/cjs/context-category-by-slug-context-provider.js +3674 -0
  26. package/build/cjs/context-category-by-slug-context-provider.js.map +1 -0
  27. package/build/cjs/context-category-info-context-provider.d.ts +3530 -0
  28. package/build/cjs/context-category-info-context-provider.js +1201 -0
  29. package/build/cjs/context-category-info-context-provider.js.map +1 -0
  30. package/build/cjs/context-category-list-context-provider.d.ts +101 -0
  31. package/build/cjs/context-category-list-context-provider.js +587 -0
  32. package/build/cjs/context-category-list-context-provider.js.map +1 -0
  33. package/build/cjs/context-product-by-id-context-provider.d.ts +4221 -0
  34. package/build/cjs/context-product-by-id-context-provider.js +3454 -0
  35. package/build/cjs/context-product-by-id-context-provider.js.map +1 -0
  36. package/build/cjs/context-product-by-slug-context-provider.d.ts +4217 -0
  37. package/build/cjs/context-product-by-slug-context-provider.js +3477 -0
  38. package/build/cjs/context-product-by-slug-context-provider.js.map +1 -0
  39. package/build/cjs/context-product-context-provider.d.ts +4449 -0
  40. package/build/cjs/context-product-context-provider.js +587 -0
  41. package/build/cjs/context-product-context-provider.js.map +1 -0
  42. package/build/cjs/context-product-item-context-provider.d.ts +4102 -0
  43. package/build/cjs/context-product-item-context-provider.js +4396 -0
  44. package/build/cjs/context-product-item-context-provider.js.map +1 -0
  45. package/build/cjs/context-product-list-context-provider.d.ts +3970 -0
  46. package/build/cjs/context-product-list-context-provider.js +587 -0
  47. package/build/cjs/context-product-list-context-provider.js.map +1 -0
  48. package/build/cjs/context-promotion-item-context-provider.d.ts +85 -0
  49. package/build/cjs/context-promotion-item-context-provider.js +592 -0
  50. package/build/cjs/context-promotion-item-context-provider.js.map +1 -0
  51. package/build/es/context-category-by-id-context-provider.d.mts +4026 -0
  52. package/build/es/context-category-by-id-context-provider.mjs +3532 -0
  53. package/build/es/context-category-by-id-context-provider.mjs.map +1 -0
  54. package/build/es/context-category-by-slug-context-provider.d.mts +4046 -0
  55. package/build/es/context-category-by-slug-context-provider.mjs +3634 -0
  56. package/build/es/context-category-by-slug-context-provider.mjs.map +1 -0
  57. package/build/es/context-category-info-context-provider.d.mts +3530 -0
  58. package/build/es/context-category-info-context-provider.mjs +1172 -0
  59. package/build/es/context-category-info-context-provider.mjs.map +1 -0
  60. package/build/es/context-category-list-context-provider.d.mts +101 -0
  61. package/build/es/context-category-list-context-provider.mjs +558 -0
  62. package/build/es/context-category-list-context-provider.mjs.map +1 -0
  63. package/build/es/context-product-by-id-context-provider.d.mts +4221 -0
  64. package/build/es/context-product-by-id-context-provider.mjs +3415 -0
  65. package/build/es/context-product-by-id-context-provider.mjs.map +1 -0
  66. package/build/es/context-product-by-slug-context-provider.d.mts +4217 -0
  67. package/build/es/context-product-by-slug-context-provider.mjs +3437 -0
  68. package/build/es/context-product-by-slug-context-provider.mjs.map +1 -0
  69. package/build/es/context-product-context-provider.d.mts +4449 -0
  70. package/build/es/context-product-context-provider.mjs +558 -0
  71. package/build/es/context-product-context-provider.mjs.map +1 -0
  72. package/build/es/context-product-item-context-provider.d.mts +4102 -0
  73. package/build/es/context-product-item-context-provider.mjs +4356 -0
  74. package/build/es/context-product-item-context-provider.mjs.map +1 -0
  75. package/build/es/context-product-list-context-provider.d.mts +3970 -0
  76. package/build/es/context-product-list-context-provider.mjs +558 -0
  77. package/build/es/context-product-list-context-provider.mjs.map +1 -0
  78. package/build/es/context-promotion-item-context-provider.d.mts +85 -0
  79. package/build/es/context-promotion-item-context-provider.mjs +563 -0
  80. package/build/es/context-promotion-item-context-provider.mjs.map +1 -0
  81. package/build/internal/cjs/context-category-by-id-context-provider.d.ts +4026 -0
  82. package/build/internal/cjs/context-category-by-slug-context-provider.d.ts +4046 -0
  83. package/build/internal/cjs/context-category-info-context-provider.d.ts +3530 -0
  84. package/build/internal/cjs/context-category-list-context-provider.d.ts +101 -0
  85. package/build/internal/cjs/context-product-by-id-context-provider.d.ts +4221 -0
  86. package/build/internal/cjs/context-product-by-slug-context-provider.d.ts +4217 -0
  87. package/build/internal/cjs/context-product-context-provider.d.ts +4449 -0
  88. package/build/internal/cjs/context-product-item-context-provider.d.ts +4102 -0
  89. package/build/internal/cjs/context-product-list-context-provider.d.ts +3970 -0
  90. package/build/internal/cjs/context-promotion-item-context-provider.d.ts +85 -0
  91. package/build/internal/es/context-category-by-id-context-provider.d.mts +4026 -0
  92. package/build/internal/es/context-category-by-slug-context-provider.d.mts +4046 -0
  93. package/build/internal/es/context-category-info-context-provider.d.mts +3530 -0
  94. package/build/internal/es/context-category-list-context-provider.d.mts +101 -0
  95. package/build/internal/es/context-product-by-id-context-provider.d.mts +4221 -0
  96. package/build/internal/es/context-product-by-slug-context-provider.d.mts +4217 -0
  97. package/build/internal/es/context-product-context-provider.d.mts +4449 -0
  98. package/build/internal/es/context-product-item-context-provider.d.mts +4102 -0
  99. package/build/internal/es/context-product-list-context-provider.d.mts +3970 -0
  100. package/build/internal/es/context-promotion-item-context-provider.d.mts +85 -0
  101. package/category-by-id-context-provider/package.json +3 -0
  102. package/category-by-slug-context-provider/package.json +3 -0
  103. package/category-info-context-provider/package.json +3 -0
  104. package/category-list-context-provider/package.json +3 -0
  105. package/context/category-by-id-context-provider/package.json +3 -0
  106. package/context/category-by-slug-context-provider/package.json +3 -0
  107. package/context/category-info-context-provider/package.json +3 -0
  108. package/context/category-list-context-provider/package.json +3 -0
  109. package/context/product-by-id-context-provider/package.json +3 -0
  110. package/context/product-by-slug-context-provider/package.json +3 -0
  111. package/context/product-context-provider/package.json +3 -0
  112. package/context/product-item-context-provider/package.json +3 -0
  113. package/context/product-list-context-provider/package.json +3 -0
  114. package/context/promotion-item-context-provider/package.json +3 -0
  115. package/package.json +159 -24
  116. package/product-by-id-context-provider/package.json +3 -0
  117. package/product-by-slug-context-provider/package.json +3 -0
  118. package/product-context-provider/package.json +3 -0
  119. package/product-item-context-provider/package.json +3 -0
  120. package/product-list-context-provider/package.json +3 -0
  121. package/promotion-item-context-provider/package.json +3 -0
@@ -0,0 +1,2 @@
1
+ import{Suspense as e,createContext as t,useCallback as n,useContext as r,useMemo as i,useState as a}from"react";import{useGetService as o,useService as s}from"@wix/services-manager-react";import{jsx as c}from"react/jsx-runtime";var l={};function u(e,t=!1,n=e=>e){return()=>({__type:`event-definition`,type:e,isDomainEvent:t,transformations:n})}var d=e=>{switch(e){case`get`:case`GET`:return`GET`;case`post`:case`POST`:return`POST`;case`put`:case`PUT`:return`PUT`;case`delete`:case`DELETE`:return`DELETE`;case`patch`:case`PATCH`:return`PATCH`;case`head`:case`HEAD`:return`HEAD`;case`options`:case`OPTIONS`:return`OPTIONS`;default:throw Error(`Unknown method: ${e}`)}},ee=e=>t=>async n=>{let r,i=t=>{if(r=e(n)(t),r.url===void 0)throw Error(`Url was not successfully created for this request, please reach out to support channels for assistance.`);let{method:i,url:a,params:o}=r;return{...r,method:d(i),url:a,data:r.data,params:o}};try{let e=await t.request(i);if(r===void 0)throw Error(`Request options were not created for this request, please reach out to support channels for assistance.`);let n=Array.isArray(r.transformResponse)?r.transformResponse:[r.transformResponse],a=e.data;return n.forEach(t=>{t&&(a=t(e.data,e.headers))}),a}catch(e){throw typeof e==`object`&&e&&`response`in e&&typeof e.response==`object`&&e.response!==null&&`data`in e.response?e.response.data:e}},te=e=>e.__isAmbassador?!0:!!e().__isAmbassador,ne=`__metadata`,re=`edge.wixapis.com`,ie=class extends Error{message;response;constructor(e,t){super(e),this.message=e,this.response=t}async details(){let e=await this.response.json();return f(this.response.status,e?.message,e?.details,{requestId:this.response.headers.get(`X-Wix-Request-Id`),details:e})}},f=(e,t,n,r)=>({details:{...!n?.validationError&&{applicationError:{description:t,code:e,data:r}},...n},message:t,requestId:r?.requestId}),ae=e=>e?.method&&[`post`,`put`,`patch`].includes(e.method.toLocaleLowerCase())&&e.body?{"Content-Type":`application/json`}:{},oe=e=>e&&typeof e==`object`&&!Array.isArray(e),se=e=>e.__type===`host`;function ce(e,t){return e.create(t)}var p=`x-wix-bi-gateway`;function m(e,t,n){return{[p]:le({environment:`js-sdk${n?`-${n}`:``}`,"package-name":e.packageName??t?.PACKAGE_NAME,"method-fqn":e.methodFqn,entity:e.entityFqdn})}}function le(e){return Object.entries(e).filter(([e,t])=>!!t).map(([e,t])=>`${e}=${t}`).join(`,`)}function h(e){let t=globalThis.__wix_context__,n={client:l.client,elevatedClient:l.elevatedClient},r;globalThis.__wix_context__=void 0,l.client=void 0,l.elevatedClient=void 0,typeof $wixContext<`u`&&(r={client:$wixContext?.client,elevatedClient:$wixContext?.elevatedClient},delete $wixContext.client,delete $wixContext.elevatedClient);try{return e()}finally{globalThis.__wix_context__=t,l.client=n.client,l.elevatedClient=n.elevatedClient,typeof $wixContext<`u`&&($wixContext.client=r.client,$wixContext.elevatedClient=r.elevatedClient)}}var g={id:`_id`,createdDate:`_createdDate`,updatedDate:`_updatedDate`};function _(e){return pe(e).map(e=>e.toLocaleUpperCase()).join(`_`)}var ue=/([\p{Ll}\d])(\p{Lu})/gu,de=/(\p{Lu})([\p{Lu}][\p{Ll}])/gu,v=`$1\0$2`,fe=/[^\p{L}\d]+/giu;function pe(e){let t=e.trim();t=t.replace(ue,v).replace(de,v),t=t.replace(fe,`\0`);let n=0,r=t.length;for(;t.charAt(n)===`\0`;)n++;if(n===r)return[];for(;t.charAt(r-1)===`\0`;)r--;return t.slice(n,r).split(/\0/g)}var me=e=>`validationError`in(e.response?.data?.details??{}),he=e=>`applicationError`in(e.response?.data?.details??{}),ge=e=>(e.response?.status??-1)>=400&&(e.response?.status??-1)<500;function _e(e,t={explicitPathsToArguments:{},spreadPathsToArguments:{},singleArgumentUnchanged:!1},n=[]){if(typeof e!=`object`||!e)throw e;if(me(e))return ve(e,t,n);if(he(e))return ye(e);if(ge(e)){let t=e.response?.status,n=e.response?.statusText??`UNKNOWN`,r=e.response?.data?.message??n,i={applicationError:{description:n,code:_(n),data:{}},requestId:e.requestId};return y(e,{message:JSON.stringify({message:r,details:i},null,2),extraProperties:{details:i,status:t}})}return be(e)}var ve=(e,t,n)=>{let r=e.response?.data,i=e.requestId,{fieldViolations:a}=r.details.validationError,o=xe(t,a,n)?.sort((e,t)=>e.field<t.field?-1:1),s=`INVALID_ARGUMENT: ${o?.map(({field:e,description:t})=>`"${e}" ${t}`)?.join(`, `)}`,c={validationError:{fieldViolations:o},requestId:i};return y(e,{message:JSON.stringify({message:s,details:c},null,2),extraProperties:{details:c,status:e.response?.status,requestId:i}})},y=(e,{message:t,extraProperties:n})=>Object.assign(e,{...n,message:t}),ye=e=>{let t=e.response?.status,n=e.response?.statusText??`UNKNOWN`,r=e.response?.data?.message??n,i=e.response?.data?.details?.applicationError?.description??n,a=e.response?.data?.details?.applicationError?.code??_(n),o=e.response?.data?.details?.applicationError?.data??{},s=r===i?r:`${r}: ${i}`,c={applicationError:{description:i,code:a,data:o},requestId:e.requestId};return y(e,{message:JSON.stringify({message:s,details:c},null,2),extraProperties:{details:c,status:t,requestId:e.requestId}})},be=e=>y(e,{message:e.requestId?`System error occurred, request-id: ${e.requestId}`:`System error occurred: ${JSON.stringify(e)}`,extraProperties:{requestId:e.requestId,status:e.response?.status,code:_(e.response?.statusText??`UNKNOWN`),...!e.response&&{runtimeError:e}}}),xe=({spreadPathsToArguments:e,explicitPathsToArguments:t,singleArgumentUnchanged:n},r,i)=>{let a={...e,...t},o=Object.keys(a);return r?.filter(e=>!r.some(t=>t.field.length>e.field.length&&t.field.startsWith(e.field)&&o.includes(t.field))).map(e=>{let r=t[e.field];if(r)return{...e,field:b(r,i)};let s=o?.sort((e,t)=>t.length-e.length)?.find(t=>e.field.startsWith(t));if(s){let t=a[s];if(t)return{...e,field:e.field.replace(s,b(t,i))}}return n?{...e,field:`${i[0]}.${e.field}`}:e})},b=(e,t)=>{let n=Se(e);return n==null?e:e.replace(`$[${n}]`,t[n])},Se=e=>{let t=e.match(/\$\[(?<argIndex>\d+)\]/);return t&&t.groups&&Number(t.groups.argIndex)};function Ce(e,t,n,r,i,a,o,s,c,l,u){return h(()=>e({request:async e=>{let i=e({host:s?.HTTPHost||`www.wixapis.com`}),a=i;a.method===`GET`&&a.fallback?.length&&(a.params?.toString().length??0)>4e3&&(a=i.fallback[0]);let o=s?.HTTPHost??`www.wixapis.com`,u=`https://${l?re:o}${a.url}`;a.params&&a.params.toString()&&(u+=`?${a.params.toString()}`);try{let e=m(i,t,c),o={method:a.method,...a.data&&{body:JSON.stringify(a.data)},headers:{...e}},s=await n(u,o);if(s.status!==200){let e=null;try{e=await s.json()}catch{}let t=Te(s.status,e?.message??s.statusText,e?.details,{requestId:s.headers.get(`X-Wix-Request-Id`),details:e}),n=_e(t);throw r?.handleError(n,{requestOptions:{url:a.url,method:a.method,entityFqdn:i.entityFqdn,methodFqn:i.methodFqn}}),t}let l=await s.json();return{data:a.migrationOptions?.optInTransformResponse&&a.transformResponse?Array.isArray(a.transformResponse)?a.transformResponse[0](l):a.transformResponse(l):l,headers:s.headers,status:s.status,statusText:s.statusText}}catch(e){throw e.message?.includes(`fetch is not defined`)&&console.error(`Node.js v18+ is required`),e}},fetchWithAuth:n,wixAPIFetch:i,getActiveToken:a,getAuthHeaders:o},{validateRequestSchema:u}))}var we=class extends Error{response;requestId;constructor(e){super(),this.response=e.response,this.requestId=e.requestId}},Te=(e,t,n,r)=>new we({response:{data:{details:{...!n?.validationError&&{applicationError:{description:t,code:e,data:r}},...n},message:t},status:e},requestId:r?.requestId}),Ee=`.`;function De(e,t,n){if(e==null)throw Error(`Cannot set value on null or undefined`);let r=x(t),i=e;for(let e=0;e<r.length;e++){let t=r[e];if(e===r.length-1){i[t]=n;break}let a=r[e+1];(!(t in i)||i[t]==null||typeof i[t]!=`object`||i[t]===null)&&(i[t]=typeof a==`number`?[]:{}),i=i[t]}return e}function x(e){return Array.isArray(e)?e:e.split(Ee).map(e=>Oe(e)?Number(e):e)}function Oe(e){return/^\d+$/.test(e)}function ke(e){let t={};for(let[n,r]of Object.entries(e))Ae(n)||De(t,x(n),r);return t}function Ae(e){return e===`__proto__`||e===`constructor`||e===`prototype`}var je=class{BRACKET_PATTERN=/\[(\d+)\]/g;NUMERIC_PATTERN=/^\d+$/;ESCAPED_DOT_PATTERN=/\\\./g;ESCAPED_LEFT_BRACKET_PATTERN=/\\\[/g;ESCAPED_RIGHT_BRACKET_PATTERN=/\\\]/g;SPLIT_PATTERN=/\.|\[(\d+)\]/g;DOT_BEFORE_BRACKET_PATTERN=/\.\[/g;ESCAPED_DOT_PLACEHOLDER=`__DOT__`;ESCAPED_RIGHT_BRACKET_PLACEHOLDER=`__RB__`;ESCAPED_LEFT_BRACKET_PLACEHOLDER=`__LB__`;modifiedFields;cleanedModifiedFields;constructor(e){this.modifiedFields=e}replaceEscapedCharacters(e){return e.replace(this.ESCAPED_DOT_PATTERN,this.ESCAPED_DOT_PLACEHOLDER).replace(this.ESCAPED_LEFT_BRACKET_PATTERN,this.ESCAPED_LEFT_BRACKET_PLACEHOLDER).replace(this.ESCAPED_RIGHT_BRACKET_PATTERN,this.ESCAPED_RIGHT_BRACKET_PLACEHOLDER)}restoreEscapedCharacters(e){return e.replace(this.ESCAPED_DOT_PLACEHOLDER,`\\.`).replace(this.ESCAPED_RIGHT_BRACKET_PLACEHOLDER,`\\]`).replace(this.ESCAPED_LEFT_BRACKET_PLACEHOLDER,`\\[`)}unflatten(){return this.cleanedModifiedFields=Object.fromEntries(Object.entries(this.modifiedFields).map(([e,t])=>[this.replaceEscapedCharacters(this.bracketToDotNotation(e)),t])),ke(this.cleanedModifiedFields)}flatten(e){let t={};for(let n of Object.keys(this.cleanedModifiedFields)){let r=this.splitPath(n),i=this.navigatePath(e,r);t={...t,...i}}return Object.fromEntries(Object.entries(t).map(([e,t])=>[this.restoreEscapedCharacters(e),t]))}splitPath(e){let t=[],n=0,r=Array.from(e.matchAll(this.SPLIT_PATTERN));for(let i of r)i.index>n&&t.push(e.substring(n,i.index)),i[1]&&t.push(i[1]),n=i.index+i[0].length;return n<e.length&&t.push(e.substring(n)),t}navigatePath(e,t){let n=e,r=[],i=e=>{if(!Array.isArray(n))throw Error(`Expected array at path ${this.buildPathString(r)}, but got ${typeof n}`);r.push(`[${e}]`),n=n[parseInt(e,10)]},a=(e,t)=>{let i=e in g?g[e]:void 0;if(i&&i in t){r.push(i),n=t[i];return}let a=Fe(e);if(a&&a in t){r.push(a),n=t[a];return}throw Error(`Cannot find key '${e}' or its transformations at path ${this.buildPathString(r)}`)},o=(e,t)=>{r.push(e),n=t[e]};for(let e of t){if(this.NUMERIC_PATTERN.test(e)){i(e);continue}if(typeof n!=`object`||!n)throw Error(`Cannot access property '${e}' on ${typeof n} at path ${this.buildPathString(r)}`);let t=n;if(e in n){o(e,t);continue}a(e,t)}return{[this.buildPathString(r)]:n}}buildPathString(e){return e.join(`.`).replace(this.DOT_BEFORE_BRACKET_PATTERN,`[`)}bracketToDotNotation(e){return e.replace(this.BRACKET_PATTERN,(t,n,r)=>r>0&&e[r-1]===`\\`?t:`.`+n)}};function Me(e,t){let n=e?.modifiedFields;if(!n)return null;let r=Ne(n);if(!r)return null;let{unflattenedModifiedFields:i,modifiedFieldsManipulator:a}=r;e={...e,modifiedFields:i};let o=t(e),s=o?.modifiedFields;if(!s)return null;let c=Pe(s,a);return c===null?null:(o.modifiedFields=c,o)}function Ne(e){if(typeof e==`object`&&e&&!Array.isArray(e))try{let t=new je(e);return{unflattenedModifiedFields:t.unflatten(),modifiedFieldsManipulator:t}}catch{return null}return null}function Pe(e,t){if(typeof e==`object`&&e&&!Array.isArray(e))try{return t.flatten(e)}catch{return null}return null}function Fe(e){return e.replace(/[-_\s]+(.)?/g,(e,t)=>t?t.toUpperCase():``).replace(/^./,e=>e.toLowerCase())}function S(){return{emit(e,...t){for(let n=0,r=this.events[e]||[],i=r.length;n<i;n++)r[n](...t)},events:{},on(e,t){return(this.events[e]||=[]).push(t),()=>{this.events[e]=this.events[e]?.filter(e=>t!==e)}}}}var Ie=e=>e.__type===`event-definition`;function C(e,t,n,r){let i;if(e.isDomainEvent){let{deletedEvent:e,actionEvent:t,createdEvent:a,updatedEvent:o,...s}=n,c={...r,...s};i=e?e?.deletedEntity?{entity:e?.deletedEntity,metadata:c}:{metadata:c}:t?{data:t.body,metadata:c}:o?{entity:o.currentEntity,metadata:c,...o.modifiedFields?{modifiedFields:o.modifiedFields}:{}}:{entity:a?.entity,metadata:c}}else i={data:n,metadata:r};let a=e.transformations??(e=>e),o=i,s=i;if(s.modifiedFields){let e=s.modifiedFields;if(typeof e==`object`&&e&&!Array.isArray(e)){o=structuredClone(i);let e=Me(s,a);if(e)return t(e)}}return t(a(o))}function Le(e){let t=new Map,n=S();return{initModule(e){return r=>{let i=t.get(e.type)??[];i.push({eventDefinition:e,handler:r}),t.set(e.type,i),n.emit(`registered`,e)}},client:{...n,getRegisteredEvents:()=>t,async process(e,n={expectedEvents:[]}){let{eventType:r,identity:i,instanceId:a,payload:o,accountInfo:s}=await this.parseJWT(e),c=[...n.expectedEvents,...Array.from(t.keys()).map(e=>({type:e}))];if(c.length>0&&!c.some(({type:e})=>e===r))throw Error(`Unexpected event type: ${r}. Expected one of: ${c.map(e=>e.type).join(`, `)}`);let l=t.get(r)??[];return await Promise.all(l.map(({eventDefinition:e,handler:t})=>C(e,t,o,{instanceId:a,identity:i,accountInfo:s}))),{instanceId:a,eventType:r,payload:o,identity:i,accountInfo:s}},async processRequest(e,t){let n=await e.text();return this.process(n,t)},async parseJWT(t){let n=e();if(!n.decodeJWT)throw Error(`decodeJWT is not supported by the authentication strategy`);let{decoded:r,valid:i}=await n.decodeJWT(t);if(!i)throw Error(`JWT is not valid`);if(typeof r.data!=`string`)throw Error(`Unexpected type of JWT data: expected string, got ${typeof r.data}`);let a=JSON.parse(r.data),o=a.eventType,s=a.accountInfo,c=a.instanceId,l=a.identity?JSON.parse(a.identity):void 0;return{instanceId:c,eventType:o,payload:JSON.parse(a.data),identity:l,accountInfo:s}},async parseRequest(e){let t=await e.text();return this.parseJWT(t)},async executeHandlers(e){let n=Array.from(t.keys()).map(e=>({type:e}));if(n.length>0&&!n.some(({type:t})=>t===e.eventType))throw Error(`Unexpected event type: ${e.eventType}. Expected one of: ${n.map(e=>e.type).join(`, `)}`);let r=t.get(e.eventType)??[];await Promise.all(r.map(({eventDefinition:t,handler:n})=>C(t,n,e.payload,{instanceId:e.instanceId,identity:e.identity})))},apps:{AppInstalled:u(`AppInstalled`)(),AppRemoved:u(`AppRemoved`)()}}}}var Re=e=>e.__type===`service-plugin-definition`;function ze(e){let t=new Map,n=S();return{initModule(e){return r=>{let i=t.get(e.componentType.toLowerCase())??[];i.push({servicePluginDefinition:e,implementation:r}),t.set(e.componentType.toLowerCase(),i),n.emit(`registered`,e)}},client:{...n,getRegisteredServicePlugins:()=>t,async parseJWT(t){let n=e();if(!n.decodeJWT)throw Error(`decodeJWT is not supported by the authentication strategy`);let{decoded:r,valid:i}=await n.decodeJWT(t,!0);if(!i)throw Error(`JWT is not valid`);if(typeof r.data!=`object`||r.data===null||!(`metadata`in r.data)||typeof r.data.metadata!=`object`||r.data.metadata===null||!(`appExtensionType`in r.data.metadata)||typeof r.data.metadata.appExtensionType!=`string`)throw Error(`Unexpected JWT data: expected object with metadata.appExtensionType string`);return r.data},async process(e){let t=await this.parseJWT(e.body);return this.executeHandler(t,e.url)},async parseRequest(e){let t=await e.text();return this.parseJWT(t)},async processRequest(e){let t=await this.parseRequest(e);return this.processParsedRequest(t,e.url)},async processParsedRequest(e,t){try{let n=await this.executeHandler(e,t);return Response.json(n)}catch(e){if(e.errorType===`SPI`&&e.applicationCode&&e.httpCode)return Response.json({applicationError:{code:e.applicationCode,data:e.data}},{status:e.httpCode});throw e}},async executeHandler(e,n){let r=e.metadata.appExtensionType.toLowerCase(),i=t.get(r)??[];if(i.length===0)throw Error(`No service plugin implementations found for component type ${r}`);if(i.length>1)throw Error(`Multiple service plugin implementations found for component type ${r}. This is currently not supported`);let{implementation:a,servicePluginDefinition:o}=i[0],s=o.methods.find(e=>n.endsWith(e.primaryHttpMappingPath));if(!s)throw Error(`Unexpect request: request url did not match any method: `+n);let c=a[s.name];if(!c)throw Error(`Got request for service plugin method ${s.name} but no implementation was provided. Available methods: ${Object.keys(a).join(`, `)}`);return s.transformations.toREST(await c(s.transformations.fromREST(e)))}}}}var w=`X-Wix-Consistent`;function Be(e){let t=e.headers||{Authorization:``},n={getAuthHeaders:e=>Promise.resolve({headers:{}})},r=e.auth,i=typeof r==`function`?r:()=>r??n,a=()=>i().getAuthHeaders(e.host),o=()=>e.fetch??fetch,s=async(n,r)=>{let i=o(),s=await a(),c={...r?.headers??{},...s.headers,...e.host?.essentials?.passThroughHeaders,...t[`X-Wix-Consistent`]?{[w]:t[w]}:{}},l=e.host?.getErrorHandler?.();try{if(typeof n==`string`||n instanceof URL){let e=await i(n,{...r,headers:c});l?.handleError(e,{requestOptions:{url:n.toString(),method:r?.method}});let a=T(e);return a&&(t[w]=a),e}{for(let[e,t]of Object.entries(c))typeof t==`string`&&n.headers.set(e,t);let e=await i(n,r);l?.handleError(e,{requestOptions:{url:n.url,method:r?.method}});let a=T(e);return a&&(t[w]=a),e}}catch(e){throw l?.handleError(e,{requestOptions:{url:typeof n==`string`||n instanceof URL?n.toString():n.url,method:r?.method}}),e}},{client:c,initModule:u}=ze(i),{client:d,initModule:re}=Le(i),f=async(n,r)=>{let i=o(),s=await a(),c=ae(r),l=await i(n,{...r,headers:{...c,...t,...s?.headers,...r?.headers,...e.host?.essentials?.passThroughHeaders,...t[`X-Wix-Consistent`]?{[w]:t[w]}:{}}}),u=T(l);return u&&(t[w]=u),l},p=(t,n)=>{if(Ie(t))return re(t);if(Re(t))return u(t);if(se(t)&&e.host)return ce(t,e.host);if(typeof t==`function`){if(`__type`in t&&t.__type===`wix_spi_error`)return t;let r=e.host?.apiBaseUrl??`www.wixapis.com`,o=e.useCDN===void 0?i().shouldUseCDN:e.useCDN;return Ce(h(()=>te(t))?ee(t):t,n??{},f,e.host?.getErrorHandler?.(),(e,t)=>{let n=new URL(e,`https://${r}`);return n.host=r,n.protocol=`https`,f(n.toString(),t)},i().getActiveToken,async()=>a(),{HTTPHost:r},e.host?.name,o,e.validateRequestSchema)}return oe(t)?Object.fromEntries(Object.entries(t).map(([e,n])=>[e,p(n,t[ne])])):t},m=e=>{for(let n in e)t[n]=e[n]};return{...e.modules?p(e.modules):{},get auth(){let t=i();return t.getAuthHeaders=t.getAuthHeaders.bind(void 0,e.host),t},setHeaders:m,use:p,enableContext(e,t={elevated:!1}){e===`global`?globalThis.__wix_context__==null?t.elevated?globalThis.__wix_context__={elevatedClient:this}:globalThis.__wix_context__={client:this}:t.elevated?globalThis.__wix_context__.elevatedClient=this:globalThis.__wix_context__.client=this:t.elevated?l.elevatedClient=this:l.client=this},fetch:(t,n)=>{let r=e.host?.apiBaseUrl??`www.wixapis.com`,i=new URL(t,`https://${r}`);return i.host=r,i.protocol=`https`,f(i.toString(),n)},fetchWithAuth:s,async graphql(t,n,r={apiVersion:`alpha`}){let i=e?.host?.apiBaseUrl??`www.wixapis.com`,a=await f(`https://${i}/graphql/${r.apiVersion}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({query:t,variables:n})});if(a.status!==200)throw new ie(`GraphQL request failed with status ${a.status}`,a);let{data:o,errors:s}=await a.json();return{data:o??{},errors:s}},webhooks:d,servicePlugins:c}}function T(e){return e.headers?.get(`X-Wix-Consistent`)??e.headers?.get(`x-wix-consistent`)}var E={_id:`id`,_createdDate:`createdDate`,_updatedDate:`updatedDate`},Ve={id:`_id`,createdDate:`_createdDate`,updatedDate:`_updatedDate`},He=E;function Ue(e,t){return e?.split(`.`).map(e=>t?.[e]??e).join(`.`)}function D(e,{transformSystemFields:t=!0}={}){return t?Ue(e,He):e}var We=`sort.fieldName`;function Ge(e,t,n){return(e===We||e.endsWith(`.${We}`))&&typeof t==`string`?Ue(t,n):t}function O(e,t,n){let r=e=>n.includes(e),i=(e,n)=>{if(Array.isArray(e))e.forEach(e=>{i(e,n)});else if(typeof e==`object`&&e){let a=e;Object.keys(a).forEach(e=>{let o=n===``?e:`${n}.${e}`;if(r(o))return;let s=Ke(e,t);s!==e&&!(s in a)&&(a[s]=a[e],delete a[e]),a[s]=Ge(o,a[s],t),i(a[s],o)})}};return i(e,``),e}function Ke(e,t){let n;return n=e.includes(`.`)?e.split(`.`).map(e=>t[e]??e).join(`.`):t[e]??e,n}function qe(e,t=[]){return O(e,E,t)}function k(e,t=[]){return O(e,Ve,t)}function A(e){return e?new Date(e):void 0}var j=new WeakMap;function M(){return{leaves:void 0,fields:void 0,mapFields:void 0,anyField:void 0}}function N(e,t){let n=e.get(t);return n||(n=M(),e.set(t,n)),n}function Je(e,t){return t===`*`?(e.anyField??=M(),e.anyField):t.endsWith(`{}`)?(e.mapFields??=new Map,N(e.mapFields,t.slice(0,-2))):(e.fields??=new Map,N(e.fields,t))}function Ye(e){let t=M();for(let n of e){let e=n.path.split(`.`).reduce(Je,t);e.leaves??=[],e.leaves.push(n)}return t}function Xe(e){let t=j.get(e);return t||(t=Ye(e),j.set(e,t)),t}function P(e){return typeof e==`object`&&!!e}function Ze(e,{isRepeated:t,isMap:n},r){return t?Array.isArray(e)?e.map(r):e:n?P(e)?Object.fromEntries(Object.entries(e).map(([e,t])=>[e,r(t)])):e:r(e)}function F(e,t,n){P(e)&&I(e,t,n)}function Qe(e,t,n){for(let[r,i]of t){if(!(r in e))continue;if(i.leaves)for(let t of i.leaves)e[r]=Ze(e[r],t,n);let t=e[r];Array.isArray(t)?t.forEach(e=>F(e,i,n)):F(t,i,n)}}function $e(e,t,n){for(let[r,i]of t){let t=e[r];P(t)&&Object.values(t).forEach(e=>F(e,i,n))}}function I(e,{fields:t,mapFields:n,anyField:r},i){t&&Qe(e,t,i),n&&$e(e,n,i),r&&Object.values(e).forEach(e=>F(e,r,i))}function L(e,t){if(!P(e))return e;for(let{paths:n,transformFn:r}of t)I(e,Xe(n),r);return e}function R(e){return rt(e).map(e=>e.toLocaleUpperCase()).join(`_`)}var et=/([\p{Ll}\d])(\p{Lu})/gu,tt=/(\p{Lu})([\p{Lu}][\p{Ll}])/gu,z=`$1\0$2`,nt=/[^\p{L}\d]+/giu;function rt(e){let t=e.trim();t=t.replace(et,z).replace(tt,z),t=t.replace(nt,`\0`);let n=0,r=t.length;for(;t.charAt(n)===`\0`;)n++;if(n===r)return[];for(;t.charAt(r-1)===`\0`;)r--;return t.slice(n,r).split(/\0/g)}var it=e=>`validationError`in(e.response?.data?.details??{}),at=e=>`applicationError`in(e.response?.data?.details??{}),ot=e=>(e.response?.status??-1)>=400&&(e.response?.status??-1)<500;function st(e,t={explicitPathsToArguments:{},spreadPathsToArguments:{},singleArgumentUnchanged:!1},n=[]){if(typeof e!=`object`||!e)throw e;if(it(e))return ct(e,t,n);if(at(e))return lt(e);if(ot(e)){let t=e.response?.status,n=e.response?.statusText??`UNKNOWN`,r=e.response?.data?.message??n,i={applicationError:{description:n,code:R(n),data:{}},requestId:e.requestId};return B(e,{message:JSON.stringify({message:r,details:i},null,2),extraProperties:{details:i,status:t}})}return ut(e)}var ct=(e,t,n)=>{let r=e.response?.data,i=e.requestId,{fieldViolations:a}=r.details.validationError,o=dt(t,a,n)?.sort((e,t)=>e.field<t.field?-1:1),s=`INVALID_ARGUMENT: ${o?.map(({field:e,description:t})=>`"${e}" ${t}`)?.join(`, `)}`,c={validationError:{fieldViolations:o},requestId:i};return B(e,{message:JSON.stringify({message:s,details:c},null,2),extraProperties:{details:c,status:e.response?.status,requestId:i}})},B=(e,{message:t,extraProperties:n})=>Object.assign(e,{...n,message:t}),lt=e=>{let t=e.response?.status,n=e.response?.statusText??`UNKNOWN`,r=e.response?.data?.message??n,i=e.response?.data?.details?.applicationError?.description??n,a=e.response?.data?.details?.applicationError?.code??R(n),o=e.response?.data?.details?.applicationError?.data??{},s=r===i?r:`${r}: ${i}`,c={applicationError:{description:i,code:a,data:o},requestId:e.requestId};return B(e,{message:JSON.stringify({message:s,details:c},null,2),extraProperties:{details:c,status:t,requestId:e.requestId}})},ut=e=>B(e,{message:e.requestId?`System error occurred, request-id: ${e.requestId}`:`System error occurred: ${JSON.stringify(e)}`,extraProperties:{requestId:e.requestId,status:e.response?.status,code:R(e.response?.statusText??`UNKNOWN`),...!e.response&&{runtimeError:e}}}),dt=({spreadPathsToArguments:e,explicitPathsToArguments:t,singleArgumentUnchanged:n},r,i)=>{let a={...e,...t},o=Object.keys(a);return r?.filter(e=>!r.some(t=>t.field.length>e.field.length&&t.field.startsWith(e.field)&&o.includes(t.field))).map(e=>{let r=t[e.field];if(r)return{...e,field:V(r,i)};let s=o?.sort((e,t)=>t.length-e.length)?.find(t=>e.field.startsWith(t));if(s){let t=a[s];if(t)return{...e,field:e.field.replace(s,V(t,i))}}return n?{...e,field:`${i[0]}.${e.field}`}:e})},V=(e,t)=>{let n=ft(e);return n==null?e:e.replace(`$[${n}]`,t[n])},ft=e=>{let t=e.match(/\$\[(?<argIndex>\d+)\]/);return t&&t.groups&&Number(t.groups.argIndex)};function H(){let e=typeof $wixContext<`u`&&$wixContext.initWixModules?$wixContext.initWixModules:globalThis.__wix_context__!==void 0&&globalThis.__wix_context__.initWixModules?globalThis.__wix_context__.initWixModules:void 0;if(e)return{initWixModules(t,n){return U(()=>e(t,n))},fetchWithAuth(){throw Error(`fetchWithAuth is not available in this context`)},graphql(){throw Error(`graphql is not available in this context`)}};let t=typeof $wixContext<`u`?$wixContext.client:l.client===void 0?globalThis.__wix_context__===void 0?void 0:globalThis.__wix_context__.client:l.client,n=typeof $wixContext<`u`?$wixContext.elevatedClient:l.elevatedClient===void 0?globalThis.__wix_context__===void 0?void 0:globalThis.__wix_context__.elevatedClient:l.elevatedClient;if(t||n)return{initWixModules(e,r){if(r){if(!n)throw 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 Error(`Wix context is not available. Make sure to initialize the Wix context before using SDK modules`);return U(()=>t.use(e))},fetchWithAuth:(e,n)=>{if(!t)throw Error(`Wix context is not available. Make sure to initialize the Wix context before using SDK modules`);return t.fetchWithAuth(e,n)},getAuth(){if(!t)throw Error(`Wix context is not available. Make sure to initialize the Wix context before using SDK modules`);return t.auth},async graphql(e,n,r){if(!t)throw Error(`Wix context is not available. Make sure to initialize the Wix context before using SDK modules`);return t.graphql(e,n,r)}}}function U(e){let t=globalThis.__wix_context__,n={client:l.client,elevatedClient:l.elevatedClient},r;globalThis.__wix_context__=void 0,l.client=void 0,l.elevatedClient=void 0,typeof $wixContext<`u`&&(r={client:$wixContext?.client,elevatedClient:$wixContext?.elevatedClient},delete $wixContext.client,delete $wixContext.elevatedClient);try{return e()}finally{globalThis.__wix_context__=t,l.client=n.client,l.elevatedClient=n.elevatedClient,typeof $wixContext<`u`&&($wixContext.client=r.client,$wixContext.elevatedClient=r.elevatedClient)}}function pt(e,t){return((...n)=>{let r=H();return r?r.initWixModules(e,t).apply(void 0,n):e.apply(void 0,n)})}function mt(e){let t=((...t)=>{let n=H();return n?n.initWixModules(e).apply(void 0,t):()=>({slug:e.type})});return t.__type=e.__type,t.type=e.type,t.isDomainEvent=e.isDomainEvent,t.transformations=e.transformations,t}function ht(e,t=!1){return pt(e,t)}function gt(e,t){let n=W(e),r=Object.entries(n).some(([e,t])=>e.includes(`.`)||Array.isArray(t)&&t.some(e=>typeof e==`object`));return t&&r?new URLSearchParams({".r":yt(JSON.stringify(e))}):Object.entries(n).reduce((e,[t,n])=>((Array.isArray(n)?n:[n]).forEach(r=>{r==null||Array.isArray(n)&&typeof r==`object`||e.append(t,r)}),e),new URLSearchParams)}function _t(e){let t=Mt(At(e.host),e.domainToMappings);return Vt(Rt(e.protoPath,e.data||{}),t)}function W(e,t=``){let n={};return Object.entries(e).forEach(([e,r])=>{let i=typeof r==`object`&&!!r&&!Array.isArray(r),a=vt(t,e);if(i){let e=W(r,a);Object.assign(n,e)}else n[a]=r}),n}function vt(e,t){return`${e}${e?`.`:``}${t}`}var yt=e=>{let t=new TextEncoder().encode(e);return(typeof btoa<`u`?btoa(String.fromCodePoint(...t)):Buffer.from(e,`utf-8`).toString(`base64`)).replace(/=/g,``).replace(/\+/g,`-`).replace(/\//g,`_`)},bt=[`wix.com`,`editorx.com`],xt=`_`,St=`*.`,Ct=RegExp(`\\.(${bt.join(`|`)})$`),wt=[`42.wixprod.net`,`uw2-edt-1.wixprod.net`,`virginia-edt.wixprod.net`],Tt={"payments.base44.com":`manage.wix.com`,"create.editorx.com":`editor.editorx.com`},Et=`dev.wix-code.com`,Dt=/{(.*)}/,Ot=RegExp(`\\.(${wt.join(`|`)})$`),kt=RegExp(`.*\\.${Et}$`);function At(e){return jt(e).replace(Ct,`._base_domain_`).replace(Ot,`._api_base_domain_`).replace(kt,`*.dev.wix-code.com`)}function jt(e){return Tt[e]??e}function Mt(e,t){let n=t[e];if(n)return n;let r=Nt(e,t)??Pt(e,t);if(!r){if(It(e)){let e=t[Lt];if(e)return e}let n=t[xt];if(n)return n}return r??[]}function Nt(e,t){return Object.entries(t).find(([t])=>{let[,...n]=e.split(`.`);return n.join(`.`)===t})?.[1]}function Pt(e,t){let[n]=Object.entries(t).filter(([t])=>Ft(e,t)).sort(([e],[t])=>t.length-e.length);if(!n)return;let[,r]=n;return r}function Ft(e,t){if(!t.startsWith(St))return!1;let n=t.slice(1);return e.length>n.length&&e.endsWith(n)}function It(e){return!!e.match(/\._base_domain_$/)}var Lt=`www._base_domain_`;function Rt(e,t){return e.split(`/`).map(e=>zt(e,t)).join(`/`)}function zt(e,t){let n=e.match(Dt)||[],r=n[1];return r?Bt(t,r,e,e.replace(n[0],``)):e}function Bt(e,t,n,r){let i=e;for(let e of t.split(`.`)){if(!i)return n;i=i[e]}return`${i}${r}`}function Vt(e,t){let n=t?.find(t=>e.startsWith(t.destPath));return n?n.srcPath+e.slice(n.destPath.length):e}function G(e){return mt(e)}function K(e){return e===`NaN`?NaN:e===`Infinity`?1/0:e===`-Infinity`?-1/0:e}var Ht=`x-wix-linguist`,Ut=`00000000-0000-0000-0000-000000000000`,Wt=`false`,Gt=()=>{let e=q(`language`),t=q(`locale`);if(e)return{[Ht]:[e,t||e,Wt,Ut].join(`|`)}};function Kt(){let e=null,t=null;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}var qt=()=>(typeof window<`u`?window.commonConfig:void 0)??globalThis.commonConfig,q=e=>qt()?.[e],Jt=({createHost:e})=>({__type:`host`,create:e=>({}),host:t=>{let{applicationId:n,componentId:r}=t??{},i=typeof window<`u`?window.wixEmbedsAPI:void 0,a=e(t),o=Xt();return{...a,apiBaseUrl:o,getMonitoringClient:i?.getMonitoringClientFunction?.(n,r),essentials:{language:q(`language`),locale:q(`locale`),get passThroughHeaders(){return Gt()}}}},auth:e=>{let t=typeof window<`u`?window.wixEmbedsAPI:void 0;!e&&Yt()&&(e=t?.getAccessTokenFunction?.());let n=!1,{resolve:r,promise:i}=Kt();return{getAuthHeaders:async()=>{if(!e&&n&&(e=await i),!e)throw Error(`Failed to resolve auth token`);return{headers:{Authorization:await e()}}},getAccessTokenInjector:()=>(n=!0,e=>{r(e)})}}});function Yt(){return typeof document<`u`&&document.currentScript?.tagName===`SCRIPT`}function Xt(){let e=(typeof window<`u`?window.wixEmbedsAPI:void 0)?.getExternalBaseUrl?.();if(!e)return;let t=new URL(e);return t?.pathname&&t.pathname!==`/`?`${t.hostname}${t.pathname}`:t.hostname}var Zt=({clientSdk:e,applicationId:t})=>({invoke:async({namespace:n,method:r,args:i})=>{if(!e)throw Error(`Wix Site SDK only works in a Wix site environment. Learn more: https://dev.wix.com/docs/sdk/host-modules/site/introduction`);return e.invoke({namespace:n,method:r,args:i,applicationId:t,accessToken:`accessToken`})},getAccessToken:()=>{throw Error(`Not implemented`)},observeState:()=>({disconnect:()=>{}})}),J=Jt({createHost:function(e){let t=(typeof $wixContext<`u`?$wixContext.clientSdk:void 0)??e?.clientSdk??(typeof window<`u`?window?.clientSdk:void 0),{applicationId:n}=e||{};if(!n)throw Error(`"createHost" was called without a required field "applicationId"`);return{channel:Zt({clientSdk:t,applicationId:n}),close:()=>{}}}}),Qt=(e,t)=>{let n=J.host({applicationId:e,componentId:t}),r=J.auth();return Be({auth:r,host:n}).enableContext(`module`),r.getAccessTokenInjector()},$t=e=>Qt(`215238eb-22a5-4c36-9e7b-e7c08025e04e`,e);function en(e){if(e.status===`fulfilled`)return e.value;throw e.status===`rejected`?e.reason:e.status===`pending`?e:(e.status=`pending`,e.then(t=>{e.status=`fulfilled`,e.value=t},t=>{e.status=`rejected`,e.reason=t}),e)}function Y(e){return e}var tn=Y(`@wix/site-service-warmup-data`);async function nn(e,t,n){let r=typeof window>`u`;if(!r&&e)try{let n=await e.get(t);if(n!==null)return n}catch{}let i=await n();if(r&&e)try{e.set(t,i)}catch{}return i}function rn(e,t){let n=o(),[r]=a(()=>{let r;try{r=n(tn)}catch{r=null}return nn(r,e,t)});return r}function X(e){if(!e)return;let t=``;return(e.filename||e.altText)&&(t=`/${encodeURIComponent(e.filename||e.altText)}`),e.id?`wix:image://v1/${e.id}${t}#originWidth=${e.width}&originHeight=${e.height}`:e.url}function an(e,t,n={}){let r=(r,i)=>an(e,t,{...n,[r]:i}),i=()=>Object.keys(n).length===0?{}:{[D(e,t)]:n};return{get filter(){return i()},eq:e=>r(`$eq`,e),ne:e=>r(`$ne`,e),gt:e=>r(`$gt`,e),gte:e=>r(`$gte`,e),lt:e=>r(`$lt`,e),lte:e=>r(`$lte`,e),startsWith:e=>r(`$startsWith`,e),endsWith:e=>r(`$endsWith`,e),contains:e=>r(`$contains`,e),in:e=>r(`$in`,e),nin:e=>r(`$nin`,e),hasSome:e=>r(`$hasSome`,e),hasAll:e=>r(`$hasAll`,e),exists:(e=!0)=>r(`$exists`,e),isEmpty:(e=!0)=>r(`$isEmpty`,e),isNotEmpty:()=>r(`$ne`,null)}}function on(e){return Object.assign(t=>an(t,e),{and:(...e)=>({filter:{$and:e.map(e=>e.filter)}}),or:(...e)=>({filter:{$or:e.map(e=>e.filter)}}),not:e=>({filter:{$not:e.filter}})})}function sn(e){return(t=>({asc:()=>({sort:{fieldName:D(t,e),order:`ASC`}}),desc:()=>({sort:{fieldName:D(t,e),order:`DESC`}})}))}function cn(e){return()=>{let t={},n={withFilter(e){return t={...t,filter:e.filter},n},withFields(...r){return t={...t,fields:r.map(t=>D(t,e))},n},withSorting(...e){return t={...t,sort:e.map(e=>e.sort)},n},withPaging(e){return t={...t,paging:e},n},build(){return t}};return n}}function ln(e){return{QueryBuilder:cn(e),Filter:on(e),Sort:sn(e)}}function un(e){let t={},n={get search(){return t},expression(e){return t={...t,expression:e},n},mode(e){return t={...t,mode:e},n},fields(r){return t={...t,fields:r.map(t=>D(t,e))},n},fuzzy(e=!0){return t={...t,fuzzy:e},n}};return n}function dn(e){return t=>{let n=un(e);return t===void 0?n:n.expression(t)}}function fn(e){let t={...e,type:`VALUE`,value:{...e.value}},n={get aggregation(){return t},sortBy(e,r){return t={...t,value:{...t.value,sortType:e,sortDirection:r}},n},limit(e){return t={...t,value:{...t.value,limit:e}},n},excludeMissingValues(){return t={...t,value:{...t.value,missingValues:`EXCLUDE`}},n},includeMissingValues(){return t={...t,value:{...t.value,missingValues:`INCLUDE`}},n},includeValues(e){return t={...t,value:{...t.value,includeOptions:{addToBucket:e}}},n}};return n}function pn(e){let t={...e,type:`RANGE`,range:{buckets:[]}},n={get aggregation(){return t},withBuckets(...e){return t={...t,range:{buckets:e}},n}};return n}function mn(e){let t={...e,type:`DATE_HISTOGRAM`,dateHistogram:{}},n={get aggregation(){return t},interval(e){return t={...t,dateHistogram:{interval:e}},n}};return n}function hn(e){let t={...e,type:`SCALAR`,scalar:{}},n={get aggregation(){return t},type(e){return t={...t,scalar:{type:e}},n}};return n}function gn(e){let t={...e,type:`NESTED`,nested:{nestedAggregations:[]}},n={get aggregation(){return t},addNestedAggregation(e){let r=e.aggregation,i=[...t.nested?.nestedAggregations??[],r];return t={...t,nested:{nestedAggregations:i}},n}};return n}function _n(e,t){let n={name:e},r={get aggregation(){return n},ofType(e){return n={...n,type:e},r},onField(e){return n={...n,fieldPath:D(e,t)},r},asValueAggregation(){return fn(n)},asRangeAggregation(){return pn(n)},asDateHistogramAggregation(){return mn(n)},asScalarAggregation(){return hn(n)},asNestedAggregation(){return gn(n)}};return r}function vn(e){return t=>_n(t,e)}function yn(){return()=>{let e={},t={withFilter(n){return e={...e,filter:n.filter},t},withSearchClause(n){return e={...e,search:n.search},t},withSorting(...n){return e={...e,sort:n.map(e=>e.sort)},t},withAggregation(...n){return e={...e,aggregations:n.map(e=>e.aggregation)},t},withPaging(n){return e={...e,paging:n},t},withTimeZone(n){return e={...e,timeZone:n},t},build(){return e}};return t}}function bn(e){return{SearchBuilder:yn(),Filter:on(e),Sort:sn(e),SearchParams:dn(e),Aggregation:vn(e)}}function xn(e){return _t(Object.assign(e,{domainToMappings:{"*.dev.wix-code.com":[{srcPath:`/_api/categories`,destPath:``}],"www.wixapis.com":[{srcPath:`/categories/v1/bulk/categories`,destPath:`/v1/bulk/categories`},{srcPath:`/categories/v1/categories`,destPath:`/v1/categories`}],"manage._base_domain_":[{srcPath:`/_api/categories`,destPath:``}],"editor._base_domain_":[{srcPath:`/_api/categories-service`,destPath:``}],"blocks._base_domain_":[{srcPath:`/_api/categories-service`,destPath:``}],"create.editorx":[{srcPath:`/_api/categories-service`,destPath:``}],_:[{srcPath:`/categories/v1/bulk/categories`,destPath:`/v1/bulk/categories`},{srcPath:`/categories/v1/categories`,destPath:`/v1/categories`}]}}))}var Sn=`@wix/auto_sdk_categories_categories`;function Cn(e){function t({host:t}){return{entityFqdn:`wix.categories.v1.category`,method:`GET`,methodFqn:`com.wix.categories.api.v1.CategoriesService.GetCategory`,packageName:Sn,migrationOptions:{optInTransformResponse:!0},url:xn({protoPath:`/v1/categories/{categoryId}`,data:e,host:t}),params:gt(e),transformResponse:e=>L(e,[{transformFn:A,paths:[{path:`category.createdDate`},{path:`category.updatedDate`},{path:`category.image.urlExpirationDate`},{path:`category.richContentDescription.metadata.createdTimestamp`},{path:`category.richContentDescription.metadata.updatedTimestamp`}]},{transformFn:K,paths:[{path:`category.richContentDescription.nodes.buttonData.styles.background.gradient.centerX`},{path:`category.richContentDescription.nodes.buttonData.styles.background.gradient.centerY`},{path:`category.richContentDescription.nodes.buttonData.styles.background.gradient.stops.position`},{path:`category.richContentDescription.nodes.buttonData.styles.backgroundHover.gradient.centerX`},{path:`category.richContentDescription.nodes.buttonData.styles.backgroundHover.gradient.centerY`},{path:`category.richContentDescription.nodes.buttonData.styles.backgroundHover.gradient.stops.position`},{path:`category.richContentDescription.nodes.galleryData.items.image.media.duration`},{path:`category.richContentDescription.nodes.galleryData.items.video.media.duration`},{path:`category.richContentDescription.nodes.galleryData.items.video.thumbnail.duration`},{path:`category.richContentDescription.nodes.galleryData.options.item.ratio`},{path:`category.richContentDescription.nodes.imageData.image.duration`},{path:`category.richContentDescription.nodes.imageData.crop.x`},{path:`category.richContentDescription.nodes.imageData.crop.y`},{path:`category.richContentDescription.nodes.imageData.crop.width`},{path:`category.richContentDescription.nodes.imageData.crop.height`},{path:`category.richContentDescription.nodes.mapData.mapSettings.lat`},{path:`category.richContentDescription.nodes.mapData.mapSettings.lng`},{path:`category.richContentDescription.nodes.pollData.poll.image.duration`},{path:`category.richContentDescription.nodes.pollData.poll.options.image.duration`},{path:`category.richContentDescription.nodes.pollData.design.poll.background.image.duration`},{path:`category.richContentDescription.nodes.appEmbedData.image.duration`},{path:`category.richContentDescription.nodes.videoData.video.duration`},{path:`category.richContentDescription.nodes.videoData.thumbnail.duration`},{path:`category.richContentDescription.nodes.audioData.audio.duration`},{path:`category.richContentDescription.nodes.audioData.coverImage.duration`},{path:`category.richContentDescription.nodes.layoutData.backgroundImage.media.duration`},{path:`category.richContentDescription.nodes.layoutData.backgroundImage.overlay.gradient.centerX`},{path:`category.richContentDescription.nodes.layoutData.backgroundImage.overlay.gradient.centerY`},{path:`category.richContentDescription.nodes.layoutData.backgroundImage.overlay.gradient.stops.position`},{path:`category.richContentDescription.nodes.layoutData.backdropImage.media.duration`},{path:`category.richContentDescription.nodes.layoutData.backdropImage.overlay.gradient.centerX`},{path:`category.richContentDescription.nodes.layoutData.backdropImage.overlay.gradient.centerY`},{path:`category.richContentDescription.nodes.layoutData.backdropImage.overlay.gradient.stops.position`},{path:`category.richContentDescription.nodes.layoutData.background.gradient.centerX`},{path:`category.richContentDescription.nodes.layoutData.background.gradient.centerY`},{path:`category.richContentDescription.nodes.layoutData.background.gradient.stops.position`},{path:`category.richContentDescription.nodes.layoutData.backdrop.gradient.centerX`},{path:`category.richContentDescription.nodes.layoutData.backdrop.gradient.centerY`},{path:`category.richContentDescription.nodes.layoutData.backdrop.gradient.stops.position`},{path:`category.richContentDescription.nodes.shapeData.shape.duration`},{path:`category.richContentDescription.nodes.cardData.background.gradient.centerX`},{path:`category.richContentDescription.nodes.cardData.background.gradient.centerY`},{path:`category.richContentDescription.nodes.cardData.background.gradient.stops.position`},{path:`category.richContentDescription.nodes.cardData.backgroundImage.media.duration`},{path:`category.richContentDescription.nodes.cardData.backgroundImage.overlay.gradient.centerX`},{path:`category.richContentDescription.nodes.cardData.backgroundImage.overlay.gradient.centerY`},{path:`category.richContentDescription.nodes.cardData.backgroundImage.overlay.gradient.stops.position`},{path:`category.richContentDescription.nodes.tocData.fontSize`},{path:`category.richContentDescription.nodes.tocData.itemSpacing`},{path:`category.richContentDescription.nodes.smartBlockCellData.shape.duration`}]}])}}return t}var Z=(e=>(e.BREADCRUMBS_INFO=`BREADCRUMBS_INFO`,e.DESCRIPTION=`DESCRIPTION`,e.RICH_CONTENT_DESCRIPTION=`RICH_CONTENT_DESCRIPTION`,e))(Z||{});async function wn(e,t,n){let{httpClient:r,sideEffects:i}=arguments[3],a=Cn(qe({categoryId:e,treeReference:t,fields:n?.fields},[]));i?.onSiteCall?.();try{let e=await r.request(a);return i?.onSuccess?.(e),k(L(e.data,[{transformFn:X,paths:[{path:`category.image`}]}]),[`category.richContentDescription`])?.category}catch(e){let t=st(e,{spreadPathsToArguments:{},explicitPathsToArguments:{categoryId:`$[0]`,treeReference:`$[1]`,fields:`$[2].fields`},singleArgumentUnchanged:!1},[`categoryId`,`treeReference`,`options`]);throw i?.onError?.(e),t}}({...ln()}),{...bn()};function Tn(e){return(t,n,r)=>wn(t,n,r,{httpClient:e})}var En=u(`wix.categories.v1.category_category_moved`,!0,e=>k(L(e,[{transformFn:A,paths:[{path:`metadata.eventTime`}]}])))(),Dn=u(`wix.categories.v1.category_created`,!0,e=>k(L(e,[{transformFn:A,paths:[{path:`entity.createdDate`},{path:`entity.updatedDate`},{path:`entity.richContentDescription.metadata.createdTimestamp`},{path:`entity.richContentDescription.metadata.updatedTimestamp`},{path:`metadata.eventTime`}]},{transformFn:X,paths:[{path:`entity.image`}]},{transformFn:K,paths:[{path:`entity.richContentDescription.nodes.buttonData.styles.background.gradient.centerX`},{path:`entity.richContentDescription.nodes.buttonData.styles.background.gradient.centerY`},{path:`entity.richContentDescription.nodes.buttonData.styles.background.gradient.stops.position`},{path:`entity.richContentDescription.nodes.buttonData.styles.backgroundHover.gradient.centerX`},{path:`entity.richContentDescription.nodes.buttonData.styles.backgroundHover.gradient.centerY`},{path:`entity.richContentDescription.nodes.buttonData.styles.backgroundHover.gradient.stops.position`},{path:`entity.richContentDescription.nodes.galleryData.items.image.media.duration`},{path:`entity.richContentDescription.nodes.galleryData.items.video.media.duration`},{path:`entity.richContentDescription.nodes.galleryData.items.video.thumbnail.duration`},{path:`entity.richContentDescription.nodes.galleryData.options.item.ratio`},{path:`entity.richContentDescription.nodes.imageData.image.duration`},{path:`entity.richContentDescription.nodes.imageData.crop.x`},{path:`entity.richContentDescription.nodes.imageData.crop.y`},{path:`entity.richContentDescription.nodes.imageData.crop.width`},{path:`entity.richContentDescription.nodes.imageData.crop.height`},{path:`entity.richContentDescription.nodes.mapData.mapSettings.lat`},{path:`entity.richContentDescription.nodes.mapData.mapSettings.lng`},{path:`entity.richContentDescription.nodes.pollData.poll.image.duration`},{path:`entity.richContentDescription.nodes.pollData.poll.options.image.duration`},{path:`entity.richContentDescription.nodes.pollData.design.poll.background.image.duration`},{path:`entity.richContentDescription.nodes.appEmbedData.image.duration`},{path:`entity.richContentDescription.nodes.videoData.video.duration`},{path:`entity.richContentDescription.nodes.videoData.thumbnail.duration`},{path:`entity.richContentDescription.nodes.audioData.audio.duration`},{path:`entity.richContentDescription.nodes.audioData.coverImage.duration`},{path:`entity.richContentDescription.nodes.layoutData.backgroundImage.media.duration`},{path:`entity.richContentDescription.nodes.layoutData.backgroundImage.overlay.gradient.centerX`},{path:`entity.richContentDescription.nodes.layoutData.backgroundImage.overlay.gradient.centerY`},{path:`entity.richContentDescription.nodes.layoutData.backgroundImage.overlay.gradient.stops.position`},{path:`entity.richContentDescription.nodes.layoutData.backdropImage.media.duration`},{path:`entity.richContentDescription.nodes.layoutData.backdropImage.overlay.gradient.centerX`},{path:`entity.richContentDescription.nodes.layoutData.backdropImage.overlay.gradient.centerY`},{path:`entity.richContentDescription.nodes.layoutData.backdropImage.overlay.gradient.stops.position`},{path:`entity.richContentDescription.nodes.layoutData.background.gradient.centerX`},{path:`entity.richContentDescription.nodes.layoutData.background.gradient.centerY`},{path:`entity.richContentDescription.nodes.layoutData.background.gradient.stops.position`},{path:`entity.richContentDescription.nodes.layoutData.backdrop.gradient.centerX`},{path:`entity.richContentDescription.nodes.layoutData.backdrop.gradient.centerY`},{path:`entity.richContentDescription.nodes.layoutData.backdrop.gradient.stops.position`},{path:`entity.richContentDescription.nodes.shapeData.shape.duration`},{path:`entity.richContentDescription.nodes.cardData.background.gradient.centerX`},{path:`entity.richContentDescription.nodes.cardData.background.gradient.centerY`},{path:`entity.richContentDescription.nodes.cardData.background.gradient.stops.position`},{path:`entity.richContentDescription.nodes.cardData.backgroundImage.media.duration`},{path:`entity.richContentDescription.nodes.cardData.backgroundImage.overlay.gradient.centerX`},{path:`entity.richContentDescription.nodes.cardData.backgroundImage.overlay.gradient.centerY`},{path:`entity.richContentDescription.nodes.cardData.backgroundImage.overlay.gradient.stops.position`},{path:`entity.richContentDescription.nodes.tocData.fontSize`},{path:`entity.richContentDescription.nodes.tocData.itemSpacing`},{path:`entity.richContentDescription.nodes.smartBlockCellData.shape.duration`}]}])))(),On=u(`wix.categories.v1.category_deleted`,!0,e=>k(L(e,[{transformFn:A,paths:[{path:`undefined.createdDate`},{path:`undefined.updatedDate`},{path:`undefined.richContentDescription.metadata.createdTimestamp`},{path:`undefined.richContentDescription.metadata.updatedTimestamp`},{path:`metadata.eventTime`}]},{transformFn:X,paths:[{path:`undefined.image`}]},{transformFn:K,paths:[{path:`undefined.richContentDescription.nodes.buttonData.styles.background.gradient.centerX`},{path:`undefined.richContentDescription.nodes.buttonData.styles.background.gradient.centerY`},{path:`undefined.richContentDescription.nodes.buttonData.styles.background.gradient.stops.position`},{path:`undefined.richContentDescription.nodes.buttonData.styles.backgroundHover.gradient.centerX`},{path:`undefined.richContentDescription.nodes.buttonData.styles.backgroundHover.gradient.centerY`},{path:`undefined.richContentDescription.nodes.buttonData.styles.backgroundHover.gradient.stops.position`},{path:`undefined.richContentDescription.nodes.galleryData.items.image.media.duration`},{path:`undefined.richContentDescription.nodes.galleryData.items.video.media.duration`},{path:`undefined.richContentDescription.nodes.galleryData.items.video.thumbnail.duration`},{path:`undefined.richContentDescription.nodes.galleryData.options.item.ratio`},{path:`undefined.richContentDescription.nodes.imageData.image.duration`},{path:`undefined.richContentDescription.nodes.imageData.crop.x`},{path:`undefined.richContentDescription.nodes.imageData.crop.y`},{path:`undefined.richContentDescription.nodes.imageData.crop.width`},{path:`undefined.richContentDescription.nodes.imageData.crop.height`},{path:`undefined.richContentDescription.nodes.mapData.mapSettings.lat`},{path:`undefined.richContentDescription.nodes.mapData.mapSettings.lng`},{path:`undefined.richContentDescription.nodes.pollData.poll.image.duration`},{path:`undefined.richContentDescription.nodes.pollData.poll.options.image.duration`},{path:`undefined.richContentDescription.nodes.pollData.design.poll.background.image.duration`},{path:`undefined.richContentDescription.nodes.appEmbedData.image.duration`},{path:`undefined.richContentDescription.nodes.videoData.video.duration`},{path:`undefined.richContentDescription.nodes.videoData.thumbnail.duration`},{path:`undefined.richContentDescription.nodes.audioData.audio.duration`},{path:`undefined.richContentDescription.nodes.audioData.coverImage.duration`},{path:`undefined.richContentDescription.nodes.layoutData.backgroundImage.media.duration`},{path:`undefined.richContentDescription.nodes.layoutData.backgroundImage.overlay.gradient.centerX`},{path:`undefined.richContentDescription.nodes.layoutData.backgroundImage.overlay.gradient.centerY`},{path:`undefined.richContentDescription.nodes.layoutData.backgroundImage.overlay.gradient.stops.position`},{path:`undefined.richContentDescription.nodes.layoutData.backdropImage.media.duration`},{path:`undefined.richContentDescription.nodes.layoutData.backdropImage.overlay.gradient.centerX`},{path:`undefined.richContentDescription.nodes.layoutData.backdropImage.overlay.gradient.centerY`},{path:`undefined.richContentDescription.nodes.layoutData.backdropImage.overlay.gradient.stops.position`},{path:`undefined.richContentDescription.nodes.layoutData.background.gradient.centerX`},{path:`undefined.richContentDescription.nodes.layoutData.background.gradient.centerY`},{path:`undefined.richContentDescription.nodes.layoutData.background.gradient.stops.position`},{path:`undefined.richContentDescription.nodes.layoutData.backdrop.gradient.centerX`},{path:`undefined.richContentDescription.nodes.layoutData.backdrop.gradient.centerY`},{path:`undefined.richContentDescription.nodes.layoutData.backdrop.gradient.stops.position`},{path:`undefined.richContentDescription.nodes.shapeData.shape.duration`},{path:`undefined.richContentDescription.nodes.cardData.background.gradient.centerX`},{path:`undefined.richContentDescription.nodes.cardData.background.gradient.centerY`},{path:`undefined.richContentDescription.nodes.cardData.background.gradient.stops.position`},{path:`undefined.richContentDescription.nodes.cardData.backgroundImage.media.duration`},{path:`undefined.richContentDescription.nodes.cardData.backgroundImage.overlay.gradient.centerX`},{path:`undefined.richContentDescription.nodes.cardData.backgroundImage.overlay.gradient.centerY`},{path:`undefined.richContentDescription.nodes.cardData.backgroundImage.overlay.gradient.stops.position`},{path:`undefined.richContentDescription.nodes.tocData.fontSize`},{path:`undefined.richContentDescription.nodes.tocData.itemSpacing`},{path:`undefined.richContentDescription.nodes.smartBlockCellData.shape.duration`}]}])))(),kn=u(`wix.categories.v1.category_item_added_to_category`,!0,e=>k(L(e,[{transformFn:A,paths:[{path:`metadata.eventTime`}]}])))(),An=u(`wix.categories.v1.category_item_removed_from_category`,!0,e=>k(L(e,[{transformFn:A,paths:[{path:`metadata.eventTime`}]}])))(),jn=u(`wix.categories.v1.category_items_arranged_in_category`,!0,e=>k(L(e,[{transformFn:A,paths:[{path:`metadata.eventTime`}]}])))(),Mn=u(`wix.categories.v1.category_updated`,!0,e=>k(L(e,[{transformFn:A,paths:[{path:`entity.createdDate`},{path:`entity.updatedDate`},{path:`entity.richContentDescription.metadata.createdTimestamp`},{path:`entity.richContentDescription.metadata.updatedTimestamp`},{path:`metadata.eventTime`},{path:`modifiedFields.createdDate`},{path:`modifiedFields.updatedDate`},{path:`modifiedFields.richContentDescription.metadata.createdTimestamp`},{path:`modifiedFields.richContentDescription.metadata.updatedTimestamp`}]},{transformFn:X,paths:[{path:`entity.image`},{path:`modifiedFields.image`}]},{transformFn:K,paths:[{path:`entity.richContentDescription.nodes.buttonData.styles.background.gradient.centerX`},{path:`entity.richContentDescription.nodes.buttonData.styles.background.gradient.centerY`},{path:`entity.richContentDescription.nodes.buttonData.styles.background.gradient.stops.position`},{path:`entity.richContentDescription.nodes.buttonData.styles.backgroundHover.gradient.centerX`},{path:`entity.richContentDescription.nodes.buttonData.styles.backgroundHover.gradient.centerY`},{path:`entity.richContentDescription.nodes.buttonData.styles.backgroundHover.gradient.stops.position`},{path:`entity.richContentDescription.nodes.galleryData.items.image.media.duration`},{path:`entity.richContentDescription.nodes.galleryData.items.video.media.duration`},{path:`entity.richContentDescription.nodes.galleryData.items.video.thumbnail.duration`},{path:`entity.richContentDescription.nodes.galleryData.options.item.ratio`},{path:`entity.richContentDescription.nodes.imageData.image.duration`},{path:`entity.richContentDescription.nodes.imageData.crop.x`},{path:`entity.richContentDescription.nodes.imageData.crop.y`},{path:`entity.richContentDescription.nodes.imageData.crop.width`},{path:`entity.richContentDescription.nodes.imageData.crop.height`},{path:`entity.richContentDescription.nodes.mapData.mapSettings.lat`},{path:`entity.richContentDescription.nodes.mapData.mapSettings.lng`},{path:`entity.richContentDescription.nodes.pollData.poll.image.duration`},{path:`entity.richContentDescription.nodes.pollData.poll.options.image.duration`},{path:`entity.richContentDescription.nodes.pollData.design.poll.background.image.duration`},{path:`entity.richContentDescription.nodes.appEmbedData.image.duration`},{path:`entity.richContentDescription.nodes.videoData.video.duration`},{path:`entity.richContentDescription.nodes.videoData.thumbnail.duration`},{path:`entity.richContentDescription.nodes.audioData.audio.duration`},{path:`entity.richContentDescription.nodes.audioData.coverImage.duration`},{path:`entity.richContentDescription.nodes.layoutData.backgroundImage.media.duration`},{path:`entity.richContentDescription.nodes.layoutData.backgroundImage.overlay.gradient.centerX`},{path:`entity.richContentDescription.nodes.layoutData.backgroundImage.overlay.gradient.centerY`},{path:`entity.richContentDescription.nodes.layoutData.backgroundImage.overlay.gradient.stops.position`},{path:`entity.richContentDescription.nodes.layoutData.backdropImage.media.duration`},{path:`entity.richContentDescription.nodes.layoutData.backdropImage.overlay.gradient.centerX`},{path:`entity.richContentDescription.nodes.layoutData.backdropImage.overlay.gradient.centerY`},{path:`entity.richContentDescription.nodes.layoutData.backdropImage.overlay.gradient.stops.position`},{path:`entity.richContentDescription.nodes.layoutData.background.gradient.centerX`},{path:`entity.richContentDescription.nodes.layoutData.background.gradient.centerY`},{path:`entity.richContentDescription.nodes.layoutData.background.gradient.stops.position`},{path:`entity.richContentDescription.nodes.layoutData.backdrop.gradient.centerX`},{path:`entity.richContentDescription.nodes.layoutData.backdrop.gradient.centerY`},{path:`entity.richContentDescription.nodes.layoutData.backdrop.gradient.stops.position`},{path:`entity.richContentDescription.nodes.shapeData.shape.duration`},{path:`entity.richContentDescription.nodes.cardData.background.gradient.centerX`},{path:`entity.richContentDescription.nodes.cardData.background.gradient.centerY`},{path:`entity.richContentDescription.nodes.cardData.background.gradient.stops.position`},{path:`entity.richContentDescription.nodes.cardData.backgroundImage.media.duration`},{path:`entity.richContentDescription.nodes.cardData.backgroundImage.overlay.gradient.centerX`},{path:`entity.richContentDescription.nodes.cardData.backgroundImage.overlay.gradient.centerY`},{path:`entity.richContentDescription.nodes.cardData.backgroundImage.overlay.gradient.stops.position`},{path:`entity.richContentDescription.nodes.tocData.fontSize`},{path:`entity.richContentDescription.nodes.tocData.itemSpacing`},{path:`entity.richContentDescription.nodes.smartBlockCellData.shape.duration`},{path:`modifiedFields.richContentDescription.nodes.buttonData.styles.background.gradient.centerX`},{path:`modifiedFields.richContentDescription.nodes.buttonData.styles.background.gradient.centerY`},{path:`modifiedFields.richContentDescription.nodes.buttonData.styles.background.gradient.stops.position`},{path:`modifiedFields.richContentDescription.nodes.buttonData.styles.backgroundHover.gradient.centerX`},{path:`modifiedFields.richContentDescription.nodes.buttonData.styles.backgroundHover.gradient.centerY`},{path:`modifiedFields.richContentDescription.nodes.buttonData.styles.backgroundHover.gradient.stops.position`},{path:`modifiedFields.richContentDescription.nodes.galleryData.items.image.media.duration`},{path:`modifiedFields.richContentDescription.nodes.galleryData.items.video.media.duration`},{path:`modifiedFields.richContentDescription.nodes.galleryData.items.video.thumbnail.duration`},{path:`modifiedFields.richContentDescription.nodes.galleryData.options.item.ratio`},{path:`modifiedFields.richContentDescription.nodes.imageData.image.duration`},{path:`modifiedFields.richContentDescription.nodes.imageData.crop.x`},{path:`modifiedFields.richContentDescription.nodes.imageData.crop.y`},{path:`modifiedFields.richContentDescription.nodes.imageData.crop.width`},{path:`modifiedFields.richContentDescription.nodes.imageData.crop.height`},{path:`modifiedFields.richContentDescription.nodes.mapData.mapSettings.lat`},{path:`modifiedFields.richContentDescription.nodes.mapData.mapSettings.lng`},{path:`modifiedFields.richContentDescription.nodes.pollData.poll.image.duration`},{path:`modifiedFields.richContentDescription.nodes.pollData.poll.options.image.duration`},{path:`modifiedFields.richContentDescription.nodes.pollData.design.poll.background.image.duration`},{path:`modifiedFields.richContentDescription.nodes.appEmbedData.image.duration`},{path:`modifiedFields.richContentDescription.nodes.videoData.video.duration`},{path:`modifiedFields.richContentDescription.nodes.videoData.thumbnail.duration`},{path:`modifiedFields.richContentDescription.nodes.audioData.audio.duration`},{path:`modifiedFields.richContentDescription.nodes.audioData.coverImage.duration`},{path:`modifiedFields.richContentDescription.nodes.layoutData.backgroundImage.media.duration`},{path:`modifiedFields.richContentDescription.nodes.layoutData.backgroundImage.overlay.gradient.centerX`},{path:`modifiedFields.richContentDescription.nodes.layoutData.backgroundImage.overlay.gradient.centerY`},{path:`modifiedFields.richContentDescription.nodes.layoutData.backgroundImage.overlay.gradient.stops.position`},{path:`modifiedFields.richContentDescription.nodes.layoutData.backdropImage.media.duration`},{path:`modifiedFields.richContentDescription.nodes.layoutData.backdropImage.overlay.gradient.centerX`},{path:`modifiedFields.richContentDescription.nodes.layoutData.backdropImage.overlay.gradient.centerY`},{path:`modifiedFields.richContentDescription.nodes.layoutData.backdropImage.overlay.gradient.stops.position`},{path:`modifiedFields.richContentDescription.nodes.layoutData.background.gradient.centerX`},{path:`modifiedFields.richContentDescription.nodes.layoutData.background.gradient.centerY`},{path:`modifiedFields.richContentDescription.nodes.layoutData.background.gradient.stops.position`},{path:`modifiedFields.richContentDescription.nodes.layoutData.backdrop.gradient.centerX`},{path:`modifiedFields.richContentDescription.nodes.layoutData.backdrop.gradient.centerY`},{path:`modifiedFields.richContentDescription.nodes.layoutData.backdrop.gradient.stops.position`},{path:`modifiedFields.richContentDescription.nodes.shapeData.shape.duration`},{path:`modifiedFields.richContentDescription.nodes.cardData.background.gradient.centerX`},{path:`modifiedFields.richContentDescription.nodes.cardData.background.gradient.centerY`},{path:`modifiedFields.richContentDescription.nodes.cardData.background.gradient.stops.position`},{path:`modifiedFields.richContentDescription.nodes.cardData.backgroundImage.media.duration`},{path:`modifiedFields.richContentDescription.nodes.cardData.backgroundImage.overlay.gradient.centerX`},{path:`modifiedFields.richContentDescription.nodes.cardData.backgroundImage.overlay.gradient.centerY`},{path:`modifiedFields.richContentDescription.nodes.cardData.backgroundImage.overlay.gradient.stops.position`},{path:`modifiedFields.richContentDescription.nodes.tocData.fontSize`},{path:`modifiedFields.richContentDescription.nodes.tocData.itemSpacing`},{path:`modifiedFields.richContentDescription.nodes.smartBlockCellData.shape.duration`}]}])))(),Nn=ht(Tn);G(En),G(Dn),G(On),G(kn),G(An),G(jn),G(Mn);function Pn(e){if(!e)return null;let t=e.match(/image:\/\/v1\/([^/#]+)/);return t?.[1]?t[1]:e.match(/\/media\/([^/]+)/)?.[1]??null}function Fn(e){if(!e)return null;let t=e.match(/#originWidth=(\d+)&originHeight=(\d+)/);return t?{width:parseInt(t[1],10),height:parseInt(t[2],10)}:null}var In=e=>`/category/${e}`,Ln=e=>({...e,nodes:e.nodes??[]}),Rn=e=>{if(!e)return;let t=Fn(e);return{uri:Pn(e)??void 0,url:e,width:t?.width,height:t?.height}},zn=e=>e.filter(e=>e.categoryId).map(e=>{let t=e.categorySlug??``;return{id:e.categoryId??``,name:e.categoryName??``,slug:t,href:In(t)}}),Bn=e=>({type:e.type,props:e.props??void 0,meta:e.meta??void 0,children:e.children,custom:e.custom,disabled:e.disabled}),Vn=e=>{if(e)return{preventAutoRedirect:e.preventAutoRedirect,keywords:e.keywords?.map(e=>({term:e.term,isMain:e.isMain,origin:e.origin??void 0}))}},Hn=e=>{if(e)return{tags:e.tags?.map(Bn),settings:Vn(e.settings)}};function Un(e){return{id:e._id??``,name:e.name??``,slug:e.slug??``,description:e.description??void 0,itemCounter:e.itemCounter,parentCategoryId:e.parentCategory?._id??void 0,seoData:Hn(e.seoData),richContentDescription:e.richContentDescription?Ln(e.richContentDescription):void 0,image:Rn(e.image),breadcrumbs:zn(e.breadcrumbsInfo?.breadcrumbs??[])}}var Wn={appNamespace:`@wix/stores`,treeKey:null},Gn=[Z.BREADCRUMBS_INFO,Z.DESCRIPTION,Z.RICH_CONTENT_DESCRIPTION],Kn=(e,t)=>{if(!e?._id||e.visible===!1)throw Error(t);return Un(e)};async function qn(e){return Kn(await Nn(e,Wn,{fields:Gn}),`Category not found for id: ${e}`)}var Jn=`wixstores-storefront-builder:category-info-context-data`;function Yn(e){return rn(`${Jn}:${e}`,()=>qn(e))}var Xn=Y(`@wix/site-service-url`),Q=`215238eb-22a5-4c36-9e7b-e7c08025e04e`;`${Q}`,`${Q}`;var Zn=function(e){return e.SIDE_CART=`ecom_side_cart`,e.CART=`shopping_cart`,e.CHECKOUT=`checkout`,e.PRODUCT_PAGE=`product-page-builder`,e.CATEGORY_PAGE=`category-page-builder`,e}({}),Qn=()=>{let e=s(Xn),t=n((t,n)=>{let r=e.appSectionRelativeUrl(Q,t,!0);if(r)return`./${r.replace(/^\//,``).replace(/\/$/,``)}/${encodeURIComponent(n)}`},[e]);return{getPageRelativeUrl:t,getPageAbsoluteUrl:n((n,r)=>{let i=t(n,r);if(i)return new URL(i,`${e.siteUrl.replace(/\/$/,``)}/`).href},[t,e])}};function $n(e){let{getPageAbsoluteUrl:t}=Qn(),n=i(()=>{if(!e.slug)return;let n=t(Zn.CATEGORY_PAGE,e.slug);return n?{href:n}:void 0},[e.slug,t]);return i(()=>({id:e.id,name:e.name,slug:e.slug,link:n,description:e.description,richContentDescription:e.richContentDescription,image:e.image,breadcrumbs:e.breadcrumbs}),[e,n])}var $=t(null);$.displayName=`CategoryInfoContext`;function er(){let e=r($);if(!e)throw Error(`useCategoryInfoContext must be used within a category info context provider`);return e}function tr({categoryPromise:e,children:t}){let n=$n(en(e));return c($.Provider,{value:n,children:t})}function nr({categoryId:t,children:n}){let r=Yn(t);return c(e,{fallback:null,children:c(tr,{categoryPromise:r,children:n})})}function rr({children:e,value:t,categoryId:n}){return t===void 0?n?c(nr,{categoryId:n,children:e},n):null:c($.Provider,{value:t,children:e})}var ir=$t(`0d8869b2-7691-4ee2-9d0b-90d72f34edd0`);export{rr as default,ir as injectAccessTokenGetter,er as useCategoryInfoContext};
2
+ //# sourceMappingURL=context-provider-0d8869b2-7691-4ee2-9d0b-90d72f34edd0-BMf-s7dC.js.map
@@ -0,0 +1,101 @@
1
+ import React from "react";
2
+
3
+ //#region ../../node_modules/type-fest/source/observable-like.d.ts
4
+ declare global {
5
+ // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
6
+ interface SymbolConstructor {
7
+ readonly observable: symbol;
8
+ }
9
+ }
10
+ /**
11
+ @remarks
12
+ The TC39 observable proposal defines a `closed` property, but some implementations (such as xstream) do not as of 10/08/2021.
13
+ As well, some guidance on making an `Observable` to not include `closed` property.
14
+ @see https://github.com/tc39/proposal-observable/blob/master/src/Observable.js#L129-L130
15
+ @see https://github.com/staltz/xstream/blob/6c22580c1d84d69773ee4b0905df44ad464955b3/src/index.ts#L79-L85
16
+ @see https://github.com/benlesh/symbol-observable#making-an-object-observable
17
+
18
+ @category Observable
19
+ */
20
+ //#endregion
21
+ //#region ../../node_modules/@wix/sdk-types/internal/build/index.d.ts
22
+ declare global {
23
+ interface ContextualClient {}
24
+ }
25
+ /**
26
+ * Creates concrete types from SDK descriptors when a contextual client is
27
+ * available.
28
+ *
29
+ * For a REST descriptor the built (bound) API is intersected with the original
30
+ * descriptor, matching what `contextualizeRESTModuleV2` returns at runtime — a
31
+ * value callable as the bound API and still usable as a descriptor. Keeping the
32
+ * descriptor half lets contextual modules be passed to descriptor-constrained
33
+ * helpers such as `elevate` from `@wix/sdk/context` (FEDINF-14092).
34
+ *
35
+ * The `& T` is scoped to REST descriptors — the only shape codegen wraps in
36
+ * `MaybeContext` — so `BuildDescriptors` (used by `createClient().use`) is left
37
+ * unchanged and stays bound-only. The fix lives here rather than in `elevate`,
38
+ * which is kept strict on purpose (see #941) so it still rejects bound-only
39
+ * functions that are unsafe through `createRESTModule`.
40
+ */
41
+ declare global {
42
+ /**
43
+ * A global interface to set the exposure toggle for the SDK.
44
+ * @example
45
+ * ```ts
46
+ * declare global {
47
+ * interface SDKExposureToggle {
48
+ * alpha: true;
49
+ * }
50
+ * }
51
+ */
52
+ interface SDKExposureToggle {}
53
+ }
54
+ declare global {
55
+ /**
56
+ * A global interface to set the type mode for the SDK.
57
+ * @example
58
+ * ```ts
59
+ * declare global {
60
+ * interface SDKTypeMode {
61
+ * strict: true;
62
+ * }
63
+ * }
64
+ */
65
+ interface SDKTypeMode {}
66
+ }
67
+ //#endregion
68
+ //#region src/domain/category/category-node/category-node.d.ts
69
+ interface CategoryNode {
70
+ id: string | null | undefined;
71
+ name?: string | null | undefined;
72
+ slug?: string | null | undefined;
73
+ href: string;
74
+ parentCategoryId?: string | null | undefined;
75
+ sortIndex?: number | null | undefined;
76
+ childCategoryIds: string[];
77
+ }
78
+ type CategoryNodes = Partial<Record<string, CategoryNode>>;
79
+ //#endregion
80
+ //#region src/extensions/gallery/providers/category-list-context/contract.d.ts
81
+ interface CategoryListContextValue {
82
+ /** All visible store categories, keyed by category id. */
83
+ categories: CategoryNodes;
84
+ /** Id of the current category, or `undefined` when there is none. */
85
+ currentCategoryId: string | undefined;
86
+ }
87
+ //#endregion
88
+ //#region src/extensions/gallery/providers/category-list-context/category-list-context-provider.d.ts
89
+ /** Reads the visible store categories and the current category. */
90
+ declare function useCategoryListContext(): CategoryListContextValue;
91
+ /** Props accepted by {@link CategoryListContextProvider}. */
92
+ interface CategoryListContextProviderProps extends React.PropsWithChildren {
93
+ value: CategoryListContextValue;
94
+ }
95
+ /** Supplies the category list and current category to descendant components. */
96
+ declare function CategoryListContextProvider({
97
+ children,
98
+ value
99
+ }: CategoryListContextProviderProps): React.ReactNode;
100
+ //#endregion
101
+ export { CategoryListContextProviderProps, type CategoryListContextValue, CategoryListContextProvider as default, useCategoryListContext };
@@ -0,0 +1,2 @@
1
+ import{createContext as e,useContext as t}from"react";import{jsx as n}from"react/jsx-runtime";var r={};function i(e,t=!1,n=e=>e){return()=>({__type:`event-definition`,type:e,isDomainEvent:t,transformations:n})}var a=e=>{switch(e){case`get`:case`GET`:return`GET`;case`post`:case`POST`:return`POST`;case`put`:case`PUT`:return`PUT`;case`delete`:case`DELETE`:return`DELETE`;case`patch`:case`PATCH`:return`PATCH`;case`head`:case`HEAD`:return`HEAD`;case`options`:case`OPTIONS`:return`OPTIONS`;default:throw Error(`Unknown method: ${e}`)}},o=e=>t=>async n=>{let r,i=t=>{if(r=e(n)(t),r.url===void 0)throw Error(`Url was not successfully created for this request, please reach out to support channels for assistance.`);let{method:i,url:o,params:s}=r;return{...r,method:a(i),url:o,data:r.data,params:s}};try{let e=await t.request(i);if(r===void 0)throw Error(`Request options were not created for this request, please reach out to support channels for assistance.`);let n=Array.isArray(r.transformResponse)?r.transformResponse:[r.transformResponse],a=e.data;return n.forEach(t=>{t&&(a=t(e.data,e.headers))}),a}catch(e){throw typeof e==`object`&&e&&`response`in e&&typeof e.response==`object`&&e.response!==null&&`data`in e.response?e.response.data:e}},s=e=>e.__isAmbassador?!0:!!e().__isAmbassador,c=`__metadata`,l=`edge.wixapis.com`,u=class extends Error{message;response;constructor(e,t){super(e),this.message=e,this.response=t}async details(){let e=await this.response.json();return d(this.response.status,e?.message,e?.details,{requestId:this.response.headers.get(`X-Wix-Request-Id`),details:e})}},d=(e,t,n,r)=>({details:{...!n?.validationError&&{applicationError:{description:t,code:e,data:r}},...n},message:t,requestId:r?.requestId}),ee=e=>e?.method&&[`post`,`put`,`patch`].includes(e.method.toLocaleLowerCase())&&e.body?{"Content-Type":`application/json`}:{},f=e=>e&&typeof e==`object`&&!Array.isArray(e),p=e=>e.__type===`host`;function te(e,t){return e.create(t)}var m=`x-wix-bi-gateway`;function h(e,t,n){return{[m]:g({environment:`js-sdk${n?`-${n}`:``}`,"package-name":e.packageName??t?.PACKAGE_NAME,"method-fqn":e.methodFqn,entity:e.entityFqdn})}}function g(e){return Object.entries(e).filter(([e,t])=>!!t).map(([e,t])=>`${e}=${t}`).join(`,`)}function _(e){let t=globalThis.__wix_context__,n={client:r.client,elevatedClient:r.elevatedClient},i;globalThis.__wix_context__=void 0,r.client=void 0,r.elevatedClient=void 0,typeof $wixContext<`u`&&(i={client:$wixContext?.client,elevatedClient:$wixContext?.elevatedClient},delete $wixContext.client,delete $wixContext.elevatedClient);try{return e()}finally{globalThis.__wix_context__=t,r.client=n.client,r.elevatedClient=n.elevatedClient,typeof $wixContext<`u`&&($wixContext.client=i.client,$wixContext.elevatedClient=i.elevatedClient)}}var v={id:`_id`,createdDate:`_createdDate`,updatedDate:`_updatedDate`};function y(e){return w(e).map(e=>e.toLocaleUpperCase()).join(`_`)}var b=/([\p{Ll}\d])(\p{Lu})/gu,x=/(\p{Lu})([\p{Lu}][\p{Ll}])/gu,S=`$1\0$2`,C=/[^\p{L}\d]+/giu;function w(e){let t=e.trim();t=t.replace(b,S).replace(x,S),t=t.replace(C,`\0`);let n=0,r=t.length;for(;t.charAt(n)===`\0`;)n++;if(n===r)return[];for(;t.charAt(r-1)===`\0`;)r--;return t.slice(n,r).split(/\0/g)}var ne=e=>`validationError`in(e.response?.data?.details??{}),T=e=>`applicationError`in(e.response?.data?.details??{}),re=e=>(e.response?.status??-1)>=400&&(e.response?.status??-1)<500;function ie(e,t={explicitPathsToArguments:{},spreadPathsToArguments:{},singleArgumentUnchanged:!1},n=[]){if(typeof e!=`object`||!e)throw e;if(ne(e))return ae(e,t,n);if(T(e))return D(e);if(re(e)){let t=e.response?.status,n=e.response?.statusText??`UNKNOWN`,r=e.response?.data?.message??n,i={applicationError:{description:n,code:y(n),data:{}},requestId:e.requestId};return E(e,{message:JSON.stringify({message:r,details:i},null,2),extraProperties:{details:i,status:t}})}return O(e)}var ae=(e,t,n)=>{let r=e.response?.data,i=e.requestId,{fieldViolations:a}=r.details.validationError,o=k(t,a,n)?.sort((e,t)=>e.field<t.field?-1:1),s=`INVALID_ARGUMENT: ${o?.map(({field:e,description:t})=>`"${e}" ${t}`)?.join(`, `)}`,c={validationError:{fieldViolations:o},requestId:i};return E(e,{message:JSON.stringify({message:s,details:c},null,2),extraProperties:{details:c,status:e.response?.status,requestId:i}})},E=(e,{message:t,extraProperties:n})=>Object.assign(e,{...n,message:t}),D=e=>{let t=e.response?.status,n=e.response?.statusText??`UNKNOWN`,r=e.response?.data?.message??n,i=e.response?.data?.details?.applicationError?.description??n,a=e.response?.data?.details?.applicationError?.code??y(n),o=e.response?.data?.details?.applicationError?.data??{},s=r===i?r:`${r}: ${i}`,c={applicationError:{description:i,code:a,data:o},requestId:e.requestId};return E(e,{message:JSON.stringify({message:s,details:c},null,2),extraProperties:{details:c,status:t,requestId:e.requestId}})},O=e=>E(e,{message:e.requestId?`System error occurred, request-id: ${e.requestId}`:`System error occurred: ${JSON.stringify(e)}`,extraProperties:{requestId:e.requestId,status:e.response?.status,code:y(e.response?.statusText??`UNKNOWN`),...!e.response&&{runtimeError:e}}}),k=({spreadPathsToArguments:e,explicitPathsToArguments:t,singleArgumentUnchanged:n},r,i)=>{let a={...e,...t},o=Object.keys(a);return r?.filter(e=>!r.some(t=>t.field.length>e.field.length&&t.field.startsWith(e.field)&&o.includes(t.field))).map(e=>{let r=t[e.field];if(r)return{...e,field:A(r,i)};let s=o?.sort((e,t)=>t.length-e.length)?.find(t=>e.field.startsWith(t));if(s){let t=a[s];if(t)return{...e,field:e.field.replace(s,A(t,i))}}return n?{...e,field:`${i[0]}.${e.field}`}:e})},A=(e,t)=>{let n=j(e);return n==null?e:e.replace(`$[${n}]`,t[n])},j=e=>{let t=e.match(/\$\[(?<argIndex>\d+)\]/);return t&&t.groups&&Number(t.groups.argIndex)};function M(e,t,n,r,i,a,o,s,c,u,d){return _(()=>e({request:async e=>{let i=e({host:s?.HTTPHost||`www.wixapis.com`}),a=i;a.method===`GET`&&a.fallback?.length&&(a.params?.toString().length??0)>4e3&&(a=i.fallback[0]);let o=s?.HTTPHost??`www.wixapis.com`,d=`https://${u?l:o}${a.url}`;a.params&&a.params.toString()&&(d+=`?${a.params.toString()}`);try{let e=h(i,t,c),o={method:a.method,...a.data&&{body:JSON.stringify(a.data)},headers:{...e}},s=await n(d,o);if(s.status!==200){let e=null;try{e=await s.json()}catch{}let t=P(s.status,e?.message??s.statusText,e?.details,{requestId:s.headers.get(`X-Wix-Request-Id`),details:e}),n=ie(t);throw r?.handleError(n,{requestOptions:{url:a.url,method:a.method,entityFqdn:i.entityFqdn,methodFqn:i.methodFqn}}),t}let l=await s.json();return{data:a.migrationOptions?.optInTransformResponse&&a.transformResponse?Array.isArray(a.transformResponse)?a.transformResponse[0](l):a.transformResponse(l):l,headers:s.headers,status:s.status,statusText:s.statusText}}catch(e){throw e.message?.includes(`fetch is not defined`)&&console.error(`Node.js v18+ is required`),e}},fetchWithAuth:n,wixAPIFetch:i,getActiveToken:a,getAuthHeaders:o},{validateRequestSchema:d}))}var N=class extends Error{response;requestId;constructor(e){super(),this.response=e.response,this.requestId=e.requestId}},P=(e,t,n,r)=>new N({response:{data:{details:{...!n?.validationError&&{applicationError:{description:t,code:e,data:r}},...n},message:t},status:e},requestId:r?.requestId}),F=`.`;function I(e,t,n){if(e==null)throw Error(`Cannot set value on null or undefined`);let r=L(t),i=e;for(let e=0;e<r.length;e++){let t=r[e];if(e===r.length-1){i[t]=n;break}let a=r[e+1];(!(t in i)||i[t]==null||typeof i[t]!=`object`||i[t]===null)&&(i[t]=typeof a==`number`?[]:{}),i=i[t]}return e}function L(e){return Array.isArray(e)?e:e.split(F).map(e=>R(e)?Number(e):e)}function R(e){return/^\d+$/.test(e)}function z(e){let t={};for(let[n,r]of Object.entries(e))B(n)||I(t,L(n),r);return t}function B(e){return e===`__proto__`||e===`constructor`||e===`prototype`}var V=class{BRACKET_PATTERN=/\[(\d+)\]/g;NUMERIC_PATTERN=/^\d+$/;ESCAPED_DOT_PATTERN=/\\\./g;ESCAPED_LEFT_BRACKET_PATTERN=/\\\[/g;ESCAPED_RIGHT_BRACKET_PATTERN=/\\\]/g;SPLIT_PATTERN=/\.|\[(\d+)\]/g;DOT_BEFORE_BRACKET_PATTERN=/\.\[/g;ESCAPED_DOT_PLACEHOLDER=`__DOT__`;ESCAPED_RIGHT_BRACKET_PLACEHOLDER=`__RB__`;ESCAPED_LEFT_BRACKET_PLACEHOLDER=`__LB__`;modifiedFields;cleanedModifiedFields;constructor(e){this.modifiedFields=e}replaceEscapedCharacters(e){return e.replace(this.ESCAPED_DOT_PATTERN,this.ESCAPED_DOT_PLACEHOLDER).replace(this.ESCAPED_LEFT_BRACKET_PATTERN,this.ESCAPED_LEFT_BRACKET_PLACEHOLDER).replace(this.ESCAPED_RIGHT_BRACKET_PATTERN,this.ESCAPED_RIGHT_BRACKET_PLACEHOLDER)}restoreEscapedCharacters(e){return e.replace(this.ESCAPED_DOT_PLACEHOLDER,`\\.`).replace(this.ESCAPED_RIGHT_BRACKET_PLACEHOLDER,`\\]`).replace(this.ESCAPED_LEFT_BRACKET_PLACEHOLDER,`\\[`)}unflatten(){return this.cleanedModifiedFields=Object.fromEntries(Object.entries(this.modifiedFields).map(([e,t])=>[this.replaceEscapedCharacters(this.bracketToDotNotation(e)),t])),z(this.cleanedModifiedFields)}flatten(e){let t={};for(let n of Object.keys(this.cleanedModifiedFields)){let r=this.splitPath(n),i=this.navigatePath(e,r);t={...t,...i}}return Object.fromEntries(Object.entries(t).map(([e,t])=>[this.restoreEscapedCharacters(e),t]))}splitPath(e){let t=[],n=0,r=Array.from(e.matchAll(this.SPLIT_PATTERN));for(let i of r)i.index>n&&t.push(e.substring(n,i.index)),i[1]&&t.push(i[1]),n=i.index+i[0].length;return n<e.length&&t.push(e.substring(n)),t}navigatePath(e,t){let n=e,r=[],i=e=>{if(!Array.isArray(n))throw Error(`Expected array at path ${this.buildPathString(r)}, but got ${typeof n}`);r.push(`[${e}]`),n=n[parseInt(e,10)]},a=(e,t)=>{let i=e in v?v[e]:void 0;if(i&&i in t){r.push(i),n=t[i];return}let a=G(e);if(a&&a in t){r.push(a),n=t[a];return}throw Error(`Cannot find key '${e}' or its transformations at path ${this.buildPathString(r)}`)},o=(e,t)=>{r.push(e),n=t[e]};for(let e of t){if(this.NUMERIC_PATTERN.test(e)){i(e);continue}if(typeof n!=`object`||!n)throw Error(`Cannot access property '${e}' on ${typeof n} at path ${this.buildPathString(r)}`);let t=n;if(e in n){o(e,t);continue}a(e,t)}return{[this.buildPathString(r)]:n}}buildPathString(e){return e.join(`.`).replace(this.DOT_BEFORE_BRACKET_PATTERN,`[`)}bracketToDotNotation(e){return e.replace(this.BRACKET_PATTERN,(t,n,r)=>r>0&&e[r-1]===`\\`?t:`.`+n)}};function H(e,t){let n=e?.modifiedFields;if(!n)return null;let r=U(n);if(!r)return null;let{unflattenedModifiedFields:i,modifiedFieldsManipulator:a}=r;e={...e,modifiedFields:i};let o=t(e),s=o?.modifiedFields;if(!s)return null;let c=W(s,a);return c===null?null:(o.modifiedFields=c,o)}function U(e){if(typeof e==`object`&&e&&!Array.isArray(e))try{let t=new V(e);return{unflattenedModifiedFields:t.unflatten(),modifiedFieldsManipulator:t}}catch{return null}return null}function W(e,t){if(typeof e==`object`&&e&&!Array.isArray(e))try{return t.flatten(e)}catch{return null}return null}function G(e){return e.replace(/[-_\s]+(.)?/g,(e,t)=>t?t.toUpperCase():``).replace(/^./,e=>e.toLowerCase())}function K(){return{emit(e,...t){for(let n=0,r=this.events[e]||[],i=r.length;n<i;n++)r[n](...t)},events:{},on(e,t){return(this.events[e]||=[]).push(t),()=>{this.events[e]=this.events[e]?.filter(e=>t!==e)}}}}var q=e=>e.__type===`event-definition`;function J(e,t,n,r){let i;if(e.isDomainEvent){let{deletedEvent:e,actionEvent:t,createdEvent:a,updatedEvent:o,...s}=n,c={...r,...s};i=e?e?.deletedEntity?{entity:e?.deletedEntity,metadata:c}:{metadata:c}:t?{data:t.body,metadata:c}:o?{entity:o.currentEntity,metadata:c,...o.modifiedFields?{modifiedFields:o.modifiedFields}:{}}:{entity:a?.entity,metadata:c}}else i={data:n,metadata:r};let a=e.transformations??(e=>e),o=i,s=i;if(s.modifiedFields){let e=s.modifiedFields;if(typeof e==`object`&&e&&!Array.isArray(e)){o=structuredClone(i);let e=H(s,a);if(e)return t(e)}}return t(a(o))}function oe(e){let t=new Map,n=K();return{initModule(e){return r=>{let i=t.get(e.type)??[];i.push({eventDefinition:e,handler:r}),t.set(e.type,i),n.emit(`registered`,e)}},client:{...n,getRegisteredEvents:()=>t,async process(e,n={expectedEvents:[]}){let{eventType:r,identity:i,instanceId:a,payload:o,accountInfo:s}=await this.parseJWT(e),c=[...n.expectedEvents,...Array.from(t.keys()).map(e=>({type:e}))];if(c.length>0&&!c.some(({type:e})=>e===r))throw Error(`Unexpected event type: ${r}. Expected one of: ${c.map(e=>e.type).join(`, `)}`);let l=t.get(r)??[];return await Promise.all(l.map(({eventDefinition:e,handler:t})=>J(e,t,o,{instanceId:a,identity:i,accountInfo:s}))),{instanceId:a,eventType:r,payload:o,identity:i,accountInfo:s}},async processRequest(e,t){let n=await e.text();return this.process(n,t)},async parseJWT(t){let n=e();if(!n.decodeJWT)throw Error(`decodeJWT is not supported by the authentication strategy`);let{decoded:r,valid:i}=await n.decodeJWT(t);if(!i)throw Error(`JWT is not valid`);if(typeof r.data!=`string`)throw Error(`Unexpected type of JWT data: expected string, got ${typeof r.data}`);let a=JSON.parse(r.data),o=a.eventType,s=a.accountInfo,c=a.instanceId,l=a.identity?JSON.parse(a.identity):void 0;return{instanceId:c,eventType:o,payload:JSON.parse(a.data),identity:l,accountInfo:s}},async parseRequest(e){let t=await e.text();return this.parseJWT(t)},async executeHandlers(e){let n=Array.from(t.keys()).map(e=>({type:e}));if(n.length>0&&!n.some(({type:t})=>t===e.eventType))throw Error(`Unexpected event type: ${e.eventType}. Expected one of: ${n.map(e=>e.type).join(`, `)}`);let r=t.get(e.eventType)??[];await Promise.all(r.map(({eventDefinition:t,handler:n})=>J(t,n,e.payload,{instanceId:e.instanceId,identity:e.identity})))},apps:{AppInstalled:i(`AppInstalled`)(),AppRemoved:i(`AppRemoved`)()}}}}var se=e=>e.__type===`service-plugin-definition`;function ce(e){let t=new Map,n=K();return{initModule(e){return r=>{let i=t.get(e.componentType.toLowerCase())??[];i.push({servicePluginDefinition:e,implementation:r}),t.set(e.componentType.toLowerCase(),i),n.emit(`registered`,e)}},client:{...n,getRegisteredServicePlugins:()=>t,async parseJWT(t){let n=e();if(!n.decodeJWT)throw Error(`decodeJWT is not supported by the authentication strategy`);let{decoded:r,valid:i}=await n.decodeJWT(t,!0);if(!i)throw Error(`JWT is not valid`);if(typeof r.data!=`object`||r.data===null||!(`metadata`in r.data)||typeof r.data.metadata!=`object`||r.data.metadata===null||!(`appExtensionType`in r.data.metadata)||typeof r.data.metadata.appExtensionType!=`string`)throw Error(`Unexpected JWT data: expected object with metadata.appExtensionType string`);return r.data},async process(e){let t=await this.parseJWT(e.body);return this.executeHandler(t,e.url)},async parseRequest(e){let t=await e.text();return this.parseJWT(t)},async processRequest(e){let t=await this.parseRequest(e);return this.processParsedRequest(t,e.url)},async processParsedRequest(e,t){try{let n=await this.executeHandler(e,t);return Response.json(n)}catch(e){if(e.errorType===`SPI`&&e.applicationCode&&e.httpCode)return Response.json({applicationError:{code:e.applicationCode,data:e.data}},{status:e.httpCode});throw e}},async executeHandler(e,n){let r=e.metadata.appExtensionType.toLowerCase(),i=t.get(r)??[];if(i.length===0)throw Error(`No service plugin implementations found for component type ${r}`);if(i.length>1)throw Error(`Multiple service plugin implementations found for component type ${r}. This is currently not supported`);let{implementation:a,servicePluginDefinition:o}=i[0],s=o.methods.find(e=>n.endsWith(e.primaryHttpMappingPath));if(!s)throw Error(`Unexpect request: request url did not match any method: `+n);let c=a[s.name];if(!c)throw Error(`Got request for service plugin method ${s.name} but no implementation was provided. Available methods: ${Object.keys(a).join(`, `)}`);return s.transformations.toREST(await c(s.transformations.fromREST(e)))}}}}var Y=`X-Wix-Consistent`;function le(e){let t=e.headers||{Authorization:``},n={getAuthHeaders:e=>Promise.resolve({headers:{}})},i=e.auth,a=typeof i==`function`?i:()=>i??n,l=()=>a().getAuthHeaders(e.host),d=()=>e.fetch??fetch,m=async(n,r)=>{let i=d(),a=await l(),o={...r?.headers??{},...a.headers,...e.host?.essentials?.passThroughHeaders,...t[`X-Wix-Consistent`]?{[Y]:t[Y]}:{}},s=e.host?.getErrorHandler?.();try{if(typeof n==`string`||n instanceof URL){let e=await i(n,{...r,headers:o});s?.handleError(e,{requestOptions:{url:n.toString(),method:r?.method}});let a=X(e);return a&&(t[Y]=a),e}{for(let[e,t]of Object.entries(o))typeof t==`string`&&n.headers.set(e,t);let e=await i(n,r);s?.handleError(e,{requestOptions:{url:n.url,method:r?.method}});let a=X(e);return a&&(t[Y]=a),e}}catch(e){throw s?.handleError(e,{requestOptions:{url:typeof n==`string`||n instanceof URL?n.toString():n.url,method:r?.method}}),e}},{client:h,initModule:g}=ce(a),{client:v,initModule:y}=oe(a),b=async(n,r)=>{let i=d(),a=await l(),o=ee(r),s=await i(n,{...r,headers:{...o,...t,...a?.headers,...r?.headers,...e.host?.essentials?.passThroughHeaders,...t[`X-Wix-Consistent`]?{[Y]:t[Y]}:{}}}),c=X(s);return c&&(t[Y]=c),s},x=(t,n)=>{if(q(t))return y(t);if(se(t))return g(t);if(p(t)&&e.host)return te(t,e.host);if(typeof t==`function`){if(`__type`in t&&t.__type===`wix_spi_error`)return t;let r=e.host?.apiBaseUrl??`www.wixapis.com`,i=e.useCDN===void 0?a().shouldUseCDN:e.useCDN;return M(_(()=>s(t))?o(t):t,n??{},b,e.host?.getErrorHandler?.(),(e,t)=>{let n=new URL(e,`https://${r}`);return n.host=r,n.protocol=`https`,b(n.toString(),t)},a().getActiveToken,async()=>l(),{HTTPHost:r},e.host?.name,i,e.validateRequestSchema)}return f(t)?Object.fromEntries(Object.entries(t).map(([e,n])=>[e,x(n,t[c])])):t},S=e=>{for(let n in e)t[n]=e[n]};return{...e.modules?x(e.modules):{},get auth(){let t=a();return t.getAuthHeaders=t.getAuthHeaders.bind(void 0,e.host),t},setHeaders:S,use:x,enableContext(e,t={elevated:!1}){e===`global`?globalThis.__wix_context__==null?t.elevated?globalThis.__wix_context__={elevatedClient:this}:globalThis.__wix_context__={client:this}:t.elevated?globalThis.__wix_context__.elevatedClient=this:globalThis.__wix_context__.client=this:t.elevated?r.elevatedClient=this:r.client=this},fetch:(t,n)=>{let r=e.host?.apiBaseUrl??`www.wixapis.com`,i=new URL(t,`https://${r}`);return i.host=r,i.protocol=`https`,b(i.toString(),n)},fetchWithAuth:m,async graphql(t,n,r={apiVersion:`alpha`}){let i=e?.host?.apiBaseUrl??`www.wixapis.com`,a=await b(`https://${i}/graphql/${r.apiVersion}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({query:t,variables:n})});if(a.status!==200)throw new u(`GraphQL request failed with status ${a.status}`,a);let{data:o,errors:s}=await a.json();return{data:o??{},errors:s}},webhooks:v,servicePlugins:h}}function X(e){return e.headers?.get(`X-Wix-Consistent`)??e.headers?.get(`x-wix-consistent`)}var ue=`x-wix-linguist`,de=`00000000-0000-0000-0000-000000000000`,fe=`false`,pe=()=>{let e=Z(`language`),t=Z(`locale`);if(e)return{[ue]:[e,t||e,fe,de].join(`|`)}};function me(){let e=null,t=null;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}var he=()=>(typeof window<`u`?window.commonConfig:void 0)??globalThis.commonConfig,Z=e=>he()?.[e],ge=({createHost:e})=>({__type:`host`,create:e=>({}),host:t=>{let{applicationId:n,componentId:r}=t??{},i=typeof window<`u`?window.wixEmbedsAPI:void 0,a=e(t),o=ve();return{...a,apiBaseUrl:o,getMonitoringClient:i?.getMonitoringClientFunction?.(n,r),essentials:{language:Z(`language`),locale:Z(`locale`),get passThroughHeaders(){return pe()}}}},auth:e=>{let t=typeof window<`u`?window.wixEmbedsAPI:void 0;!e&&_e()&&(e=t?.getAccessTokenFunction?.());let n=!1,{resolve:r,promise:i}=me();return{getAuthHeaders:async()=>{if(!e&&n&&(e=await i),!e)throw Error(`Failed to resolve auth token`);return{headers:{Authorization:await e()}}},getAccessTokenInjector:()=>(n=!0,e=>{r(e)})}}});function _e(){return typeof document<`u`&&document.currentScript?.tagName===`SCRIPT`}function ve(){let e=(typeof window<`u`?window.wixEmbedsAPI:void 0)?.getExternalBaseUrl?.();if(!e)return;let t=new URL(e);return t?.pathname&&t.pathname!==`/`?`${t.hostname}${t.pathname}`:t.hostname}var ye=({clientSdk:e,applicationId:t})=>({invoke:async({namespace:n,method:r,args:i})=>{if(!e)throw Error(`Wix Site SDK only works in a Wix site environment. Learn more: https://dev.wix.com/docs/sdk/host-modules/site/introduction`);return e.invoke({namespace:n,method:r,args:i,applicationId:t,accessToken:`accessToken`})},getAccessToken:()=>{throw Error(`Not implemented`)},observeState:()=>({disconnect:()=>{}})}),Q=ge({createHost:function(e){let t=(typeof $wixContext<`u`?$wixContext.clientSdk:void 0)??e?.clientSdk??(typeof window<`u`?window?.clientSdk:void 0),{applicationId:n}=e||{};if(!n)throw Error(`"createHost" was called without a required field "applicationId"`);return{channel:ye({clientSdk:t,applicationId:n}),close:()=>{}}}}),be=(e,t)=>{let n=Q.host({applicationId:e,componentId:t}),r=Q.auth();return le({auth:r,host:n}).enableContext(`module`),r.getAccessTokenInjector()},xe=e=>be(`215238eb-22a5-4c36-9e7b-e7c08025e04e`,e),$=e(null);$.displayName=`CategoryListContext`;function Se(){let e=t($);if(!e)throw Error(`useCategoryListContext must be used within a category list context provider`);return e}function Ce({children:e,value:t}){return n($.Provider,{value:t,children:e})}var we=xe(`5533ec46-14cb-4179-ac9c-985b289ff2dd`);export{Ce as default,we as injectAccessTokenGetter,Se as useCategoryListContext};
2
+ //# sourceMappingURL=context-provider-5533ec46-14cb-4179-ac9c-985b289ff2dd-3DcJHkIM.js.map