@occluze/tether 0.9.1 → 0.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/esm/astro.js +1 -1
- package/dist/esm/chunks/{account-LCMJ7QU5.js → account-XBGNTM7V.js} +1 -1
- package/dist/esm/chunks/{account-pages-3C5KTPQV.js → account-pages-FIXSWJH7.js} +1 -1
- package/dist/esm/chunks/{analytics-VWSZOX2D.js → analytics-MO2ZWBOD.js} +1 -1
- package/dist/esm/chunks/chunk-2J3MTS3E.js +1 -0
- package/dist/esm/chunks/chunk-4FR3CUO2.js +1 -0
- package/dist/esm/chunks/{chunk-OURC3H6L.js → chunk-7CRTJV25.js} +1 -1
- package/dist/esm/chunks/{chunk-P6DV24RG.js → chunk-7ZXEVDOS.js} +1 -1
- package/dist/esm/chunks/{chunk-S5BUUIB6.js → chunk-BVO7KK2M.js} +1 -1
- package/dist/esm/chunks/{chunk-2IGCUTG5.js → chunk-CRKJ2VEX.js} +1 -1
- package/dist/esm/chunks/{chunk-XU27NSXT.js → chunk-DM5LEAWM.js} +1 -1
- package/dist/esm/chunks/{chunk-F2BYVA7V.js → chunk-FI4NIWAD.js} +1 -1
- package/dist/esm/chunks/{chunk-ZBV2JSHE.js → chunk-FWMPL6PR.js} +1 -1
- package/dist/esm/chunks/{chunk-EUCFOBIT.js → chunk-H6IORH7O.js} +1 -1
- package/dist/esm/chunks/{chunk-MJNPD6LB.js → chunk-IJAMRI33.js} +1 -1
- package/dist/esm/chunks/{chunk-P73VN3B6.js → chunk-OATTAXPO.js} +1 -1
- package/dist/esm/chunks/{chunk-2A2GN3Z7.js → chunk-OENVX4NY.js} +1 -1
- package/dist/esm/chunks/{chunk-D3MRWOFI.js → chunk-OJAV2I3C.js} +1 -1
- package/dist/esm/chunks/{chunk-3UCVDDK6.js → chunk-SZRDO62E.js} +1 -1
- package/dist/esm/chunks/{chunk-HROQXZYN.js → chunk-Y3NKKN2O.js} +1 -1
- package/dist/esm/chunks/{diagnose-TE72GNOO.js → diagnose-XSZPWEG7.js} +1 -1
- package/dist/esm/chunks/{extras-7GTMJMOZ.js → extras-DZIOTZ3H.js} +1 -1
- package/dist/esm/chunks/{lists-ZMVRGD6L.js → lists-OJGSVQMM.js} +1 -1
- package/dist/esm/chunks/{markets-ui-AAQM4PEE.js → markets-ui-DEEYV4KT.js} +1 -1
- package/dist/esm/chunks/{search-PWF4YZQO.js → search-A6HF5PMJ.js} +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/server.js +2 -2
- package/dist/tether.js +8 -4
- package/dist/tether.min.js +1 -1
- package/dist/tether.min.js.map +2 -2
- package/dist/types/src/server.d.ts +5 -2
- package/dist/types/src/version.d.ts +1 -1
- package/package.json +2 -2
- package/dist/esm/chunks/chunk-SOFWDTR7.js +0 -1
- package/dist/esm/chunks/chunk-YJC3CSEG.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{A as j,E as q,F as Q,b as T,d as E,e as x,o as V,p as G,r as c,x as O,y as S,z as b}from"./chunk-D3MRWOFI.js";var g=class extends Error{constructor(r,{status:n,errors:o,userErrors:i,code:s}={}){super(r);T(this,"name","TetherError");T(this,"code");T(this,"status");T(this,"errors");T(this,"userErrors");this.code=s??(n?`HTTP_${n}`:"ERROR"),this.status=n,this.errors=o,this.userErrors=i}};function v(t,e){return typeof e=="function"?e(t):typeof e=="string"?e==="object"?E(t):typeof t===e:Et(e)?Array.isArray(t)&&t.every(r=>v(r,e[0])):E(t)&&Object.entries(e).every(([r,n])=>n===void 0||v(t[r],n))}var Et=t=>Array.isArray(t),He=t=>e=>e===null||v(e,t),$e=t=>e=>v(e,t);function Tt(t=c){return`https://${t.domain}/api/${t.apiVersion}/graphql.json`}var Y=/"(?:\\.|[^"\\\n])*"|#[^\n]*/g,bt=/^\s*(?:query|mutation)(?:\s+\w+)?\s*(?:\([^)]*\))?/;function wt(t){return/\bmutation\b/.test(t.replace(Y,""))?"mutation":"query"}function J(t,{country:e,language:r}){let n=[];if(e&&n.push(`country: ${e}`),r&&n.push(`language: ${r}`),!n.length)return t;let o=`@inContext(${n.join(", ")})`,i=t.replace(Y,p=>" ".repeat(p.length)),s=i.indexOf("{");if(i.slice(0,s).includes("@inContext"))return t;if(i.trimStart().startsWith("{"))return`query ${o} ${t.slice(s)}`;let a=bt.exec(i);if(!a)return t;let l=a[0].length;return`${t.slice(0,l).trimEnd()} ${o} ${t.slice(l).trimStart()}`}function De(t,e=c){let r=V(e.country)??void 0,n=G(e.language)??void 0;return J(t,{country:r,language:n})}var N=300,St=500,At=3e4,W=430,xt=1e3,L="quantityAvailable",B=new Set,vt=t=>`${t.domain} ${t.apiVersion} ${t.token}`;function kt(t,e,r,{context:n,operation:o}){let i=typeof e=="string"?e:e(r),s=n?J(i,t):i;return t.maxAge<=0||o==="mutation"?s:`${s} #${Math.floor(Date.now()/(t.maxAge*xt))}`}var Rt=t=>new Promise(e=>setTimeout(e,t));function I(t,e){if(t===401||t===403){let r=e.token.startsWith("shpat_")?", not an Admin API token (shpat_\u2026)":"";return`Shopify rejected the Storefront token for ${e.domain} (${t}): use the public Storefront API token (Headless channel)${r}`}return t===404?`Store or API version not found (404): check domain ${e.domain} and apiVersion ${e.apiVersion}`:`HTTP ${t} from ${e.domain}`}function Ot(t){let e=x(t,"message"),r=x(x(t,"extensions"),"code"),n=typeof e=="string"?e:"";return typeof r=="string"?{message:n,extensions:{code:r}}:{message:n}}function Ct(t){if(!E(t))return null;let{data:e,errors:r}=t;return r==null?{data:e}:Array.isArray(r)?{data:e,errors:r.map(Ot)}:null}function C(t,e){return t.ok?new g(`Invalid response (${t.status})`,{code:"INVALID_RESPONSE",status:t.status}):new g(I(t.status,e),{status:t.status})}function K(t,e,r,n){let o=e.map(s=>s.message).filter(Boolean).join(" | "),i=o||"Storefront API error";return t.ok||(i=t.status===401||t.status===403||!o?I(t.status,r):o),new g(i,{status:t.status,errors:e,code:n})}function z(t,e){if(e==="any")return{kind:"retry",backoffMs:N};throw new g(`Network error: ${j(t)}`,{code:"NETWORK"})}function Lt(t,e,r,n,o,i,s){if(r.includes(L)&&n.some(d=>d.message.includes(L)))return{kind:"inventory-refused",error:K(t,n,e)};let a=n.map(d=>d.extensions?.code);if(i!=="none"&&a.includes("THROTTLED"))return{kind:"retry",backoffMs:St};let l=a.includes("INTERNAL_SERVER_ERROR");if(i==="any"&&l)return{kind:"retry",backoffMs:N};let p=t.ok&&(l||s==="mutation"&&o==null);throw K(t,n,e,p?"SERVER_ERROR":void 0)}async function Nt(t,e){if(!t)return e(null);let r=new AbortController,n=setTimeout(()=>{r.abort(new DOMException("signal timed out","TimeoutError"))},t);try{return await e(r.signal)}finally{clearTimeout(n)}}async function It(t,e,r,n,o,i,s){let a;try{a=await(t.fetch??fetch)(Tt(t),{method:"POST",headers:{"Content-Type":"application/json","X-Shopify-Storefront-Access-Token":t.token},body:JSON.stringify({query:e,variables:r}),signal:s})}catch(f){return z(f,o)}if(a.status===W)throw new g("Shopify security rejection (430)",{status:W});if(o!=="none"&&a.status===429||o==="any"&&a.status>=500)return{kind:"retry",backoffMs:N};let l;try{l=await a.json()}catch(f){if(f instanceof SyntaxError)throw C(a,t);return z(f,o)}let p=Ct(l);if(!p)throw C(a,t);let{data:d,errors:h=[]}=p;if(h.length)return Lt(a,t,e,h,d,o,i);if(!a.ok)throw new g(I(a.status,t),{status:a.status});if(!n(d))throw C(a,t);return{kind:"data",data:d}}async function X(t,e,r,n,{context:o=!0,operation:i="query"}={}){if(!t.domain||!t.token)throw new g("Tether is not configured: domain and token are required",{code:"NOT_CONFIGURED"});let s=vt(t),a=i==="mutation"?"not-run":"any",l=0;for(;;){let p={inventory:!B.has(s)},d=kt(t,e,p,{context:o,operation:i}),h=l<t.retries?a:"none",f=await Nt(t.requestTimeout,w=>It(t,d,r,n,h,i,w));switch(f.kind){case"data":return f.data;case"inventory-refused":if(typeof e=="string"||!p.inventory)throw f.error;O(`the token can't read inventory: ${L} is left out from now on`),B.add(s);break;case"retry":await Rt(Math.min(f.backoffMs*2**l,At)),l+=1,O("retry",l);break}}}function Fe(t,e,r,n){return X(c,t,e,r,n)}var Pt=t=>typeof t=="object"&&t!==null;function Mt(t,e,r={},n){return X(t,e,r,Pt,{...n,operation:wt(e)})}function Ve(t,e,r){return Mt(c,t,e,r)}function Ge(t,e){if(!t)throw new g(`${e}: empty response`);let r=t.userErrors??[];if(r.length)throw new g(r.map(n=>n.message).join(" | "),{userErrors:r});return t}var m=t=>`${c.prefix}-${t}`,_t=(t,e)=>e===void 0?`[${m(t)}]`:`[${m(t)}="${e}"]`,P=(t,e)=>t.getAttribute(m(e)),Ut=(t,e)=>t.hasAttribute(m(e));function Z(t,e){return t?[...t.querySelectorAll(e)]:[]}var Ht=(t,e,r)=>Z(t,e).filter(n=>n.closest(r)===t),$t=["product-ready","list-ready","cart-updated","cart-toggled","checkout","search"],tt=new WeakMap;function et(t,e){let r=new CustomEvent(`${c.prefix}:${t}`,{detail:e,bubbles:!0});return tt.set(r,t),r}function Dt(t,e){return tt.get(t)===e}function M(t,e,r=document){r.dispatchEvent(et(t,e))}function nt(t,{width:e,height:r,crop:n}={}){if(!t)return t;let o;try{o=new URL(t)}catch(i){if(i instanceof TypeError)return t;throw i}return e&&o.searchParams.set("width",String(e)),r&&o.searchParams.set("height",String(r)),n&&o.searchParams.set("crop",n),o.toString()}function _(t,e){return t.getAttribute(e)??t.getAttribute(m(e))??t.getAttribute(`data-${e}`)}function ot(t,e){if(!t||!e)return t;let r=_(e,"max-width"),n=_(e,"max-height");return nt(t,{width:r,height:n,crop:r||n?_(e,"crop"):null})}var rt=t=>t.replace(/\?.*$/,"");function it(t,e){return!t||!e?!1:rt(t)===rt(e)}function Ft(t){return/^\s*[a-z][a-z0-9+.-]*:/i.test(t)&&!/^\s*(https?:|data:image\/)/i.test(t)?"none":`url("${t.replace(/["\\\n\r\f]/g,n=>`\\${n.charCodeAt(0).toString(16)} `)}")`}function Vt(t,e,r){if(!e)return;let n=ot(e,t);if(t.tagName!=="IMG"){t.style.backgroundImage=Ft(n);return}if(it(t.getAttribute("src"),n)){r!=null&&!t.getAttribute("alt")&&t.setAttribute("alt",r);return}t.removeAttribute("srcset"),t.removeAttribute("sizes"),t.setAttribute("src",n),r!=null&&t.setAttribute("alt",r),t.getAttribute("loading")||t.setAttribute("loading","lazy")}var U=new WeakMap,Gt=t=>!!U.get(t),H=t=>t.cloneNode(!0);function st(t){let e=U.get(t);if(e!==void 0)return e;let r=t.firstElementChild,n=r?H(r):null;return U.set(t,n),t.replaceChildren(),n}function jt(t,e,r){let n=st(t);if(!n){e.length&&S("repeater without a template child",t);return}t.replaceChildren(),e.forEach((o,i)=>{let s=H(n);r(s,o,i),t.appendChild(s)})}function qt(t,e){let r=()=>{t.remove()};if(!e){r();return}try{e(t,r)}catch(n){b(n,"repeater onLeave"),r()}}function Qt(t,e,r,n){e.forEach((o,i)=>{if(!r.has(o))return;let s=e[i-1];if(s?.parentNode===t?s.after(o):t.prepend(o),!!n)try{n(o)}catch(a){b(a,"repeater onEnter")}})}function Wt(t,e,r,n,{onEnter:o,onLeave:i}={}){let s=st(t);if(!s){S("repeater without a template child",t);return}let a=`data-${c.prefix}-key`,l=`data-${c.prefix}-leaving`,p=()=>[...t.children].filter(u=>u.hasAttribute(a)&&!u.hasAttribute(l)),d=new Map(p().map(u=>[u.getAttribute(a),u])),h=[],f=new Set;e.forEach((u,A)=>{let R=String(r(u,A)),y=d.get(R);y?d.delete(R):(y=H(s),y.setAttribute(a,R),f.add(y)),n(y,u,A,f.has(y)),h.push(y)});let w=h.filter(u=>!f.has(u)),F=p().filter(u=>w.includes(u));if(!(F.length===w.length&&F.every((u,A)=>u===w[A]))){d.forEach(u=>{u.remove()}),h.forEach(u=>t.appendChild(u));return}Qt(t,h,f,o),d.forEach(u=>{u.setAttribute(l,""),u.removeAttribute(a),u.style.pointerEvents="none",u.inert=!0,qt(u,i)})}var Bt="http://www.w3.org/1999/xhtml",Kt=new Set(["h1","h2","h3","h4","h5","h6","p","span","div","br","hr","blockquote","code","pre","strong","em","b","i","u","s","small","sub","sup","ul","ol","li","dl","dt","dd","table","caption","colgroup","col","thead","tbody","tfoot","tr","th","td","a","img","picture","source","video","figure","figcaption","iframe"]),zt=new Set(["script","style","template","noscript","textarea","select","title"]),Yt=new Set(["style","title","lang","dir","role","align","width","height"]),Jt=new Map([["a",new Set(["href","target","rel","hreflang"])],["img",new Set(["src","srcset","sizes","alt","loading","decoding"])],["source",new Set(["src","srcset","sizes","type","media"])],["video",new Set(["src","poster","controls","autoplay","muted","loop","playsinline","preload"])],["iframe",new Set(["src","allow","allowfullscreen","frameborder","loading"])],["blockquote",new Set(["cite"])],["ol",new Set(["start","type","reversed"])],["li",new Set(["value"])],["table",new Set(["border","cellpadding","cellspacing","summary"])],["col",new Set(["span"])],["colgroup",new Set(["span"])],["th",new Set(["colspan","rowspan","headers","scope","valign"])],["td",new Set(["colspan","rowspan","headers","valign"])]]),Xt=new Set(["href","src","poster","cite"]),Zt=/^(javascript|vbscript|data):/i,te=/^data:image\/(png|gif|jpeg|webp|avif);/i,ee=new Set(["position","top","right","bottom","left","z-index","-webkit-box-reflect"]),re=["inset","transform","translate","rotate","scale","offset"],ne=/\d(?:[sld]?v|cq)(?:w|h|i|b|min|max)\b/i,oe=/^(?:outline|box-shadow|text-shadow|filter|text-decoration|text-underline-offset|text-stroke)|^(?:border-image|mask-border|mask-box-image)(?:-outset)?$/,at=40,ie=new Map([["letter-spacing",{px:4,em:.25}],["word-spacing",{px:4,em:.25}],["text-indent",{px:at}]]),ut=/(?<![\w#.-])[+-]?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?(%|[a-z]+)?/gi,se=/(?<![\w-])(?!drop-shadow\(|blur\()[\w-]+\([^()]*\)/g,ct=/(?:var|calc|min|max|clamp|env|attr)\(/i,ae=/url\(|expression\(|@import/i,ue=/[\u0000- ]/g,ce="allow-scripts allow-same-origin allow-popups allow-presentation",le=new Set(["autoplay","encrypted-media","picture-in-picture","fullscreen","clipboard-write","accelerometer","gyroscope","web-share"]),de="strict-origin-when-cross-origin",fe=["https://www.youtube.com","https://www.youtube-nocookie.com","https://player.vimeo.com","https://www.loom.com","https://fast.wistia.net"];function pe(t,e){return Yt.has(e)||e.startsWith("aria-")||(Jt.get(t)?.has(e)??!1)}function ge(t,e,r){let n=r.replace(ue,"");return Zt.test(n)?t==="img"&&e==="src"&&te.test(n):!0}function lt(t,e){try{return new URL(t,e)}catch{return null}}function me(t,e,r){let n=t.baseURI,o=lt(n)?.origin??"null";return{origin:o==="null"?null:o,baseUrl:n,styleParser:e,embedOrigins:new Set([...fe,...r])}}function he(t,e){let r=lt(t.trim(),e.baseUrl);return r!==null&&r.origin!==e.origin&&e.embedOrigins.has(r.origin)}function ye(t){let e=t.split(";").map(r=>r.trim().split(/\s+/)[0]?.toLowerCase()??"");return[...new Set(e.filter(r=>le.has(r)))].join("; ")}function Ee(t,e){if(ee.has(t)||re.some(n=>t.startsWith(n))||ne.test(e))return!0;let r=ie.get(t);return r?ct.test(e)||Te(e,r):t.startsWith("margin")&&e.includes("-")}function Te(t,e){return[...t.matchAll(ut)].some(([r="",n=""])=>{let o=parseFloat(r);if(o>=0)return!1;let i=e[n.toLowerCase()];return i===void 0||-o>i})}function be(t,e){return oe.test(t.replace(/^-webkit-/,""))?ct.test(e)?!0:[...e.replace(se,"").matchAll(ut)].some(([r="",n=""])=>{let o=Math.abs(parseFloat(r));return o!==0&&(n.toLowerCase()!=="px"||o>at)}):!1}function we(t,e){let r=e.style;r.cssText=t;let n=Array.from({length:r.length},(i,s)=>r.item(s));for(let i of n){let s=r.getPropertyValue(i);(Ee(i,s)||be(i,s)||ae.test(s))&&r.removeProperty(i)}let o=r.cssText;return e.removeAttribute("style"),o}function Se(t,e){let r=t.localName;for(let i of[...t.attributes]){let s=i.name.toLowerCase(),a=Xt.has(s);pe(r,s)&&(!a||ge(r,s,i.value))||t.removeAttribute(i.name)}let n=t.getAttribute("style");if(n===null)return;let o=we(n,e.styleParser);o===""?t.removeAttribute("style"):t.setAttribute("style",o)}var Ae=new Set(["","_self","_parent","_top"]);function xe(t){if(t.localName==="iframe"){let n=ye(t.getAttribute("allow")??"");n===""?t.removeAttribute("allow"):t.setAttribute("allow",n),t.setAttribute("sandbox",ce),t.setAttribute("referrerpolicy",de);return}if(t.localName!=="a")return;let e=t.getAttribute("target");if(e===null||Ae.has(e.toLowerCase()))return;let r=new Set((t.getAttribute("rel")??"").split(/\s+/).filter(Boolean));r.add("noopener"),r.add("noreferrer"),t.setAttribute("rel",[...r].join(" "))}function ve(t,e){let r=t.localName,n=t.namespaceURI===Bt;if(n&&zt.has(r)){t.remove();return}if(!n||!Kt.has(r)){t.replaceWith(...t.childNodes);return}if(r==="iframe"&&!he(t.getAttribute("src")??"",e)){t.remove();return}Se(t,e),xe(t)}function dt(t,e=globalThis.document,r=[]){let n=e.createElement("template");n.innerHTML=t??"";let o=me(e,n,r);for(let i of[...n.content.querySelectorAll("*")])ve(i,o);return n.content}var ft="data-tether-seen",D="data-tether-shown",k="data-tether-prev-display",ke=120;function nr(t,e){return Q(c.productPath||"/product",t,e)}function ht(t,e){try{return t()}catch(r){if(r instanceof RangeError)return e;throw r}}function or(t,e=c.locale){return t?ht(()=>new Intl.NumberFormat(e||void 0,{style:"percent",maximumFractionDigits:0}).format(t/100),`${t}%`):""}function ir(t){return t?c.formatMoney?c.formatMoney(t,c.locale):q(t,c.locale):""}function sr(t){return t?ht(()=>new Date(t).toLocaleDateString(c.locale||void 0),""):""}function ar(t,e){t.replaceChildren(dt(e,t.ownerDocument,c.embedOrigins))}var yt=t=>t.tagName==="INPUT"||t.tagName==="TEXTAREA",pt=t=>t.tagName==="INPUT";function Re(t,e){let r=e==null?"":String(e);yt(t)?t.value=r:t.textContent=r}var gt=t=>yt(t)?t.value:t.textContent;function ur(t,e){let r=gt(t);if(Re(t,e),r!==gt(t)&&t.hasAttribute(ft)&&c.onValueChange)try{c.onValueChange(t,r)}catch(n){b(n,"onValueChange")}t.setAttribute(ft,"1")}function Oe(t){if(t.hasAttribute(D))return;t.setAttribute(D,""),t.removeAttribute("hidden");let e=t.getAttribute(k);e!==null?(t.style.display=e,t.removeAttribute(k)):t.style.display==="none"&&(t.style.display=""),typeof getComputedStyle=="function"&&getComputedStyle(t).display==="none"&&(t.style.display=t.getAttribute(m("display"))||"block")}function cr(t,e){if(e){Oe(t);return}t.removeAttribute(D),!t.hasAttribute(k)&&t.style.display!=="none"&&t.setAttribute(k,t.style.display),t.style.display="none"}function lr(t,e){t.classList.toggle("is-selected",e),t.setAttribute("aria-pressed",e?"true":"false"),pt(t)&&(t.type==="radio"||t.type==="checkbox")&&(t.checked=e);let r=t.querySelector('input[type="radio"],input[type="checkbox"]');r&&pt(r)&&(r.checked=e)}var mt,Ce=t=>Reflect.get(window,t);function Le(){let t=Ce("ScrollTrigger");if(typeof t!="function")return;let e=Reflect.get(t,"refresh");typeof e=="function"&&Reflect.apply(e,t,[])}function Ne(t){clearTimeout(mt),mt=setTimeout(()=>{try{c.onLayoutChange?c.onLayoutChange(t):Le()}catch(e){b(e,"layout-changed")}M("layout-changed",{reason:t})},ke)}function dr(t,e){let r=[...t.querySelectorAll("img")].filter(i=>!i.complete),n=r.length,o=()=>{n-=1,n===0&&Ne(`${e}:images`)};r.forEach(i=>{i.addEventListener("load",o,{once:!0}),i.addEventListener("error",o,{once:!0})})}function fr(t,e){return t.getAttribute("aria-busy")==="true"?Promise.resolve(void 0):(t.setAttribute("aria-busy","true"),Promise.resolve().then(e).finally(()=>{t.removeAttribute("aria-busy")}))}function pr(t,e){let r=t?P(t,e):null;if(!r)return null;try{return JSON.parse(r)}catch{return S(`invalid JSON in ${m(e)}`,t),null}}function $(t){return t==null?"":typeof t=="string"?t:typeof t=="number"||typeof t=="boolean"?String(t):JSON.stringify(t)}function gr(t){return Array.isArray(t)?t.filter(E).map(r=>({key:$(r.key),value:$(r.value)})):E(t)?Object.entries(t).map(([e,r])=>({key:e,value:$(r)})):[]}function mr(t){return t?Array.isArray(t)?t.map(e=>({key:String(e.key),value:String(e.value??"")})):Object.entries(t).map(([e,r])=>({key:e,value:String(r??"")})):[]}export{g as a,v as b,He as c,$e as d,Tt as e,De as f,X as g,Fe as h,Mt as i,Ve as j,Ge as k,m as l,_t as m,P as n,Ut as o,Z as p,Ht as q,$t as r,Dt as s,M as t,nt as u,it as v,Vt as w,Gt as x,jt as y,Wt as z,nr as A,or as B,ir as C,sr as D,ar as E,Re as F,ur as G,cr as H,lr as I,Ce as J,Ne as K,dr as L,fr as M,pr as N,gr as O,mr as P};
|
|
1
|
+
import{A as j,E as q,F as Q,b as T,d as E,e as x,o as V,p as G,r as c,x as O,y as S,z as b}from"./chunk-OJAV2I3C.js";var g=class extends Error{constructor(r,{status:n,errors:o,userErrors:i,code:s}={}){super(r);T(this,"name","TetherError");T(this,"code");T(this,"status");T(this,"errors");T(this,"userErrors");this.code=s??(n?`HTTP_${n}`:"ERROR"),this.status=n,this.errors=o,this.userErrors=i}};function v(t,e){return typeof e=="function"?e(t):typeof e=="string"?e==="object"?E(t):typeof t===e:Et(e)?Array.isArray(t)&&t.every(r=>v(r,e[0])):E(t)&&Object.entries(e).every(([r,n])=>n===void 0||v(t[r],n))}var Et=t=>Array.isArray(t),He=t=>e=>e===null||v(e,t),$e=t=>e=>v(e,t);function Tt(t=c){return`https://${t.domain}/api/${t.apiVersion}/graphql.json`}var Y=/"(?:\\.|[^"\\\n])*"|#[^\n]*/g,bt=/^\s*(?:query|mutation)(?:\s+\w+)?\s*(?:\([^)]*\))?/;function wt(t){return/\bmutation\b/.test(t.replace(Y,""))?"mutation":"query"}function J(t,{country:e,language:r}){let n=[];if(e&&n.push(`country: ${e}`),r&&n.push(`language: ${r}`),!n.length)return t;let o=`@inContext(${n.join(", ")})`,i=t.replace(Y,p=>" ".repeat(p.length)),s=i.indexOf("{");if(i.slice(0,s).includes("@inContext"))return t;if(i.trimStart().startsWith("{"))return`query ${o} ${t.slice(s)}`;let a=bt.exec(i);if(!a)return t;let l=a[0].length;return`${t.slice(0,l).trimEnd()} ${o} ${t.slice(l).trimStart()}`}function De(t,e=c){let r=V(e.country)??void 0,n=G(e.language)??void 0;return J(t,{country:r,language:n})}var N=300,St=500,At=3e4,W=430,xt=1e3,L="quantityAvailable",B=new Set,vt=t=>`${t.domain} ${t.apiVersion} ${t.token}`;function kt(t,e,r,{context:n,operation:o}){let i=typeof e=="string"?e:e(r),s=n?J(i,t):i;return t.maxAge<=0||o==="mutation"?s:`${s} #${Math.floor(Date.now()/(t.maxAge*xt))}`}var Rt=t=>new Promise(e=>setTimeout(e,t));function I(t,e){if(t===401||t===403){let r=e.token.startsWith("shpat_")?", not an Admin API token (shpat_\u2026)":"";return`Shopify rejected the Storefront token for ${e.domain} (${t}): use the public Storefront API token (Headless channel)${r}`}return t===404?`Store or API version not found (404): check domain ${e.domain} and apiVersion ${e.apiVersion}`:`HTTP ${t} from ${e.domain}`}function Ot(t){let e=x(t,"message"),r=x(x(t,"extensions"),"code"),n=typeof e=="string"?e:"";return typeof r=="string"?{message:n,extensions:{code:r}}:{message:n}}function Ct(t){if(!E(t))return null;let{data:e,errors:r}=t;return r==null?{data:e}:Array.isArray(r)?{data:e,errors:r.map(Ot)}:null}function C(t,e){return t.ok?new g(`Invalid response (${t.status})`,{code:"INVALID_RESPONSE",status:t.status}):new g(I(t.status,e),{status:t.status})}function K(t,e,r,n){let o=e.map(s=>s.message).filter(Boolean).join(" | "),i=o||"Storefront API error";return t.ok||(i=t.status===401||t.status===403||!o?I(t.status,r):o),new g(i,{status:t.status,errors:e,code:n})}function z(t,e){if(e==="any")return{kind:"retry",backoffMs:N};throw new g(`Network error: ${j(t)}`,{code:"NETWORK"})}function Lt(t,e,r,n,o,i,s){if(r.includes(L)&&n.some(d=>d.message.includes(L)))return{kind:"inventory-refused",error:K(t,n,e)};let a=n.map(d=>d.extensions?.code);if(i!=="none"&&a.includes("THROTTLED"))return{kind:"retry",backoffMs:St};let l=a.includes("INTERNAL_SERVER_ERROR");if(i==="any"&&l)return{kind:"retry",backoffMs:N};let p=t.ok&&(l||s==="mutation"&&o==null);throw K(t,n,e,p?"SERVER_ERROR":void 0)}async function Nt(t,e){if(!t)return e(null);let r=new AbortController,n=setTimeout(()=>{r.abort(new DOMException("signal timed out","TimeoutError"))},t);try{return await e(r.signal)}finally{clearTimeout(n)}}async function It(t,e,r,n,o,i,s){let a;try{a=await(t.fetch??fetch)(Tt(t),{method:"POST",headers:{"Content-Type":"application/json","X-Shopify-Storefront-Access-Token":t.token},body:JSON.stringify({query:e,variables:r}),signal:s})}catch(f){return z(f,o)}if(a.status===W)throw new g("Shopify security rejection (430)",{status:W});if(o!=="none"&&a.status===429||o==="any"&&a.status>=500)return{kind:"retry",backoffMs:N};let l;try{l=await a.json()}catch(f){if(f instanceof SyntaxError)throw C(a,t);return z(f,o)}let p=Ct(l);if(!p)throw C(a,t);let{data:d,errors:h=[]}=p;if(h.length)return Lt(a,t,e,h,d,o,i);if(!a.ok)throw new g(I(a.status,t),{status:a.status});if(!n(d))throw C(a,t);return{kind:"data",data:d}}async function X(t,e,r,n,{context:o=!0,operation:i="query"}={}){if(!t.domain||!t.token)throw new g("Tether is not configured: domain and token are required",{code:"NOT_CONFIGURED"});let s=vt(t),a=i==="mutation"?"not-run":"any",l=0;for(;;){let p={inventory:!B.has(s)},d=kt(t,e,p,{context:o,operation:i}),h=l<t.retries?a:"none",f=await Nt(t.requestTimeout,w=>It(t,d,r,n,h,i,w));switch(f.kind){case"data":return f.data;case"inventory-refused":if(typeof e=="string"||!p.inventory)throw f.error;O(`the token can't read inventory: ${L} is left out from now on`),B.add(s);break;case"retry":await Rt(Math.min(f.backoffMs*2**l,At)),l+=1,O("retry",l);break}}}function Fe(t,e,r,n){return X(c,t,e,r,n)}var Pt=t=>typeof t=="object"&&t!==null;function Mt(t,e,r={},n){return X(t,e,r,Pt,{...n,operation:wt(e)})}function Ve(t,e,r){return Mt(c,t,e,r)}function Ge(t,e){if(!t)throw new g(`${e}: empty response`);let r=t.userErrors??[];if(r.length)throw new g(r.map(n=>n.message).join(" | "),{userErrors:r});return t}var m=t=>`${c.prefix}-${t}`,_t=(t,e)=>e===void 0?`[${m(t)}]`:`[${m(t)}="${e}"]`,P=(t,e)=>t.getAttribute(m(e)),Ut=(t,e)=>t.hasAttribute(m(e));function Z(t,e){return t?[...t.querySelectorAll(e)]:[]}var Ht=(t,e,r)=>Z(t,e).filter(n=>n.closest(r)===t),$t=["product-ready","list-ready","cart-updated","cart-toggled","checkout","search"],tt=new WeakMap;function et(t,e){let r=new CustomEvent(`${c.prefix}:${t}`,{detail:e,bubbles:!0});return tt.set(r,t),r}function Dt(t,e){return tt.get(t)===e}function M(t,e,r=document){r.dispatchEvent(et(t,e))}function nt(t,{width:e,height:r,crop:n}={}){if(!t)return t;let o;try{o=new URL(t)}catch(i){if(i instanceof TypeError)return t;throw i}return e&&o.searchParams.set("width",String(e)),r&&o.searchParams.set("height",String(r)),n&&o.searchParams.set("crop",n),o.toString()}function _(t,e){return t.getAttribute(e)??t.getAttribute(m(e))??t.getAttribute(`data-${e}`)}function ot(t,e){if(!t||!e)return t;let r=_(e,"max-width"),n=_(e,"max-height");return nt(t,{width:r,height:n,crop:r||n?_(e,"crop"):null})}var rt=t=>t.replace(/\?.*$/,"");function it(t,e){return!t||!e?!1:rt(t)===rt(e)}function Ft(t){return/^\s*[a-z][a-z0-9+.-]*:/i.test(t)&&!/^\s*(https?:|data:image\/)/i.test(t)?"none":`url("${t.replace(/["\\\n\r\f]/g,n=>`\\${n.charCodeAt(0).toString(16)} `)}")`}function Vt(t,e,r){if(!e)return;let n=ot(e,t);if(t.tagName!=="IMG"){t.style.backgroundImage=Ft(n);return}if(it(t.getAttribute("src"),n)){r!=null&&!t.getAttribute("alt")&&t.setAttribute("alt",r);return}t.removeAttribute("srcset"),t.removeAttribute("sizes"),t.setAttribute("src",n),r!=null&&t.setAttribute("alt",r),t.getAttribute("loading")||t.setAttribute("loading","lazy")}var U=new WeakMap,Gt=t=>!!U.get(t),H=t=>t.cloneNode(!0);function st(t){let e=U.get(t);if(e!==void 0)return e;let r=t.firstElementChild,n=r?H(r):null;return U.set(t,n),t.replaceChildren(),n}function jt(t,e,r){let n=st(t);if(!n){e.length&&S("repeater without a template child",t);return}t.replaceChildren(),e.forEach((o,i)=>{let s=H(n);r(s,o,i),t.appendChild(s)})}function qt(t,e){let r=()=>{t.remove()};if(!e){r();return}try{e(t,r)}catch(n){b(n,"repeater onLeave"),r()}}function Qt(t,e,r,n){e.forEach((o,i)=>{if(!r.has(o))return;let s=e[i-1];if(s?.parentNode===t?s.after(o):t.prepend(o),!!n)try{n(o)}catch(a){b(a,"repeater onEnter")}})}function Wt(t,e,r,n,{onEnter:o,onLeave:i}={}){let s=st(t);if(!s){S("repeater without a template child",t);return}let a=`data-${c.prefix}-key`,l=`data-${c.prefix}-leaving`,p=()=>[...t.children].filter(u=>u.hasAttribute(a)&&!u.hasAttribute(l)),d=new Map(p().map(u=>[u.getAttribute(a),u])),h=[],f=new Set;e.forEach((u,A)=>{let R=String(r(u,A)),y=d.get(R);y?d.delete(R):(y=H(s),y.setAttribute(a,R),f.add(y)),n(y,u,A,f.has(y)),h.push(y)});let w=h.filter(u=>!f.has(u)),F=p().filter(u=>w.includes(u));if(!(F.length===w.length&&F.every((u,A)=>u===w[A]))){d.forEach(u=>{u.remove()}),h.forEach(u=>t.appendChild(u));return}Qt(t,h,f,o),d.forEach(u=>{u.setAttribute(l,""),u.removeAttribute(a),u.style.pointerEvents="none",u.inert=!0,qt(u,i)})}var Bt="http://www.w3.org/1999/xhtml",Kt=new Set(["h1","h2","h3","h4","h5","h6","p","span","div","br","hr","blockquote","code","pre","strong","em","b","i","u","s","small","sub","sup","ul","ol","li","dl","dt","dd","table","caption","colgroup","col","thead","tbody","tfoot","tr","th","td","a","img","picture","source","video","figure","figcaption","iframe"]),zt=new Set(["script","style","template","noscript","textarea","select","title"]),Yt=new Set(["style","title","lang","dir","role","align","width","height"]),Jt=new Map([["a",new Set(["href","target","rel","hreflang"])],["img",new Set(["src","srcset","sizes","alt","loading","decoding"])],["source",new Set(["src","srcset","sizes","type","media"])],["video",new Set(["src","poster","controls","autoplay","muted","loop","playsinline","preload"])],["iframe",new Set(["src","allow","allowfullscreen","frameborder","loading"])],["blockquote",new Set(["cite"])],["ol",new Set(["start","type","reversed"])],["li",new Set(["value"])],["table",new Set(["border","cellpadding","cellspacing","summary"])],["col",new Set(["span"])],["colgroup",new Set(["span"])],["th",new Set(["colspan","rowspan","headers","scope","valign"])],["td",new Set(["colspan","rowspan","headers","valign"])]]),Xt=new Set(["href","src","poster","cite"]),Zt=/^(javascript|vbscript|data):/i,te=/^data:image\/(png|gif|jpeg|webp|avif);/i,ee=new Set(["position","top","right","bottom","left","z-index","-webkit-box-reflect"]),re=["inset","transform","translate","rotate","scale","offset"],ne=/\d(?:[sld]?v|cq)(?:w|h|i|b|min|max)\b/i,oe=/^(?:outline|box-shadow|text-shadow|filter|text-decoration|text-underline-offset|text-stroke)|^(?:border-image|mask-border|mask-box-image)(?:-outset)?$/,at=40,ie=new Map([["letter-spacing",{px:4,em:.25}],["word-spacing",{px:4,em:.25}],["text-indent",{px:at}]]),ut=/(?<![\w#.-])[+-]?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?(%|[a-z]+)?/gi,se=/(?<![\w-])(?!drop-shadow\(|blur\()[\w-]+\([^()]*\)/g,ct=/(?:var|calc|min|max|clamp|env|attr)\(/i,ae=/url\(|expression\(|@import/i,ue=/[\u0000- ]/g,ce="allow-scripts allow-same-origin allow-popups allow-presentation",le=new Set(["autoplay","encrypted-media","picture-in-picture","fullscreen","clipboard-write","accelerometer","gyroscope","web-share"]),de="strict-origin-when-cross-origin",fe=["https://www.youtube.com","https://www.youtube-nocookie.com","https://player.vimeo.com","https://www.loom.com","https://fast.wistia.net"];function pe(t,e){return Yt.has(e)||e.startsWith("aria-")||(Jt.get(t)?.has(e)??!1)}function ge(t,e,r){let n=r.replace(ue,"");return Zt.test(n)?t==="img"&&e==="src"&&te.test(n):!0}function lt(t,e){try{return new URL(t,e)}catch{return null}}function me(t,e,r){let n=t.baseURI,o=lt(n)?.origin??"null";return{origin:o==="null"?null:o,baseUrl:n,styleParser:e,embedOrigins:new Set([...fe,...r])}}function he(t,e){let r=lt(t.trim(),e.baseUrl);return r!==null&&r.origin!==e.origin&&e.embedOrigins.has(r.origin)}function ye(t){let e=t.split(";").map(r=>r.trim().split(/\s+/)[0]?.toLowerCase()??"");return[...new Set(e.filter(r=>le.has(r)))].join("; ")}function Ee(t,e){if(ee.has(t)||re.some(n=>t.startsWith(n))||ne.test(e))return!0;let r=ie.get(t);return r?ct.test(e)||Te(e,r):t.startsWith("margin")&&e.includes("-")}function Te(t,e){return[...t.matchAll(ut)].some(([r="",n=""])=>{let o=parseFloat(r);if(o>=0)return!1;let i=e[n.toLowerCase()];return i===void 0||-o>i})}function be(t,e){return oe.test(t.replace(/^-webkit-/,""))?ct.test(e)?!0:[...e.replace(se,"").matchAll(ut)].some(([r="",n=""])=>{let o=Math.abs(parseFloat(r));return o!==0&&(n.toLowerCase()!=="px"||o>at)}):!1}function we(t,e){let r=e.style;r.cssText=t;let n=Array.from({length:r.length},(i,s)=>r.item(s));for(let i of n){let s=r.getPropertyValue(i);(Ee(i,s)||be(i,s)||ae.test(s))&&r.removeProperty(i)}let o=r.cssText;return e.removeAttribute("style"),o}function Se(t,e){let r=t.localName;for(let i of[...t.attributes]){let s=i.name.toLowerCase(),a=Xt.has(s);pe(r,s)&&(!a||ge(r,s,i.value))||t.removeAttribute(i.name)}let n=t.getAttribute("style");if(n===null)return;let o=we(n,e.styleParser);o===""?t.removeAttribute("style"):t.setAttribute("style",o)}var Ae=new Set(["","_self","_parent","_top"]);function xe(t){if(t.localName==="iframe"){let n=ye(t.getAttribute("allow")??"");n===""?t.removeAttribute("allow"):t.setAttribute("allow",n),t.setAttribute("sandbox",ce),t.setAttribute("referrerpolicy",de);return}if(t.localName!=="a")return;let e=t.getAttribute("target");if(e===null||Ae.has(e.toLowerCase()))return;let r=new Set((t.getAttribute("rel")??"").split(/\s+/).filter(Boolean));r.add("noopener"),r.add("noreferrer"),t.setAttribute("rel",[...r].join(" "))}function ve(t,e){let r=t.localName,n=t.namespaceURI===Bt;if(n&&zt.has(r)){t.remove();return}if(!n||!Kt.has(r)){t.replaceWith(...t.childNodes);return}if(r==="iframe"&&!he(t.getAttribute("src")??"",e)){t.remove();return}Se(t,e),xe(t)}function dt(t,e=globalThis.document,r=[]){let n=e.createElement("template");n.innerHTML=t??"";let o=me(e,n,r);for(let i of[...n.content.querySelectorAll("*")])ve(i,o);return n.content}var ft="data-tether-seen",D="data-tether-shown",k="data-tether-prev-display",ke=120;function nr(t,e){return Q(c.productPath||"/product",t,e)}function ht(t,e){try{return t()}catch(r){if(r instanceof RangeError)return e;throw r}}function or(t,e=c.locale){return t?ht(()=>new Intl.NumberFormat(e||void 0,{style:"percent",maximumFractionDigits:0}).format(t/100),`${t}%`):""}function ir(t){return t?c.formatMoney?c.formatMoney(t,c.locale):q(t,c.locale):""}function sr(t){return t?ht(()=>new Date(t).toLocaleDateString(c.locale||void 0),""):""}function ar(t,e){t.replaceChildren(dt(e,t.ownerDocument,c.embedOrigins))}var yt=t=>t.tagName==="INPUT"||t.tagName==="TEXTAREA",pt=t=>t.tagName==="INPUT";function Re(t,e){let r=e==null?"":String(e);yt(t)?t.value=r:t.textContent=r}var gt=t=>yt(t)?t.value:t.textContent;function ur(t,e){let r=gt(t);if(Re(t,e),r!==gt(t)&&t.hasAttribute(ft)&&c.onValueChange)try{c.onValueChange(t,r)}catch(n){b(n,"onValueChange")}t.setAttribute(ft,"1")}function Oe(t){if(t.hasAttribute(D))return;t.setAttribute(D,""),t.removeAttribute("hidden");let e=t.getAttribute(k);e!==null?(t.style.display=e,t.removeAttribute(k)):t.style.display==="none"&&(t.style.display=""),typeof getComputedStyle=="function"&&getComputedStyle(t).display==="none"&&(t.style.display=t.getAttribute(m("display"))||"block")}function cr(t,e){if(e){Oe(t);return}t.removeAttribute(D),!t.hasAttribute(k)&&t.style.display!=="none"&&t.setAttribute(k,t.style.display),t.style.display="none"}function lr(t,e){t.classList.toggle("is-selected",e),t.setAttribute("aria-pressed",e?"true":"false"),pt(t)&&(t.type==="radio"||t.type==="checkbox")&&(t.checked=e);let r=t.querySelector('input[type="radio"],input[type="checkbox"]');r&&pt(r)&&(r.checked=e)}var mt,Ce=t=>Reflect.get(window,t);function Le(){let t=Ce("ScrollTrigger");if(typeof t!="function")return;let e=Reflect.get(t,"refresh");typeof e=="function"&&Reflect.apply(e,t,[])}function Ne(t){clearTimeout(mt),mt=setTimeout(()=>{try{c.onLayoutChange?c.onLayoutChange(t):Le()}catch(e){b(e,"layout-changed")}M("layout-changed",{reason:t})},ke)}function dr(t,e){let r=[...t.querySelectorAll("img")].filter(i=>!i.complete),n=r.length,o=()=>{n-=1,n===0&&Ne(`${e}:images`)};r.forEach(i=>{i.addEventListener("load",o,{once:!0}),i.addEventListener("error",o,{once:!0})})}function fr(t,e){return t.getAttribute("aria-busy")==="true"?Promise.resolve(void 0):(t.setAttribute("aria-busy","true"),Promise.resolve().then(e).finally(()=>{t.removeAttribute("aria-busy")}))}function pr(t,e){let r=t?P(t,e):null;if(!r)return null;try{return JSON.parse(r)}catch{return S(`invalid JSON in ${m(e)}`,t),null}}function $(t){return t==null?"":typeof t=="string"?t:typeof t=="number"||typeof t=="boolean"?String(t):JSON.stringify(t)}function gr(t){return Array.isArray(t)?t.filter(E).map(r=>({key:$(r.key),value:$(r.value)})):E(t)?Object.entries(t).map(([e,r])=>({key:e,value:$(r)})):[]}function mr(t){return t?Array.isArray(t)?t.map(e=>({key:String(e.key),value:String(e.value??"")})):Object.entries(t).map(([e,r])=>({key:e,value:String(r??"")})):[]}export{g as a,v as b,He as c,$e as d,Tt as e,De as f,X as g,Fe as h,Mt as i,Ve as j,Ge as k,m as l,_t as m,P as n,Ut as o,Z as p,Ht as q,$t as r,Dt as s,M as t,nt as u,it as v,Vt as w,Gt as x,jt as y,Wt as z,nr as A,or as B,ir as C,sr as D,ar as E,Re as F,ur as G,cr as H,lr as I,Ce as J,Ne as K,dr as L,fr as M,pr as N,gr as O,mr as P};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as m,f as p}from"./chunk-
|
|
1
|
+
import{e as m,f as p}from"./chunk-7ZXEVDOS.js";import{a as M}from"./chunk-CRKJ2VEX.js";import{m as k,o as i,p as g,r as u,u as y}from"./chunk-OJAV2I3C.js";var S="tether_country",C=()=>`${u.prefix}:market:${u.domain}`,w={getItem:e=>m(e)};function b(){let e=typeof window<"u";return{document:typeof document<"u"?document:null,location:e?window.location:null,storage:w,global:e?window:{}}}function E(e){try{return JSON.parse(e)}catch(t){if(t instanceof SyntaxError)return null;throw t}}function L(e){if(typeof e!="object"||e===null)return null;let t=i(Reflect.get(e,"country"));if(!t)return null;let n=Reflect.get(e,"locale");return{country:t,language:g(Reflect.get(e,"language"))??void 0,locale:typeof n=="string"&&n?n:void 0}}var h=e=>L(E(e));function x(e=w){let t=e.getItem(C());return t?h(t):null}function R(e,t){if(!e||!t)return null;let n=e.cookie.split(";").map(r=>r.trim()).find(r=>r.startsWith(`${t}=`));return n?M(n.slice(t.length+1)):null}function s(e,t){if(!e||!t)return null;let n=t.toLowerCase(),r=Object.keys(e).find(o=>o.toLowerCase()===n);return r?e[r]??null:null}function v(e,t){let n=a=>t.document?.querySelector(`meta[name="${a}"]`)?.getAttribute("content"),r=Reflect.get(t.global,"TETHER_COUNTRY"),o=Reflect.get(t.global,"TETHER_LANGUAGE"),l=n("tether-country")||R(t.document,e.cookie||S);return{country:r||l,language:o||n("tether-language")}}function N(e,t){let n=(t.location?.pathname??"/").split("/").find(c=>c!==""),r=s(e.locales,n);if(r)return r;let o=t.document?.documentElement.getAttribute("lang");if(!o)return null;let l=s(e.locales,o)??s(e.locales,o.split("-")[0]);if(l)return{locale:o,...l};if(e.locales&&e.strict)return null;let a=o.split("-")[1];return{language:o,country:a?.length===2?a:null,locale:o}}function O(e,t,n){switch(e){case"saved":return t.remember===!1?null:x(n.storage);case"server":return v(t,n);case"webflow":return N(t,n)}}function H(e){return e?e===!0?k:e:["saved"]}function I(e=u.markets,t=b()){let n=(e===u.markets?e:y(e))??{};if(n.detect===!1)return{};let r={},o={sources:r};for(let l of H(n.detect)){let a=O(l,n,t);if(!a)continue;let c=i(a.country),d=g(a.language),f=typeof a.locale=="string"&&a.locale?a.locale:null;c&&!o.country&&(o.country=c,r.country=l),d&&!o.language&&(o.language=d,r.language=l),f&&!o.locale&&(o.locale=f,r.locale=l)}return o}function _(e){if(u.markets?.remember===!1)return;let t={country:e.country,language:e.language||void 0,locale:e.locale||void 0};p(C(),JSON.stringify(t))}export{C as a,h as b,x as c,I as d,_ as e};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var w=Object.defineProperty;var G=(n,e,t)=>e in n?w(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var Fn=(n,e)=>{for(var t in e)w(n,t,{get:e[t],enumerable:!0})};var $n=(n,e,t)=>G(n,typeof e!="symbol"?e+"":e,t);var z=/^(\d{4})-(01|04|07|10)$/;function T(n){let e=z.exec(typeof n=="string"?n:"");return e?{year:Number(e[1]),month:Number(e[2])}:null}var S=n=>T(n)!==null,j=(n,e)=>`${n}-${String(e).padStart(2,"0")}`;function A(n,e=1){let t=T(n);if(!t)throw new Error(`not a quarterly Shopify API version: ${n}`);let o=t.year*4+(t.month-1)/3+e;return j(Math.floor(o/4),o%4*3+1)}function Dn(n,e=new Date){if(n==="unstable")return{version:n,ok:!1,note:'"unstable" changes without notice: pin a dated version such as 2026-07'};let t=T(n);if(!t)return{version:n,ok:!1,note:"not a quarterly version (YYYY-01, -04, -07 or -10)"};let o=new Date(Date.UTC(t.year,t.month-1,1)),r=new Date(Date.UTC(t.year,t.month-1+12,1)),i=(r.getTime()-e.getTime())/2630016e3,f=o<=e,u=`supported until about ${r.toISOString().slice(0,7)}`;return f?i<=0?u="no longer supported: Shopify falls back to the oldest supported version. Upgrade (see docs/reference.md)":i<3&&(u=`${u}: plan the upgrade to ${A(n)} or later (see docs/reference.md)`):u="not released yet (release candidate at best)",{version:n,ok:f&&i>0,monthsLeft:Math.round(i),next:A(n),note:u}}function O(n){return n!==null&&typeof n=="object"&&!Array.isArray(n)}function v(n,e){return O(n)?n[e]:void 0}function Q(n){return Array.isArray(n)?n:[]}function Z(n){return typeof n=="string"&&n!==""?n:null}var B=n=>typeof n=="number"&&Number.isFinite(n)?n:null,Kn=n=>B(n)??0,x=(n,e)=>Q(n).map(t=>e(t)),Yn=(n,e)=>({nodes:x(v(n,"nodes"),e)}),Gn=n=>x(n,Z).filter(e=>e!==null);var q=/^[A-Z]{2}$/,W=new Set(["XX","T1"]),X=new Set(["PT_BR","PT_PT","ZH_CN","ZH_TW"]),J=/^[A-Z]{2,3}$/;function k(n){let e=(typeof n=="string"?n:"").trim().toUpperCase();return!q.test(e)||W.has(e)?null:e}function h(n){let e=(typeof n=="string"?n:"").trim().replace("-","_").toUpperCase();if(X.has(e))return e;let t=e.split("_")[0]??"";return J.test(t)?t:null}var E="2026-07";var nn=/^[A-Za-z0-9_.-]+$/,en=/^(\$app(:[A-Za-z0-9_-]+)?|[A-Za-z0-9_.-]+)$/,tn=/^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i,on=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,rn=/^[A-Za-z_$][\w$]*$/,R="https://site.invalid",sn=new Set(["localhost","127.0.0.1","[::1]"]),N=["saved","server","webflow"],an=["no-banner","default-banner","custom-banner"],y=n=>typeof n=="string"&&n!=="",un=n=>typeof n=="function";function M(n,e){if(typeof n!="string"||!n)return"";let t=n.replace(/^https?:\/\//,"").replace(/\/.*$/,"");return dn(t)?t:(e("domain",n),"")}function P(n){if(!y(n))return!1;try{let e=new URL(n,`${R}/`);return e.origin===R?!0:e.protocol==="https:"||e.protocol==="http:"&&sn.has(e.hostname)}catch{return!1}}function I(n,e){return n==null||n===""?null:typeof n=="string"&&(P(n)||cn(n))?n:(e("partsUrl",n),null)}function cn(n){if(typeof location>"u")return!1;try{return new URL(n).origin===location.origin}catch{return!1}}function ln(n){if(typeof n!="string")return null;try{let e=new URL(n);return e.protocol==="https:"&&e.href===new URL(e.origin).href?e.origin:null}catch{return null}}function L(n,e){if(!Array.isArray(n))return e("embedOrigins",n),[];let t=[],o=n;for(let r of o){let i=ln(r);i?t.push(i):e("embedOrigin",r)}return t}function fn(n){let e,t;if(typeof n=="string"){let o=n.indexOf(".");e=o>0?n.slice(0,o):"",t=n.slice(o+1)}else typeof n=="object"&&n!==null&&(e=Reflect.get(n,"namespace"),t=Reflect.get(n,"key"));return typeof e!="string"||typeof t!="string"?null:en.test(e)&&nn.test(t)?{namespace:e,key:t}:null}function U(n,e){if(!Array.isArray(n))return e("metafields",n),[];let t=[],o=n;for(let r of o){let i=fn(r);i?t.push(typeof r=="string"?r:i):e("metafield",r)}return t}var d=n=>e=>n(e)?e:void 0,dn=n=>y(n)&&tn.test(n),pn=n=>y(n)&&on.test(n),gn=n=>typeof n=="boolean"||y(n)&&rn.test(n),g=d(P),C=d(y),_=d(n=>typeof n=="boolean"),F=d(un);function m(n,e,t,o){if(e==null)return null;if(!O(e))return o(n,e),null;let r={};for(let i in t){let f=e[i];if(f===void 0)continue;let u=t[i](f);u===void 0?o(`${n}.${i}`,f):r[i]=u}return r}var yn={server:g,orderUrl:g,subscriptionsUrl:g,paymentUrl:g,logoutUrl:g,locale:C,navigate:F},mn="customer accounts need the Worker since 0.7.0: set account.server",On={country:C,language:C,locale:C},Cn={detect:n=>{if(typeof n=="boolean")return n;let e=Array.isArray(n)?n:[n];return typeof n=="string"||Array.isArray(n)?N.filter(t=>e.includes(t)):void 0},locales:n=>{if(!O(n))return;let e={};for(let[t,o]of Object.entries(n)){let r=m(`markets.locales.${t}`,o,On,()=>{});r&&(e[t]=r)}return e},cookie:d(pn),remember:_,strict:_},Tn={consent:n=>an.find(e=>e===n),proxy:n=>n!==void 0&&!!n},kn={dataLayer:d(gn),shopify:n=>typeof n=="boolean"?n:m("analytics.shopify",n,Tn,()=>{})??void 0,onEvent:F};function $(n,e,t){let o=m("account",n,yn,e);if(o===null)return null;let{server:r}=o;return r===void 0?(t(mn),null):{...o,server:r}}var b=(n,e)=>m("markets",n,Cn,e),V=(n,e)=>m("analytics",n,kn,e);var c={domain:"",token:"",apiVersion:E,country:void 0,language:void 0,locale:void 0,markets:null,prefix:"tether",productPath:"/product",collectionPath:"/collection",metafields:[],embedOrigins:[],imagesFirst:25,variantsFirst:100,sellingPlanGroupsFirst:10,sellingPlansFirst:25,collectionFirst:24,retries:2,requestTimeout:15e3,revalidate:!0,storageKey:"",cartDrawerOpenClass:"is-open",openCartOnAdd:!0,cartFocus:!0,checkoutTarget:"_self",defaultPurchase:"one-time",variantUrl:!1,maxAge:60,lowStock:5,searchDelay:150,autoMount:!0,observe:!1,astro:!0,partsUrl:null,analytics:null,account:null,warningText:null,formatMoney:null,onLayoutChange:null,onCartOpen:null,onCartClose:null,onLineEnter:null,onLineLeave:null,onValueChange:null,onError:null,debug:!1},a={...c};function Y(n){let e=t=>(l(`Tether.config is read-only (${String(t)}): pass options to Tether.init() instead`),!1);return new Proxy(n,{get(t,o){let r=Reflect.get(t,o);return typeof r=="object"&&r!==null?Y(r):r},set:(t,o)=>e(o),deleteProperty:(t,o)=>e(o),defineProperty:(t,o)=>e(o)})}var ee=Y(a),hn=/^[a-z][a-z0-9-]*$/,bn=["revalidate","openCartOnAdd","cartFocus","variantUrl","autoMount","observe","astro","debug"],wn=["token","productPath","collectionPath","cartDrawerOpenClass"],An=["imagesFirst","variantsFirst","sellingPlanGroupsFirst","sellingPlansFirst","collectionFirst","retries","requestTimeout","maxAge","lowStock","searchDelay"],Sn=["warningText","formatMoney","onLayoutChange","onCartOpen","onCartClose","onLineEnter","onLineLeave","onValueChange","onError"];function p(n,e,t){return e!==void 0&&l(`invalid ${n} ${JSON.stringify(e)}: using ${JSON.stringify(t)}`),t}function s(n,e){l(`invalid ${n} ${JSON.stringify(e)}: ignored`)}function xn(n){for(let e of Object.keys(n))e in c||l(`unknown option ${JSON.stringify(e)}: ignored`)}function En(n,e,t){typeof t=="function"?n[e]=t:t!=null&&s(e,t)}var D=2147483647,Rn=10,_n={requestTimeout:D,searchDelay:D,retries:Rn};function Nn(n,e){let t=_n[n]??Number.POSITIVE_INFINITY;return typeof e=="number"&&Number.isInteger(e)&&e>=0&&e<=t?e:p(n,e,c[n])}function Mn(n,e){return typeof e=="boolean"?e:p(n,e,c[n])}function Pn(n,e){return typeof e=="string"?e:p(n,e,c[n])}function In(n){if(!(n==null||n==="")){try{if(typeof n=="string"&&Intl.getCanonicalLocales(n).length)return n}catch{}s("locale",n)}}function H(n,e,t){return t.find(o=>o===e)??p(n,e,t[0])}function Ln(n){return n==="unstable"?(l('apiVersion "unstable" changes without notice. Pin a dated version (e.g. 2026-07).'),n):S(n)?n:p("apiVersion",n,c.apiVersion)}function K(n,e,t){if(e==null||e==="")return;let o=t(e);if(o!==null)return o;s(n,e)}function Un(n){xn(n);let e=M(n.domain,s),t=typeof n.prefix=="string"&&hn.test(n.prefix)?n.prefix:p("prefix",n.prefix,c.prefix),o={...c,domain:e,apiVersion:Ln(n.apiVersion),country:K("country",n.country,k),locale:In(n.locale),partsUrl:I(n.partsUrl,s),language:K("language",n.language,h),markets:b(n.markets,s),analytics:V(n.analytics,s),account:$(n.account,s,l),prefix:t,storageKey:typeof n.storageKey=="string"&&n.storageKey?n.storageKey:`${t}:cart:${e}`,metafields:U(n.metafields??[],s),embedOrigins:L(n.embedOrigins??[],s),checkoutTarget:H("checkoutTarget",n.checkoutTarget,["_self","_blank"]),defaultPurchase:H("defaultPurchase",n.defaultPurchase,["one-time","subscription"])};for(let r of An)o[r]=Nn(r,n[r]);for(let r of bn)o[r]=Mn(r,n[r]);for(let r of wn)o[r]=Pn(r,n[r]);for(let r of Sn)En(o,r,n[r]);return o}var te=n=>b(n,s);function oe(n={}){let e=Un(n);for(let t of Object.keys(a))t in e||Reflect.deleteProperty(a,t);return Object.assign(a,e)}var re=()=>!!(a.domain&&a.token);function ie(...n){a.debug&&console.log(`[${a.prefix}]`,...n)}function l(...n){console.warn(`[${a.prefix}]`,...n)}function se(n,e){if(l(e,n instanceof Error&&n.message?n.message:n),!!a.onError)try{a.onError(n,e)}catch(t){l("onError threw",t)}}function ce(n){return n instanceof Error?n.message:String(n)}var fe={domain:["PUBLIC_SHOPIFY_DOMAIN","PUBLIC_SHOPIFY_STORE_DOMAIN","SHOPIFY_DOMAIN"],token:["PUBLIC_SHOPIFY_STOREFRONT_TOKEN","PUBLIC_SHOPIFY_STOREFRONT_ACCESS_TOKEN","SHOPIFY_STOREFRONT_TOKEN"]};function de(n){if(typeof n!="string")return!1;try{return new URL(n).protocol==="https:"}catch{return!1}}function pe(n){return/^shp[a-z]{2}_/.test(n.trim())}function ge(n,e){if(!n)return"";let t=parseFloat(n.amount);if(Number.isNaN(t))return"";try{return new Intl.NumberFormat(e||void 0,{style:"currency",currency:n.currencyCode}).format(t)}catch{return`${n.currencyCode} ${t.toFixed(2)}`}}function ye(n,e,t){if(!/\{(handle|id)\}/.test(n))return e?`${n.replace(/\/$/,"")}/${encodeURIComponent(e)}`:null;let o=t?t.split("/").at(-1)??"":"";return n.includes("{handle}")&&!e||n.includes("{id}")&&!o?null:n.replace(/\{handle\}/g,encodeURIComponent(e??"")).replace(/\{id\}/g,encodeURIComponent(o))}function me(n){let e=String(n??"").trim();return e?e.startsWith("gid://")?e:/^\d+$/.test(e)?`gid://shopify/Product/${e}`:/\/products\/([^/?#]+)/.exec(e)?.[1]??e:null}export{Fn as a,$n as b,Dn as c,O as d,v as e,Q as f,Z as g,B as h,Kn as i,x as j,Yn as k,Gn as l,N as m,fn as n,k as o,h as p,c as q,a as r,ee as s,Un as t,te as u,oe as v,re as w,ie as x,l as y,se as z,ce as A,fe as B,de as C,pe as D,ge as E,ye as F,me as G};
|
|
1
|
+
var w=Object.defineProperty;var G=(n,e,t)=>e in n?w(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var Fn=(n,e)=>{for(var t in e)w(n,t,{get:e[t],enumerable:!0})};var $n=(n,e,t)=>G(n,typeof e!="symbol"?e+"":e,t);var z=/^(\d{4})-(01|04|07|10)$/;function k(n){let e=z.exec(typeof n=="string"?n:"");return e?{year:Number(e[1]),month:Number(e[2])}:null}var S=n=>k(n)!==null,j=(n,e)=>`${n}-${String(e).padStart(2,"0")}`;function A(n,e=1){let t=k(n);if(!t)throw new Error(`not a quarterly Shopify API version: ${n}`);let o=t.year*4+(t.month-1)/3+e;return j(Math.floor(o/4),o%4*3+1)}function Dn(n,e=new Date){if(n==="unstable")return{version:n,ok:!1,note:'"unstable" changes without notice: pin a dated version such as 2026-07'};let t=k(n);if(!t)return{version:n,ok:!1,note:"not a quarterly version (YYYY-01, -04, -07 or -10)"};let o=new Date(Date.UTC(t.year,t.month-1,1)),r=new Date(Date.UTC(t.year,t.month-1+12,1)),i=(r.getTime()-e.getTime())/2630016e3,f=o<=e,c=`supported until about ${r.toISOString().slice(0,7)}`;return f?i<=0?c="no longer supported: Shopify falls back to the oldest supported version. Upgrade (see docs/reference.md)":i<3&&(c=`${c}: plan the upgrade to ${A(n)} or later (see docs/reference.md)`):c="not released yet (release candidate at best)",{version:n,ok:f&&i>0,monthsLeft:Math.round(i),next:A(n),note:c}}function O(n){return n!==null&&typeof n=="object"&&!Array.isArray(n)}function v(n,e){return O(n)?n[e]:void 0}function Q(n){return Array.isArray(n)?n:[]}function Z(n){return typeof n=="string"&&n!==""?n:null}var B=n=>typeof n=="number"&&Number.isFinite(n)?n:null,Kn=n=>B(n)??0,x=(n,e)=>Q(n).map(t=>e(t)),Yn=(n,e)=>({nodes:x(v(n,"nodes"),e)}),Gn=n=>x(n,Z).filter(e=>e!==null);var q=/^[A-Z]{2}$/,W=new Set(["XX","T1"]),X=new Set(["PT_BR","PT_PT","ZH_CN","ZH_TW"]),J=/^[A-Z]{2,3}$/;function T(n){let e=(typeof n=="string"?n:"").trim().toUpperCase();return!q.test(e)||W.has(e)?null:e}function h(n){let e=(typeof n=="string"?n:"").trim().replace("-","_").toUpperCase();if(X.has(e))return e;let t=e.split("_")[0]??"";return J.test(t)?t:null}var E="2026-07";var nn=/^[A-Za-z0-9_.-]+$/,en=/^(\$app(:[A-Za-z0-9_-]+)?|[A-Za-z0-9_.-]+)$/,tn=/^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i,on=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,rn=/^[A-Za-z_$][\w$]*$/,R="https://site.invalid",sn=new Set(["localhost","127.0.0.1","[::1]"]),N=["saved","server","webflow"],an=["no-banner","default-banner","custom-banner"],y=n=>typeof n=="string"&&n!=="",un=n=>typeof n=="function";function M(n,e){if(typeof n!="string"||!n)return"";let t=n.replace(/^https?:\/\//,"").replace(/\/.*$/,"");return dn(t)?t:(e("domain",n),"")}function P(n){if(!y(n))return!1;try{let e=new URL(n,`${R}/`);return e.origin===R?!0:e.protocol==="https:"||e.protocol==="http:"&&sn.has(e.hostname)}catch{return!1}}function L(n,e){return n==null||n===""?null:typeof n=="string"&&(P(n)||cn(n))?n:(e("partsUrl",n),null)}function cn(n){if(typeof location>"u")return!1;try{return new URL(n).origin===location.origin}catch{return!1}}function ln(n){if(typeof n!="string")return null;try{let e=new URL(n);return e.protocol==="https:"&&e.href===new URL(e.origin).href?e.origin:null}catch{return null}}function I(n,e){if(!Array.isArray(n))return e("embedOrigins",n),[];let t=[],o=n;for(let r of o){let i=ln(r);i?t.push(i):e("embedOrigin",r)}return t}function fn(n){let e,t;if(typeof n=="string"){let o=n.indexOf(".");e=o>0?n.slice(0,o):"",t=n.slice(o+1)}else typeof n=="object"&&n!==null&&(e=Reflect.get(n,"namespace"),t=Reflect.get(n,"key"));return typeof e!="string"||typeof t!="string"?null:en.test(e)&&nn.test(t)?{namespace:e,key:t}:null}function U(n,e){if(!Array.isArray(n))return e("metafields",n),[];let t=[],o=n;for(let r of o){let i=fn(r);i?t.push(typeof r=="string"?r:i):e("metafield",r)}return t}var d=n=>e=>n(e)?e:void 0,dn=n=>y(n)&&tn.test(n),pn=n=>y(n)&&on.test(n),gn=n=>typeof n=="boolean"||y(n)&&rn.test(n),g=d(P),C=d(y),_=d(n=>typeof n=="boolean"),F=d(un);function m(n,e,t,o){if(e==null)return null;if(!O(e))return o(n,e),null;let r={};for(let i in t){let f=e[i];if(f===void 0)continue;let c=t[i](f);c===void 0?o(`${n}.${i}`,f):r[i]=c}return r}var yn={server:g,orderUrl:g,subscriptionsUrl:g,paymentUrl:g,logoutUrl:g,locale:C,navigate:F},mn="customer accounts need the Worker since 0.7.0: set account.server",On={country:C,language:C,locale:C},Cn={detect:n=>{if(typeof n=="boolean")return n;let e=Array.isArray(n)?n:[n];return typeof n=="string"||Array.isArray(n)?N.filter(t=>e.includes(t)):void 0},locales:n=>{if(!O(n))return;let e={};for(let[t,o]of Object.entries(n)){let r=m(`markets.locales.${t}`,o,On,()=>{});r&&(e[t]=r)}return e},cookie:d(pn),remember:_,strict:_},kn={consent:n=>an.find(e=>e===n),proxy:n=>n!==void 0&&!!n},Tn={dataLayer:d(gn),shopify:n=>typeof n=="boolean"?n:m("analytics.shopify",n,kn,()=>{})??void 0,onEvent:F};function $(n,e,t){let o=m("account",n,yn,e);if(o===null)return null;let{server:r}=o;return r===void 0?(t(mn),null):{...o,server:r}}var b=(n,e)=>m("markets",n,Cn,e),V=(n,e)=>m("analytics",n,Tn,e);var l={domain:"",token:"",apiVersion:E,country:void 0,language:void 0,locale:void 0,markets:null,prefix:"tether",productPath:"/product",collectionPath:"/collection",metafields:[],embedOrigins:[],imagesFirst:25,variantsFirst:100,sellingPlanGroupsFirst:10,sellingPlansFirst:25,collectionFirst:24,retries:2,requestTimeout:15e3,revalidate:!0,storageKey:"",cartDrawerOpenClass:"is-open",openCartOnAdd:!0,cartFocus:!0,checkoutTarget:"_self",defaultPurchase:"one-time",variantUrl:!1,maxAge:60,lowStock:5,searchDelay:150,autoMount:!0,observe:!1,astro:!0,partsUrl:null,analytics:null,account:null,warningText:null,formatMoney:null,onLayoutChange:null,onCartOpen:null,onCartClose:null,onLineEnter:null,onLineLeave:null,onValueChange:null,onError:null,debug:!1},a={...l};function Y(n){let e=t=>(u(`Tether.config is read-only (${String(t)}): pass options to Tether.init() instead`),!1);return new Proxy(n,{get(t,o){let r=Reflect.get(t,o);return typeof r=="object"&&r!==null?Y(r):r},set:(t,o)=>e(o),deleteProperty:(t,o)=>e(o),defineProperty:(t,o)=>e(o)})}var ee=Y(a),hn=/^[a-z][a-z0-9-]*$/,bn=["revalidate","openCartOnAdd","cartFocus","variantUrl","autoMount","observe","astro","debug"],wn=["token","productPath","collectionPath","cartDrawerOpenClass"],An=["imagesFirst","variantsFirst","sellingPlanGroupsFirst","sellingPlansFirst","collectionFirst","retries","requestTimeout","maxAge","lowStock","searchDelay"],Sn=["warningText","formatMoney","onLayoutChange","onCartOpen","onCartClose","onLineEnter","onLineLeave","onValueChange","onError"];function p(n,e,t){return e!==void 0&&u(`invalid ${n} ${JSON.stringify(e)}: using ${JSON.stringify(t)}`),t}function s(n,e){u(`invalid ${n} ${JSON.stringify(e)}: ignored`)}function xn(n){for(let e of Object.keys(n))e in l||u(`unknown option ${JSON.stringify(e)}: ignored`)}function En(n,e,t){typeof t=="function"?n[e]=t:t!=null&&s(e,t)}var D=2147483647,Rn=10,_n={requestTimeout:D,searchDelay:D,retries:Rn};function Nn(n,e){if(typeof e!="number"||!Number.isInteger(e)||e<0)return p(n,e,l[n]);let t=_n[n];return t===void 0||e<=t?e:(u(`${n} ${String(e)} is more than its maximum: using ${String(t)}`),t)}function Mn(n,e){return typeof e=="boolean"?e:p(n,e,l[n])}function Pn(n,e){return typeof e=="string"?e:p(n,e,l[n])}function Ln(n){if(!(n==null||n==="")){try{if(typeof n=="string"&&Intl.getCanonicalLocales(n).length)return n}catch{}s("locale",n)}}function H(n,e,t){return t.find(o=>o===e)??p(n,e,t[0])}function In(n){return n==="unstable"?(u('apiVersion "unstable" changes without notice. Pin a dated version (e.g. 2026-07).'),n):S(n)?n:p("apiVersion",n,l.apiVersion)}function K(n,e,t){if(e==null||e==="")return;let o=t(e);if(o!==null)return o;s(n,e)}function Un(n){xn(n);let e=M(n.domain,s),t=typeof n.prefix=="string"&&hn.test(n.prefix)?n.prefix:p("prefix",n.prefix,l.prefix),o={...l,domain:e,apiVersion:In(n.apiVersion),country:K("country",n.country,T),locale:Ln(n.locale),partsUrl:L(n.partsUrl,s),language:K("language",n.language,h),markets:b(n.markets,s),analytics:V(n.analytics,s),account:$(n.account,s,u),prefix:t,storageKey:typeof n.storageKey=="string"&&n.storageKey?n.storageKey:`${t}:cart:${e}`,metafields:U(n.metafields??[],s),embedOrigins:I(n.embedOrigins??[],s),checkoutTarget:H("checkoutTarget",n.checkoutTarget,["_self","_blank"]),defaultPurchase:H("defaultPurchase",n.defaultPurchase,["one-time","subscription"])};for(let r of An)o[r]=Nn(r,n[r]);for(let r of bn)o[r]=Mn(r,n[r]);for(let r of wn)o[r]=Pn(r,n[r]);for(let r of Sn)En(o,r,n[r]);return o}var te=n=>b(n,s);function oe(n={}){let e=Un(n);for(let t of Object.keys(a))t in e||Reflect.deleteProperty(a,t);return Object.assign(a,e)}var re=()=>!!(a.domain&&a.token);function ie(...n){a.debug&&console.log(`[${a.prefix}]`,...n)}function u(...n){console.warn(`[${a.prefix}]`,...n)}function se(n,e){if(u(e,n instanceof Error&&n.message?n.message:n),!!a.onError)try{a.onError(n,e)}catch(t){u("onError threw",t)}}function ce(n){return n instanceof Error?n.message:String(n)}var fe={domain:["PUBLIC_SHOPIFY_DOMAIN","PUBLIC_SHOPIFY_STORE_DOMAIN","SHOPIFY_DOMAIN"],token:["PUBLIC_SHOPIFY_STOREFRONT_TOKEN","PUBLIC_SHOPIFY_STOREFRONT_ACCESS_TOKEN","SHOPIFY_STOREFRONT_TOKEN"]};function de(n){if(typeof n!="string")return!1;try{return new URL(n).protocol==="https:"}catch{return!1}}function pe(n){return/^shp[a-z]{2}_/.test(n.trim())}function ge(n,e){if(!n)return"";let t=parseFloat(n.amount);if(Number.isNaN(t))return"";try{return new Intl.NumberFormat(e||void 0,{style:"currency",currency:n.currencyCode}).format(t)}catch{return`${n.currencyCode} ${t.toFixed(2)}`}}function ye(n,e,t){if(!/\{(handle|id)\}/.test(n))return e?`${n.replace(/\/$/,"")}/${encodeURIComponent(e)}`:null;let o=t?t.split("/").at(-1)??"":"";return n.includes("{handle}")&&!e||n.includes("{id}")&&!o?null:n.replace(/\{handle\}/g,encodeURIComponent(e??"")).replace(/\{id\}/g,encodeURIComponent(o))}function me(n){let e=String(n??"").trim();return e?e.startsWith("gid://")?e:/^\d+$/.test(e)?`gid://shopify/Product/${e}`:/\/products\/([^/?#]+)/.exec(e)?.[1]??e:null}export{Fn as a,$n as b,Dn as c,O as d,v as e,Q as f,Z as g,B as h,Kn as i,x as j,Yn as k,Gn as l,N as m,fn as n,T as o,h as p,l as q,a as r,ee as s,Un as t,te as u,oe as v,re as w,ie as x,u as y,se as z,ce as A,fe as B,de as C,pe as D,ge as E,ye as F,me as G};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as a}from"./chunk-
|
|
1
|
+
import{c as a}from"./chunk-OENVX4NY.js";import{a as o}from"./chunk-2J3MTS3E.js";import{o as u,p as i,r as n,x as c,z as g}from"./chunk-OJAV2I3C.js";var f={country:void 0,language:void 0,locale:void 0},l=!1;function d(){let t=e=>document.querySelector(`meta[name="${n.prefix}-page-${e}"]`)?.getAttribute("content")||void 0,r=u(t("country"));return r?{country:r,language:i(t("language"))??void 0,locale:t("locale")}:null}async function m(){let t=n.markets??{};if(t.detect===!1)return null;if(!t.detect)return t.remember===!1?null:a();try{return(await o("markets")).detectMarket(t)}catch(r){return g(r,"markets"),null}}async function C(t){f={country:n.country,language:n.language,locale:n.locale};let r=d();if(l=r!==null,r){n.country=r.country,n.language=r.language,r.locale&&(n.locale=r.locale);return}let e=await m();e&&(e.country&&(n.country=e.country),e.language&&(n.language=e.language),e.locale&&!t.locale&&(n.locale=e.locale),c("market",e))}var s=(t,r)=>(t??"").toUpperCase()===(r??"").toUpperCase();function P(){let t=d(),r=t===null&&l;l=t!==null;let e=t??(r?a()??f:null);return!e?.country||s(e.country,n.country)&&s(e.language,n.language)?null:{country:e.country,language:e.language,locale:e.locale}}function S(t,r){return o("markets").then(e=>e.setCountry(t,r))}export{C as a,P as b,S as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as A}from"./chunk-
|
|
1
|
+
import{a as A}from"./chunk-4FR3CUO2.js";import{a as l,b as K,c as $}from"./chunk-FI4NIWAD.js";import{b as E,d as b,g as m}from"./chunk-CRKJ2VEX.js";import{c as C,f as M,g as H,h as R}from"./chunk-H6IORH7O.js";import{f as T}from"./chunk-FWMPL6PR.js";import{l as c,n as L,p as x,t as p}from"./chunk-OATTAXPO.js";import{d as w,o as k,p as v,r as a,x as h,y as P,z as f}from"./chunk-OJAV2I3C.js";var W='script[type="application/json"][data-tether-hydrate]',g=new WeakSet,ut=new WeakSet,s=new Set,N=new Set,F=new WeakMap;function q(){s.forEach(t=>{t.isConnected||s.delete(t)}),N.forEach(t=>{t.root.isConnected||N.delete(t)})}function J(t,e){return[...t.matches?.(e)?[t]:[],...x(t,e)]}function z(t,e){let n=L(t,"page-title");!n||typeof document>"u"||(document.title=n.replace(/\{title\}/g,e.title).replace(/\{vendor\}/g,e.vendor||"").replace(/\{type\}/g,e.productType||""))}function D(t,{fromUrl:e,raw:n}){e?(g.add(t),m(t,"not-found"),p("product-not-found",{key:null,source:n},t)):t.closest(A())||P(`[${c("product")}] without a value. Bind it to the Shopify handle field, or use "url:handle".`,t)}function B(t,e,{fromUrl:n,raw:r},o){let d=b(o);if(m(t,d?"not-found":"error",o),!d){f(o,`product ${e}`),p("error",{error:o,context:"product",key:e},t);return}p("product-not-found",{key:e,source:r},t),n?h(`product not found: ${e}`):f(o,`product ${e}`)}function Q(t){if(g.has(t))return!1;let{key:e,...n}=E(t);if(!e)return D(t,n),!1;g.add(t),s.add(t);let r={};F.set(t,r);let o=()=>F.get(t)===r;return l.get(t)?t.setAttribute(c("state"),"updating"):m(t,"loading"),j(C(e)).then(u=>{if(!o())return;let S=l.get(t);S?S.update(u):new $(t,u),z(t,u),a.revalidate&&H(e)&&U(e)}).catch(u=>{o()&&B(t,e,n,u)}),!0}function dt(){q(),s.forEach(t=>{t.getAttribute(c("state"))!=="error"||t.getAttribute(c("error"))==="not-found"||(g.delete(t),Q(t))})}var y=new Set;function U(t){y.size||setTimeout(_,0),y.add(t)}function Y(t,e){s.forEach(n=>{let r=l.get(n);if(!r||!n.isConnected)return;let o=E(n).key;o!==t&&o!==e.handle&&o!==e.id||JSON.stringify(r.product)!==JSON.stringify(e)&&r.update(e)})}function _(){let t=[...y];y=new Set,t.forEach(e=>{R(e).then(n=>{Y(e,n)}).catch(n=>{f(n,`refresh ${e}`)})})}var i=null,j=t=>(i?.add(t),t);function G(){if(!i)return;let t=[...i];Promise.allSettled(t).then(()=>{if(!(!i||t.some(e=>!i?.has(e)))){if(t.length!==i.size){G();return}i=null,document.documentElement.classList.remove(`${a.prefix}-market-pending`)}})}function I(t){if(!w(t))return{country:void 0,language:void 0,products:[]};let{products:e}=t,n=Array.isArray(e)?e:[];return{country:k(t.country)??void 0,language:v(t.language)??void 0,products:n.filter(T)}}var O=new WeakSet;function at(t=document){J(t,W).forEach(e=>{if(O.has(e))return;O.add(e);let n;try{n=JSON.parse(e.textContent)}catch(u){P("bad data-tether-hydrate",u);return}let{country:r,language:o,products:d}=I(n);if(K(d),r===a.country&&o===a.language){M(d);return}h("hydration skipped: other market"),i||(i=new Set,document.documentElement.classList.add(`${a.prefix}-market-pending`))})}export{g as a,ut as b,s as c,N as d,q as e,J as f,Q as g,dt as h,j as i,G as j,at as k};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{e as E}from"./chunk-
|
|
1
|
+
import{e as E}from"./chunk-BVO7KK2M.js";import{a as M}from"./chunk-2J3MTS3E.js";import{b as h,e as A}from"./chunk-CRKJ2VEX.js";import{c as D}from"./chunk-H6IORH7O.js";import"./chunk-FWMPL6PR.js";import{d as P,e as $,h as v,l as p,m as l,n as m,p as d,x as S}from"./chunk-OATTAXPO.js";import{c as k,r as a,w}from"./chunk-OJAV2I3C.js";var R=new Set(["in-stock","out-of-stock","backorder","low-stock","plenty-in-stock","on-sale","not-on-sale","has-variants","single-variant","subscription-available","subscription-unavailable","subscription-only","one-time-available","subscription-selected","one-time-selected","has-savings","loading","ready","error","not-found","cart-empty","cart-filled","cart-has-subscription","cart-no-subscription","cart-has-discount","cart-error","cart-warning","list-empty","list-filled","search-empty","search-results","logged-in","logged-out","orders-empty","orders-loading","addresses-loading","addresses-empty","addresses-error","subscriptions-loading","subscriptions-empty","subscriptions-error"]),N=new Set(["title","description","description-text","vendor","type","handle","published-at","price","total-price","compare-at-price","unit-price","min-price","max-price","discount-percentage","discount-amount","variant-title","variant-id","sku","barcode","stock","quantity","featured-image","variant-image","images","tags","link","url","one-time-price","subscription-price","subscription-savings","subscription-savings-amount","checkout-charge","plan-name","plan-description","plan-group","option-value","swatch","image"]),x=new Set(`account account-bind account-link account-login account-logout add-label add-to-cart adding-text
|
|
2
2
|
always-enabled bind cart-checkout-charge cart-clear cart-close cart-count cart-discounts cart-drawer cart-label cart-lines
|
|
3
3
|
cart-note cart-open cart-subtotal cart-total cart-warning checkout code collection collection-bind countries country
|
|
4
4
|
country-bind country-label country-select default-plan default-purchase discount discount-code discount-form discount-input
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as v}from"./chunk-
|
|
1
|
+
import{c as v}from"./chunk-SZRDO62E.js";import{a as b,b as S}from"./chunk-OENVX4NY.js";import{a as k}from"./chunk-FI4NIWAD.js";import{h as p}from"./chunk-7ZXEVDOS.js";import"./chunk-DM5LEAWM.js";import"./chunk-BVO7KK2M.js";import"./chunk-2J3MTS3E.js";import"./chunk-CRKJ2VEX.js";import"./chunk-H6IORH7O.js";import"./chunk-FWMPL6PR.js";import{N as h,O as w,m as l,n as f,o as g,p as d,t as y}from"./chunk-OATTAXPO.js";import{r as s,y as m,z as u}from"./chunk-OJAV2I3C.js";function U(t,r){let e=w(h(t,"line-attributes"));return r?[{key:"_group",value:r},...e]:e}async function V(t){let r=t.closest(l("group"));if(!r)return null;let e=f(r,"group"),n=U(r,e),i=d(r,l("product")).flatMap(a=>{let o=k.get(a);if(!o?.variant?.availableForSale||o.quantity<=0)return[];let c=o.getLine();return c?[{...c,attributes:[...c.attributes??[],...n]}]:[]});if(!i.length)return m("group-add: nothing selected"),null;try{let a=await p.add(i);return y("group-added",{group:e,lines:i},r),a}catch(a){return u(a,"group add"),null}}function _(t){if(t.key===s.storageKey||t.key===`${s.storageKey}:seen`){p.init().catch(n=>{u(n,"cart from another tab")});return}if(t.key!==b()||!t.newValue)return;let r=S(t.newValue);if(!r)return;let e={language:r.language??null,locale:r.locale,remember:!1};v(r.country,e).catch(n=>{u(n,"market from another tab")})}var E=new WeakMap,K=t=>t.split("/").pop()??t;function x(t){try{window.history.replaceState(window.history.state,"",t)}catch{}}function $(t,{variant:r,sellingPlanId:e}){let n=`${r.id}|${e??""}`,i=E.get(t);if(E.set(t,n),!i||i===n)return;let a=s.variantUrl&&document.querySelector(l("product"))===t;if(!g(t,"variant-url")&&!a)return;let o=new URL(window.location.href);o.searchParams.set("variant",K(r.id)),e?o.searchParams.set("selling_plan",K(e)):o.searchParams.delete("selling_plan"),x(o)}export{V as addGroup,_ as onStorage,$ as writeVariantUrl};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as T}from"./chunk-
|
|
1
|
+
import{a as T}from"./chunk-4FR3CUO2.js";import"./chunk-2J3MTS3E.js";import{b as E,d as w,g as I}from"./chunk-CRKJ2VEX.js";import{a as H,b as m,d as h}from"./chunk-H6IORH7O.js";import{c as A,h as x,i as M,j as O}from"./chunk-FWMPL6PR.js";import{E as b,F as $,H as f,K as N,M as q,a as y,h as a,l as P,m as c,n as i,o as d,q as k,t as u,w as v,y as K}from"./chunk-OATTAXPO.js";import{b as l,r as L,z as S}from"./chunk-OJAV2I3C.js";var U="url:",Y=`query TetherCollection($handle:String!,$first:Int!,$after:String,$sortKey:ProductCollectionSortKeys,$reverse:Boolean,$filters:[ProductFilter!]){collection(handle:$handle){${A()} products(first:$first,after:$after,sortKey:$sortKey,reverse:$reverse,filters:$filters){nodes{...TetherProduct}pageInfo{hasNextPage endCursor}}}}`,B="query TetherSearch($first:Int!,$after:String,$query:String,$sortKey:ProductSortKeys,$reverse:Boolean){products(first:$first,after:$after,query:$query,sortKey:$sortKey,reverse:$reverse){nodes{...TetherProduct}pageInfo{hasNextPage endCursor}}}";async function W({collection:n,query:t,first:o=L.collectionFirst,after:e=null,sortKey:r,reverse:s=!1,filters:D}={}){if(n){let C=await a(h(Y),{handle:n,first:o,after:e,sortKey:r||void 0,reverse:s,filters:D??void 0},x);if(!C.collection)throw new y(`Collection not found: ${n}`,{code:"NOT_FOUND"});let{products:g,..._}=C.collection;return g.nodes.forEach(m),{collection:_,products:g.nodes,pageInfo:g.pageInfo}}let p=await a(h(B),{first:o,after:e,query:t||void 0,sortKey:r||void 0,reverse:s},M);return p.products.nodes.forEach(m),{collection:null,products:p.products.nodes,pageInfo:p.products.pageInfo}}async function j(n,t="RELATED"){let o=H(typeof n=="object"?n?.id:n);if(!o)throw new y("No product for recommendations",{code:"NOT_FOUND"});let e=o.startsWith("gid://"),s=(await a(h(`query TetherRecs(${e?"$id: ID!":"$handle: String!"},$intent:ProductRecommendationIntent){productRecommendations(${e?"productId: $id":"productHandle: $handle"},intent:$intent){...TetherProduct}}`),e?{id:o,intent:t}:{handle:o,intent:t},O)).productRecommendations??[];return s.forEach(m),s}var z=n=>n instanceof window.Element,F=n=>parseInt(n??"",10)||void 0,G=n=>n==="COMPLEMENTARY"?"COMPLEMENTARY":"RELATED",R=class{constructor(t){l(this,"root");l(this,"products",[]);l(this,"pageInfo",null);l(this,"collection",null);l(this,"loadToken",0);this.root=t,t.addEventListener("click",o=>{if(!z(o.target))return;let e=o.target.closest(c("load-more"));e?.closest(T())===t&&(o.preventDefault(),q(e,()=>this.load(!0)))})}$(t){return k(this.root,t,T())}options(){let{root:t}=this,o={reverse:i(t,"reverse")==="true"},e=F(i(t,"limit"));e&&(o.first=e);let r=i(t,"sort");if(r&&(o.sortKey=r),d(t,"collection"))return o.collection=i(t,"collection")??"",o;let s=i(t,"products")??"";return o.query=s.startsWith(U)?new URL(window.location.href).searchParams.get(s.slice(U.length))||"":s,o}async loadRecommendations(){let{key:t}=E(this.root,window.location,"recommendations"),o=this.root.closest(c("product"));return!t&&o&&({key:t}=E(o)),j(t,G(i(this.root,"intent")))}async load(t=!1){this.loadToken+=1;let o=this.loadToken,e=()=>o!==this.loadToken;try{if(d(this.root,"recommendations")){let r=await this.loadRecommendations();if(e())return;let s=F(i(this.root,"limit"));this.products=s?r.slice(0,s):r}else{let r=await W({...this.options(),after:t?this.pageInfo?.endCursor??null:null});if(e())return;this.collection=r.collection,this.pageInfo=r.pageInfo,this.products=t?[...this.products,...r.products]:r.products}this.render(),I(this.root,"ready"),u("list-ready",{products:this.products,collection:this.collection},this.root)}catch(r){if(e())return;t||I(this.root,w(r)?"not-found":"error",r),w(r)&&d(this.root,"recommendations")||S(r,"list load failed"),u("error",{error:r,context:"list"},this.root)}}render(){let{collection:t}=this;this.$(c("collection-bind")).forEach(e=>{switch(i(e,"collection-bind")??""){case"title":$(e,t?.title??"");break;case"description":b(e,t?.descriptionHtml);break;case"image":v(e,t?.image?.url,t?.image?.altText||t?.title);break;case"count":$(e,this.products.length);break}}),this.$(c("list")).forEach(e=>{K(e,this.products,(r,s)=>{r.setAttribute(P("product"),s.handle),r.removeAttribute(P("state"))}),u("list-rendered",{container:e},this.root)});let o=this.products.length===0;this.$(c("show")).forEach(e=>{let r=i(e,"show");r==="list-empty"&&f(e,o),r==="list-filled"&&f(e,!o)}),this.$(c("load-more")).forEach(e=>{f(e,!!this.pageInfo?.hasNextPage)}),N("list")}},Q=new WeakMap;function nt(n){let t=Q.get(n);return t||(t=new R(n),Q.set(n,t)),t.load()}export{W as getProducts,j as getRecommendations,nt as loadList};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as E,c as P,d as k,e as T,f as p,g as A}from"./chunk-
|
|
1
|
+
import{a as E,c as P,d as k,e as T,f as p,g as A}from"./chunk-Y3NKKN2O.js";import{a as I}from"./chunk-4FR3CUO2.js";import{d as F,e as x}from"./chunk-OENVX4NY.js";import"./chunk-FI4NIWAD.js";import{h as u}from"./chunk-7ZXEVDOS.js";import"./chunk-DM5LEAWM.js";import"./chunk-BVO7KK2M.js";import"./chunk-2J3MTS3E.js";import"./chunk-CRKJ2VEX.js";import{e as w}from"./chunk-H6IORH7O.js";import"./chunk-FWMPL6PR.js";import{a as L,d as h,h as b,l as s,m as C,n as v,t as z}from"./chunk-OATTAXPO.js";import{o as f,p as g,r as a,z as y}from"./chunk-OJAV2I3C.js";var _="{name} ({currency})",j="name",d=null;function B(){d=null}var D="query TetherLocalization{localization{country{isoCode name currency{isoCode symbol}}language{isoCode name}availableCountries{isoCode name currency{isoCode symbol}availableLanguages{isoCode name}}}}",O={isoCode:"string",name:"string",currency:"object"},H=h({localization:{country:O,availableCountries:[O]}});function R(){return d??(d=b(D,{},H).then(e=>e.localization,e=>{throw d=null,e})),d}function U(e,n){switch(n){case"name":return e.name;case"code":return e.isoCode;case"currency":return e.currency.isoCode;case"symbol":return e.currency.symbol;default:return""}}var Y=(e,n)=>e.replace(/\{(name|code|currency|symbol)\}/g,(o,i)=>U(n,i));function q(e,n,o){let i=e.getAttribute(s("country-label"))||_,r=(e.getAttribute(s("countries"))||"").toUpperCase().split(/[\s,]+/).filter(Boolean),c=r.length?r.map(t=>n.find(l=>l.isoCode===t)).filter(t=>t!==void 0):n;e.replaceChildren(...c.map(t=>new Option(Y(i,t),t.isoCode))),e.value=o,e.value!==o&&(e.selectedIndex=-1),e.disabled=c.length<2&&!e.hasAttribute(s("always-enabled"))}function $(e,n,o){let i=(a.country||o.country.isoCode).toUpperCase(),r=[...o.availableCountries].sort((t,l)=>t.name.localeCompare(l.name,a.locale||void 0)),c=r.find(t=>t.isoCode===i)??o.country;e.forEach(t=>{q(t,r,i)}),n.forEach(t=>{t.textContent=U(c,v(t,"country-bind")||j)})}function S(e=document){let n=p(e,`select${C("country-select")}`),o=p(e,C("country-bind"));return!n.length&&!o.length?Promise.resolve():R().then(i=>{$(n,o,i)}).catch(i=>{y(i,"country select")})}var Q=e=>Object.values(a.markets?.locales??{}).find(n=>f(n.country)===e);function V(e,n){return e!==void 0?g(e):n?n.language?g(n.language):void 0:a.language}function Z(e){w();let n=[];return u.id()&&n.push(u.setBuyerIdentity({countryCode:e},{create:!1}).catch(o=>{y(o,"cart country")})),T(),k.forEach(o=>n.push(o.load())),P.forEach(o=>{o.closest(I())||(E.delete(o),A(o))}),n}async function re(e,{language:n,locale:o,remember:i=!0}={}){let r=f(e);if(!r)throw new L(`Not a country code: ${e}`,{code:"INVALID_COUNTRY"});let c=Q(r),t=o||c?.locale,l=t||a.locale,m=V(n,c),M=r!==a.country||m!==a.language||l!==a.locale;if(a.country=r,a.language=m||void 0,a.locale=l,i&&x({country:r,language:m,locale:t}),!M)return S(),u.state;n!==void 0&&B();let N=Z(r);return S(),z("country-changed",{country:r,language:a.language}),await Promise.all(N),u.state}export{F as detectMarket,R as getLocalization,S as renderCountrySelects,re as setCountry};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as M}from"./chunk-
|
|
1
|
+
import{f as M}from"./chunk-Y3NKKN2O.js";import"./chunk-4FR3CUO2.js";import"./chunk-FI4NIWAD.js";import"./chunk-7ZXEVDOS.js";import"./chunk-DM5LEAWM.js";import"./chunk-BVO7KK2M.js";import"./chunk-2J3MTS3E.js";import"./chunk-CRKJ2VEX.js";import"./chunk-H6IORH7O.js";import"./chunk-FWMPL6PR.js";import{A as x,C,F as q,H as d,c as S,d as E,h as T,l as A,m as o,n as m,p as h,t as I,w as L,y as w}from"./chunk-OATTAXPO.js";import{b as a,r as u,x as b,z as y}from"./chunk-OJAV2I3C.js";var N=E({predictiveSearch:S({products:[{priceRange:"object"}],collections:["object"],queries:[{text:"string"}]})}),U="query TetherPredictive($q:String!,$limit:Int!){predictiveSearch(query:$q,limit:$limit,limitScope:EACH,types:[PRODUCT,COLLECTION,QUERY]){products{id handle title availableForSale featuredImage{url altText}priceRange{minVariantPrice{amount currencyCode}}}collections{handle title image{url altText}}queries{text}}}",D=6,V=2,F="/search",R=new WeakSet,v=0;function $(s,t,e){return parseInt(m(s,t)||"",10)||e}var H=s=>s.tagName==="A"?s:s.querySelector("a");function p(s,t){h(s,o("search-bind")).forEach(e=>{let i=m(e,"search-bind");i==="image"?L(e,t.image?.url,t.image?.altText||t.title):(i==="title"||i==="price"||i==="text")&&t[i]!=null&&q(e,t[i])})}function k(s,t){let e=H(s);e&&(t&&e.setAttribute("href",t),e.setAttribute("role","option"))}var f=class{constructor(t,e,i){a(this,"root");a(this,"input");a(this,"results");a(this,"limit");a(this,"minCharacters");a(this,"resultsId");a(this,"searchNumber",0);a(this,"timer");a(this,"lastTerm","");a(this,"cache",new Map);this.root=t,this.input=e,this.results=i,this.limit=$(t,"search-limit",D),this.minCharacters=$(t,"search-min",V),i.id||(v+=1,i.id=`${u.prefix}-search-${v}`),this.resultsId=i.id,this.setUpAria(),this.listen()}setUpAria(){this.input.setAttribute("role","combobox"),this.input.setAttribute("aria-autocomplete","list"),this.input.setAttribute("aria-controls",this.resultsId),this.input.setAttribute("aria-expanded","false"),this.input.setAttribute("autocomplete","off"),this.results.hasAttribute("role")||this.results.setAttribute("role","listbox"),this.results.hidden=!0}listen(){this.input.addEventListener("input",()=>{let t=this.input.value.trim();t!==this.lastTerm&&(this.lastTerm=t,clearTimeout(this.timer),this.timer=setTimeout(()=>void this.search(t),u.searchDelay))}),this.input.addEventListener("focus",()=>{this.input.value.trim().length>=this.minCharacters&&this.options().length&&this.open(!0)}),this.input.addEventListener("keydown",t=>{this.onKeydown(t)}),document.addEventListener("click",t=>{this.root.contains(t.target)||this.open(!1)})}setState(t){this.root.setAttribute(A("search-state"),t)}open(t){this.root.classList.toggle("is-open",t),this.results.hidden=!t,this.input.setAttribute("aria-expanded",String(t)),t||this.input.removeAttribute("aria-activedescendant")}options(){return h(this.results,'[role="option"]')}async fetchResults(t){let e=this.cache.get(t);if(e)return e;let i=await T(U,{q:t,limit:this.limit},N);return this.cache.set(t,i.predictiveSearch),i.predictiveSearch}async search(t){this.searchNumber+=1;let e=this.searchNumber;if(t.length<this.minCharacters){this.open(!1),this.setState("idle");return}this.setState("loading");try{let i=await this.fetchResults(t);e===this.searchNumber&&this.render(i,t)}catch(i){if(e!==this.searchNumber){b("a superseded search failed",i);return}this.setState("error"),y(i,"search")}}fillList(t,e,i){h(this.results,o(t)).forEach(l=>{w(l,e,i),d(l,e.length>0)})}queryUrl(t){let e=this.root.getAttribute("action")||F,i=e.includes("?")?"&":"?";return`${e}${i}${this.input.name||"q"}=${encodeURIComponent(t)}`}render(t,e){let i=t?.products??[],l=t?.collections??[],c=(t?.queries??[]).filter(n=>n.text.toLowerCase()!==e.toLowerCase());this.fillList("search-products",i,(n,r)=>{let P=C(r.priceRange.minVariantPrice);p(n,{title:r.title,price:P,image:r.featuredImage}),k(n,x(r.handle,r.id)),n.classList.toggle("is-sold-out",!r.availableForSale)}),this.fillList("search-collections",l,(n,r)=>{p(n,{title:r.title,image:r.image}),k(n,`${(u.collectionPath||"/collection").replace(/\/$/,"")}/${r.handle}`)}),this.fillList("search-queries",c,(n,r)=>{p(n,{text:r.text}),H(n)?.setAttribute("href",this.queryUrl(r.text))});let g=i.length+l.length+c.length;this.showCount(g),this.setState(g?"ready":"empty"),this.open(!0),I("search",{term:e,products:i,collections:l,queries:c},this.root)}showCount(t){h(this.root,o("show")).forEach(e=>{let i=m(e,"show");i==="search-empty"&&d(e,t===0),i==="search-results"&&d(e,t>0)}),this.options().forEach((e,i)=>{e.id||(e.id=`${this.resultsId}-${i}`),e.setAttribute("aria-selected","false")})}highlight(t,e){t.forEach((l,c)=>{l.setAttribute("aria-selected",String(c===e))});let i=t[e];i&&(this.input.setAttribute("aria-activedescendant",i.id),i.scrollIntoView?.({block:"nearest"}))}onKeydown(t){let e=this.options(),i=e.findIndex(l=>l.getAttribute("aria-selected")==="true");t.key==="ArrowDown"&&e.length?(t.preventDefault(),this.open(!0),this.highlight(e,(i+1)%e.length)):t.key==="ArrowUp"&&e.length?(t.preventDefault(),this.highlight(e,i<=0?e.length-1:i-1)):t.key==="Enter"&&i>=0?(t.preventDefault(),e[i]?.click()):t.key==="Escape"&&this.open(!1)}};function j(s=document){for(let t of M(s,o("search"))){if(R.has(t))continue;R.add(t);let e=t.querySelector(o("search-input"))??t.querySelector("input"),i=t.querySelector(o("search-results"));e&&i&&new f(t,e,i)}}export{j as mountSearch};
|
package/dist/esm/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as st,b as at,c as ct}from"./chunks/chunk-MJNPD6LB.js";import{b as C,d as w,e as T,f as p,g as et,h as nt,i as ot,j as k,k as S}from"./chunks/chunk-HROQXZYN.js";import{a as lt,b as dt}from"./chunks/chunk-SOFWDTR7.js";import{a as rt,b as it,c as h}from"./chunks/chunk-3UCVDDK6.js";import"./chunks/chunk-2A2GN3Z7.js";import{a as tt}from"./chunks/chunk-F2BYVA7V.js";import{a as z,e as X,h as s}from"./chunks/chunk-P6DV24RG.js";import"./chunks/chunk-XU27NSXT.js";import{l as Q}from"./chunks/chunk-S5BUUIB6.js";import{a as u,b as ut}from"./chunks/chunk-YJC3CSEG.js";import{b as Z}from"./chunks/chunk-2IGCUTG5.js";import{a as K,b as W,c as Y,e as J}from"./chunks/chunk-EUCFOBIT.js";import"./chunks/chunk-ZBV2JSHE.js";import{C as q,J as P,M as f,a as v,f as G,j as U,l as d,m as r,r as B,s as g,t as y,u as j}from"./chunks/chunk-P73VN3B6.js";import{e as $,r as c,s as V,v as F,w as E,x as L,y as _,z as a}from"./chunks/chunk-D3MRWOFI.js";var x="0.9.1";var Mt=["account-login","account-bind","account-link","orders","order","addresses","subscriptions","profile-form","address-form"],It=()=>[...Mt.map(t=>`[${d(t)}]`),`[${d("show")}^="logged-"]`].join(",");function Nt(){return!!X(st())}function mt(t){!c.account||!(p(t,It()).length>0||ct(new URLSearchParams(window.location.search).get("account"))||Nt())||u("account").then(n=>n.mountAccount(t)).catch(n=>{a(n,"account")})}function l(t){return(...e)=>u("account").then(n=>{let o=n[t];return o(...e)})}var ft={login:l("login"),logout:l("logout"),isLoggedIn:l("isLoggedIn"),customer:l("customer"),orders:l("orders"),order:l("order"),updateProfile:l("updateProfile"),addresses:l("addresses"),saveAddress:l("saveAddress"),deleteAddress:l("deleteAddress"),subscriptions:l("subscriptions"),subscriptionAction:l("subscriptionAction"),requestReturn:l("requestReturn"),render:l("render"),mountAccount:l("mountAccount")};var pt=()=>`data-${c.prefix}-key`,yt=t=>t instanceof window.Element;function ht(t){let e=t.closest(`[${pt()}]`),n=e?.getAttribute(pt());return e&&n?{line:e,id:n}:null}function A(t,e){t.catch(n=>{a(n,e)})}function Ot(t,e){let n=ht(e);if(!n?.line.closest(r("cart-lines")))return;let{line:o,id:i}=n;if(e.closest(r("line-remove"))){t.preventDefault(),o.classList.add("is-busy"),A(s.removeLine(i),"cart line");return}let H=Dt(e);!H||!s.lines.some(xt=>xt.id===i)||(t.preventDefault(),A(s.changeQuantity(i,H),"cart line"))}function Dt(t){return t.closest(r("line-plus"))?1:t.closest(r("line-minus"))?-1:0}function Rt(t){let{target:e}=t;if(!yt(e))return;if(e.closest(r("cart-open"))){t.preventDefault(),s.toggle();return}if(e.closest(r("cart-close"))){t.preventDefault(),s.close();return}let n=e.closest(r("cart-clear"));if(n){t.preventDefault(),f(n,()=>s.clear().catch(i=>{a(i,"cart clear")}));return}let o=e.closest(r("checkout"));if(o){t.preventDefault(),f(o,()=>s.checkout());return}Ot(t,e)}function gt(t,e,n){t.classList.add("is-busy"),t.setAttribute("aria-busy","true"),A(e,n)}function Ht(t){let{target:e}=t;if(!yt(e))return;let n=ht(e);n&&e instanceof window.HTMLInputElement&&e.matches(r("line","quantity"))?gt(n.line,s.updateLine(n.id,parseInt(e.value,10)||0),"cart line"):n&&e instanceof window.HTMLSelectElement&&e.matches(r("line-plan"))?gt(n.line,s.updateLine(n.id,{sellingPlanId:e.value||null}),"cart line plan"):$t(e)&&e.matches(r("cart-note"))&&A(s.setNote(e.value),"cart note")}var $t=t=>t instanceof window.HTMLInputElement||t instanceof window.HTMLTextAreaElement||t instanceof window.HTMLSelectElement;function Vt(t){if(s.isOpen()){if(t.key==="Escape"){s.close();return}z(t)}}function Et(){document.addEventListener("click",Rt),document.addEventListener("change",Ht),document.addEventListener("keydown",Vt)}var M=t=>t instanceof window.Element;function Ft(t){let e=t.querySelector(r("discount-input"))??t.querySelector("input");return e instanceof window.HTMLInputElement?e:null}function vt(t,e,n){t.classList.toggle("is-invalid",n),n?e?.setAttribute("aria-invalid","true"):e?.removeAttribute("aria-invalid")}async function _t(t,e,n){try{await s.applyDiscount(n),vt(t,e,!1),y("discount-applied",{code:n},t),e&&(e.value="")}catch(o){vt(t,e,!0),o instanceof v&&o.code==="INVALID_DISCOUNT"?y("discount-invalid",{code:n},t):a(o,"discount")}}function Gt(t){let{target:e}=t,n=M(e)?e.closest(r("discount-form")):null;if(!n)return;t.preventDefault();let o=Ft(n),i=o?.value.trim();i&&f(n,()=>_t(n,o,i))}function Ut(t){let{target:e}=t;if(!M(e))return;let n=e.closest(r("discount-form"));n&&(n.classList.remove("is-invalid"),e.removeAttribute("aria-invalid"))}function Bt(t){let{target:e}=t,n=M(e)?e.closest(r("discount-remove")):null;if(!n)return;t.preventDefault();let o=n.closest(r("discount-code"))?.getAttribute(d("discount-code"));o&&s.removeDiscount(o).catch(i=>{a(i,"discount")})}function Pt(){document.addEventListener("submit",Gt,!0),document.addEventListener("input",Ut),document.addEventListener("click",Bt)}var I=t=>u("extras").then(e=>e.addGroup(t)),N=t=>{a(t,"extras")};function jt(t){let{target:e}=t,n=e instanceof window.Element?e.closest(r("group-add")):null;n&&(t.preventDefault(),f(n,()=>I(n)).catch(N))}function qt(t){!c.domain||!t.key?.startsWith(`${c.prefix}:`)||u("extras").then(e=>{e.onStorage(t)}).catch(N)}function Qt(t){if(!g(t,"variant-changed"))return;let{target:e}=t;e instanceof window.Element&&(!c.variantUrl&&!e.hasAttribute(d("variant-url"))||u("extras").then(n=>{n.writeVariantUrl(e,t.detail)}).catch(N))}function wt(){document.addEventListener("click",jt),window.addEventListener("storage",qt),document.addEventListener(`${c.prefix}:variant-changed`,Qt)}var O=null;function At(){O=document.body}async function zt(t){await t.ready();let e=it();if(!e){O!==document.body&&t.mount(document);return}try{await h(e.country,{language:e.language??null,locale:e.locale,remember:!1})}catch(n){a(n,"country")}t.mount(document)}function Kt(t){document.addEventListener("astro:page-load",()=>{zt(t).catch(e=>{a(e,"page mount")})}),document.addEventListener("astro:before-swap",()=>{O=null,t.unmount()})}function Wt(t){let{target:e}=t;!(e instanceof window.HTMLSelectElement)||!e.matches(r("country-select"))||e.value&&h(e.value).catch(n=>{a(n,"country")})}function Yt(){nt(),w.forEach(t=>{t.root.getAttribute(d("state"))==="error"&&t.load()})}function bt(t){c.astro&&Kt(t),document.addEventListener("change",Wt),window.addEventListener("online",Yt)}var Jt=50;function Xt(){let t=P("TETHER_CONFIG");return typeof t=="object"&&t!==null?Object.fromEntries(Object.entries(t)):{}}var m=null,D=null,Ct=null,Lt=!1;function Zt(t){let e=0;return p(t,lt()).forEach(n=>{if(C.has(n))return;C.add(n),e++;let o=dt(n);w.add(o),n.addEventListener(`${c.prefix}:list-rendered`,i=>{g(i,"list-rendered")&&b(i.detail.container)}),ot(o.load())}),e}function te(t){p(t,`${r("country-select")},${r("country-bind")}`).length&&u("markets").then(e=>e.renderCountrySelects(t)).catch(e=>{a(e,"markets")}),mt(t),p(t,r("search")).length&&u("search").then(e=>{e.mountSearch(t)}).catch(e=>{a(e,"search")})}function Tt(t){let e=Zt(t);return p(t,r("product")).forEach(n=>{et(n)&&e++}),te(t),e}function b(t=document){if(!E())return 0;t===document&&At(),T(),S(t.ownerDocument??document);let e=Tt(t);return k(),s.render(),L(`mounted ${e} scope(s)`,t),e}function ee(t){let e=t.filter(o=>o.isConnected&&!t.some(i=>i!==o&&i.contains(o)));if(!e.length||!E())return;T(),e.forEach(o=>{S(o)});let n=e.reduce((o,i)=>o+Tt(i),0);k(),s.render(),L(`mounted ${n} scope(s) in ${e.length} added element(s)`)}function kt(){s.close()}function ne(t){let e=t?.closest(r("product"));return e?tt.get(e)??null:null}function oe(){Lt||(Lt=!0,Et(),Pt(),wt(),bt({ready:()=>m??Promise.resolve(null),mount:b,unmount:kt}))}function re(){let t=[];Ct=t,B.forEach(e=>{document.addEventListener(`${c.prefix}:${e}`,n=>t.push(n))}),document.addEventListener("astro:page-load",e=>t.push(e)),u("analytics").then(e=>e.startAnalytics(t)).catch(e=>{a(e,"analytics")})}async function ie(t){let e=c.country,n=t?.buyerIdentity.countryCode;if(!t||!e||!n||n===e)return t;try{return await s.setBuyerIdentity({countryCode:e},{create:!1})}catch(o){return a(o,"cart country"),t}}function St(t={}){return m&&!Object.keys(t).length?m:(F({...Xt(),...t}),E()?(at(),oe(),c.observe&&se(),c.analytics&&!Ct&&re(),m=rt(t).then(()=>s.init()).then(ie).then(e=>(y("ready",{cart:e}),R)),m):(_("TETHER_CONFIG is missing domain or token. Tether is idle."),m=Promise.resolve(null),m))}function se(){if(D||typeof MutationObserver>"u")return;let t,e=new Set;D=new MutationObserver(n=>{n.forEach(o=>{o.addedNodes.forEach(i=>{i instanceof window.Element&&e.add(i)})}),clearTimeout(t),t=setTimeout(()=>{let o=[...e];e.clear(),ee(o)},Jt)}),D.observe(document.body,{childList:!0,subtree:!0})}var ae=t=>u("markets").then(e=>e.detectMarket(t??c.markets)),ce=t=>u("lists").then(e=>e.getProducts(t)),ue=(t,e)=>u("lists").then(n=>n.getRecommendations(t,e)),le=()=>u("markets").then(t=>t.getLocalization()),de=t=>u("diagnose").then(e=>e.diagnose({...t,version:x}));function me(t,e){let n=`${c.prefix}:${t}`,o=i=>{g(i,t)&&e(i.detail,i)};return document.addEventListener(n,o),()=>{document.removeEventListener(n,o)}}var fe={VERSION:x,init:St,mount:b,unmount:kt,get config(){return V},get ready(){return m??Promise.resolve(null)},query:U,withContext:G,cart:s,getProduct:Y,getProducts:ce,getRecommendations:ue,getScope:ne,addGroup:I,account:ft,primeProduct:W,normalizeProductKey:K,clearProductCache:J,formatMoney:q,imageUrl:j,plans:Q,TetherError:v,resolveProductKey:Z,setCountry:h,detectMarket:ae,getLocalization:le,diagnose:de,on:me},pe={__core:ut,__parts:{}},R=Object.assign(fe,pe),cn=R;function ge(){Reflect.set(window,"Tether",R);let t=P("TETHER_CONFIG");if(!t||$(t,"autoMount")===!1||P("TETHER_INTEGRATION"))return;let e=()=>{St().then(()=>b(document)).catch(n=>{a(n,"init")})};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",e,{once:!0}):e()}typeof window<"u"&&typeof document<"u"&&ge();export{x as VERSION,I as addGroup,R as api,cn as default,ne as getScope,St as init,b as mount,h as setCountry,kt as unmount};
|
|
1
|
+
import{a as st,b as at,c as ct}from"./chunks/chunk-IJAMRI33.js";import{b as C,d as w,e as T,f as p,g as et,h as nt,i as ot,j as k,k as S}from"./chunks/chunk-Y3NKKN2O.js";import{a as lt,b as dt}from"./chunks/chunk-4FR3CUO2.js";import{a as rt,b as it,c as h}from"./chunks/chunk-SZRDO62E.js";import"./chunks/chunk-OENVX4NY.js";import{a as tt}from"./chunks/chunk-FI4NIWAD.js";import{a as z,e as X,h as s}from"./chunks/chunk-7ZXEVDOS.js";import"./chunks/chunk-DM5LEAWM.js";import{l as Q}from"./chunks/chunk-BVO7KK2M.js";import{a as u,b as ut}from"./chunks/chunk-2J3MTS3E.js";import{b as Z}from"./chunks/chunk-CRKJ2VEX.js";import{a as K,b as W,c as Y,e as J}from"./chunks/chunk-H6IORH7O.js";import"./chunks/chunk-FWMPL6PR.js";import{C as q,J as P,M as f,a as v,f as G,j as U,l as d,m as r,r as B,s as g,t as y,u as j}from"./chunks/chunk-OATTAXPO.js";import{e as $,r as c,s as V,v as F,w as E,x as L,y as _,z as a}from"./chunks/chunk-OJAV2I3C.js";var x="0.9.2";var Mt=["account-login","account-bind","account-link","orders","order","addresses","subscriptions","profile-form","address-form"],It=()=>[...Mt.map(t=>`[${d(t)}]`),`[${d("show")}^="logged-"]`].join(",");function Nt(){return!!X(st())}function mt(t){!c.account||!(p(t,It()).length>0||ct(new URLSearchParams(window.location.search).get("account"))||Nt())||u("account").then(n=>n.mountAccount(t)).catch(n=>{a(n,"account")})}function l(t){return(...e)=>u("account").then(n=>{let o=n[t];return o(...e)})}var ft={login:l("login"),logout:l("logout"),isLoggedIn:l("isLoggedIn"),customer:l("customer"),orders:l("orders"),order:l("order"),updateProfile:l("updateProfile"),addresses:l("addresses"),saveAddress:l("saveAddress"),deleteAddress:l("deleteAddress"),subscriptions:l("subscriptions"),subscriptionAction:l("subscriptionAction"),requestReturn:l("requestReturn"),render:l("render"),mountAccount:l("mountAccount")};var pt=()=>`data-${c.prefix}-key`,yt=t=>t instanceof window.Element;function ht(t){let e=t.closest(`[${pt()}]`),n=e?.getAttribute(pt());return e&&n?{line:e,id:n}:null}function A(t,e){t.catch(n=>{a(n,e)})}function Ot(t,e){let n=ht(e);if(!n?.line.closest(r("cart-lines")))return;let{line:o,id:i}=n;if(e.closest(r("line-remove"))){t.preventDefault(),o.classList.add("is-busy"),A(s.removeLine(i),"cart line");return}let H=Dt(e);!H||!s.lines.some(xt=>xt.id===i)||(t.preventDefault(),A(s.changeQuantity(i,H),"cart line"))}function Dt(t){return t.closest(r("line-plus"))?1:t.closest(r("line-minus"))?-1:0}function Rt(t){let{target:e}=t;if(!yt(e))return;if(e.closest(r("cart-open"))){t.preventDefault(),s.toggle();return}if(e.closest(r("cart-close"))){t.preventDefault(),s.close();return}let n=e.closest(r("cart-clear"));if(n){t.preventDefault(),f(n,()=>s.clear().catch(i=>{a(i,"cart clear")}));return}let o=e.closest(r("checkout"));if(o){t.preventDefault(),f(o,()=>s.checkout());return}Ot(t,e)}function gt(t,e,n){t.classList.add("is-busy"),t.setAttribute("aria-busy","true"),A(e,n)}function Ht(t){let{target:e}=t;if(!yt(e))return;let n=ht(e);n&&e instanceof window.HTMLInputElement&&e.matches(r("line","quantity"))?gt(n.line,s.updateLine(n.id,parseInt(e.value,10)||0),"cart line"):n&&e instanceof window.HTMLSelectElement&&e.matches(r("line-plan"))?gt(n.line,s.updateLine(n.id,{sellingPlanId:e.value||null}),"cart line plan"):$t(e)&&e.matches(r("cart-note"))&&A(s.setNote(e.value),"cart note")}var $t=t=>t instanceof window.HTMLInputElement||t instanceof window.HTMLTextAreaElement||t instanceof window.HTMLSelectElement;function Vt(t){if(s.isOpen()){if(t.key==="Escape"){s.close();return}z(t)}}function Et(){document.addEventListener("click",Rt),document.addEventListener("change",Ht),document.addEventListener("keydown",Vt)}var M=t=>t instanceof window.Element;function Ft(t){let e=t.querySelector(r("discount-input"))??t.querySelector("input");return e instanceof window.HTMLInputElement?e:null}function vt(t,e,n){t.classList.toggle("is-invalid",n),n?e?.setAttribute("aria-invalid","true"):e?.removeAttribute("aria-invalid")}async function _t(t,e,n){try{await s.applyDiscount(n),vt(t,e,!1),y("discount-applied",{code:n},t),e&&(e.value="")}catch(o){vt(t,e,!0),o instanceof v&&o.code==="INVALID_DISCOUNT"?y("discount-invalid",{code:n},t):a(o,"discount")}}function Gt(t){let{target:e}=t,n=M(e)?e.closest(r("discount-form")):null;if(!n)return;t.preventDefault();let o=Ft(n),i=o?.value.trim();i&&f(n,()=>_t(n,o,i))}function Ut(t){let{target:e}=t;if(!M(e))return;let n=e.closest(r("discount-form"));n&&(n.classList.remove("is-invalid"),e.removeAttribute("aria-invalid"))}function Bt(t){let{target:e}=t,n=M(e)?e.closest(r("discount-remove")):null;if(!n)return;t.preventDefault();let o=n.closest(r("discount-code"))?.getAttribute(d("discount-code"));o&&s.removeDiscount(o).catch(i=>{a(i,"discount")})}function Pt(){document.addEventListener("submit",Gt,!0),document.addEventListener("input",Ut),document.addEventListener("click",Bt)}var I=t=>u("extras").then(e=>e.addGroup(t)),N=t=>{a(t,"extras")};function jt(t){let{target:e}=t,n=e instanceof window.Element?e.closest(r("group-add")):null;n&&(t.preventDefault(),f(n,()=>I(n)).catch(N))}function qt(t){!c.domain||!t.key?.startsWith(`${c.prefix}:`)||u("extras").then(e=>{e.onStorage(t)}).catch(N)}function Qt(t){if(!g(t,"variant-changed"))return;let{target:e}=t;e instanceof window.Element&&(!c.variantUrl&&!e.hasAttribute(d("variant-url"))||u("extras").then(n=>{n.writeVariantUrl(e,t.detail)}).catch(N))}function wt(){document.addEventListener("click",jt),window.addEventListener("storage",qt),document.addEventListener(`${c.prefix}:variant-changed`,Qt)}var O=null;function At(){O=document.body}async function zt(t){await t.ready();let e=it();if(!e){O!==document.body&&t.mount(document);return}try{await h(e.country,{language:e.language??null,locale:e.locale,remember:!1})}catch(n){a(n,"country")}t.mount(document)}function Kt(t){document.addEventListener("astro:page-load",()=>{zt(t).catch(e=>{a(e,"page mount")})}),document.addEventListener("astro:before-swap",()=>{O=null,t.unmount()})}function Wt(t){let{target:e}=t;!(e instanceof window.HTMLSelectElement)||!e.matches(r("country-select"))||e.value&&h(e.value).catch(n=>{a(n,"country")})}function Yt(){nt(),w.forEach(t=>{t.root.getAttribute(d("state"))==="error"&&t.load()})}function bt(t){c.astro&&Kt(t),document.addEventListener("change",Wt),window.addEventListener("online",Yt)}var Jt=50;function Xt(){let t=P("TETHER_CONFIG");return typeof t=="object"&&t!==null?Object.fromEntries(Object.entries(t)):{}}var m=null,D=null,Ct=null,Lt=!1;function Zt(t){let e=0;return p(t,lt()).forEach(n=>{if(C.has(n))return;C.add(n),e++;let o=dt(n);w.add(o),n.addEventListener(`${c.prefix}:list-rendered`,i=>{g(i,"list-rendered")&&b(i.detail.container)}),ot(o.load())}),e}function te(t){p(t,`${r("country-select")},${r("country-bind")}`).length&&u("markets").then(e=>e.renderCountrySelects(t)).catch(e=>{a(e,"markets")}),mt(t),p(t,r("search")).length&&u("search").then(e=>{e.mountSearch(t)}).catch(e=>{a(e,"search")})}function Tt(t){let e=Zt(t);return p(t,r("product")).forEach(n=>{et(n)&&e++}),te(t),e}function b(t=document){if(!E())return 0;t===document&&At(),T(),S(t.ownerDocument??document);let e=Tt(t);return k(),s.render(),L(`mounted ${e} scope(s)`,t),e}function ee(t){let e=t.filter(o=>o.isConnected&&!t.some(i=>i!==o&&i.contains(o)));if(!e.length||!E())return;T(),e.forEach(o=>{S(o)});let n=e.reduce((o,i)=>o+Tt(i),0);k(),s.render(),L(`mounted ${n} scope(s) in ${e.length} added element(s)`)}function kt(){s.close()}function ne(t){let e=t?.closest(r("product"));return e?tt.get(e)??null:null}function oe(){Lt||(Lt=!0,Et(),Pt(),wt(),bt({ready:()=>m??Promise.resolve(null),mount:b,unmount:kt}))}function re(){let t=[];Ct=t,B.forEach(e=>{document.addEventListener(`${c.prefix}:${e}`,n=>t.push(n))}),document.addEventListener("astro:page-load",e=>t.push(e)),u("analytics").then(e=>e.startAnalytics(t)).catch(e=>{a(e,"analytics")})}async function ie(t){let e=c.country,n=t?.buyerIdentity.countryCode;if(!t||!e||!n||n===e)return t;try{return await s.setBuyerIdentity({countryCode:e},{create:!1})}catch(o){return a(o,"cart country"),t}}function St(t={}){return m&&!Object.keys(t).length?m:(F({...Xt(),...t}),E()?(at(),oe(),c.observe&&se(),c.analytics&&!Ct&&re(),m=rt(t).then(()=>s.init()).then(ie).then(e=>(y("ready",{cart:e}),R)),m):(_("TETHER_CONFIG is missing domain or token. Tether is idle."),m=Promise.resolve(null),m))}function se(){if(D||typeof MutationObserver>"u")return;let t,e=new Set;D=new MutationObserver(n=>{n.forEach(o=>{o.addedNodes.forEach(i=>{i instanceof window.Element&&e.add(i)})}),clearTimeout(t),t=setTimeout(()=>{let o=[...e];e.clear(),ee(o)},Jt)}),D.observe(document.body,{childList:!0,subtree:!0})}var ae=t=>u("markets").then(e=>e.detectMarket(t??c.markets)),ce=t=>u("lists").then(e=>e.getProducts(t)),ue=(t,e)=>u("lists").then(n=>n.getRecommendations(t,e)),le=()=>u("markets").then(t=>t.getLocalization()),de=t=>u("diagnose").then(e=>e.diagnose({...t,version:x}));function me(t,e){let n=`${c.prefix}:${t}`,o=i=>{g(i,t)&&e(i.detail,i)};return document.addEventListener(n,o),()=>{document.removeEventListener(n,o)}}var fe={VERSION:x,init:St,mount:b,unmount:kt,get config(){return V},get ready(){return m??Promise.resolve(null)},query:U,withContext:G,cart:s,getProduct:Y,getProducts:ce,getRecommendations:ue,getScope:ne,addGroup:I,account:ft,primeProduct:W,normalizeProductKey:K,clearProductCache:J,formatMoney:q,imageUrl:j,plans:Q,TetherError:v,resolveProductKey:Z,setCountry:h,detectMarket:ae,getLocalization:le,diagnose:de,on:me},pe={__core:ut,__parts:{}},R=Object.assign(fe,pe),cn=R;function ge(){Reflect.set(window,"Tether",R);let t=P("TETHER_CONFIG");if(!t||$(t,"autoMount")===!1||P("TETHER_INTEGRATION"))return;let e=()=>{St().then(()=>b(document)).catch(n=>{a(n,"init")})};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",e,{once:!0}):e()}typeof window<"u"&&typeof document<"u"&&ge();export{x as VERSION,I as addGroup,R as api,cn as default,ne as getScope,St as init,b as mount,h as setCountry,kt as unmount};
|
package/dist/esm/server.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as
|
|
2
|
-
${
|
|
1
|
+
import{b as G,f as Q,g as H}from"./chunks/chunk-DM5LEAWM.js";import{e as O,f as v,g as w,i as F,l as q}from"./chunks/chunk-BVO7KK2M.js";import{a as M,c as R,e as V,g as J,h as B,i as K,j}from"./chunks/chunk-FWMPL6PR.js";import{B as D,a as y,c as b,d as S,f as ot,g as k,i as U,u as L}from"./chunks/chunk-OATTAXPO.js";import{B as E,E as _,F as C,G as I,q as g,t as N,y as A}from"./chunks/chunk-OJAV2I3C.js";function z(t,e={}){if(!t)return null;let{variant:r,sellingPlan:a,defaultPurchase:c=g.defaultPurchase,lowStock:u=g.lowStock}=e,d=Q(t,{variant:r,sellingPlan:a,defaultPurchase:c}),n=H(t,{...d,quantity:1},u);if(!n)throw new y(`Product ${t.handle} has no variants`);let{selected:l,line:p}=n,i=(o,s)=>!G(t,l,o,s);return{variant:n.variant,selected:l,purchase:n.purchase.kind,plan:p.kind==="subscription"?n.plan:null,plans:O(t).map(o=>({id:o.id,name:o.name,price:w(n.variant,o.id),savings:F(n.variant,o.id).percentage,selected:p.kind==="subscription"&&o.id===p.planId,available:!!v(n.variant,o.id)})),savings:n.savings.percentage,price:n.price,compareAtPrice:n.compareAtPrice,available:n.variant.availableForSale,show:n.show,unavailable:Object.fromEntries(t.options.map(o=>[o.name,o.optionValues.map(s=>s.name).filter(s=>i(o.name,s))])),isUnavailable:i}}var it=500,at=100,st=100,lt="query TetherServerProductById($id:ID!){node(id:$id){... on Product{...TetherProduct}}}",ct="query TetherServerProduct($handle:String!){product(handle:$handle){...TetherProduct}}",ut=()=>`query TetherServerCollection($handle:String!,$first:Int!,$after:String,$sortKey:ProductCollectionSortKeys,$reverse:Boolean,$filters:[ProductFilter!]){collection(handle:$handle){${R()} products(first:$first,after:$after,sortKey:$sortKey,reverse:$reverse,filters:$filters){nodes{...TetherProduct}pageInfo{hasNextPage endCursor}}}}`,dt="query TetherServerProducts($first:Int!,$after:String,$query:String,$sortKey:ProductSortKeys,$reverse:Boolean){products(first:$first,after:$after,query:$query,sortKey:$sortKey,reverse:$reverse){nodes{...TetherProduct}pageInfo{hasNextPage endCursor}}}",ft=()=>`query TetherServerCollections($first:Int!,$after:String){collections(first:$first,after:$after){nodes{${R()}}pageInfo{hasNextPage endCursor}}}`,pt=t=>`query TetherServerRecs(${t?"$id: ID!":"$handle: String!"},$intent:ProductRecommendationIntent){productRecommendations(${t?"productId: $id":"productHandle: $handle"},intent:$intent){...TetherProduct}}`,mt=S({product:b(V)}),gt=S({node:b(J)}),yt=S({collections:{nodes:[{handle:"string"}],pageInfo:{hasNextPage:"boolean"}}});async function Pt(t){let e=[],r=null;for(let a=0;a<st;a++){let c=await k(t,ft(),{first:at,after:r},yt);if(e.push(...c.collections.nodes),!c.collections.pageInfo.hasNextPage)break;r=c.collections.pageInfo.endCursor}return e}function Y(t,e){let r=(i,o,s)=>k(t,f=>`${i}
|
|
2
|
+
${M(t,f)}`,o,s);async function a(i){let o=I(i);if(!o)return null;if(o.startsWith("gid://")){let{node:f}=await r(lt,{id:o},gt);return f?.id?f:null}return(await r(ct,{handle:o},mt)).product}async function c(i,{first:o=e,after:s=null,sortKey:f,reverse:m=!1,filters:$}){let h=await r(ut(),{handle:i,first:o,after:s,sortKey:f||void 0,reverse:m,filters:$??void 0},B);if(!h.collection)return{collection:null,products:[],pageInfo:{hasNextPage:!1,endCursor:null}};let{products:P,...rt}=h.collection;return{collection:rt,products:P.nodes,pageInfo:P.pageInfo}}async function u(i={}){let{collection:o,query:s,first:f=e,after:m=null,sortKey:$,reverse:h=!1}=i;if(o)return c(o,i);let P=await r(dt,{first:f,after:m,query:s||void 0,sortKey:$||void 0,reverse:h},K);return{collection:null,products:P.products.nodes,pageInfo:P.products.pageInfo}}async function d(i={}){let o=[],s=null;for(let f=0;f<it;f++){let m=await u({...i,first:e,after:s});if(o.push(...m.products),!m.pageInfo.hasNextPage)break;s=m.pageInfo.endCursor}return o}async function n(i,o={}){let s=await u({...o,collection:i});return s.collection?{...s.collection,products:s.products,pageInfo:s.pageInfo}:null}async function l(i,o="RELATED"){let s=I(typeof i=="object"?i?.id:i);if(!s)throw new y("No product for recommendations",{code:"NOT_FOUND"});let f=s.startsWith("gid://");return(await r(pt(f),f?{id:s,intent:o}:{handle:s,intent:o},j)).productRecommendations??[]}return{getProduct:a,getProducts:u,allProducts:d,getCollection:n,allCollections:()=>Pt(t),getRecommendations:l}}var X={size:"https://schema.org/size",color:"https://schema.org/color",colour:"https://schema.org/color",material:"https://schema.org/material"},T=t=>JSON.stringify(t).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");function W(t){return JSON.parse(JSON.stringify(t))}var Z=t=>t.split("/").pop()??t;function ht(t){return t.availableForSale?t.currentlyNotInStock?"https://schema.org/BackOrder":"https://schema.org/InStock":"https://schema.org/OutOfStock"}function St(t,e){if(!t.requiresSellingPlan)return e.price;let r=O(t).find(a=>v(e,a.id));return(r&&w(e,r.id))??e.price}function tt(t,e,r){let a=St(t,e),c=r?.includes("?")?"&":"?";return{"@type":"Offer",price:a.amount,priceCurrency:a.currencyCode,availability:ht(e),url:r?`${r}${c}variant=${Z(e.id)}`:void 0}}function Ct(t,e,r,a){let c=e.selectedOptions.flatMap(u=>{let d=X[u.name.toLowerCase()];return d?[[d.split("/").pop()??d,u.value]]:[]});return{"@type":"Product",name:`${t.title} - ${e.title}`,sku:e.sku||void 0,image:e.image?.url||a[0],...Object.fromEntries(c),offers:tt(t,e,r)}}function It(t,{url:e},r){if(e)return e;let a=C(r.productPath,t.handle,t.id);if(!(!r.siteUrl||!a))return new URL(a,r.siteUrl).toString()}function x(t,e,r){if(!t)return null;let a=It(t,e,r),c=t.images.nodes.map(i=>i.url).filter(Boolean),u=e.brand||t.vendor,d=u?{"@type":"Brand",name:u}:void 0,n=t.description.trim()||void 0,l=t.variants.nodes;if(l.length<=1){let[i]=l;return W({"@context":"https://schema.org","@type":"Product",name:t.title,description:n,url:a,image:c,sku:i?.sku||void 0,brand:d,offers:i?tt(t,i,a):void 0})}let p=t.options.map(i=>X[i.name.toLowerCase()]).filter(Boolean);return W({"@context":"https://schema.org","@type":"ProductGroup",name:t.title,description:n,url:a,productGroupID:Z(t.id),image:c,brand:d,variesBy:[...new Set(p)],hasVariant:l.map(i=>Ct(t,i,a,c))})}var et=25,Ot=250,vt=2,wt=1;function $t(t,{productPath:e=g.productPath,id:r}={}){return C(e,t,r)}function nt(t,e){for(let r of e){let a=t[r];if(typeof a=="string"&&a)return a}return""}function bt(t){let e={};for(let[u,d]of Object.entries(t))u in g&&(e[u]=d);let r=typeof t.domain=="string"&&t.domain?t.domain:"",a=typeof t.token=="string"&&t.token?t.token:"",c={...N({...e,domain:r||nt(t,E.domain),token:a||nt(t,E.token)}),pageSize:kt(t.pageSize)};return t.fetch&&(c.fetch=t.fetch),t.siteUrl!==void 0&&(c.siteUrl=t.siteUrl),c}function kt(t){return typeof t=="number"&&Number.isInteger(t)&&t>=1&&t<=Ot?t:(t!==void 0&&A(`invalid pageSize ${JSON.stringify(t)}: using ${String(et)}`),et)}function Et(t,e){return{...t,description:"",descriptionHtml:"",images:{nodes:t.images.nodes.slice(0,Math.max(1,e))},variants:{nodes:t.variants.nodes.map(r=>({...r,image:null}))}}}function zt(t={}){let e=bt(t);if(!e.domain||!e.token)throw new y("createStorefront needs domain and token: pass them, or import.meta.env with PUBLIC_SHOPIFY_DOMAIN and PUBLIC_SHOPIFY_STOREFRONT_TOKEN",{code:"NOT_CONFIGURED"});let r=Y(e,e.pageSize),a={productPath:e.productPath,siteUrl:e.siteUrl};function c(n,{card:l=!1,images:p=vt}={}){let i=(Array.isArray(n)?n:[n]).filter(s=>s!=null),o={v:wt,at:new Date().toISOString(),country:e.country||null,language:e.language||null,products:l?i.map(s=>Et(s,p)):i};return`<script type="application/json" data-tether-hydrate>${T(o)}<\/script>`}function u(n,l={}){return n?`<script type="application/ld+json">${T(x(n,l,a))}<\/script>`:""}function d(n,l={}){return z(n,{defaultPurchase:e.defaultPurchase,lowStock:e.lowStock,...l})}return{config:e,query:(n,l,p)=>U(e,n,l,p),...r,hydrate:c,formatMoney:(n,l=e.locale)=>_(n,l),formatPercent:(n,l=e.locale)=>D(n,l),imageUrl:L,jsonLd:u,jsonLdData:(n,l={})=>x(n,l,a),initialState:d,productUrl:(n,l={})=>$t(n,{productPath:e.productPath,...l}),plans:q}}export{y as TetherError,zt as createStorefront,_ as formatMoney,D as formatPercent,L as imageUrl,z as initialState,q as plans,I as productKey,$t as productUrl,ot as withContext};
|
package/dist/tether.js
CHANGED
|
@@ -348,9 +348,13 @@
|
|
|
348
348
|
retries: MAX_RETRIES
|
|
349
349
|
};
|
|
350
350
|
function countOption(name, value) {
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
351
|
+
if (typeof value !== "number" || !Number.isInteger(value) || value < 0) {
|
|
352
|
+
return invalidOption(name, value, DEFAULTS[name]);
|
|
353
|
+
}
|
|
354
|
+
const maximum = COUNT_MAXIMUMS[name];
|
|
355
|
+
if (maximum === void 0 || value <= maximum) return value;
|
|
356
|
+
warn(`${name} ${String(value)} is more than its maximum: using ${String(maximum)}`);
|
|
357
|
+
return maximum;
|
|
354
358
|
}
|
|
355
359
|
function switchOption(name, value) {
|
|
356
360
|
return typeof value === "boolean" ? value : invalidOption(name, value, DEFAULTS[name]);
|
|
@@ -3444,7 +3448,7 @@
|
|
|
3444
3448
|
}
|
|
3445
3449
|
|
|
3446
3450
|
// src/version.ts
|
|
3447
|
-
var VERSION = "0.9.
|
|
3451
|
+
var VERSION = "0.9.2";
|
|
3448
3452
|
|
|
3449
3453
|
// src/lazy-iife.ts
|
|
3450
3454
|
var coreModules = {
|