@fast-simon/storefront-kit
Version:
A comprehensive kit for developing storefronts with Fast Simon components, utilities, and React/Hydrogen support.
181 lines (160 loc) • 65.6 kB
JavaScript
"use strict";var jr=Object.defineProperty;var Ct=e=>{throw TypeError(e)};var Tr=(e,t,r)=>t in e?jr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var Et=(e,t,r)=>Tr(e,typeof t!="symbol"?t+"":t,r),kt=(e,t,r)=>t.has(e)||Ct("Cannot "+r);var he=(e,t,r)=>(kt(e,t,"read from private field"),r?r.call(e):t.get(e)),Be=(e,t,r)=>t.has(e)?Ct("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),He=(e,t,r,n)=>(kt(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const L=require("react"),ee=require("@remix-run/react");function Dr(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const re=Dr(L);var et={exports:{}},_e={};/**
* @license React
* react-jsx-runtime.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var Ot;function Ar(){if(Ot)return _e;Ot=1;var e=L,t=Symbol.for("react.element"),r=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,o=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function u(c,d,y){var v,x={},m=null,f=null;y!==void 0&&(m=""+y),d.key!==void 0&&(m=""+d.key),d.ref!==void 0&&(f=d.ref);for(v in d)n.call(d,v)&&!s.hasOwnProperty(v)&&(x[v]=d[v]);if(c&&c.defaultProps)for(v in d=c.defaultProps,d)x[v]===void 0&&(x[v]=d[v]);return{$$typeof:t,type:c,key:m,ref:f,props:x,_owner:o.current}}return _e.Fragment=r,_e.jsx=u,_e.jsxs=u,_e}var Se={};/**
* @license React
* react-jsx-runtime.development.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var jt;function Ir(){return jt||(jt=1,process.env.NODE_ENV!=="production"&&function(){var e=L,t=Symbol.for("react.element"),r=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),u=Symbol.for("react.provider"),c=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),y=Symbol.for("react.suspense"),v=Symbol.for("react.suspense_list"),x=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),f=Symbol.for("react.offscreen"),D=Symbol.iterator,T="@@iterator";function F(i){if(i===null||typeof i!="object")return null;var l=D&&i[D]||i[T];return typeof l=="function"?l:null}var O=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function b(i){{for(var l=arguments.length,h=new Array(l>1?l-1:0),p=1;p<l;p++)h[p-1]=arguments[p];C("error",i,h)}}function C(i,l,h){{var p=O.ReactDebugCurrentFrame,A=p.getStackAddendum();A!==""&&(l+="%s",h=h.concat([A]));var I=h.map(function(j){return String(j)});I.unshift("Warning: "+l),Function.prototype.apply.call(console[i],console,I)}}var z=!1,a=!1,w=!1,_=!1,P=!1,g;g=Symbol.for("react.module.reference");function R(i){return!!(typeof i=="string"||typeof i=="function"||i===n||i===s||P||i===o||i===y||i===v||_||i===f||z||a||w||typeof i=="object"&&i!==null&&(i.$$typeof===m||i.$$typeof===x||i.$$typeof===u||i.$$typeof===c||i.$$typeof===d||i.$$typeof===g||i.getModuleId!==void 0))}function E(i,l,h){var p=i.displayName;if(p)return p;var A=l.displayName||l.name||"";return A!==""?h+"("+A+")":h}function N(i){return i.displayName||"Context"}function $(i){if(i==null)return null;if(typeof i.tag=="number"&&b("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof i=="function")return i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case n:return"Fragment";case r:return"Portal";case s:return"Profiler";case o:return"StrictMode";case y:return"Suspense";case v:return"SuspenseList"}if(typeof i=="object")switch(i.$$typeof){case c:var l=i;return N(l)+".Consumer";case u:var h=i;return N(h._context)+".Provider";case d:return E(i,i.render,"ForwardRef");case x:var p=i.displayName||null;return p!==null?p:$(i.type)||"Memo";case m:{var A=i,I=A._payload,j=A._init;try{return $(j(I))}catch{return null}}}return null}var U=Object.assign,V=0,Q,ne,ie,H,Y,ce,Ce;function Ee(){}Ee.__reactDisabledLog=!0;function Ue(){{if(V===0){Q=console.log,ne=console.info,ie=console.warn,H=console.error,Y=console.group,ce=console.groupCollapsed,Ce=console.groupEnd;var i={configurable:!0,enumerable:!0,value:Ee,writable:!0};Object.defineProperties(console,{info:i,log:i,warn:i,error:i,group:i,groupCollapsed:i,groupEnd:i})}V++}}function We(){{if(V--,V===0){var i={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:U({},i,{value:Q}),info:U({},i,{value:ne}),warn:U({},i,{value:ie}),error:U({},i,{value:H}),group:U({},i,{value:Y}),groupCollapsed:U({},i,{value:ce}),groupEnd:U({},i,{value:Ce})})}V<0&&b("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var ue=O.ReactCurrentDispatcher,le;function oe(i,l,h){{if(le===void 0)try{throw Error()}catch(A){var p=A.stack.trim().match(/\n( *(at )?)/);le=p&&p[1]||""}return`
`+le+i}}var ke=!1,Oe;{var or=typeof WeakMap=="function"?WeakMap:Map;Oe=new or}function dt(i,l){if(!i||ke)return"";{var h=Oe.get(i);if(h!==void 0)return h}var p;ke=!0;var A=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var I;I=ue.current,ue.current=null,Ue();try{if(l){var j=function(){throw Error()};if(Object.defineProperty(j.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(j,[])}catch(K){p=K}Reflect.construct(i,[],j)}else{try{j.call()}catch(K){p=K}i.call(j.prototype)}}else{try{throw Error()}catch(K){p=K}i()}}catch(K){if(K&&p&&typeof K.stack=="string"){for(var k=K.stack.split(`
`),J=p.stack.split(`
`),M=k.length-1,W=J.length-1;M>=1&&W>=0&&k[M]!==J[W];)W--;for(;M>=1&&W>=0;M--,W--)if(k[M]!==J[W]){if(M!==1||W!==1)do if(M--,W--,W<0||k[M]!==J[W]){var B=`
`+k[M].replace(" at new "," at ");return i.displayName&&B.includes("<anonymous>")&&(B=B.replace("<anonymous>",i.displayName)),typeof i=="function"&&Oe.set(i,B),B}while(M>=1&&W>=0);break}}}finally{ke=!1,ue.current=I,We(),Error.prepareStackTrace=A}var fe=i?i.displayName||i.name:"",ae=fe?oe(fe):"";return typeof i=="function"&&Oe.set(i,ae),ae}function ar(i,l,h){return dt(i,!1)}function sr(i){var l=i.prototype;return!!(l&&l.isReactComponent)}function je(i,l,h){if(i==null)return"";if(typeof i=="function")return dt(i,sr(i));if(typeof i=="string")return oe(i);switch(i){case y:return oe("Suspense");case v:return oe("SuspenseList")}if(typeof i=="object")switch(i.$$typeof){case d:return ar(i.render);case x:return je(i.type,l,h);case m:{var p=i,A=p._payload,I=p._init;try{return je(I(A),l,h)}catch{}}}return""}var we=Object.prototype.hasOwnProperty,ft={},ht=O.ReactDebugCurrentFrame;function Te(i){if(i){var l=i._owner,h=je(i.type,i._source,l?l.type:null);ht.setExtraStackFrame(h)}else ht.setExtraStackFrame(null)}function cr(i,l,h,p,A){{var I=Function.call.bind(we);for(var j in i)if(I(i,j)){var k=void 0;try{if(typeof i[j]!="function"){var J=Error((p||"React class")+": "+h+" type `"+j+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof i[j]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw J.name="Invariant Violation",J}k=i[j](l,j,p,h,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(M){k=M}k&&!(k instanceof Error)&&(Te(A),b("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",p||"React class",h,j,typeof k),Te(null)),k instanceof Error&&!(k.message in ft)&&(ft[k.message]=!0,Te(A),b("Failed %s type: %s",h,k.message),Te(null))}}}var ur=Array.isArray;function Ve(i){return ur(i)}function lr(i){{var l=typeof Symbol=="function"&&Symbol.toStringTag,h=l&&i[Symbol.toStringTag]||i.constructor.name||"Object";return h}}function dr(i){try{return mt(i),!1}catch{return!0}}function mt(i){return""+i}function gt(i){if(dr(i))return b("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",lr(i)),mt(i)}var yt=O.ReactCurrentOwner,fr={key:!0,ref:!0,__self:!0,__source:!0},vt,wt;function hr(i){if(we.call(i,"ref")){var l=Object.getOwnPropertyDescriptor(i,"ref").get;if(l&&l.isReactWarning)return!1}return i.ref!==void 0}function mr(i){if(we.call(i,"key")){var l=Object.getOwnPropertyDescriptor(i,"key").get;if(l&&l.isReactWarning)return!1}return i.key!==void 0}function gr(i,l){typeof i.ref=="string"&&yt.current}function yr(i,l){{var h=function(){vt||(vt=!0,b("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",l))};h.isReactWarning=!0,Object.defineProperty(i,"key",{get:h,configurable:!0})}}function vr(i,l){{var h=function(){wt||(wt=!0,b("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",l))};h.isReactWarning=!0,Object.defineProperty(i,"ref",{get:h,configurable:!0})}}var wr=function(i,l,h,p,A,I,j){var k={$$typeof:t,type:i,key:l,ref:h,props:j,_owner:I};return k._store={},Object.defineProperty(k._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(k,"_self",{configurable:!1,enumerable:!1,writable:!1,value:p}),Object.defineProperty(k,"_source",{configurable:!1,enumerable:!1,writable:!1,value:A}),Object.freeze&&(Object.freeze(k.props),Object.freeze(k)),k};function _r(i,l,h,p,A){{var I,j={},k=null,J=null;h!==void 0&&(gt(h),k=""+h),mr(l)&&(gt(l.key),k=""+l.key),hr(l)&&(J=l.ref,gr(l,A));for(I in l)we.call(l,I)&&!fr.hasOwnProperty(I)&&(j[I]=l[I]);if(i&&i.defaultProps){var M=i.defaultProps;for(I in M)j[I]===void 0&&(j[I]=M[I])}if(k||J){var W=typeof i=="function"?i.displayName||i.name||"Unknown":i;k&&yr(j,W),J&&vr(j,W)}return wr(i,k,J,A,p,yt.current,j)}}var qe=O.ReactCurrentOwner,_t=O.ReactDebugCurrentFrame;function de(i){if(i){var l=i._owner,h=je(i.type,i._source,l?l.type:null);_t.setExtraStackFrame(h)}else _t.setExtraStackFrame(null)}var Je;Je=!1;function Ke(i){return typeof i=="object"&&i!==null&&i.$$typeof===t}function St(){{if(qe.current){var i=$(qe.current.type);if(i)return`
Check the render method of \``+i+"`."}return""}}function Sr(i){return""}var pt={};function pr(i){{var l=St();if(!l){var h=typeof i=="string"?i:i.displayName||i.name;h&&(l=`
Check the top-level render call using <`+h+">.")}return l}}function bt(i,l){{if(!i._store||i._store.validated||i.key!=null)return;i._store.validated=!0;var h=pr(l);if(pt[h])return;pt[h]=!0;var p="";i&&i._owner&&i._owner!==qe.current&&(p=" It was passed a child from "+$(i._owner.type)+"."),de(i),b('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',h,p),de(null)}}function xt(i,l){{if(typeof i!="object")return;if(Ve(i))for(var h=0;h<i.length;h++){var p=i[h];Ke(p)&&bt(p,l)}else if(Ke(i))i._store&&(i._store.validated=!0);else if(i){var A=F(i);if(typeof A=="function"&&A!==i.entries)for(var I=A.call(i),j;!(j=I.next()).done;)Ke(j.value)&&bt(j.value,l)}}}function br(i){{var l=i.type;if(l==null||typeof l=="string")return;var h;if(typeof l=="function")h=l.propTypes;else if(typeof l=="object"&&(l.$$typeof===d||l.$$typeof===x))h=l.propTypes;else return;if(h){var p=$(l);cr(h,i.props,"prop",p,i)}else if(l.PropTypes!==void 0&&!Je){Je=!0;var A=$(l);b("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",A||"Unknown")}typeof l.getDefaultProps=="function"&&!l.getDefaultProps.isReactClassApproved&&b("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function xr(i){{for(var l=Object.keys(i.props),h=0;h<l.length;h++){var p=l[h];if(p!=="children"&&p!=="key"){de(i),b("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",p),de(null);break}}i.ref!==null&&(de(i),b("Invalid attribute `ref` supplied to `React.Fragment`."),de(null))}}var Pt={};function Rt(i,l,h,p,A,I){{var j=R(i);if(!j){var k="";(i===void 0||typeof i=="object"&&i!==null&&Object.keys(i).length===0)&&(k+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var J=Sr();J?k+=J:k+=St();var M;i===null?M="null":Ve(i)?M="array":i!==void 0&&i.$$typeof===t?(M="<"+($(i.type)||"Unknown")+" />",k=" Did you accidentally export a JSX literal instead of a component?"):M=typeof i,b("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",M,k)}var W=_r(i,l,h,A,I);if(W==null)return W;if(j){var B=l.children;if(B!==void 0)if(p)if(Ve(B)){for(var fe=0;fe<B.length;fe++)xt(B[fe],i);Object.freeze&&Object.freeze(B)}else b("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else xt(B,i)}if(we.call(l,"key")){var ae=$(i),K=Object.keys(l).filter(function(Or){return Or!=="key"}),Ye=K.length>0?"{key: someKey, "+K.join(": ..., ")+": ...}":"{key: someKey}";if(!Pt[ae+Ye]){var kr=K.length>0?"{"+K.join(": ..., ")+": ...}":"{}";b(`A props object containing a "key" prop is being spread into JSX:
let props = %s;
<%s {...props} />
React keys must be passed directly to JSX without using spread:
let props = %s;
<%s key={someKey} {...props} />`,Ye,ae,kr,ae),Pt[ae+Ye]=!0}}return i===n?xr(W):br(W),W}}function Pr(i,l,h){return Rt(i,l,h,!0)}function Rr(i,l,h){return Rt(i,l,h,!1)}var Cr=Rr,Er=Pr;Se.Fragment=n,Se.jsx=Cr,Se.jsxs=Er}()),Se}process.env.NODE_ENV==="production"?et.exports=Ar():et.exports=Ir();var S=et.exports;const Nr="2024-10",Lr={storeDomain:"test",storefrontToken:"abc123",storefrontApiVersion:Nr,countryIsoCode:"US",languageIsoCode:"EN",getStorefrontApiUrl(){return""},getPublicTokenHeaders(){return{}},getShopifyDomain(){return""}},Fr=L.createContext(Lr);function $r(){const e=L.useContext(Fr);if(!e)throw new Error("'useShop()' must be a descendent of <ShopifyProvider/>");return e}function Le(e){const t={id:"",resource:null,resourceId:null,search:"",searchParams:new URLSearchParams,hash:""};if(typeof e!="string")return t;try{const{search:r,searchParams:n,pathname:o,hash:s}=new URL(e),u=o.split("/"),c=u[u.length-1],d=u[u.length-2];return!c||!d?t:{id:`${c}${r}${s}`||"",resource:d??null,resourceId:c||null,search:r,searchParams:n,hash:s}}catch{return t}}function Mr(e){const{countryIsoCode:t,languageIsoCode:r}=$r(),n=r.includes("_")?r.replace("_","-"):`${r}-${t}`;if(!n)throw new Error("useMoney(): Unable to get 'locale' from 'useShop()', which means that 'locale' was not passed to '<ShopifyProvider/>'. 'locale' is required for 'useMoney()' to work");const o=parseFloat(e.amount),{defaultFormatter:s,nameFormatter:u,narrowSymbolFormatter:c,withoutTrailingZerosFormatter:d,withoutCurrencyFormatter:y,withoutTrailingZerosOrCurrencyFormatter:v}=L.useMemo(()=>{const f={style:"currency",currency:e.currencyCode};return{defaultFormatter:me(n,f),nameFormatter:me(n,{...f,currencyDisplay:"name"}),narrowSymbolFormatter:me(n,{...f,currencyDisplay:"narrowSymbol"}),withoutTrailingZerosFormatter:me(n,{...f,minimumFractionDigits:0,maximumFractionDigits:0}),withoutCurrencyFormatter:me(n),withoutTrailingZerosOrCurrencyFormatter:me(n,{minimumFractionDigits:0,maximumFractionDigits:0})}},[e.currencyCode,n]),x=f=>f.type==="currency",m=L.useMemo(()=>({original:()=>e,currencyCode:()=>e.currencyCode,localizedString:()=>s().format(o),parts:()=>s().formatToParts(o),withoutTrailingZeros:()=>o%1===0?d().format(o):s().format(o),withoutTrailingZerosAndCurrency:()=>o%1===0?v().format(o):y().format(o),currencyName:()=>{var f;return((f=u().formatToParts(o).find(x))==null?void 0:f.value)??e.currencyCode},currencySymbol:()=>{var f;return((f=s().formatToParts(o).find(x))==null?void 0:f.value)??e.currencyCode},currencyNarrowSymbol:()=>{var f;return((f=c().formatToParts(o).find(x))==null?void 0:f.value)??""},amount:()=>s().formatToParts(o).filter(f=>["decimal","fraction","group","integer","literal"].includes(f.type)).map(f=>f.value).join("")}),[e,o,u,s,c,y,d,v]);return L.useMemo(()=>new Proxy(m,{get:(f,D)=>{var T;return(T=Reflect.get(f,D))==null?void 0:T.call(null)}}),[m])}const Tt=new Map;function me(e,t){const r=JSON.stringify([e,t]);return function(){let n=Tt.get(r);return n||(n=new Intl.NumberFormat(e,t),Tt.set(r,n)),n}}function Ur({data:e,as:t,withoutCurrency:r,withoutTrailingZeros:n,measurement:o,measurementSeparator:s="/",...u}){if(!Wr(e))throw new Error("<Money/> needs a valid 'data' prop that has 'amount' and 'currencyCode'");const c=Mr(e),d=t??"div";let y=c.localizedString;return(r||n)&&(r&&!n?y=c.amount:!r&&n?y=c.withoutTrailingZeros:y=c.withoutTrailingZerosAndCurrency),S.jsxs(d,{...u,children:[y,o&&o.referenceUnit&&S.jsxs(S.Fragment,{children:[s,o.referenceUnit]})]})}function Wr(e){return typeof e.amount=="string"&&!!e.amount&&typeof e.currencyCode=="string"&&!!e.currencyCode}const Vr=re.forwardRef(({alt:e,aspectRatio:t,crop:r="center",data:n,decoding:o="async",height:s="auto",loader:u=Me,loading:c="lazy",sizes:d,src:y,srcSetOptions:v={intervals:15,startingWidth:200,incrementSize:200,placeholderWidth:100},width:x="100%",...m},f)=>{const D=re.useMemo(()=>{const w=n!=null&&n.width&&(n!=null&&n.height)?n==null?void 0:n.width:void 0,_=n!=null&&n.width&&(n!=null&&n.height)?n==null?void 0:n.height:void 0;return{width:w,height:_,unitsMatch:!!Bt(w,_)}},[n]),T=re.useMemo(()=>{const _=xe((x||"100%").toString()),P=`${_.number}${_.unit}`,g=s==null,R=g?null:xe(s.toString()),E=R?`${R.number}${R.unit}`:"",N=g?"auto":E,$=y||(n==null?void 0:n.url),U=n!=null&&n.altText&&!e?n==null?void 0:n.altText:e||"",V=t||(D.unitsMatch?[Pe(D.width),Pe(D.height)].join("/"):void 0);return{width:P,height:N,src:$,alt:U,aspectRatio:V}},[x,s,y,n,e,t,D,m==null?void 0:m.key]),{intervals:F,startingWidth:O,incrementSize:b,placeholderWidth:C}=v,z=re.useMemo(()=>Kr(x,F,O,b),[x,F,O,b]);return Ht(T.width)?S.jsx(qr,{aspectRatio:t,crop:r,decoding:o,height:s,imageWidths:z,loader:u,loading:c,normalizedProps:T,passthroughProps:m,ref:f,width:x,data:n}):S.jsx(Jr,{aspectRatio:t,crop:r,decoding:o,imageWidths:z,loader:u,loading:c,normalizedProps:T,passthroughProps:m,placeholderWidth:C,ref:f,sizes:d,data:n})}),qr=re.forwardRef(({aspectRatio:e,crop:t,decoding:r,height:n,imageWidths:o,loader:s=Me,loading:u,normalizedProps:c,passthroughProps:d,width:y,data:v},x)=>{const m=re.useMemo(()=>{const f=Pe(y),D=Pe(n),T=e||(Bt(c.width,c.height)?[f,D].join("/"):c.aspectRatio?c.aspectRatio:void 0),F=o===void 0?void 0:Qt(o,T,t,{width:(v==null?void 0:v.width)??void 0,height:(v==null?void 0:v.height)??void 0}),O=D||(T&&f?f*(at(T)??1):void 0),b=zt(c.src,F,s),C=s({src:c.src,width:f,height:O,crop:c.height==="auto"?void 0:t});return{width:f,aspectRatio:T,height:O,srcSet:b,src:C}},[e,t,v,n,o,s,c,y]);return S.jsx("img",{ref:x,alt:c.alt,decoding:r,height:m.height,loading:u,src:m.src,srcSet:m.srcSet,width:m.width,style:{aspectRatio:m.aspectRatio,...d.style},...d})}),Jr=re.forwardRef(({crop:e,decoding:t,imageWidths:r,loader:n=Me,loading:o,normalizedProps:s,passthroughProps:u,placeholderWidth:c,sizes:d,data:y},v)=>{const x=re.useMemo(()=>{const m=r===void 0?void 0:Qt(r,s.aspectRatio,e,{width:(y==null?void 0:y.width)??void 0,height:(y==null?void 0:y.height)??void 0}),f=s.aspectRatio&&c?c*(at(s.aspectRatio)??1):void 0,D=zt(s.src,m,n),T=n({src:s.src,width:c,height:f,crop:e});return{placeholderHeight:f,srcSet:D,src:T}},[e,y,r,n,s,c]);return S.jsx("img",{ref:v,alt:s.alt,decoding:t,height:x.placeholderHeight,loading:o,sizes:d,src:x.src,srcSet:x.srcSet,width:c,...u,style:{width:s.width,aspectRatio:s.aspectRatio,...u.style}})}),Dt="https://placeholder.shopify.com";function Me({src:e,width:t,height:r,crop:n}){if(!e)return"";const o=new URL(e,Dt);return t&&o.searchParams.append("width",Math.round(t).toString()),r&&o.searchParams.append("height",Math.round(r).toString()),n&&o.searchParams.append("crop",n),o.href.replace(Dt,"")}function Bt(e="100%",t="auto"){return xe(e.toString()).unit===xe(t.toString()).unit}function xe(e){const t=e.replace(/[0-9.]/g,""),r=parseFloat(e.replace(t,""));return{unit:t===""?r===void 0?"auto":"px":t,number:r}}function Pe(e){if(e===void 0)return;const{unit:t,number:r}=xe(e.toString());switch(t){case"em":return r*16;case"rem":return r*16;case"px":return r;case"":return r;default:return}}function Ht(e){return typeof e=="number"||/\d(px|em|rem)$/.test(e)}function zt(e,t,r=Me){return e?(t==null?void 0:t.length)===0||!t?e:t.map((n,o)=>`${r({src:e,width:n.width,height:n.height,crop:n.crop})} ${t.length===3?`${o+1}x`:`${n.width??0}w`}`).join(", "):""}function Kr(e="100%",t,r,n){const o=Array.from({length:t},(u,c)=>c*n+r),s=Array.from({length:3},(u,c)=>(c+1)*(Pe(e)??0));return Ht(e)?s:o}function at(e){if(!e)return;const[t,r]=e.split("/");return 1/(Number(t)/Number(r))}function Qt(e,t,r="center",n){if(e)return e.map(o=>({width:o,height:t?o*(at(t)??1):void 0,crop:r})).filter(({width:o,height:s})=>!(n!=null&&n.width&&o>n.width||n!=null&&n.height&&s&&s>n.height))}const At={};function Yr(e,t){const r=At[e];if(r)return r;const n=new Promise((o,s)=>{const u=document.createElement("script");t!=null&&t.module?u.type="module":u.type="text/javascript",u.src=e,u.onload=()=>{o(!0)},u.onerror=()=>{s(!1)},(t==null?void 0:t.in)==="head"?document.head.appendChild(u):document.body.appendChild(u);const c=t==null?void 0:t.attributes;c&&Object.keys(c).forEach(d=>{u.setAttribute(d,c[d])})});return At[e]=n,n}function Br(e,t){const[r,n]=L.useState("loading");return L.useEffect(()=>{Yr(e,t).then(()=>n("done")).catch(()=>n("error"))},[e]),r}var st="public",Hr="no-store",It={maxAge:"max-age",staleWhileRevalidate:"stale-while-revalidate",sMaxAge:"s-maxage",staleIfError:"stale-if-error"};function zr(e){let t=[];return Object.keys(e).forEach(r=>{r==="mode"?t.push(e[r]):It[r]&&t.push(`${It[r]}=${e[r]}`)}),t.join(", ")}function G(e){return{mode:st,maxAge:1,staleWhileRevalidate:9,...e}}function ze(e){return{mode:st,maxAge:3600,staleWhileRevalidate:82800,...e}}function Gt(e){return{mode:st,maxAge:1,staleWhileRevalidate:86399,...e}}function Zt(e){return String(e).includes("__proto__")?JSON.parse(e,Qr):JSON.parse(e)}function Qr(e,t){if(e!=="__proto__")return t}function Ne(e,t){return e&&t?{...e,...t}:e||Gt()}function tt(e){return zr(Ne(e))}async function Gr(e,t){if(!e)return;let r=await e.match(t);if(r)return r}async function Zr(e,t,r,n){if(!e)return;let o=Ne(n),s=tt(Ne(o,{maxAge:(o.maxAge||0)+(o.staleWhileRevalidate||0)})),u=tt(Ne(o));r.headers.set("cache-control",s),r.headers.set("real-cache-control",u),r.headers.set("cache-put-date",String(Date.now())),await e.put(t,r)}async function Xr(e,t){e&&await e.delete(t)}function en(e,t){let r=e.headers.get("real-cache-control"),n=0;if(r){let o=r.match(/max-age=(\d*)/);o&&o.length>1&&(n=parseFloat(o[1]))}return[(Date.now()-Number(t))/1e3,n]}function tn(e,t){let r=t.headers.get("cache-put-date");if(!r)return!1;let[n,o]=en(t,r);return n>o}var ct={get:Gr,set:Zr,delete:Xr,generateDefaultCacheControlHeader:tt,isStale:tn};function ut(e){return`https://shopify.dev/?${e}`}function rn(e){return e||Gt()}async function nn(e,t){if(!e)return;let r=ut(t),n=new Request(r),o=await ct.get(e,n);if(!o)return;let s=await o.text();try{return[Zt(s),o]}catch{return[s,o]}}async function on(e,t,r,n){if(!e)return;let o=ut(t),s=new Request(o),u=new Response(JSON.stringify(r));await ct.set(e,s,u,rn(n))}function an(e,t){return ct.isStale(new Request(ut(e)),t)}function sn(e){let t=Array.isArray(e)?e:[e],r="";for(let n of t)n!=null&&(typeof n=="object"?r+=JSON.stringify(n):r+=n.toString());return encodeURIComponent(r)}var Qe=new Set;async function Xt(e,t,{strategy:r=G(),cacheInstance:n,shouldCacheResult:o=()=>!0,waitUntil:s,debugInfo:u}){let c=sn([...typeof e=="string"?[e]:e]),d=f=>{var D,T,F,O;f.displayName,(D=f.response)==null||D.url,(T=f.response)!=null&&T.status,(F=f.response)!=null&&F.statusText,Array.from(((O=f.response)==null?void 0:O.headers.entries())||[])},y;if(!n||!r||r.mode===Hr)return await t({addDebugData:d});let v=f=>on(n,c,{value:f,debugInfo:void 0},r),x=await nn(n,c);if(x&&typeof x[0]!="string"){let[{value:f,debugInfo:D},T]=x,F=an(c,T)?"STALE":"HIT";if(!Qe.has(c)&&F==="STALE"){Qe.add(c);let O=Promise.resolve().then(async()=>{let b=Date.now();try{let C=await t({addDebugData:d});o(C)&&(await v(C),y==null||y({result:C,cacheStatus:"PUT",overrideStartTime:b}))}catch(C){C.message&&(C.message="SWR in sub-request failed: "+C.message),console.error(C)}finally{Qe.delete(c)}});s==null||s(O)}return f}let m=await t({addDebugData:d});if(o(m)){let f=Promise.resolve().then(async()=>{await v(m)});s==null||s(f)}return m}function cn(e,t){return[e,{status:t.status,statusText:t.statusText,headers:Array.from(t.headers.entries())}]}function Nt([e,t]){return[e,new Response(e,t)]}async function un(e,t,{cacheInstance:r,cache:n,cacheKey:o=[e,t],shouldCacheResponse:s,waitUntil:u,debugInfo:c}){return!n&&(!t.method||t.method==="GET")&&(n=G()),Xt(o,async()=>{let d=await fetch(e,t);if(!d.ok)return d;let y=await d.text().catch(()=>"");try{y&&(y=Zt(y))}catch{}return cn(y,d)},{cacheInstance:r,waitUntil:u,strategy:n??null,debugInfo:c,shouldCacheResult:d=>"ok"in d?!1:s(...Nt(d))}).then(d=>"ok"in d?[null,d]:Nt(d))}var ge=void 0;function Lt(e,t){return ln(e.headers,t)}function ln(e,t){var n;let r=((n=e==null?void 0:e.get)==null?void 0:n.call(e,t))??(e==null?void 0:e[t]);return typeof r=="string"?r:null}function Ft(e){return{requestId:e?Lt(e,"request-id"):void 0,purpose:e?Lt(e,"purpose"):void 0}}function dn(e){let{cache:t,waitUntil:r,request:n}=e;return{run:({cacheKey:o,cacheStrategy:s,shouldCacheResult:u},c)=>Xt(o,c,{shouldCacheResult:u,strategy:s,cacheInstance:t,waitUntil:r,debugInfo:{...Ft(n),stackInfo:ge==null?void 0:ge()}}),fetch:(o,s,u)=>un(o,s??{},{waitUntil:r,cacheKey:[o,s],cacheInstance:t,debugInfo:{url:o,...Ft(n),stackInfo:ge==null?void 0:ge(),displayName:u==null?void 0:u.displayName},cache:u.cacheStrategy,...u}).then(([c,d])=>({data:c,response:d}))}}L.lazy(()=>Promise.resolve().then(()=>require("./log-seo-tags-TY72EQWZ-BuJmqTh2.cjs")));var er=L.createContext(void 0);er.Provider;var fn=()=>L.useContext(er);L.forwardRef((e,t)=>{let{waitForHydration:r,src:n,...o}=e;if(r)return S.jsx(hn,{src:n,options:o});let s=fn();return S.jsx("script",{suppressHydrationWarning:!0,...o,src:n,nonce:s,ref:t})});function hn({src:e,options:t}){if(!e)throw new Error("`waitForHydration` with the Script component requires a `src` prop");return Br(e,{attributes:t}),null}var mn={canTrack:()=>!1,cart:null,customData:{},prevCart:null,publish:()=>{},shop:null,subscribe:()=>{},register:()=>({ready:()=>{}}),customerPrivacy:null,privacyBanner:null};L.createContext(mn);function gn({product:e,imageAspectRatio:t="1/1"}){return S.jsx("div",{className:"fs-recommended-product",children:S.jsxs(ee.Link,{className:"fs-recommended-product-content",to:`/products/${e.handle}`,children:[S.jsx(Vr,{data:e.images.nodes[0],aspectRatio:t,sizes:"(min-width: 45em) 20vw, 50vw",className:"fs-recommended-product-image"}),S.jsx("h4",{children:e.title}),S.jsx("small",{children:S.jsx(Ur,{data:e.priceRange.minVariantPrice})})]})},e.id)}const yn=`
.fs-recommended-products-container {
width: 100%;
margin: 10px 0;
}
.fs-recommended-products-grid-container {
width: 100%;
overflow: auto hidden;
padding: 0 0 10px 0;
display: flex;
align-items: center;
}
.fs-recommended-products-grid {
grid-template-columns: repeat(var(--num-of-products), calc(calc(calc(100% / var(--mobile-breakpoint)) - var(--carousel-gap)) - 16px) );
display: grid;
grid-gap: var(--carousel-gap);
width: 100%;
max-width: -webkit-fill-available;
}
.fs-recommended-products-widget-title {
display: flex;
align-items: center;
justify-content: center;
font-family: Lato,sans-serif!important;
margin-bottom: 10px;
}
.fs-grid-arrows-container {
width: 100%;
position: relative;
height: 100%;
display: flex;
align-items: center;
}
.fs-arrows-container {
position: absolute;
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
opacity: calc(var(--num-of-products) - var(--mobile-breakpoint));
}
.fs-recommended-product {
display: flex;
overflow: hidden;
border-radius: 8px;
border: 1px solid var(--lines-disabled);
width: 100%;
height: 100%;
position: relative;
align-items: center;
justify-content: center;
}
.fs-recommended-product-content {
width: 100%;
height: 100%;
position: relative;
}
.fs-widget-arrow-left, .fs-widget-arrow-right {
display: flex;
width: 36px;
height: 36px;
flex-direction: column;
justify-content: center;
align-items: center;
cursor: pointer;
position: absolute;
z-index: 6;
border-radius: 200px;
background-color: #006CDC99;
transition: background-color 0.1s ease-in-out;
color: white;
}
.fs-arrow-icon {
height: inherit;
display: flex;
align-items: center;
fill: white;
}
.fs-widget-arrow-left {
left: 0;
transform: rotate(180deg);
}
.fs-widget-arrow-right {
right: 0;
}
.fs-recommended-product-image {
height: unset;
object-fit: cover;
}
.arrow-hide {
display: none;
}
.spinner-container {
display: flex;
justify-content: center;
align-items: center;
height: 100px;
}
.spinner {
border: 4px solid rgba(0, 0, 0, 0.1);
border-top: 4px solid #000000;
border-radius: 50%;
width: 36px;
height: 36px;
spin 0.8s cubic-bezier(0.26, 0.14, 0.59, 0.79) infinite
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
@media screen and (min-width: 1024px) {
.fs-recommended-products-grid {
grid-template-columns: repeat(var(--num-of-products), calc(calc(calc(100% / var(--desktop-breakpoint)) - var(--carousel-gap)) - 16px) );
}
.fs-recommended-products-container {
grid-area: span 2 / span 2;
}
.fs-arrows-container {
opacity: calc(var(--num-of-products) - var(--desktop-breakpoint));
}
}
@media screen and (min-width: 720px) and (max-width: 1023px) {
.fs-recommended-products-grid {
grid-template-columns: repeat(var(--num-of-products), calc(calc(calc(100% / var(--tablet-breakpoint)) - var(--carousel-gap)) - 16px) );
}
.fs-recommended-products-container {
grid-area: span 2 / span 2;
}
.fs-arrows-container {
opacity: calc(var(--num-of-products) - var(--tablet-breakpoint));
}
}
`;function $t(){return S.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",height:"1em",viewBox:"0 0 448 512",className:"fs-arrow-icon",children:S.jsx("path",{d:"M438.6 278.6c12.5-12.5 12.5-32.8 0-45.3l-160-160c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L338.8 224 32 224c-17.7 0-32 14.3-32 32s14.3 32 32 32l306.7 0L233.4 393.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0l160-160z"})})}const vn=()=>S.jsx("div",{className:"spinner-container",children:S.jsx("div",{className:"spinner"})});function wn({title:e,products:t,renderProduct:r,breakpoints:n={mobile:2,desktop:4,tablet:3},carouselGap:o=16,RightArrowIcon:s,imageAspectRatio:u}){const c=L.useRef(null),d=m=>{c.current&&c.current.scrollTo({left:m,behavior:"smooth"})},y=m=>{var F,O,b;if(!c.current)return;const f=c.current.scrollWidth/m,D=Math.floor(c.current.clientWidth/f)||1,T=c.current.scrollLeft+D*f-1;d(T),(b=(O=(F=c.current.parentElement)==null?void 0:F.querySelector(".fs-widget-arrow-left"))==null?void 0:O.classList)==null||b.remove("arrow-hide")},v=m=>{var F,O,b;if(!c.current)return;const f=c.current.scrollWidth/m,D=Math.floor(c.current.clientWidth/f)||1,T=c.current.scrollLeft-D*f+1;d(T),(b=(O=(F=c.current.parentElement)==null?void 0:F.querySelector(".fs-widget-arrow-right"))==null?void 0:O.classList)==null||b.remove("arrow-hide")},x=m=>{m.target.scrollLeft>0?m.target.parentElement.querySelector(".fs-widget-arrow-left").classList.remove("arrow-hide"):m.target.parentElement.querySelector(".fs-widget-arrow-left").classList.add("arrow-hide"),m.target.scrollLeft>=m.target.scrollWidth-m.target.clientWidth?m.target.parentElement.querySelector(".fs-widget-arrow-right").classList.add("arrow-hide"):m.target.parentElement.querySelector(".fs-widget-arrow-right").classList.remove("arrow-hide")};return S.jsxs(L.Fragment,{children:[S.jsx("style",{children:yn}),S.jsxs("div",{className:"fs-recommended-products-container",children:[S.jsx("h2",{className:"fs-recommended-products-widget-title",children:e??"Recommended Products"}),S.jsx(L.Suspense,{fallback:S.jsx(vn,{}),children:S.jsx(ee.Await,{resolve:t,children:({products:m})=>S.jsxs("div",{className:"fs-grid-arrows-container",style:{"--num-of-products":m.nodes.length,"--carousel-gap":`${o}px`,"--mobile-breakpoint":n.mobile,"--tablet-breakpoint":n.tablet,"--desktop-breakpoint":n.desktop},children:[S.jsxs("div",{className:"fs-arrows-container",children:[S.jsx("div",{className:"fs-widget-arrow fs-widget-arrow-left arrow-hide",onClick:()=>v(m.nodes.length),children:s??S.jsx($t,{})}),S.jsx("div",{className:"fs-widget-arrow fs-widget-arrow-right",onClick:()=>y(m.nodes.length),children:s??S.jsx($t,{})})]}),S.jsx("div",{className:"fs-recommended-products-grid-container",ref:c,onScroll:x,children:S.jsx("div",{className:"fs-recommended-products-grid",children:m.nodes.map((f,D)=>{if(r){const T=r(f,D+1);if(T)return T}return S.jsx(gn,{product:f,imageAspectRatio:u},f.id)})})})]})})}),S.jsx("br",{})]})]})}function be(e,t){const r=new URLSearchParams(e);for(const[n,o]of Object.entries(t)){if(o===void 0){r.delete(n);continue}r.set(n,String(o))}return r.toString()}function _n({total:e}){const[t]=ee.useSearchParams(),r=Number(t.get("page"))||1,n=e,o=[...Array.from(Array(n).keys())].map(s=>s+1);return S.jsxs("div",{className:"pagination-wrapper",children:[r>1?S.jsx(ee.Link,{to:{search:be(t,{page:Math.max(r-1,0)})},preventScrollReset:!0,prefetch:"intent",className:"arrow-button-wrapper arrow-button",children:S.jsxs("span",{className:"sr-only",children:[" ","<"]})}):null,S.jsx("span",{className:"center-pages-wrapper",children:o.map(s=>s===2&&r>4?S.jsx("span",{className:"page-number-item three-dots-item",children:"..."},"three-dots-left"):s===r?S.jsx(ee.Link,{to:{search:be(t,{page:s})},preventScrollReset:!0,prefetch:"intent",className:"page-number-item page-number-item-selected",children:S.jsxs("span",{className:"sr-only",children:[" ",s]})},`page_num_${s}_current`):s===r+1||s===r+2||s===r-1||s===r-2||s===n||s===1?S.jsx(ee.Link,{to:{search:be(t,{page:Math.max(s,0)})},preventScrollReset:!0,prefetch:"intent",className:"page-number-item",children:S.jsxs("span",{className:"sr-only",children:[" ",s]})},`page_num_${s}`):r<n-3&&s===n-1?S.jsx("span",{className:"page-number-item three-dots-item",children:"..."},"three-dots-right"):null)}),r<n?S.jsx(ee.Link,{to:{search:be(t,{page:Math.max(r+1,0)})},preventScrollReset:!0,prefetch:"intent",className:"arrow-button-wrapper",children:S.jsx("span",{className:"sr-only arrow-button",children:">"})}):null]})}const Sn=e=>({products:{nodes:e.map(t=>t!=null&&t.promotile?t:{handle:t.u.split("/").pop(),title:t.l,priceRange:{minVariantPrice:{amount:t.p,currencyCode:"USD"}},images:{nodes:[{altText:t.l,height:2048,width:1463,id:`gid://shopify/ProductImage/${t.id}`,url:t.t}]},featuredImage:{altText:t.l,height:2048,width:1463,id:`gid://shopify/ProductImage/${t.id}`,url:t.t},variants:{nodes:[{selectedOptions:[{name:"",value:""},{name:"",value:""}]}]},...t})}}),pn=[{sources:"similar_products_lookalike, similar_products,related_views,related_top_products,similar_products_by_attributes",max_suggest:"60",categories:"",widget_id:"similar-products-widget-1234",title:"Similar+Products"}],bn={relevency:"Best Match",relevance:"Best Match",price_min_to_max:"Price: Low to High",price_max_to_min:"Price: High to Low",creation_date:"Newest Arrivals",creation_date_oldest:"Oldest Products",popularity:"Popularity",reviews:"Customer Rating",a_to_z:"Alphabetical: A-Z",z_to_a:"Alphabetical: Z-A"},xn={relevance:"0",price_min_to_max:"1",price_max_to_min:"2",creation_date:"3",creation_date_oldest:"4",popularity:"5",reviews:"6",a_to_z:"7",z_to_a:"8"},Mt=e=>e.normalize("NFD").replace(/[\u0300-\u036f]/g,"");function Pn({keyword:e,query:t,options:r}){e=Mt(e),t=Mt(t);let n=e.toLowerCase().trim();const o=t.toLowerCase().trim(),s=t.length+1,u=n.split(" ").map(v=>v.trim()),c=o.split(" ").map(v=>v.trim()),d=(r==null?void 0:r.customScoreFunc)&&r.customScoreFunc(o,n);if(d)return{score:d,reason:"Custom",maxScore:-1,matchingKeyword:""};if(r!=null&&r.formatKeyword&&(n=r.formatKeyword(n)),n===o)return{score:t.length+1,reason:"Exact Match",maxScore:s,matchingKeyword:n};if(n.startsWith(t))return{score:t.length,reason:"Start With",maxScore:s,matchingKeyword:u[0]};const y=u.findIndex(v=>v.startsWith(o)||v.endsWith(o));if(y>-1)return{score:t.length-1,reason:t.length-1<1?"No Match":"Index Of Query",maxScore:s,matchingKeyword:u[y]};if(r!=null&&r.matchAllSubItems){let v=0;for(const x of c)(n.startsWith(x)||n.endsWith(x))&&v++;if(v>=c.length)return{score:t.length-1,reason:t.length-1<1?"No Match":"Index Of Sub Query",maxScore:s,matchingKeyword:c.join(",")}}else{let v=0;if(c.map(x=>{n.includes(x)&&v++}),v>=c.length)return{score:t.length-1,reason:t.length-1<1?"No Match":"Index Of Sub Query",maxScore:s,matchingKeyword:c.join(",")}}return{score:0,reason:"No Match",maxScore:s,matchingKeyword:""}}function pe({maxResult:e,data:t,query:r,key:n,minScore:o=1,options:s}){return Rn(t,r,n,s).sort((c,d)=>d.score-c.score).splice(0,e).filter(c=>c.score>0&&c.score>=o).map(({item:c})=>c)}function Rn(e,t,r,n){return!e||!e.map?[]:e.map(o=>({item:o,score:Pn({query:t,keyword:r?o[r]:o,options:n}).score}))}const Cn={getRecommendations:e=>{var r,n,o;let t="";if(!e.widgetIds)t="widgetIds is required";else if(!Array.isArray(e.widgetIds))t="widgetIds should be an array";else if(e.productId&&typeof e.productId!="string")t="productId should be a string";else if(e.widgetsToCategories&&typeof e.widgetsToCategories!="object")t="widgetsToCategories should be an object";else if(e.widgetsToCategories){const s=Object.keys(e.widgetsToCategories);for(let u=0;u<s.length&&!t;u++){const c=s[u];if(!Array.isArray((r=e.widgetsToCategories)==null?void 0:r[c])){t="widgetsToCategories should be an array";break}(o=(n=e==null?void 0:e.widgetsToCategories)==null?void 0:n[c])==null||o.forEach(d=>{!t&&typeof d!="string"&&(t="widgetsToCategories values should be an array of strings")})}}t&&console.error("ERR: getRecommendations input validation failed: "+t)}};function En({cache:e,waitUntil:t,request:r,uuid:n,storeID:o,fastSimonSession:s,searchPersonalization:u,collectionPersonalization:c}){const d=dn({cache:e,waitUntil:t,request:r});function y(a){for(const w in a)!a[w]&&a[w]!==!1&&delete a[w]}function v(){return{st:s.getSessionToken(),sp:s.getVisitedProducts().toString()}}function x(a=10){const w=new Date,_=a*60*1e3,P=w.getTime(),g=P-P%_;return new Date(g).getTime()}async function m({url:a,cacheStrategy:w=G()}){return(await d.fetch(a,{method:"GET",headers:{"Content-type":"application/json"}},{cacheKey:[a],cacheStrategy:w,shouldCacheResponse:P=>P.error==null||P.error.length===0})).data}async function f({url:a,cacheStrategy:w=G()}){const _=new URL(a);_.searchParams.set("facets_required","2");const P=await m({url:_.toString(),cacheStrategy:w});return P==null?void 0:P.facets}async function D({props:a,cacheStrategy:w=G()}){const _={src:"hydrogen",request_source:"hydrogen",q:a.query,narrow:a!=null&&a.narrow?JSON.stringify(a.narrow):void 0,facets_required:a!=null&&a.facetsRequired?"1":"0",products_per_page:String(a==null?void 0:a.productsPerPage),page_num:String(a.page),sort_by:a!=null&&a.sortBy?a.sortBy:void 0,with_product_attributes:"1",search_within_search:a.searchWithinResultsQuery?a.searchWithinResultsQuery:void 0,uuid:n,store_id:o};s&&u&&Object.assign(_,v()),y(_);const P="https://api.fastsimon.com/full_text_search?"+new URLSearchParams(_),g=await m({url:P,cacheStrategy:w});return g.items=g.items.map(R=>{var E,N;return{...R,t:((N=(E=R==null?void 0:R.t)==null?void 0:E.replace)==null?void 0:N.call(E,"_large.","."))||""}}),g.getFacetsOnly=g!=null&&g.facets_completed?void 0:()=>f({url:P}),{...g,uuid:n,storeID:o,ids:g.items.map(R=>R.id)}}async function T({props:a,cacheStrategy:w=G()}){const _={src:"hydrogen",request_source:"hydrogen",category_id:a.categoryID||void 0,category_url:a!=null&&a.categoryURL?decodeURIComponent(a.categoryURL):void 0,narrow:a!=null&&a.narrow?JSON.stringify(a.narrow):void 0,facets_required:a!=null&&a.facetsRequired?"1":"0",products_per_page:String(a==null?void 0:a.productsPerPage),page_num:String(a.page),sort_by:a!=null&&a.sortBy?a.sortBy:void 0,with_product_attributes:"1",search_within_search:a.searchWithinResultsQuery?a.searchWithinResultsQuery:void 0,uuid:n,store_id:o};s&&c&&Object.assign(_,v()),y(_);const P="https://api.fastsimon.com/categories_navigation?"+new URLSearchParams(_),g=await m({url:P,cacheStrategy:w});return g.items=g.items.map(R=>{var E,N;return{...R,t:((N=(E=R==null?void 0:R.t)==null?void 0:E.replace)==null?void 0:N.call(E,"_large.","."))||""}}),g.getFacetsOnly=g!=null&&g.facets_completed?void 0:()=>f({url:P}),{...g,uuid:n,storeID:o}}async function F({props:a,cacheStrategy:w=G()}){const _=E=>JSON.stringify([{sources:E.sources.join(","),max_suggest:E.maxSuggestions,categories:(E==null?void 0:E.categoriesIDs)??[],widget_id:E.widgetID,title:"Similar+Products"}]),P={request_source:"upsell-cross-sell-hydrogen",specs:a.specs?_(a.specs):JSON.stringify(pn),UUID:n,store_id:o,product_id:a.productId.replace("gid://shopify/Product/",""),with_product_attributes:"true"},g="https://api.fastsimon.com/related_products_suggest?"+new URLSearchParams(P);return(await m({url:g,cacheStrategy:w})).widget_responses[0].products}async function O({cacheStrategy:a=ze()}){const w=`https://settings.fastsimon.com/settings/load?uuid=${n}&store_id=${o}`,_=await m({url:w,cacheStrategy:a}),P=_.isp_sort_options;return _.sort=Object.entries(xn).filter(([g,R])=>P[Number(R)]).map(([g,R])=>({active:!0,name:bn[g],id:R})),_}async function b({props:a,cacheStrategy:w=G()}){var ue,le,oe;const _=x(10),P={q:a.query,uuid:n,store_id:o,src:"storefront-kit",cdn_cache_key:String(_)},g={input_query:a.query,site_uuid:n,store_id:o,src:"storefront-kit"},R="https://api.fastsimon.com?"+new URLSearchParams(P),E=`https://api.fastsimon.com/pop?store_id=${o}&UUID=${n}&c=1&api_type=json&src=storefront-kit&cdn_cache_key=${_}`,N=`https://api.fastsimon.com/pop?store_id=${o}&UUID=${n}&api_type=json&src=storefront-kit&cdn_cache_key=${_}`,$=`https://api.fastsimon.com/pop?store_id=${o}&UUID=${n}&t=1&api_type=json&src=storefront-kit&cdn_cache_key=${_}`,U="https://api.fastsimon.com/get_cms_ac_search?"+new URLSearchParams(g),V=(a==null?void 0:a.max_collections)===0?Promise.resolve([]):m({url:E,cacheStrategy:w}),Q=m({url:N,cacheStrategy:w}),ne=m({url:$,cacheStrategy:ze()}),ie=m({url:U,cacheStrategy:ze()}),H=await Promise.all([Q,V,ne,ie]),Y=5;let ce=pe({data:(ue=H[0])==null?void 0:ue.products,maxResult:(a==null?void 0:a.max_products)||Y,query:a.query,key:"l",options:{matchAllSubItems:!0,avoidNumbersTypoCorrection:!0}});const Ce=pe({data:((le=H[0])==null?void 0:le.searches)||[],maxResult:(a==null?void 0:a.max_popular)||Y,query:a.query}),Ee=pe({data:H[1],maxResult:(a==null?void 0:a.max_collections)||Y,query:a.query,key:"l"}),Ue=pe({data:H[2],maxResult:(a==null?void 0:a.max_turbolinks)||Y,query:a.query,key:"l"}),We=pe({data:H[3],maxResult:(a==null?void 0:a.max_articles)||Y,query:a.query,key:"l"});return ce.length<((a==null?void 0:a.max_products)||Y)&&(ce=(oe=(await m({url:R,cacheStrategy:w})).items)==null?void 0:oe.splice(0,(a==null?void 0:a.max_products)||Y)),{items:{products:ce,collections:Ee,articles:We,pages:[],queries:[],turbolinks:Ue,popularSearches:Ce}}}async function C({props:a,cacheStrategy:w=G()}){const _={request_source:"upsell-cross-sell-hydrogen",UUID:n,store_id:o,widgets_ids:JSON.stringify([a.widgetID]),product_id:a.productId.replace("gid://shopify/Product/",""),with_product_attributes:"true"},P="https://api.fastsimon.com/upsell_cross_sell_recommendation?"+new URLSearchParams(_),g=await m({url:P,cacheStrategy:w});return g==null?void 0:g.widget_responses[0].products}async function z({props:a,cacheStrategy:w=G()}){Cn.getRecommendations(a);const _={request_source:"upsell-cross-sell-hydrogen",UUID:n,store_id:o,widgets_ids:JSON.stringify(a.widgetIds),product_id:a!=null&&a.productId?a.productId.replace("gid://shopify/Product/",""):void 0,with_product_attributes:"true",widgets_categories:a!=null&&a.widgetsToCategories?JSON.stringify(a.widgetsToCategories):void 0};if(s){const g=s.getVisitedProducts();g.length>0&&(_.products=JSON.stringify(g))}y(_);const P="https://api.fastsimon.com/upsell_cross_sell_recommendation?"+new URLSearchParams(_);return await m({url:P,cacheStrategy:w})}return{getSmartCollection:T,getSearchResults:D,getVisualSimilarityProducts:F,getDashboardConfig:O,getAutocompleteResults:b,productsRecommendations:C,getRecommendations:z}}const rt="isp_session_1",tr="fast-session-token",kn=1800,nt="isp_token_1",q="fastSimonDelayedReportData",it="fastSimonDelayedReportPromoTileData";var ve=(e=>(e[e.popularSearchSeen=1]="popularSearchSeen",e[e.autocompleteProductSeen=3]="autocompleteProductSeen",e[e.searchPreformed=4]="searchPreformed",e[e.categorySearchSeen=5]="categorySearchSeen",e[e.relatedProductWidgetShown=15]="relatedProductWidgetShown",e[e.popUpUsedQuickView=13]="popUpUsedQuickView",e[e.popUpUsedLookALike=17]="popUpUsedLookALike",e[e.lookAlikeProductSeen=18]="lookAlikeProductSeen",e[e.collectionPreformed=20]="collectionPreformed",e[e.cartVisited=9]="cartVisited",e[e.searchPreformedNoResults=8]="searchPreformedNoResults",e[e.productAddedToCart=9]="productAddedToCart",e[e.relatedProductClicked=12]="relatedProductClicked",e[e.hoverOnProduct=42]="hoverOnProduct",e[e.hoverOnProductVariant=43]="hoverOnProductVariant",e[e.promoTileClicked=44]="promoTileClicked",e[e.landingPageSeen=19]="landingPageSeen",e[e.landingPageProductClicked=25]="landingPageProductClicked",e[e.collectionPreformedFromTurbolink=46]="collectionPreformedFromTurbolink",e))(ve||{});function Fe(){return nt in localStorage?localStorage.getItem(nt):null}function On(e){localStorage.setItem(nt,e)}function $e(){const e=jn()??localStorage.getItem(tr),t=Math.round(Date.now()/1e3);if(e){const r=JSON.parse(e);return t-r.lastActive>=kn?Ge({lastActive:t,start:t}):Ge({lastActive:t,start:r.start})}else return Ge({lastActive:t,start:t})}function jn(){if(rt in localStorage){const e=JSON.parse(localStorage.getItem(rt));return JSON.stringify({lastActive:e.last_active,start:e.start})}return null}function Ge(e){return localStorage.setItem(rt,JSON.stringify({last_active:e.lastActive,start:e.start})),localStorage.setItem(tr,JSON.stringify(e)),e}const Tn={prepareProductSeenFromSerpData({productId:e,productPosition:t,query:r,sortBy:n,pageNumber:o}){localStorage.setItem(q,JSON.stringify({sort_by:n,id:e==null?void 0:e.replace("gid://shopify/Product/",""),pagenum:o,pos:t,original_search_query:r}))},prepareProductSeenFromCollectionData({productId:e,productPosition:t,sortBy:r,pageNumber:n,categoryId:o,categoryName:s}){localStorage.setItem(q,JSON.stringify({sort_by:r,id:e==null?void 0:e.replace("gid://shopify/Product/",""),pagenum:n,pos:t,original_category_id:o,original_smart_navigation:s}))},prepareProductSeenFromAutocompleteData({productId:e,query:t,sku:r}){localStorage.setItem(q,JSON.stringify({id:e==null?void 0:e.replace("gid://shopify/Product/",""),original_search_query:t,q:r,prev_up_type:3}))},prepareCollectionSeenFromAutocompleteData({collectionId:e,query:t}){localStorage.setItem(q,JSON.stringify({id:e,original_search_query:t,prev_up_type:5}))},prepareProductAddedToCartData(e){var t,r;localStorage.setItem(q,JSON.stringify({cart_product:(r=(t=e.productId)==null?void 0:t.replace)==null?void 0:r.call(t,"gid://shopify/Product/",""),variant_id:e.variantId,pos:e.productPosition,cart:"1",original_category_id:e==null?void 0:e.categoryId,original_smart_navigation:e==null?void 0:e.categoryName,original_search_query:e==null?void 0:e.query,prev_up_type:9}))},preparePromotileClickedData(e){localStorage.setItem(it,JSON.stringify({sort_by:e.sortBy,id:e.id,pagenum:e.pageNumber,pos:e.position,original_category_id:e==null?void 0:e.categoryId,original_smart_navigation:e==null?void 0:e.categoryName,original_search_query:e==null?void 0:e.query,link:e.link,thumbnail:e.image,prev_up_type:44}))},preparePopularSeenData(e){localStorage.setItem(q,JSON.stringify({original_search_query:e.query,q:e.popularQuery,prev_up_type:1}))},prepareProductSeenFromRecommendations(e){var t,r;localStorage.setItem(q,JSON.stringify({id:(r=(t=e==null?void 0:e.productId)==null?void 0:t.replace)==null?void 0:r.call(t,"gid://shopify/Product/",""),pos:e==null?void 0:e.productPosition,widget_id:e==null?void 0:e.widgetId,prev_up_type:12}))},prepareWidgetProductsShown(e){localStorage.setItem(q,JSON.stringify({widget_id:e.widgetId,products:e.productIds,prev_up_type:15}))}};function Ut(e,t,r){var n,o,s,u,c,d;return{source:"fast-simon-hydrogen-analytics",store_id:t,UUID:r,st:Fe(),session:$e().start,cart_token:(n=e==null?void 0:e.cart)!=null&&n.id&&((o=Le(e.cart.id))==null?void 0:o.resourceId)||"",cart:"1