import{m as u}from"./shop-pay-FullScreenBackground.C1_sL6Wu.js";function m(t){return!t||t.__typename!=="TipWrapper"?[]:t.tipSuggestions.map(e=>({percentage:e.percentage,amount:u(e.amount)}))}function l(t){return!t||t.__typename!=="TipWrapper"||!t.terms||t.terms.__typename!=="FilledTipTerms"?[]:t.terms.tipLines.map(o).filter(e=>!!e)}function o(t){if(t.__typename==="TipLine")return{amount:u(t.amount)}}function g(t){return t?.map(({amount:e})=>({amount:{value:{amount:e.amount.toString(),currencyCode:e.currencyCode}}}))??[]}function p(t,e,n){return t?.length&&t.every(({amount:{currencyCode:r}})=>r===n?.presentmentCurrency)?t:e??[]}function f(t,e,n){return{message:e??t.note??null,customAttributes:n?.map(({...r})=>r)??t.customAttributes?.map(r=>({key:r.key,value:r.value}))??[]}}function d(t){if(!(!t.message||t.__typename!=="Note"))return t.message}function c(t){return t.__typename!=="Note"?[]:t.customAttributes?.map(({__typename:e,...n})=>n)}function L(t){return{signature:t.signature??void 0,contents:t.contents.map(e=>({signature:e.signature,targetTerms:e.targetTerms,targetLine:e.targetLine===void 0?void 0:{allLines:e.targetLine?.allLines??!1,index:e.targetLine?.index},attributes:e.attributes}))}}function _(t){return{signature:t.signature,contents:t.contents.map(e=>({signature:e.signature,targetTerms:e.targetTerms,targetLine:e.targetLine===void 0||e.targetLine===null?void 0:{allLines:e.targetLine.allLines,index:e.targetLine.index},attributes:e.attributes}))}}function F(t,e){if(!t||t.__typename!=="AllocatedAlternativePaymentCurrencyTotal"||!e?.lines)return;const n=e.lines.flatMap(a=>a.method.type==="giftCard"?[a.stableId]:[]),r=t.paymentLineAllocations.reduce((a,i)=>n.includes(i.stableId)?a:a+parseFloat(i.amount.amount),0);return{total:u(t.total),totalWithoutGiftCards:u({amount:r.toString(),currencyCode:t.total.currencyCode,__typename:"Money"})}}function y(t){if(t)return{total:{amount:t.total.amount.toString(),currencyCode:t.total.currencyCode}}}export{y as a,f as b,m as c,l as d,F as e,_ as f,c as g,d as h,p as i,L as n,g as t};
