1import{c as b,s as C,u,d as m,W as l,V as T,b as h}from"./sanitize.e37d93cf.js";const A=(e,t)=>{let c;return function(...o){clearTimeout(c),c=setTimeout(()=>e(...o),t)}},F="acfw_bogo",v=()=>!!b.getCartData().coupons.filter(t=>t.discount_type===F).length,x={debounce:A,hasBOGOCoupon:v,sanitizeHtml:C},D=e=>{const{useState:t,useEffect:c,useRef:o}=wp.element,{title:n,children:s,caret_img_src:a,auto_display_store_credits_redeem_form:g}=e,[E,w]=t(!1),r=o(null),O=()=>{if(w(!E),r.current){let i=r.current.style.maxHeight;i=parseInt(i.replace("px","")),i=i>0?0:r.current.scrollHeight,r.current.style.maxHeight="".concat(i,"px")}},y=()=>{if(a)return React.createElement("span",{className:"caret"},React.createElement("img",{src:a}))};return c(()=>{g==="yes"&&(w(!0),O())},[g]),React.createElement("div",{className:"acfw-accordion"},React.createElement("div",{className:"acfw-accordion acfw-store-credits-checkout-ui ".concat(E?"show":"")},React.createElement("h3",{onClick:O},React.createElement("span",{className:"acfw-accordion-title"},n),y()),React.createElement("div",{className:"acfw-accordion-inner",ref:r},React.createElement("div",{className:"acfw-accordion-content"},s))))},k=e=>{const{label:t,value:c,children:o}=e;return React.createElement("div",{className:"wp-block-woocommerce-checkout-order-summary-subtotal-block wc-block-components-totals-wrapper"},React.createElement("div",{className:"wc-block-components-totals-item"},React.createElement("span",{className:"wc-block-components-totals-item__label"},t),React.createElement("span",{className:"wc-block-components-totals-item__value"},React.createElement("div",{dangerouslySetInnerHTML:{__html:C(c)}})),React.createElement("div",{className:"wc-block-components-totals-item__description"},o)))},W={Accordion:D,OrderSummarySubtotalBlock:k},{extensionCartUpdate:H}=wc.blocksCheckout,B=()=>H({namespace:"acfwf_dummy_update",data:{}}),L={dummyUpdateCart:B};function Z(){acfwfObj.components=W,acfwfObj.wc=L,acfwfObj.utils=x}const G=()=>{const e=u(c=>{var s;const o=c("wc/store/cart").getCartData(),{acfwf_block:n}=o.extensions;return!n||!n.couponSummaries?[]:(s=n.couponSummaries)!=null?s:[]}),{ExperimentalDiscountsMeta:t}=wc.blocksCheckout;return e.length?React.createElement(t,null,e.map(c=>React.createElement(k,{label:c.coupon_code},React.createElement("div",{className:"acfwf-bogo-discount-summary-block",dangerouslySetInnerHTML:{__html:C(c.content)}})))):null};function ee(){const{registerPlugin:e}=wp.plugins;e("acfw-coupons-summary",{render:G,scope:"woocommerce-checkout"})}const S="wc/checkout",_="wc/cart",d="core/notices",p={ACFWF_NOTICE_BOGO:"ACFWF_NOTICE_BOGO",ACFWF_NOTICE_CART_CONDITIONS:"ACFWF_NOTICE_CART_CONDITIONS",ACFWF_NOTICE_STORE_CREDIT:"ACFWF_NOTICE_STORE_CREDIT"},I=e=>{let t=document.createElement("div");return t.innerHTML=e,t.textContent||t.innerText},M=e=>/<[^>]+>|&[a-z]+;/i.test(e),P=e=>e.find(t=>t.code==="woocommerce_rest_cart_coupon_error"&&M(t.message));function j(){const e=u(o=>o(l).getCartErrors()),t=u(o=>o(T).getValidationError("coupon")),c=P(e);if(c){t&&m(T).setValidationErrors({coupon:{message:" ",hidden:!1}});const o=c.message||"";m(d).createNotice("error",I(o),{context:_,id:p.ACFWF_NOTICE_CART_CONDITIONS})}}function U(){const e=u(a=>a(l).getCartData()),{dummyUpdateCart:t}=acfwfObj.wc,c=h(l).isApplyingCoupon(),o=h(l).isRemovingCoupon();(c||o)&&t();const{acfwf_block:n}=e.extensions;
1if(!n||!n.bogo_deals)return null;const s=n.bogo_deals;s&&s.forEach(a=>{m(d).createNotice("info",I(a),{context:_,id:p.ACFWF_NOTICE_BOGO})})}const V="acfwf-wc-checkout-block",$={integration:V},{wcSettings:K}=wc,Y=e=>K.getSetting("".concat(e,"_data")),f=jQuery,N='.wc-block-components-notice-banner a[href="#acfw-reapply-sc-discount"]',z=e=>{f(document).off("click",N,R),f(document).on("click",N,R),setTimeout(function(){m(d).createNotice("error",e,{context:S,id:p.ACFWF_NOTICE_STORE_CREDIT})},400)},R=e=>{e.preventDefault();const t=f(".acfw-checkout-ui-block"),c=t.find(".acfw-store-credits-checkout-ui"),o=t.find("h3");c.hasClass("show")||o.trigger("click"),setTimeout(function(){var s;window.scroll({top:(s=t==null?void 0:t.offset())==null?void 0:s.top,behavior:"smooth"}),t.find("input").trigger("focus")},400)};function Q(){const e=u(s=>s(l).getHasCalculatedShipping()),{store_credits:t}=Y($.integration);if(!t)return null;const{apply_type:c,notice_store_credits_text:o}=t,{acfwf_block:n}=b.getCartData().extensions;c!=="coupon"&&e&&n.store_credits.notice&&z(o)}const X=[_,S],q=()=>{X.forEach(e=>{m(d).removeNotices(Object.values(p).filter(t=>t),e)}),j(),U(),Q()};function te(){const{registerPlugin:e}=wp.plugins;e("acfwf-notices",{render:q,scope:"woocommerce-checkout"})}export{F as A,ee as a,$ as c,Y as g,Z as i,te as r};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.