import{a as n}from"https://cdn.shopify.com/oxygen-v2/26324/10616/21935/1653405/build/_shared/chunk-6P2OMZAG.js";var u=`#graphql query CartQuery($cartId: ID!, $country: CountryCode, $language: LanguageCode) @inContext(country: $country, language: $language) { cart(id: $cartId) { ...CartFragment } } fragment CartFragment on Cart { id checkoutUrl totalQuantity buyerIdentity { ...BuyerIdentity } lines(first: 100) { edges { node { id quantity attributes { key value } cost { totalAmount { amount currencyCode } amountPerQuantity { amount currencyCode } compareAtAmountPerQuantity { amount currencyCode } } sellingPlanAllocation { sellingPlan { id name } priceAdjustments { price { amount } compareAtPrice { amount } perDeliveryPrice { amount } } } merchandise { ... MerchandiseCartLine } } } } cost { subtotalAmount { ...MoneyFragment } totalAmount { ...MoneyFragment } totalDutyAmount { ...MoneyFragment } totalTaxAmount { ...MoneyFragment } } note attributes { key value } discountCodes { code } } fragment MoneyFragment on MoneyV2 { currencyCode amount } fragment ImageFragment on Image { id url altText width height } fragment BuyerIdentity on CartBuyerIdentity { countryCode customer { id email firstName lastName displayName } email phone purchasingCompany { company { name id } location { id name } } } fragment MerchandiseCartLine on ProductVariant { id quantityAvailable availableForSale quantityRule { maximum minimum increment } compareAtPrice { ...MoneyFragment } price { ...MoneyFragment } requiresShipping title image { ...ImageFragment } sku taxable product { totalInventory handle title id tags options { name } freeProducts: metafield(namespace: "custom", key: "free_products") { value type } } selectedOptions { name value } sellingPlanAllocations(first:10) { edges { node { sellingPlan { id name options { name value } } priceAdjustments { price { amount currencyCode } compareAtPrice { amount currencyCode } perDeliveryPrice { amount currencyCode } unitPrice { amount currencyCode } } } } } } `,o=`#graphql fragment ErrorFragment on CartUserError { message field code } `,i=`#graphql fragment CartLinesFragment on Cart { id totalQuantity lines(first: 100) { edges { node { id quantity merchandise { ...on ProductVariant { id product { id } } } } } } } `,c=`#graphql mutation ($input: CartInput!, $country: CountryCode = ZZ, $language: LanguageCode) @inContext(country: $country, language: $language) { cartCreate(input: $input) { cart { ...CartLinesFragment checkoutUrl } errors: userErrors { ...ErrorFragment } } } ${i} ${o} `,d=`#graphql mutation ($cartId: ID!, $lines: [CartLineInput!]!, $country: CountryCode = ZZ, $language: LanguageCode) @inContext(country: $country, language: $language) { cartLinesAdd(cartId: $cartId, lines: $lines) { cart { ...CartLinesFragment } errors: userErrors { ...ErrorFragment } } } ${i} ${o} `,s=`#graphql ${i} ${o} mutation ($cartId: ID!, $lines: [CartLineUpdateInput!]!, $language: LanguageCode, $country: CountryCode) @inContext(country: $country, language: $language) { cartLinesUpdate(cartId: $cartId, lines: $lines) { cart { ...CartLinesFragment } errors: userErrors { ...ErrorFragment } } } `,m=`#graphql mutation ($cartId: ID!, $lineIds: [ID!]!, $language: LanguageCode, $country: CountryCode) @inContext(country: $country, language: $language) { cartLinesRemove(cartId: $cartId, lineIds: $lineIds) { cart { id totalQuantity lines(first: 100) { edges { node { id quantity merchandise { ...on ProductVariant { id product { id } } } } } } } errors: userErrors { message field code } } } `,l=`#graphql mutation( $cartId: ID! $buyerIdentity: CartBuyerIdentityInput! $country: CountryCode = ZZ $language: LanguageCode ) @inContext(country: $country, language: $language) { cartBuyerIdentityUpdate(cartId: $cartId, buyerIdentity: $buyerIdentity) { cart { id buyerIdentity { email phone countryCode } } errors: userErrors { message field code } } } `;var C={getCart:async({storefront:t},r)=>{if(!t)throw new Error("missing storefront client in cart query");let{cart:e}=await t.query(u,{variables:{cartId:r,country:t.i18n.country,language:t.i18n.language},cache:t.CacheNone()});return e},cartCreate:async({input:t,storefront:r})=>{let{cartCreate:e}=await r.mutate(c,{variables:{input:t}});return n(e,"No data returned from cartCreate mutation"),e},cartAdd:async({cartId:t,lines:r,storefront:e})=>{let{cartLinesAdd:a}=await e.mutate(d,{variables:{cartId:t,lines:r}});return n(a,"No data returned from cartLinesAdd mutation"),a},cartRemove:async({cartId:t,lineIds:r,storefront:e})=>{let{cartLinesRemove:a}=await e.mutate(m,{variables:{cartId:t,lineIds:r}});return n(a,"No data returned from remove lines mutation"),a},cartUpdate:async({cartId:t,lines:r,storefront:e})=>{let{cartLinesUpdate:a}=await e.mutate(s,{variables:{cartId:t,lines:r}});return n(a,"No data returned from update lines items mutation"),a},cartUpdateBuyerIdentity:async({cartId:t,buyerIdentity:r,storefront:e})=>{let{cartBuyerIdentityUpdate:a}=await e.mutate(l,{variables:{cartId:t,buyerIdentity:r}}).catch(console.error);return n(a,"No data returned from cart buyer identity update mutation"),a}};export{C as a};