System.register(["./sanitize-legacy.7fed1f66.js"],function(e,t){"use strict";var c,o,n,a,r,s,i;return{setters:[e=>{c=e.a,o=e.s,n=e.u,a=e.d,r=e.W,s=e.V,i=e.b}],execute:function(){e({a:function(){const{registerPlugin:e}=wp.plugins;e("acfw-coupons-summary",{render:f,scope:"woocommerce-checkout"})},i:function(){acfwfObj.components=u,acfwfObj.wc=d,acfwfObj.utils=t},r:function(){const{registerPlugin:e}=wp.plugins;e("acfwf-notices",{render:R,scope:"woocommerce-checkout"})}});const t={debounce:(e,t)=>{let c;return function(...o){clearTimeout(c),c=setTimeout(()=>e(...o),t)}},hasBOGOCoupon:()=>!!c.getCartData().coupons.filter(e=>"acfw_bogo"===e.discount_type).length,sanitizeHtml:o},l=e=>{const{label:t,value:c,children:n}=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:o(c)}})),React.createElement("div",{className:"wc-block-components-totals-item__description"},n)))},u={Accordion:e=>{const{useState:t,useEffect:c,useRef:o}=wp.element,{title:n,children:a,caret_img_src:r,auto_display_store_credits_redeem_form:s}=e,[i,l]=t(!1),u=o(null),m=()=>{if(l(!i),u.current){let e=u.current.style.maxHeight;e=parseInt(e.replace("px","")),e=e>0?0:u.current.scrollHeight,u.current.style.maxHeight=`${e}px`}};return c(()=>{"yes"===s&&(l(!0),m())},[s]),React.createElement("div",{className:"acfw-accordion"},React.createElement("div",{className:"acfw-accordion acfw-store-credits-checkout-ui "+(i?"show":"")},React.createElement("h3",{onClick:m},React.createElement("span",{className:"acfw-accordion-title"},n),(()=>{if(r)return React.createElement("span",{className:"caret"},React.createElement("img",{src:r}))})()),React.createElement("div",{className:"acfw-accordion-inner",ref:u},React.createElement("div",{className:"acfw-accordion-content"},a))))},OrderSummarySubtotalBlock:l},{extensionCartUpdate:m}=wc.blocksCheckout,d={dummyUpdateCart:()=>m({namespace:"acfwf_dummy_update",data:{}})},f=()=>{const e=n(e=>{var t;const c=e("wc/store/cart").getCartData(),{acfwf_block:o}=c.extensions;return o&&o.couponSummaries&&null!==(t=o.couponSummaries)&&void 0!==t?t:[]}),{ExperimentalDiscountsMeta:t}=wc.blocksCheckout;return e.length?React.createElement(t,null,e.map(e=>React.createElement(l,{label:e.coupon_code},React.createElement("div",{className:"acfwf-bogo-discount-summary-block",dangerouslySetInnerHTML:{__html:o(e.content)}})))):null},_="wc/checkout",p="wc/cart",w="core/notices",g={ACFWF_NOTICE_BOGO:"ACFWF_NOTICE_BOGO",ACFWF_NOTICE_CART_CONDITIONS:"ACFWF_NOTICE_CART_CONDITIONS",ACFWF_NOTICE_STORE_CREDIT:"ACFWF_NOTICE_STORE_CREDIT"},C=e=>{let t=document.createElement("div");return t.innerHTML=e,t.textContent||t.innerText},E=e("c",{integration:"acfwf-wc-checkout-block"}),{wcSettings:b}=wc,h=e("g",e=>b.getSetting(`${e}_data`)),O=jQuery,N=()=>{const e=O(".acfw-checkout-ui-block"),t=e.find(".acfw-store-credits-checkout-ui"),c=e.find("h3");t.hasClass("show")||c.trigger("click"),setTimeout(function(){var t;window.scroll({top:null==e||null===(t=e.offset())||void 0===t?void 0:t.top,behavior:"smooth"}),e.find("input").trigger("focus")},400)};function k(){const e=n(e=>e(r).getHasCalculatedShipping()),{store_credits:t}=h(E.integration);if(!t)return null;const{apply_type:o,notice_store_credits_text:s}=t,{acfwf_block:i}=c.getCartData().extensions;"coupon"!==o&&e&&i.store_credits.notice&&(e=>{setTimeout(function(){a(w).createNotice("error",e,{context:_,id:g.ACFWF_NOTICE_STORE_CREDIT}),O(".acfw-reapply-sc-discount").on("click",N)},400)})(s)}const T=[p,_],R=()=>{T.forEach(e=>{a(w).removeNotices(Object.values(g).filter(e=>e),e)}),function(){const e=n(e=>e(r).getCartErrors()),t=n(e=>e(s).getValidationError("coupon")),c=e.find(e=>{return"woocommerce_rest_cart_coupon_error"===e.code&&(t=e.message,/<[^>]+>|&[a-z]+;/i.test(t));var t});if(c&&t){a(s).setValidationErrors({coupon:{message:" ",hidden:!1}});const e=c.message||"";a(w).createNotice("error",C(e),{context:p,id:g.ACFWF_NOTICE_CART_CONDITIONS})}}(),function(){const e=n(e=>e(r).getCartData()),{dummyUpdateCart:t}=acfwfObj.wc,c=i(r).isApplyingCoupon(),o=i(r).isRemovingCoupon();(c||o)&&t();const{acfwf_block:s}=e.extensions;if(!s||!s.bogo_deals)return null;const l=s.bogo_deals;l&&l.forEach(e=>{a(w).createNotice("info",C(e),{context:p,id:g.ACFWF_NOTICE_BOGO})})}(),k()}}}});
