@fast-simon/storefront-kit
Version:
A comprehensive kit for developing storefronts with Fast Simon components, utilities, and React/Hydrogen support.
181 lines (160 loc) • 66.8 kB
JavaScript
"use strict";var Tr=Object.defineProperty;var Ot=e=>{throw TypeError(e)};var Ar=(e,t,r)=>t in e?Tr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var jt=(e,t,r)=>Ar(e,typeof t!="symbol"?t+"":t,r),Tt=(e,t,r)=>t.has(e)||Ot("Cannot "+r);var he=(e,t,r)=>(Tt(e,t,"read from private field"),r?r.call(e):t.get(e)),ze=(e,t,r)=>t.has(e)?Ot("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),Ge=(e,t,r,n)=>(Tt(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const U=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(U);var rt={exports:{}},Pe={};/**
* @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 At;function Ir(){if(At)return Pe;At=1;var e=U,t=Symbol.for("react.element"),r=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,i=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,a={key:!0,ref:!0,__self:!0,__source:!0};function u(c,d,S){var w,b={},_=null,f=null;S!==void 0&&(_=""+S),d.key!==void 0&&(_=""+d.key),d.ref!==void 0&&(f=d.ref);for(w in d)n.call(d,w)&&!a.hasOwnProperty(w)&&(b[w]=d[w]);if(c&&c.defaultProps)for(w in d=c.defaultProps,d)b[w]===void 0&&(b[w]=d[w]);return{$$typeof:t,type:c,key:_,ref:f,props:b,_owner:i.current}}return Pe.Fragment=r,Pe.jsx=u,Pe.jsxs=u,Pe}var Ee={};/**
* @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 Dt;function Nr(){return Dt||(Dt=1,process.env.NODE_ENV!=="production"&&function(){var e=U,t=Symbol.for("react.element"),r=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),u=Symbol.for("react.provider"),c=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),S=Symbol.for("react.suspense"),w=Symbol.for("react.suspense_list"),b=Symbol.for("react.memo"),_=Symbol.for("react.lazy"),f=Symbol.for("react.offscreen"),D=Symbol.iterator,R="@@iterator";function $(o){if(o===null||typeof o!="object")return null;var l=D&&o[D]||o[R];return typeof l=="function"?l:null}var T=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function E(o){{for(var l=arguments.length,h=new Array(l>1?l-1:0),P=1;P<l;P++)h[P-1]=arguments[P];k("error",o,h)}}function k(o,l,h){{var P=T.ReactDebugCurrentFrame,N=P.getStackAddendum();N!==""&&(l+="%s",h=h.concat([N]));var L=h.map(function(A){return String(A)});L.unshift("Warning: "+l),Function.prototype.apply.call(console[o],console,L)}}var H=!1,g=!1,I=!1,F=!1,s=!1,m;m=Symbol.for("react.module.reference");function v(o){return!!(typeof o=="string"||typeof o=="function"||o===n||o===a||s||o===i||o===S||o===w||F||o===f||H||g||I||typeof o=="object"&&o!==null&&(o.$$typeof===_||o.$$typeof===b||o.$$typeof===u||o.$$typeof===c||o.$$typeof===d||o.$$typeof===m||o.getModuleId!==void 0))}function p(o,l,h){var P=o.displayName;if(P)return P;var N=l.displayName||l.name||"";return N!==""?h+"("+N+")":h}function y(o){return o.displayName||"Context"}function C(o){if(o==null)return null;if(typeof o.tag=="number"&&E("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof o=="function")return o.displayName||o.name||null;if(typeof o=="string")return o;switch(o){case n:return"Fragment";case r:return"Portal";case a:return"Profiler";case i:return"StrictMode";case S:return"Suspense";case w:return"SuspenseList"}if(typeof o=="object")switch(o.$$typeof){case c:var l=o;return y(l)+".Consumer";case u:var h=o;return y(h._context)+".Provider";case d:return p(o,o.render,"ForwardRef");case b:var P=o.displayName||null;return P!==null?P:C(o.type)||"Memo";case _:{var N=o,L=N._payload,A=N._init;try{return C(A(L))}catch{return null}}}return null}var O=Object.assign,M=0,B,ne,oe,ie,ae,Te,Ae;function X(){}X.__reactDisabledLog=!0;function G(){{if(M===0){B=console.log,ne=console.info,oe=console.warn,ie=console.error,ae=console.group,Te=console.groupCollapsed,Ae=console.groupEnd;var o={configurable:!0,enumerable:!0,value:X,writable:!0};Object.defineProperties(console,{info:o,log:o,warn:o,error:o,group:o,groupCollapsed:o,groupEnd:o})}M++}}function we(){{if(M--,M===0){var o={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:O({},o,{value:B}),info:O({},o,{value:ne}),warn:O({},o,{value:oe}),error:O({},o,{value:ie}),group:O({},o,{value:ae}),groupCollapsed:O({},o,{value:Te}),groupEnd:O({},o,{value:Ae})})}M<0&&E("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var _e=T.ReactCurrentDispatcher,Se;function le(o,l,h){{if(Se===void 0)try{throw Error()}catch(N){var P=N.stack.trim().match(/\n( *(at )?)/);Se=P&&P[1]||""}return`
`+Se+o}}var pe=!1,se;{var De=typeof WeakMap=="function"?WeakMap:Map;se=new De}function be(o,l){if(!o||pe)return"";{var h=se.get(o);if(h!==void 0)return h}var P;pe=!0;var N=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var L;L=_e.current,_e.current=null,G();try{if(l){var A=function(){throw Error()};if(Object.defineProperty(A.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(A,[])}catch(K){P=K}Reflect.construct(o,[],A)}else{try{A.call()}catch(K){P=K}o.call(A.prototype)}}else{try{throw Error()}catch(K){P=K}o()}}catch(K){if(K&&P&&typeof K.stack=="string"){for(var j=K.stack.split(`
`),q=P.stack.split(`
`),W=j.length-1,V=q.length-1;W>=1&&V>=0&&j[W]!==q[V];)V--;for(;W>=1&&V>=0;W--,V--)if(j[W]!==q[V]){if(W!==1||V!==1)do if(W--,V--,V<0||j[W]!==q[V]){var Y=`
`+j[W].replace(" at new "," at ");return o.displayName&&Y.includes("<anonymous>")&&(Y=Y.replace("<anonymous>",o.displayName)),typeof o=="function"&&se.set(o,Y),Y}while(W>=1&&V>=0);break}}}finally{pe=!1,_e.current=L,we(),Error.prepareStackTrace=N}var fe=o?o.displayName||o.name:"",ce=fe?le(fe):"";return typeof o=="function"&&se.set(o,ce),ce}function gt(o,l,h){return be(o,!1)}function cr(o){var l=o.prototype;return!!(l&&l.isReactComponent)}function Ie(o,l,h){if(o==null)return"";if(typeof o=="function")return be(o,cr(o));if(typeof o=="string")return le(o);switch(o){case S:return le("Suspense");case w:return le("SuspenseList")}if(typeof o=="object")switch(o.$$typeof){case d:return gt(o.render);case b:return Ie(o.type,l,h);case _:{var P=o,N=P._payload,L=P._init;try{return Ie(L(N),l,h)}catch{}}}return""}var xe=Object.prototype.hasOwnProperty,mt={},yt=T.ReactDebugCurrentFrame;function Ne(o){if(o){var l=o._owner,h=Ie(o.type,o._source,l?l.type:null);yt.setExtraStackFrame(h)}else yt.setExtraStackFrame(null)}function ur(o,l,h,P,N){{var L=Function.call.bind(xe);for(var A in o)if(L(o,A)){var j=void 0;try{if(typeof o[A]!="function"){var q=Error((P||"React class")+": "+h+" type `"+A+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof o[A]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw q.name="Invariant Violation",q}j=o[A](l,A,P,h,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(W){j=W}j&&!(j instanceof Error)&&(Ne(N),E("%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,A,typeof j),Ne(null)),j instanceof Error&&!(j.message in mt)&&(mt[j.message]=!0,Ne(N),E("Failed %s type: %s",h,j.message),Ne(null))}}}var lr=Array.isArray;function qe(o){return lr(o)}function dr(o){{var l=typeof Symbol=="function"&&Symbol.toStringTag,h=l&&o[Symbol.toStringTag]||o.constructor.name||"Object";return h}}function fr(o){try{return vt(o),!1}catch{return!0}}function vt(o){return""+o}function wt(o){if(fr(o))return E("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",dr(o)),vt(o)}var _t=T.ReactCurrentOwner,hr={key:!0,ref:!0,__self:!0,__source:!0},St,pt;function gr(o){if(xe.call(o,"ref")){var l=Object.getOwnPropertyDescriptor(o,"ref").get;if(l&&l.isReactWarning)return!1}return o.ref!==void 0}function mr(o){if(xe.call(o,"key")){var l=Object.getOwnPropertyDescriptor(o,"key").get;if(l&&l.isReactWarning)return!1}return o.key!==void 0}function yr(o,l){typeof o.ref=="string"&&_t.current}function vr(o,l){{var h=function(){St||(St=!0,E("%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(o,"key",{get:h,configurable:!0})}}function wr(o,l){{var h=function(){pt||(pt=!0,E("%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(o,"ref",{get:h,configurable:!0})}}var _r=function(o,l,h,P,N,L,A){var j={$$typeof:t,type:o,key:l,ref:h,props:A,_owner:L};return j._store={},Object.defineProperty(j._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(j,"_self",{configurable:!1,enumerable:!1,writable:!1,value:P}),Object.defineProperty(j,"_source",{configurable:!1,enumerable:!1,writable:!1,value:N}),Object.freeze&&(Object.freeze(j.props),Object.freeze(j)),j};function Sr(o,l,h,P,N){{var L,A={},j=null,q=null;h!==void 0&&(wt(h),j=""+h),mr(l)&&(wt(l.key),j=""+l.key),gr(l)&&(q=l.ref,yr(l,N));for(L in l)xe.call(l,L)&&!hr.hasOwnProperty(L)&&(A[L]=l[L]);if(o&&o.defaultProps){var W=o.defaultProps;for(L in W)A[L]===void 0&&(A[L]=W[L])}if(j||q){var V=typeof o=="function"?o.displayName||o.name||"Unknown":o;j&&vr(A,V),q&&wr(A,V)}return _r(o,j,q,N,P,_t.current,A)}}var Ke=T.ReactCurrentOwner,bt=T.ReactDebugCurrentFrame;function de(o){if(o){var l=o._owner,h=Ie(o.type,o._source,l?l.type:null);bt.setExtraStackFrame(h)}else bt.setExtraStackFrame(null)}var Ye;Ye=!1;function He(o){return typeof o=="object"&&o!==null&&o.$$typeof===t}function xt(){{if(Ke.current){var o=C(Ke.current.type);if(o)return`
Check the render method of \``+o+"`."}return""}}function pr(o){return""}var Pt={};function br(o){{var l=xt();if(!l){var h=typeof o=="string"?o:o.displayName||o.name;h&&(l=`
Check the top-level render call using <`+h+">.")}return l}}function Et(o,l){{if(!o._store||o._store.validated||o.key!=null)return;o._store.validated=!0;var h=br(l);if(Pt[h])return;Pt[h]=!0;var P="";o&&o._owner&&o._owner!==Ke.current&&(P=" It was passed a child from "+C(o._owner.type)+"."),de(o),E('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 Rt(o,l){{if(typeof o!="object")return;if(qe(o))for(var h=0;h<o.length;h++){var P=o[h];He(P)&&Et(P,l)}else if(He(o))o._store&&(o._store.validated=!0);else if(o){var N=$(o);if(typeof N=="function"&&N!==o.entries)for(var L=N.call(o),A;!(A=L.next()).done;)He(A.value)&&Et(A.value,l)}}}function xr(o){{var l=o.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===b))h=l.propTypes;else return;if(h){var P=C(l);ur(h,o.props,"prop",P,o)}else if(l.PropTypes!==void 0&&!Ye){Ye=!0;var N=C(l);E("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",N||"Unknown")}typeof l.getDefaultProps=="function"&&!l.getDefaultProps.isReactClassApproved&&E("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Pr(o){{for(var l=Object.keys(o.props),h=0;h<l.length;h++){var P=l[h];if(P!=="children"&&P!=="key"){de(o),E("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",P),de(null);break}}o.ref!==null&&(de(o),E("Invalid attribute `ref` supplied to `React.Fragment`."),de(null))}}var Ct={};function kt(o,l,h,P,N,L){{var A=v(o);if(!A){var j="";(o===void 0||typeof o=="object"&&o!==null&&Object.keys(o).length===0)&&(j+=" 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 q=pr();q?j+=q:j+=xt();var W;o===null?W="null":qe(o)?W="array":o!==void 0&&o.$$typeof===t?(W="<"+(C(o.type)||"Unknown")+" />",j=" Did you accidentally export a JSX literal instead of a component?"):W=typeof o,E("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",W,j)}var V=Sr(o,l,h,N,L);if(V==null)return V;if(A){var Y=l.children;if(Y!==void 0)if(P)if(qe(Y)){for(var fe=0;fe<Y.length;fe++)Rt(Y[fe],o);Object.freeze&&Object.freeze(Y)}else E("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 Rt(Y,o)}if(xe.call(l,"key")){var ce=C(o),K=Object.keys(l).filter(function(jr){return jr!=="key"}),Be=K.length>0?"{key: someKey, "+K.join(": ..., ")+": ...}":"{key: someKey}";if(!Ct[ce+Be]){var Or=K.length>0?"{"+K.join(": ..., ")+": ...}":"{}";E(`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} />`,Be,ce,Or,ce),Ct[ce+Be]=!0}}return o===n?Pr(V):xr(V),V}}function Er(o,l,h){return kt(o,l,h,!0)}function Rr(o,l,h){return kt(o,l,h,!1)}var Cr=Rr,kr=Er;Ee.Fragment=n,Ee.jsx=Cr,Ee.jsxs=kr}()),Ee}process.env.NODE_ENV==="production"?rt.exports=Ir():rt.exports=Nr();var x=rt.exports;const Lr="2024-10",Fr={storeDomain:"test",storefrontToken:"abc123",storefrontApiVersion:Lr,countryIsoCode:"US",languageIsoCode:"EN",getStorefrontApiUrl(){return""},getPublicTokenHeaders(){return{}},getShopifyDomain(){return""}},$r=U.createContext(Fr);function Mr(){const e=U.useContext($r);if(!e)throw new Error("'useShop()' must be a descendent of <ShopifyProvider/>");return e}function Ue(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:i,hash:a}=new URL(e),u=i.split("/"),c=u[u.length-1],d=u[u.length-2];return!c||!d?t:{id:`${c}${r}${a}`||"",resource:d??null,resourceId:c||null,search:r,searchParams:n,hash:a}}catch{return t}}function Ur(e){const{countryIsoCode:t,languageIsoCode:r}=Mr(),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 i=parseFloat(e.amount),{defaultFormatter:a,nameFormatter:u,narrowSymbolFormatter:c,withoutTrailingZerosFormatter:d,withoutCurrencyFormatter:S,withoutTrailingZerosOrCurrencyFormatter:w}=U.useMemo(()=>{const f={style:"currency",currency:e.currencyCode};return{defaultFormatter:ge(n,f),nameFormatter:ge(n,{...f,currencyDisplay:"name"}),narrowSymbolFormatter:ge(n,{...f,currencyDisplay:"narrowSymbol"}),withoutTrailingZerosFormatter:ge(n,{...f,minimumFractionDigits:0,maximumFractionDigits:0}),withoutCurrencyFormatter:ge(n),withoutTrailingZerosOrCurrencyFormatter:ge(n,{minimumFractionDigits:0,maximumFractionDigits:0})}},[e.currencyCode,n]),b=f=>f.type==="currency",_=U.useMemo(()=>({original:()=>e,currencyCode:()=>e.currencyCode,localizedString:()=>a().format(i),parts:()=>a().formatToParts(i),withoutTrailingZeros:()=>i%1===0?d().format(i):a().format(i),withoutTrailingZerosAndCurrency:()=>i%1===0?w().format(i):S().format(i),currencyName:()=>{var f;return((f=u().formatToParts(i).find(b))==null?void 0:f.value)??e.currencyCode},currencySymbol:()=>{var f;return((f=a().formatToParts(i).find(b))==null?void 0:f.value)??e.currencyCode},currencyNarrowSymbol:()=>{var f;return((f=c().formatToParts(i).find(b))==null?void 0:f.value)??""},amount:()=>a().formatToParts(i).filter(f=>["decimal","fraction","group","integer","literal"].includes(f.type)).map(f=>f.value).join("")}),[e,i,u,a,c,S,d,w]);return U.useMemo(()=>new Proxy(_,{get:(f,D)=>{var R;return(R=Reflect.get(f,D))==null?void 0:R.call(null)}}),[_])}const It=new Map;function ge(e,t){const r=JSON.stringify([e,t]);return function(){let n=It.get(r);return n||(n=new Intl.NumberFormat(e,t),It.set(r,n)),n}}function Wr({data:e,as:t,withoutCurrency:r,withoutTrailingZeros:n,measurement:i,measurementSeparator:a="/",...u}){if(!Vr(e))throw new Error("<Money/> needs a valid 'data' prop that has 'amount' and 'currencyCode'");const c=Ur(e),d=t??"div";let S=c.localizedString;return(r||n)&&(r&&!n?S=c.amount:!r&&n?S=c.withoutTrailingZeros:S=c.withoutTrailingZerosAndCurrency),x.jsxs(d,{...u,children:[S,i&&i.referenceUnit&&x.jsxs(x.Fragment,{children:[a,i.referenceUnit]})]})}function Vr(e){return typeof e.amount=="string"&&!!e.amount&&typeof e.currencyCode=="string"&&!!e.currencyCode}const Jr=re.forwardRef(({alt:e,aspectRatio:t,crop:r="center",data:n,decoding:i="async",height:a="auto",loader:u=Je,loading:c="lazy",sizes:d,src:S,srcSetOptions:w={intervals:15,startingWidth:200,incrementSize:200,placeholderWidth:100},width:b="100%",..._},f)=>{const D=re.useMemo(()=>{const I=n!=null&&n.width&&(n!=null&&n.height)?n==null?void 0:n.width:void 0,F=n!=null&&n.width&&(n!=null&&n.height)?n==null?void 0:n.height:void 0;return{width:I,height:F,unitsMatch:!!Gt(I,F)}},[n]),R=re.useMemo(()=>{const F=ke((b||"100%").toString()),s=`${F.number}${F.unit}`,m=a==null,v=m?null:ke(a.toString()),p=v?`${v.number}${v.unit}`:"",y=m?"auto":p,C=S||(n==null?void 0:n.url),O=n!=null&&n.altText&&!e?n==null?void 0:n.altText:e||"",M=t||(D.unitsMatch?[Oe(D.width),Oe(D.height)].join("/"):void 0);return{width:s,height:y,src:C,alt:O,aspectRatio:M}},[b,a,S,n,e,t,D,_==null?void 0:_.key]),{intervals:$,startingWidth:T,incrementSize:E,placeholderWidth:k}=w,H=re.useMemo(()=>Yr(b,$,T,E),[b,$,T,E]);return Qt(R.width)?x.jsx(qr,{aspectRatio:t,crop:r,decoding:i,height:a,imageWidths:H,loader:u,loading:c,normalizedProps:R,passthroughProps:_,ref:f,width:b,data:n}):x.jsx(Kr,{aspectRatio:t,crop:r,decoding:i,imageWidths:H,loader:u,loading:c,normalizedProps:R,passthroughProps:_,placeholderWidth:k,ref:f,sizes:d,data:n})}),qr=re.forwardRef(({aspectRatio:e,crop:t,decoding:r,height:n,imageWidths:i,loader:a=Je,loading:u,normalizedProps:c,passthroughProps:d,width:S,data:w},b)=>{const _=re.useMemo(()=>{const f=Oe(S),D=Oe(n),R=e||(Gt(c.width,c.height)?[f,D].join("/"):c.aspectRatio?c.aspectRatio:void 0),$=i===void 0?void 0:Xt(i,R,t,{width:(w==null?void 0:w.width)??void 0,height:(w==null?void 0:w.height)??void 0}),T=D||(R&&f?f*(ct(R)??1):void 0),E=Zt(c.src,$,a),k=a({src:c.src,width:f,height:T,crop:c.height==="auto"?void 0:t});return{width:f,aspectRatio:R,height:T,srcSet:E,src:k}},[e,t,w,n,i,a,c,S]);return x.jsx("img",{ref:b,alt:c.alt,decoding:r,height:_.height,loading:u,src:_.src,srcSet:_.srcSet,width:_.width,style:{aspectRatio:_.aspectRatio,...d.style},...d})}),Kr=re.forwardRef(({crop:e,decoding:t,imageWidths:r,loader:n=Je,loading:i,normalizedProps:a,passthroughProps:u,placeholderWidth:c,sizes:d,data:S},w)=>{const b=re.useMemo(()=>{const _=r===void 0?void 0:Xt(r,a.aspectRatio,e,{width:(S==null?void 0:S.width)??void 0,height:(S==null?void 0:S.height)??void 0}),f=a.aspectRatio&&c?c*(ct(a.aspectRatio)??1):void 0,D=Zt(a.src,_,n),R=n({src:a.src,width:c,height:f,crop:e});return{placeholderHeight:f,srcSet:D,src:R}},[e,S,r,n,a,c]);return x.jsx("img",{ref:w,alt:a.alt,decoding:t,height:b.placeholderHeight,loading:i,sizes:d,src:b.src,srcSet:b.srcSet,width:c,...u,style:{width:a.width,aspectRatio:a.aspectRatio,...u.style}})}),Nt="https://placeholder.shopify.com";function Je({src:e,width:t,height:r,crop:n}){if(!e)return"";const i=new URL(e,Nt);return t&&i.searchParams.append("width",Math.round(t).toString()),r&&i.searchParams.append("height",Math.round(r).toString()),n&&i.searchParams.append("crop",n),i.href.replace(Nt,"")}function Gt(e="100%",t="auto"){return ke(e.toString()).unit===ke(t.toString()).unit}function ke(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 Oe(e){if(e===void 0)return;const{unit:t,number:r}=ke(e.toString());switch(t){case"em":return r*16;case"rem":return r*16;case"px":return r;case"":return r;default:return}}function Qt(e){return typeof e=="number"||/\d(px|em|rem)$/.test(e)}function Zt(e,t,r=Je){return e?(t==null?void 0:t.length)===0||!t?e:t.map((n,i)=>`${r({src:e,width:n.width,height:n.height,crop:n.crop})} ${t.length===3?`${i+1}x`:`${n.width??0}w`}`).join(", "):""}function Yr(e="100%",t,r,n){const i=Array.from({length:t},(u,c)=>c*n+r),a=Array.from({length:3},(u,c)=>(c+1)*(Oe(e)??0));return Qt(e)?a:i}function ct(e){if(!e)return;const[t,r]=e.split("/");return 1/(Number(t)/Number(r))}function Xt(e,t,r="center",n){if(e)return e.map(i=>({width:i,height:t?i*(ct(t)??1):void 0,crop:r})).filter(({width:i,height:a})=>!(n!=null&&n.width&&i>n.width||n!=null&&n.height&&a&&a>n.height))}const Lt={};function Hr(e,t){const r=Lt[e];if(r)return r;const n=new Promise((i,a)=>{const u=document.createElement("script");t!=null&&t.module?u.type="module":u.type="text/javascript",u.src=e,u.onload=()=>{i(!0)},u.onerror=()=>{a(!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 Lt[e]=n,n}function Br(e,t){const[r,n]=U.useState("loading");return U.useEffect(()=>{Hr(e,t).then(()=>n("done")).catch(()=>n("error"))},[e]),r}var ut="public",zr="no-store",Ft={maxAge:"max-age",staleWhileRevalidate:"stale-while-revalidate",sMaxAge:"s-maxage",staleIfError:"stale-if-error"};function Gr(e){let t=[];return Object.keys(e).forEach(r=>{r==="mode"?t.push(e[r]):Ft[r]&&t.push(`${Ft[r]}=${e[r]}`)}),t.join(", ")}function z(e){return{mode:ut,maxAge:1,staleWhileRevalidate:9,...e}}function Qe(e){return{mode:ut,maxAge:3600,staleWhileRevalidate:82800,...e}}function er(e){return{mode:ut,maxAge:1,staleWhileRevalidate:86399,...e}}function tr(e){return String(e).includes("__proto__")?JSON.parse(e,Qr):JSON.parse(e)}function Qr(e,t){if(e!=="__proto__")return t}function Me(e,t){return e&&t?{...e,...t}:e||er()}function nt(e){return Gr(Me(e))}async function Zr(e,t){if(!e)return;let r=await e.match(t);if(r)return r}async function Xr(e,t,r,n){if(!e)return;let i=Me(n),a=nt(Me(i,{maxAge:(i.maxAge||0)+(i.staleWhileRevalidate||0)})),u=nt(Me(i));r.headers.set("cache-control",a),r.headers.set("real-cache-control",u),r.headers.set("cache-put-date",String(Date.now())),await e.put(t,r)}async function en(e,t){e&&await e.delete(t)}function tn(e,t){let r=e.headers.get("real-cache-control"),n=0;if(r){let i=r.match(/max-age=(\d*)/);i&&i.length>1&&(n=parseFloat(i[1]))}return[(Date.now()-Number(t))/1e3,n]}function rn(e,t){let r=t.headers.get("cache-put-date");if(!r)return!1;let[n,i]=tn(t,r);return n>i}var lt={get:Zr,set:Xr,delete:en,generateDefaultCacheControlHeader:nt,isStale:rn};function dt(e){return`https://shopify.dev/?${e}`}function nn(e){return e||er()}async function on(e,t){if(!e)return;let r=dt(t),n=new Request(r),i=await lt.get(e,n);if(!i)return;let a=await i.text();try{return[tr(a),i]}catch{return[a,i]}}async function an(e,t,r,n){if(!e)return;let i=dt(t),a=new Request(i),u=new Response(JSON.stringify(r));await lt.set(e,a,u,nn(n))}function sn(e,t){return lt.isStale(new Request(dt(e)),t)}function cn(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 Ze=new Set;async function rr(e,t,{strategy:r=z(),cacheInstance:n,shouldCacheResult:i=()=>!0,waitUntil:a,debugInfo:u}){let c=cn([...typeof e=="string"?[e]:e]),d=f=>{var D,R,$,T;f.displayName,(D=f.response)==null||D.url,(R=f.response)!=null&&R.status,($=f.response)!=null&&$.statusText,Array.from(((T=f.response)==null?void 0:T.headers.entries())||[])},S;if(!n||!r||r.mode===zr)return await t({addDebugData:d});let w=f=>an(n,c,{value:f,debugInfo:void 0},r),b=await on(n,c);if(b&&typeof b[0]!="string"){let[{value:f,debugInfo:D},R]=b,$=sn(c,R)?"STALE":"HIT";if(!Ze.has(c)&&$==="STALE"){Ze.add(c);let T=Promise.resolve().then(async()=>{let E=Date.now();try{let k=await t({addDebugData:d});i(k)&&(await w(k),S==null||S({result:k,cacheStatus:"PUT",overrideStartTime:E}))}catch(k){k.message&&(k.message="SWR in sub-request failed: "+k.message),console.error(k)}finally{Ze.delete(c)}});a==null||a(T)}return f}let _=await t({addDebugData:d});if(i(_)){let f=Promise.resolve().then(async()=>{await w(_)});a==null||a(f)}return _}function un(e,t){return[e,{status:t.status,statusText:t.statusText,headers:Array.from(t.headers.entries())}]}function $t([e,t]){return[e,new Response(e,t)]}async function ln(e,t,{cacheInstance:r,cache:n,cacheKey:i=[e,t],shouldCacheResponse:a,waitUntil:u,debugInfo:c}){return!n&&(!t.method||t.method==="GET")&&(n=z()),rr(i,async()=>{let d=await fetch(e,t);if(!d.ok)return d;let S=await d.text().catch(()=>"");try{S&&(S=tr(S))}catch{}return un(S,d)},{cacheInstance:r,waitUntil:u,strategy:n??null,debugInfo:c,shouldCacheResult:d=>"ok"in d?!1:a(...$t(d))}).then(d=>"ok"in d?[null,d]:$t(d))}var me=void 0;function Mt(e,t){return dn(e.headers,t)}function dn(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 Ut(e){return{requestId:e?Mt(e,"request-id"):void 0,purpose:e?Mt(e,"purpose"):void 0}}function fn(e){let{cache:t,waitUntil:r,request:n}=e;return{run:({cacheKey:i,cacheStrategy:a,shouldCacheResult:u},c)=>rr(i,c,{shouldCacheResult:u,strategy:a,cacheInstance:t,waitUntil:r,debugInfo:{...Ut(n),stackInfo:me==null?void 0:me()}}),fetch:(i,a,u)=>ln(i,a??{},{waitUntil:r,cacheKey:[i,a],cacheInstance:t,debugInfo:{url:i,...Ut(n),stackInfo:me==null?void 0:me(),displayName:u==null?void 0:u.displayName},cache:u.cacheStrategy,...u}).then(([c,d])=>({data:c,response:d}))}}U.lazy(()=>Promise.resolve().then(()=>require("./log-seo-tags-TY72EQWZ-BuJmqTh2.cjs")));var nr=U.createContext(void 0);nr.Provider;var hn=()=>U.useContext(nr);U.forwardRef((e,t)=>{let{waitForHydration:r,src:n,...i}=e;if(r)return x.jsx(gn,{src:n,options:i});let a=hn();return x.jsx("script",{suppressHydrationWarning:!0,...i,src:n,nonce:a,ref:t})});function gn({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};U.createContext(mn);function yn({product:e,imageAspectRatio:t="1/1"}){return x.jsx("div",{className:"fs-recommended-product",children:x.jsxs(ee.Link,{className:"fs-recommended-product-content",to:`/products/${e.handle}`,children:[x.jsx(Jr,{data:e.images.nodes[0],aspectRatio:t,sizes:"(min-width: 45em) 20vw, 50vw",className:"fs-recommended-product-image"}),x.jsx("h4",{children:e.title}),x.jsx("small",{children:x.jsx(Wr,{data:e.priceRange.minVariantPrice})})]})},e.id)}const vn=`
.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 Wt(){return x.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",height:"1em",viewBox:"0 0 448 512",className:"fs-arrow-icon",children:x.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 wn=()=>x.jsx("div",{className:"spinner-container",children:x.jsx("div",{className:"spinner"})});function _n({title:e,products:t,renderProduct:r,breakpoints:n={mobile:2,desktop:4,tablet:3},carouselGap:i=16,RightArrowIcon:a,imageAspectRatio:u}){const c=U.useRef(null),d=_=>{c.current&&c.current.scrollTo({left:_,behavior:"smooth"})},S=_=>{var $,T,E;if(!c.current)return;const f=c.current.scrollWidth/_,D=Math.floor(c.current.clientWidth/f)||1,R=c.current.scrollLeft+D*f-1;d(R),(E=(T=($=c.current.parentElement)==null?void 0:$.querySelector(".fs-widget-arrow-left"))==null?void 0:T.classList)==null||E.remove("arrow-hide")},w=_=>{var $,T,E;if(!c.current)return;const f=c.current.scrollWidth/_,D=Math.floor(c.current.clientWidth/f)||1,R=c.current.scrollLeft-D*f+1;d(R),(E=(T=($=c.current.parentElement)==null?void 0:$.querySelector(".fs-widget-arrow-right"))==null?void 0:T.classList)==null||E.remove("arrow-hide")},b=_=>{_.target.scrollLeft>0?_.target.parentElement.querySelector(".fs-widget-arrow-left").classList.remove("arrow-hide"):_.target.parentElement.querySelector(".fs-widget-arrow-left").classList.add("arrow-hide"),_.target.scrollLeft>=_.target.scrollWidth-_.target.clientWidth?_.target.parentElement.querySelector(".fs-widget-arrow-right").classList.add("arrow-hide"):_.target.parentElement.querySelector(".fs-widget-arrow-right").classList.remove("arrow-hide")};return x.jsxs(U.Fragment,{children:[x.jsx("style",{children:vn}),x.jsxs("div",{className:"fs-recommended-products-container",children:[x.jsx("h2",{className:"fs-recommended-products-widget-title",children:e??"Recommended Products"}),x.jsx(U.Suspense,{fallback:x.jsx(wn,{}),children:x.jsx(ee.Await,{resolve:t,children:({products:_})=>x.jsxs("div",{className:"fs-grid-arrows-container",style:{"--num-of-products":_.nodes.length,"--carousel-gap":`${i}px`,"--mobile-breakpoint":n.mobile,"--tablet-breakpoint":n.tablet,"--desktop-breakpoint":n.desktop},children:[x.jsxs("div",{className:"fs-arrows-container",children:[x.jsx("div",{className:"fs-widget-arrow fs-widget-arrow-left arrow-hide",onClick:()=>w(_.nodes.length),children:a??x.jsx(Wt,{})}),x.jsx("div",{className:"fs-widget-arrow fs-widget-arrow-right",onClick:()=>S(_.nodes.length),children:a??x.jsx(Wt,{})})]}),x.jsx("div",{className:"fs-recommended-products-grid-container",ref:c,onScroll:b,children:x.jsx("div",{className:"fs-recommended-products-grid",children:_.nodes.map((f,D)=>{if(r){const R=r(f,D+1);if(R)return R}return x.jsx(yn,{product:f,imageAspectRatio:u},f.id)})})})]})})}),x.jsx("br",{})]})]})}function Ce(e,t){const r=new URLSearchParams(e);for(const[n,i]of Object.entries(t)){if(i===void 0){r.delete(n);continue}r.set(n,String(i))}return r.toString()}function Sn({total:e}){const[t]=ee.useSearchParams(),r=Number(t.get("page"))||1,n=e,i=[...Array.from(Array(n).keys())].map(a=>a+1);return x.jsxs("div",{className:"pagination-wrapper",children:[r>1?x.jsx(ee.Link,{to:{search:Ce(t,{page:Math.max(r-1,0)})},preventScrollReset:!0,prefetch:"intent",className:"arrow-button-wrapper arrow-button",children:x.jsxs("span",{className:"sr-only",children:[" ","<"]})}):null,x.jsx("span",{className:"center-pages-wrapper",children:i.map(a=>a===2&&r>4?x.jsx("span",{className:"page-number-item three-dots-item",children:"..."},"three-dots-left"):a===r?x.jsx(ee.Link,{to:{search:Ce(t,{page:a})},preventScrollReset:!0,prefetch:"intent",className:"page-number-item page-number-item-selected",children:x.jsxs("span",{className:"sr-only",children:[" ",a]})},`page_num_${a}_current`):a===r+1||a===r+2||a===r-1||a===r-2||a===n||a===1?x.jsx(ee.Link,{to:{search:Ce(t,{page:Math.max(a,0)})},preventScrollReset:!0,prefetch:"intent",className:"page-number-item",children:x.jsxs("span",{className:"sr-only",children:[" ",a]})},`page_num_${a}`):r<n-3&&a===n-1?x.jsx("span",{className:"page-number-item three-dots-item",children:"..."},"three-dots-right"):null)}),r<n?x.jsx(ee.Link,{to:{search:Ce(t,{page:Math.max(r+1,0)})},preventScrollReset:!0,prefetch:"intent",className:"arrow-button-wrapper",children:x.jsx("span",{className:"sr-only arrow-button",children:">"})}):null]})}const pn=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})}}),bn=[{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"}],xn={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"},Pn={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"},Vt=e=>e.normalize("NFD").replace(/[\u0300-\u036f]/g,"");function En({keyword:e,query:t,options:r}){e=Vt(e),t=Vt(t);let n=e.toLowerCase().trim();const i=t.toLowerCase().trim(),a=t.length+1,u=n.split(" ").map(w=>w.trim()),c=i.split(" ").map(w=>w.trim()),d=(r==null?void 0:r.customScoreFunc)&&r.customScoreFunc(i,n);if(d)return{score:d,reason:"Custom",maxScore:-1,matchingKeyword:""};if(r!=null&&r.formatKeyword&&(n=r.formatKeyword(n)),n===i)return{score:t.length+1,reason:"Exact Match",maxScore:a,matchingKeyword:n};if(n.startsWith(t))return{score:t.length,reason:"Start With",maxScore:a,matchingKeyword:u[0]};const S=u.findIndex(w=>w.startsWith(i)||w.endsWith(i));if(S>-1)return{score:t.length-1,reason:t.length-1<1?"No Match":"Index Of Query",maxScore:a,matchingKeyword:u[S]};if(r!=null&&r.matchAllSubItems){let w=0;for(const b of c)(n.startsWith(b)||n.endsWith(b))&&w++;if(w>=c.length)return{score:t.length-1,reason:t.length-1<1?"No Match":"Index Of Sub Query",maxScore:a,matchingKeyword:c.join(",")}}else{let w=0;if(c.map(b=>{n.includes(b)&&w++}),w>=c.length)return{score:t.length-1,reason:t.length-1<1?"No Match":"Index Of Sub Query",maxScore:a,matchingKeyword:c.join(",")}}return{score:0,reason:"No Match",maxScore:a,matchingKeyword:""}}function Re({maxResult:e,data:t,query:r,key:n,minScore:i=1,options:a}){return Rn(t,r,n,a).sort((c,d)=>d.score-c.score).splice(0,e).filter(c=>c.score>0&&c.score>=i).map(({item:c})=>c)}function Rn(e,t,r,n){return!e||!e.map?[]:e.map(i=>({item:i,score:En({query:t,keyword:r?i[r]:i,options:n}).score}))}const Cn={getRecommendations:e=>{var r,n,i;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 a=Object.keys(e.widgetsToCategories);for(let u=0;u<a.length&&!t;u++){const c=a[u];if(!Array.isArray((r=e.widgetsToCategories)==null?void 0:r[c])){t="widgetsToCategories should be an array";break}(i=(n=e==null?void 0:e.widgetsToCategories)==null?void 0:n[c])==null||i.forEach(d=>{!t&&typeof d!="string"&&(t="widgetsToCategories values should be an array of strings")})}}t&&console.error("ERR: getRecommendations input validation failed: "+t)}},kn="__fs_ps",On="ISP_PERSONALIZATION_SEGMENT";function ft(e){return e==="new"||e==="returning"}function jn(e){if(!(!e||typeof e!="string"))for(const t of e.split(";")){const r=t.indexOf("=");if(r<0||t.slice(0,r).trim()!==kn)continue;let n=t.slice(r+1).trim();n.length>=2&&n[0]==='"'&&n[n.length-1]==='"'&&(n=n.slice(1,-1));try{n=decodeURIComponent(n)}catch{}if(ft(n))return n}}function Tn(){var e;if(!(typeof window>"u"))try{const t=(e=window.localStorage)==null?void 0:e.getItem(On);return ft(t)?t:void 0}catch{return}}function An({cache:e,waitUntil:t,request:r,uuid:n,storeID:i,fastSimonSession:a,searchPersonalization:u,collectionPersonalization:c,marketContext:d,requestCookieHeader:S}){const w=fn({cache:e,waitUntil:t,request:r});function b(s){for(const m in s)!s[m]&&s[m]!==!1&&delete s[m]}function _(){var p,y,C;const s=(p=a==null?void 0:a.getPersonalizationSegment)==null?void 0:p.call(a);if(ft(s))return s;let m=S;if(!m)try{m=(C=(y=r==null?void 0:r.headers)==null?void 0:y.get)==null?void 0:C.call(y,"cookie")}catch{m=void 0}const v=jn(m);return v||Tn()}function f(){var s,m;return{st:(s=a==null?void 0:a.getSessionToken)==null?void 0:s.call(a),sp:(m=a==null?void 0:a.getVisitedProducts)==null?void 0:m.call(a).toString(),ps:_()}}function D(s=10){const m=new Date,v=s*60*1e3,p=m.getTime(),y=p-p%v;return new Date(y).getTime()}async function R({url:s,cacheStrategy:m=z()}){return(await w.fetch(s,{method:"GET",headers:{"Content-type":"application/json"}},{cacheKey:[s],cacheStrategy:m,shouldCacheResponse:p=>p.error==null||p.error.length===0})).data}async function $({url:s,cacheStrategy:m=z()}){const v=new URL(s);v.searchParams.set("facets_required","2");const p=await R({url:v.toString(),cacheStrategy:m});return p==null?void 0:p.facets}async function T({props:s,cacheStrategy:m=z()}){const v={src:"hydrogen",request_source:"hydrogen",q:s.query,narrow:s!=null&&s.narrow?JSON.stringify(s.narrow):void 0,facets_required:s!=null&&s.facetsRequired?"1":"0",products_per_page:String(s==null?void 0:s.productsPerPage),page_num:String(s.page),sort_by:s!=null&&s.sortBy?s.sortBy:void 0,with_product_attributes:"1",search_within_search:s.searchWithinResultsQuery?s.searchWithinResultsQuery:void 0,uuid:n,store_id:i,market_context:d};u&&Object.assign(v,f()),b(v);const p="https://api.fastsimon.com/full_text_search?"+new URLSearchParams(v),y=await R({url:p,cacheStrategy:m});return y.items=y.items.map(C=>{var O,M;return{...C,t:((M=(O=C==null?void 0:C.t)==null?void 0:O.replace)==null?void 0:M.call(O,"_large.","."))||""}}),y.getFacetsOnly=y!=null&&y.facets_completed?void 0:()=>$({url:p}),{...y,uuid:n,storeID:i,ids:y.items.map(C=>C.id)}}async function E({props:s,cacheStrategy:m=z()}){const v={src:"hydrogen",request_source:"hydrogen",category_id:s.categoryID||void 0,category_url:s!=null&&s.categoryURL?decodeURIComponent(s.categoryURL):void 0,narrow:s!=null&&s.narrow?JSON.stringify(s.narrow):void 0,facets_required:s!=null&&s.facetsRequired?"1":"0",products_per_page:String(s==null?void 0:s.productsPerPage),page_num:String(s.page),sort_by:s!=null&&s.sortBy?s.sortBy:void 0,with_product_attributes:"1",search_within_search:s.searchWithinResultsQuery?s.searchWithinResultsQuery:void 0,uuid:n,store_id:i,market_context:d};c&&Object.assign(v,f()),b(v);const p="https://api.fastsimon.com/categories_navigation?"+new URLSearchParams(v),y=await R({url:p,cacheStrategy:m});return y.items=y.items.map(C=>{var O,M;return{...C,t:((M=(O=C==null?void 0:C.t)==null?void 0:O.replace)==null?void 0:M.call(O,"_large.","."))||""}}),y.getFacetsOnly=y!=null&&y.facets_completed?void 0:()=>$({url:p}),{...y,uuid:n,storeID:i}}async function k({props:s,cacheStrategy:m=z()}){const v=O=>JSON.stringify([{sources:O.sources.join(","),max_suggest:O.maxSuggestions,categories:(O==null?void 0:O.categoriesIDs)??[],widget_id:O.widgetID,title:"Similar+Products"}]),p={request_source:"upsell-cross-sell-hydrogen",specs:s.specs?v(s.specs):JSON.stringify(bn),UUID:n,store_id:i,product_id:s.productId.replace("gid://shopify/Product/",""),with_product_attributes:"true",market_context:d};b(p);const y="https://api.fastsimon.com/related_products_suggest?"+new URLSearchParams(p);return(await R({url:y,cacheStrategy:m})).widget_responses[0].products}async function H({cacheStrategy:s=Qe()}){const m=`https://settings.fastsimon.com/settings/load?uuid=${n}&store_id=${i}`,v=await R({url:m,cacheStrategy:s}),p=v.isp_sort_options;return v.sort=Object.entries(Pn).filter(([y,C])=>p[Number(C)]).map(([y,C])=>({active:!0,name:xn[y],id:C})),v}async function g({props:s,cacheStrategy:m=z()}){var se,De,be;const v=D(10),p={q:s.query,uuid:n,store_id:i,src:"storefront-kit",cdn_cache_key:String(v),market_context:d},y={input_query:s.query,site_uuid:n,store_id:i,src:"storefront-kit",market_context:d};b(p),b(y);const C=d?`&market_context=${encodeURIComponent(d)}`:"",O="https://api.fastsimon.com?"+new URLSearchParams(p),M=`https://api.fastsimon.com/pop?store_id=${i}&UUID=${n}&c=1&api_type=json&src=storefront-kit&cdn_cache_key=${v}${C}`,B=`https://api.fastsimon.com/pop?store_id=${i}&UUID=${n}&api_type=json&src=storefront-kit&cdn_cache_key=${v}${C}`,ne=`https://api.fastsimon.com/pop?store_id=${i}&UUID=${n}&t=1&api_type=json&src=storefront-kit&cdn_cache_key=${v}${C}`,oe="https://api.fastsimon.com/get_cms_ac_search?"+new URLSearchParams(y),ie=(s==null?void 0:s.max_collections)===0?Promise.resolve([]):R({url:M,cacheStrategy:m}),ae=R({url:B,cacheStrategy:m}),Te=R({url:ne,cacheStrategy:Qe()}),Ae=R({url:oe,cacheStrategy:Qe()}),X=await Promise.all([ae,ie,Te,Ae]),G=5;let we=Re({data:(se=X[0])==null?void 0:se.products,maxResult:(s==null?void 0:s.max_products)||G,query:s.query,key:"l",options:{matchAllSubItems:!0,avoidNumbersTypoCorrection:!0}});const _e=Re({data:((De=X[0])==null?void 0:De.searches)||[],maxResult:(s==null?void 0:s.max_popular)||G,query:s.query}),Se=Re({data:X[1],maxResult:(s==null?void 0:s.max_collections)||G,query:s.query,key:"l"}),le=Re({data:X[2],maxResult:(s==null?void 0:s.max_turbolinks)||G,query:s.query,key:"l"}),pe=Re({data:X[3],maxResult:(s==null?void 0:s.max_articles)||G,query:s.query,key:"l"});return we.length<((s==null?void 0:s.max_products)||G)&&(we=(be=(await R({url:O,cacheStrategy:m})).items)==null?void 0:be.splice(0,(s==null?void 0:s.max_products)||G)),{items:{products:we,collections:Se,articles:pe,pages:[],queries:[],turbolinks:le,popularSearches:_e}}}async function I({props:s,cacheStrategy:m=z()}){const v={request_source:"upsell-cross-sell-hydrogen",UUID:n,store_id:i,widgets_ids:JSON.stringify([s.widgetID]),product_id:s.productId.replace("gid://shopify/Product/",""),with_product_attributes:"true",market_context:d};b(v);const p="https://api.fastsimon.com/upsell_cross_sell_recommendation?"+new URLSearchParams(v),y=await R({url:p,cacheStrategy:m});return y==null?void 0:y.widget_responses[0].products}async function F({props:s,cacheStrategy:m=z()}){Cn.getRecommendations(s);const v={request_source:"upsell-cross-sell-hydrogen",UUID:n,store_id:i,widgets_ids:JSON.stringify(s.widgetIds),product_id:s!=null&&s.productId?s.productId.replace("gid://shopify/Product/",""):void 0,with_product_attributes:"true",widgets_categories:s!=null&&s.widgetsToCategories?JSON.stringify(s.widgetsToCategories):void 0,market_context:d};if(a){const y=a.getVisitedProducts();y.length>0&&(v.products=JSON.stringify(y))}b(v);const p="https://api.fastsimon.com/upsell_cross_sell_recommendation?"+new URLSearchParams(v);return await R({url:p,cacheStrategy:m})}return{getSmartCollection:E,getSearchResults:T,getVisualSimilarityProducts:k,getDashboardConfig:H,getAutocompleteResults:g,productsRecommendations:I,getRecommendations:F}}const ot="isp_session_1",or="fast-session-token",Dn=1800,it="isp_token_1",J="fastSimonDelayedReportData",at="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 We(){return it in localStorage?localStorage.getItem(it):null}function In(e){localStorage.setItem(it,e)}function Ve(){const e=Nn()??localStorage.getItem(or),t=Math.round(Date.now()/1e3);if(e){const r=JSON.parse(e);return t-r.lastActive>=Dn?Xe({lastActive:t,start:t}):Xe({lastActive:t,start:r.start})}else return Xe({lastActive:t,start:t})}function Nn(){if(ot in localStorage){const e=JSON.parse(localStorage.getItem(ot));return JSON.stringify({lastActive:e.last_active,start:e.start})}return null}function Xe(e){return localStorage.setItem(ot,JSON.stringify({last_active:e.lastActive,start:e.start})),localStorage.setItem(or,JSON.stringify(e)),e}const Ln={prepareProductSeenFromSerpData({productId:e,productPosition:t,query:r,sortBy:n,pageNumber:i}){localStorage.setItem(J,JSON.stringify({sort_by:n,id:e==null?void 0:e.replace("gid://shopify/Product/",""),pagenum:i,pos:t,original_search_query:r}))},prepareProductSeenFromCollectionData({productId:e,productPosition:t,sortBy:r,pageNumber:n,categoryId:i,categoryName:a}){localStorage.setItem(J,JSON.stringify({sort_by:r,id:e==null?void 0:e.replace("gid://shopify/Product/",""),pagenum:n,pos:t,original_category_id:i,original_smart_navigation:a}))},prepareProductSeenFromAutocompleteData({productId:e,query:t,sku:r}){localStorage.setItem(J,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(J,JSON.stringify({id:e,original_search_query:t,prev_up_type:5}))},prepareProductAddedToCartData(e){var t,r;localStorage.setItem(J,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