import{jsxs as e,jsx as r}from"react/jsx-runtime";import{createStyle as o,createClass as t}from"@gem-sdk/system";import{getWrapperStyles as s,getContainerStyles as i,getTextStyle as d}from"../common/styles.js";import{getWrapperClassName as m,getCheckboxContainerClassName as c,getLinkComponentClassName as l,getLinkComponentStyles as n}from"../common/classes.js";import{getComponentTag as a}from"../common/helpers.js";import{useRenderMode as u,useProduct as h,usePageStore as p,filterToolbarPreview as y}from"@gem-sdk/core";import f from"./PostPurchaseCheckbox.js";import{useBuyerConsentChecked as b}from"../hooks/useBuyerConsentChecked.js";let COMPONENT_ID_PREFIX="buyer-consent-product",BuyerConsent=({styles:k,builderProps:C,setting:g,builderAttrs:j,style:N,children:x})=>{let{isEditMode:P}=u(),v=h(),{checked:B,setChecked:_}=b(),E=p(e=>e.subscriptionVisible),{description:F,policyLabel:I,policyLink:O,align:$}=g??{},D=v?.id?`buyer-consent-product-${C?.uid}-${v.id}`:void 0,M=a(O),R=o(s({styles:k})),T=t(m({align:$,uid:C?.uid})),V=o(i({styles:k})),X=t(c()),q=o(d({styles:k})),w=t(l()),z=o(n()),A=e=>{_(e.target.checked)},G=!P&&!E?.[v?.id??""]?.length;return G?null:e("div",{...j,style:{...N},children:[r("div",{"data-id":C?.uid,style:R,className:T,children:e("label",{htmlFor:D,dir:k?.direction??"ltr",style:V,className:X,children:[r(f,{id:D,name:D,type:"checkbox",checked:B,onChange:A}),e("bdo",{dir:k?.direction??"ltr",style:q,children:[F," ",r(M,{target:"_blank",rel:"noreferrer",href:O,className:w,style:z,children:I})]})]})}),y(x,!0)]})};export{BuyerConsent as default};
