import{u as o,M as e,m as n}from"./2c1ab0fe.Dbn2KvkT.js";import{s as a,L as t,I as r,t as s}from"./164ad2e3.FTBuhkTQ.js";import{d as i,z as c,C as l,F as d,G as u}from"./4b4bc88f.z1yoAwwH.js";function m(o,e){const n=e.translations.get(o);return Boolean(n&&""!==n.toString().trim())}const p=s("legal-link-modal");function h({handle:n,tone:s}){const{embed:d,i18n:u,shop:{merchantPolicies:m}}=i(),h=u.translate("shop_policies",{scope:n.replace(/-/g,"_")}),{localPolicies:f}=c(),g=m.some(o=>o.handle===n)?f.find(o=>o.handle===n):void 0,b=a(void 0,p);return g?.url&&l(d?.embedder)?o(t,{tone:s,"aria-haspopup":"dialog",onClick:()=>{d?.client?.windowOpenRequest(g.url)},children:h}):o(e,g?{children:[o(t,{commandFor:b,tone:s,children:h}),o(r,{id:b,defaultPolicy:g})]}:{children:h})}function f(){const{shop:o,source:e,checkout:{negotiator:a}}=i(),t=a.current.fields.buyerIdentity;return n(()=>Boolean(o.customerAccountLocationsUrl&&"draftOrder"!==e.type&&!d(e)&&u(t.value?.purchasingCompany)))}export{h as L,m as h,f as u};