1import{_ as Ke}from"./preload-helper-ckwbz45p.js";import{r as l,e as Re,g as ae,c as xe,L as ce,i as Ye,H as Je,I as ze}from"./chunk-EPOLDU6W-Ds8Iy-uH.js";import{j as P}from"./jsx-runtime-D_zvdyIk.js";import{u as Qe,d as Xe}from"./ShopifyProvider-TkzKs_gv.js";function $(e){if(!e){const t=`flattenConnection(): needs a 'connection' to flatten, but received '${e??""}' instead.`;return console.error(t+" Returning an empty array"),[]}return"nodes"in e?e.nodes:"edges"in e&&Array.isArray(e.edges)?e.edges.map(t=>{if(!(t!=null&&t.node))throw new Error("flattenConnection(): Connection edges must contain nodes");return t.node}):[]}const ue="_shopify_y",le="_shopify_s",Ze="X-Shopify-VisitToken",et="X-Shopify-UniqueToken",re={current:null};function V(){var e,t,r;let n;if(typeof window<"u"&&typeof window.performance<"u")try{const o=/^https?:\/\/([^/]+)(\/api\/(?:unstable|2\d{3}-\d{2})\/graphql\.json(?=$|\?))?/,i=performance.getEntriesByType("resource");let a;for(let s=i.length-1;s>=0;s--){const c=i[s];if(c.initiatorType!=="fetch")continue;const u=window.location.host,d=c.name.match(o);if(!d)continue;const[,f,y]=d;if(f===u||y&&(f==null?void 0:f.endsWith(`.${u}`))){const p=de(c);if(p){a=p;break}}}if(a&&(n=a),n?re.current=n:re.current&&(n=re.current),!n){const s=performance.getEntriesByType("navigation")[0];n=de(s,!1)}}catch{}if(!n){const o=typeof arguments[0]=="string"?arguments[0]:typeof document<"u"?document.cookie:"";n={uniqueToken:((e=o.match(/\b_shopify_y=([^;]+)/))==null?void 0:e[1])||"",visitToken:((t=o.match(/\b_shopify_s=([^;]+)/))==null?void 0:t[1])||"",consent:((r=o.match(/\b_tracking_consent=([^;]+)/))==null?void 0:r[1])||""}}return n}function de(e,t=!0){let r="",n="",o="";const i=e.serverTiming;if(i&&i.length>=3)for(let a=i.length-1;a>=0;a--){const{name:s,description:c}=i[a];if(!(!s||!c)&&(s==="_y"?r=c:s==="_s"?n=c:s==="_cmp"&&(o=c),r&&n&&o))break}return r&&n&&(!t||o)?{uniqueToken:r,visitToken:n,consent:o}:void 0}const A={PAGE_VIEW:"PAGE_VIEW",ADD_TO_CART:"ADD_TO_CART",PAGE_VIEW_2:"PAGE_VIEW_2",COLLECTION_VIEW:"COLLECTION_VIEW",PRODUCT_VIEW:"PRODUCT_VIEW",SEARCH_VIEW:"SEARCH_VIEW"},U={collection:"collection",product:"product",search:"search"},tt={headless:"headless"},fe={hydrogen:"6167201",headless:"12875497473"};function D(e,t){return{schema_id:e,payload:t,metadata:{event_created_at_ms:Date.now()}}}function C(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:i}=new URL(e),a=o.split("/"),s=a[a.length-1],c=a[a.length-2];return!s||!c?t:{id:`${s}${r}${i}`||"",resource:c??null,resourceId:s||null,search:r,searchParams:n,hash:i}}catch{return t}}function S(e,t){return typeof e!="object"?{}:(Object.entries(e).forEach(([r,n])=>{n&&(t[r]=n)}),t)}function rt(e){return typeof document>"u"?(console.error(`${e} should only be used within the useEffect callback or event handlers`),!0):!1}const pe="xxxx-4xxx-xxxx-xxxxxxxxxxxx";function Q(){let e="";try{const t=window.crypto,r=new Uint16Array(31);t.getRandomValues(r);let n=0;e=pe.replace(/[x]/g,o=>{const i=r[n]%16,a=o==="x"?i:i&3|8;return n++,a.toString(16)}).toUpperCase()}catch{e=pe.replace(/[x]/g,r=>{const n=Math.random()*16|0;return(r==="x"?n:n&3|8).toString(16)}).toUpperCase()}return`${nt()}-${e}`}function nt(){let e=0,t=0;e=new Date().getTime()>>>0;try{t=performance.now()>>>0}catch{t=0}return Math.abs(e+t).toString(16).toLowerCase().padStart(8,"0")}const ot="trekkie_storefront_page_view/1.4",at="myshopify.dev";function he(e){const t=e,{id:r,resource:n}=C(t.resourceId),o=n?n.toLowerCase():void 0;return[D(ot,S({pageType:t.pageType,customerId:parseInt(C(t.customerId).id||"0"),resourceType:o,resourceId:parseInt(r)},it(t)))]}function it(e){return{appClientId:e.shopifySalesChannel?fe[e.shopifySalesChannel]:fe.headless,isMerchantRequest:st(e.url),hydrogenSubchannelId:e.storefrontId||e.hydrogenSubchannelId||"0",isPersistentCookie:e.hasUserConsent,uniqToken:e.uniqueToken,visitToken:e.visitToken,microSessionId:Q(),microSessionCount:1,url:e.url,path:e.path,search:e.search,referrer:e.referrer,title:e.title,shopId:parseInt(C(e.shopId).id),currency:e.currency,contentLanguage:e.acceptedLanguage||"en"}}function st(e){if(typeof e!="string")return!1;const t=new URL(e).hostname;return t.indexOf(at)!==-1||t==="localhost"}const ct="2026.4.1",O="custom_storefront_customer_tracking/1.2",Le="page_rendered",Ne="collection_page_rendered",Ve="product_page_rendered",ut="product_added_to_cart",Ue="search_submitted";function W(e){return{canonical_url:e.canonicalUrl||e.url,customer_id:parseInt(C(e.customerId).id||"0")}}function lt(e){const t=e,r=W(t),n=t.pageType,o=[];switch(o.push(D(O,S({event_name:Le,...r},R(t)))),n){case U.collection:o.push(D(O,S({event_name:Ne,...r,collection_name:t.collectionHandle,collection_id:parseInt(C(t.collectionId).id)},R(t))));break;case U.product:o.push(D(O,S({event_name:Ve,...r,products:ie(t.products),total_value:t.totalValue},R(t))));break;case U.search:o.push(D(O,S({event_name:Ue,...r,search_string:t.searchString},R(t))));break}return o}function dt(e){const t=e,r=W(t);return[D(O,S({event_name:Le,...r},R(t)))]}function ft(e){const t=e,r=W(t);return[D(O,S({event_name:Ne,...r,collection_name:t.collectionHandle,collection_id:parseInt(C(t.collectionId).id)},R(t)))]}function pt(e){const t=e,r=W(t);return[D(O,S({event_name:Ve,...r,products:ie(t.products),total_value:t.totalValue},R(t)))]}function ht(e){const t=e,r=W(t);return[D(O,S({event_name:Ue,...r,search_string:t.searchString},R(t)))]}function yt(e){const t=e,r=C(t.cartId);return[D(O,S({event_name:ut,customerId:t.customerId,cart_token:r!=null&&r.id?`${r.id}`:null,total_value:t.totalValue,products:ie(t.products),customer_id:parseInt(C(t.customerId).id||"0")},R(t)))]}function R(e){const t=e;return{source:e.shopifySalesChannel||tt.headless,asset_version_id:e.assetVersionId||ct,hydrogenSubchannelId:e.storefrontId||e.hydrogenSubchannelId||"0",is_persistent_c
1ookie:e.hasUserConsent,deprecated_visit_token:e.visitToken,unique_token:e.uniqueToken,event_time:Date.now(),event_id:Q(),event_source_url:e.url,referrer:e.referrer,user_agent:e.userAgent,navigation_type:e.navigationType,navigation_api:e.navigationApi,shop_id:parseInt(C(e.shopId).id),currency:e.currency,ccpa_enforced:t.ccpaEnforced||!1,gdpr_enforced:t.gdprEnforced||!1,gdpr_enforced_as_string:t.gdprEnforced?"true":"false",analytics_allowed:e.analyticsAllowed||!1,marketing_allowed:e.marketingAllowed||!1,sale_of_data_allowed:e.saleOfDataAllowed||!1}}function ie(e){return e?e.map(t=>{const r=S({variant_gid:t.variantGid,category:t.category,sku:t.sku,product_id:parseInt(C(t.productGid).id),variant_id:parseInt(C(t.variantGid).id)},{product_gid:t.productGid,name:t.name,variant:t.variantName||"",brand:t.brand,price:parseFloat(t.price),quantity:Number(t.quantity||0)});return JSON.stringify(r)}):[]}function H(e,t){const{eventName:r,payload:n}=e;if(!n.hasUserConsent)return Promise.resolve();let o=[];const i=n;return r===A.PAGE_VIEW?o=o.concat(he(i),lt(i)):r===A.ADD_TO_CART?o=o.concat(yt(n)):r===A.PAGE_VIEW_2?o=o.concat(he(i),dt(i)):r===A.COLLECTION_VIEW?o=o.concat(ft(i)):r===A.PRODUCT_VIEW?o=o.concat(pt(i)):r===A.SEARCH_VIEW&&(o=o.concat(ht(i))),o.length?gt(o,t):Promise.resolve()}function mt(){return typeof window>"u"||!window.navigator?!1:/Chrome-Lighthouse/.test(window.navigator.userAgent)}const ye="sendShopifyAnalytics request is unsuccessful";function gt(e,t){if(mt())return Promise.resolve();const r={events:e,metadata:{event_sent_at_ms:Date.now()}};try{return fetch(t?`https://${t}/.well-known/shopify/monorail/unstable/produce_batch`:"https://monorail-edge.shopifysvc.com/unstable/produce_batch",{method:"post",headers:{"content-type":"text/plain"},body:JSON.stringify(r)}).then(n=>{if(!n.ok)throw new Error("Response failed");return n.text()}).then(n=>{n&&JSON.parse(n).result.forEach(i=>{i.status!==200&&console.error(ye,` 2 3`,i.message)})}).catch(n=>{console.error(ye,n)})}catch{return Promise.resolve()}}function vt(){if(rt("getClientBrowserParameters"))return{uniqueToken:"",visitToken:"",url:"",path:"",search:"",referrer:"",title:"",userAgent:"",navigationType:"",navigationApi:""};const[e,t]=Pt(),r=V();return{uniqueToken:r.uniqueToken,visitToken:r.visitToken,url:location.href,path:location.pathname,search:location.search,referrer:document.referrer,title:document.title,userAgent:navigator.userAgent,navigationType:e,navigationApi:t}}function _t(){try{const e=(performance==null?void 0:performance.getEntriesByType)&&(performance==null?void 0:performance.getEntriesByType("navigation"));if(e&&e[0]){const t=window.performance.getEntriesByType("navigation")[0].type;return t&&t.toString()}}catch{}}function wt(){var e,t;try{if(PerformanceNavigation&&((e=performance==null?void 0:performance.navigation)==null?void 0:e.type)!==null&&((t=performance==null?void 0:performance.navigation)==null?void 0:t.type)!==void 0){const r=performance.navigation.type;switch(r){case PerformanceNavigation.TYPE_NAVIGATE:return"navigate";case PerformanceNavigation.TYPE_RELOAD:return"reload";case PerformanceNavigation.TYPE_BACK_FORWARD:return"back_forward";default:return`unknown: ${r}`}}}catch{}}function Pt(){try{let e="PerformanceNavigationTiming",t=_t();return t||(t=wt(),e="performance.navigation"),t?[t,e]:["unknown","unknown"]}catch{}return["error","error"]}const me={};function Et(e,t){const r=me[e];if(r)return r;const n=new Promise((o,i)=>{const a=document.createElement("script");t!=null&&t.module?a.type="module":a.type="text/javascript",a.src=e,a.onload=()=>{o(!0)},a.onerror=()=>{i(!1)},(t==null?void 0:t.in)==="head"?document.head.appendChild(a):document.body.appendChild(a);const s=t==null?void 0:t.attributes;s&&Object.keys(s).forEach(c=>{a.setAttribute(c,s[c])})});return me[e]=n,n}function Z(e,t){const[r,n]=l.useState("loading");return l.useEffect(()=>{Et(e,t).then(()=>n("done")).catch(()=>n("error"))},[e]),r}const Ct="https://cdn.shopify.com/shopifycloud/shop-js/v1.0/client.js";function Tt(e){return e==="headless"||e==="hydrogen"}function It({channel:e,variantIds:t,className:r,variantIdsAndQuantities:n,width:o,storeDomain:i}){const a=Qe(),s=i||(a==null?void 0:a.storeDomain),c=Z(Ct);let u=[],d;if(!s||s===Xe.storeDomain)throw new Error(At);if(t&&n)throw new Error(kt);if(!t&&!n)throw new Error(ge);if(e)if(Tt(e))d=e;else throw new Error(bt);if(t)u=t.reduce((y,m)=>{const p=C(m).id;return p&&y.push(p),y},[]);else if(n)u=n.reduce((y,m)=>{const p=C(m==null?void 0:m.id).id;return p&&y.push(`${p}:${(m==null?void 0:m.quantity)??1}`),y},[]);else throw new Error(ge);if(u.length===0)throw new Error(St);const f=o?{"--shop-pay-button-width":o}:void 0;return P.jsx("div",{className:r,style:f,children:c==="done"&&P.jsx("shop-pay-button",{...d?{channel:d}:{},"store-url":s,variants:u.join(",")})})}const At='You must pass a "storeDomain" prop to the "ShopPayButton" component, or wrap it in a "ShopifyProvider" component.',St='You must pass in "variantIds" in the form of ["gid://shopify/ProductVariant/1"]',ge='You must pass in either "variantIds" or "variantIdsAndQuantities" to ShopPayButton',kt="You must provide either a variantIds or variantIdsAndQuantities prop, but not both in the ShopPayButton component",bt='Invalid channel attribution value. Must be either "headless" or "hydrogen"';function Dt(e,t,r={}){let n=e+"="+encodeURIComponent(t);return r.expires&&(n+="; Expires="+new Date(r.expires).toUTCString()),r.maxage!=null&&r.maxage>=0&&(n+="; Max-Age="+(r.maxage|0)),r.domain&&(n+="; Domain="+r.domain),r.path&&(n+="; Path="+r.path),r.samesite&&(n+="; SameSite="+r.samesite),(r.secure||r.samesite==="None")&&(n+="; Secure"),r.httponly&&(n+="; HttpOnly"),n}const Ot=3600*24*360*1,Rt=1800;function Me(e){const{hasUserConsent:t,domain:r="",checkoutDomain:n="",storefrontAccessToken:o,fetchTrackingValues:i,ignoreDeprecatedCookies:a=!1}=e||{}
3,s=xt({storefrontAccessToken:o,fetchTrackingValues:i,checkoutDomain:n});return l.useEffect(()=>{if(a||!s)return;let c=r||window.location.host;if(n){const d=n.split(".").reverse(),f=c.split(".").reverse(),y=[];d.forEach((m,p)=>{m===f[p]&&y.push(m)}),c=y.reverse().join(".")}/^localhost/.test(c)&&(c="");const u=c?/^\./.test(c)?c:`.${c}`:"";if(t){const d=V();if((d.uniqueToken||d.visitToken||"").startsWith("00000000-"))return;F(ue,d.uniqueToken||Q(),Ot,u),F(le,d.visitToken||Q(),Rt,u)}else F(ue,"",0,u),F(le,"",0,u)},[s,t,r,n,a]),s}function F(e,t,r,n){document.cookie=Dt(e,t,{maxage:r,domain:n,samesite:"Lax",path:"/"})}async function ve(e,t=""){const{uniqueToken:r,visitToken:n}=V(),o=await fetch(`${t.replace(/\/+$/,"")}/api/unstable/graphql.json`,{method:"POST",headers:{"Content-Type":"application/json",...e&&{"X-Shopify-Storefront-Access-Token":e},...n||r?{[Ze]:n,[et]:r}:void 0},body:JSON.stringify({query:"query ensureCookies { consentManagement { cookies(visitorConsent:{}) { cookieDomain } } }"})});if(!o.ok)throw new Error(`Failed to fetch consent from browser: ${o.status} ${o.statusText}`);await o.json(),V()}function xt({checkoutDomain:e,storefrontAccessToken:t,fetchTrackingValues:r=!1}){const[n,o]=l.useState(!r),i=l.useRef(!1);return l.useEffect(()=>{if(!r){o(!0);return}i.current||(i.current=!0,ve(t).catch(a=>e?ve(t,e):Promise.reject(a)).catch(a=>{console.warn("[h2:warn:useShopifyCookies] Failed to fetch tracking values from browser: "+(a instanceof Error?a.message:String(a)))}).finally(()=>{o(!0)}))},[e,r,t]),n}function ee(e){let{type:t,data:r={},customData:n}=e,o=ae(),{publish:i,cart:a,prevCart:s,shop:c,customData:u}=te(),d=o.pathname+o.search,f={...r,customData:{...u,...n},cart:a,prevCart:s,shop:c};return l.useEffect(()=>{c!=null&&c.shopId&&(f={...f,url:window.location.href},i(t,f))},[i,d,c==null?void 0:c.shopId]),null}function Lt(e){return P.jsx(ee,{...e,type:"page_viewed"})}function Nt(e){return P.jsx(ee,{...e,type:"product_viewed"})}function Vt(e){return P.jsx(ee,{...e,type:"collection_viewed"})}function Ut(e){return P.jsx(ee,{...e,type:"search_viewed"})}var b={PAGE_VIEWED:"page_viewed",PRODUCT_VIEWED:"product_viewed",COLLECTION_VIEWED:"collection_viewed",CART_VIEWED:"cart_viewed",SEARCH_VIEWED:"search_viewed",PRODUCT_ADD_TO_CART:"product_added_to_cart"},Mt="_sfapi_proxy",jt="_server_tracking";function je(e){var t,r;if(typeof window>"u")return!1;try{return!!((r=(t=window.performance.getEntriesByType("navigation")[0])==null?void 0:t.serverTiming)!=null&&r.some(n=>n.name===e))}catch{return!1}}function qt(){return je(Mt)}function $t(){return je(jt)}var Bt="https://cdn.shopify.com/shopifycloud/consent-tracking-api/v0.2/consent-tracking-api.js",Wt="https://cdn.shopify.com/shopifycloud/privacy-banner/storefront-banner.js";function ne(e){console.error(`[h2:error:useCustomerPrivacy] Unable to setup Customer Privacy API: Missing consent.${e} configuration.`)}function Ht(e){let{withPrivacyBanner:t=!1,onVisitorConsentCollected:r,onReady:n,checkoutDomain:o,storefrontAccessToken:i,country:a,locale:s,sameDomainForStorefrontApi:c}=e,u=l.useMemo(()=>c??qt(),[c]),d=l.useMemo(()=>u&&!$t(),[u]),f=Me({fetchTrackingValues:d,storefrontAccessToken:i,ignoreDeprecatedCookies:!0}),y=l.useMemo(V,[f]),{revalidate:m}=ze();Z(t?Wt:Bt,{attributes:{id:"customer-privacy-api"}});let{observing:p,setLoaded:h,apisLoaded:g}=Ft({withPrivacyBanner:t}),v=l.useMemo(()=>{o||ne("checkoutDomain"),i||ne("storefrontAccessToken"),(i.startsWith("shpat_")||i.length!==32)&&console.error("[h2:error:useCustomerPrivacy] It looks like you passed a private access token, make sure to use the public token");let w=Kt(o);return{checkoutRootDomain:u&&typeof window<"u"?window.location.host:o,storefrontRootDomain:w?"."+w:void 0,storefrontAccessToken:i,country:a,locale:s}},[ne,o,i,a,s]);l.useEffect(()=>{let w=_=>{let k=V();if((y.visitToken!==k.visitToken||y.uniqueToken!==k.uniqueToken)&&m().catch(()=>{console.warn("[h2:warn:useCustomerPrivacy] Revalidation failed after consent change.")}),r){let T=M();if(T!=null&&T.shouldShowBanner()){let I=T.currentVisitorConsent();if(I&&I.marketing===""&&I.analytics===""&&I.preferences==="")return}r(_.detail)}};return document.addEventListener("visitorConsentCollected",w),()=>{document.removeEventListener("visitorConsentCollected",w)}},[r]),l.useEffect(()=>{if(!t||p.current.privacyBanner)return;p.current.privacyBanner=!0;let w=window.privacyBanner||void 0;Object.defineProperty(window,"privacyBanner",{configurable:!0,get(){return w},set(_){typeof _=="object"&&_!==null&&"showPreferences"in _&&"loadBanner"in _&&(w=Pe({privacyBanner:_,config:v}),h.privacyBanner())}})},[t,v,Pe,h.privacyBanner]),l.useEffect(()=>{if(p.current.customerPrivacy)return;p.current.customerPrivacy=!0;let w=null,_=null,k=window.Shopify||void 0;Object.defineProperty(window,"Shopify",{configurable:!0,get(){return k},set(T){typeof T=="object"&&T!==null&&Object.keys(T).length===0&&(k=T,w={backendConsentEnabled:!0},Object.defineProperty(window.Shopify,"customerPrivacy",{configurable:!0,get(){return _??w},set(I){if(typeof I=="object"&&I!==null&&"setTrackingConsent"in I){let j=I;_={...j,setTrackingConsent:we({customerPrivacy:j,config:v})},k={...k,customerPrivacy:_},h.customerPrivacy()}}}))}})},[v,we,h.customerPrivacy]),l.useEffect(()=>{if(!g||!f)return;let w=M();if(w&&!w.cachedConsent){let _=V();_.consent&&(w.cachedConsent=_.consent)}if(t){let _=X();_&&_.loadBanner(v)}Gt(),n==null||n()},[g,f]);let E={customerPrivacy:M()};return t&&(E.privacyBanner=X()),E}var _e=!1;function Gt(){if(_e)return;_e=!0;let e=new CustomEvent("shopifyCustomerPrivacyApiLoaded");document.dispatchEvent(e)}function Ft({withPrivacyBanner:e}){let t=l.useRef({customerPrivacy:!1,privacyBanner:!1}),[r,n]=l.useState(e?[!1,!1]:[!1]),o=r.every(Boolean);return{observing:t,setLoaded:{customerPrivacy:()=>{n(e?i=>[!0,i[1]]:()=>[!0])},privacyBanner:()=>{e&&n(i=>[i[0],!0])}},apisLoaded:o}}function Kt(e){if(typeof window>"u")return;let t=window.location.host,r=e.split(".").reverse(),n=t.split(".").reverse(),o=[];return r.forEach((i,a)=>{i===n[a]&&o.push(i)}),o.reverse().join(".")||void 0}function we({customerPrivacy:e,config:t}){let r=e.setTrackingConsent,{locale:n,country:o,...i}=t;function a(s,c){r({...i,headlessStorefront:!0,...s},c)}return a}function Pe({privacyBanner:e,config:t}){let r=e.loadBanner,n=e.showPreferences;function o(a){if(typeof a=="object"){r({...t,...a});return}r(t)}function i(a){if(typeof a=="object"){n({...t,...a});return}n(t)}return{loadBanner:o,showPreferences:i}}function M(){var e;try{let t=(e=window.Shopify)==null?void 0:e.customerPrivacy;return t&&"setTrackingConsent"in t?t:null}catch{return null}}function X(){try{return window&&(window!=null&&window.privacyBanner)?window.privacyBanner:null}catch{return null}}var Yt="2026.4.1";function Jt(){let e=M();if(!e)throw new Error("Shopify Customer Privacy API not available. Must be used within a useEffect. Make sure to load the Shopify Customer Privacy API with useCustomerPrivacy() or <AnalyticsProvider>.");return e}function zt({consent:e,onReady:t,domain:r}){let{subscribe:n,register:o,canTrack:i}=te(),[a,s]=l.useState(!1),[c,u]=l.useState(!1),[d,f]=l.useState(""),y=l.useRef(!1),{checkoutDomain:m,storefrontAccessToken:p,language:h}=e,{ready:g}=o("Internal_Shopify_Analytics");Ht({...e,locale:h,checkoutDomain:m||"mock.shop",storefrontAccessToken:p||"abcdefghijklmnopqrstuvwxyz123456",onReady:()=>!e.withPrivacyBanner&&u(!0),onVisitorConsentCollected:E=>{try{f(JSON.stringify(E))}catch{}u(!0)}});let v=l.useMemo(()=>c?i():!0,[c,i,d]);return Me({hasUserConsent:v,domain:r,checkoutDomain:m,fetchTrackingValues:!1,ignoreDeprecatedCookies:!c}),l.useEffect(()=>{y.current||(y.current=!0,n(b.PAGE_VIEWED,Xt),n(b.PRODUCT_VIEWED,Zt),n(b.COLLECTION_VIEWED,er),n(b.SEARCH_VIEWED,tr),n(b.PRODUCT_ADD_TO_CART,rr),s(!0))},[n]),l.useEffect(()=>{a&&c&&(g(),t())},[a,c,t]),null}function K(e){console.error(`[h2:error:ShopifyAnalytics] Unable to send Shopify analytics: Missing shop.${e} configuration.`)}function G(e){var n,o,i,a;let t=Jt(),r=t.analyticsProcessingAllowed();if(!((n=e==null?void 0:e.shop)!=null&&n.shopId)){K("shopId");return}if(!((o=e==null?void 0:e.shop)!=null&&o.acceptedLanguage)){K("acceptedLanguage");return}if(!((i=e==null?void 0:e.shop)!=null&&i.currency)){K("currency");return}if(!((a=e==null?void 0:e.shop)!=null&&a.hydrogenSubchannelId)){K("hydrogenSubchannelId");return}return{shopifySalesChannel:"hydrogen",assetVersionId:Yt,...e.shop,hasUserConsent:r,...vt(),analyticsAllowed:t.analyticsProcessingAllowed(),marketingAllowed:t.marketingAllowed(),saleOfDataAllowed:t.saleOfDataAllowed(),ccpaEnforced:!t.saleOfDataAllowed(),gdprEnforced:!(t.marketingAllowed()&&t.anal
3yticsProcessingAllowed())}}function Qt(e,t){if(t===null)return;let r=G(e);return r?{...r,cartId:t.id}:void 0}var x={};function Xt(e){let t=G(e);t&&(H({eventName:A.PAGE_VIEW_2,payload:{...t,...x}}),x={})}function Zt(e){let t=G(e);if(t&&qe({type:"product",products:e.products})){let r=oe(e.products);x={pageType:U.product,resourceId:r[0].productGid},t={...t,...x,products:oe(e.products)},H({eventName:A.PRODUCT_VIEW,payload:t})}}function er(e){let t=G(e);t&&(x={pageType:U.collection,resourceId:e.collection.id},t={...t,...x,collectionHandle:e.collection.handle,collectionId:e.collection.id},H({eventName:A.COLLECTION_VIEW,payload:t}))}function tr(e){let t=G(e);t&&(x={pageType:U.search},t={...t,...x,searchString:e.searchTerm},H({eventName:A.SEARCH_VIEW,payload:t}))}function rr(e){let{cart:t,currentLine:r}=e,n=Qt(e,t);!n||!(r!=null&&r.id)||nr({matchedLine:r,eventPayload:n})}function nr({matchedLine:e,eventPayload:t}){let r={id:e.merchandise.product.id,variantId:e.merchandise.id,title:e.merchandise.product.title,variantTitle:e.merchandise.title,vendor:e.merchandise.product.vendor,price:e.merchandise.price.amount,quantity:e.quantity,productType:e.merchandise.product.productType,sku:e.merchandise.sku};qe({type:"cart",products:[r]})&&H({eventName:A.ADD_TO_CART,payload:{...t,products:oe([r])}})}function L(e,t,r,n){if(e==="cart"){let o=`${r?"merchandise":"merchandise.product"}.${t}`;console.error(`[h2:error:ShopifyAnalytics] Can't set up cart analytics events because the \`cart.lines[].${o}\` value is missing from your GraphQL cart query. In your project, search for where \`fragment CartLine on CartLine\` is defined and make sure \`${o}\` is part of your cart query. Check the Hydrogen Skeleton template for reference: https://github.com/Shopify/hydrogen/blob/main/templates/skeleton/app/lib/fragments.ts#L25-L56.`)}else{let o=`${n||t}`;console.error(`[h2:error:ShopifyAnalytics] Can't set up product view analytics events because the \`${o}\` is missing from your \`<Analytics.ProductView>\`. Make sure \`${o}\` is part of your products data prop. Check the Hydrogen Skeleton template for reference: https://github.com/Shopify/hydrogen/blob/main/templates/skeleton/app/routes/products.%24handle.tsx#L159-L165.`)}}function qe({type:e,products:t}){return!t||t.length===0?(L(e,"",!1,"data.products"),!1):(t.forEach(r=>{if(!r.id)return L(e,"id",!1),!1;if(!r.title)return L(e,"title",!1),!1;if(!r.price)return L(e,"price.amount",!0,"price"),!1;if(!r.vendor)return L(e,"vendor",!1),!1;if(!r.variantId)return L(e,"id",!0,"variantId"),!1;if(!r.variantTitle)return L(e,"title",!0,"variantTitle"),!1}),!0)}function oe(e){return e.map(t=>{let r={productGid:t.id,variantGid:t.variantId,name:t.title,variantName:t.variantTitle,brand:t.vendor,price:t.price,quantity:t.quantity||1,category:t.productType};return t.sku&&(r.sku=t.sku),t.productType&&(r.category=t.productType),r})}function Ee(e){console.error(`[h2:error:CartAnalytics] Can't set up cart analytics events because the \`cart.${e}\` value is missing from your GraphQL cart query. In your project, search for where \`fragment CartApiQuery on Cart\` is defined and make sure \`${e}\` is part of your cart query. Check the Hydrogen Skeleton template for reference: https://github.com/Shopify/hydrogen/blob/main/templates/skeleton/app/lib/fragments.ts#L59.`)}function or({cart:e,setCarts:t}){let{publish:r,shop:n,customData:o,canTrack:i,cart:a,prevCart:s}=te(),c=l.useRef(null);return l.useEffect(()=>{if(e)return Promise.resolve(e).then(u=>{if(u&&u.lines){if(!u.id){Ee("id");return}if(!u.updatedAt){Ee("updatedAt");return}}t(({cart:d,prevCart:f})=>(u==null?void 0:u.updatedAt)!==(d==null?void 0:d.updatedAt)?{cart:u,prevCart:d}:{cart:d,prevCart:f})}),()=>{}},[t,e]),l.useEffect(()=>{if(!a||!(a!=null&&a.updatedAt)||(a==null?void 0:a.updatedAt)===(s==null?void 0:s.updatedAt))return;let u;try{u=JSON.parse(localStorage.getItem("cartLastUpdatedAt")||"")}catch{u=null}if(a.id===(u==null?void 0:u.id)&&a.updatedAt===(u==null?void 0:u.updatedAt))return;let d={eventTimestamp:Date.now(),cart:a,prevCart:s,shop:n,customData:o};if(a.updatedAt===c.current)return;c.current=a.updatedAt,r("cart_updated",d),localStorage.setItem("cartLastUpdatedAt",JSON.stringify({id:a.id,updatedAt:a.updatedAt}));let f=s!=null&&s.lines?$(s==null?void 0:s.lines):[],y=a.lines?$(a.lines):[];f==null||f.forEach(m=>{let p=y.filter(h=>m.id===h.id);
3if((p==null?void 0:p.length)===1){let h=p[0];m.quantity<h.quantity?r("product_added_to_cart",{...d,prevLine:m,currentLine:h}):m.quantity>h.quantity&&r("product_removed_from_cart",{...d,prevLine:m,currentLine:h})}else r("product_removed_from_cart",{...d,prevLine:m})}),y==null||y.forEach(m=>{let p=f.filter(h=>m.id===h.id);(!p||p.length===0)&&r("product_added_to_cart",{...d,currentLine:m})})},[a,s,r,n,o,i]),null}var ar="https://cdn.shopify.com/shopifycloud/perf-kit/shopify-perf-kit-spa.min.js";function ir({shop:e}){let t=l.useRef(!1),{subscribe:r,register:n}=te(),{ready:o}=n("Internal_Shopify_Perf_Kit"),i=Z(ar,{attributes:{id:"perfkit","data-application":"hydrogen","data-shop-id":C(e.shopId).id.toString(),"data-storefront-id":e.hydrogenSubchannelId,"data-monorail-region":"global","data-spa-mode":"true","data-resource-timing-sampling-rate":"100"}});return l.useEffect(()=>{i!=="done"||t.current||(t.current=!0,r(b.PAGE_VIEWED,()=>{var a;(a=window.PerfKit)==null||a.navigate()}),r(b.PRODUCT_VIEWED,()=>{var a;(a=window.PerfKit)==null||a.setPageType("product")}),r(b.COLLECTION_VIEWED,()=>{var a;(a=window.PerfKit)==null||a.setPageType("collection")}),r(b.SEARCH_VIEWED,()=>{var a;(a=window.PerfKit)==null||a.setPageType("search")}),r(b.CART_VIEWED,()=>{var a;(a=window.PerfKit)==null||a.setPageType("cart")}),o())},[r,o,i]),null}var Ce=new Set,sr=e=>{Ce.has(e)||(console.warn(e),Ce.add(e))},Te=new Set,Ie=e=>{Te.has(e)||(console.error(new Error(e)),Te.add(e))},cr={canTrack:()=>!1,cart:null,customData:{},prevCart:null,publish:()=>{},shop:null,subscribe:()=>{},register:()=>({ready:()=>{}}),customerPrivacy:null,privacyBanner:null},$e=l.createContext(cr),J=new Map,B={};function Be(){return Object.values(B).every(Boolean)}function Ae(e,t){var r;J.has(e)||J.set(e,new Map),(r=J.get(e))==null||r.set(t.toString(),t)}var z=new Map;function Se(e,t){if(!Be()){z.set(e,t);return}We(e,t)}function We(e,t){(J.get(e)??new Map).forEach((r,n)=>{try{r(t)}catch(o){typeof o=="object"&&o instanceof Error?console.error("Analytics publish error",o.message,n,o.stack):console.error("Analytics publish error",o,n)}})}function ke(e){return B.hasOwnProperty(e)||(B[e]=!1),{ready:()=>{B[e]=!0,Be()&&z.size>0&&(z.forEach((t,r)=>{We(r,t)}),z.clear())}}}function be(){var e,t;try{return((t=(e=window.Shopify.customerPrivacy)==null?void 0:e.analyticsProcessingAllowed)==null?void 0:t.call(e))??!1}catch{}return!1}function De(e,t){return`[h2:error:Analytics.Provider] - ${e} is required. Make sure ${t} is defined in your environment variables. See https://h2o.fyi/analytics/consent to learn how to setup environment variables in the Shopify admin.`}function ur({canTrack:e,cart:t,children:r,consent:n,customData:o={},shop:i=null,cookieDomain:a}){var v;let{shop:s}=lr(i),[c,u]=l.useState(!!e),[d,f]=l.useState(!1),[y,m]=l.useState({cart:null,prevCart:null}),[p,h]=l.useState(e?()=>e:()=>be);if(s)if(/\/68817551382$/.test(s.shopId))sr("[h2:error:Analytics.Provider] - Mock shop is used. Analytics will not work properly.");else{if(!n.checkoutDomain){let E=De("consent.checkoutDomain","PUBLIC_CHECKOUT_DOMAIN");Ie(E)}if(!n.storefrontAccessToken){let E=De("consent.storefrontAccessToken","PUBLIC_STOREFRONT_API_TOKEN");Ie(E)}n!=null&&n.country||(n.country="US"),n!=null&&n.language||(n.language="EN"),n.withPrivacyBanner===void 0&&(n.withPrivacyBanner=!1)}let g=l.useMemo(()=>({canTrack:p,...y,customData:o,publish:p()?Se:()=>{},shop:s,subscribe:Ae,register:ke,customerPrivacy:M(),privacyBanner:X()}),[c,p,y,(v=y.cart)==null?void 0:v.updatedAt,y.prevCart,Se,Ae,o,s,ke,JSON.stringify(B),M,X]);return P.jsxs($e.Provider,{value:g,children:[r,!!s&&P.jsx(Lt,{}),!!s&&!!t&&P.jsx(or,{cart:t,setCarts:m}),!!s&&P.jsx(zt,{consent:n,onReady:()=>{u(!0),h(e?()=>e:()=>be),f(!0)},domain:a}),!!s&&d&&P.jsx(ir,{shop:s})]})}function te(){let e=l.useContext($e);if(!e)throw new Error("[h2:error:useAnalytics] 'useAnalytics()' must be a descendent of <AnalyticsProvider/>");return e}function lr(e){let[t,r]=l.useState(null);return l.useEffect(()=>(Promise.resolve(e).then(r),()=>{}),[r,e]),{shop:t}}var wr={CollectionView:Vt,ProductView:Nt,Provider:ur,SearchView:Ut},He="cartFormInput";function N({children:e,action:t,inputs:r,route:n,fetcherKey:o}){let i=Ye({key:o});return P.jsxs(i.Form,{action:n||"",method:"post",children:[(t||r)&&P.jsx("input",{type:"hidden",name:He,value:JSON.stringify({action:t,inputs:r})}),typeof e=="function"?e(i):e]})}N.INPUT_NAME=He;N.ACTIONS={AttributesUpdateInput:"AttributesUpdateInput",BuyerIdentityUpdate:"BuyerIdentityUpdate",Create:"Create",DiscountCodesUpdate:"DiscountCodesUpdate",GiftCardCodesUpdate:"GiftCardCodesUpdate",GiftCardCodesAdd:"GiftCardCodesAdd",GiftCardCodesRemove:"GiftCardCodesRemove",LinesAdd:"LinesAdd",LinesRemove:"LinesRemove",LinesUpdate:"LinesUpdate",NoteUpdate:"NoteUpdate",SelectedDeliveryOptionsUpdate:"SelectedDeliveryOptionsUpdate",MetafieldsSet:"MetafieldsSet",MetafieldDelete:"MetafieldDelete",DeliveryAddressesAdd:"DeliveryAddressesAdd",DeliveryAddressesUpdate:"DeliveryAddressesUpdate",DeliveryAddressesRemove:"DeliveryAddressesRemove",DeliveryAddressesReplace:"DeliveryAddressesReplace"};function dr(e){let t={};for(let a of e.entries()){let s=a[0],c=e.getAll(s);t[s]=c.length>1?c:a[1],t[s]==="on"?t[s]=!0:t[s]==="off"&&(t[s]=!1)}let{cartFormInput:r,...n}=t,{action:o,inputs:i}=r?JSON.parse(String(r)):{};return{action:o,inputs:{...i,...n}}}N.getFormInput=dr;var Ge="__h_pending_";function fr(e){return Ge+e}function Oe(e){return e.startsWith(Ge)}function Pr(e){let t=Je();if(!t||!t.length)return e;let r=e!=null&&e.lines?structuredClone(e):{lines:{nodes:[]}},n=r.lines.nodes,o=!1;for(let{formData:i}of t){if(!i)continue;let a=N.getFormInput(i);if(a.action===N.ACTIONS.LinesAdd)for(let s of a.inputs.lines){if(!s.selectedVariant){console.error("[h2:error:useOptimisticCart] No selected variant was passed in the cart action. Make sure to pass the selected variant if you want to use an optimistic cart");continue}let c=n.find(u=>{var d;return u.merchandise.id===((d=s.selectedVariant)==null?void 0:d.id)});o=!0,c?(c.quantity=(c.quantity||1)+(s.quantity||1),c.isOptimistic=!0):n.unshift({id:fr(s.selectedVariant.id),merchandise:s.selectedVariant,isOptimistic:!0,quantity:s.quantity||1})}else if(a.action===N.ACTIONS.LinesRemove)for(let s of a.inputs.lineIds){let c=n.findIndex(u=>u.id===s);if(c!==-1){if(Oe(n[c].id)){console.error("[h2:error:useOptimisticCart] Tried to remove an optimistic line that has not been added to the cart yet");continue}n.splice(c,1),o=!0}else console.warn(`[h2:warn:useOptimisticCart] Tried to remove line '${s}' but it doesn't exist in the cart`)}else if(a.action===N.ACTIONS.LinesUpdate)for(let s of a.inputs.lines){let c=n.findIndex(u=>s.id===u.id);if(c>-1){if(Oe(n[c].id)){console.error("[h2:error:useOptimisticCart] Tried to update an optimistic line that has not been added to the cart yet");continue}n[c].quantity=s.quantity,n[c].quantity===0&&n.splice(c,1),o=!0}else console.warn(`[h2:warn:useOptimisticCart] Tried to update line '${s.id}' but it doesn't exist in the cart`)}}return o&&(r.isOptimistic=o),r.totalQuantity=n.reduce((i,a)=>i+a.quantity,0),r}var Fe=l.createContext(void 0),Er=Fe.Provider,pr=()=>l.useContext(Fe);l.forwardRef((e,t)=>
3{let{waitForHydration:r,src:n,...o}=e,i=pr();return r?P.jsx(hr,{src:n,options:o}):P.jsx("script",{suppressHydrationWarning:!0,...o,src:n,nonce:i,ref:t})});function hr({src:e,options:t}){if(!e)throw new Error("`waitForHydration` with the Script component requires a `src` prop");return Z(e,{attributes:t}),null}function Cr({connection:e,children:t=()=>(console.warn("<Pagination> requires children to work properly"),null),namespace:r=""}){let[n,o]=l.useState(!1),i=Re(),a=ae();xe(),l.useEffect(()=>{i.state==="idle"&&o(!1)},[i.state]);let{endCursor:s,hasNextPage:c,hasPreviousPage:u,nextPageUrl:d,nodes:f,previousPageUrl:y,startCursor:m}=yr(e,r),p=l.useMemo(()=>{var v;return{...a.state,pagination:{...((v=a.state)==null?void 0:v.pagination)||{},[r]:{pageInfo:{endCursor:s,hasPreviousPage:u,hasNextPage:c,startCursor:m},nodes:f}}}},[s,c,u,m,f,r,a.state]),h=l.useMemo(()=>l.forwardRef(function(v,E){return c?l.createElement(ce,{preventScrollReset:!0,...v,to:d,state:p,replace:!0,ref:E,onClick:()=>o(!0)}):null}),[c,d,p]),g=l.useMemo(()=>l.forwardRef(function(v,E){return u?l.createElement(ce,{preventScrollReset:!0,...v,to:y,state:p,replace:!0,ref:E,onClick:()=>o(!0)}):null}),[u,y,p]);return t({state:p,hasNextPage:c,hasPreviousPage:u,isLoading:n,nextPageUrl:d,nodes:f,previousPageUrl:y,NextLink:h,PreviousLink:g})}function Y(e,t){let r=new URLSearchParams(e);return Object.keys((t==null?void 0:t.pagination)||{}).forEach(n=>{let o=n===""?"":`${n}_`,i=`${o}cursor`,a=`${o}direction`;r.delete(i),r.delete(a)}),r.toString()}function q(e){throw new Error(`The Pagination component requires ${"`"+e+"`"} to be a part of your query. See the guide on how to setup your query to include ${"`"+e+"`"}: https://shopify.dev/docs/custom-storefronts/hydrogen/data-fetching/pagination#setup-the-paginated-query`)}function yr(e,t=""){e.pageInfo||q("pageInfo"),typeof e.pageInfo.startCursor>"u"&&q("pageInfo.startCursor"),typeof e.pageInfo.endCursor>"u"&&q("pageInfo.endCursor"),typeof e.pageInfo.hasNextPage>"u"&&q("pageInfo.hasNextPage"),typeof e.pageInfo.hasPreviousPage>"u"&&q("pageInfo.hasPreviousPage");let r=Re(),n=xe(),{state:o,search:i,pathname:a}=ae(),s=t?`${t}_cursor`:"cursor",c=t?`${t}_direction`:"direction",u=new URLSearchParams(i).get(c)==="previous",d=l.useMemo(()=>{var h,g,v;return!((h=globalThis==null?void 0:globalThis.window)!=null&&h.__hydrogenHydrated)||!((v=(g=o==null?void 0:o.pagination)==null?void 0:g[t])!=null&&v.nodes)?$(e):u?[...$(e),...o.pagination[t].nodes||[]]:[...o.pagination[t].nodes||[],...$(e)]},[o,e,t]),f=l.useMemo(()=>{var k,T,I,j,se;let h=(k=globalThis==null?void 0:globalThis.window)==null?void 0:k.__hydrogenHydrated,g=(I=(T=o==null?void 0:o.pagination)==null?void 0:T[t])==null?void 0:I.pageInfo,v=!h||(g==null?void 0:g.startCursor)===void 0?e.pageInfo.startCursor:g.startCursor,E=!h||(g==null?void 0:g.endCursor)===void 0?e.pageInfo.endCursor:g.endCursor,w=!h||(g==null?void 0:g.hasPreviousPage)===void 0?e.pageInfo.hasPreviousPage:g.hasPreviousPage,_=!h||(g==null?void 0:g.hasNextPage)===void 0?e.pageInfo.hasNextPage:g.hasNextPage;return(se=(j=o==null?void 0:o.pagination)==null?void 0:j[t])!=null&&se.nodes&&(u?(v=e.pageInfo.startCursor,w=e.pageInfo.hasPreviousPage):(E=e.pageInfo.endCursor,_=e.pageInfo.hasNextPage)),{startCursor:v,endCursor:E,hasPreviousPage:w,hasNextPage:_}},[u,o,t,e.pageInfo.hasNextPage,e.pageInfo.hasPreviousPage,e.pageInfo.startCursor,e.pageInfo.endCursor]),y=l.useRef({params:Y(i,o),pathname:a});l.useEffect(()=>{window.__hydrogenHydrated=!0},[]),l.useEffect(()=>{let h=Y(i,o),g=y.current.params;(a!==y.current.pathname||h!==g)&&!(r.state==="idle"&&!r.location)&&(y.current={pathname:a,params:Y(i,o)},n(`${a}?${Y(i,o)}`,{replace:!0,preventScrollReset:!0,state:{nodes:void 0,pageInfo:void 0}}))},[a,i,o]);let m=l.useMemo(()=>{let h=new URLSearchParams(i);return h.set(c,"previous"),f.startCursor&&h.set(s,f.startCursor),`?${h.toString()}`},[i,f.startCursor]),p=l.useMemo(()=>{let h=new URLSearchParams(i);return h.set(c,"next"),f.endCursor&&h.set(s,f.endCursor),`?${h.toString()}`},[i,f.endCursor]);return{...f,previousPageUrl:m,nextPageUrl:p,nodes:d}}l.lazy(()=>Ke(()=>import("./log-seo-tags-TY72EQWZ-DCHH-_Gl.js"),[]));function Tr(e){return P.jsx(It,{channel:"hydrogen",...e})}export{wr as H,Tr as K,Er as L,te as Z,Pr as _,$ as f,Cr as m,N as r,pr as y};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.