@shopify/hydrogen-react 2023.4.1 → 2023.4.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.
@@ -260,7 +260,7 @@
260
260
  }
261
261
  `,oe="2023-04";function gr(e){const{storeDomain:t,privateStorefrontToken:r,publicStorefrontToken:n,storefrontApiVersion:o,contentType:a}=e;return o!==oe&&hr(`StorefrontClient: The Storefront API version that you're using is different than the version this build of Hydrogen React is targeting. You may run into unexpected errors if these versions don't match. Received verion: "${o}"; expected version "${oe}"`),{getShopifyDomain(s){return(s==null?void 0:s.storeDomain)??t},getStorefrontApiUrl(s){const i=(s==null?void 0:s.storeDomain)??t;return`${i}${i.endsWith("/")?"":"/"}api/${(s==null?void 0:s.storefrontApiVersion)??o}/graphql.json`},getPrivateTokenHeaders(s){if(!r&&!(s!=null&&s.privateStorefrontToken))throw new Error("StorefrontClient: You did not pass in a 'privateStorefrontToken' while using 'getPrivateTokenHeaders()'");return{"content-type":((s==null?void 0:s.contentType)??a)==="graphql"?"application/graphql":"application/json","X-SDK-Variant":"hydrogen-react","X-SDK-Variant-Source":"react","X-SDK-Version":o,"Shopify-Storefront-Private-Token":(s==null?void 0:s.privateStorefrontToken)??r??"",...s!=null&&s.buyerIp?{"Shopify-Storefront-Buyer-IP":s.buyerIp}:{}}},getPublicTokenHeaders(s){if(!n&&!(s!=null&&s.publicStorefrontToken))throw new Error("StorefrontClient: You did not pass in a 'publicStorefrontToken' while using 'getPublicTokenHeaders()'");const i=(s==null?void 0:s.contentType)??a??"json";return Be(i,o,(s==null?void 0:s.publicStorefrontToken)??n??"")}}}function Be(e,t,r){return{"content-type":e==="graphql"?"application/graphql":"application/json","X-SDK-Variant":"hydrogen-react","X-SDK-Variant-Source":"react","X-SDK-Version":t,"X-Shopify-Storefront-Access-Token":r}}const Ye=new Set,hr=e=>{Ye.has(e)||(console.warn(e),Ye.add(e))},je={storeDomain:"test",storefrontToken:"abc123",storefrontApiVersion:oe,countryIsoCode:"US",languageIsoCode:"EN",getStorefrontApiUrl(){return""},getPublicTokenHeaders(){return{}},getShopifyDomain(){return""}},Ge=u.createContext(je);function mr({children:e,...t}){if(!t.countryIsoCode||!t.languageIsoCode||!t.storeDomain||!t.storefrontToken||!t.storefrontApiVersion)throw new Error("Please provide the necessary props to '<ShopifyProvider/>'");t.storefrontApiVersion!==oe&&console.warn(`<ShopifyProvider/>: This version of Hydrogen React is built for Shopify's Storefront API version ${oe}, but it looks like you're using version ${t.storefrontApiVersion}. There may be issues or bugs if you use a mismatched version of Hydrogen React and the Storefront API.`);const r=u.useMemo(()=>{function n(o){return(o==null?void 0:o.storeDomain)??t.storeDomain}return{...t,getPublicTokenHeaders(o){return Be(o.contentType,t.storefrontApiVersion,o.storefrontToken??t.storefrontToken)},getShopifyDomain:n,getStorefrontApiUrl(o){const a=n({storeDomain:(o==null?void 0:o.storeDomain)??t.storeDomain});return`${a}${a.endsWith("/")?"":"/"}api/${(o==null?void 0:o.storefrontApiVersion)??t.storefrontApiVersion}/graphql.json`}}},[t]);return u.createElement(Ge.Provider,{value:r},e)}function ge(){const e=u.useContext(Ge);if(!e)throw new Error("'useShop()' must be a descendent of <ShopifyProvider/>");return e}const Ie="shopifyCartId",Ze="Shopify-Storefront-Id",We="Shopify-Storefront-Y",Qe="Shopify-Storefront-S",j="_shopify_y",G="_shopify_s";var pr=new Set(["domain","path","max-age","expires","samesite","secure","httponly"]);function Er(e){let t={},r,n,o=0,a=e.split(/;\s*/g),s,i;for(;o<a.length;o++)if(n=a[o],r=n.indexOf("="),~r){if(s=n.substring(0,r++).trim(),i=n.substring(r).trim(),i[0]==='"'&&(i=i.substring(1,i.length-1)),~i.indexOf("%"))try{i=decodeURIComponent(i)}catch{}pr.has(n=s.toLowerCase())?n==="expires"?t.expires=new Date(i):n==="max-age"?t.maxage=+i:t[n]=i:t[s]=i}else(s=n.trim().toLowerCase())&&(s==="httponly"||s==="secure")&&(t[s]=!0);return t}function Cr(e,t,r={}){let n=e+"="+encodeURIComponent(t);return r.expires&&(n+="; Expires="+new Date(r.expires).toUTCString()),r.maxage!=null&&r.maxage>=0&&(n+="; Max-Age="+(r.maxage|0)),r.domain&&(n+="; Domain="+r.domain),r.path&&(n+="; Path="+r.path),r.samesite&&(n+="; SameSite="+r.samesite),(r.secure||r.samesite==="None")&&(n+="; Secure"),r.httponly&&(n+="; HttpOnly"),n}const Je="xxxx-4xxx-xxxx-xxxxxxxxxxxx";function he(){let e="";try{const t=window.crypto,r=new Uint16Array(31);t.getRandomValues(r);let n=0;e=Je.replace(/[x]/g,o=>{const a=r[n]%16,s=o==="x"?a:a&3|8;return n++,s.toString(16)}).toUpperCase()}catch{e=Je.replace(/[x]/g,r=>{const n=Math.random()*16|0;return(r==="x"?n:n&3|8).toString(16)}).toUpperCase()}return`${Sr()}-${e}`}function Sr(){let e=0,t=0;e=new Date().getTime()>>>0;try{t=performance.now()>>>0}catch{t=0}const r=Math.abs(e+t).toString(16).toLowerCase();return r.padStart(8-r.length,"0")}function me(e){const t=Er(e);return{[j]:t[j]||"",[G]:t[G]||""}}function Tr(){const{storefrontId:e,getPublicTokenHeaders:t,getStorefrontApiUrl:r}=ge();return u.useCallback(({query:n,variables:o})=>{const a=t({contentType:"json"});e&&(a[Ze]=e);const s=me(document.cookie);return a[We]=s[j],a[Qe]=s[G],fetch(r(),{method:"POST",headers:a,body:JSON.stringify({query:n.toString(),variables:o})}).then(i=>i.json()).catch(i=>({data:void 0,errors:i==null?void 0:i.toString()}))},[t,e,r])}function _r({numCartLines:e,cartFragment:t,countryCode:r="US"}){const n=Tr(),o=u.useCallback(p=>n({query:fr(t),variables:{id:p,numCartLines:e,country:r}}),[n,t,e,r]),a=u.useCallback(p=>n({query:ir(t),variables:{input:p,numCartLines:e,country:r}}),[t,r,n,e]),s=u.useCallback((p,d)=>n({query:or(t),variables:{cartId:p,lines:d,numCartLines:e,country:r}}),[t,r,n,e]),i=u.useCallback((p,d)=>n({query:sr(t),variables:{cartId:p,lines:d,numCartLines:e,country:r}}),[t,r,n,e]),c=u.useCallback((p,d)=>n({query:ar(t),variables:{cartId:p,lines:d,numCartLines:e,country:r}}),[t,r,n,e]),h=u.useCallback((p,d)=>n({query:ur(t),variables:{cartId:p,note:d,numCartLines:e,country:r}}),[n,t,e,r]),l=u.useCallback((p,d)=>n({query:cr(t),variables:{cartId:p,buyerIdentity:d,numCartLines:e,country:r}}),[t,r,n,e]),y=u.useCallback((p,d)=>n({query:lr(t),variables:{cartId:p,attributes:d,numCartLines:e,country:r}}),[t,r,n,e]),m=u.useCallback((p,d)=>n({query:dr(t),variables:{cartId:p,discountCodes:d,numCartLines:e,country:r}}),[t,r,n,e]);return u.useMemo(()=>({cartFetch:o,cartCreate:a,cartLineAdd:s,cartLineUpdate:i,cartLineRemove:c,noteUpdate:h,buyerIdentityUpdate:l,cartAttributesUpdate:y,discountCodesUpdate:m,cartFragment:t}),[o,a,s,i,c,h,l,y,m,t])}function x(e,t){return{entry:[...(t==null?void 0:t.entryActions)||[],K({lastValidCart:r=>r==null?void 0:r.cart}),"onCartActionEntry","onCartActionOptimisticUI",e],on:{RESOLVE:{target:(t==null?void 0:t.resolveTarget)||"idle",actions:[K({prevCart:r=>r==null?void 0:r.lastValidCart,cart:(r,n)=>{var o;return(o=n==null?void 0:n.payload)==null?void 0:o.cart},rawCartResult:(r,n)=>{var o;return(o=n==null?void 0:n.payload)==null?void 0:o.rawCartResult},errors:r=>{}})]},ERROR:{target:(t==null?void 0:t.errorTarget)||"error",actions:[K({prevCart:r=>r==null?void 0:r.lastValidCart,cart:r=>r==null?void 0:r.lastValidCart,errors:(r,n)=>{var o;return(o=n==null?void 0:n.payload)==null?void 0:o.errors}})]},CART_COMPLETED:{target:"cartCompleted",actions:K({prevCart:r=>{},cart:r=>{},lastValidCart:r=>{},rawCartResult:r=>{},errors:r=>{}})}},exit:["onCartActionComplete",...(t==null?void 0:t.exitActions)||[]]}}const ie={CART_FETCH:{target:"cartFetching"},CART_CREATE:{target:"cartCreating"},CART_SET:{target:"idle",actions:[K({rawCartResult:(e,t)=>t.payload.cart,cart:(e,t)=>we(t.payload.cart)})]}},Ke={CARTLINE_ADD:{target:"cartLineAdding"},CARTLINE_UPDATE:{target:"cartLineUpdating"},CARTLINE_REMOVE:{target:"cartLineRemoving"},NOTE_UPDATE:{target:"noteUpdating"},BUYER_IDENTITY_UPDATE:{target:"buyerIdentityUpdating"},CART_ATTRIBUTES_UPDATE:{target:"cartAttributesUpdating"},DISCOUNT_CODES_UPDATE:{target:"discountCodesUpdating"}};function Ar(e){return xe({id:"Cart",initial:e?"idle":"uninitialized",context:{cart:e&&we(e)},states:{uninitialized:{on:ie},cartCompleted:{on:ie},initializationError:{on:ie},idle:{on:{...ie,...Ke}},error:{on:{...ie,...Ke}},cartFetching:x("cartFetchAction",{errorTarget:"initializationError"}),cartCreating:x("cartCreateAction",{errorTarget:"initializationError"}),cartLineRemoving:x("cartLineRemoveAction"),cartLineUpdating:x("cartLineUpdateAction"),cartLineAdding:x("cartLineAddAction"),noteUpdating:x("noteUpdateAction"),buyerIdentityUpdating:x("buyerIdentityUpdateAction"),cartAttributesUpdating:x("cartAttributesUpdateAction"),discountCodesUpdating:x("discountCodesUpdateAction")}})}function vr({numCartLines:e,onCartActionEntry:t,onCartActionOptimisticUI:r,onCartActionComplete:n,data:o,cartFragment:a,countryCode:s}){const{cartFetch:i,cartCreate:c,cartLineAdd:h,cartLineUpdate:l,cartLineRemove:y,noteUpdate:m,buyerIdentityUpdate:p,cartAttributesUpdate:d,discountCodesUpdate:I}=_r({numCartLines:e,cartFragment:a,countryCode:s}),T=u.useMemo(()=>Ar(o),[o]),[w,A,O]=tr(T,{actions:{cartFetchAction:async(g,f)=>{var _;if(f.type!=="CART_FETCH")return;const{data:C,errors:P}=await i((_=f==null?void 0:f.payload)==null?void 0:_.cartId),D=F(f,C==null?void 0:C.cart,P);A(D)},cartCreateAction:async(g,f)=>{var _;if(f.type!=="CART_CREATE")return;const{data:C,errors:P}=await c(f==null?void 0:f.payload),D=F(f,(_=C==null?void 0:C.cartCreate)==null?void 0:_.cart,P);A(D)},cartLineAddAction:async(g,f)=>{var _,v;if(f.type!=="CARTLINE_ADD"||!((_=g==null?void 0:g.cart)!=null&&_.id))return;const{data:C,errors:P}=await h(g.cart.id,f.payload.lines),D=F(f,(v=C==null?void 0:C.cartLinesAdd)==null?void 0:v.cart,P);A(D)},cartLineUpdateAction:async(g,f)=>{var _,v;if(f.type!=="CARTLINE_UPDATE"||!((_=g==null?void 0:g.cart)!=null&&_.id))return;const{data:C,errors:P}=await l(g.cart.id,f.payload.lines),D=F(f,(v=C==null?void 0:C.cartLinesUpdate)==null?void 0:v.cart,P);A(D)},cartLineRemoveAction:async(g,f)=>{var _,v;if(f.type!=="CARTLINE_REMOVE"||!((_=g==null?void 0:g.cart)!=null&&_.id))return;const{data:C,errors:P}=await y(g.cart.id,f.payload.lines),D=F(f,(v=C==null?void 0:C.cartLinesRemove)==null?void 0:v.cart,P);A(D)},noteUpdateAction:async(g,f)=>{var _,v;if(f.type!=="NOTE_UPDATE"||!((_=g==null?void 0:g.cart)!=null&&_.id))return;const{data:C,errors:P}=await m(g.cart.id,f.payload.note),D=F(f,(v=C==null?void 0:C.cartNoteUpdate)==null?void 0:v.cart,P);A(D)},buyerIdentityUpdateAction:async(g,f)=>{var _,v;if(f.type!=="BUYER_IDENTITY_UPDATE"||!((_=g==null?void 0:g.cart)!=null&&_.id))return;const{data:C,errors:P}=await p(g.cart.id,f.payload.buyerIdentity),D=F(f,(v=C==null?void 0:C.cartBuyerIdentityUpdate)==null?void 0:v.cart,P);A(D)},cartAttributesUpdateAction:async(g,f)=>{var _,v;if(f.type!=="CART_ATTRIBUTES_UPDATE"||!((_=g==null?void 0:g.cart)!=null&&_.id))return;const{data:C,errors:P}=await d(g.cart.id,f.payload.attributes),D=F(f,(v=C==null?void 0:C.cartAttributesUpdate)==null?void 0:v.cart,P);A(D)},discountCodesUpdateAction:async(g,f)=>{var _,v;if(f.type!=="DISCOUNT_CODES_UPDATE"||!((_=g==null?void 0:g.cart)!=null&&_.id))return;const{data:C,errors:P}=await I(g.cart.id,f.payload.discountCodes),D=F(f,(v=C==null?void 0:C.cartDiscountCodesUpdate)==null?void 0:v.cart,P);A(D)},...t&&{onCartActionEntry:(g,f)=>{br(f)&&t(g,f)}},...r&&{onCartActionOptimisticUI:K((g,f)=>r(g,f))},...n&&{onCartActionComplete:(g,f)=>{Ir(f)&&n(g,f)}}}});return u.useMemo(()=>[w,A,O],[w,A,O])}function we(e){return{...e,lines:Y(e==null?void 0:e.lines),note:e.note??void 0}}function F(e,t,r){return r?{type:"ERROR",payload:{errors:r,cartActionEvent:e}}:t?{type:"RESOLVE",payload:{cart:we(t),rawCartResult:t,cartActionEvent:e}}:{type:"CART_COMPLETED",payload:{cartActionEvent:e}}}function br(e){return e.type==="CART_CREATE"||e.type==="CARTLINE_ADD"||e.type==="CARTLINE_UPDATE"||e.type==="CARTLINE_REMOVE"||e.type==="NOTE_UPDATE"||e.type==="BUYER_IDENTITY_UPDATE"||e.type==="CART_ATTRIBUTES_UPDATE"||e.type==="DISCOUNT_CODES_UPDATE"}function Ir(e){return e.type==="RESOLVE"||e.type==="ERROR"||e.type==="CART_COMPLETED"}const Xe=u.createContext(null);function z(){const e=u.useContext(Xe);if(!e)throw new Error("Expected a Cart Context, but no Cart Context was found");return e}function wr({children:e,numCartLines:t,onCreate:r,onLineAdd:n,onLineRemove:o,onLineUpdate:a,onNoteUpdate:s,onBuyerIdentityUpdate:i,onAttributesUpdate:c,onDiscountCodesUpdate:h,onCreateComplete:l,onLineAddComplete:y,onLineRemoveComplete:m,onLineUpdateComplete:p,onNoteUpdateComplete:d,onBuyerIdentityUpdateComplete:I,onAttributesUpdateComplete:T,onDiscountCodesUpdateComplete:w,data:A,cartFragment:O=yr,customerAccessToken:g,countryCode:f="US"}){var _t,At,vt,bt,It,wt,Dt;f&&(f=f.toUpperCase());const[C,P]=u.useState(f),[D,_]=u.useState(g),v=u.useRef(!1);(C!==f||D!==g)&&(P(f),_(g),v.current=!1);const[U,L]=vr({numCartLines:t,data:A,cartFragment:O,countryCode:f,onCartActionEntry(S,$){try{switch($.type){case"CART_CREATE":return r==null?void 0:r();case"CARTLINE_ADD":return n==null?void 0:n();case"CARTLINE_REMOVE":return o==null?void 0:o();case"CARTLINE_UPDATE":return a==null?void 0:a();case"NOTE_UPDATE":return s==null?void 0:s();case"BUYER_IDENTITY_UPDATE":return i==null?void 0:i();case"CART_ATTRIBUTES_UPDATE":return c==null?void 0:c();case"DISCOUNT_CODES_UPDATE":return h==null?void 0:h()}}catch(M){console.error("Cart entry action failed",M)}},onCartActionOptimisticUI(S,$){var M,B,N,de;if(!S.cart)return{...S};switch($.type){case"CARTLINE_REMOVE":return{...S,cart:{...S.cart,lines:(B=(M=S==null?void 0:S.cart)==null?void 0:M.lines)==null?void 0:B.filter(R=>(R==null?void 0:R.id)&&!$.payload.lines.includes(R==null?void 0:R.id))}};case"CARTLINE_UPDATE":return{...S,cart:{...S.cart,lines:(de=(N=S==null?void 0:S.cart)==null?void 0:N.lines)==null?void 0:de.map(R=>{const Oe=$.payload.lines.find(({id:bn})=>bn===(R==null?void 0:R.id));return Oe&&Oe.quantity?{...R,quantity:Oe.quantity}:R})}}}return{...S}},onCartActionComplete(S,$){const M=$.payload.cartActionEvent;try{switch($.type){case"RESOLVE":switch(M.type){case"CART_CREATE":return l==null?void 0:l();case"CARTLINE_ADD":return y==null?void 0:y();case"CARTLINE_REMOVE":return m==null?void 0:m();case"CARTLINE_UPDATE":return p==null?void 0:p();case"NOTE_UPDATE":return d==null?void 0:d();case"BUYER_IDENTITY_UPDATE":return kr(S,M)&&(v.current=!0),I==null?void 0:I();case"CART_ATTRIBUTES_UPDATE":return T==null?void 0:T();case"DISCOUNT_CODES_UPDATE":return w==null?void 0:w()}}}catch(B){console.error("onCartActionComplete failed",B)}}}),H=u.useRef(!1),re=U.matches("cartCompleted"),ne=(U.value==="idle"||U.value==="error"||U.value==="cartCompleted")&&f!==((vt=(At=(_t=U==null?void 0:U.context)==null?void 0:_t.cart)==null?void 0:At.buyerIdentity)==null?void 0:vt.countryCode)&&!U.context.errors,Q=u.useRef(!1);u.useEffect(()=>{if(!H.current&&!Q.current){if(!A&&De("localStorage")){Q.current=!0;try{const S=window.localStorage.getItem(Ie);S&&L({type:"CART_FETCH",payload:{cartId:S}})}catch(S){console.warn("error fetching cartId"),console.warn(S)}}H.current=!0}},[A,H,L]),u.useEffect(()=>{!ne||v.current||L({type:"BUYER_IDENTITY_UPDATE",payload:{buyerIdentity:{countryCode:f,customerAccessToken:g}}})},[f,g,ne,v,L]);const b=u.useCallback(S=>{if(!H.current)return console.warn("Cart isn't ready yet");L(S)},[L]);u.useEffect(()=>{var S,$,M;if(($=(S=U==null?void 0:U.context)==null?void 0:S.cart)!=null&&$.id&&De("localStorage"))try{window.localStorage.setItem(Ie,(M=U.context.cart)==null?void 0:M.id)}catch(B){console.warn("Failed to save cartId to localStorage",B)}},[(It=(bt=U==null?void 0:U.context)==null?void 0:bt.cart)==null?void 0:It.id]),u.useEffect(()=>{if(re&&De("localStorage"))try{window.localStorage.removeItem(Ie)}catch(S){console.warn("Failed to delete cartId from localStorage",S)}},[re]);const J=u.useCallback(S=>{var $,M;f&&!(($=S.buyerIdentity)!=null&&$.countryCode)&&(S.buyerIdentity==null&&(S.buyerIdentity={}),S.buyerIdentity.countryCode=f),g&&!((M=S.buyerIdentity)!=null&&M.customerAccessToken)&&(S.buyerIdentity==null&&(S.buyerIdentity={}),S.buyerIdentity.customerAccessToken=g),b({type:"CART_CREATE",payload:S})},[f,g,b]),k=Pr(U),Te=u.useMemo(()=>{var S,$,M,B;return{...((S=k==null?void 0:k.context)==null?void 0:S.cart)??{lines:[],attributes:[]},status:Dr(k.value),error:($=k==null?void 0:k.context)==null?void 0:$.errors,totalQuantity:((B=(M=k==null?void 0:k.context)==null?void 0:M.cart)==null?void 0:B.totalQuantity)??0,cartCreate:J,linesAdd(N){var de,R;(R=(de=k==null?void 0:k.context)==null?void 0:de.cart)!=null&&R.id?b({type:"CARTLINE_ADD",payload:{lines:N}}):J({lines:N})},linesRemove(N){b({type:"CARTLINE_REMOVE",payload:{lines:N}})},linesUpdate(N){b({type:"CARTLINE_UPDATE",payload:{lines:N}})},noteUpdate(N){b({type:"NOTE_UPDATE",payload:{note:N}})},buyerIdentityUpdate(N){b({type:"BUYER_IDENTITY_UPDATE",payload:{buyerIdentity:N}})},cartAttributesUpdate(N){b({type:"CART_ATTRIBUTES_UPDATE",payload:{attributes:N}})},discountCodesUpdate(N){b({type:"DISCOUNT_CODES_UPDATE",payload:{discountCodes:N}})},cartFragment:O}},[J,(wt=k==null?void 0:k.context)==null?void 0:wt.cart,(Dt=k==null?void 0:k.context)==null?void 0:Dt.errors,k.value,O,b]);return u.createElement(Xe.Provider,{value:Te},e)}function Dr(e){switch(e){case"uninitialized":case"initializationError":return"uninitialized";case"idle":case"cartCompleted":case"error":return"idle";case"cartFetching":return"fetching";case"cartCreating":return"creating";case"cartLineAdding":case"cartLineRemoving":case"cartLineUpdating":case"noteUpdating":case"buyerIdentityUpdating":case"cartAttributesUpdating":case"discountCodesUpdating":return"updating"}}function Pr(e){const[t,r]=u.useTransition(),[n,o]=u.useState(e),a=u.useRef(!1);t&&(a.current=!0);const s=u.useRef(!1);return!t&&a.current&&(s.current=!0),u.useEffect(()=>{r(()=>{s.current||o(e)})},[e]),s.current?e:n}function De(e){let t;try{t=window[e];const r="__storage_test__";return t.setItem(r,r),t.removeItem(r),!0}catch(r){return!!(r instanceof DOMException&&(r.code===22||r.code===1014||r.name==="QuotaExceededError"||r.name==="NS_ERROR_DOM_QUOTA_REACHED")&&t&&t.length!==0)}}function kr(e,t){var r,n;return!!(t.payload.buyerIdentity.countryCode&&((n=(r=e.cart)==null?void 0:r.buyerIdentity)==null?void 0:n.countryCode)!==t.payload.buyerIdentity.countryCode)}const ze=u.createContext(null);function Ur({children:e,data:t,initialVariantId:r}){const n=u.useMemo(()=>Y(t.variants??{}),[t.variants]);if(!$r(n))throw new Error("<ProductProvider/> requires 'product.variants.nodes' or 'product.variants.edges'");const o=u.useMemo(()=>Or(n),[n]),[a,s]=u.useState(()=>rt(r,n)),[i,c]=u.useState(()=>nt(a));u.useEffect(()=>{const T=rt(r,n);s(T),c(nt(T))},[r,n]);const h=u.useCallback((T,w)=>{c(A=>{const O={...A,[T]:w};return s(tt(n,O)),O})},[c,n]),l=u.useCallback((T,w)=>{const A=tt(n,{...i,[T]:w});return(A==null?void 0:A.availableForSale)??!0},[i,n]),y=u.useMemo(()=>Y(t.sellingPlanGroups??{}).map(T=>({...T,sellingPlans:Y((T==null?void 0:T.sellingPlans)??{})})),[t.sellingPlanGroups]),[m,p]=u.useState(void 0),d=u.useMemo(()=>{var T,w;if(!(!a||!m)){if(!((T=a.sellingPlanAllocations)!=null&&T.nodes)&&!((w=a.sellingPlanAllocations)!=null&&w.edges))throw new Error("<ProductProvider/>: You must include 'sellingPlanAllocations.nodes' or 'sellingPlanAllocations.edges' in your variants in order to calculate selectedSellingPlanAllocation");return Y(a.sellingPlanAllocations).find(A=>{var O;return((O=A==null?void 0:A.sellingPlan)==null?void 0:O.id)===m.id})}},[a,m]),I=u.useMemo(()=>({product:t,variants:n,variantsConnection:t.variants,options:o,selectedVariant:a,setSelectedVariant:s,selectedOptions:i,setSelectedOption:h,setSelectedOptions:c,isOptionInStock:l,selectedSellingPlan:m,setSelectedSellingPlan:p,selectedSellingPlanAllocation:d,sellingPlanGroups:y,sellingPlanGroupsConnection:t.sellingPlanGroups}),[t,l,o,i,m,d,a,y,h,n]);return u.createElement(ze.Provider,{value:I},e)}function et(){const e=u.useContext(ze);if(!e)throw new Error("'useProduct' must be a child of <ProductProvider />");return e}function tt(e,t){var r,n;if(!(!e.length||((n=(r=e==null?void 0:e[0])==null?void 0:r.selectedOptions)==null?void 0:n.length)!==Object.keys(t).length))return e==null?void 0:e.find(o=>Object.entries(t).every(([a,s])=>{var i;return(i=o==null?void 0:o.selectedOptions)==null?void 0:i.some(c=>(c==null?void 0:c.name)===a&&(c==null?void 0:c.value)===s)}))}function Or(e){const t=e.reduce((r,n)=>{var o;if(!n.selectedOptions)throw new Error("'getOptions' requires 'variant.selectedOptions'");return(o=n==null?void 0:n.selectedOptions)==null||o.forEach(a=>{r[(a==null?void 0:a.name)??""]=r[(a==null?void 0:a.name)??""]||new Set,r[(a==null?void 0:a.name)??""].add((a==null?void 0:a.value)??"")}),r},{});return Object.keys(t).map(r=>({name:r,values:Array.from(t[r])}))}function rt(e,t){if(e){const r=t.find(n=>(n==null?void 0:n.id)===e);return r||console.warn("<ProductProvider/> received a 'initialVariantId' prop, but could not actually find a variant with that ID"),r}if(e===null)return null;if(e===void 0)return t.find(r=>r==null?void 0:r.availableForSale)||t[0]}function nt(e){return e!=null&&e.selectedOptions?e.selectedOptions.reduce((t,r)=>(t[(r==null?void 0:r.name)??""]=(r==null?void 0:r.value)??"",t),{}):{}}function $r(e){return!(!e||!Array.isArray(e))}function pe(e){const{as:t,onClick:r,defaultOnClick:n,children:o,buttonRef:a,...s}=e,i=u.useCallback(h=>{if(r){const l=r(h);if(typeof l=="boolean"&&l===!1||h!=null&&h.defaultPrevented)return}n==null||n(h)},[n,r]),c=t||"button";return u.createElement(c,{ref:a,onClick:i,...s},o)}function Nr(e){const[t,r]=u.useState(!1),{variantId:n,quantity:o=1,attributes:a,sellingPlanId:s,onClick:i,children:c,accessibleAddingToCartLabel:h,...l}=e,{status:y,linesAdd:m}=z(),{selectedVariant:p}=et(),d=n??(p==null?void 0:p.id)??"",I=n===null||d===""||p===null||t||l.disabled;u.useEffect(()=>{t&&y==="idle"&&r(!1)},[y,t]);const T=u.useCallback(()=>{r(!0),m([{quantity:o,merchandiseId:d||"",attributes:a,sellingPlanId:s}])},[m,o,d,a,s]);return V.createElement(V.Fragment,null,V.createElement(pe,{...l,disabled:I,onClick:i,defaultOnClick:T},c),h?V.createElement("p",{style:{position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"},role:"alert","aria-live":"assertive"},t?h:null):null)}const Pe={PAGE_VIEW:"PAGE_VIEW",ADD_TO_CART:"ADD_TO_CART"},Ee={article:"article",blog:"blog",captcha:"captcha",cart:"cart",collection:"collection",customersAccount:"customers/account",customersActivateAccount:"customers/activate_account",customersAddresses:"customers/addresses",customersLogin:"customers/login",customersOrder:"customers/order",customersRegister:"customers/register",customersResetPassword:"customers/reset_password",giftCard:"gift_card",home:"index",listCollections:"list-collections",forbidden:"403",notFound:"404",page:"page",password:"password",product:"product",policy:"policy",search:"search"},ot={hydrogen:"hydrogen",headless:"headless"},it={hydrogen:"6167201",headless:"12875497473"};function ee(e,t){return{schema_id:e,payload:t,metadata:{event_created_at_ms:Date.now()}}}function q(e){const t={id:"",resource:null};if(typeof e!="string")return t;const r=e.match(/^gid:\/\/shopify\/(\w+)\/([^/]+)/);if(!r||r.length===1)return t;const n=r[2]??null,o=r[1]??null;return{id:n,resource:o}}function W(e,t){return typeof e!="object"?{}:(Object.entries(e).forEach(([r,n])=>{n&&(t[r]=n)}),t)}function Mr(e){return typeof document>"u"?(console.error(`${e} should only be used within the useEffect callback or event handlers`),!0):!1}const Vr="trekkie_storefront_page_view/1.4",Rr="myshopify.dev";function Lr(e){const t=e,{id:r,resource:n}=q(t.resourceId),o=n?n.toLowerCase():void 0;return[ee(Vr,W({pageType:t.pageType,customerId:t.customerId,resourceType:o,resourceId:parseInt(r)},xr(t)))]}function xr(e){return{appClientId:e.shopifySalesChannel?it[e.shopifySalesChannel]:it.headless,isMerchantRequest:Fr(e.url),hydrogenSubchannelId:e.storefrontId||"0",isPersistentCookie:e.hasUserConsent,uniqToken:e.uniqueToken,visitToken:e.visitToken,microSessionId:he(),microSessionCount:1,url:e.url,path:e.path,search:e.search,referrer:e.referrer,title:e.title,shopId:parseInt(q(e.shopId).id),currency:e.currency,contentLanguage:e.acceptedLanguage||"en"}}function Fr(e){if(typeof e!="string")return!1;const t=new URL(e).hostname;return t.indexOf(Rr)!==-1||t==="localhost"}const ae="custom_storefront_customer_tracking/1.0",qr="page_rendered",Hr="collection_page_rendered",Br="product_page_rendered",Yr="product_added_to_cart",jr="search_submitted";function Gr(e){const t=e,r={canonical_url:t.canonicalUrl||t.url,customer_id:t.customerId},n=t.pageType,o=[];switch(o.push(ee(ae,W({event_name:qr,...r},se(t)))),n){case Ee.collection:o.push(ee(ae,W({event_name:Hr,...r,collection_name:t.collectionHandle},se(t))));break;case Ee.product:o.push(ee(ae,W({event_name:Br,...r,products:at(t.products),total_value:t.totalValue},se(t))));break;case Ee.search:o.push(ee(ae,W({event_name:jr,...r,search_string:t.searchString},se(t))));break}return o}function Zr(e){const t=e,r=q(t.cartId),n=r!=null&&r.id?`${r.id}`:null;return[ee(ae,W({event_name:Yr,customerId:t.customerId,cart_token:n,total_value:t.totalValue,products:at(t.products)},se(t)))]}function se(e){return{source:e.shopifySalesChannel||ot.headless,hydrogenSubchannelId:e.storefrontId||"0",is_persistent_cookie:e.hasUserConsent,ccpa_enforced:!1,gdpr_enforced:!1,unique_token:e.uniqueToken,event_time:Date.now(),event_id:he(),event_source_url:e.url,referrer:e.referrer,user_agent:e.userAgent,navigation_type:e.navigationType,navigation_api:e.navigationApi,shop_id:parseInt(q(e.shopId).id),currency:e.currency}}function at(e){return e?e.map(t=>{const r=W({variant_gid:t.variantGid,category:t.category,sku:t.sku,product_id:parseInt(q(t.productGid).id),variant_id:parseInt(q(t.variantGid).id)},{product_gid:t.productGid,name:t.name,variant:t.variantName||"",brand:t.brand,price:t.price,quantity:Number(t.quantity||0)});return JSON.stringify(r)}):[]}function Wr(e,t){const{eventName:r,payload:n}=e;if(!n.hasUserConsent)return Promise.resolve();let o=[];if(r===Pe.PAGE_VIEW){const a=n;o=o.concat(Lr(a),Gr(a))}else r===Pe.ADD_TO_CART&&(o=o.concat(Zr(n)));return o.length?Qr(o,t):Promise.resolve()}const st="sendShopifyAnalytics request is unsuccessful";function Qr(e,t){const r={events:e,metadata:{event_sent_at_ms:Date.now()}};try{return fetch(t?`https://${t}/.well-known/shopify/monorail/unstable/produce_batch`:"https://monorail-edge.shopifysvc.com/unstable/produce_batch",{method:"post",headers:{"content-type":"text/plain"},body:JSON.stringify(r)}).then(n=>{if(!n.ok)throw new Error("Response failed");return n.text()}).then(n=>{n&&JSON.parse(n).result.forEach(a=>{a.status!==200&&console.error(st,`
