geno/wp-content/plugins/woocommerce/packages/woocommerce-blocks/build/checkout-blocks/order-summary-discount-frontend.js

14 lines
61 KiB
JavaScript
Raw Normal View History

2024-02-01 17:24:18 +05:30
(self.webpackChunkwebpackWcBlocksJsonp=self.webpackChunkwebpackWcBlocksJsonp||[]).push([[6262],{8184:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var o=n(9196),r=n(444);const a=(0,o.createElement)(r.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,o.createElement)(r.Path,{d:"M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"}))},5202:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var o=n(9196),r=n(444);const a=(0,o.createElement)(r.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,o.createElement)(r.Path,{d:"M13 11.8l6.1-6.3-1-1-6.1 6.2-6.1-6.2-1 1 6.1 6.3-6.5 6.7 1 1 6.5-6.6 6.5 6.6 1-1z"}))},5430:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var o=n(9196),r=n(444);const a=(0,o.createElement)(r.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,o.createElement)(r.Path,{d:"M12 3.2c-4.8 0-8.8 3.9-8.8 8.8 0 4.8 3.9 8.8 8.8 8.8 4.8 0 8.8-3.9 8.8-8.8 0-4.8-4-8.8-8.8-8.8zm0 16c-4 0-7.2-3.3-7.2-7.2C4.8 8 8 4.8 12 4.8s7.2 3.3 7.2 7.2c0 4-3.2 7.2-7.2 7.2zM11 17h2v-6h-2v6zm0-8h2V7h-2v2z"}))},5045:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var o=n(9196),r=n(444);const a=(0,o.createElement)(r.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,o.createElement)(r.Path,{fillRule:"evenodd",d:"M6.863 13.644L5 13.25h-.5a.5.5 0 01-.5-.5v-3a.5.5 0 01.5-.5H5L18 6.5h2V16h-2l-3.854-.815.026.008a3.75 3.75 0 01-7.31-1.549zm1.477.313a2.251 2.251 0 004.356.921l-4.356-.921zm-2.84-3.28L18.157 8h.343v6.5h-.343L5.5 11.823v-1.146z",clipRule:"evenodd"}))},4877:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var o=n(9196),r=n(9685),a=n(4184),s=n.n(a),i=(n(5482),n(4705));const l=({className:e,showSpinner:t=!1,children:n,variant:a="contained",...l})=>{const c=s()("wc-block-components-button","wp-element-button",e,a,{"wc-block-components-button--loading":t});return(0,o.createElement)(r.Z,{className:c,...l},t&&(0,o.createElement)(i.Z,null),(0,o.createElement)("span",{className:"wc-block-components-button__text"},n))}},8082:(e,t,n)=>{"use strict";n.d(t,{k:()=>Q});var o=n(9196),r=n(3554),a=n(711),s=n(9307),i=n(5736),l=n(2629),c=n(4184),u=n.n(c),p=n(4333),d=n(2819),m=n(9630),f=n(5158),g=n(444);const h=(0,s.createElement)(g.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(g.Path,{d:"M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z"}));var b=n(7462);class v extends s.Component{constructor(){super(...arguments),this.onChange=this.onChange.bind(this),this.bindInput=this.bindInput.bind(this)}focus(){this.input.focus()}hasFocus(){return this.input===this.input.ownerDocument.activeElement}bindInput(e){this.input=e}onChange(e){this.props.onChange({value:e.target.value})}render(){const{value:e,isExpanded:t,instanceId:n,selectedSuggestionIndex:o,className:r,...a}=this.props,i=e?e.length+1:0;return(0,s.createElement)("input",(0,b.Z)({ref:this.bindInput,id:`components-form-token-input-${n}`,type:"text"},a,{value:e||"",onChange:this.onChange,size:i,className:u()(r,"components-form-token-field__input"),autoComplete:"off",role:"combobox","aria-expanded":t,"aria-autocomplete":"list","aria-owns":t?`components-form-token-suggestions-${n}`:void 0,"aria-activedescendant":-1!==o?`components-form-token-suggestions-${n}-${o}`:void 0,"aria-describedby":`components-form-token-suggestions-howto-${n}`}))}}const y=v;var E=n(4979),w=n.n(E);class _ extends s.Component{constructor(){super(...arguments),this.handleMouseDown=this.handleMouseDown.bind(this),this.bindList=this.bindList.bind(this)}componentDidUpdate(){this.props.selectedIndex>-1&&this.props.scrollIntoView&&this.list.children[this.props.selectedIndex]&&(this.scrollingIntoView=!0,w()(this.list.children[this.props.selectedIndex],this.list,{onlyScrollIfNeeded:!0}),this.props.setTimeout((()=>{this.scrollingIntoView=!1}),100))}bindList(e){this.list=e}handleHover(e){return()=>{this.scrollingIntoView||this.props.onHover(e)}}handleClick(e){return()=>{this.props.onSelect(e)}}handleMouseDown(e){e.preventDefault()}computeSuggestionMatch(e){const t=this.props.displayTransform(this.props.mat
/* translators: %d: number of results. */
(0,i._n)("%d result found, use up and down arrow keys to navigate.","%d results found, use up and down arrow keys to navigate.",V.length),V.length):(0,i.__)("No results.");(0,f.speak)(t,"polite")}}),[V,x]),(0,s.createElement)(O,{onFocusOutside:()=>{A(!1)}},(0,s.createElement)(C.Z,{className:u()(b,"components-combobox-control"),tabIndex:"-1",label:n,id:`components-form-token-input-${w}`,hideLabelFromVision:l,help:c},(0,s.createElement)("div",{className:"components-combobox-control__suggestions-container",tabIndex:"-1",onKeyDown:e=>{let t=!1;switch(e.keyCode){case m.ENTER:_&&(z(_),t=!0);break;case m.UP:B(-1),t=!0;break;case m.DOWN:B(1),t=!0;break;case m.ESCAPE:A(!1),S(null),t=!0,e.stopPropagation()}t&&e.preventDefault()}},(0,s.createElement)(T.Z,null,(0,s.createElement)(R,null,(0,s.createElement)(y,{className:"components-combobox-control__input",instanceId:w,ref:P,value:x?M:H,"aria-label":H?`${H}, ${n}`:null,onFocus:()=>{D(!0),A(!0),a(""),F("")},onBlur:()=>{D(!1)},isExpanded:x,selectedSuggestionIndex:V.indexOf(_),onChange:e=>{const t=e.value;F(t),a(t),I&&A(!0)}})),g&&(0,s.createElement)(L.Z,null,(0,s.createElement)(N.Z,{className:"components-combobox-control__reset",icon:h,disabled:!t,onClick:()=>{r(null),P.current.input.focus()},label:(0,i.__)("Reset")}))),x&&(0,s.createElement)(k,{instanceId:w,match:{label:M},displayTransform:e=>e.label,suggestions:V,selectedIndex:V.indexOf(_),onHover:S,onSelect:z,scrollIntoView:!0}))))};var D=n(7884),M=n(9818),F=n(4801);n(5821);const P=(0,p.withInstanceId)((({id:e,className:t,label:n,onChange:r,options:l,value:c,required:p=!1,errorMessage:d=(0,i.__)("Please select a value.","woocommerce"),errorId:m,instanceId:f="0",autoComplete:g="off"})=>{const h=(0,s.useRef)(null),b=e||"control-"+f,v=m||b,{setValidationErrors:y,clearValidationError:E}=(0,M.useDispatch)(F.VALIDATION_STORE_KEY),w=(0,M.useSelect)((e=>e(F.VALIDATION_STORE_KEY).getValidationError(v)));return(0,s.useEffect)((()=>(!p||c?E(v):y({[v]:{message:d,hidden:!0}}),()=>{E(v)})),[E,c,v,d,p,y]),(0,o.createElement)("div",{id:b,className:u()("wc-block-components-combobox",t,{"is-active":c,"has-error":(null==w?void 0:w.message)&&!(null!=w&&w.hidden)}),ref:h},(0,o.createElement)(I,{className:"wc-block-components-combobox-control",label:n,onChange:r,onFilterValueChange:e=>{if(e.length){const t=(0,D.Kn)(h.current)?h.current.ownerDocument.activeElement:void 0;if(t&&(0,D.Kn)(h.current)&&h.current.contains(t))return;const n=e.toLocaleUpperCase(),o=l.find((e=>e.value.toLocaleUpperCase()===n));if(o)return void r(o.value);const a=l.find((e=>e.label.toLocaleUpperCase().startsWith(n)));a&&r(a.value)}},options:l,value:c||"",allowReset:!1,autoComplete:g,"aria-invalid":(null==w?void 0:w.message)&&!(null!=w&&w.hidden)}),(0,o.createElement)(a.ValidationInputError,{propertyName:v}))}));n(7775);const U=({className:e,countries:t,id:n,label:r,onChange:a,value:c="",autoComplete:p="off",required:d=!1,errorId:m,errorMessage:f=(0,i.__)("Please select a country","woocommerce")})=>{const g=(0,s.useMemo)((()=>Object.entries(t).map((([e,t])=>({value:e,label:(0,l.decodeEntities)(t)})))),[t]);return(0,o.createElement)("div",{className:u()(e,"wc-block-components-country-input")},(0,o.createElement)(P,{id:n,label:r,onChange:a,options:g,value:c,errorId:m,errorMessage:f,required:d,autoComplete:p}))};var H=n(5271);const V=e=>(0,o.createElement)(U,{countries:H.DK,...e}),z=e=>(0,o.createElement)(U,{countries:H.mO,...e});n(8410);const B=(e,t)=>{const n=t.find((t=>t.label.toLocaleUpperCase()===e.toLocaleUpperCase()||t.value.toLocaleUpperCase()===e.toLocaleUpperCase()));return n?n.value:""},W=({className:e,id:t,states:n,country:r,label:c,onChange:p,autoComplete:d="off",value:m="",required:f=!1,errorId:g=""})=>{const h=n[r],b=(0,s.useMemo)((()=>h?Object.keys(h).map((e=>({value:e,label:(0,l.decodeEntities)(h[e])}))):[]),[h]),v=(0,s.useCallback)((e=>{const t=b.length>0?B(e,b):e;t!==m&&p(t)}),[p,b,m]),y=(0,s.useRef)(m);return(0,s.useEffect)((()=>{y.current!==m&&(y.current=m)}),[m]),(0,s.useEffect)((()=>{if(b.length>0&&y.current){const e=B(y.current,b);e!==y.current&&v(e)}}),[b,v]),
(0,s._n)("%1$s (%2$d unit)","%1$s (%2$d units)",n,"woocommerce"),t,n)}))})))),_=(0,c.useCallback)((t=>{f(t,e)}),[e,f]),k={className:t,noResultsMessage:n,rates:p.shipping_rates,onSelectRate:_,selectedRate:p.shipping_rates.find((e=>e.selected)),renderOption:r,disabled:h};return y?(0,o.createElement)(l.Panel,{className:a()("wc-block-components-shipping-rates-control__package",t,{"wc-block-components-shipping-rates-control__package--disabled":h}),initialOpen:!1,title:w},(0,o.createElement)(E,{...k})):(0,o.createElement)("div",{className:a()("wc-block-components-shipping-rates-control__package",t,{"wc-block-components-shipping-rates-control__package--disabled":h})},w,(0,o.createElement)(E,{...k}))}},4017:(e,t,n)=>{"use strict";n.d(t,{Z:()=>b});var o=n(9196),r=n(5736),a=n(9307),s=n(1193),i=n(3554),l=n(602),c=n(4055),u=n(8832),p=n(5027),d=n(6131),m=n(7884),f=n(4427),g=n(5158);const h=({packages:e,showItems:t,collapsible:n,noResultsMessage:r,renderOption:a})=>e.length?(0,o.createElement)(o.Fragment,null,e.map((({package_id:e,...s})=>(0,o.createElement)(f.Z,{key:e,packageId:e,packageData:s,collapsible:n,showItems:t,noResultsMessage:r,renderOption:a})))):null,b=({shippingRates:e,isLoadingRates:t,className:n,collapsible:b,showItems:v,noResultsMessage:y,renderOption:E,context:w})=>{(0,a.useEffect)((()=>{var n,o;t||(n=(0,l.wH)(e),o=(0,l.Q_)(e),1===n?(0,g.speak)((0,r.sprintf)(/* translators: %d number of shipping options found. */
(0,r._n)("%d shipping option was found.","%d shipping options were found.",o,"woocommerce"),o)):(0,g.speak)((0,r.sprintf)(/* translators: %d number of shipping packages packages. */
(0,r._n)("Shipping option searched for %d package.","Shipping options searched for %d packages.",n,"woocommerce"),n)+" "+(0,r.sprintf)(/* translators: %d number of shipping options available. */
(0,r._n)("%d shipping option was found","%d shipping options were found",o,"woocommerce"),o)))}),[t,e]);const{extensions:_,receiveCart:k,...C}=(0,c.b)(),N={className:n,collapsible:b,showItems:v,noResultsMessage:y,renderOption:E,extensions:_,cart:C,components:{ShippingRatesControlPackage:f.Z},context:w},{isEditor:T}=(0,u._)(),{hasSelectedLocalPickup:S,selectedRates:x}=(0,p.V)(),A=(0,m.Kn)(x)?Object.values(x):[],R=A.every((e=>e===A[0]));return(0,o.createElement)(s.Z,{isLoading:t,screenReaderLabel:(0,r.__)("Loading shipping rates…","woocommerce"),showSpinner:!0},S&&"woocommerce/cart"===w&&e.length>1&&!R&&!T&&(0,o.createElement)(d.Z,{className:"wc-block-components-notice",isDismissible:!1,status:"warning"},(0,r.__)("Multiple shipments must have the same pickup location","woocommerce")),(0,o.createElement)(i.ExperimentalOrderShippingPackages.Slot,{...N}),(0,o.createElement)(i.ExperimentalOrderShippingPackages,null,(0,o.createElement)(h,{packages:e,noResultsMessage:y,renderOption:E})))}},27:(e,t,n)=>{"use strict";n.d(t,{RK:()=>f,X$:()=>v,Br:()=>w,Tm:()=>$});var o=n(9196),r=n(5736),a=n(9307),s=n(4877),i=n(1193),l=n(4333),c=n(711),u=n(9818),p=n(4801),d=n(4184),m=n.n(d);n(5454);const f=(0,l.withInstanceId)((({instanceId:e,isLoading:t=!1,onSubmit:n,displayCouponForm:l=!1})=>{const[d,f]=(0,a.useState)(""),[g,h]=(0,a.useState)(!l),b=`wc-block-components-totals-coupon__input-${e}`,v=m()("wc-block-components-totals-coupon__content",{"screen-reader-text":g}),{validationErrorId:y}=(0,u.useSelect)((e=>({validationErrorId:e(p.VALIDATION_STORE_KEY).getValidationErrorId(b)})));return(0,o.createElement)("div",{className:"wc-block-components-totals-coupon"},g?(0,o.createElement)("a",{role:"button",href:"#wc-block-components-totals-coupon__form",className:"wc-block-components-totals-coupon-link","aria-label":(0,r.__)("Add a coupon","woocommerce"),onClick:e=>{e.preventDefault(),h(!1)}},(0,r.__)("Add a coupon","woocommerce")):(0,o.createElement)(i.Z,{screenReaderLabel:(0,r.__)("Applying coupon…","woocommerce"),isLoading:t,showSpinner:!1},(0,o.createElement)("div",{className:v},(0,o.createElement)("form",{className:"wc-block-components-totals-coupon__form",id:"wc-block-components-totals-coupon__form"},(0,o.createElement)(c.ValidatedTextInput,{id:b,errorId:"coupon",className:"wc-block-components-totals-coupon__input",label:(0,r.__)("Enter code","woocommerce"),value:d,ariaDescribedBy:y,onChange:e=>{f(e)},focusOnMount:!0,validateOnMount:!1,showError:!1}),(0,o.createElement)(s.Z,{className:"wc-block-components-totals-coupon__button",disabled:t||!d,showSpinner:t,onClick:e=>{var t;e.preventDefault(),void 0!==n?null===(t=n(d))||void 0===t||t.then((e=>{e&&(f(""),h(!0))})):(f(""),h(!0))},type:"submit"},(0,r.__)("Apply","woocommerce"))),(0,o.createElement)(c.ValidationInputError,{propertyName:"coupon",elementId:b}))))}));var g=n(3554),h=n(4617);n(5154);const b={context:"summary"},v=({cartCoupons:e=[],currency:t,isRemovingCoupon:n,removeCoupon:a,values:s})=>{const{total_discount:l,total_discount_tax:u}=s,p=parseInt(l,10);if(!p&&0===e.length)return null;const d=parseInt(u,10),m=(0,h.getSetting)("displayCartPricesIncludingTax",!1)?p+d:p,f=(0,g.applyCheckoutFilter)({arg:b,filterName:"coupons",defaultValue:e});return(0,o.createElement)(c.TotalsItem,{className:"wc-block-components-totals-discount",currency:t,description:0!==f.length&&(0,o.createElement)(i.Z,{screenReaderLabel:(0,r.__)("Removing coupon…","woocommerce"),isLoading:n,showSpinner:!1},(0,o.createElement)("ul",{className:"wc-block-components-totals-discount__coupon-list"},f.map((e=>(0,o.createElement)(c.RemovableChip,{key:"coupon-"+e.code,className:"wc-block-components-totals-discount__coupon-list-item",text:e.label,screenReaderText:(0,r.sprintf)(/* translators: %s Coupon code. */
(0,r.__)("Coupon: %s","woocommerce"),e.label),disabled:n,onRemove:()=>{a(e.code)},radius:"large",ariaLabel:(0,r.sprintf)(/* translators: %s is a coupon code. */
(0,r.__)('Remove coupon "%s"',"woocommerce"),e.label)}))))),label:m?(0,r.__)("Discount","woocommerce"):(0,r.__)("Coupons","woocommerce"),value:m?-1*m:"-"})};var y=n(4055),E=n(4293);n(6305);const w=({currency:e,values:t,className:n})=>{const s=(0,h.getSetting)("taxesEnabled",!0)&&(0,h.getSetting)("displayCartPricesIncludingTax",!1),{total_price:i,total_tax:l,tax_lines:u}=t,{receiveCart:p,...d}=(0,y.b)(),f=(0,g.applyCheckoutFilter)({filterName:"totalLabel",defaultValue:(0,r.__)("Total","woocommerce"),extensions:d.extensions,arg:{cart:d}}),b=parseInt(l,10),v=u&&u.length>0?(0,r.sprintf)(/* translators: %s is a list of tax rates */
(0,r.__)("Including %s","woocommerce"),u.map((({name:t,price:n})=>`${(0,E.formatPrice)(n,e)} ${t}`)).join(", ")):(0,r.__)("Including <TaxAmount/> in taxes","woocommerce");return(0,o.createElement)(c.TotalsItem,{className:m()("wc-block-components-totals-footer-item",n),currency:e,label:f,value:parseInt(i,10),description:s&&0!==b&&(0,o.createElement)("p",{className:"wc-block-components-totals-footer-item-tax"},(0,a.createInterpolateElement)(v,{TaxAmount:(0,o.createElement)(c.FormattedMonetaryAmount,{className:"wc-block-components-totals-footer-item-tax-value",currency:e,value:b})}))})};var _=n(2629);const k=({selectedShippingRates:e})=>(0,o.createElement)("div",{className:"wc-block-components-totals-item__description wc-block-components-totals-shipping__via"},(0,_.decodeEntities)(e.filter(((t,n)=>e.indexOf(t)===n)).join(", ")));var C=n(602),N=n(3881),T=n(7844),S=n(4076),x=n(9127),A=n.n(x),R=(n(7866),n(8082));const L=({address:e,onUpdate:t,onCancel:n,addressFields:i})=>{const[l,c]=(0,a.useState)(e),{showAllValidationErrors:d}=(0,u.useDispatch)(p.VALIDATION_STORE_KEY),{hasValidationErrors:m,isCustomerDataUpdating:f}=(0,u.useSelect)((e=>({hasValidationErrors:e(p.VALIDATION_STORE_KEY).hasValidationErrors,isCustomerDataUpdating:e(p.CART_STORE_KEY).isCustomerDataUpdating()})));return(0,o.createElement)("form",{className:"wc-block-components-shipping-calculator-address"},(0,o.createElement)(R.k,{fields:i,onChange:c,values:l}),(0,o.createElement)(s.Z,{className:"wc-block-components-shipping-calculator-address__button",disabled:f,onClick:o=>(o.preventDefault(),A()(l,e)?n():(d(),m()?void 0:t(l))),type:"submit"},(0,r.__)("Update","woocommerce")))},O=({onUpdate:e=(()=>{}),onCancel:t=(()=>{}),addressFields:n=["country","state","city","postcode"]})=>{const{shippingAddress:r}=(0,T.L)(),a="wc/cart/shipping-calculator";return(0,o.createElement)("div",{className:"wc-block-components-shipping-calculator"},(0,o.createElement)(c.StoreNoticesContainer,{context:a}),(0,o.createElement)(L,{address:r,addressFields:n,onCancel:t,onUpdate:t=>{(0,u.dispatch)(p.CART_STORE_KEY).updateCustomerData({shipping_address:t},!1).then((()=>{(0,S.Zt)(a),e(t)})).catch((e=>{(0,p.processErrorResponse)(e,a)}))}}))};var I=n(467);const D=({label:e=(0,r.__)("Calculate","woocommerce"),isShippingCalculatorOpen:t,setIsShippingCalculatorOpen:n})=>(0,o.createElement)("a",{role:"button",href:"#wc-block-components-shipping-calculator-address__link",className:"wc-block-components-totals-shipping__change-address__link",id:"wc-block-components-totals-shipping__change-address__link",onClick:e=>{e.preventDefault(),n(!t)},"aria-label":e,"aria-expanded":t},e),M=({showCalculator:e,isShippingCalculatorOpen:t,setIsShippingCalculatorOpen:n,isCheckout:a=!1})=>e?(0,o.createElement)(D,{label:(0,r.__)("Add an address for shipping options","woocommerce"),isShippingCalculatorOpen:t,setIsShippingCalculatorOpen:n}):(0,o.createElement)("em",null,a?(0,r.__)("No shipping options available","woocommerce"):(0,r.__)("Calculated during checkout","woocommerce"));var F=n(8832),P=n(7884);const U=()=>{const{pickupAddress:e}=(0,u.useSelect)((e=>{const t=e("wc/store/cart").getShippingRates().flatMap((e=>e.shipping_rates)).find((e=>e.selected&&(0,C.J3)(e)));if((0,P.Kn)(t)&&(0,P.$n)(t,"meta_data")){const e=t.meta_data.find((e=>"pickup_address"===e.key));if((0,P.Kn)(e)&&(0,P.$n)(e,"value")&&e.value)return{pickupAddress:e.value}}return(0,P.Kn)(t),{pickupAddress:void 0}}));return void 0===e?null:(0,o.createElement)("span",{className:"wc-block-components-shipping-address"},(0,r.sprintf)(/* translators: %s: shipping method name, e.g. "Amazon Locker" */
(0,r.__)("Collection from %s","woocommerce"),e)+" ")},H=({formattedLocation:e})=>e?(0,o.createElement)("span",{className:"wc-block-components-shipping-address"},(0,r.sprintf)(/* translators: %s location. */
(0,r.__)("Shipping to %s","woocommerce"),e)+" "):null,V=({showCalculator:e,isShippingCalculatorOpen:t,setIsShippingCalculatorOpen:n,shippingAddress:a})=>{const{isEditor:s}=(0,F._)(),i=(0,u.useSelect)((e=>e(p.CHECKOUT_STORE_KEY).prefersCollection()));if(!(0,N.ET)(a)&&!s)return null;const l=(0,N.ET)(a);return(0,o.createElement)(o.Fragment,null,i?(0,o.createElement)(U,null):(0,o.createElement)(H,{formattedLocation:l}),e&&(0,o.createElement)(D,{label:(0,r.__)("Change address","woocommerce"),isShippingCalculatorOpen:t,setIsShippingCalculatorOpen:n}))};var z=n(6131),B=n(4017);const W=({hasRates:e,shippingRates:t,isLoadingRates:n,isAddressComplete:a})=>{const s=e?(0,r.__)("Shipping options","woocommerce"):(0,r.__)("Choose a shipping option","woocommerce");return(0,o.createElement)("fieldset",{className:"wc-block-components-totals-shipping__fieldset"},(0,o.createElement)("legend",{className:"screen-reader-text"},s),(0,o.createElement)(B.Z,{className:"wc-block-components-totals-shipping__options",noResultsMessage:(0,o.createElement)(o.Fragment,null,a&&(0,o.createElement)(z.Z,{isDismissible:!1,className:"wc-block-components-shipping-rates-control__no-results-notice",status:"warning"},(0,r.__)("There are no shipping options available. Please check your shipping address.","woocommerce"))),shippingRates:t,isLoadingRates:n,context:"woocommerce/cart"}))};n(5092);const $=({currency:e,values:t,showCalculator:n=!0,showRateSelector:s=!0,isCheckout:i=!1,className:l})=>{const[d,f]=(0,a.useState)(!1),{shippingAddress:g,cartHasCalculatedShipping:h,shippingRates:b,isLoadingRates:v}=(0,y.b)(),E=(0,I.KR)(t),w=(0,I.CN)(b)||E>0,_=n&&d,T=(0,u.useSelect)((e=>e(p.CHECKOUT_STORE_KEY).prefersCollection())),S=b.flatMap((e=>e.shipping_rates.filter((e=>T&&(0,C.J3)(e)&&e.selected||!T&&e.selected)).flatMap((e=>e.name)))),x=(0,N.K5)(g),A=(0,I.iG)(w,T,b);return(0,o.createElement)("div",{className:m()("wc-block-components-totals-shipping",l)},(0,o.createElement)(c.TotalsItem,{label:(0,r.__)("Shipping","woocommerce"),value:!A&&h?E:(!x||i)&&(0,o.createElement)(M,{showCalculator:n,isCheckout:i,isShippingCalculatorOpen:d,setIsShippingCalculatorOpen:f}),description:!A&&h||x&&!i?(0,o.createElement)(o.Fragment,null,(0,o.createElement)(k,{selectedShippingRates:S}),(0,o.createElement)(V,{shippingAddress:g,showCalculator:n,isShippingCalculatorOpen:d,setIsShippingCalculatorOpen:f})):null,currency:e}),_&&(0,o.createElement)(O,{onUpdate:()=>{f(!1)},onCancel:()=>{f(!1)}}),s&&h&&!_&&(0,o.createElement)(W,{hasRates:w,shippingRates:b,isLoadingRates:v,isAddressComplete:x}))}},1193:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var o=n(9196),r=n(5736),a=n(4184),s=n.n(a),i=n(711);n(6575);const l=({children:e,className:t,screenReaderLabel:n,showSpinner:a=!1,isLoading:l=!0})=>(0,o.createElement)("div",{className:s()(t,{"wc-block-components-loading-mask":l})},l&&a&&(0,o.createElement)(i.Spinner,null),(0,o.createElement)("div",{className:s()({"wc-block-components-loading-mask__children":l}),"aria-hidden":l},e),l&&(0,o.createElement)("span",{className:"screen-reader-text"},n||(0,r.__)("Loading…","woocommerce")))},6131:(e,t,n)=>{"use strict";n.d(t,{Z:()=>d});var o=n(9196),r=n(4184),a=n.n(r),s=n(5736),i=n(1984),l=n(5202),c=(n(1365),n(395)),u=n(4877),p=n(2023);const d=({className:e,status:t="default",children:n,spokenMessage:r=n,onRemove:d=(()=>{}),isDismissible:m=!0,politeness:f=(0,c.x)(t),summary:g})=>((0,p.o)(r,f),(0,o.createElement)("div",{className:a()(e,"wc-block-components-notice-banner","is-"+t,{"is-dismissible":m})},(0,o.createElement)(i.Z,{icon:(0,c.X)(t)}),(0,o.createElement)("div",{className:"wc-block-components-notice-banner__content"},g&&(0,o.createElement)("p",{className:"wc-block-components-notice-banner__summary"},g),n),!!m&&(0,o.createElement)(u.Z,{className:"wc-block-components-notice-banner__dismiss",icon:l.Z,label:(0,s.__)("Dismiss this notice","woocommerce"),onClick:e=>{"function"==typeof(null==e?void 0:e.preventDefault)&&e.preventDefault&&e.preventDefault(),d()},showTooltip:!1})))},395:(e,t,n)=>{"use strict";n.d(t,{X:()=>i,x:()=>s});var o=n(8184),r=n(5430),a=n(5045);con
(0,o.__)('Coupon code "%s" has been applied to your cart.',"woocommerce"),t),{id:"coupon-form",type:"snackbar",context:e}),Promise.resolve(!0)))).catch((e=>(p({coupon:{message:(0,s.decodeEntities)(e.message),hidden:!1}}),Promise.resolve(!1)))),removeCoupon:t=>g(t).then((()=>((0,i.applyCheckoutFilter)({filterName:"showRemoveCouponNotice",defaultValue:!0,arg:{couponCode:t,context:e}})&&u("info",(0,o.sprintf)(/* translators: %s coupon code. */
(0,o.__)('Coupon code "%s" has been removed from your cart.',"woocommerce"),t),{id:"coupon-form",type:"snackbar",context:e}),Promise.resolve(!0)))).catch((t=>(c(t.message,{id:"coupon-form",context:e}),Promise.resolve(!1)))),isApplyingCoupon:d,isRemovingCoupon:m}}},7844:(e,t,n)=>{"use strict";n.d(t,{L:()=>a});var o=n(9818),r=n(4801);const a=()=>{const{customerData:e,isInitialized:t}=(0,o.useSelect)((e=>{const t=e(r.CART_STORE_KEY);return{customerData:t.getCustomerData(),isInitialized:t.hasFinishedResolution("getCartData")}})),{setShippingAddress:n,setBillingAddress:a}=(0,o.useDispatch)(r.CART_STORE_KEY);return{isInitialized:t,billingAddress:e.billingAddress,shippingAddress:e.shippingAddress,setBillingAddress:a,setShippingAddress:n}}},9075:(e,t,n)=>{"use strict";n.d(t,{s:()=>s});var o=n(9307),r=n(9127),a=n.n(r);function s(e){const t=(0,o.useRef)(e);return a()(e,t.current)||(t.current=e),t.current}},2023:(e,t,n)=>{"use strict";n.d(t,{o:()=>a});var o=n(9307),r=n(5158);const a=(e,t)=>{const n="string"==typeof e?e:(0,o.renderToString)(e);(0,o.useEffect)((()=>{n&&(0,r.speak)(n,t)}),[n,t])}},1642:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>p});var o=n(9196),r=n(27),a=n(711),s=n(4293),i=n(4055),l=n(1137),c=n(3554);const u=()=>{const{extensions:e,receiveCart:t,...n}=(0,i.b)(),r={extensions:e,cart:n,context:"woocommerce/checkout"};return(0,o.createElement)(c.ExperimentalDiscountsMeta.Slot,{...r})},p=({className:e=""})=>{const{cartTotals:t,cartCoupons:n}=(0,i.b)(),{removeCoupon:c,isRemovingCoupon:p}=(0,l.K)("wc/checkout"),d=(0,s.getCurrencyFromPriceResponse)(t);return(0,o.createElement)(o.Fragment,null,(0,o.createElement)(a.TotalsWrapper,{className:e},(0,o.createElement)(r.X$,{cartCoupons:n,currency:d,isRemovingCoupon:p,removeCoupon:c,values:t})),(0,o.createElement)(u,null))}},4705:(e,t,n)=>{"use strict";n.d(t,{Z:()=>r});var o=n(9196);n(129);const r=()=>(0,o.createElement)("span",{className:"wc-block-components-spinner","aria-hidden":"true"})},9010:(e,t,n)=>{"use strict";var o=n(4657);e.exports=function(e,t,n){n=n||{},9===t.nodeType&&(t=o.getWindow(t));var r=n.allowHorizontalScroll,a=n.onlyScrollIfNeeded,s=n.alignWithTop,i=n.alignWithLeft,l=n.offsetTop||0,c=n.offsetLeft||0,u=n.offsetBottom||0,p=n.offsetRight||0;r=void 0===r||r;var d=o.isWindow(t),m=o.offset(e),f=o.outerHeight(e),g=o.outerWidth(e),h=void 0,b=void 0,v=void 0,y=void 0,E=void 0,w=void 0,_=void 0,k=void 0,C=void 0,N=void 0;d?(_=t,N=o.height(_),C=o.width(_),k={left:o.scrollLeft(_),top:o.scrollTop(_)},E={left:m.left-k.left-c,top:m.top-k.top-l},w={left:m.left+g-(k.left+C)+p,top:m.top+f-(k.top+N)+u},y=k):(h=o.offset(t),b=t.clientHeight,v=t.clientWidth,y={left:t.scrollLeft,top:t.scrollTop},E={left:m.left-(h.left+(parseFloat(o.css(t,"borderLeftWidth"))||0))-c,top:m.top-(h.top+(parseFloat(o.css(t,"borderTopWidth"))||0))-l},w={left:m.left+g-(h.left+v+(parseFloat(o.css(t,"borderRightWidth"))||0))+p,top:m.top+f-(h.top+b+(parseFloat(o.css(t,"borderBottomWidth"))||0))+u}),E.top<0||w.top>0?!0===s?o.scrollTop(t,y.top+E.top):!1===s?o.scrollTop(t,y.top+w.top):E.top<0?o.scrollTop(t,y.top+E.top):o.scrollTop(t,y.top+w.top):a||((s=void 0===s||!!s)?o.scrollTop(t,y.top+E.top):o.scrollTop(t,y.top+w.top)),r&&(E.left<0||w.left>0?!0===i?o.scrollLeft(t,y.left+E.left):!1===i?o.scrollLeft(t,y.left+w.left):E.left<0?o.scrollLeft(t,y.left+E.left):o.scrollLeft(t,y.left+w.left):a||((i=void 0===i||!!i)?o.scrollLeft(t,y.left+E.left):o.scrollLeft(t,y.left+w.left)))}},4979:(e,t,n)=>{"use strict";e.exports=n(9010)},4657:e=>{"use strict";var t=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e};function o(e,t){var n=e["page"+(t?"Y":"X")+"Offset"],o="scroll"+(t?"Top":"Left");if("number"!=typeof n){var r=e.document;"number"!=typeof(n=r.documentElement[o])&&(n=r.body[o])}return n}function r(e){return o(e)}function a(e){r