import{aw as e,hF as t}from"./4b4bc88f.z1yoAwwH.js";function n(e){return null!=e&&"merchandiseLine"in e}function s(e){return null==e||"merchandiseLine"in e?void 0:e}function r(e){return i(e.discount)}function i(e){return"code"===e.type||"automatic"===e.type||"custom"===e.type}var o=(e=>(e.Ddp="DDP",e.Dap="DAP",e.Ddu="DDU",e.Unsupported="UNSUPPORTED",e))(o||{}),u=(e=>(e.BuyerConfigured="Buyer Configured",e.DefaultDuties="Default Duties and Taxes",e.DutyAndTaxInclusive="Duty and Tax Inclusive Pricing",e.DutyInclusive="Duty Inclusive Pricing",e.ErrorOccured="Error Occured",e.FlowConfigured="Flow Configured",e.LowValueGoodsFallback="Low Value Goods Taxes Apply",e.PreConfigured="Pre-configured",e.UnsupportedRegion="Unsupported Region",e))(u||{});const c=/[\w-]+/,a=/\d+/;function f(e,t,n=c){return"string"==typeof e&&new RegExp(`^gid://shopify/${t}/${n.source}$`).test(e)}function d(e,t,n={}){const s=`gid://shopify/${e}/${t}`;return 0===Object.keys(n).length?s:`${s}?${new URLSearchParams(n).toString()}`}function p(e){return e.reduce((e,{cost:t,costBeforeDiscounts:n})=>({priceBeforeDiscounts:e.priceBeforeDiscounts+n,priceAfterDiscounts:e.priceAfterDiscounts+t}),{priceBeforeDiscounts:0,priceAfterDiscounts:0})}function D(e,n=e=>e.amountCombinabilityToken??void 0){if(!e.some(e=>n(e)))return p(e);const s=t(e,e=>e.costBeforeDiscounts,n);return e.reduce((e,t,n)=>s.has(n)?e:{priceBeforeDiscounts:e.priceBeforeDiscounts+t.costBeforeDiscounts,priceAfterDiscounts:e.priceAfterDiscounts+t.cost},{priceBeforeDiscounts:0,priceAfterDiscounts:0})}function l(e){return!!r(e)&&e.allocations.some(e=>"DELIVERYLINE"===e.target.type)}function g(e,t){return e?e.filter(e=>!!r(e)&&e.allocations.some(e=>"DELIVERYLINE"===e.target.type&&null!=e.target.index&&t.has(e.target.index))):[]}function y(t,n){const s=new Set,r=new Set;return t&&"filled"===t.status&&t.lines.forEach((t,n)=>{if("available"!==t.status)return;const i=e(t);i&&("PICK_UP"===i.methodType?r.add(n):s.add(n))}),{shippingDiscountLines:g(n,s),pickupDiscountLines:g(n,r)}}export{a as G,o as I,n as a,r as b,i as c,D as d,d as e,s as f,l as g,y as h,f as i,u as j,p as s};