262
262
 
263
- `,a.message)})}).catch(n=>{console.error(st,n)})}catch{return Promise.resolve()}}function Jr(){if(Mr("getClientBrowserParameters"))return{uniqueToken:"",visitToken:"",url:"",path:"",search:"",referrer:"",title:"",userAgent:"",navigationType:"",navigationApi:""};const[e,t]=zr(),r=me(document.cookie);return{uniqueToken:r[j],visitToken:r[G],url:location.href,path:location.pathname,search:location.search,referrer:document.referrer,title:document.title,userAgent:navigator.userAgent,navigationType:e,navigationApi:t}}function Kr(){try{const e=(performance==null?void 0:performance.getEntriesByType)&&(performance==null?void 0:performance.getEntriesByType("navigation"));if(e&&e[0]){const t=window.performance.getEntriesByType("navigation")[0].type;return t&&t.toString()}}catch{}}function Xr(){var e,t;try{if(PerformanceNavigation&&((e=performance==null?void 0:performance.navigation)==null?void 0:e.type)!==null&&((t=performance==null?void 0:performance.navigation)==null?void 0:t.type)!==void 0){const r=performance.navigation.type;switch(r){case PerformanceNavigation.TYPE_NAVIGATE:return"navigate";case PerformanceNavigation.TYPE_RELOAD:return"reload";case PerformanceNavigation.TYPE_BACK_FORWARD:return"back_forward";default:return`unknown: ${r}`}}}catch{}}function zr(){try{let e="PerformanceNavigationTiming",t=Kr();return t||(t=Xr(),e="performance.navigation"),t?[t,e]:["unknown","unknown"]}catch{}return["error","error"]}function en(e){const{cartCreate:t,checkoutUrl:r}=z(),[n,o]=u.useState(!1),{quantity:a,variantId:s,onClick:i,attributes:c,children:h,...l}=e;u.useEffect(()=>{r&&(window.location.href=r)},[r]);const y=u.useCallback(()=>{o(!0),t({lines:[{quantity:a??1,merchandiseId:s,attributes:c}]})},[t,a,s,c]);return u.createElement(pe,{disabled:n??l.disabled,...l,onClick:i,defaultOnClick:y},h)}function tn(e){const[t,r]=u.useState(!1),{status:n,checkoutUrl:o}=z(),{children:a,...s}=e;return u.useEffect(()=>{t&&o&&n==="idle"&&(window.location.href=o)},[t,n,o]),u.createElement(pe,{...s,disabled:t||s.disabled,onClick:()=>r(!0)},a)}function ut(e){const{countryIsoCode:t,languageIsoCode:r}=ge(),n=`${r}-${t}`;if(!n)throw new Error("useMoney(): Unable to get 'locale' from 'useShop()', which means that 'locale' was not passed to '<ShopifyProvider/>'. 'locale' is required for 'useMoney()' to work");const o=parseFloat(e.amount),a=u.useMemo(()=>({style:"currency",currency:e.currencyCode}),[e.currencyCode]),s=te(n,a),i=te(n,{...a,currencyDisplay:"name"}),c=te(n,{...a,currencyDisplay:"narrowSymbol"}),h=te(n,{...a,minimumFractionDigits:0,maximumFractionDigits:0}),l=te(n),y=te(n,{minimumFractionDigits:0,maximumFractionDigits:0}),m=d=>d.type==="currency",p=u.useMemo(()=>({original:()=>e,currencyCode:()=>e.currencyCode,localizedString:()=>s().format(o),parts:()=>s().formatToParts(o),withoutTrailingZeros:()=>o%1===0?h().format(o):s().format(o),withoutTrailingZerosAndCurrency:()=>o%1===0?y().format(o):l().format(o),currencyName:()=>{var d;return((d=i().formatToParts(o).find(m))==null?void 0:d.value)??e.currencyCode},currencySymbol:()=>{var d;return((d=s().formatToParts(o).find(m))==null?void 0:d.value)??e.currencyCode},currencyNarrowSymbol:()=>{var d;return((d=c().formatToParts(o).find(m))==null?void 0:d.value)??""},amount:()=>s().formatToParts(o).filter(d=>["decimal","fraction","group","integer","literal"].includes(d.type)).map(d=>d.value).join("")}),[e,o,i,s,c,l,h,y]);return u.useMemo(()=>new Proxy(p,{get:(d,I)=>{var T;return(T=Reflect.get(d,I))==null?void 0:T.call(null)}}),[p])}function te(e,t){return u.useMemo(()=>{let r;return()=>r??(r=new Intl.NumberFormat(e,t))},[e,t])}function Ce({data:e,as:t,withoutCurrency:r,withoutTrailingZeros:n,measurement:o,measurementSeparator:a="/",...s}){if(!rn(e))throw new Error("<Money/> needs a valid 'data' prop that has 'amount' and 'currencyCode'");const i=ut(e),c=t??"div";let h=i.localizedString;return(r||n)&&(r&&!n?h=i.amount:!r&&n?h=i.withoutTrailingZeros:h=i.withoutTrailingZerosAndCurrency),u.createElement(c,{...s},h,o&&o.referenceUnit&&u.createElement(u.Fragment,null,a,o.referenceUnit))}function rn(e){return typeof e.amount=="string"&&!!e.amount&&typeof e.currencyCode=="string"&&!!e.currencyCode}function nn(e){const{cost:t}=z(),{amountType:r="total",children:n,...o}=e;let a;return r=="total"?a=t==null?void 0:t.totalAmount:r=="subtotal"?a=t==null?void 0:t.subtotalAmount:r=="tax"?a=t==null?void 0:t.totalTaxAmount:r=="duty"&&(a=t==null?void 0:t.totalDutyAmount),a==null?null:u.createElement(Ce,{...o,data:a},n)}const ct=u.createContext(null);function ke(){const e=u.useContext(ct);if(e==null)throw new Error("Expected a cart line context but none was found");return e}function on({children:e,line:t}){return u.createElement(ct.Provider,{value:t},e)}function an(e){const t=ke(),{as:r,...n}=e,o=r||"span";return u.createElement(o,{...n},t.quantity)}function sn(e){const{status:t,linesRemove:r,linesUpdate:n}=z(),o=ke(),{children:a,adjust:s,onClick:i,...c}=e,h=u.useCallback(()=>{if(s==="remove"){r([(o==null?void 0:o.id)??""]);return}const l=s==="decrease"?((o==null?void 0:o.quantity)??0)-1:((o==null?void 0:o.quantity)??0)+1;if(l<=0){r([(o==null?void 0:o.id)??""]);return}const y={id:(o==null?void 0:o.id)??"",quantity:l,attributes:(o==null?void 0:o.attributes)??[]};n([y])},[s,o==null?void 0:o.attributes,o==null?void 0:o.id,o==null?void 0:o.quantity,r,n]);return u.createElement(pe,{...c,onClick:i,defaultOnClick:h,disabled:typeof c.disabled<"u"?c.disabled:t!=="idle"},a)}const un={DateTime:"string",Decimal:"string",HTML:"string",URL:"string",Color:"string",UnsignedInt64:"string"};function lt(e){const{data:t,options:r,id:n=t.id,frameBorder:o="0",allow:a="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:s=!0,loading:i="lazy",...c}=e;if(!t.embedUrl)throw new Error("<ExternalVideo/> requires the 'embedUrl' property");let h=t.embedUrl;if(r){const l=new URL(t.embedUrl);for(const y of Object.keys(r))l.searchParams.set(y,r[y]);h=l.toString()}return u.createElement("iframe",{...c,id:n??t.embedUrl,title:t.alt??t.id??"external video",frameBorder:o,allow:a,allowFullScreen:s,src:h,loading:i})}const cn=`#graphql
263
+ `,a.message)})}).catch(n=>{console.error(st,n)})}catch{return Promise.resolve()}}function Jr(){if(Mr("getClientBrowserParameters"))return{uniqueToken:"",visitToken:"",url:"",path:"",search:"",referrer:"",title:"",userAgent:"",navigationType:"",navigationApi:""};const[e,t]=zr(),r=me(document.cookie);return{uniqueToken:r[j],visitToken:r[G],url:location.href,path:location.pathname,search:location.search,referrer:document.referrer,title:document.title,userAgent:navigator.userAgent,navigationType:e,navigationApi:t}}function Kr(){try{const e=(performance==null?void 0:performance.getEntriesByType)&&(performance==null?void 0:performance.getEntriesByType("navigation"));if(e&&e[0]){const t=window.performance.getEntriesByType("navigation")[0].type;return t&&t.toString()}}catch{}}function Xr(){var e,t;try{if(PerformanceNavigation&&((e=performance==null?void 0:performance.navigation)==null?void 0:e.type)!==null&&((t=performance==null?void 0:performance.navigation)==null?void 0:t.type)!==void 0){const r=performance.navigation.type;switch(r){case PerformanceNavigation.TYPE_NAVIGATE:return"navigate";case PerformanceNavigation.TYPE_RELOAD:return"reload";case PerformanceNavigation.TYPE_BACK_FORWARD:return"back_forward";default:return`unknown: ${r}`}}}catch{}}function zr(){try{let e="PerformanceNavigationTiming",t=Kr();return t||(t=Xr(),e="performance.navigation"),t?[t,e]:["unknown","unknown"]}catch{}return["error","error"]}function en(e){const{cartCreate:t,checkoutUrl:r}=z(),[n,o]=u.useState(!1),{quantity:a,variantId:s,onClick:i,attributes:c,children:h,...l}=e;u.useEffect(()=>{n&&r&&(window.location.href=r)},[n,r]);const y=u.useCallback(()=>{o(!0),t({lines:[{quantity:a??1,merchandiseId:s,attributes:c}]})},[t,a,s,c]);return u.createElement(pe,{disabled:n??l.disabled,...l,onClick:i,defaultOnClick:y},h)}function tn(e){const[t,r]=u.useState(!1),{status:n,checkoutUrl:o}=z(),{children:a,...s}=e;return u.useEffect(()=>{t&&o&&n==="idle"&&(window.location.href=o)},[t,n,o]),u.createElement(pe,{...s,disabled:t||s.disabled,onClick:()=>r(!0)},a)}function ut(e){const{countryIsoCode:t,languageIsoCode:r}=ge(),n=`${r}-${t}`;if(!n)throw new Error("useMoney(): Unable to get 'locale' from 'useShop()', which means that 'locale' was not passed to '<ShopifyProvider/>'. 'locale' is required for 'useMoney()' to work");const o=parseFloat(e.amount),a=u.useMemo(()=>({style:"currency",currency:e.currencyCode}),[e.currencyCode]),s=te(n,a),i=te(n,{...a,currencyDisplay:"name"}),c=te(n,{...a,currencyDisplay:"narrowSymbol"}),h=te(n,{...a,minimumFractionDigits:0,maximumFractionDigits:0}),l=te(n),y=te(n,{minimumFractionDigits:0,maximumFractionDigits:0}),m=d=>d.type==="currency",p=u.useMemo(()=>({original:()=>e,currencyCode:()=>e.currencyCode,localizedString:()=>s().format(o),parts:()=>s().formatToParts(o),withoutTrailingZeros:()=>o%1===0?h().format(o):s().format(o),withoutTrailingZerosAndCurrency:()=>o%1===0?y().format(o):l().format(o),currencyName:()=>{var d;return((d=i().formatToParts(o).find(m))==null?void 0:d.value)??e.currencyCode},currencySymbol:()=>{var d;return((d=s().formatToParts(o).find(m))==null?void 0:d.value)??e.currencyCode},currencyNarrowSymbol:()=>{var d;return((d=c().formatToParts(o).find(m))==null?void 0:d.value)??""},amount:()=>s().formatToParts(o).filter(d=>["decimal","fraction","group","integer","literal"].includes(d.type)).map(d=>d.value).join("")}),[e,o,i,s,c,l,h,y]);return u.useMemo(()=>new Proxy(p,{get:(d,I)=>{var T;return(T=Reflect.get(d,I))==null?void 0:T.call(null)}}),[p])}function te(e,t){return u.useMemo(()=>{let r;return()=>r??(r=new Intl.NumberFormat(e,t))},[e,t])}function Ce({data:e,as:t,withoutCurrency:r,withoutTrailingZeros:n,measurement:o,measurementSeparator:a="/",...s}){if(!rn(e))throw new Error("<Money/> needs a valid 'data' prop that has 'amount' and 'currencyCode'");const i=ut(e),c=t??"div";let h=i.localizedString;return(r||n)&&(r&&!n?h=i.amount:!r&&n?h=i.withoutTrailingZeros:h=i.withoutTrailingZerosAndCurrency),u.createElement(c,{...s},h,o&&o.referenceUnit&&u.createElement(u.Fragment,null,a,o.referenceUnit))}function rn(e){return typeof e.amount=="string"&&!!e.amount&&typeof e.currencyCode=="string"&&!!e.currencyCode}function nn(e){const{cost:t}=z(),{amountType:r="total",children:n,...o}=e;let a;return r=="total"?a=t==null?void 0:t.totalAmount:r=="subtotal"?a=t==null?void 0:t.subtotalAmount:r=="tax"?a=t==null?void 0:t.totalTaxAmount:r=="duty"&&(a=t==null?void 0:t.totalDutyAmount),a==null?null:u.createElement(Ce,{...o,data:a},n)}const ct=u.createContext(null);function ke(){const e=u.useContext(ct);if(e==null)throw new Error("Expected a cart line context but none was found");return e}function on({children:e,line:t}){return u.createElement(ct.Provider,{value:t},e)}function an(e){const t=ke(),{as:r,...n}=e,o=r||"span";return u.createElement(o,{...n},t.quantity)}function sn(e){const{status:t,linesRemove:r,linesUpdate:n}=z(),o=ke(),{children:a,adjust:s,onClick:i,...c}=e,h=u.useCallback(()=>{if(s==="remove"){r([(o==null?void 0:o.id)??""]);return}const l=s==="decrease"?((o==null?void 0:o.quantity)??0)-1:((o==null?void 0:o.quantity)??0)+1;if(l<=0){r([(o==null?void 0:o.id)??""]);return}const y={id:(o==null?void 0:o.id)??"",quantity:l,attributes:(o==null?void 0:o.attributes)??[]};n([y])},[s,o==null?void 0:o.attributes,o==null?void 0:o.id,o==null?void 0:o.quantity,r,n]);return u.createElement(pe,{...c,onClick:i,defaultOnClick:h,disabled:typeof c.disabled<"u"?c.disabled:t!=="idle"},a)}const un={DateTime:"string",Decimal:"string",HTML:"string",URL:"string",Color:"string",UnsignedInt64:"string"};function lt(e){const{data:t,options:r,id:n=t.id,frameBorder:o="0",allow:a="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:s=!0,loading:i="lazy",...c}=e;if(!t.embedUrl)throw new Error("<ExternalVideo/> requires the 'embedUrl' property");let h=t.embedUrl;if(r){const l=new URL(t.embedUrl);for(const y of Object.keys(r))l.searchParams.set(y,r[y]);h=l.toString()}return u.createElement("iframe",{...c,id:n??t.embedUrl,title:t.alt??t.id??"external video",frameBorder:o,allow:a,allowFullScreen:s,src:h,loading:i})}const cn=`#graphql
264
264
  fragment Image on Image {
265
265
  altText
266
266
  url