← Back
Editing: checkout.js
(()=>{var e,t,o,s={93970:(e,t,o)=>{"use strict";var s=o(4921),r=o(5573),c=o(10790);const n=(0,c.jsxs)(r.SVG,{xmlns:"http://www.w3.org/2000/SVG",viewBox:"0 0 24 24",fill:"none",children:[(0,c.jsx)("path",{stroke:"currentColor",strokeWidth:"1.5",fill:"none",d:"M5 3.75h14c.69 0 1.25.56 1.25 1.25v14c0 .69-.56 1.25-1.25 1.25H5c-.69 0-1.25-.56-1.25-1.25V5c0-.69.56-1.25 1.25-1.25z"}),(0,c.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M6.4 10.75c0-.47.38-.85.85-.85h9.5c.47 0 .85.38.85.85v1.5c0 .47-.38.85-.85.85h-9.5a.85.85 0 01-.85-.85v-1.5zm1.2.35v.8h8.8v-.8H7.6zM12.4 15.25c0-.47.38-.85.85-.85h3.5c.47 0 .85.38.85.85v1.5c0 .47-.38.85-.85.85h-3.5a.85.85 0 01-.85-.85v-1.5zm1.2.35v.8h2.8v-.8h-2.8zM6.5 15.9a.6.6 0 01.6-.6h2.8a.6.6 0 010 1.2H7.1a.6.6 0 01-.6-.6zM6.5 7.9a.6.6 0 01.6-.6h9.8a.6.6 0 110 1.2H7.1a.6.6 0 01-.6-.6z",clipRule:"evenodd"})]});var a=o(11789);const i=window.wp.blocks,l=window.wp.blockEditor;var d=o(86087),p=o(29491);const m=(0,d.createContext)({hasContainerWidth:!1,containerClassName:"",isMobile:!1,isSmall:!1,isMedium:!1,isLarge:!1}),u=()=>(0,d.useContext)(m),h=({children:e,className:t=""})=>{const[o,r]=(()=>{const[e,{width:t}]=(0,p.useResizeObserver)();let o="";return t>920?o="is-large":t>520?o="is-medium":t>400?o="is-small":t&&(o="is-mobile"),[e,o]})(),n={hasContainerWidth:""!==r,containerClassName:r,isMobile:"is-mobile"===r,isSmall:"is-small"===r,isMedium:"is-medium"===r,isLarge:"is-large"===r};return(0,c.jsx)(m.Provider,{value:n,children:(0,c.jsxs)("div",{className:(0,s.A)(t,r),children:[o,e]})})};o(99163);const g=({children:e,className:t})=>(0,c.jsx)(h,{className:(0,s.A)("wc-block-components-sidebar-layout",t),children:e}),_=window.wp.data,k=(0,d.createContext)({isEditor:!1,currentPostId:0,currentView:"",previewData:{},getPreviewData:()=>({})}),b=()=>(0,d.useContext)(k),w=({children:e,currentPostId:t=0,previewData:o={},currentView:s=""})=>{const r=(0,_.useSelect)(e=>{const{getSettings:t}=e(l.store);return Boolean(t()?.isPreviewMode??!1)},[]),n=(0,_.useSelect)(e=>t||e("core/editor").getCurrentPostId(),[t]),a=(0,d.useCallback)((e,t={})=>o&&e in o?o[e]:t,[o]),i={isEditor:!0,currentPostId:n,currentView:s,previewData:o,getPreviewData:a,isPreview:r};return(0,c.jsx)(k.Provider,{value:i,children:e})},y=window.wp.plugins,f=window.wc.wcSettings;var x=o(27723);const v=window.wc.wcTypes,S=(0,f.getSetting)("wcBlocksConfig",{pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),j=S.pluginUrl+"assets/images/",C=(S.pluginUrl,f.STORE_PAGES.shop,f.STORE_PAGES.checkout?.id),P=(f.STORE_PAGES.checkout,f.STORE_PAGES.privacy?.permalink),E=(f.STORE_PAGES.privacy,f.STORE_PAGES.terms?.permalink),N=(f.STORE_PAGES.terms,f.STORE_PAGES.cart?.id),A=f.STORE_PAGES.cart?.permalink,I=(f.STORE_PAGES.myaccount?.permalink?f.STORE_PAGES.myaccount.permalink:(0,f.getSetting)("wpLoginUrl","/wp-login.php"),(0,f.getSetting)("localPickupEnabled",!1)),R=((0,f.getSetting)("shippingMethodsExist",!1),(0,f.getSetting)("shippingEnabled",!0)),T=(0,f.getSettingWithCoercion)("countries",{},v.isObject),M=(0,f.getSetting)("countryData",{}),B=Object.fromEntries(Object.keys(M).filter(e=>!0===M[e].allowBilling).map(e=>{const t=T[e];return[e,(0,v.isString)(t)?t:""]})),O=Object.fromEntries(Object.keys(M).filter(e=>!0===M[e].allowShipping).map(e=>{const t=T[e];return[e,(0,v.isString)(t)?t:""]})),D={...B,...O},L=Object.fromEntries(Object.keys(D).map(e=>[e,M[e].states||{}])),F=Object.fromEntries(Object.keys(D).map(e=>[e,M[e].locale||{}])),V={address:["first_name","last_name","company","address_1","address_2","city","postcode","country","state","phone"],contact:["email"],order:[]},$=(0,f.getSetting)("addressFieldsLocations",V).address,H=(0,f.getSetting)("addressFieldsLocations",V).contact,z=(0,f.getSetting)("addressFieldsLocations",V).order,U=((0,f.getSetting)("additionalOrderFields",{}),(0,f.getSetting)("additionalContactFields",{}),(0,f.getSetting)("additionalAddressFields",{}),()=>{const{experimentalBlocksEnabled:e}=(0,f.getSetting)("wcBlocksConfig",{experimentalBlocksEnabled:!1});return e}),q=({imageUrl:e=`${j}/block-error.svg`,header:t=(0,x.__)("Oops!","woocommerce"),text:o=(0,x.__)("There was an error loading the content.","woocommerce"),errorMessage:s,errorMessagePrefix:r=(0,x.__)("Error:","woocommerce"),button:n,showErrorBlock:a=!0})=>a?(0,c.jsxs)("div",{className:"wc-block-error wc-block-components-error",children:[e&&(0,c.jsx)("img",{className:"wc-block-error__image wc-block-components-error__image",src:e,alt:""}),(0,c.jsxs)("div",{className:"wc-block-error__content wc-block-components-error__content",children:[t&&(0,c.jsx)("p",{className:"wc-block-error__header wc-block-components-error__header",children:t}),o&&(0,c.jsx)("p",{className:"wc-block-error__text wc-block-components-error__text",children:o}),s&&(0,c.jsxs)("p",{className:"wc-block-error__message wc-block-components-error__message",children:[r?r+" ":"",s]}),n&&(0,c.jsx)("p",{className:"wc-block-error__button wc-block-components-error__button",children:n})]})]}):null;o(45893);class W extends d.Component{state={errorMessage:"",hasError:!1};static getDerivedStateFromError(e){return void 0!==e.statusText&&void 0!==e.status?{errorMessage:(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("strong",{children:e.status}),": ",e.statusText]}),hasError:!0}:{errorMessage:e.message,hasError:!0}}render(){const{header:e,imageUrl:t,showErrorMessage:o=!0,showErrorBlock:s=!0,text:r,errorMessagePrefix:n,renderError:a,button:i}=this.props,{errorMessage:l,hasError:d}=this.state;return d?"function"==typeof a?a({errorMessage:l}):(0,c.jsx)(q,{showErrorBlock:s,errorMessage:o?l:null,header:e,imageUrl:t,text:r,errorMessagePrefix:n,button:i}):this.props.children}}const Y=W,G=window.wc.wcBlocksData;var J=o(64040),K=o.n(J);let Z=function(e){return e.ADD_EVENT_CALLBACK="add_event_callback",e.REMOVE_EVENT_CALLBACK="remove_event_callback",e}({});const Q={},X=(e=Q,{type:t,eventType:o,id:s,callback:r,priority:c})=>{const n=e.hasOwnProperty(o)?new Map(e[o]):new Map;switch(t){case Z.ADD_EVENT_CALLBACK:return n.set(s,{priority:c,callback:r}),{...e,[o]:n};case Z.REMOVE_EVENT_CALLBACK:return n.delete(s),{...e,[o]:n}}},ee=(e,t)=>(o,s=10)=>{const r=((e,t,o=10)=>({id:Math.floor(Math.random()*Date.now()).toString(),type:Z.ADD_EVENT_CALLBACK,eventType:e,callback:t,priority:o}))(e,o,s);return t(r),()=>{var o;t((o=e,{id:r.id,type:Z.REMOVE_EVENT_CALLBACK,eventType:o}))}},te=(0,d.createContext)({onPaymentProcessing:()=>()=>()=>{},onPaymentSetup:()=>()=>()=>{}}),oe=({children:e})=>{const{isProcessing:t,isIdle:o,isCalculating:s,hasError:r}=(0,_.useSelect)(e=>{const t=e(G.checkoutStore);return{isProcessing:t.isProcessing(),isIdle:t.isIdle(),hasError:t.hasError(),isCalculating:t.isCalculating()}}),{isPaymentReady:n}=(0,_.useSelect)(e=>{const t=e(G.paymentStore);return{isPaymentProcessing:t.isPaymentProcessing(),isPaymentReady:t.isPaymentReady()}}),{setValidationErrors:a}=(0,_.useDispatch)(G.validationStore),[i,l]=(0,d.useReducer)(X,{}),{onPaymentSetup:p}=(e=>(0,d.useMemo)(()=>({onPaymentSetup:ee("payment_setup",e)}),[e]))(l),m=(0,d.useRef)(i);(0,d.useEffect)(()=>{m.current=i},[i]);const{__internalSetPaymentProcessing:u,__internalSetPaymentIdle:h,__internalEmitPaymentProcessingEvent:g}=(0,_.useDispatch)(G.paymentStore);(0,d.useEffect)(()=>{!t||r||s||(u(),g(m.current,a))},[t,r,s,u,g,a]),(0,d.useEffect)(()=>{o&&!n&&h()},[o,n,h]),(0,d.useEffect)(()=>{r&&n&&h()},[r,n,h]);const k={onPaymentProcessing:(0,d.useMemo)(()=>function(...e){return K()("onPaymentProcessing",{alternative:"onPaymentSetup"}),p(...e)},[p]),onPaymentSetup:p};return(0,c.jsx)(te.Provider,{value:k,children:e})},se={NONE:"none",INVALID_ADDRESS:"invalid_address",UNKNOWN:"unknown_error"},re={INVALID_COUNTRY:"woocommerce_rest_cart_shipping_rates_invalid_country",MISSING_COUNTRY:"woocommerce_rest_cart_shipping_rates_missing_country",INVALID_STATE:"woocommerce_rest_cart_shipping_rates_invalid_state"},ce={shippingErrorStatus:{isPristine:!0,isValid:!1,hasInvalidAddress:!1,hasError:!1},dispatchErrorStatus:e=>e,shippingErrorTypes:se,onShippingRateSuccess:()=>()=>{},onShippingRateFail:()=>()=>{},onShippingRateSelectSuccess:()=>()=>{},onShippingRateSelectFail:()=>()=>{}},ne=(e,{type:t})=>Object.values(se).includes(t)?t:e,ae="shipping_rates_success",ie="shipping_rates_fail",le="shipping_rate_select_success",de="shipping_rate_select_fail",pe=e=>({onSuccess:ee(ae,e),onFail:ee(ie,e),onSelectSuccess:ee(le,e),onSelectFail:ee(de,e)});let me=function(e){return e.CART="wc/cart",e.CHECKOUT="wc/checkout",e.PAYMENTS="wc/checkout/payments",e.EXPRESS_PAYMENTS="wc/checkout/express-payments",e.CONTACT_INFORMATION="wc/checkout/contact-information",e.SHIPPING_ADDRESS="wc/checkout/shipping-address",e.BILLING_ADDRESS="wc/checkout/billing-address",e.SHIPPING_METHODS="wc/checkout/shipping-methods",e.CHECKOUT_ACTIONS="wc/checkout/checkout-actions",e.ORDER_INFORMATION="wc/checkout/order-information",e}({});const ue=async(e,t,o)=>{const s=((e,t)=>e[t]?Array.from(e[t].values()).sort((e,t)=>e.priority-t.priority):[])(e,t),r=[];for(const e of s)try{const t=await Promise.resolve(e.callback(o));"object"==typeof t&&r.push(t)}catch(e){console.error(e)}return!r.length||r};var he=o(11824),ge=o.n(he);const _e=window.wp.htmlEntities,ke=Object.entries(F).reduce((e,[t,o])=>(e[t]=Object.entries(o).reduce((e,[t,o])=>(e[t]=(e=>{const t={};return void 0!==e.label&&(t.label=e.label),void 0!==e.required&&(t.required=e.required),void 0!==e.hidden&&(t.hidden=e.hidden),void 0===e.label||e.optionalLabel||(t.optionalLabel=(0,x.sprintf)(/* translators: %s Field label. */ /* translators: %s Field label. */ (0,x.__)("%s (optional)","woocommerce"),e.label)),void 0!==e.optionalLabel&&(t.optionalLabel=e.optionalLabel),e.index&&((0,v.isNumber)(e.index)&&(t.index=e.index),(0,v.isString)(e.index)&&(t.index=parseInt(e.index,10))),e.hidden&&(t.required=!1),t})(o),e),{}),e),{}),be=(e,t,o="")=>{const s=o&&void 0!==ke[o]?ke[o]:{};return e.map(e=>({key:e,...t&&e in t?t[e]:{},...s&&e in s?s[e]:{}})).sort((e,t)=>e.index-t.index)},we=["state","country","postcode","city"],ye=(e,t)=>e in t,fe=e=>{const t=be($,f.defaultFields,e.country),o=Object.assign({},e);return t.forEach(({key:t,hidden:s})=>{!0===s&&ye(t,e)&&(o[t]="")}),o},xe=e=>!!e.country&&be($,f.defaultFields,e.country).filter(({key:e})=>{return t=e,we.includes(t);var t}).every(({key:t,hidden:o,required:s})=>!0===o||!1===s||ye(t,e)&&""!==e[t]),ve=window.CustomEvent||null,Se=(e,t,o=!1,s=!1)=>{if("function"!=typeof jQuery)return()=>{};const r=()=>{((e,{bubbles:t=!1,cancelable:o=!1,element:s,detail:r={}})=>{if(!ve)return;s||(s=document.body);const c=new ve(e,{bubbles:t,cancelable:o,detail:r});s.dispatchEvent(c)})(t,{bubbles:o,cancelable:s})};return jQuery(document).on(e,r),()=>jQuery(document).off(e,r)},je=e=>{const t=e?.detail;t&&t.preserveCartData||(0,_.dispatch)(G.cartStore).invalidateResolutionForStore()},Ce=e=>{(e?.persisted||"back_forward"===(window.performance&&window.performance.getEntriesByType("navigation").length?window.performance.getEntriesByType("navigation")[0].type:""))&&(0,_.dispatch)(G.cartStore).invalidateResolutionForStore()},Pe=()=>{1===window.wcBlocksStoreCartListeners.count&&window.wcBlocksStoreCartListeners.remove(),window.wcBlocksStoreCartListeners.count--},Ee={first_name:"",last_name:"",company:"",address_1:"",address_2:"",city:"",state:"",postcode:"",country:"",phone:""},Ne={...Ee,email:""},Ae={total_items:"",total_items_tax:"",total_fees:"",total_fees_tax:"",total_discount:"",total_discount_tax:"",total_shipping:"",total_shipping_tax:"",total_price:"",total_tax:"",tax_lines:G.EMPTY_TAX_LINES,currency_code:"",currency_symbol:"",currency_minor_unit:2,currency_decimal_separator:"",currency_thousand_separator:"",currency_prefix:"",currency_suffix:""},Ie=e=>Object.fromEntries(Object.entries(e).map(([e,t])=>[e,(0,_e.decodeEntities)(t)])),Re=(e,t)=>{const o=fe(Ie(e));return ge()(t.current,o)||(t.current=o),t.current},Te={billingAddress:Ne,billingData:Ne,cartCoupons:G.EMPTY_CART_COUPONS,cartErrors:G.EMPTY_CART_ERRORS,cartFees:G.EMPTY_CART_FEES,cartHasCalculatedShipping:!1,cartIsLoading:!0,cartItemErrors:G.EMPTY_CART_ITEM_ERRORS,cartItems:G.EMPTY_CART_ITEMS,cartItemsCount:0,cartItemsWeight:0,cartNeedsPayment:!0,cartNeedsShipping:!0,cartTotals:Ae,crossSellsProducts:G.EMPTY_CART_CROSS_SELLS,extensions:G.EMPTY_EXTENSIONS,hasPendingItemsOperations:!1,isLoadingRates:!1,paymentMethods:G.EMPTY_PAYMENT_METHODS,paymentRequirements:G.EMPTY_PAYMENT_REQUIREMENTS,receiveCart:()=>{},receiveCartContents:()=>{},shippingAddress:Ee,shippingRates:G.EMPTY_SHIPPING_RATES},Me=(e={shouldSelect:!0})=>{const{shouldSelect:t}=e,o=(0,d.useRef)(),s=(0,d.useRef)(Ne),r=(0,d.useRef)(Ee);(0,d.useEffect)(()=>((()=>{if(window.wcBlocksStoreCartListeners||(window.wcBlocksStoreCartListeners={count:0,remove:()=>{}}),window.wcBlocksStoreCartListeners?.count>0)return void window.wcBlocksStoreCartListeners.count++;document.body.addEventListener("wc-blocks_added_to_cart",je),document.body.addEventListener("wc-blocks_removed_from_cart",je),window.addEventListener("pageshow",Ce);const e=Se("added_to_cart","wc-blocks_added_to_cart"),t=Se("removed_from_cart","wc-blocks_removed_from_cart");window.wcBlocksStoreCartListeners.count=1,window.wcBlocksStoreCartListeners.remove=()=>{document.body.removeEventListener("wc-blocks_added_to_cart",je),document.body.removeEventListener("wc-blocks_removed_from_cart",je),window.removeEventListener("pageshow",Ce),e(),t()}})(),Pe),[]);const{receiveCart:c,receiveCartContents:n}=(0,_.useDispatch)(G.cartStore),{cartData:a,cartErrors:i,cartTotals:l,cartIsLoading:p,isLoadingRates:m,hasPendingItemsOperations:u}=(0,_.useSelect)(e=>{const t=e(G.cartStore),o=!t.hasFinishedResolution("getCartData",[]);return{cartData:t.getCartData(),cartErrors:t.getCartErrors(),cartTotals:t.getCartTotals(),cartIsLoading:o,isLoadingRates:t.isAddressFieldsForShippingRatesUpdating(),hasPendingItemsOperations:t.hasPendingItemsOperations()}},[]);if(!t)return Te;const h=Re(a.billingAddress,s),g=a.needsShipping?Re(a.shippingAddress,r):h,k={billingAddress:h,billingData:h,cartCoupons:(y=a.coupons,y.length>0?y.map(e=>({...e,label:(0,_e.decodeEntities)(e.code)})):G.EMPTY_CART_COUPONS),cartErrors:i,cartFees:(w=a.fees,w.length>0?w.map(e=>Ie(e)):G.EMPTY_CART_FEES),cartHasCalculatedShipping:a.hasCalculatedShipping,cartIsLoading:p,cartItemErrors:a.errors,cartItems:a.items,cartItemsCount:a.itemsCount,cartItemsWeight:a.itemsWeight,cartNeedsPayment:a.needsPayment,cartNeedsShipping:a.needsShipping,cartTotals:l,crossSellsProducts:a.crossSells,extensions:a.extensions,hasPendingItemsOperations:u,isLoadingRates:m,paymentMethods:a.paymentMethods,paymentRequirements:a.paymentRequirements,receiveCart:c,receiveCartContents:n,shippingAddress:g,shippingRates:(b=a.shippingRates,b.length>0?b.map(e=>({...e,shipping_rates:e.shipping_rates.length>0?e.shipping_rates.map(e=>Ie(e)):[]})):[])};var b,w,y;return o.current&&ge()(o.current,k)||(o.current=k),o.current},Be=e=>e.length,Oe=(0,f.getSetting)("collectableMethodIds",[]),De=e=>Oe.includes(e.method_id),Le=e=>!!I&&(Array.isArray(e)?!!e.find(e=>Oe.includes(e)):Oe.includes(e)),Fe=e=>e.reduce(function(e,t){return e+t.shipping_rates.length},0),Ve=e=>e.find(e=>e.selected)?.rate_id??e[0]?.rate_id,$e=e=>!!(e=>e.some(e=>!!e.shipping_rates.length))(e)&&e.some(e=>e.shipping_rates.some(e=>e.selected)),He=e=>Array.from(new Set(e.flatMap(e=>e.shipping_rates.filter(e=>e.selected).map(e=>e.name)))),ze=e=>Object.fromEntries(e.map(({package_id:e,shipping_rates:t})=>[e,t.find(e=>e.selected)?.rate_id||""]));var Ue=o(20923),qe=o.n(Ue);const We=window.wp.hooks,Ye=()=>({dispatchStoreEvent:(0,d.useCallback)((e,t={})=>{try{(0,We.doAction)(`experimental__woocommerce_blocks-${e}`,t)}catch(e){console.error(e)}},[]),dispatchCheckoutEvent:(0,d.useCallback)((e,t={})=>{try{(0,We.doAction)(`experimental__woocommerce_blocks-checkout-${e}`,{...t,storeCart:(0,_.select)("wc/store/cart").getCartData()})}catch(e){console.error(e)}},[])}),Ge=()=>{const{shippingRates:e,needsShipping:t,hasCalculatedShipping:o,isLoadingRates:s,isShippingRatesStale:r,isCollectable:c,isSelectingRate:n}=(0,_.useSelect)(e=>{const t=e(G.cartStore),o=t.getShippingRates();return{shippingRates:o,needsShipping:t.getNeedsShipping(),hasCalculatedShipping:t.getHasCalculatedShipping(),isLoadingRates:t.isAddressFieldsForShippingRatesUpdating(),isShippingRatesStale:t.isShippingRatesStale(),isCollectable:o.every(({shipping_rates:e})=>e.find(({method_id:e})=>Le(e))),isSelectingRate:t.isShippingRateBeingSelected()}},[]),a=(0,d.useRef)({});(0,d.useEffect)(()=>{const t=ze(e);(0,v.isObject)(t)&&!qe()(a.current,t)&&(a.current=t)},[e]);const{selectShippingRate:i}=(0,_.useDispatch)(G.cartStore),l=Le(Object.values(a.current).map(e=>e.split(":")[0])),{dispatchCheckoutEvent:p}=Ye(),m=(0,d.useCallback)((e,t)=>{let o;void 0!==e&&(o=Le(e.split(":")[0])?i(e,null):i(e,t),o.then(()=>{p("set-selected-shipping-rate",{shippingRateId:e})}).catch(e=>{(0,G.processErrorResponse)(e)}))},[i,p]);return{isSelectingRate:n,selectedRates:a.current,selectShippingRate:m,shippingRates:e,needsShipping:t,hasCalculatedShipping:o,isLoadingRates:s,isShippingRatesStale:r,isCollectable:c,hasSelectedLocalPickup:l}},{NONE:Je,INVALID_ADDRESS:Ke,UNKNOWN:Ze}=se,Qe=(0,d.createContext)(ce),Xe=()=>(0,d.useContext)(Qe),et=({children:e})=>{const{__internalStartCalculation:t,__internalFinishCalculation:o}=(0,_.useDispatch)(G.checkoutStore),{shippingRates:s,isLoadingRates:r,cartErrors:n}=Me(),{selectedRates:a,isSelectingRate:i}=Ge(),[l,p]=(0,d.useReducer)(ne,Je),[m,u]=(0,d.useReducer)(X,{}),h=(0,d.useRef)(m),g=(0,d.useMemo)(()=>({onShippingRateSuccess:pe(u).onSuccess,onShippingRateFail:pe(u).onFail,onShippingRateSelectSuccess:pe(u).onSelectSuccess,onShippingRateSelectFail:pe(u).onSelectFail}),[u]);(0,d.useEffect)(()=>{h.current=m},[m]),(0,d.useEffect)(()=>{r?t():o()},[r,t,o]),(0,d.useEffect)(()=>{i?t():o()},[t,o,i]),(0,d.useEffect)(()=>{n.length>0&&n.some(e=>!(!e.code||!Object.values(re).includes(e.code)))?p({type:Ke}):p({type:Je})},[n]);const k=(0,d.useMemo)(()=>({isPristine:l===Je,isValid:l===Je,hasInvalidAddress:l===Ke,hasError:l===Ze||l===Ke}),[l]);(0,d.useEffect)(()=>{r||0!==s.length&&!k.hasError||ue(h.current,ie,{hasInvalidAddress:k.hasInvalidAddress,hasError:k.hasError})},[s,r,k.hasError,k.hasInvalidAddress]),(0,d.useEffect)(()=>{!r&&s.length>0&&!k.hasError&&ue(h.current,ae,s)},[s,r,k.hasError]),(0,d.useEffect)(()=>{i||(k.hasError?ue(h.current,de,{hasError:k.hasError,hasInvalidAddress:k.hasInvalidAddress}):ue(h.current,le,a.current))},[a,i,k.hasError,k.hasInvalidAddress]);const b={shippingErrorStatus:k,dispatchErrorStatus:p,shippingErrorTypes:se,...g};return(0,c.jsx)(c.Fragment,{children:(0,c.jsx)(Qe.Provider,{value:b,children:e})})};function tt(e,t){const o=(0,d.useRef)();return(0,d.useEffect)(()=>{o.current===e||t&&!t(e,o.current)||(o.current=e)},[e,t]),o.current}const ot=window.wp.notices,st=window.wc.blocksCheckoutEvents,rt=window.wc.wcBlocksRegistry,ct=(0,d.createContext)({onSubmit:()=>{},onCheckoutAfterProcessingWithSuccess:()=>()=>{},onCheckoutAfterProcessingWithError:()=>()=>{},onCheckoutBeforeProcessing:()=>()=>{},onCheckoutValidationBeforeProcessing:()=>()=>{},onCheckoutSuccess:()=>()=>{},onCheckoutFail:()=>()=>{},onCheckoutValidation:()=>()=>{}}),nt=()=>(0,d.useContext)(ct),at=({children:e,redirectUrl:t})=>{const o=(0,rt.getPaymentMethods)(),s=(0,rt.getExpressPaymentMethods)(),r=(0,rt.getExpressPaymentMethods)(),{isEditor:n}=b(),a=(0,_.useRegistry)(),{__internalUpdateAvailablePaymentMethods:i,__internalSetRegisteredExpressPaymentMethods:l}=(0,_.useDispatch)(G.paymentStore);(0,d.useEffect)(()=>{l((e=>{const t={};return Object.keys(e).forEach(o=>{const s=e[o];t[o]={name:s.name,title:s.title,description:s.description,gatewayId:s.gatewayId,supportsStyle:s.supports?.style||[]}}),t})(r))},[l,r]),(0,d.useEffect)(()=>{const e=Object.keys(o).length>0||Object.keys(s).length>0,t=a.select(G.cartStore).hasFinishedResolution("getCartData");(n||e&&t)&&i()},[n,o,s,a,i]);const{__internalSetRedirectUrl:p,__internalEmitValidateEvent:m,__internalEmitAfterProcessingEvents:u,__internalSetBeforeProcessing:h}=(0,_.useDispatch)(G.checkoutStore),{checkoutRedirectUrl:g,checkoutStatus:k,isCheckoutBeforeProcessing:w,isCheckoutAfterProcessing:y,checkoutHasError:f,checkoutOrderId:x,checkoutOrderNotes:v,checkoutCustomerId:S}=(0,_.useSelect)(e=>{const t=e(G.checkoutStore);return{checkoutRedirectUrl:t.getRedirectUrl(),checkoutStatus:t.getCheckoutStatus(),isCheckoutBeforeProcessing:t.isBeforeProcessing(),isCheckoutAfterProcessing:t.isAfterProcessing(),checkoutHasError:t.hasError(),checkoutOrderId:t.getOrderId(),checkoutOrderNotes:t.getOrderNotes(),checkoutCustomerId:t.getCustomerId()}});t&&t!==g&&p(t);const{setValidationErrors:j}=(0,_.useDispatch)(G.validationStore),{dispatchCheckoutEvent:C}=Ye(),P=Object.values(me).filter(e=>e!==me.PAYMENTS&&e!==me.EXPRESS_PAYMENTS),E=(0,_.useSelect)(e=>{const{getNotices:t}=e(ot.store);return P.reduce((e,o)=>[...e,...t(o)],[])},[P]),{paymentNotices:N,expressPaymentNotices:A}=(0,_.useSelect)(e=>{const{getNotices:t}=e(ot.store);return{paymentNotices:t(me.PAYMENTS),expressPaymentNotices:t(me.EXPRESS_PAYMENTS)}},[]),[I]=(0,d.useReducer)(X,{}),R=(0,d.useRef)(I),{onCheckoutValidation:T,onCheckoutSuccess:M,onCheckoutFail:B}=st.checkoutEvents;(0,d.useEffect)(()=>{R.current=I},[I]);const O=(0,d.useMemo)(()=>function(...e){return K()("onCheckoutBeforeProcessing",{alternative:"onCheckoutValidation"}),T(...e)},[T]),D=(0,d.useMemo)(()=>function(...e){return K()("onCheckoutValidationBeforeProcessing",{since:"7.6.0",alternative:"onCheckoutValidation",link:"https://github.com/woocommerce/woocommerce-blocks/pull/8381"}),T(...e)},[T]),L=(0,d.useMemo)(()=>function(...e){return K()("onCheckoutAfterProcessingWithSuccess",{since:"7.6.0",alternative:"onCheckoutSuccess",link:"https://github.com/woocommerce/woocommerce-blocks/pull/8381"}),M(...e)},[M]),F=(0,d.useMemo)(()=>function(...e){return K()("onCheckoutAfterProcessingWithError",{since:"7.6.0",alternative:"onCheckoutFail",link:"https://github.com/woocommerce/woocommerce-blocks/pull/8381"}),B(...e)},[B]);(0,d.useEffect)(()=>{w&&m({setValidationErrors:j})},[w,j,m]);const V=tt(k),$=tt(f);(0,d.useEffect)(()=>{k===V&&f===$||y&&u({notices:{checkoutNotices:E,paymentNotices:N,expressPaymentNotices:A}})},[k,f,g,x,S,v,y,w,V,$,E,A,N,m,u]);const H={onSubmit:(0,d.useCallback)(()=>{C("submit"),h()},[C,h]),onCheckoutBeforeProcessing:O,onCheckoutValidationBeforeProcessing:D,onCheckoutAfterProcessingWithSuccess:L,onCheckoutAfterProcessingWithError:F,onCheckoutSuccess:M,onCheckoutFail:B,onCheckoutValidation:T};return(0,c.jsx)(ct.Provider,{value:H,children:e})},it=window.wp.apiFetch;var lt=o.n(it);(0,x.__)("Something went wrong. Please contact us to get assistance.","woocommerce");const dt=(e,t,o)=>{const s=Object.keys(e).map(t=>({key:t,value:e[t]}),[]),r=`wc-${o}-new-payment-method`;return s.push({key:r,value:t}),s},pt=e=>{if(!e)return;const{__internalSetCustomerId:t}=(0,_.dispatch)(G.checkoutStore);lt().setNonce&&"function"==typeof lt().setNonce&<().setNonce(e),lt().setCartHash&&"function"==typeof lt().setCartHash&<().setCartHash(e),e?.get("User-ID")&&t(parseInt(e.get("User-ID")||"0",10))};function mt(e){const t=(0,d.useRef)(e);return qe()(e,t.current)||(t.current=e),t.current}const ut=()=>{const{customerData:e,isInitialized:t}=(0,_.useSelect)(e=>{const t=e(G.cartStore);return{customerData:t.getCustomerData(),isInitialized:t.hasFinishedResolution("getCartData")}}),{setShippingAddress:o,setBillingAddress:s}=(0,_.useDispatch)(G.cartStore);return{isInitialized:t,billingAddress:e.billingAddress,shippingAddress:e.shippingAddress,setBillingAddress:s,setShippingAddress:o}},ht=()=>{const{isEditor:e,getPreviewData:t}=b(),{needsShipping:o}=Ge(),{useShippingAsBilling:s,prefersCollection:r,editingBillingAddress:c,editingShippingAddress:n}=(0,_.useSelect)(e=>({useShippingAsBilling:e(G.checkoutStore).getUseShippingAsBilling(),prefersCollection:e(G.checkoutStore).prefersCollection(),editingBillingAddress:e(G.checkoutStore).getEditingBillingAddress(),editingShippingAddress:e(G.checkoutStore).getEditingShippingAddress()})),{__internalSetUseShippingAsBilling:a,setEditingBillingAddress:i,setEditingShippingAddress:l}=(0,_.useDispatch)(G.checkoutStore),{billingAddress:p,setBillingAddress:m,shippingAddress:u,setShippingAddress:h}=ut(),g=mt(p),k=mt(u),w=(0,d.useMemo)(()=>fe(g),[g]),y=(0,d.useMemo)(()=>fe(k),[k]),x=(0,d.useCallback)(e=>{m({email:e})},[m]),v=(0,f.getSetting)("forcedBillingAddress",!1);return{shippingAddress:y,billingAddress:w,setShippingAddress:h,setBillingAddress:m,setEmail:x,defaultFields:e?t("defaultFields",f.defaultFields):f.defaultFields,useShippingAsBilling:s,setUseShippingAsBilling:a,editingBillingAddress:c,editingShippingAddress:n,setEditingBillingAddress:i,setEditingShippingAddress:l,needsShipping:o,showShippingFields:!v&&o&&!r,showShippingMethods:o&&!r,showBillingFields:!o||!s||!!r,forcedBillingAddress:v,useBillingAsShipping:v||!!r}},gt=()=>{const{onCheckoutValidation:e}=st.checkoutEvents,{additionalFields:t,customerId:o,customerPassword:s,extensionData:r,hasError:c,isBeforeProcessing:n,isComplete:a,isProcessing:i,orderNotes:l,redirectUrl:p,shouldCreateAccount:m}=(0,_.useSelect)(e=>{const t=e(G.checkoutStore);return{additionalFields:t.getAdditionalFields(),customerId:t.getCustomerId(),customerPassword:t.getCustomerPassword(),extensionData:t.getExtensionData(),hasError:t.hasError(),isBeforeProcessing:t.isBeforeProcessing(),isComplete:t.isComplete(),isProcessing:t.isProcessing(),orderNotes:t.getOrderNotes(),redirectUrl:t.getRedirectUrl(),shouldCreateAccount:t.getShouldCreateAccount()}},[]),{__internalSetHasError:u,__internalProcessCheckoutResponse:h}=(0,_.useDispatch)(G.checkoutStore),g=(0,_.useSelect)(e=>e(G.validationStore).hasValidationErrors,[]),{shippingErrorStatus:k}=Xe(),{shippingAddress:b,billingAddress:w,useBillingAsShipping:y}=ht(),{cartNeedsPayment:f,cartNeedsShipping:S,cartTotals:j,receiveCartContents:C}=Me(),{activePaymentMethod:P,paymentMethodData:E,isExpressPaymentMethodActive:N,hasPaymentError:A,isPaymentReady:I,shouldSavePayment:R}=(0,_.useSelect)(e=>{const t=e(G.paymentStore);return{activePaymentMethod:t.getActivePaymentMethod(),paymentMethodData:t.getPaymentMethodData(),isExpressPaymentMethodActive:t.isExpressPaymentMethodActive(),hasPaymentError:t.hasPaymentError(),isPaymentReady:t.isPaymentReady(),shouldSavePayment:t.getShouldSavePaymentMethod()}},[]),T=(0,rt.getPaymentMethods)(),M=(0,rt.getExpressPaymentMethods)(),B=(0,d.useRef)(w),O=(0,d.useRef)(b),D=(0,d.useRef)(p),[L,F]=(0,d.useState)(!1),V=(0,d.useMemo)(()=>{const e={...M,...T};return e?.[P]?.paymentMethodId},[P,M,T]),$=g()&&!N||A||k.hasError,H=!c&&!$&&(I||!f)&&i;(0,d.useEffect)(()=>{$===c||!i&&!n||N||u($)},[$,c,i,n,N,u]),(0,d.useEffect)(()=>{B.current=w,O.current=b,D.current=p},[w,b,p]);const z=(0,d.useCallback)(()=>g()?void 0!==(0,_.select)(G.validationStore).getValidationError("shipping-rates-error")&&{type:v.responseTypes.ERROR,errorMessage:(0,x.__)("Sorry, this order requires a shipping option.","woocommerce")}:A?{type:v.responseTypes.ERROR,errorMessage:(0,x.__)("There was a problem with your payment option.","woocommerce"),context:"wc/checkout/payments"}:!k.hasError||{type:v.responseTypes.ERROR,errorMessage:(0,x.__)("There was a problem with your shipping option.","woocommerce"),context:"wc/checkout/shipping-methods"},[g,A,k.hasError]);(0,d.useEffect)(()=>{let t;return N||(t=e(z,0)),()=>{N||"function"!=typeof t||t()}},[e,z,N]),(0,d.useEffect)(()=>{window.localStorage.removeItem("WOOCOMMERCE_CHECKOUT_IS_CUSTOMER_DATA_DIRTY"),D.current&&(window.location.href=D.current)},[a]);const U=(0,d.useCallback)(async()=>{if(L)return;F(!0),(()=>{const e=(0,_.select)("wc/store/store-notices").getRegisteredContainers(),{removeNotice:t}=(0,_.dispatch)(ot.store),{getNotices:o}=(0,_.select)(ot.store);e.forEach(e=>{o(e).forEach(o=>{t(o.id,e)})})})();const e=f?{payment_method:V,payment_data:dt(E,R,P)}:{},c=B.current,n=y?c:O.current,a={additional_fields:t,billing_address:c,create_account:m,customer_note:l,customer_password:s,extensions:{...r},shipping_address:S?n:void 0,...!N&&j&&""!==j.total_price?{expected_total:j.total_price}:{},...e};(0,G.clearCheckoutPutRequests)(),lt()({path:"/wc/store/v1/checkout",method:"POST",data:a,cache:"no-store",parse:!1}).then(e=>{if((0,v.assertResponseIsValid)(e),pt(e.headers),!e.ok)throw e;return e.json()}).then(e=>{h(e),F(!1)}).catch(e=>{pt(e?.headers);try{e.json().then(e=>e).then(e=>{e.data?.cart&&C(e.data.cart),(0,G.processErrorResponse)(e),h(e)})}catch{let e=(0,x.__)("Something went wrong when placing the order. Check your email for order updates before retrying.","woocommerce");0!==o&&(e=(0,x.__)("Something went wrong when placing the order. Check your account's order history or your email for order updates before retrying.","woocommerce")),(0,G.processErrorResponse)({code:"unknown_error",message:e,data:null})}u(!0),F(!1)})},[L,f,j,N,V,E,R,P,l,m,o,s,r,t,S,C,u,h,y]);return(0,d.useEffect)(()=>{H&&!L&&U()},[U,H,L]),null},_t=({children:e,redirectUrl:t})=>(0,c.jsx)(at,{redirectUrl:t,children:(0,c.jsx)(et,{children:(0,c.jsxs)(oe,{children:[e,(0,c.jsx)(Y,{renderError:f.CURRENT_USER_IS_ADMIN?null:()=>null,children:(0,c.jsx)(y.PluginArea,{scope:"woocommerce-checkout"})}),(0,c.jsx)(gt,{})]})})}),kt={currency_code:f.SITE_CURRENCY.code,currency_symbol:f.SITE_CURRENCY.symbol,currency_minor_unit:f.SITE_CURRENCY.minorUnit,currency_decimal_separator:f.SITE_CURRENCY.decimalSeparator,currency_thousand_separator:f.SITE_CURRENCY.thousandSeparator,currency_prefix:f.SITE_CURRENCY.prefix,currency_suffix:f.SITE_CURRENCY.suffix},bt=(e,t=2)=>{const o=f.SITE_CURRENCY.minorUnit;if(o===t||!e)return e;const s=Math.pow(10,o);return(Math.round(parseInt(e,10)/Math.pow(10,t))*s).toString()},wt=(0,f.getSetting)("localPickupEnabled",!1),yt=(0,f.getSetting)("localPickupText",(0,x.__)("Local pickup","woocommerce")),ft=(0,f.getSetting)("localPickupCost",""),xt=wt?(0,f.getSetting)("localPickupLocations",[]):[],vt=xt?Object.values(xt).map((e,t)=>({...kt,name:`${yt} (${e.name})`,description:"",delivery_time:"",price:bt(ft,0)||"0",taxes:"0",rate_id:`pickup_location:${t+1}`,instance_id:t+1,meta_data:[{key:"pickup_location",value:e.name},{key:"pickup_address",value:e.formatted_address},{key:"pickup_details",value:e.details}],method_id:"pickup_location",selected:!1})):[],St=[{destination:{address_1:"",address_2:"",city:"",state:"",postcode:"",country:""},package_id:0,name:(0,x.__)("Shipping","woocommerce"),items:[{key:"33e75ff09dd601bbe69f351039152189",name:(0,x._x)("Beanie with Logo","example product in Cart Block","woocommerce"),quantity:2},{key:"6512bd43d9caa6e02c990b0a82652dca",name:(0,x._x)("Beanie","example product in Cart Block","woocommerce"),quantity:1}],shipping_rates:[{...kt,name:(0,x.__)("Flat rate shipping","woocommerce"),description:"",delivery_time:"",price:bt("500"),taxes:"0",rate_id:"flat_rate:0",instance_id:0,meta_data:[],method_id:"flat_rate",selected:!1},{...kt,name:(0,x.__)("Free shipping","woocommerce"),description:"",delivery_time:"",price:"0",taxes:"0",rate_id:"free_shipping:1",instance_id:0,meta_data:[],method_id:"flat_rate",selected:!0},...vt]}],jt=(0,f.getSetting)("displayCartPricesIncludingTax",!1),Ct={coupons:[],shipping_rates:(0,f.getSetting)("shippingMethodsExist",!1)||(0,f.getSetting)("localPickupEnabled",!1)?St:[],items:[{key:"1",parent_item_key:null,id:1,type:"simple",quantity:2,catalog_visibility:"visible",name:(0,x.__)("Beanie","woocommerce"),summary:(0,x.__)("Beanie","woocommerce"),short_description:(0,x.__)("Warm hat for winter","woocommerce"),description:"Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",sku:"woo-beanie",permalink:"https://example.org",low_stock_remaining:2,backorders_allowed:!1,show_backorder_badge:!1,sold_individually:!1,quantity_limits:{minimum:1,maximum:99,multiple_of:1,editable:!0},images:[{id:10,src:j+"previews/beanie.jpg",thumbnail:j+"previews/beanie.jpg",srcset:"",sizes:"",name:"",alt:""}],variation:[{attribute:(0,x.__)("Color","woocommerce"),value:(0,x.__)("Yellow","woocommerce")},{attribute:(0,x.__)("Size","woocommerce"),value:(0,x.__)("Small","woocommerce")}],prices:{...kt,price:bt(jt?"12000":"10000"),regular_price:bt(jt?"120":"100"),sale_price:bt(jt?"12000":"10000"),price_range:null,raw_prices:{precision:6,price:jt?"12000000":"10000000",regular_price:jt?"12000000":"10000000",sale_price:jt?"12000000":"10000000"}},totals:{...kt,line_subtotal:bt("2000"),line_subtotal_tax:bt("400"),line_total:bt("2000"),line_total_tax:bt("400")},extensions:{},item_data:[]},{key:"2",parent_item_key:null,id:2,type:"simple",quantity:1,catalog_visibility:"visible",name:(0,x.__)("Cap","woocommerce"),summary:(0,x.__)("Cap","woocommerce"),short_description:(0,x.__)("Lightweight baseball cap","woocommerce"),description:"Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",sku:"woo-cap",low_stock_remaining:null,permalink:"https://example.org",backorders_allowed:!1,show_backorder_badge:!1,sold_individually:!1,quantity_limits:{minimum:1,maximum:99,multiple_of:1,editable:!0},images:[{id:11,src:j+"previews/cap.jpg",thumbnail:j+"previews/cap.jpg",srcset:"",sizes:"",name:"",alt:""}],variation:[{attribute:(0,x.__)("Color","woocommerce"),value:(0,x.__)("Orange","woocommerce")}],prices:{...kt,price:bt(jt?"2400":"2000"),regular_price:bt(jt?"2400":"2000"),sale_price:bt(jt?"2400":"2000"),price_range:null,raw_prices:{precision:6,price:jt?"24000000":"20000000",regular_price:jt?"24000000":"20000000",sale_price:jt?"24000000":"20000000"}},totals:{...kt,line_subtotal:bt("2000"),line_subtotal_tax:bt("400"),line_total:bt("2000"),line_total_tax:bt("400")},extensions:{},item_data:[]}],cross_sells:[{id:1,name:(0,x.__)("Polo","woocommerce"),slug:"polo",parent:0,type:"simple",variation:"",permalink:"https://example.org",sku:"woo-polo",short_description:(0,x.__)("Polo","woocommerce"),description:(0,x.__)("Polo","woocommerce"),on_sale:!1,prices:{...kt,price:bt(jt?"24000":"20000"),regular_price:bt(jt?"24000":"20000"),sale_price:bt(jt?"12000":"10000"),price_range:null},price_html:"",average_rating:"4.5",review_count:2,images:[{id:17,src:j+"previews/polo.jpg",thumbnail:j+"previews/polo.jpg",srcset:"",sizes:"",name:"",alt:""}],categories:[],tags:[],attributes:[],variations:[],has_options:!1,is_purchasable:!0,is_in_stock:!0,is_on_backorder:!1,low_stock_remaining:null,sold_individually:!1,add_to_cart:{text:"",description:"",url:"",minimum:1,maximum:99,multiple_of:1}},{id:2,name:(0,x.__)("Long Sleeve Tee","woocommerce"),slug:"long-sleeve-tee",parent:0,type:"simple",variation:"",permalink:"https://example.org",sku:"woo-long-sleeve-tee",short_description:(0,x.__)("Long Sleeve Tee","woocommerce"),description:(0,x.__)("Long Sleeve Tee","woocommerce"),on_sale:!1,prices:{...kt,price:bt(jt?"30000":"25000"),regular_price:bt(jt?"30000":"25000"),sale_price:bt(jt?"30000":"25000"),price_range:null},price_html:"",average_rating:"4",review_count:2,images:[{id:17,src:j+"previews/long-sleeve-tee.jpg",thumbnail:j+"previews/long-sleeve-tee.jpg",srcset:"",sizes:"",name:"",alt:""}],categories:[],tags:[],attributes:[],variations:[],has_options:!1,is_purchasable:!0,is_in_stock:!0,is_on_backorder:!1,low_stock_remaining:null,sold_individually:!1,add_to_cart:{text:"",description:"",url:"",minimum:1,maximum:99,multiple_of:1}},{id:3,name:(0,x.__)("Hoodie with Zipper","woocommerce"),slug:"hoodie-with-zipper",parent:0,type:"simple",variation:"",permalink:"https://example.org",sku:"woo-hoodie-with-zipper",short_description:(0,x.__)("Hoodie with Zipper","woocommerce"),description:(0,x.__)("Hoodie with Zipper","woocommerce"),on_sale:!0,prices:{...kt,price:bt(jt?"15000":"12500"),regular_price:bt(jt?"30000":"25000"),sale_price:bt(jt?"15000":"12500"),price_range:null},price_html:"",average_rating:"1",review_count:2,images:[{id:17,src:j+"previews/hoodie-with-zipper.jpg",thumbnail:j+"previews/hoodie-with-zipper.jpg",srcset:"",sizes:"",name:"",alt:""}],categories:[],tags:[],attributes:[],variations:[],has_options:!1,is_purchasable:!0,is_in_stock:!0,is_on_backorder:!1,low_stock_remaining:null,sold_individually:!1,add_to_cart:{text:"",description:"",url:"",minimum:1,maximum:99,multiple_of:1}},{id:4,name:(0,x.__)("Hoodie with Logo","woocommerce"),slug:"hoodie-with-logo",parent:0,type:"simple",variation:"",permalink:"https://example.org",sku:"woo-hoodie-with-logo",short_description:(0,x.__)("Polo","woocommerce"),description:(0,x.__)("Polo","woocommerce"),on_sale:!1,prices:{...kt,price:bt(jt?"4500":"4250"),regular_price:bt(jt?"4500":"4250"),sale_price:bt(jt?"4500":"4250"),price_range:null},price_html:"",average_rating:"5",review_count:2,images:[{id:17,src:j+"previews/hoodie-with-logo.jpg",thumbnail:j+"previews/hoodie-with-logo.jpg",srcset:"",sizes:"",name:"",alt:""}],categories:[],tags:[],attributes:[],variations:[],has_options:!1,is_purchasable:!0,is_in_stock:!0,is_on_backorder:!1,low_stock_remaining:null,sold_individually:!1,add_to_cart:{text:"",description:"",url:"",minimum:1,maximum:99,multiple_of:1}},{id:5,name:(0,x.__)("Hoodie with Pocket","woocommerce"),slug:"hoodie-with-pocket",parent:0,type:"simple",variation:"",permalink:"https://example.org",sku:"woo-hoodie-with-pocket",short_description:(0,x.__)("Hoodie with Pocket","woocommerce"),description:(0,x.__)("Hoodie with Pocket","woocommerce"),on_sale:!0,prices:{...kt,price:bt(jt?"3500":"3250"),regular_price:bt(jt?"4500":"4250"),sale_price:bt(jt?"3500":"3250"),price_range:null},price_html:"",average_rating:"3.75",review_count:4,images:[{id:17,src:j+"previews/hoodie-with-pocket.jpg",thumbnail:j+"previews/hoodie-with-pocket.jpg",srcset:"",sizes:"",name:"",alt:""}],categories:[],tags:[],attributes:[],variations:[],has_options:!1,is_purchasable:!0,is_in_stock:!0,is_on_backorder:!1,low_stock_remaining:null,sold_individually:!1,add_to_cart:{text:"",description:"",url:"",minimum:1,maximum:99,multiple_of:1}},{id:6,name:(0,x.__)("T-Shirt","woocommerce"),slug:"t-shirt",parent:0,type:"simple",variation:"",permalink:"https://example.org",sku:"woo-t-shirt",short_description:(0,x.__)("T-Shirt","woocommerce"),description:(0,x.__)("T-Shirt","woocommerce"),on_sale:!1,prices:{...kt,price:bt(jt?"1800":"1500"),regular_price:bt(jt?"1800":"1500"),sale_price:bt(jt?"1800":"1500"),price_range:null},price_html:"",average_rating:"3",review_count:2,images:[{id:17,src:j+"previews/tshirt.jpg",thumbnail:j+"previews/tshirt.jpg",srcset:"",sizes:"",name:"",alt:""}],categories:[],tags:[],attributes:[],variations:[],has_options:!1,is_purchasable:!0,is_in_stock:!0,is_on_backorder:!1,low_stock_remaining:null,sold_individually:!1,add_to_cart:{text:"",description:"",url:"",minimum:1,maximum:99,multiple_of:1}}],fees:[{id:"fee",name:(0,x.__)("Fee","woocommerce"),totals:{...kt,total:bt("100"),total_tax:bt("20")}}],items_count:3,items_weight:0,needs_payment:!0,needs_shipping:R,has_calculated_shipping:!0,shipping_address:{first_name:"",last_name:"",company:"",address_1:"",address_2:"",city:"",state:"",postcode:"",country:"",phone:""},billing_address:{first_name:"",last_name:"",company:"",address_1:"",address_2:"",city:"",state:"",postcode:"",country:"",email:"",phone:""},totals:{...kt,total_items:bt("4000"),total_items_tax:bt("800"),total_fees:bt("100"),total_fees_tax:bt("20"),total_discount:"0",total_discount_tax:"0",total_shipping:"0",total_shipping_tax:"0",total_tax:bt("820"),total_price:bt("4920"),tax_lines:[{name:(0,x.__)("Sales tax","woocommerce"),rate:"20%",price:bt("820")}]},errors:[],payment_methods:["cod","bacs","cheque"],payment_requirements:["products"],extensions:{}},Pt={cc:[{method:{gateway:"credit-card",last4:"5678",brand:"Visa"},expires:"12/20",is_default:!1,tokenId:"1"}]},Et=window.wc.blocksCheckout,Nt=window.wp.url,At=window.wp.coreData;var It=o(19437);const Rt=(0,d.forwardRef)(({children:e,className:t=""},o)=>(0,c.jsx)("div",{ref:o,className:(0,s.A)("wc-block-components-main",t),children:e})),Tt={showOrderNotes:!0,showPolicyLinks:!0,showReturnToCart:!1,cartPageId:0,showRateAfterTaxName:!1,showFormStepNumbers:!1,defaultFields:f.defaultFields},Mt=(0,d.createContext)(Tt),Bt=()=>{const e=(0,d.useContext)(Mt);return{...Tt,...e}},Ot=["core/paragraph","core/image","core/separator"],Dt=e=>{const t=(0,Et.applyCheckoutFilter)({filterName:"additionalCartCheckoutInnerBlockTypes",defaultValue:[],extensions:(0,_.select)(G.cartStore).getCartData().extensions,arg:{block:e},validation:e=>{if(Array.isArray(e)&&e.every(e=>"string"==typeof e))return!0;throw new Error("allowedBlockTypes filters must return an array of strings.")}});return Array.from(new Set([...(0,i.getBlockTypes)().filter(t=>(t?.parent||[]).includes(e)).map(({name:e})=>e),...Ot,...t]))},Lt=({clientId:e,registeredBlocks:t,defaultTemplate:o=[]})=>{const s=(0,d.useRef)(t),r=(0,d.useRef)(o),c=(0,_.useRegistry)(),{isPreview:n}=b();(0,d.useEffect)(()=>{let t=!1;if(n)return;const{replaceInnerBlocks:o}=(0,_.dispatch)("core/block-editor");return c.subscribe(()=>{if(!c.select("core/block-editor").getBlock(e))return;const n=c.select("core/block-editor").getBlocks(e);if(0===n.length&&r.current.length>0&&!t){const s=(0,i.createBlocksFromInnerBlocksTemplate)(r.current);if(0!==s.length)return t=!0,void o(e,s)}const a=s.current.map(e=>(0,i.getBlockType)(e)),l=((e,t)=>{const o=t.filter(e=>e&&(({attributes:e})=>Boolean(e.lock?.remove||e.lock?.default?.remove))(e)),s=[];return o.forEach(t=>{if(void 0===t)return;const o=e.find(e=>e.name===t.name);o||s.push(t)}),s})(n,a);if(0===l.length)return;let d=-1;const p=l.map(e=>{const t=r.current.findIndex(([t])=>t===e.name),o=(0,i.createBlock)(e.name);return-1===d&&(d=(({defaultTemplatePosition:e,innerBlocks:t,currentDefaultTemplate:o})=>{switch(e){case-1:return t.length;case 0:return 0;default:const s=o.current[e-1],r=t.findIndex(({name:e})=>e===s[0]);return-1===r?e:r+1}})({defaultTemplatePosition:t,innerBlocks:n,currentDefaultTemplate:r})),o});c.batch(()=>{c.dispatch("core/block-editor").insertBlocks(p,d,e)})},"core/block-editor")},[e,n,c])};o(94793);const Ft=window.wp.components,Vt=()=>{const{defaultFields:e}=Bt(),t=(e,t)=>{["phone","company","address_2"].includes(e)&&["optional","required","hidden"].includes(t)&&(0,_.dispatch)(At.store).editEntityRecord("root","site",void 0,{[`woocommerce_checkout_${e}_field`]:t})},o=[{label:(0,x.__)("Optional","woocommerce"),value:"false"},{label:(0,x.__)("Required","woocommerce"),value:"true"}];return(0,c.jsx)(l.InspectorControls,{children:(0,c.jsxs)(Ft.PanelBody,{title:(0,x.__)("Address Fields","woocommerce"),children:[(0,c.jsx)("p",{className:"wc-block-checkout__controls-text",children:(0,x.__)("Show or hide fields in the checkout address forms.","woocommerce")}),(0,c.jsx)(Ft.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,x.__)("Company","woocommerce"),checked:!e.company.hidden,onChange:()=>{e.company.hidden?t("company","optional"):t("company","hidden")}}),!e.company.hidden&&(0,c.jsx)(Ft.RadioControl,{selected:e.company.required?"true":"false",options:o,onChange:e=>{t("company","true"===e?"required":"optional")},className:"components-base-control--nested wc-block-components-require-company-field"}),(0,c.jsx)(Ft.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,x.__)("Address line 2","woocommerce"),checked:!e.address_2.hidden,onChange:()=>{e.address_2.hidden?t("address_2","optional"):t("address_2","hidden")}}),!e.address_2.hidden&&(0,c.jsx)(Ft.RadioControl,{selected:e.address_2.required?"true":"false",options:o,onChange:e=>{t("address_2","true"===e?"required":"optional")},className:"components-base-control--nested wc-block-components-require-address_2-field"}),(0,c.jsx)(Ft.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,x.__)("Phone","woocommerce"),checked:!e.phone.hidden,onChange:()=>{e.phone.hidden?t("phone","optional"):t("phone","hidden")}}),!e.phone.hidden&&(0,c.jsx)(Ft.RadioControl,{selected:e.phone.required?"true":"false",options:o,onChange:e=>{t("phone","true"===e?"required":"optional")},className:"components-base-control--nested wc-block-components-require-phone-field"})]})})},$t=JSON.parse('{"name":"woocommerce/checkout-fields-block","title":"Checkout Fields","description":"Column containing checkout address fields.","category":"woocommerce","supports":{"align":false,"html":false,"multiple":false,"reusable":false,"inserter":false,"lock":false},"attributes":{"className":{"type":"string","default":""},"lock":{"type":"object","default":{"remove":true,"move":true}}},"parent":["woocommerce/checkout"],"textdomain":"woocommerce","$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3}');(0,i.registerBlockType)($t,{icon:{src:(0,c.jsx)(a.A,{icon:It.A,className:"wc-block-editor-components-block-icon"})},edit:({clientId:e,attributes:t})=>{const o=(0,l.useBlockProps)({className:(0,s.A)("wc-block-checkout__main",t?.className)}),r=Dt(Et.innerBlockAreas.CHECKOUT_FIELDS),{showFormStepNumbers:n}=Bt(),a=[["woocommerce/checkout-express-payment-block",{},[]],["woocommerce/checkout-contact-information-block",{},[]],["woocommerce/checkout-shipping-method-block",{},[]],["woocommerce/checkout-pickup-options-block",{},[]],["woocommerce/checkout-shipping-address-block",{},[]],["woocommerce/checkout-billing-address-block",{},[]],["woocommerce/checkout-shipping-methods-block",{},[]],["woocommerce/checkout-payment-block",{},[]],["woocommerce/checkout-additional-information-block",{},[]],["woocommerce/checkout-order-note-block",{},[]],["woocommerce/checkout-terms-block",{},[]],["woocommerce/checkout-actions-block",{},[]]].filter(Boolean);return Lt({clientId:e,registeredBlocks:r,defaultTemplate:a}),(0,c.jsxs)(Rt,{...o,children:[(0,c.jsx)(Vt,{}),(0,c.jsx)("form",{className:(0,s.A)("wc-block-components-form wc-block-checkout__form",{"wc-block-checkout__form--with-step-numbers":n}),children:(0,c.jsx)(l.InnerBlocks,{allowedBlocks:r,templateLock:!1,template:a,renderAppender:l.InnerBlocks.ButtonBlockAppender})})]})},save:()=>(0,c.jsx)("div",{...l.useBlockProps.save(),children:(0,c.jsx)(l.InnerBlocks.Content,{})})});const Ht=(0,d.forwardRef)(({children:e,className:t=""},o)=>(0,c.jsx)("div",{ref:o,className:(0,s.A)("wc-block-components-sidebar",t),children:e}));o(6811);const zt=JSON.parse('{"name":"woocommerce/checkout-totals-block","title":"Checkout Totals","description":"Column containing the checkout totals.","category":"woocommerce","supports":{"align":false,"html":false,"multiple":false,"reusable":false,"inserter":false,"lock":false},"attributes":{"className":{"type":"string","default":""},"checkbox":{"type":"boolean","default":false},"text":{"type":"string","required":false}},"parent":["woocommerce/checkout"],"textdomain":"woocommerce","$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3}');(0,i.registerBlockType)(zt,{icon:{src:(0,c.jsx)(a.A,{icon:It.A,className:"wc-block-editor-components-block-icon"})},edit:({clientId:e,attributes:t})=>{const o=(0,l.useBlockProps)({className:(0,s.A)("wc-block-checkout__sidebar",t?.className)}),r=Dt(Et.innerBlockAreas.CHECKOUT_TOTALS),n=[["woocommerce/checkout-order-summary-block",{},[]]];return Lt({clientId:e,registeredBlocks:r,defaultTemplate:n}),(0,c.jsx)(Ht,{...o,children:(0,c.jsx)(l.InnerBlocks,{allowedBlocks:r,templateLock:!1,template:n,renderAppender:l.InnerBlocks.ButtonBlockAppender})})},save:()=>(0,c.jsx)("div",{...l.useBlockProps.save(),children:(0,c.jsx)(l.InnerBlocks.Content,{})})});var Ut=o(29312);const qt=window.wc.blocksComponents,Wt=({children:e,stepHeadingContent:t})=>(0,c.jsxs)("div",{className:"wc-block-components-checkout-step__heading",children:[(0,c.jsx)(qt.Title,{className:"wc-block-components-checkout-step__title",headingLevel:"2",children:e}),!!t&&(0,c.jsx)("span",{className:"wc-block-components-checkout-step__heading-content",children:t})]}),Yt=({attributes:e,setAttributes:t,className:o="",children:r})=>{const{showFormStepNumbers:n}=Bt(),{title:a="",description:i=""}=e,d=(0,l.useBlockProps)({className:(0,s.A)("wc-block-components-checkout-step",o,{"wc-block-components-checkout-step--with-step-number":n})});return(0,c.jsxs)("div",{...d,children:[(0,c.jsxs)("div",{className:"wc-block-components-checkout-step__heading-container",children:[(0,c.jsx)(Wt,{children:(0,c.jsx)(l.PlainText,{className:"",value:a,onChange:e=>t({title:e}),style:{backgroundColor:"transparent"}})}),(0,c.jsx)("p",{className:"wc-block-components-checkout-step__description",children:(0,c.jsx)(l.PlainText,{className:i?"":"wc-block-components-checkout-step__description-placeholder",value:i,placeholder:(0,x.__)("Optional text for this form step.","woocommerce"),onChange:e=>t({description:e}),style:{backgroundColor:"transparent"}})})]}),(0,c.jsx)("div",{className:"wc-block-components-checkout-step__content",children:r})]})};o(62862);const Gt=({block:e})=>{const{"data-block":t}=(0,l.useBlockProps)(),o=Dt(e);return Lt({clientId:t,registeredBlocks:o}),(0,c.jsx)("div",{className:"wc-block-checkout__additional_fields",children:(0,c.jsx)(l.InnerBlocks,{allowedBlocks:o})})},Jt=()=>(0,c.jsx)(l.InnerBlocks.Content,{});var Kt=o(55583),Zt=o(28107),Qt=o(64347);const Xt=["BUTTON","FIELDSET","INPUT","OPTGROUP","OPTION","SELECT","TEXTAREA","A"],eo=({children:e,style:t={},...o})=>{const s=(0,d.useRef)(null),r=()=>{s.current&&Zt.focus.focusable.find(s.current).forEach(e=>{Xt.includes(e.nodeName)&&e.setAttribute("tabindex","-1"),e.hasAttribute("contenteditable")&&e.setAttribute("contenteditable","false")})},n=(0,Qt.YQ)(r,0,{leading:!0});return(0,d.useLayoutEffect)(()=>{let e;return r(),s.current&&(e=new window.MutationObserver(n),e.observe(s.current,{childList:!0,attributes:!0,subtree:!0})),()=>{e&&e.disconnect(),n.cancel()}},[n]),(0,c.jsx)("div",{ref:s,"aria-disabled":"true",style:{userSelect:"none",pointerEvents:"none",cursor:"normal",...t},...o,children:e})};o(44249);var to=o(10149);o(48306);const oo=e=>{const{onChange:t,options:o,label:r,value:n="",className:i,size:l,errorId:p,required:m,errorMessage:u=(0,x.__)("Please select a valid option","woocommerce"),placeholder:h,...g}=e,k=(0,d.useCallback)(e=>{t(e.target.value)},[t]),b=(0,Et.getFieldLabel)(r),w=(0,d.useMemo)(()=>({value:"",label:h??(0,x.sprintf)( // translators: %s will be label of the field. For example "country/region". // translators: %s will be label of the field. For example "country/region". (0,x.__)("Select a %s","woocommerce"),b),disabled:!!m}),[h,m,b]),y=(0,d.useId)(),f=g.id||`wc-blocks-components-select-${y}`,v=p||f,S=(0,d.useMemo)(()=>[w].concat(o),[w,o]),{setValidationErrors:j,clearValidationError:C}=(0,_.useDispatch)(G.validationStore),{error:P,validationErrorId:E}=(0,_.useSelect)(e=>{const t=e(G.validationStore);return{error:t.getValidationError(v),validationErrorId:t.getValidationErrorId(v)}},[v]);(0,d.useEffect)(()=>(!m||n?C(v):j({[v]:{message:u,hidden:!0}}),()=>{C(v)}),[C,n,v,u,m,j]);const N=(0,_.useSelect)(e=>e(G.validationStore).getValidationError(v||"")||{hidden:!0},[v]);return(0,c.jsxs)("div",{className:(0,s.A)(i,{"has-error":!N.hidden}),children:[(0,c.jsx)("div",{className:"wc-blocks-components-select",children:(0,c.jsxs)("div",{className:"wc-blocks-components-select__container",children:[(0,c.jsx)("label",{htmlFor:f,className:"wc-blocks-components-select__label",children:r}),(0,c.jsx)("select",{className:"wc-blocks-components-select__select",id:f,size:void 0!==l?l:1,onChange:k,value:n,"aria-invalid":!(!P?.message||P?.hidden),"aria-errormessage":E,...g,children:S.map(e=>(0,c.jsx)("option",{value:e.value,"data-alternate-values":`[${e.label}]`,disabled:void 0!==e.disabled&&e.disabled,children:e.label},e.value))}),(0,c.jsx)(a.A,{className:"wc-blocks-components-select__expand",icon:to.A})]})}),(0,c.jsx)(qt.ValidationInputError,{propertyName:v})]})},so=({className:e,countries:t,id:o,errorId:r,label:n,onChange:a,value:i="",autoComplete:l="off",required:p=!1})=>{const m=(0,d.useMemo)(()=>{const e=Object.entries(t).map(([e,t])=>({value:e,label:(0,_e.decodeEntities)(t)})),o="string"==typeof i?i:"";if(o&&!(0,v.objectHasProp)(t,o)){const t=(0,f.getSettingWithCoercion)("countries",{},v.isObject)[o];e.push({value:o,label:(0,_e.decodeEntities)((0,v.isString)(t)&&t?t:o),disabled:!0})}return e},[t,i]);return(0,c.jsx)(oo,{className:(0,s.A)(e,"wc-block-components-country-input"),id:o,errorId:r,label:n||"",onChange:a,options:m,value:i,required:p,autoComplete:l})},ro=e=>{const{...t}=e;return(0,c.jsx)(so,{countries:D,...t})},co=e=>(0,c.jsx)(so,{countries:D,...e}),no=(e,t)=>{const o=t.find(t=>t.label.toLocaleUpperCase()===e.toLocaleUpperCase()||t.value.toLocaleUpperCase()===e.toLocaleUpperCase());return o?o.value:""},ao=({className:e,id:t,states:o,country:r,label:n,onChange:a,autoComplete:i="off",value:l="",required:p=!1})=>{const m=o[r],u=(0,d.useMemo)(()=>m&&Object.keys(m).length>0?Object.keys(m).map(e=>({value:e,label:(0,_e.decodeEntities)(m[e])})):[],[m]),h=(0,d.useCallback)(e=>{const t=u.length>0?no(e,u):e;t!==l&&a(t)},[a,u,l]),g=(0,d.useRef)(l);return(0,d.useEffect)(()=>{g.current!==l&&(g.current=l)},[l]),(0,d.useEffect)(()=>{if(u.length>0&&g.current){const e=no(g.current,u);e!==g.current&&h(e)}},[u,h]),u.length>0?(0,c.jsx)(oo,{className:(0,s.$)(e,"wc-block-components-state-input"),options:u,label:n||"",id:t,onChange:h,value:l,autoComplete:i,required:p}):(0,c.jsx)(qt.ValidatedTextInput,{className:e,id:t,label:n,onChange:h,autoComplete:i,value:l,required:p})},io=e=>{const{...t}=e;return(0,c.jsx)(ao,{states:L,...t})},lo=e=>(0,c.jsx)(ao,{states:L,...e});var po=o(39049),mo=o(16874);o(32770);const uo=({field:e,props:t,onChange:o,value:s})=>{const r=e?.required??!1,n=tt(r),[a,i]=(0,d.useState)(()=>Boolean(s)||r),l=(0,Et.getFieldLabel)(e.label);(0,d.useEffect)(()=>{n!==r&&i(Boolean(s)||r)},[s,n,r]);const p=(0,d.useCallback)(e=>{o(e),i(!0)},[o]);return(0,d.useEffect)(()=>{s&&i(!0)},[s]),(0,c.jsx)(d.Fragment,{children:a?(0,c.jsx)(qt.ValidatedTextInput,{...t,type:e.type,label:r?e.label:e.optionalLabel,className:"wc-block-components-address-form__address_2",value:s,onChange:e=>o(e)}):(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(mo.$,{render:(0,c.jsx)("span",{}),className:"wc-block-components-address-form__address_2-toggle",onClick:()=>i(!0),children:(0,x.sprintf)( // translators: %s: address 2 field label. // translators: %s: address 2 field label. (0,x.__)("+ Add %s","woocommerce"),l)}),(0,c.jsx)("input",{type:"text",tabIndex:-1,className:"wc-block-components-address-form__address_2-hidden-input","aria-hidden":"true","aria-label":e.label,autoComplete:t?.autoComplete,id:t?.id,value:s,onChange:e=>p(e.target.value)})]})})},ho=["billing","shipping"],go=(e,t)=>{if("string"!=typeof e)return;const o=e.trim();if(!o)return;const s=o.toLowerCase();if("on"===s||"off"===s)return o;if(o.includes(" "))return o;const r="string"==typeof t?t.trim().toLowerCase():"";return ho.includes(r)?`section-${r} ${r} ${o}`:o},_o=(e,t,o)=>({id:`${t}-${e?.key}`.replaceAll("/","-"),errorId:`${o}_${e?.key}`,name:`${o}_${e?.key}`,label:(e?.required?e?.label:e?.optionalLabel)||"",autoCapitalize:e?.autocapitalize,autoComplete:go(e?.autocomplete,o),errorMessage:e?.errorMessage||"",required:e?.required,placeholder:e?.placeholder,className:`wc-block-components-address-form__${e?.key}`.replaceAll("/","-"),...e?.attributes}),ko=(e,t,o)=>{const s=t.find(t=>t.key===e),r=(0,v.objectHasProp)(o,e)?o[e]:"";return s?{field:{...s,key:e},value:r}:null},bo=(e,t)=>(0,v.isObject)(e[t])&&Object.keys(e[t]).length>0;o(64927);const wo=window.wc.sanitize;function yo(e,t){const o=(0,_e.decodeEntities)(e),s=[];let r=0;return Array.isArray(t)?(t.filter(e=>e&&"number"==typeof e.offset&&"number"==typeof e.length&&e.offset>=0&&e.length>0&&e.offset+e.length<=o.length).forEach((e,t)=>{e.offset>r&&s.push(o.slice(r,e.offset)),s.push((0,c.jsx)("strong",{children:o.slice(e.offset,e.offset+e.length)},`match-${t}`)),r=e.offset+e.length}),r<o.length&&s.push(o.slice(r)),s):[o]}const fo=({suggestions:e,branding:t,selectedSuggestion:o,addressType:s,onSuggestionClick:r})=>{if(!e)return null;const n=`address-suggestions-${s}-list`;return(0,c.jsxs)("div",{className:"wc-block-components-address-autocomplete-suggestions",role:"region","aria-live":"polite",children:[(0,c.jsx)("ul",{className:"suggestions-list",id:n,role:"listbox","aria-label":"Address suggestions",children:e.slice(0,5).map((e,t)=>(0,c.jsx)("li",{id:`suggestion-item-${s}-${t}`,className:"wc-block-components-address-autocomplete-suggestion"+(o===t?" active":""),role:"option",tabIndex:-1,"aria-selected":o===t,onClick:()=>r(e.id),style:{cursor:"pointer"},children:yo(e?.label,e?.matchedSubstrings||[])},e.id))}),t?(0,c.jsx)("div",{className:"woocommerce-address-autocomplete-branding",dangerouslySetInnerHTML:{__html:(0,wo.sanitizeHTML)(t,{tags:["a","img","span","br"],attr:["href","target","rel","src","alt","style","width","height"]})}}):null]})},xo=(0,f.getSettingWithCoercion)("addressAutocompleteProviders",[],e=>!!Array.isArray(e)&&e.every(e=>"string"==typeof e.name&&"string"==typeof e.id&&"string"==typeof e.branding_html));function vo(e){const{country:t,registeredProviders:o}=(0,_.useSelect)(t=>{const o="shipping"===e?"shippingAddress":"billingAddress";return{country:t("wc/store/cart").getCartData()?.[o]?.country,registeredProviders:t("wc/store/checkout").getRegisteredAutocompleteProviders()}},[e]),{setActiveAddressAutocompleteProvider:s}=(0,_.useDispatch)("wc/store/checkout");(0,d.useEffect)(()=>{if(!window?.wc?.addressAutocomplete?.providers)return s("",e),void(window?.wc?.addressAutocomplete?.activeProvider&&(window.wc.addressAutocomplete.activeProvider[e]=null));for(const o of xo){const r=window?.wc?.addressAutocomplete?.providers?.[o.id];if(r&&r.canSearch(t))return s(r.id,e),void(window.wc.addressAutocomplete.activeProvider[e]=r)}s("",e),window?.wc?.addressAutocomplete?.activeProvider&&(window.wc.addressAutocomplete.activeProvider[e]=null)},[e,t,s,o])}const So=({addressType:e,id:t,...o})=>{vo(e);const{useShippingAsBilling:s,useBillingAsShipping:r}=ht(),n=(0,d.useRef)(null),a=(0,d.useRef)(null),i=(0,f.getSettingWithCoercion)("addressAutocompleteProviders",[],e=>!!Array.isArray(e)&&e.every(e=>"string"==typeof e.name&&"string"==typeof e.id&&"string"==typeof e.branding_html)),{country:l,registeredProviders:p}=(0,_.useSelect)(t=>{const o=t(G.cartStore),s=t(G.checkoutStore),r="shipping"===e?"shippingAddress":"billingAddress",c=o.getCartData();return{country:c?.[r]?.country||"",registeredProviders:s.getRegisteredAutocompleteProviders()||[]}},[e]),{setActiveAddressAutocompleteProvider:m}=(0,_.useDispatch)(G.checkoutStore),{setBillingAddress:u,setShippingAddress:h}=(0,_.useDispatch)(G.cartStore),[g,k]=(0,d.useState)(""),b=(0,_.useSelect)(t=>t(G.checkoutStore).getActiveAutocompleteProvider(e),[e]);(0,d.useEffect)(()=>{if(!window?.wc?.addressAutocomplete?.providers)return;const e=i.find(e=>e.id===b)?.branding_html||"";k(e)},[l,p,m,e,i,b]);const[w,y]=(0,d.useState)([]),[x,v]=(0,d.useState)(""),[S,j]=(0,d.useState)(!1),C=(0,d.useRef)(null),P=(0,d.useRef)(!1),E=(0,d.useRef)(null),N=(0,d.useRef)(!1),A=(0,d.useRef)(0);(0,d.useEffect)(()=>{if(S||x.length<3||C.current)return void y([]);const t=window?.wc?.addressAutocomplete?.activeProvider?.[e];if(t){const e=++A.current;t.search(x,l).then(t=>{if(e!==A.current)return;const o=n.current?.inputRef?.current;o&&function(e){try{return e.matches(":-webkit-autofill")}catch{return!1}}(o)?y([]):t&&t.length?y(t):y([])}).catch(()=>{y([])})}},[x]),(0,d.useEffect)(()=>()=>{C.current&&clearTimeout(C.current),E.current&&clearTimeout(E.current)},[]),(0,d.useEffect)(()=>{const e=n.current?.inputRef?.current;if(e)return a.current=new MutationObserver(()=>{"on"===e.getAttribute("data-disable-autocomplete")?(e.setAttribute("data-1p-ignore","true"),e.setAttribute("autocomplete","none")):(e.removeAttribute("data-1p-ignore"),o.autoComplete?e.setAttribute("autocomplete",o.autoComplete):e.removeAttribute("autocomplete"));const t=e.parentElement;if(t){const o=e.ownerDocument.activeElement===e,s=e.selectionStart,r=e.selectionEnd;t.appendChild(t.removeChild(e)),o&&(e.focus(),null!==s&&null!==r&&e.setSelectionRange(s,r))}}),a.current.observe(e,{attributes:!0,attributeFilter:["data-disable-autocomplete"]}),()=>{a.current&&(a.current.disconnect(),a.current=null)}},[o.autoComplete]),(0,d.useEffect)(()=>{const e=n.current?.inputRef?.current;if(!e)return;const t=e=>{const t=e,{inputType:o}=t;"insertReplacementText"===o?N.current=!0:o&&(P.current=!0,E.current&&clearTimeout(E.current),E.current=setTimeout(()=>{P.current=!1},200))};return e.addEventListener("input",t),()=>{e.removeEventListener("input",t)}},[]);const[I,R]=(0,d.useState)(-1),T=`address-suggestions-${e}-list`,M=I>=0?`suggestion-item-${e}-${I}`:void 0;return(0,c.jsxs)("div",{className:"wc-block-components-address-autocomplete-container",children:[(0,c.jsx)(qt.ValidatedTextInput,{...o,id:t,ref:n,onChange:e=>{if(o.onChange(e),!S&&!C.current)return N.current?(N.current=!1,v(""),void y([])):void(P.current&&v(e))},onKeyDown:t=>{if(0!==w.length)if("ArrowDown"===t.key)t.preventDefault(),R(e=>e<w.length-1?e+1:0);else if("ArrowUp"===t.key)t.preventDefault(),R(e=>e>0?e-1:w.length-1);else if("Enter"===t.key){if(t.preventDefault(),I>=0&&I<w.length){const t=w[I],o=window?.wc?.addressAutocomplete?.activeProvider?.[e];o&&(j(!0),C.current=setTimeout(()=>{C.current=null},1e3),o.select(t.id,l).then(t=>{"shipping"===e?(h(t),s&&u(t)):(u(t),r&&h(t))}).finally(()=>{j(!1),y([]),R(-1)}))}}else"Escape"===t.key&&(y([]),R(-1))},onBlurCapture:()=>{setTimeout(()=>{y([]),R(-1)},200)},"aria-expanded":w.length>0,"aria-owns":w.length>0?T:void 0,"aria-activedescendant":M,"aria-autocomplete":"list",role:"combobox","data-disable-autocomplete":x.length>=3?"on":"off",icon:i.length>0?(0,c.jsx)("div",{className:"wc-block-components-address-autocomplete-icon","aria-hidden":"true"}):null}),x.length>=3&&w.length>0?(0,c.jsx)(fo,{selectedSuggestion:I,suggestions:w,branding:g,addressType:e,onSuggestionClick:async t=>{const o=window?.wc?.addressAutocomplete?.activeProvider?.[e];if(o){j(!0),C.current=setTimeout(()=>{C.current=null},1e3);try{const c=await o.select(t,l);"shipping"===e?(h(c),s&&u(c)):(u(c),r&&h(c))}finally{j(!1),y([]),R(-1)}}}}):null]})},jo=({formId:e,address1:t,address2:o,addressType:s,onChange:r})=>{const n=_o(t.field,e,s),a=_o(o.field,e,s),i="billing"===s||"shipping"===s,l=(0,f.getSettingWithCoercion)("addressAutocompleteProviders",[],e=>!!Array.isArray(e)&&e.every(e=>"string"==typeof e.name&&"string"==typeof e.id&&"string"==typeof e.branding_html)).length>0&&i,d=l?So:qt.ValidatedTextInput;return(0,c.jsxs)(c.Fragment,{children:[t&&(0,c.jsx)(d,{...n,type:t.field.type,...l?{addressType:s}:{},className:"wc-block-components-address-form__address_1",value:t.value,onChange:e=>r("address_1",e)}),o.field&&!o.field.hidden&&(0,c.jsx)(uo,{field:o.field,props:a,onChange:e=>r("address_2",e),value:o.value})]})},Co=window.wp.date;var Po=o(20932),Eo=o(31114);const No=new Map,Ao=e=>{if(!e)return;const t=e.trim();if(/^\d{4}-\d{2}-\d{2}$/.test(t))return t;const o=(0,Co.date)("Y-m-d",new Date),s=`${t}|${o}`;if(!No.has(s)){let e;try{e=((e,t)=>{const[o,s,r]=t.split("-").map(Number);return Eo.dI(Eo.WQ(Eo.vt(o,s,r),Po.sH(e)))})(t,o)}catch{e=void 0}No.set(s,e)}return No.get(s)},Io=e=>{const t=Ao(e.min),o=Ao(e.max);return t&&o&&t>o?{min:void 0,max:void 0}:{min:t,max:o}};var Ro=o(17740);const To=e=>((e,t)=>Object.entries(e).reduce((e,[o,s])=>({...e,[t(0,o)]:s}),{}))(e,(e,t)=>(0,Ro.L)(t)),Mo=e=>{const t=(e=>{const t=(0,d.useRef)({cart:{},checkout:{},customer:{}}),{cartData:o,prefersCollection:s,shouldCreateAccount:r,orderNotes:c,additionalFields:n,activePaymentMethod:a,customerId:i}=(0,_.useSelect)(e=>{const t=e(G.cartStore),o=e(G.checkoutStore),s=e(G.paymentStore);return{cartData:t.getCartData(),prefersCollection:o.prefersCollection(),shouldCreateAccount:o.getShouldCreateAccount(),orderNotes:o.getOrderNotes(),additionalFields:o.getAdditionalFields(),activePaymentMethod:s.getActivePaymentMethod(),customerId:o.getCustomerId()}},[]),l=(0,d.useMemo)(()=>{const{coupons:t,shippingRates:l,shippingAddress:d,billingAddress:p,items:m,itemsCount:u,itemsWeight:h,needsShipping:g,totals:_,extensions:k}=o,b={cart:{coupons:t.map(e=>e.code),shippingRates:[...new Set(l.map(e=>e.shipping_rates.find(e=>e.selected)?.rate_id).filter(Boolean))],items:m.map(e=>Array(Math.ceil(e.quantity)).fill(e.id)).flat(),itemsType:[...new Set(m.map(e=>e.type))],itemsCount:u,itemsWeight:h,needsShipping:g,prefersCollection:"boolean"==typeof s&&s,totals:{total_price:Number(_.total_price),total_tax:Number(_.total_tax)},extensions:k},checkout:{createAccount:r,customerNote:c,additionalFields:Object.fromEntries(Object.entries(n).filter(([e])=>z.includes(e))),paymentMethod:a},customer:{id:i,billingAddress:p,shippingAddress:d,additionalFields:Object.fromEntries(Object.entries(n).filter(([e])=>H.includes(e))),..."billing"===e||"shipping"===e?{address:"billing"===e?p:d}:{}}};return{cart:To(b.cart),checkout:To(b.checkout),customer:To(b.customer)}},[o,s,r,c,n,a,i,e]);return t.current&&ge()(t.current,l)||(t.current=l),t.current})(e);return window.schemaParser?{parser:window.schemaParser,data:t}:{parser:null,data:t}},Bo=(e,t,o,s="")=>{const r=(0,d.useRef)([]),{parser:c,data:n}=Mo(o),a=be(e,t,s).map(e=>{const o=t[e.key]||{};if(c){if(bo(o,"required")){let t={};t=Object.keys(o.required).some(e=>"cart"===e||"checkout"===e||"customer"===e)?{type:"object",properties:o.required}:o.required;try{const o=c.validate(t,n);e.required=o}catch(e){f.CURRENT_USER_IS_ADMIN&&console.error(e)}}if(bo(o,"hidden")){let t={};t=Object.keys(o.hidden).some(e=>"cart"===e||"checkout"===e||"customer"===e)?{type:"object",properties:o.hidden}:o.hidden;try{const o=c.validate(t,n);e.hidden=o}catch(e){f.CURRENT_USER_IS_ADMIN&&console.error(e)}}}return e});if(!r.current||!ge()(r.current,a)){const e=a.map(e=>({...e,hidden:"boolean"==typeof e.hidden&&e.hidden,required:"boolean"==typeof e.required&&e.required}));r.current=e}return r.current},Oo={};function Do(e){let t=e;return function(e){const o=t;return t=e,o}}const Lo=Do(),Fo=Do(),Vo=({id:e="",fields:t,onChange:o,addressType:r="shipping",values:n,children:i,isEditing:l,ariaDescribedBy:m=""})=>{const u=(0,p.useInstanceId)(Vo),h=(0,d.useRef)(!0),{defaultFields:g}=ht(),k=mt(t),b=mt("country"in n?n.country:""),w=Bo(k,g,r,b),y=tt(w),f=tt(l),S=tt(n),j=(0,d.useRef)({}),{errors:C,previousErrors:P}=((e,t,o)=>{const{parser:s,data:r}=Mo(t),c=(0,d.useRef)(Oo),n=tt(c.current);if(!r)return{errors:c.current,previousErrors:void 0};let a;if(o)a=o;else switch(t){case"billing":case"shipping":a=r.customer.address||{};break;case"contact":case"order":a=r.checkout.additional_fields||{};break;default:a={}}const i=e.reduce((e,t)=>(bo(t,"validation")&&!t.hidden&&(t.required||a[t.key])&&(e[t.key]=t.validation),e),{});let l=Oo;if(Object.keys(i).length>0&&s){const o={type:"object",properties:{}};switch(t){case"shipping":o.properties={customer:{type:"object",properties:{shipping_address:{type:"object",properties:i}}}};break;case"billing":o.properties={customer:{type:"object",properties:{billing_address:{type:"object",properties:i}}}};break;default:o.properties={checkout:{type:"object",properties:{additional_fields:{type:"object",properties:i}}}}}const c=s.compile(o),n=c(r);l=!n&&c.errors?((e,t)=>e.reduce((e,o)=>{const s=(r=o.instancePath,r.split("/").pop()?.replace("~1","/"));var r;const c=t.find(e=>e.key===s);if(!c||!s)return e;const n=(0,Et.getFieldLabel)(c.label),a=(0,x.sprintf)( // translators: %s is the label of the field. // translators: %s is the label of the field. (0,x.__)("%s is invalid","woocommerce"),n);if(s)switch(o.keyword){case"errorMessage":e[s]=o.message??a;break;case"pattern":e[s]=(0,x.sprintf)( // translators: %1$s is the label of the field, %2$s is the pattern. // translators: %1$s is the label of the field, %2$s is the pattern. (0,x.__)("%1$s must match the pattern %2$s","woocommerce"),n,o.params.pattern);break;default:e[s]=a}return e},{}))(c.errors,e):Oo}const p=e.map(e=>l[e.key]?[e.key,l[e.key]]:e.hidden||!e.required&&!a[e.key]?null:"postcode"===e.key&&"country"in a&&!(0,Et.isPostcode)({postcode:a.postcode,country:a.country})?[e.key,(0,x.__)("Please enter a valid postcode","woocommerce")]:"email"===e.key&&"email"in a&&!(0,Nt.isEmail)(a.email)?[e.key,(0,x.__)("Please enter a valid email address","woocommerce")]:null).filter(v.nonNullable);return ge()(c.current,Object.fromEntries(p))||(c.current=Object.fromEntries(p)),{errors:c.current,previousErrors:n}})(w,r,"shipping"===r?n:void 0);return(0,d.useEffect)(()=>{if(Object.entries(C).forEach(([e,t])=>{const o=j.current[e];t&&(o?.setErrorMessage(t),(0,_.select)(G.validationStore).getValidationError(`${r}_${e}`)||(0,_.dispatch)(G.validationStore).setValidationErrors({[`${r}_${e}`]:{message:t,hidden:!!o?.isFocused()}}))}),P){const e=[];Object.entries(P).forEach(([t])=>{const o=j.current[t];t in C||(e.push(`${r}_${t}`),o?.setErrorMessage(""))}),e.length&&(0,_.dispatch)(G.validationStore).clearValidationErrors(e)}},[C,P,r,n]),(0,d.useEffect)(()=>{j.current?.postcode?.revalidate()},[b]),(0,d.useEffect)(()=>{let t;if(!h.current&&l&&j.current&&f!==l){const o=w.find(e=>!1===e.hidden);if(!o)return;const{id:s}=_o(o,e||`${u}`,r),c=document.getElementById(s);c&&(t=setTimeout(()=>{c.focus()},300))}return h.current=!1,()=>{clearTimeout(t)}},[l,w,e,u,r,f]),(0,d.useEffect)(()=>{if(ge()(y,w))return;const e={...n,...Object.fromEntries(w.filter(e=>e.hidden).map(e=>[e.key,""]))};qe()(n,e)||o(e)},[o,w,y,n]),(0,d.useEffect)(()=>{if((!ge()(y,w)||!ge()(S,n))&&("country"in n&&((e,t)=>{const o=`${e}_country`,s=(0,_.select)(G.validationStore).getValidationError(o),r=t.city||t.state||t.postcode;try{if(!t.country&&r)throw(0,x.__)("Please select your country","woocommerce");if("billing"===e&&t.country&&!Object.keys(B).includes(t.country))throw(0,x.__)("Sorry, we do not allow orders from the selected country","woocommerce");if("shipping"===e&&t.country&&!Object.keys(O).includes(t.country))throw(0,x.__)("Sorry, we do not ship orders to the selected country","woocommerce");s&&(0,_.dispatch)(G.validationStore).clearValidationError(o)}catch(e){s?(0,_.dispatch)(G.validationStore).showValidationError(o):(0,_.dispatch)(G.validationStore).setValidationErrors({[o]:{message:String(e),hidden:!1}})}})(r,n),"state"in n)){const e=w.find(e=>"state"===e.key);e&&((e,t,o)=>{const s=`${e}_state`,r=(0,_.select)(G.validationStore).getValidationError(s),c=o.required,n="shipping"===e?Lo(t):Fo(t),a=!!n&&!qe()(n,t);r?!c||t.state?(0,_.dispatch)(G.validationStore).clearValidationError(s):a||(0,_.dispatch)(G.validationStore).showValidationError(s):!r&&c&&!t.state&&t.country&&(0,_.dispatch)(G.validationStore).setValidationErrors({[s]:{message:(0,x.sprintf)(/* translators: %s will be the state field label in lowercase e.g. "state" */ /* translators: %s will be the state field label in lowercase e.g. "state" */ (0,x.__)("Please select a %s","woocommerce"),o.label.toLowerCase()),hidden:!0}})})(r,n,e)}},[n,S,r,w,y]),e=e||`${u}`,(0,c.jsxs)("div",{id:e,className:"wc-block-components-address-form",children:[w.map(t=>{if(t.hidden)return null;const i=_o(t,e,r),l=(e=>{const{autoCapitalize:t,autoComplete:o,placeholder:s,...r}=e;return r})(i);if("email"===t.key&&(i.id="email",i.errorId="billing_email"),"checkbox"===t.type){const e=t.key in n&&n[t.key],s={checked:Boolean(e),onChange:e=>{o({...n,[t.key]:e})},...l};return t.required?(0,c.jsx)(qt.ValidatedCheckboxControl,{...t.errorMessage?{errorMessage:t.errorMessage}:{},...s},t.key):(0,c.jsx)(qt.CheckboxControl,{...s},t.key)}if("address_1"===t.key&&"address_1"in n){const s=ko("address_1",w,n),a=ko("address_2",w,n);return(0,v.isNull)(s)||(0,v.isNull)(a)?null:(0,c.jsx)(jo,{address1:s,address2:a,addressType:r,formId:e,onChange:(e,t)=>{o({...n,[e]:t})}},t.key)}if("address_2"===t.key)return null;if("country"===t.key&&"country"in n){const e="shipping"===r?co:ro;return(0,c.jsx)(e,{...i,value:n.country,onChange:e=>{o({...n,country:e,state:"",postcode:""})}},t.key)}if("state"===t.key&&"state"in n&&"country"in n){const e="shipping"===r?lo:io;return(0,c.jsx)(e,{...i,country:n.country,value:n.state,onChange:e=>o({...n,state:e})},t.key)}return"select"===t.type&&"options"in t?void 0===t.options?null:(0,c.jsx)(oo,{...i,label:i.label||"",className:(0,s.A)("wc-block-components-select-input",`wc-block-components-select-input-${t.key}`.replaceAll("/","-")),value:t.key in n?n[t.key]:"",onChange:e=>{o({...n,[t.key]:e})},options:t.options,required:t.required,errorMessage:i.errorMessage||void 0},t.key):(0,c.jsx)(qt.ValidatedTextInput,{ref:e=>j.current[t.key]=e,...i,type:t.type,..."date"===t.type?{...Io(t),icon:(0,c.jsx)("span",{className:"wc-block-components-text-input__date-icon","aria-hidden":"true",children:(0,c.jsx)(a.A,{icon:po.A,size:24})})}:{},ariaDescribedBy:m,value:(0,_e.decodeEntities)(n[t.key])??"",onChange:e=>o({...n,[t.key]:e}),customFormatter:e=>"postcode"===t.key?e.trimStart().toUpperCase():e},t.key)}),i]})},$o=Vo;o(71121);const Ho=({isEditing:e=!1,addressCard:t,addressForm:o,shouldAnimate:r=!1})=>{const n=(0,s.A)("wc-block-components-address-address-wrapper",{"is-editing":e,"is-animated":r});return(0,c.jsxs)("div",{className:n,children:[(0,c.jsx)("div",{className:"wc-block-components-address-card-wrapper",children:t}),(0,c.jsx)("div",{className:"wc-block-components-address-form-wrapper",children:o})]})},zo=e=>(0,v.isObject)(L[e.country])&&(0,v.isString)(L[e.country][e.state])?(0,_e.decodeEntities)(L[e.country][e.state]):e.state,Uo=e=>(0,v.isString)(D[e.country])?(0,_e.decodeEntities)(D[e.country]):e.country;o(28796);const qo=({address:e,onEdit:t,target:o,isExpanded:r})=>{const{name:n,address:a}=(e=>{const t=(0,f.getSetting)("countryData",{});let o=(0,f.getSetting)("defaultAddressFormat","{name}\n{company}\n{address_1}\n{address_2}\n{city}\n{state}\n{postcode}\n{country}");return(0,v.objectHasProp)(t,e?.country)&&(0,v.objectHasProp)(t[e.country],"format")&&(0,v.isString)(t[e.country].format)&&(o=t[e.country].format),((e,t)=>{const o=(e=>["{name}","{name_upper}","{first_name} {last_name}","{last_name} {first_name}","{first_name_upper} {last_name_upper}","{last_name_upper} {first_name_upper}","{first_name} {last_name_upper}","{first_name_upper} {last_name}","{last_name} {first_name_upper}","{last_name_upper} {first_name}"].find(t=>e.indexOf(t)>=0)||"")(t),s=t.replace(`${o}\n`,""),r=[["{company}",e?.company||""],["{address_1}",e?.address_1||""],["{address_2}",e?.address_2||""],["{city}",e?.city||""],["{state}",zo(e)],["{postcode}",e?.postcode||""],["{country}",Uo(e)],["{company_upper}",(e?.company||"").toUpperCase()],["{address_1_upper}",(e?.address_1||"").toUpperCase()],["{address_2_upper}",(e?.address_2||"").toUpperCase()],["{city_upper}",(e?.city||"").toUpperCase()],["{state_upper}",zo(e).toUpperCase()],["{state_code}",e?.state||""],["{postcode_upper}",(e?.postcode||"").toUpperCase()],["{country_upper}",Uo(e).toUpperCase()]],c=[["{name}",e?.first_name+(e?.first_name&&e?.last_name?" ":"")+e?.last_name],["{name_upper}",(e?.first_name+(e?.first_name&&e?.last_name?" ":"")+e?.last_name).toUpperCase()],["{first_name}",e?.first_name||""],["{last_name}",e?.last_name||""],["{first_name_upper}",(e?.first_name||"").toUpperCase()],["{last_name_upper}",(e?.last_name||"").toUpperCase()]];let n=o;c.forEach(([e,t])=>{n=n.replace(e,t)});let a=s;r.forEach(([e,t])=>{a=a.replace(e,t)});const i=a.trim().replace(/\n{2,}/g,"\n").split("\n").map(e=>e.split(", ").map(e=>e.trim()).filter(Boolean).join(", ")).filter(e=>e.length>0);return{name:n,address:i}})(e,o)})(e),i="shipping"===o?(0,x.__)("Edit shipping address","woocommerce"):(0,x.__)("Edit billing address","woocommerce"),l=(0,d.useMemo)(()=>[...a,e.phone].filter(e=>!!e).map(e=>(0,_e.decodeEntities)(e)).join(", "),[a,e.phone]);return(0,c.jsxs)("div",{className:"wc-block-components-address-card",children:[(0,c.jsxs)("address",{children:[(0,c.jsx)("span",{className:(0,s.A)("wc-block-components-address-card__address-section","wc-block-components-address-card__address-section--primary"),children:(0,_e.decodeEntities)(n)}),(0,c.jsx)("span",{className:(0,s.A)("wc-block-components-address-card__address-section","wc-block-components-address-card__address-section--secondary"),children:l})]}),t&&(0,c.jsx)(mo.$,{render:(0,c.jsx)("span",{}),className:"wc-block-components-address-card__edit","aria-controls":o,"aria-expanded":r,"aria-label":i,onClick:e=>{e.preventDefault(),t()},type:"button",children:(0,x.__)("Edit","woocommerce")})]})},Wo=()=>{const{shippingAddress:e,setShippingAddress:t,setBillingAddress:o,useShippingAsBilling:s,editingShippingAddress:r,setEditingShippingAddress:n}=ht(),{dispatchCheckoutEvent:a}=Ye(),[i,l]=(0,d.useState)(!1),{isInitialized:p}=ut(),{validationErrors:m}=(0,_.useSelect)(e=>({validationErrors:e(G.validationStore).getValidationErrors()}),[e]);(0,d.useEffect)(()=>{const t=Object.keys(e).some(e=>void 0!==m[`shipping_${e}`]);p&&t&&!1===r&&n(!0)},[r,e,p,n,m]);const u=(0,d.useCallback)(e=>{t(e),s&&(o(e),a("set-billing-address")),a("set-shipping-address")},[a,o,t,s]),h=(0,d.useCallback)(()=>{l(!0),n(!0)},[n]);return(0,c.jsx)(Ho,{isEditing:r,shouldAnimate:i,addressCard:(0,c.jsx)(qo,{address:e,target:"shipping",onEdit:h,isExpanded:r}),addressForm:(0,c.jsx)($o,{id:"shipping",addressType:"shipping",onChange:u,values:e,fields:$,isEditing:r})})},Yo=()=>{const{defaultFields:e,setBillingAddress:t,shippingAddress:o,billingAddress:s,useShippingAsBilling:r,setUseShippingAsBilling:n,setEditingBillingAddress:a}=ht(),{isEditor:i}=b(),l=0===(0,f.getSetting)("currentUserId"),p=()=>{const r={...o};e?.phone?.hidden&&delete r.phone,e?.company?.hidden&&delete r.company,(Object.keys(r).length!==Object.keys(s).length||!Object.keys(r).every(e=>r[e]===s[e]))&&t(r)};(0,Kt.Su)(()=>{r&&p()});const m=i?eo:d.Fragment,u=r?[me.SHIPPING_ADDRESS,me.BILLING_ADDRESS]:[me.SHIPPING_ADDRESS];return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(qt.StoreNoticesContainer,{context:u}),(0,c.jsx)(m,{children:(0,c.jsx)(Wo,{})}),(0,c.jsx)(qt.CheckboxControl,{className:"wc-block-checkout__use-address-for-billing",label:(0,x.__)("Use same address for billing","woocommerce"),checked:r,onChange:e=>{n(e),e?p():(a(!0),(e=>{if(!e||!l)return;const o=(e=>{const t=be($,f.defaultFields,e.country),o=Object.assign({},e);return t.forEach(({key:t})=>{"country"!==t&&"state"!==t&&ye(t,e)&&(o[t]="")}),o})(e);t(o)})(s))}})]})},Go=({defaultTitle:e=(0,x.__)("Step","woocommerce"),defaultDescription:t=(0,x.__)("Step description text.","woocommerce"),defaultShowStepNumber:o=!0})=>({title:{type:"string",default:e},description:{type:"string",default:t},showStepNumber:{type:"boolean",default:o}}),Jo={...Go({defaultTitle:(0,x.__)("Shipping address","woocommerce"),defaultDescription:(0,x.__)("","woocommerce")}),className:{type:"string",default:""},lock:{type:"object",default:{move:!0,remove:!0}}},Ko=JSON.parse('{"name":"woocommerce/checkout-shipping-address-block","title":"Shipping Address","description":"Collect your customer\'s shipping address.","category":"woocommerce","supports":{"align":false,"html":false,"multiple":false,"reusable":false,"inserter":false,"lock":false},"attributes":{"lock":{"type":"object","default":{"remove":true,"move":true}}},"parent":["woocommerce/checkout-fields-block"],"textdomain":"woocommerce","$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3}');(0,i.registerBlockType)(Ko,{icon:{src:(0,c.jsx)(a.A,{icon:Ut.A,className:"wc-block-editor-components-block-icon"})},attributes:Jo,edit:({attributes:e,setAttributes:t})=>{const{showShippingFields:o}=ht();return o?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(Vt,{}),(0,c.jsxs)(Yt,{setAttributes:t,attributes:e,className:(0,s.A)("wc-block-checkout__shipping-fields",e?.className),children:[(0,c.jsx)(Yo,{}),(0,c.jsx)(Gt,{block:Et.innerBlockAreas.SHIPPING_ADDRESS})]})]}):null},save:()=>(0,c.jsx)("div",{...l.useBlockProps.save(),children:(0,c.jsx)(Jt,{})})});var Zo=o(22400);o(76223);const Qo=E?`<a href="${E}" target="_blank">${(0,x.__)("Terms and Conditions","woocommerce")}</a>`:(0,x.__)("Terms and Conditions","woocommerce"),Xo=P?`<a href="${P}" target="_blank">${(0,x.__)("Privacy Policy","woocommerce")}</a>`:(0,x.__)("Privacy Policy","woocommerce"),es=(0,x.sprintf)(/* translators: %1$s terms page link, %2$s privacy page link. */ /* translators: %1$s terms page link, %2$s privacy page link. */ (0,x.__)("By proceeding with your purchase you agree to our %1$s and %2$s","woocommerce"),Qo,Xo),ts=(0,x.sprintf)(/* translators: %1$s terms page link, %2$s privacy page link. */ /* translators: %1$s terms page link, %2$s privacy page link. */ (0,x.__)("You must accept our %1$s and %2$s to continue with your purchase.","woocommerce"),Qo,Xo),os=()=>{},ss=JSON.parse('{"name":"woocommerce/checkout-terms-block","title":"Terms and Conditions","description":"Ensure that customers agree to your Terms & Conditions and Privacy Policy.","category":"woocommerce","supports":{"align":false,"html":false,"multiple":false,"reusable":false},"attributes":{"className":{"type":"string","default":""},"checkbox":{"type":"boolean","default":false},"text":{"type":"string","required":false},"showSeparator":{"type":"boolean","default":true}},"parent":["woocommerce/checkout-fields-block"],"textdomain":"woocommerce","$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3}');o(88144),(0,i.registerBlockType)(ss,{icon:{src:(0,c.jsx)(a.A,{icon:Zo.A,className:"wc-block-editor-components-block-icon"})},edit:({attributes:{checkbox:e,text:t,showSeparator:o},setAttributes:r})=>{const n=(0,l.useBlockProps)(),a=t||(e?ts:es);return(0,c.jsxs)("div",{...n,children:[(0,c.jsxs)(l.InspectorControls,{children:[(!E||!P)&&(0,c.jsxs)(Ft.Notice,{className:"wc-block-checkout__terms_notice",status:"warning",isDismissible:!1,children:[(0,x.__)("Link to your store's Terms and Conditions and Privacy Policy pages by creating pages for them.","woocommerce"),(0,c.jsx)("br",{}),!E&&(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("br",{}),(0,c.jsx)(Ft.ExternalLink,{href:`${f.ADMIN_URL}admin.php?page=wc-settings&tab=advanced`,children:(0,x.__)("Setup a Terms and Conditions page","woocommerce")})]}),!P&&(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("br",{}),(0,c.jsx)(Ft.ExternalLink,{href:`${f.ADMIN_URL}options-privacy.php`,children:(0,x.__)("Setup a Privacy Policy page","woocommerce")})]})]}),E&&P&&!(a.includes(E)&&a.includes(P))&&(0,c.jsx)(Ft.Notice,{className:"wc-block-checkout__terms_notice",status:"warning",isDismissible:!1,actions:es!==t?[{label:(0,x.__)("Restore default text","woocommerce"),onClick:()=>r({text:""})}]:[],children:(0,c.jsx)("p",{children:(0,x.__)("Ensure you add links to your policy pages in this section.","woocommerce")})}),(0,c.jsxs)(Ft.PanelBody,{title:(0,x.__)("Display options","woocommerce"),children:[(0,c.jsx)(Ft.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,x.__)("Require checkbox","woocommerce"),checked:e,onChange:()=>r({checkbox:!e})}),(0,c.jsx)(Ft.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,x.__)("Show separator","woocommerce"),checked:o,onChange:()=>r({showSeparator:!o})})]})]}),(0,c.jsx)("div",{className:(0,s.A)("wc-block-checkout__terms",{"wc-block-checkout__terms--with-separator":o}),children:e?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("div",{className:"wc-block-checkout__terms-checkbox-wrapper",children:(0,c.jsx)(qt.CheckboxControl,{id:"terms-condition",checked:!1,onChange:os})}),(0,c.jsx)(l.RichText,{value:a,onChange:e=>r({text:e})})]}):(0,c.jsx)(l.RichText,{tagName:"span",value:a,onChange:e=>r({text:e})})})]})},save:()=>(0,c.jsx)("div",{...l.useBlockProps.save()})});var rs=o(20939),cs=o(73558);o(36713);const ns=[(0,x.__)("Too weak","woocommerce"),(0,x.__)("Weak","woocommerce"),(0,x.__)("Medium","woocommerce"),(0,x.__)("Strong","woocommerce"),(0,x.__)("Very strong","woocommerce")],as=({password:e="",onChange:t})=>{const o=(0,p.useInstanceId)(as,"woocommerce-password-strength-meter");let r=-1;e.length>0&&(r=(e=>void 0===window.zxcvbn?(0,cs.Bi)(e,[{id:0,value:ns[0],minDiversity:0,minLength:0},{id:1,value:ns[1],minDiversity:1,minLength:4},{id:2,value:ns[2],minDiversity:2,minLength:8},{id:3,value:ns[3],minDiversity:4,minLength:12},{id:4,value:ns[4],minDiversity:4,minLength:20}]).id:window.zxcvbn(e).score)(e));const n=tt(r);return(0,d.useEffect)(()=>{r!==n&&t&&t(r)},[r,n,t]),(0,c.jsxs)("div",{id:o,className:(0,s.A)("wc-block-components-password-strength",{hidden:-1===r}),children:[(0,c.jsx)("label",{htmlFor:o+"-meter",className:"screen-reader-text",children:(0,x.__)("Password strength","woocommerce")}),(0,c.jsx)("meter",{id:o+"-meter",className:"wc-block-components-password-strength__meter",min:0,max:4,value:r>-1?r:0,children:ns[r]??""}),!!ns[r]&&(0,c.jsxs)("div",{id:o+"-result",className:"wc-block-components-password-strength__result",children:[(0,c.jsx)("span",{className:"screen-reader-text","aria-live":"polite",children:(0,x.sprintf)(/* translators: %s: Password strength */ /* translators: %s: Password strength */ (0,x.__)("Password strength: %1$s (%2$d characters long)","woocommerce"),ns[r],e.length)})," ",(0,c.jsx)("span",{"aria-hidden":!0,children:ns[r]})]})]})},is=as,ls=()=>{const[e,t]=(0,d.useState)(0),{customerPassword:o}=(0,_.useSelect)(e=>({customerPassword:e(G.checkoutStore).getCustomerPassword()}),[]),{__internalSetCustomerPassword:s}=(0,_.useDispatch)(G.checkoutStore),{setValidationErrors:r,clearValidationError:n}=(0,_.useDispatch)(G.validationStore);return(0,d.useEffect)(()=>{o&&(e<2?r({"account-password":{message:(0,x.__)("Please create a stronger password","woocommerce"),hidden:!0}}):n("account-password"))},[n,o,e,r]),(0,c.jsx)(qt.ValidatedTextInput,{type:"password",label:(0,x.__)("Create a password","woocommerce"),className:"wc-block-components-address-form__password",value:o,required:!0,errorId:"account-password",onChange:e=>{s(e),e||r({"account-password":{message:(0,x.__)("Please enter a valid password","woocommerce"),hidden:!0}})},feedback:(0,c.jsx)(is,{password:o,onChange:e=>t(e)})})},ds="wc-guest-checkout-notice",ps=()=>{const{shouldCreateAccount:e}=(0,_.useSelect)(e=>({shouldCreateAccount:e(G.checkoutStore).getShouldCreateAccount()})),{__internalSetShouldCreateAccount:t,__internalSetCustomerPassword:o}=(0,_.useDispatch)(G.checkoutStore),s=(0,f.getSetting)("checkoutAllowsGuest",!1),r=(0,f.getSetting)("checkoutAllowsSignup",!1),n=s&&r,a=!(0,f.getSetting)("generatePassword",!1)&&(n&&e||!s);return s||n||a?(0,c.jsxs)(c.Fragment,{children:[s&&(0,c.jsx)("p",{id:ds,className:"wc-block-checkout__guest-checkout-notice",children:(0,x.__)("You are currently checking out as a guest.","woocommerce")}),n&&(0,c.jsx)(qt.CheckboxControl,{className:"wc-block-checkout__create-account",label:(0,x.sprintf)(/* translators: Store name */ /* translators: Store name */ (0,x.__)("Create an account with %s","woocommerce"),(0,f.getSetting)("siteTitle","")),checked:e,onChange:e=>{t(e),o("")}}),a&&(0,c.jsx)(ls,{})]}):null},ms=()=>{const{additionalFields:e,customerId:t}=(0,_.useSelect)(e=>{const t=e(G.checkoutStore);return{additionalFields:t.getAdditionalFields(),customerId:t.getCustomerId()}}),{setAdditionalFields:o}=(0,_.useDispatch)(G.checkoutStore),{billingAddress:s,setEmail:r}=ht(),{dispatchCheckoutEvent:n}=Ye(),a={email:s.email,...e};return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(qt.StoreNoticesContainer,{context:me.CONTACT_INFORMATION}),(0,c.jsx)($o,{id:"contact",addressType:"contact",ariaDescribedBy:ds,onChange:e=>{const{email:t,...s}=e;r(t),n("set-email-address"),o(s)},values:a,fields:H,children:!t&&(0,c.jsx)(ps,{})})]})},us={...Go({defaultTitle:(0,x.__)("Contact information","woocommerce"),defaultDescription:""}),className:{type:"string",default:""},lock:{type:"object",default:{remove:!0,move:!0}}},hs=JSON.parse('{"name":"woocommerce/checkout-contact-information-block","title":"Contact Information","description":"Collect your customer\'s contact information.","category":"woocommerce","supports":{"align":false,"html":false,"multiple":false,"reusable":false,"inserter":false,"lock":false},"attributes":{"lock":{"type":"object","default":{"remove":true,"move":true}}},"parent":["woocommerce/checkout-fields-block"],"textdomain":"woocommerce","$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3}');(0,i.registerBlockType)(hs,{icon:{src:(0,c.jsx)(a.A,{icon:rs.A,className:"wc-block-editor-components-block-icon"})},attributes:us,edit:({attributes:e,setAttributes:t})=>(0,c.jsxs)(Yt,{attributes:e,setAttributes:t,className:(0,s.A)("wc-block-checkout__contact-fields",e?.className),children:[(0,c.jsx)(l.InspectorControls,{children:(0,c.jsxs)(Ft.PanelBody,{title:(0,x.__)("Account creation and guest checkout","woocommerce"),children:[(0,c.jsx)("p",{className:"wc-block-checkout__controls-text",children:(0,x.__)("Account creation and guest checkout settings can be managed in your store settings.","woocommerce")}),(0,c.jsx)(Ft.ExternalLink,{href:`${f.ADMIN_URL}admin.php?page=wc-settings&tab=account`,children:(0,x.__)("Manage account settings","woocommerce")})]})}),(0,c.jsx)(eo,{children:(0,c.jsx)(ms,{})}),(0,c.jsx)(Gt,{block:Et.innerBlockAreas.CONTACT_INFORMATION})]}),save:()=>(0,c.jsx)("div",{...l.useBlockProps.save(),children:(0,c.jsx)(Jt,{})})});const gs=()=>{const{billingAddress:e,setShippingAddress:t,setBillingAddress:o,useBillingAsShipping:s,editingBillingAddress:r,setEditingBillingAddress:n}=ht(),{dispatchCheckoutEvent:a}=Ye(),{isInitialized:i}=ut(),{validationErrors:l}=(0,_.useSelect)(e=>({validationErrors:e(G.validationStore).getValidationErrors()}),[e]);(0,d.useEffect)(()=>{const t=Object.keys(e).some(e=>void 0!==l[`billing_${e}`]);i&&t&&!1===r&&n(!0)},[r,e,i,n,l]);const p=(0,d.useCallback)(e=>{o(e),s&&(t(e),a("set-shipping-address")),a("set-billing-address")},[a,o,t,s]);return(0,c.jsx)(Ho,{isEditing:r,addressCard:(0,c.jsx)(qo,{address:e,target:"billing",onEdit:()=>{n(!0)},isExpanded:r}),addressForm:(0,c.jsx)($o,{id:"billing",addressType:"billing",onChange:p,values:e,fields:$,isEditing:r})})},_s=()=>{const{defaultFields:e,billingAddress:t,setShippingAddress:o,useBillingAsShipping:s}=ht(),{isEditor:r}=b();(0,Kt.Su)(()=>{if(s){const{email:s,...r}=t,c={...r};e?.phone?.hidden&&delete c.phone,e?.company?.hidden&&delete c.company,o(c)}});const n=r?eo:d.Fragment,a=s?[me.BILLING_ADDRESS,me.SHIPPING_ADDRESS]:[me.BILLING_ADDRESS];return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(qt.StoreNoticesContainer,{context:a}),(0,c.jsx)(n,{children:(0,c.jsx)(gs,{})})]})},ks=(0,x.__)("Billing address","woocommerce"),bs=(0,x.__)("","woocommerce"),ws=(0,x.__)("Billing and shipping address","woocommerce"),ys=(0,x.__)("Enter the billing and shipping address that matches your payment method.","woocommerce"),fs={...Go({defaultTitle:ks,defaultDescription:""}),className:{type:"string",default:""},lock:{type:"object",default:{move:!0,remove:!0}}},xs=JSON.parse('{"name":"woocommerce/checkout-billing-address-block","title":"Billing Address","description":"Collect your customer\'s billing address.","category":"woocommerce","supports":{"align":false,"html":false,"multiple":false,"reusable":false,"inserter":false,"lock":false},"attributes":{"lock":{"type":"object","default":{"remove":true,"move":true}}},"parent":["woocommerce/checkout-fields-block"],"textdomain":"woocommerce","$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3}');(0,i.registerBlockType)(xs,{icon:{src:(0,c.jsx)(a.A,{icon:Ut.A,className:"wc-block-editor-components-block-icon"})},attributes:fs,edit:({attributes:e,setAttributes:t})=>{const{showBillingFields:o,forcedBillingAddress:r,useBillingAsShipping:n}=ht();return o||n?(e.title=((e,t)=>t?e===ks?ws:e:e===ws?ks:e)(e.title,r),e.description=((e,t)=>t?e===bs?ys:e:e===ys?bs:e)(e.description,r),(0,c.jsxs)(Yt,{setAttributes:t,attributes:e,className:(0,s.A)("wc-block-checkout__billing-fields",e?.className),children:[(0,c.jsx)(Vt,{}),(0,c.jsx)(_s,{}),(0,c.jsx)(Gt,{block:Et.innerBlockAreas.BILLING_ADDRESS})]})):null},save:()=>(0,c.jsx)("div",{...l.useBlockProps.save(),children:(0,c.jsx)(Jt,{})})});var vs=o(11003);const Ss=(0,x.__)("Place Order","woocommerce"),js=(0,x.__)("Return to Cart","woocommerce"),Cs={placeOrderButtonLabel:{type:"string",default:Ss},returnToCartButtonLabel:{type:"string",default:js}},Ps=(e,t)=>{if(!e.title.raw)return e.slug;const o=1===t.filter(t=>t.title.raw===e.title.raw).length;return e.title.raw+(o?"":` - ${e.slug}`)},Es=({setPageId:e,pageId:t,labels:o})=>{const s=(0,_.useSelect)(e=>e("core").getEntityRecords("postType","page",{status:"publish",orderby:"title",order:"asc",per_page:100}),[])||null;return s?(0,c.jsx)(Ft.__experimentalToolsPanel,{label:o.title,resetAll:()=>e(0),children:(0,c.jsx)(Ft.__experimentalToolsPanelItem,{label:(0,x.__)("Link to","woocommerce"),hasValue:()=>"number"==typeof t&&0!==t,onDeselect:()=>e(0),isShownByDefault:!0,children:(0,c.jsx)(Ft.SelectControl,{label:(0,x.__)("Link to","woocommerce"),value:t,options:[{label:o.default,value:0},...s.map(e=>({label:Ps(e,s),value:parseInt(e.id,10)}))],onChange:t=>e(parseInt(t,10))})})}):null};var Ns=o(77134);o(92840);const As=({href:e,children:t,element:o="a"})=>{const s=e||A;if(!s)return null;const r=o;return(0,c.jsxs)(r,{..."a"===o?{href:s}:{},className:"wc-block-components-checkout-return-to-cart-button",children:[(0,c.jsx)(a.A,{icon:Ns.A}),t]})},Is=(e=!1)=>{const{paymentMethodsInitialized:t,expressPaymentMethodsInitialized:o,availablePaymentMethods:s,availableExpressPaymentMethods:r}=(0,_.useSelect)(e=>{const t=e(G.paymentStore);return{paymentMethodsInitialized:t.paymentMethodsInitialized(),expressPaymentMethodsInitialized:t.expressPaymentMethodsInitialized(),availableExpressPaymentMethods:t.getAvailableExpressPaymentMethods(),availablePaymentMethods:t.getAvailablePaymentMethods()}}),c=Object.values(s).map(({name:e})=>e),n=Object.values(r).map(({name:e})=>e),a=(0,rt.getPaymentMethods)(),i=(0,rt.getExpressPaymentMethods)(),l=Object.keys(a).reduce((e,t)=>(c.includes(t)&&(e[t]=a[t]),e),{}),d=Object.keys(i).reduce((e,t)=>(n.includes(t)&&(e[t]=i[t]),e),{}),p=mt(l),m=mt(d);return{paymentMethods:e?m:p,isInitialized:e?o:t}},Rs=()=>Is(!0),Ts=window.wc.priceFormat,Ms=(0,c.jsx)(r.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.jsxs)("g",{fill:"none",fillRule:"evenodd",children:[(0,c.jsx)("path",{d:"M0 0h24v24H0z"}),(0,c.jsx)("path",{fill:"#000",fillRule:"nonzero",d:"M17.3 8v1c1 .2 1.4.9 1.4 1.7h-1c0-.6-.3-1-1-1-.8 0-1.3.4-1.3.9 0 .4.3.6 1.4 1 1 .2 2 .6 2 1.9 0 .9-.6 1.4-1.5 1.5v1H16v-1c-.9-.1-1.6-.7-1.7-1.7h1c0 .6.4 1 1.3 1 1 0 1.2-.5 1.2-.8 0-.4-.2-.8-1.3-1.1-1.3-.3-2.1-.8-2.1-1.8 0-.9.7-1.5 1.6-1.6V8h1.3zM12 10v1H6v-1h6zm2-2v1H6V8h8zM2 4v16h20V4H2zm2 14V6h16v12H4z"}),(0,c.jsx)("path",{stroke:"#000",strokeLinecap:"round",d:"M6 16c2.6 0 3.9-3 1.7-3-2 0-1 3 1.5 3 1 0 1-.8 2.8-.8"})]})});var Bs=o(13197),Os=o(1951),Ds=o(98041);o(29287);const Ls={bank:Bs.A,bill:Os.A,card:Ds.A,checkPayment:Ms},Fs=({icon:e="",text:t=""})=>{const o=!!e,r=(0,d.useCallback)(e=>o&&(0,v.isString)(e)&&(0,v.objectHasProp)(Ls,e),[o]),n=(0,s.A)("wc-block-components-payment-method-label",{"wc-block-components-payment-method-label--with-icon":o});return(0,c.jsxs)("span",{className:n,children:[r(e)?(0,c.jsx)(a.A,{icon:Ls[e]}):e,t]})},Vs=e=>`wc-block-components-payment-method-icon wc-block-components-payment-method-icon--${e}`,$s=({id:e,src:t=null,alt:o=""})=>t?(0,c.jsx)("img",{className:Vs(e),src:t,alt:o}):null,Hs=[{id:"alipay",alt:"Alipay",src:j+"payment-methods/alipay.svg"},{id:"amex",alt:"American Express",src:j+"payment-methods/amex.svg"},{id:"bancontact",alt:"Bancontact",src:j+"payment-methods/bancontact.svg"},{id:"diners",alt:"Diners Club",src:j+"payment-methods/diners.svg"},{id:"discover",alt:"Discover",src:j+"payment-methods/discover.svg"},{id:"eps",alt:"EPS",src:j+"payment-methods/eps.svg"},{id:"giropay",alt:"Giropay",src:j+"payment-methods/giropay.svg"},{id:"ideal",alt:"iDeal",src:j+"payment-methods/ideal.svg"},{id:"jcb",alt:"JCB",src:j+"payment-methods/jcb.svg"},{id:"laser",alt:"Laser",src:j+"payment-methods/laser.svg"},{id:"maestro",alt:"Maestro",src:j+"payment-methods/maestro.svg"},{id:"mastercard",alt:"Mastercard",src:j+"payment-methods/mastercard.svg"},{id:"multibanco",alt:"Multibanco",src:j+"payment-methods/multibanco.svg"},{id:"p24",alt:"Przelewy24",src:j+"payment-methods/p24.svg"},{id:"sepa",alt:"Sepa",src:j+"payment-methods/sepa.svg"},{id:"sofort",alt:"Sofort",src:j+"payment-methods/sofort.svg"},{id:"unionpay",alt:"Union Pay",src:j+"payment-methods/unionpay.svg"},{id:"visa",alt:"Visa",src:j+"payment-methods/visa.svg"},{id:"wechat",alt:"WeChat",src:j+"payment-methods/wechat.svg"}];o(86983);const zs=({icons:e=[],align:t="center",className:o})=>{const r=(e=>{const t={};return e.forEach(e=>{let o={};"string"==typeof e&&(o={id:e,alt:e,src:null}),"object"==typeof e&&(o={id:e.id||"",alt:e.alt||"",src:e.src||null}),o.id&&(0,v.isString)(o.id)&&!t[o.id]&&(t[o.id]=o)}),Object.values(t)})(e);if(0===r.length)return null;const n=(0,s.A)("wc-block-components-payment-method-icons",{"wc-block-components-payment-method-icons--align-left":"left"===t,"wc-block-components-payment-method-icons--align-right":"right"===t},o);return(0,c.jsx)("div",{className:n,children:r.map(e=>{const t={...e,...(o=e.id,Hs.find(e=>e.id===o)||{})};var o;return(0,c.jsx)($s,{...t},"payment-method-icon-"+e.id)})})};o(99961);const Us=({children:e,className:t,screenReaderLabel:o,showSpinner:r=!1,isLoading:n=!0})=>(0,c.jsxs)("div",{className:(0,s.A)(t,{"wc-block-components-loading-mask":n}),children:[n&&r&&(0,c.jsx)(qt.Spinner,{}),(0,c.jsx)("div",{className:(0,s.A)({"wc-block-components-loading-mask__children":n}),"aria-hidden":n,children:e}),n&&(0,c.jsx)("span",{className:"screen-reader-text",children:o||(0,x.__)("Loading…","woocommerce")})]});o(42405);const qs=({tag:e="div",width:t="100%",height:o="8px",maxWidth:r="",className:n="",borderRadius:a="",isStatic:i=!1,ariaMessage:l})=>(0,c.jsx)(e,{className:(0,s.A)("wc-block-components-skeleton__element",{"wc-block-components-skeleton__element--static":i},n),...l?{"aria-live":"polite","aria-label":l}:{"aria-hidden":"true"},style:{width:t,height:o,borderRadius:a,maxWidth:r}}),Ws=(e="")=>{const{cartCoupons:t,cartIsLoading:o}=Me(),{applyCoupon:s,removeCoupon:r}=(0,_.useDispatch)(G.cartStore),{isApplyingCoupon:c,isRemovingCoupon:n,orderId:a}=(0,_.useSelect)(e=>({isApplyingCoupon:e(G.cartStore).isApplyingCoupon(),isRemovingCoupon:e(G.cartStore).isRemovingCoupon(),orderId:e(G.checkoutStore).getOrderId()}),[]),i=(0,d.useCallback)(e=>a&&a>0&&e?.data?.details?.checkout?e.data.details.checkout:e?.data?.details?.cart?e.data.details.cart:e.message,[a]);return{appliedCoupons:t,isLoading:o,applyCoupon:(0,d.useCallback)(t=>s(t).then(()=>((0,Et.applyCheckoutFilter)({filterName:"showApplyCouponNotice",defaultValue:!0,arg:{couponCode:t,context:e}})&&(0,_.dispatch)("core/notices").createNotice("info",(0,x.sprintf)(/* translators: %s coupon code. */ /* translators: %s coupon code. */ (0,x.__)('Coupon code "%s" has been applied to your cart.',"woocommerce"),t),{id:"coupon-form",type:"snackbar",context:e}),Promise.resolve(!0))).catch(e=>{const t=i(e);return(0,_.dispatch)(G.validationStore).setValidationErrors({coupon:{message:(0,_e.decodeEntities)(t),hidden:!1}}),Promise.resolve(!1)}),[s,i,e]),removeCoupon:(0,d.useCallback)(t=>r(t).then(()=>((0,Et.applyCheckoutFilter)({filterName:"showRemoveCouponNotice",defaultValue:!0,arg:{couponCode:t,context:e}})&&(0,_.dispatch)("core/notices").createNotice("info",(0,x.sprintf)(/* translators: %s coupon code. */ /* translators: %s coupon code. */ (0,x.__)('Coupon code "%s" has been removed from your cart.',"woocommerce"),(0,_e.decodeEntities)(t)),{id:"coupon-form",type:"snackbar",context:e}),Promise.resolve(!0))).catch(t=>((0,_.dispatch)("core/notices").createErrorNotice(t.message,{id:"coupon-form",type:"snackbar",context:e}),Promise.resolve(!1))),[r,e]),isApplyingCoupon:c,isRemovingCoupon:n}},Ys=(e,t)=>{const o=[],s=(t,o)=>{const s=o+"_tax",r=(0,v.objectHasProp)(e,o)&&(0,v.isString)(e[o])?parseInt(e[o],10):0;return{key:o,label:t,value:r,valueWithTax:r+((0,v.objectHasProp)(e,s)&&(0,v.isString)(e[s])?parseInt(e[s],10):0)}};return o.push(s((0,x.__)("Subtotal:","woocommerce"),"total_items")),o.push(s((0,x.__)("Fees:","woocommerce"),"total_fees")),o.push(s((0,x.__)("Discount:","woocommerce"),"total_discount")),o.push({key:"total_tax",label:(0,x.__)("Taxes:","woocommerce"),value:parseInt(e.total_tax,10),valueWithTax:parseInt(e.total_tax,10)}),t&&o.push(s((0,x.__)("Shipping:","woocommerce"),"total_shipping")),o},Gs=()=>{const{onCheckoutBeforeProcessing:e,onCheckoutValidationBeforeProcessing:t,onCheckoutAfterProcessingWithSuccess:o,onCheckoutAfterProcessingWithError:s,onSubmit:r}=nt(),{onCheckoutValidation:c,onCheckoutSuccess:n,onCheckoutFail:a}=st.checkoutEvents,{isCalculating:i,isComplete:l,isIdle:p,isProcessing:m,customerId:u}=(0,_.useSelect)(e=>{const t=e(G.checkoutStore);return{isComplete:t.isComplete(),isIdle:t.isIdle(),isProcessing:t.isProcessing(),customerId:t.getCustomerId(),isCalculating:t.isCalculating()}},[]),{paymentIsIdle:h,paymentIsStarted:g,paymentIsProcessing:k,paymentHasError:b,paymentIsReady:w,paymentIsDoingExpressPayment:y,activePaymentMethod:S,shouldSavePayment:j}=(0,_.useSelect)(e=>{const t=e(G.paymentStore);return{paymentIsIdle:t.isPaymentIdle(),paymentIsStarted:t.isExpressPaymentStarted(),paymentIsProcessing:t.isPaymentProcessing(),paymentHasError:t.hasPaymentError(),paymentIsReady:t.isPaymentReady(),paymentIsDoingExpressPayment:t.isExpressPaymentMethodActive(),activePaymentMethod:t.getActivePaymentMethod(),shouldSavePayment:t.getShouldSavePaymentMethod()}},[]),C={isIdle:h,isStarted:g,isProcessing:k,hasError:b,isReady:w,isDoingExpressPayment:y,get isPristine(){return K()("isPristine",{since:"7.5.0",alternative:"isIdle",link:"https://github.com/woocommerce/woocommerce-blocks/pull/8110"}),h},get isFinished(){return K()("isFinished",{since:"7.5.0",link:"https://github.com/woocommerce/woocommerce-blocks/pull/8110"}),b||w},get hasFailed(){return K()("hasFailed",{since:"7.5.0",link:"https://github.com/woocommerce/woocommerce-blocks/pull/8110"}),b},get isSuccessful(){return K()("isSuccessful",{since:"7.5.0",link:"https://github.com/woocommerce/woocommerce-blocks/pull/8110"}),w}},{__internalSetExpressPaymentError:P}=(0,_.useDispatch)(G.paymentStore),{onPaymentProcessing:E,onPaymentSetup:N}=(0,d.useContext)(te),{shippingErrorStatus:A,shippingErrorTypes:I,onShippingRateSuccess:R,onShippingRateFail:T,onShippingRateSelectSuccess:M,onShippingRateSelectFail:B}=Xe(),{shippingRates:O,isLoadingRates:D,selectedRates:L,isSelectingRate:F,selectShippingRate:V,needsShipping:$}=Ge(),{billingAddress:H,shippingAddress:z}=(0,_.useSelect)(e=>e(G.cartStore).getCustomerData(),[]),{setShippingAddress:U}=(0,_.useDispatch)(G.cartStore),{cartItems:q,cartFees:W,cartTotals:Y,extensions:J}=Me(),{appliedCoupons:Z}=Ws(),Q=(0,d.useRef)(Ys(Y,$)),X=(0,d.useRef)({label:(0,x.__)("Total","woocommerce"),value:parseInt(Y.total_price,10)});(0,d.useEffect)(()=>{Q.current=Ys(Y,$),X.current={label:(0,x.__)("Total","woocommerce"),value:parseInt(Y.total_price,10)}},[Y,$]);const ee=(0,d.useCallback)((e="")=>{K()("setExpressPaymentError should only be used by Express Payment Methods (using the provided onError handler).",{alternative:"",link:"https://github.com/woocommerce/woocommerce-gutenberg-products-block/pull/4228"}),P(e)},[P]);return{activePaymentMethod:S,billing:{appliedCoupons:Z,billingAddress:H,billingData:H,cartTotal:X.current,cartTotalItems:Q.current,currency:(0,Ts.getCurrencyFromPriceResponse)(Y),customerId:u,displayPricesIncludingTax:(0,f.getSetting)("displayCartPricesIncludingTax",!1)},cartData:{cartItems:q,cartFees:W,extensions:J},checkoutStatus:{isCalculating:i,isComplete:l,isIdle:p,isProcessing:m},components:{LoadingMask:Us,PaymentMethodIcons:zs,PaymentMethodLabel:Fs,Skeleton:qs,ValidationInputError:qt.ValidationInputError},emitResponse:{noticeContexts:me,responseTypes:v.responseTypes},eventRegistration:{onCheckoutAfterProcessingWithError:s,onCheckoutAfterProcessingWithSuccess:o,onCheckoutBeforeProcessing:e,onCheckoutValidationBeforeProcessing:t,onCheckoutSuccess:n,onCheckoutFail:a,onCheckoutValidation:c,onPaymentProcessing:E,onPaymentSetup:N,onShippingRateFail:T,onShippingRateSelectFail:B,onShippingRateSelectSuccess:M,onShippingRateSuccess:R},onSubmit:r,paymentStatus:C,setExpressPaymentError:ee,shippingData:{isSelectingRate:F,needsShipping:$,selectedRates:L,setSelectedRates:V,setShippingAddress:U,shippingAddress:z,shippingRates:O,shippingRatesLoading:D},shippingStatus:{shippingErrorStatus:A,shippingErrorTypes:I},shouldSavePayment:j}};o(46882);const Js=(0,d.forwardRef)((e,t)=>{const{className:o,children:r,variant:n="contained",removeTextWrap:a=!1,...i}=e,l=(0,s.A)("wc-block-components-button","wp-element-button",o,n);if("href"in e)return(0,c.jsx)(mo.$,{render:(0,c.jsx)("a",{ref:t,href:e.href,children:(0,c.jsx)("div",{className:"wc-block-components-button__text",children:r})}),className:l,...i});const d=a?e.children:(0,c.jsx)("div",{className:"wc-block-components-button__text",children:e.children});return(0,c.jsx)(mo.$,{ref:t,className:l,...i,children:d})});o(73793);const Ks=({label:e,fullWidth:t=!1,showPrice:o=!1,priceSeparator:r="·",CustomButtonComponent:n})=>{const{onSubmit:a,isCalculating:i,isDisabled:l,waitingForProcessing:d,waitingForRedirect:p}=(()=>{const{isCalculating:e,isBeforeProcessing:t,isProcessing:o,isAfterProcessing:s,isComplete:r,hasError:c}=(0,_.useSelect)(e=>{const t=e(G.checkoutStore);return{isCalculating:t.isCalculating(),isBeforeProcessing:t.isBeforeProcessing(),isProcessing:t.isProcessing(),isAfterProcessing:t.isAfterProcessing(),isComplete:t.isComplete(),hasError:t.hasError()}}),{activePaymentMethod:n,isExpressPaymentMethodActive:a}=(0,_.useSelect)(e=>{const t=e(G.paymentStore);return{activePaymentMethod:t.getActivePaymentMethod(),isExpressPaymentMethodActive:t.isExpressPaymentMethodActive()}}),{onSubmit:i}=nt(),{paymentMethods:l={}}=Is(!1),d=l[n]||{},p=o||s||t,m=r&&!c;return{paymentMethodButtonLabel:d.placeOrderButtonLabel,paymentMethodPlaceOrderButton:d.placeOrderButton,onSubmit:i,isCalculating:e,isDisabled:o||a,waitingForProcessing:p,waitingForRedirect:m}})(),m=Gs(),u=(0,Et.useValidateCheckout)(),{isEditor:h,isPreview:g=!1}=b(),{cartTotals:k,cartIsLoading:w}=Me();return n?(0,c.jsx)(n,{waitingForProcessing:d,waitingForRedirect:p,disabled:i||l||d||p||w,isEditor:h,isPreview:g,validate:u,...m}):(0,c.jsxs)(Js,{className:(0,s.A)("wc-block-components-checkout-place-order-button",{"wc-block-components-checkout-place-order-button--full-width":t},{"wc-block-components-checkout-place-order-button--loading":d||p}),onClick:a,disabled:i||l||d||p||w,children:[d&&(0,c.jsx)(qt.Spinner,{}),p&&(0,c.jsx)("svg",{className:"wc-block-components-checkout-place-order-button__icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"24",height:"24","aria-hidden":"true",focusable:"false",children:(0,c.jsx)("path",{d:"M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"})}),(0,c.jsxs)("div",{className:"wc-block-components-checkout-place-order-button__text",children:[e,o&&(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("style",{children:`.wp-block-woocommerce-checkout-actions-block {\n\t\t\t\t\t\t\t.wc-block-components-checkout-place-order-button__separator {\n\t\t\t\t\t\t\t\t&::after {\n\t\t\t\t\t\t\t\t\tcontent: "${r}";\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}`}),(0,c.jsx)("div",{className:"wc-block-components-checkout-place-order-button__separator"}),(0,c.jsx)("div",{className:"wc-block-components-checkout-place-order-button__price",children:(0,c.jsx)(qt.FormattedMonetaryAmount,{value:k.total_price,currency:(0,Ts.getCurrencyFromPriceResponse)(k)})})]})]})]})},Zs=JSON.parse('{"name":"woocommerce/checkout-actions-block","title":"Actions","description":"Allow customers to place their order.","category":"woocommerce","supports":{"align":false,"html":false,"multiple":false,"reusable":false,"inserter":false,"lock":false},"attributes":{"lock":{"type":"object","default":{"remove":true,"move":true}},"cartPageId":{"type":"number","default":0},"showReturnToCart":{"type":"boolean","default":false},"className":{"type":"string","default":""},"priceSeparator":{"type":"string","default":"·"}},"parent":["woocommerce/checkout-fields-block"],"textdomain":"woocommerce","$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3}');o(17883);const Qs={example:{attributes:{showPrice:!0,placeOrderButtonLabel:(0,x.__)("Place Order","woocommerce"),showReturnToCart:!1}},icon:{src:(0,c.jsx)(a.A,{icon:vs.A,className:"wc-block-editor-components-block-icon"})},attributes:{...Cs,...Zs.attributes},save:()=>(0,c.jsx)("div",{...l.useBlockProps.save()}),edit:({attributes:e,setAttributes:t})=>{const o=(0,l.useBlockProps)(),{cartPageId:r=0,showReturnToCart:n=!1,placeOrderButtonLabel:a,returnToCartButtonLabel:i}=e,{current:p}=(0,d.useRef)(r),m=(0,_.useSelect)(e=>p||e("core/editor").getCurrentPostId(),[p]),u=o.className.includes("is-style-with-price");return(0,c.jsxs)("div",{...o,children:[(0,c.jsxs)(l.InspectorControls,{children:[(0,c.jsxs)(Ft.PanelBody,{title:(0,x.__)("Options","woocommerce"),children:[(0,c.jsx)(Ft.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,x.__)('Show a "Return to Cart" link',"woocommerce"),help:(0,x.__)("Recommended to enable only if there is no Cart link in the header.","woocommerce"),checked:n,onChange:()=>t({showReturnToCart:!n})}),u&&(0,c.jsx)(Ft.TextControl,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,label:(0,x.__)("Price separator","woocommerce"),id:"price-separator",value:e.priceSeparator,onChange:e=>{t({priceSeparator:e})}})]}),n&&!(m===C&&0===p)&&(0,c.jsx)(Es,{pageId:r,setPageId:e=>t({cartPageId:e}),labels:{title:(0,x.__)("Return to Cart button","woocommerce"),default:(0,x.__)("WooCommerce Cart Page","woocommerce")}})]}),(0,c.jsx)("div",{className:"wc-block-checkout__actions",children:(0,c.jsxs)("div",{className:(0,s.A)("wc-block-checkout__actions_row",{"wc-block-checkout__actions_row--justify-flex-end":!n}),children:[n&&(0,c.jsx)(As,{element:"span",children:(0,c.jsx)(l.RichText,{multiline:!1,allowedFormats:[],value:i,placeholder:js,onChange:e=>{t({returnToCartButtonLabel:e})}})}),(0,c.jsx)(Ks,{label:(0,c.jsx)(l.RichText,{multiline:!1,allowedFormats:[],value:a,onChange:e=>{t({placeOrderButtonLabel:e})}}),fullWidth:!n,showPrice:u,priceSeparator:e.priceSeparator})]})})]})}};(0,i.registerBlockType)(Zs,Qs);const Xs=()=>{const{additionalFields:e}=(0,_.useSelect)(e=>({additionalFields:e(G.checkoutStore).getAdditionalFields()}),[]),{isEditor:t}=b(),{setAdditionalFields:o}=(0,_.useDispatch)(G.checkoutStore),s={...e},r=t?eo:d.Fragment;return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(qt.StoreNoticesContainer,{context:me.ORDER_INFORMATION}),(0,c.jsx)(r,{children:(0,c.jsx)($o,{id:"order",addressType:"order",onChange:e=>{o(e)},fields:z,values:s})})]})},er={...Go({defaultTitle:(0,x.__)("Additional order information","woocommerce"),defaultDescription:""}),className:{type:"string",default:""},lock:{type:"object",default:{move:!1,remove:!0}}},tr=JSON.parse('{"name":"woocommerce/checkout-additional-information-block","title":"Additional information","description":"Render additional fields in the \'Additional information\' location.","category":"woocommerce","supports":{"align":false,"html":false,"multiple":false,"reusable":false},"attributes":{"className":{"type":"string","default":""},"lock":{"type":"object","default":{"remove":true,"move":false}}},"parent":["woocommerce/checkout-fields-block"],"textdomain":"woocommerce","$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3}');(0,i.registerBlockType)(tr,{attributes:er,icon:{src:(0,c.jsx)(a.A,{icon:Zo.A,className:"wc-block-editor-components-block-icon"})},edit:({attributes:e,setAttributes:t})=>{const{defaultFields:o}=ht(),r=Bo(z,o,"order");return 0===r.length||r.every(e=>!!e.hidden)?null:(0,c.jsx)(Yt,{setAttributes:t,attributes:e,className:(0,s.A)("wc-block-checkout__additional-information-fields",e?.className),children:(0,c.jsx)(Xs,{})})},save:()=>(0,c.jsx)("div",{...l.useBlockProps.save()})});var or=o(73448);o(76443);const sr=({disabled:e,onChange:t,placeholder:o,value:s})=>{const[r,n]=(0,d.useState)(""!==s),[a,i]=(0,d.useState)("");return(0,c.jsxs)("div",{className:"wc-block-checkout__add-note",children:[(0,c.jsx)(qt.CheckboxControl,{disabled:e,label:(0,x.__)("Add a note to your order","woocommerce"),checked:r,onChange:e=>{n(e),e?s!==a&&t(a):(t(""),i(s))}}),r&&(0,c.jsx)(qt.Textarea,{disabled:e,onTextChange:t,placeholder:o,value:s})]})},rr=({className:e})=>{const{needsShipping:t}=Ge(),{isProcessing:o,orderNotes:r}=(0,_.useSelect)(e=>{const t=e(G.checkoutStore);return{isProcessing:t.isProcessing(),orderNotes:t.getOrderNotes()}},[]),{__internalSetOrderNotes:n}=(0,_.useDispatch)(G.checkoutStore);return(0,c.jsx)(qt.FormStep,{id:"order-notes",showStepNumber:!1,className:(0,s.A)("wc-block-checkout__order-notes",e),disabled:o,children:(0,c.jsx)(sr,{disabled:o,onChange:n,placeholder:t?(0,x.__)("Notes about your order, e.g. special notes for delivery.","woocommerce"):(0,x.__)("Notes about your order.","woocommerce"),value:r})})};o(89003);const cr=JSON.parse('{"name":"woocommerce/checkout-order-note-block","title":"Order Note","description":"Allow customers to add a note to their order.","category":"woocommerce","supports":{"align":false,"html":false,"multiple":false,"reusable":false},"attributes":{"className":{"type":"string","default":""},"lock":{"type":"object","default":{"remove":false,"move":true}}},"parent":["woocommerce/checkout-fields-block"],"textdomain":"woocommerce","$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3}');(0,i.registerBlockType)(cr,{icon:{src:(0,c.jsx)(a.A,{icon:or.A,className:"wc-block-editor-components-block-icon"})},edit:()=>{const e=(0,l.useBlockProps)();return(0,c.jsx)("div",{...e,children:(0,c.jsx)(eo,{children:(0,c.jsx)(rr,{})})})},save:()=>(0,c.jsx)("div",{...l.useBlockProps.save()})});const nr=(0,c.jsxs)(r.SVG,{xmlns:"http://www.w3.org/2000/SVG",viewBox:"0 0 24 24",fill:"none",children:[(0,c.jsx)("path",{stroke:"currentColor",strokeWidth:"1.5",fill:"none",d:"M6 3.75h12c.69 0 1.25.56 1.25 1.25v14c0 .69-.56 1.25-1.25 1.25H6c-.69 0-1.25-.56-1.25-1.25V5c0-.69.56-1.25 1.25-1.25z"}),(0,c.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M6.9 7.5A1.1 1.1 0 018 6.4h8a1.1 1.1 0 011.1 1.1v2a1.1 1.1 0 01-1.1 1.1H8a1.1 1.1 0 01-1.1-1.1v-2zm1.2.1v1.8h7.8V7.6H8.1z",clipRule:"evenodd"}),(0,c.jsx)("path",{fill:"currentColor",d:"M8.5 12h1v1h-1v-1zM8.5 14h1v1h-1v-1zM8.5 16h1v1h-1v-1zM11.5 12h1v1h-1v-1zM11.5 14h1v1h-1v-1zM11.5 16h1v1h-1v-1zM14.5 12h1v1h-1v-1zM14.5 14h1v1h-1v-1zM14.5 16h1v1h-1v-1z"})]});o(81962);const ar=({instanceId:e,isLoading:t=!1,onSubmit:o,displayCouponForm:r=!1})=>{const[n,a]=(0,d.useState)(""),[i,l]=(0,d.useState)(r),p=`wc-block-components-totals-coupon__input-${e}`,{validationErrorId:m}=(0,_.useSelect)(t=>({validationErrorId:t(G.validationStore).getValidationErrorId(e)}),[e]),u=(0,d.useRef)(null);return(0,c.jsx)(qt.Panel,{className:"wc-block-components-totals-coupon",initialOpen:i,hasBorder:!1,headingLevel:2,title:(0,x.__)("Add coupons","woocommerce"),state:[i,l],children:(0,c.jsx)(Us,{screenReaderLabel:(0,x.__)("Applying coupon…","woocommerce"),isLoading:t,showSpinner:!1,children:(0,c.jsxs)("div",{className:"wc-block-components-totals-coupon__content",children:[(0,c.jsxs)("form",{className:"wc-block-components-totals-coupon__form",id:"wc-block-components-totals-coupon__form",children:[(0,c.jsx)(qt.ValidatedTextInput,{id:p,errorId:"coupon",className:"wc-block-components-totals-coupon__input",label:(0,x.__)("Enter code","woocommerce"),value:n,ariaDescribedBy:m||"",onChange:e=>{a(e)},focusOnMount:!0,validateOnMount:!1,showError:!1,ref:u}),(0,c.jsxs)(Js,{className:(0,s.A)("wc-block-components-totals-coupon__button",{"wc-block-components-totals-coupon__button--loading":t}),disabled:t||!n,onClick:e=>{e.preventDefault(),void 0!==o?o(n)?.then(e=>{e?(a(""),l(!1)):u.current?.focus&&u.current.focus()}):(a(""),l(!0))},type:"submit",children:[t&&(0,c.jsx)(qt.Spinner,{}),(0,x.__)("Apply","woocommerce")]})]}),(0,c.jsx)(qt.ValidationInputError,{propertyName:"coupon",elementId:e})]})})})};o(90619);const ir={context:"summary"},lr=({cartCoupons:e=[],currency:t,isRemovingCoupon:o,removeCoupon:s,values:r,isLoading:n})=>{const{total_discount:a,total_discount_tax:i}=r,l=parseInt(a,10),d=(0,Et.applyCheckoutFilter)({arg:ir,filterName:"coupons",defaultValue:e});if(!l&&0===d.length)return null;const p=parseInt(i,10),m=(0,f.getSetting)("displayCartPricesIncludingTax",!1)?l+p:l;return(0,c.jsx)(qt.TotalsItem,{className:"wc-block-components-totals-discount",currency:t,description:0!==d.length&&(0,c.jsx)(Us,{screenReaderLabel:(0,x.__)("Removing coupon…","woocommerce"),isLoading:o,showSpinner:!1,children:(0,c.jsx)("ul",{className:"wc-block-components-totals-discount__coupon-list",children:d.map(e=>(0,c.jsx)(qt.RemovableChip,{className:"wc-block-components-totals-discount__coupon-list-item",text:e.label,screenReaderText:(0,x.sprintf)(/* translators: %s Coupon code. */ /* translators: %s Coupon code. */ (0,x.__)("Coupon: %s","woocommerce"),e.label),disabled:o,onRemove:()=>{s(e.code)},radius:"large",ariaLabel:(0,x.sprintf)(/* translators: %s is a coupon code. */ /* translators: %s is a coupon code. */ (0,x.__)('Remove coupon "%s"',"woocommerce"),e.label)},"coupon-"+e.code))})}),label:m?(0,x.__)("Discount","woocommerce"):(0,x.__)("Coupons","woocommerce"),value:m?-1*m:"-",showSkeleton:n})},dr=()=>{const{cartIsLoading:e,isLoadingRates:t,hasPendingItemsOperations:o}=Me(),{isApplyingCoupon:s,isRemovingCoupon:r}=Ws(),c=(0,_.useSelect)(e=>e(G.checkoutStore).isCalculating(),[]);return{isLoading:e||t||s||r||c||o}},pr=({children:e,isLoading:t,skeleton:o})=>{const s=(0,p.useReducedMotion)(),[r,n]=(0,d.useState)(t),[a,i]=(0,d.useState)(null);return(0,d.useEffect)(()=>{if(s)return void n(t);let e;if(t)n(!0),i(Date.now());else if(a){const t=Date.now()-a,o=Math.max(0,2e3-t);e=setTimeout(()=>{n(!1),i(null)},o)}return()=>{e&&clearTimeout(e)}},[t,a,s]),(0,c.jsx)(c.Fragment,{children:r?o:e})};o(48413);const mr=({currency:e,values:t,className:o,isEstimate:r=!1})=>{const n=(0,f.getSetting)("taxesEnabled",!0)&&(0,f.getSetting)("displayCartPricesIncludingTax",!1),{total_price:a,total_tax:i,tax_lines:l}=t,{receiveCart:p,...m}=Me(),{isLoading:u}=dr(),h=(0,Et.applyCheckoutFilter)({filterName:"totalLabel",defaultValue:r?(0,x.__)("Estimated total","woocommerce"):(0,x.__)("Total","woocommerce"),extensions:m.extensions,arg:{cart:m}}),g=(0,Et.applyCheckoutFilter)({filterName:"totalValue",defaultValue:"<price/>",extensions:m.extensions,arg:{cart:m},validation:Et.productPriceValidation}),_=(0,c.jsx)(qt.FormattedMonetaryAmount,{className:"wc-block-components-totals-footer-item-tax-value",currency:e,value:parseInt(a,10)}),k=(0,d.createInterpolateElement)(g,{price:_}),b=parseInt(i,10),w=(0,c.jsx)(c.Fragment,{children:l?.map(({name:t,price:o,rate:s},r)=>(0,c.jsxs)(d.Fragment,{children:[r>0&&", ",(0,c.jsx)(qt.FormattedMonetaryAmount,{className:"wc-block-components-totals-footer-item-tax-value",currency:e,value:o}),` ${t}`]},`${t}-${s}`))}),y=l&&l.length>0?(0,x.sprintf)(/* translators: %s is a list of tax rates */ /* translators: %s is a list of tax rates */ (0,x.__)("Including %s","woocommerce"),"<TaxLines/>"):(0,x.__)("Including <TaxAmount/> in taxes","woocommerce"),v=$e(m.shippingRates),S=m.cartNeedsShipping,j=(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("span",{children:(0,x.__)("Including","woocommerce")}),(0,c.jsx)(qs,{height:"1em",width:"45px",tag:"span",ariaMessage:(0,x.__)("Loading price… ","woocommerce")})]});return(0,c.jsx)(qt.TotalsItem,{className:(0,s.A)("wc-block-components-totals-footer-item",o),currency:e,label:h,value:k,description:(0,c.jsxs)(c.Fragment,{children:[n&&0!==b&&(0,c.jsx)("p",{className:"wc-block-components-totals-footer-item-tax",children:(0,c.jsx)(pr,{isLoading:u,skeleton:j,children:(0,c.jsx)(c.Fragment,{children:(0,d.createInterpolateElement)(y,{TaxAmount:(0,c.jsx)(qt.FormattedMonetaryAmount,{className:"wc-block-components-totals-footer-item-tax-value",currency:e,value:b}),TaxLines:w})})})}),r&&!v&&S&&(0,c.jsx)("p",{className:"wc-block-components-totals-footer-item-shipping",children:(0,x.__)("Shipping will be calculated at checkout","woocommerce")})]}),showSkeleton:u})},ur=()=>{const{shippingRates:e}=Me(),t=He(e);return t?(0,c.jsx)("div",{className:"wc-block-components-totals-shipping__via",children:(0,_e.decodeEntities)(t.filter((e,o)=>t.indexOf(e)===o).join(", "))}):null},hr=e=>{const t=(e=>(0,f.getSetting)("displayCartPricesIncludingTax",!1)?parseInt(e.total_shipping,10)+parseInt(e.total_shipping_tax,10):parseInt(e.total_shipping,10))(e);return 0===t?(0,c.jsx)("strong",{children:(0,x.__)("Free","woocommerce")}):t};o(36562);const gr=({label:e=(0,x.__)("Shipping","woocommerce"),placeholder:t=null,collaterals:o=null,shippingRates:s})=>{const{cartTotals:r,shippingRates:n}=Me(),{isLoading:a}=dr(),i=s??n,l=$e(i),d=He(i),p=i.flatMap(e=>e.shipping_rates.map(e=>e.name).filter(Boolean));let m=[];d.length>0?m=d:1===p.length&&(m=p);const u=d.length>1||p.length>1,h=0===m.length||u?e:m[0];return(0,c.jsx)("div",{className:"wc-block-components-totals-shipping",children:(0,c.jsx)(qt.TotalsItem,{label:h,value:l?hr(r):t,description:(0,c.jsxs)(c.Fragment,{children:[u&&(0,c.jsx)(ur,{}),o&&(0,c.jsx)("div",{className:"wc-block-components-totals-shipping__collaterals",children:o})]}),currency:(0,Ts.getCurrencyFromPriceResponse)(r),showSkeleton:a})})};var _r=o(58396);const kr=()=>{const{extensions:e,receiveCart:t,...o}=Me(),s={extensions:e,cart:o,context:"woocommerce/checkout"};return(0,c.jsx)(Et.ExperimentalOrderMeta.Slot,{...s})},{Fill:br,Slot:wr}=(0,Et.createSlotFill)("checkoutOrderSummaryActionArea"),yr=JSON.parse('{"name":"woocommerce/checkout-order-summary-block","title":"Order Summary","description":"Show customers a summary of their order.","category":"woocommerce","supports":{"align":false,"html":false,"multiple":false,"reusable":false,"inserter":false,"lock":false},"attributes":{"lock":{"type":"object","default":{"remove":true}}},"parent":["woocommerce/checkout-totals-block"],"textdomain":"woocommerce","$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3}'),fr=[{attributes:yr.attributes,save:()=>(0,c.jsx)("div",{...l.useBlockProps.save(),children:(0,c.jsx)(l.InnerBlocks.Content,{})}),supports:yr.supports,migrate:({attributes:e})=>[e,[(0,i.createBlock)("woocommerce/checkout-order-summary-cart-items-block",{},[]),(0,i.createBlock)("woocommerce/checkout-order-summary-coupon-form-block",{},[]),(0,i.createBlock)("woocommerce/checkout-order-summary-totals-block",{},[(0,i.createBlock)("woocommerce/checkout-order-summary-subtotal-block",{},[]),(0,i.createBlock)("woocommerce/checkout-order-summary-fee-block",{},[]),(0,i.createBlock)("woocommerce/checkout-order-summary-discount-block",{},[]),(0,i.createBlock)("woocommerce/checkout-order-summary-shipping-block",{},[]),(0,i.createBlock)("woocommerce/checkout-order-summary-taxes-block",{},[])])]],isEligible:(e,t)=>!t.some(e=>"woocommerce/checkout-order-summary-totals-block"===e.name)}],xr=fr;o(86229),(0,i.registerBlockType)(yr,{icon:{src:(0,c.jsx)(a.A,{icon:nr,className:"wc-block-editor-components-block-icon"})},attributes:{className:{type:"string",default:""},lock:{type:"object",default:{move:!0,remove:!0}}},edit:({clientId:e})=>{const t=(0,l.useBlockProps)(),{cartTotals:o}=Me(),r=(0,Ts.getCurrencyFromPriceResponse)(o),n=parseInt(o.total_price,10),a=Dt(Et.innerBlockAreas.CHECKOUT_ORDER_SUMMARY),{isOpen:i,ariaControlsId:p,toggleProps:m}=(()=>{const{hasContainerWidth:e,isLarge:t}=u(),[o,s]=(0,d.useState)(!1),r=(0,d.useId)(),c=(0,d.useCallback)(()=>s(!1),[]);return{isOpen:o,hasContainerWidth:e,isLarge:t,closeSummary:c,ariaControlsId:r,toggleProps:t?{}:{role:"button",onClick:()=>s(!o),"aria-expanded":o,"aria-controls":r,tabIndex:0,onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),s(!o))}}}})(),h=[["woocommerce/checkout-order-summary-cart-items-block",{},[]],["woocommerce/checkout-order-summary-coupon-form-block",{},[]],["woocommerce/checkout-order-summary-totals-block",{},[]]];return Lt({clientId:e,registeredBlocks:a,defaultTemplate:h}),(0,c.jsxs)("div",{...t,children:[(0,c.jsxs)("div",{className:"wc-block-components-checkout-order-summary__title",...m,children:[(0,c.jsx)("p",{className:"wc-block-components-checkout-order-summary__title-text",role:"heading","aria-level":2,children:(0,x.__)("Order summary","woocommerce")}),(0,c.jsx)(qt.FormattedMonetaryAmount,{currency:r,value:n,className:"wc-block-components-checkout-order-summary__title-price"}),(0,c.jsx)("span",{className:"wc-block-components-checkout-order-summary__title-icon",children:(0,c.jsx)(Ft.Icon,{icon:i?_r.A:to.A})})]}),(0,c.jsxs)("div",{className:(0,s.A)("wc-block-components-checkout-order-summary__content",{"is-open":i}),id:p,children:[(0,c.jsx)(l.InnerBlocks,{allowedBlocks:a,template:h}),(0,c.jsx)("div",{className:"wc-block-components-totals-wrapper",children:(0,c.jsx)(mr,{currency:r,values:o})}),(0,c.jsx)(kr,{})]})]})},save:()=>(0,c.jsx)("div",{...l.useBlockProps.save(),children:(0,c.jsx)(l.InnerBlocks.Content,{})}),deprecated:xr});var vr=o(96900);const Sr={warning:"#F0B849",error:"#CC1818",success:"#46B450",info:"#0073AA"},jr=({status:e="warning",...t})=>(0,c.jsxs)(r.SVG,{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",...t,children:[(0,c.jsx)("path",{d:"M12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20Z",stroke:Sr[e],strokeWidth:"1.5"}),(0,c.jsx)("path",{d:"M13 7H11V13H13V7Z",fill:Sr[e]}),(0,c.jsx)("path",{d:"M13 15H11V17H13V15Z",fill:Sr[e]})]});o(84459);const Cr=({href:e,title:t,description:o,warning:s})=>(0,c.jsxs)("a",{href:e,className:"wc-block-editor-components-external-link-card",target:"_blank",rel:"noreferrer",children:[(0,c.jsxs)("span",{className:"wc-block-editor-components-external-link-card__content",children:[(0,c.jsx)("strong",{className:"wc-block-editor-components-external-link-card__title",children:t}),o&&(0,c.jsx)("span",{className:"wc-block-editor-components-external-link-card__description",dangerouslySetInnerHTML:{__html:(0,wo.sanitizeHTML)(o)}}),s?(0,c.jsxs)("span",{className:"wc-block-editor-components-external-link-card__warning",children:[(0,c.jsx)(a.A,{icon:(0,c.jsx)(jr,{status:"error"})}),(0,c.jsx)("span",{children:s})]}):null]}),(0,c.jsx)(Ft.VisuallyHidden,{as:"span",children:/* translators: accessibility text */ /* translators: accessibility text */ (0,x.__)("(opens in a new tab)","woocommerce")}),(0,c.jsx)(a.A,{icon:vr.A,className:"wc-block-editor-components-external-link-card__icon"})]}),Pr=window.wp.autop,Er=e=>e.replace(/<\/?[a-z][^>]*?>/gi,""),Nr=(e,t)=>e.replace(/[\s|\.\,]+$/i,"")+t,Ar=(e,t,o="…",s=!0)=>{const r=Er(e),c=r.split(" ").splice(0,t).join(" ");return c===r?s?(0,Pr.autop)(r):r:s?(0,Pr.autop)(Nr(c,o)):Nr(c,o)},Ir=(e,t,o=!0,s="…",r=!0)=>{const c=Er(e),n=c.slice(0,t);if(n===c)return r?(0,Pr.autop)(c):c;if(o)return(0,Pr.autop)(Nr(n,s));const a=n.match(/([\s]+)/g),i=a?a.length:0,l=c.slice(0,t+i);return r?(0,Pr.autop)(Nr(l,s)):Nr(l,s)};o(9249);const Rr=()=>(0,c.jsxs)("div",{className:"wc-block-components-skeleton wc-block-components-skeleton--checkout-payment","aria-live":"polite","aria-label":(0,x.__)("Loading payment options… ","woocommerce"),children:[(0,c.jsxs)("div",{className:"wc-block-components-skeleton--checkout-payment-container",children:[(0,c.jsx)(qs,{height:"20px",width:"20px",borderRadius:"100%"}),(0,c.jsx)(qs,{height:"20px",maxWidth:"148px"})]}),(0,c.jsx)(qs,{height:"20px"})]});var Tr=o(42451),Mr=(o(97575),o(29471)),Br=o(74515),Or=o(29617);const Dr=e=>{switch(e){case"success":case"warning":case"info":case"default":return"polite";default:return"assertive"}},Lr=e=>{switch(e){case"success":return Mr.A;case"warning":case"info":case"error":return Br.A;default:return Or.A}};var Fr=o(20195);const Vr=({className:e,status:t="default",children:o,spokenMessage:r=o,onRemove:n=()=>{},isDismissible:i=!0,politeness:l=Dr(t),summary:p})=>(((e,t)=>{const o="string"==typeof e?e:(0,d.renderToString)(e);(0,d.useEffect)(()=>{o&&(0,Fr.speak)(o,t)},[o,t])})(r,l),(0,c.jsxs)("div",{role:"error"===t||"warning"===t||"success"===t?"alert":"status",className:(0,s.A)(e,"wc-block-components-notice-banner","is-"+t,{"is-dismissible":i}),children:[(0,c.jsx)(a.A,{icon:Lr(t)}),(0,c.jsxs)("div",{className:"wc-block-components-notice-banner__content",children:[p&&(0,c.jsx)("p",{className:"wc-block-components-notice-banner__summary",children:p}),o]}),!!i&&(0,c.jsx)(Js,{className:"wc-block-components-notice-banner__dismiss","aria-label":(0,x.__)("Dismiss this notice","woocommerce"),onClick:e=>{"function"==typeof e?.preventDefault&&e.preventDefault&&e.preventDefault(),n()},removeTextWrap:!0,children:(0,c.jsx)(a.A,{icon:Tr.A})})]}));o(94147);const $r=()=>(0,c.jsx)(Vr,{isDismissible:!1,className:"wc-block-checkout__no-payment-methods-notice",status:"error",children:(0,x.__)("There are no payment methods available. Please contact us for help placing your order.","woocommerce")});o(85193);const Hr=()=>(0,c.jsx)(Vr,{isDismissible:!1,className:"wc-block-checkout__only-express-payments-notice",status:"info",children:(0,x.__)("Only express payment methods are available for this order. Please select one to continue.","woocommerce")});class zr extends d.Component{state={errorMessage:"",hasError:!1};static getDerivedStateFromError(e){return{errorMessage:e.message,hasError:!0}}render(){const{hasError:e,errorMessage:t}=this.state,{isEditor:o}=this.props;if(e){let e=(0,x.__)("We are experiencing difficulties with this payment method. Please contact us for assistance.","woocommerce");(o||f.CURRENT_USER_IS_ADMIN)&&(e=t||(0,x.__)("There was an error with this payment method. Please verify it's configured correctly.","woocommerce"));const s=[{id:"0",content:e,isDismissible:!1,status:"error"}];return(0,c.jsx)(qt.StoreNoticesContainer,{additionalNotices:s,context:me.PAYMENTS})}return this.props.children}}const Ur=zr,qr=({children:e,showSaveOption:t})=>{const{isEditor:o}=b(),{shouldSavePaymentMethod:s,customerId:r,shouldCreateAccount:n}=(0,_.useSelect)(e=>{const t=e(G.paymentStore),o=e(G.checkoutStore);return{shouldSavePaymentMethod:t.getShouldSavePaymentMethod(),customerId:o.getCustomerId(),shouldCreateAccount:o.getShouldCreateAccount()}},[]),{__internalSetShouldSavePaymentMethod:a}=(0,_.useDispatch)(G.paymentStore),i=(0,f.getSetting)("checkoutAllowsGuest",!1),l=r>0||n||!i;return(0,d.useEffect)(()=>{!l&&s&&a(!1)},[l,s,a]),(0,c.jsxs)(Ur,{isEditor:o,children:[e,l&&t&&(0,c.jsx)(qt.CheckboxControl,{className:"wc-block-components-payment-methods__save-card-info",label:(0,x.__)("Save payment information to my account for future purchases.","woocommerce"),checked:s,onChange:()=>a(!s)})]})},Wr=()=>{const{activeSavedToken:e,activePaymentMethod:t,isExpressPaymentMethodActive:o,availablePaymentMethods:s}=(0,_.useSelect)(e=>{const t=e(G.paymentStore);return{activeSavedToken:t.getActiveSavedToken(),activePaymentMethod:t.getActivePaymentMethod(),isExpressPaymentMethodActive:t.isExpressPaymentMethodActive(),availablePaymentMethods:t.getAvailablePaymentMethods()}}),{__internalSetActivePaymentMethod:r}=(0,_.useDispatch)(G.paymentStore),n=(0,rt.getPaymentMethods)(),{...a}=Gs(),{removeNotice:i}=(0,_.useDispatch)("core/notices"),{dispatchCheckoutEvent:l}=Ye(),{isEditor:p}=b(),m=Object.keys(s).map(e=>{const{edit:t,content:o,label:s,supports:i}=n[e],l=p?t:o;return{value:e,label:"string"==typeof s?s:(0,d.cloneElement)(s,{components:a.components}),name:`wc-saved-payment-method-token-${e}`,content:(0,c.jsx)(qr,{showSaveOption:i.showSaveOption,children:(0,d.cloneElement)(l,{__internalSetActivePaymentMethod:r,...a})})}}),u=(0,d.useCallback)(e=>{r(e),i("wc-payment-error",me.PAYMENTS),l("set-active-payment-method",{paymentMethodSlug:e})},[l,i,r]);return o?null:(0,c.jsx)(qt.RadioControlAccordion,{highlightChecked:!0,id:"wc-payment-method-options",selected:e?null:t,onChange:u,options:m})},Yr=[],Gr=[],Jr={},Kr={};$.forEach(e=>{Kr[e]=""});const Zr={};$.forEach(e=>{Zr[e]=""}),Zr.email="";const Qr={cartItemsPendingQuantity:[],cartItemsPendingDelete:[],productsPendingAdd:[],cartData:{coupons:[],shippingRates:[],shippingAddress:Kr,billingAddress:Zr,items:[],itemsCount:0,itemsWeight:0,crossSells:[],needsShipping:!0,needsPayment:!1,hasCalculatedShipping:!0,fees:[],totals:{currency_code:"",currency_symbol:"",currency_minor_unit:2,currency_decimal_separator:".",currency_thousand_separator:",",currency_prefix:"",currency_suffix:"",total_items:"0",total_items_tax:"0",total_fees:"0",total_fees_tax:"0",total_discount:"0",total_discount_tax:"0",total_shipping:"0",total_shipping_tax:"0",total_price:"0",total_tax:"0",tax_lines:[]},errors:Yr,paymentMethods:[],paymentRequirements:[],extensions:Jr},metaData:{updatingCustomerData:!1,updatingAddressFieldsForShippingRates:!1,isShippingRatesUpdateQueued:!1,updatingSelectedRate:!1,applyingCoupon:"",removingCoupon:"",isCartDataStale:!1},errors:Gr},Xr="wc/store/cart";(0,x.__)("Unable to get cart data from the API.","woocommerce");const ec=({method:e,expires:t})=>(0,x.sprintf)(/* translators: %1$s is referring to the payment method brand, %2$s is referring to the last 4 digits of the payment card, %3$s is referring to the expiry date. */ /* translators: %1$s is referring to the payment method brand, %2$s is referring to the last 4 digits of the payment card, %3$s is referring to the expiry date. */ (0,x.__)("%1$s ending in %2$s (expires %3$s)","woocommerce"),e?.display_brand??e?.networks?.preferred??e.brand,e.last4,t),tc=({method:e,display_name:t},o)=>{if(e.brand&&e.last4)return(0,x.sprintf)(/* translators: %1$s is referring to the payment method brand, %2$s is referring to the last 4 digits of the payment card. */ /* translators: %1$s is referring to the payment method brand, %2$s is referring to the last 4 digits of the payment card. */ (0,x.__)("%1$s ending in %2$s","woocommerce"),e.brand,e.last4);const s="string"==typeof t?t.trim():"";return""!==s&&s.toLowerCase()!==o.toLowerCase()?s:(0,x.sprintf)(/* translators: %s is the name of the payment method gateway. */ /* translators: %s is the name of the payment method gateway. */ (0,x.__)("Saved token for %s","woocommerce"),e.gateway)},oc=()=>{const{activeSavedToken:e,activePaymentMethod:t,savedPaymentMethods:o}=(0,_.useSelect)(e=>{const t=e(G.paymentStore);return{activeSavedToken:t.getActiveSavedToken(),activePaymentMethod:t.getActivePaymentMethod(),savedPaymentMethods:t.getSavedPaymentMethods()}}),{__internalSetActivePaymentMethod:s}=(0,_.useDispatch)(G.paymentStore),r=(()=>{let e;if((0,_.select)("core/editor")){const t={cartCoupons:Ct.coupons,cartItems:Ct.items,crossSellsProducts:Ct.cross_sells,cartFees:Ct.fees,cartItemsCount:Ct.items_count,cartItemsWeight:Ct.items_weight,cartNeedsPayment:Ct.needs_payment,cartNeedsShipping:Ct.needs_shipping,cartItemErrors:Yr,cartTotals:Ct.totals,cartIsLoading:!1,cartErrors:Gr,billingData:Qr.cartData.billingAddress,billingAddress:Qr.cartData.billingAddress,shippingAddress:Qr.cartData.shippingAddress,extensions:Jr,shippingRates:Ct.shipping_rates,isLoadingRates:!1,cartHasCalculatedShipping:Ct.has_calculated_shipping,paymentRequirements:Ct.payment_requirements,receiveCart:()=>{}};e={cart:t,cartTotals:t.cartTotals,cartNeedsShipping:t.cartNeedsShipping,billingData:t.billingAddress,billingAddress:t.billingAddress,shippingAddress:t.shippingAddress,selectedShippingMethods:ze(t.shippingRates),paymentMethods:Ct.payment_methods,paymentRequirements:t.paymentRequirements}}else{const t=(0,_.select)(Xr),o=t.getCartData(),s=t.getCartErrors(),r=t.getCartTotals(),c=!t.hasFinishedResolution("getCartData"),n=t.isAddressFieldsForShippingRatesUpdating(),a=ze(o.shippingRates);e={cart:{cartCoupons:o.coupons,cartItems:o.items,crossSellsProducts:o.crossSells,cartFees:o.fees,cartItemsCount:o.itemsCount,cartItemsWeight:o.itemsWeight,cartNeedsPayment:o.needsPayment,cartNeedsShipping:o.needsShipping,cartItemErrors:o.errors,cartTotals:r,cartIsLoading:c,cartErrors:s,billingData:fe(o.billingAddress),billingAddress:fe(o.billingAddress),shippingAddress:fe(o.shippingAddress),extensions:o.extensions,shippingRates:o.shippingRates,isLoadingRates:n,cartHasCalculatedShipping:o.hasCalculatedShipping,paymentRequirements:o.paymentRequirements,receiveCart:(0,_.dispatch)(Xr).receiveCart},cartTotals:o.totals,cartNeedsShipping:o.needsShipping,billingData:o.billingAddress,billingAddress:o.billingAddress,shippingAddress:o.shippingAddress,selectedShippingMethods:a,paymentMethods:o.paymentMethods,paymentRequirements:o.paymentRequirements}}return e})(),n=(0,rt.getPaymentMethods)(),a=Gs(),{removeNotice:i}=(0,_.useDispatch)("core/notices"),{dispatchCheckoutEvent:l}=Ye(),p=(0,d.useMemo)(()=>{const e=Object.keys(o),t=new Set(e.flatMap(e=>o[e].map(e=>e.method.gateway))),c=Array.from(t).filter(e=>n[e]?.canMakePayment(r));return e.flatMap(e=>o[e].map(t=>{if(!c.includes(t.method.gateway))return;const o="cc"===e||"echeck"===e,r=t.method.gateway;return{name:`wc-saved-payment-method-token-${r}`,label:o?ec(t):tc(t,e),value:t.tokenId.toString(),onChange:e=>{const t=`wc-${r}-payment-token`;s(r,{token:e,payment_method:r,[t]:e.toString(),isSavedToken:!0}),i("wc-payment-error",me.PAYMENTS),l("set-active-payment-method",{paymentMethodSlug:r})}}})).filter(e=>void 0!==e)},[o,n,s,i,l,r]),m=e&&n[t]&&void 0!==n[t]?.savedTokenComponent&&!(0,v.isNull)(n[t].savedTokenComponent)?(0,d.cloneElement)(n[t].savedTokenComponent,{token:e,...a}):null;return p.length>0?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(qt.RadioControl,{highlightChecked:!0,id:"wc-payment-method-saved-tokens",selected:e,options:p,onChange:()=>{}}),m]}):null};o(9725),o(87215);const sc=({noPaymentMethods:e=(0,c.jsx)($r,{}),onlyExpressPayments:t=(0,c.jsx)(Hr,{})})=>{const{paymentMethodsInitialized:o,expressPaymentMethodsInitialized:s,availablePaymentMethods:r,availableExpressPaymentMethods:n,savedPaymentMethods:a}=(0,_.useSelect)(e=>{const t=e(G.paymentStore);return{paymentMethodsInitialized:t.paymentMethodsInitialized(),expressPaymentMethodsInitialized:t.expressPaymentMethodsInitialized(),availablePaymentMethods:t.getAvailablePaymentMethods(),availableExpressPaymentMethods:t.getAvailableExpressPaymentMethods(),savedPaymentMethods:t.getSavedPaymentMethods()}}),i=Object.keys(r).length>0,l=Object.keys(n).length>0;if(o&&s){if(!i&&!l)return e;if(l&&!i)return t}return(0,c.jsxs)(pr,{isLoading:!o||!s,skeleton:(0,c.jsx)(Rr,{}),children:[(0,c.jsx)(oc,{}),Object.keys(a).length>0&&(0,c.jsx)(qt.Label,{label:(0,x.__)("Use another payment method.","woocommerce"),screenReaderLabel:(0,x.__)("Other available payment methods","woocommerce"),wrapperElement:"p",wrapperProps:{className:"wc-block-components-checkout-step__description-payments-aligned"}}),(0,c.jsx)(Wr,{})]})},rc=({noPaymentMethods:e})=>(0,c.jsx)(sc,{noPaymentMethods:e});var cc=o(83098),nc=o(65194);const ac=({label:e,description:t,buttonLabel:o,buttonHref:s,icon:r=cc.A})=>(0,c.jsxs)(Ft.Placeholder,{icon:(0,c.jsx)(a.A,{icon:r}),label:e,className:"wc-block-checkout__configure-placeholder",children:[(0,c.jsx)("span",{className:"wc-block-checkout__configure-placeholder-description",children:t}),(0,c.jsx)(Ft.Button,{variant:"primary",href:s,target:"_blank",rel:"noopener noreferrer",style:{backgroundColor:nc.T.fN2,color:nc.T.cai,pointerEvents:"all"},children:o})]}),ic={...Go({defaultTitle:(0,x.__)("Payment options","woocommerce"),defaultDescription:""}),className:{type:"string",default:""},lock:{type:"object",default:{move:!0,remove:!0}}},lc=JSON.parse('{"name":"woocommerce/checkout-payment-block","title":"Payment Options","description":"Payment options for your store.","category":"woocommerce","supports":{"align":false,"html":false,"multiple":false,"reusable":false,"inserter":false,"lock":false},"attributes":{"lock":{"type":"object","default":{"remove":true,"move":true}}},"parent":["woocommerce/checkout-fields-block"],"textdomain":"woocommerce","$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3}');(0,i.registerBlockType)(lc,{icon:{src:(0,c.jsx)(a.A,{icon:Ds.A,className:"wc-block-editor-components-block-icon"})},attributes:ic,edit:({attributes:e,setAttributes:t})=>{const o=(0,f.getSetting)("globalPaymentMethods"),r=(0,_.select)(G.paymentStore).getIncompatiblePaymentMethods(),n=(0,x.__)("Incompatible with block-based checkout","woocommerce"),a=S.wordCountType;return(0,c.jsxs)(Yt,{attributes:e,setAttributes:t,className:(0,s.A)("wc-block-checkout__payment-method",e?.className),children:[(0,c.jsx)(l.InspectorControls,{children:o.length>0&&(0,c.jsxs)(Ft.PanelBody,{title:(0,x.__)("Methods","woocommerce"),children:[(0,c.jsx)("p",{className:"wc-block-checkout__controls-text",children:(0,x.__)("You currently have the following payment integrations active.","woocommerce")}),o.map(e=>{const t=!!r[e.id];let o;return o="words"===a?Ar(e.description,30,void 0,!1):Ir(e.description,30,"characters_including_spaces"===a,void 0,!1),(0,c.jsx)(Cr,{href:`${f.ADMIN_URL}admin.php?page=wc-settings&tab=checkout§ion=${e.id}`,title:e.title,description:o,...t?{warning:n}:{}},e.id)}),(0,c.jsx)(Ft.ExternalLink,{href:`${f.ADMIN_URL}admin.php?page=wc-settings&tab=checkout`,children:(0,x.__)("Manage payment methods","woocommerce")})]})}),(0,c.jsx)(eo,{children:(0,c.jsx)(rc,{noPaymentMethods:(0,c.jsx)(ac,{icon:Ds.A,label:(0,x.__)("Payment options","woocommerce"),description:(0,x.__)("Your store does not have any payment methods that support the Checkout block. Once you have configured a compatible payment method it will be displayed here.","woocommerce"),buttonLabel:(0,x.__)("Configure Payment Options","woocommerce"),buttonHref:`${f.ADMIN_URL}admin.php?page=wc-settings&tab=checkout`})})}),(0,c.jsx)(Gt,{block:Et.innerBlockAreas.PAYMENT_METHODS})]})},save:()=>(0,c.jsx)("div",{...l.useBlockProps.save(),children:(0,c.jsx)(Jt,{})})});const dc=(0,c.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"currentColor",viewBox:"0 0 24 24",children:[(0,c.jsx)("path",{stroke:"#1E1E1E",strokeLinejoin:"round",strokeWidth:"1.5",d:"M18.25 12a6.25 6.25 0 1 1-12.5 0 6.25 6.25 0 0 1 12.5 0Z"}),(0,c.jsx)("path",{fill:"#1E1E1E",d:"M10 3h4v3h-4z"}),(0,c.jsx)("rect",{width:"1.5",height:"5",x:"11.25",y:"8",fill:"#1E1E1E",rx:".75"}),(0,c.jsx)("path",{fill:"#1E1E1E",d:"m15.7 4.816 1.66 1.078-1.114 1.718-1.661-1.078z"})]}),pc=["height","borderRadius"],mc=e=>{const t=(0,_.select)(G.paymentStore).getAvailableExpressPaymentMethods();return Object.values(t).reduce((t,o)=>t||o?.supportsStyle.some(t=>e.includes(t)),!1)},uc=({attributes:e,setAttributes:t})=>{const{buttonHeight:o,buttonBorderRadius:s}=e;return(0,c.jsxs)(c.Fragment,{children:[mc(["height"])&&(0,c.jsx)(Ft.RadioControl,{label:(0,x.__)("Button height","woocommerce"),selected:o,options:[{label:(0,x.__)("Small (40px)","woocommerce"),value:"40"},{label:(0,x.__)("Medium (48px)","woocommerce"),value:"48"},{label:(0,x.__)("Large (55px)","woocommerce"),value:"55"}],onChange:e=>t({buttonHeight:e})}),mc(["borderRadius"])&&(0,c.jsx)("div",{className:"border-radius-control-container",children:(0,c.jsx)(l.HeightControl,{label:(0,x.__)("Button border radius","woocommerce"),value:s,onChange:e=>{const o=e.replace("px","");t({buttonBorderRadius:o})}})})]})},hc=({attributes:e,setAttributes:t})=>e.showButtonStyles?(0,c.jsx)(uc,{attributes:e,setAttributes:t}):null,gc=()=>{const e=(0,_.select)(G.paymentStore).getAvailableExpressPaymentMethods();return Object.entries(e).length<1?(0,c.jsx)("p",{className:"wc-block-checkout__controls-text",children:(0,x.__)("You currently have no express payment integrations active.","woocommerce")}):(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("p",{className:"wc-block-checkout__controls-text",children:(0,x.__)("You currently have the following express payment integrations active.","woocommerce")}),Object.values(e).map(e=>(0,c.jsx)(Cr,{href:`${f.ADMIN_URL}admin.php?page=wc-settings&tab=checkout§ion=${encodeURIComponent(e.gatewayId)}`,title:e.title,description:e.description},e.name))]})},_c=(0,c.jsxs)(c.Fragment,{children:[(0,x.__)("Apply uniform styles","woocommerce")," ",(0,c.jsx)("span",{className:"express-payment-styles-beta-badge",children:"Beta"})]}),kc=({attributes:e,setAttributes:t})=>(0,c.jsxs)(l.InspectorControls,{children:[mc(pc)&&(0,c.jsxs)(Ft.PanelBody,{title:(0,x.__)("Button Settings","woocommerce"),className:"express-payment-button-settings",children:[(0,c.jsx)(Ft.ToggleControl,{__nextHasNoMarginBottom:!0,label:_c,checked:e.showButtonStyles,onChange:()=>t({showButtonStyles:!e.showButtonStyles}),help:(0,x.__)("Sets a consistent style for express payment buttons.","woocommerce")}),(0,c.jsxs)(Ft.Notice,{status:"warning",isDismissible:!1,className:"wc-block-checkout__notice express-payment-styles-notice",children:[(0,c.jsxs)("strong",{children:[(0,x.__)("Note","woocommerce"),":"]})," ",(0,x.__)("Some payment methods might not yet support all style controls","woocommerce")]}),(0,c.jsx)(hc,{attributes:e,setAttributes:t})]}),(0,c.jsx)(Ft.PanelBody,{title:(0,x.__)("Express Payment Methods","woocommerce"),children:(0,c.jsx)(gc,{})})]}),bc=(0,d.createContext)({showButtonStyles:!1,buttonHeight:"48",buttonBorderRadius:"4"}),wc=()=>{const{isEditor:e}=b(),{showButtonStyles:t,buttonHeight:o,buttonBorderRadius:r}=(0,d.useContext)(bc),n=t?{height:o,borderRadius:r}:void 0,{activePaymentMethod:a,paymentMethodData:i}=(0,_.useSelect)(e=>{const t=e(G.paymentStore);return{activePaymentMethod:t.getActivePaymentMethod(),paymentMethodData:t.getPaymentMethodData()}}),{__internalSetActivePaymentMethod:l,__internalSetExpressPaymentStarted:p,__internalSetPaymentIdle:m,__internalSetPaymentError:u,__internalSetPaymentMethodData:h,__internalSetExpressPaymentError:g}=(0,_.useDispatch)(G.paymentStore),{paymentMethods:k}=Rs(),w=Gs(),y=(0,d.useRef)(a),f=(0,d.useRef)(i),v=Object.entries(k),{expressPaymentWrapperRef:S,focusedExpressPaymentMethod:j}=(e=>{const t=(0,d.useRef)(null),o=(0,d.useRef)(null),[s,r]=(0,d.useState)(null),c=(0,d.useCallback)(()=>{o.current&&(clearInterval(o.current),o.current=null)},[]),n=(0,d.useCallback)(()=>{const e=t.current,o=e?.ownerDocument.activeElement;if(!(e&&o instanceof Element))return{focusedPaymentMethod:null,isExpressPaymentIframe:!1};const s=o.closest('[id^="express-payment-method-"]'),r=o instanceof HTMLIFrameElement&&e.contains(o);return s&&e.contains(s)?{focusedPaymentMethod:s.id.replace("express-payment-method-",""),isExpressPaymentIframe:r}:{focusedPaymentMethod:null,isExpressPaymentIframe:!1}},[]),a=(0,d.useCallback)(()=>{const{focusedPaymentMethod:e,isExpressPaymentIframe:t}=n();r(e),t?o.current||(o.current=setInterval(()=>{const{focusedPaymentMethod:e,isExpressPaymentIframe:t}=n();r(e),t||c()},100)):c()},[n,c]);return(0,d.useEffect)(()=>{if(!e)return r(null),void c();const o=t.current;if(!o)return;const s=o.ownerDocument,n=s.defaultView,i=()=>{setTimeout(a,0)};return s.addEventListener("focusin",a),s.addEventListener("focusout",i),n?.addEventListener("blur",a),n?.addEventListener("focus",i),()=>{c(),s.removeEventListener("focusin",a),s.removeEventListener("focusout",i),n?.removeEventListener("blur",a),n?.removeEventListener("focus",i)}},[e,c,a]),{expressPaymentWrapperRef:t,focusedExpressPaymentMethod:s}})(!e&&v.length>0),C=(0,d.useCallback)(e=>()=>{y.current=a,f.current=i,p(),l(e)},[a,i,l,p]),P=(0,d.useCallback)(()=>{m(),l(y.current,f.current)},[l,m]),E=(0,d.useCallback)(e=>{u(),h(e),g(e),l(y.current,f.current)},[l,u,h,g]),N=(0,d.useCallback)((e="")=>{K()("Express Payment Methods should use the provided onError handler instead.",{alternative:"onError",link:"https://github.com/woocommerce/woocommerce-gutenberg-products-block/pull/4228"}),e?E(e):g("")},[g,E]),A=v.length>1?"ul":"div",I=v.length>1?"li":"div",R=v.length>0?v.map(([t,o])=>{const r=e?o.edit:o.content;return(0,d.isValidElement)(r)?(0,c.jsx)(I,{id:`express-payment-method-${t}`,className:(0,s.A)({"wc-block-components-express-payment__event-button--focused":j===t}),children:(0,d.cloneElement)(r,{...w,onClick:C(t),onClose:P,onError:E,setExpressPaymentError:N,buttonAttributes:n})},t):null}):(0,c.jsx)("div",{children:(0,x.__)("No registered Payment Methods","woocommerce")},"noneRegistered");return(0,c.jsx)(Ur,{isEditor:e,children:(0,c.jsx)(A,{className:"wc-block-components-express-payment__event-buttons",ref:S,children:R})})};o(42831);const yc=()=>{const{isCalculating:e,isProcessing:t,isAfterProcessing:o,isBeforeProcessing:r,isComplete:n,hasError:a,availableExpressPaymentMethods:i={},expressPaymentMethodsInitialized:l,isExpressPaymentMethodActive:d,registeredExpressPaymentMethods:p={}}=(0,_.useSelect)(e=>{const t=e(G.checkoutStore),o=e(G.paymentStore);return{isCalculating:t.isCalculating(),isProcessing:t.isProcessing(),isAfterProcessing:t.isAfterProcessing(),isBeforeProcessing:t.isBeforeProcessing(),isComplete:t.isComplete(),hasError:t.hasError(),availableExpressPaymentMethods:o.getAvailableExpressPaymentMethods(),expressPaymentMethodsInitialized:o.expressPaymentMethodsInitialized(),isExpressPaymentMethodActive:o.isExpressPaymentMethodActive(),registeredExpressPaymentMethods:o.getRegisteredExpressPaymentMethods()}},[]),{isEditor:m}=b(),{hasRegisteredExpressPaymentMethods:u,hasRegisteredNotInitializedExpressPaymentMethods:h,hasNoValidRegisteredExpressPaymentMethods:g,availableExpressPaymentsCount:k}=(({availableExpressPaymentMethods:e={},expressPaymentMethodsInitialized:t=!1,registeredExpressPaymentMethods:o={}})=>{const s=Object.keys(o||{}),r=Object.keys(e||{}),c=s.length,n=r.length,a=c>0;return{hasRegisteredExpressPaymentMethods:a,hasRegisteredNotInitializedExpressPaymentMethods:!t&&a,hasNoValidRegisteredExpressPaymentMethods:t&&a&&!n,availableExpressPaymentsCount:n||2}})({availableExpressPaymentMethods:i,expressPaymentMethodsInitialized:l,registeredExpressPaymentMethods:p});if(!u||g)return m||f.CURRENT_USER_IS_ADMIN?(0,c.jsx)(qt.StoreNoticesContainer,{context:me.EXPRESS_PAYMENTS}):null;const w=t||o||r||n&&!a||d,y=!d&&(e||h);return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsxs)("div",{className:(0,s.A)("wc-block-components-express-payment","wc-block-components-express-payment--checkout",{"wc-block-components-express-payment--disabled":w}),"aria-disabled":w,"aria-live":"polite",...w&&{"aria-busy":!0,"aria-label":(0,x.__)("Processing express checkout","woocommerce")},children:[(0,c.jsx)("div",{className:"wc-block-components-express-payment__title-container",children:(0,c.jsx)("h2",{className:"wc-block-components-express-payment__title",children:h?(0,c.jsx)(qs,{width:"127px",height:"20px",ariaMessage:(0,x.__)("Loading express payment area…","woocommerce")}):(0,x.__)(" Express Checkout","woocommerce")})}),(0,c.jsxs)("div",{className:"wc-block-components-express-payment__content",children:[(0,c.jsx)(qt.StoreNoticesContainer,{context:me.EXPRESS_PAYMENTS}),y?(0,c.jsx)("ul",{className:"wc-block-components-express-payment__event-buttons",children:Array.from({length:k}).map((e,t)=>(0,c.jsx)("li",{children:(0,c.jsx)(qs,{height:"48px",ariaMessage:(0,x.__)("Loading express payment method…","woocommerce")})},t))}):(0,c.jsx)(wc,{})]})]}),(0,c.jsx)("div",{className:"wc-block-components-express-payment-continue-rule wc-block-components-express-payment-continue-rule--checkout",children:(0,x.__)("Or continue below","woocommerce")})]})},fc=({className:e})=>{const{cartNeedsPayment:t}=Me();return t?(0,c.jsx)("div",{className:e,children:(0,c.jsx)(yc,{})}):null};o(56715);const xc=JSON.parse('{"name":"woocommerce/checkout-express-payment-block","title":"Express Checkout","description":"Allow customers to breeze through with quick payment options.","category":"woocommerce","supports":{"align":false,"html":false,"multiple":false,"reusable":false,"inserter":false,"lock":false},"attributes":{"showButtonStyles":{"type":"boolean","default":false},"buttonHeight":{"type":"string","default":"48"},"buttonBorderRadius":{"type":"string","default":"4"},"className":{"type":"string","default":""},"lock":{"type":"object","default":{"remove":true,"move":true}}},"parent":["woocommerce/checkout-fields-block"],"textdomain":"woocommerce","$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3}');(0,i.registerBlockType)(xc,{icon:{src:(0,c.jsx)(a.A,{style:{fill:"none"},icon:dc,className:"wc-block-editor-components-block-icon"})},edit:({attributes:e,setAttributes:t})=>{const{paymentMethods:o,isInitialized:r}=Rs(),n=Object.keys(o).length>0,a=(0,l.useBlockProps)({className:(0,s.A)({"wp-block-woocommerce-checkout-express-payment-block--has-express-payment-methods":n},e?.className),attributes:e});if(!r||!n)return null;const{buttonHeight:i,buttonBorderRadius:d,showButtonStyles:p}=e;return(0,c.jsxs)("div",{...a,children:[(0,c.jsx)(kc,{attributes:e,setAttributes:t}),(0,c.jsx)(bc.Provider,{value:{showButtonStyles:p,buttonHeight:i,buttonBorderRadius:d},children:(0,c.jsx)(fc,{})})]})},save:()=>(0,c.jsx)("div",{...l.useBlockProps.save()})});var vc=o(68989),Sc=o(19138);const jc=({minRate:e,maxRate:t,multiple:o=!1})=>{if(void 0===e||void 0===t)return null;const s=(0,f.getSetting)("displayCartPricesIncludingTax",!1)?parseInt(e.price,10)+parseInt(e.taxes,10):parseInt(e.price,10),r=(0,f.getSetting)("displayCartPricesIncludingTax",!1)?parseInt(t.price,10)+parseInt(t.taxes,10):parseInt(t.price,10),n=0===s&&0===r?(0,c.jsx)("em",{children:(0,x.__)("free","woocommerce")}):(0,c.jsx)(qt.FormattedMonetaryAmount,{currency:(0,Ts.getCurrencyFromPriceResponse)(e),value:s});return(0,c.jsx)("span",{className:"wc-block-checkout__shipping-method-option-price",children:s!==r||o?(0,d.createInterpolateElement)(0===s&&0===r?"<price />":(0,x.__)("from <price />","woocommerce"),{price:n}):n})};function Cc(e){return e?{min:e.reduce((e,t)=>Le(t.method_id)?e:void 0===e||parseInt(t.price,10)<parseInt(e.price,10)?t:e,void 0),max:e.reduce((e,t)=>Le(t.method_id)?e:void 0===e||parseInt(t.price,10)>parseInt(e.price,10)?t:e,void 0)}:{min:void 0,max:void 0}}function Pc(e){return e?{min:e.reduce((e,t)=>Le(t.method_id)&&(void 0===e||t.price<e.price)?t:e,void 0),max:e.reduce((e,t)=>Le(t.method_id)&&(void 0===e||t.price>e.price)?t:e,void 0)}:{min:void 0,max:void 0}}o(86336);const Ec=(0,x.__)("Pickup","woocommerce"),Nc=(0,x.__)("Ship","woocommerce"),Ac=({checked:e,rate:t,showPrice:o,showIcon:r,toggleText:n,setAttributes:i,onClick:d})=>(0,c.jsxs)(mo.$,{render:(0,c.jsx)("div",{}),className:(0,s.A)("wc-block-checkout__shipping-method-option",{"wc-block-checkout__shipping-method-option--selected":"pickup"===e}),onClick:d,children:[!0===r&&(0,c.jsx)(a.A,{icon:Sc.A,size:28,className:"wc-block-checkout__shipping-method-option-icon"}),(0,c.jsx)(l.RichText,{value:n,placeholder:Ec,tagName:"span",className:"wc-block-checkout__shipping-method-option-title",onChange:e=>i({localPickupText:e}),__unstableDisableFormats:!0,preserveWhiteSpace:!0}),!0===o&&(0,c.jsx)(jc,{minRate:t.min,maxRate:t.max})]}),Ic=({checked:e,rate:t,showPrice:o,showIcon:r,toggleText:n,setAttributes:i,onClick:d})=>{const p=void 0===t.min?(0,c.jsx)("span",{className:"wc-block-checkout__shipping-method-option-price",children:(0,x.__)("calculated with an address","woocommerce")}):(0,c.jsx)(jc,{minRate:t.min,maxRate:t.max});return(0,c.jsxs)(mo.$,{render:(0,c.jsx)("div",{}),className:(0,s.A)("wc-block-checkout__shipping-method-option",{"wc-block-checkout__shipping-method-option--selected":"shipping"===e}),onClick:d,children:[!0===r&&(0,c.jsx)(a.A,{icon:vc.A,size:28,className:"wc-block-checkout__shipping-method-option-icon"}),(0,c.jsx)(l.RichText,{value:n,placeholder:Nc,tagName:"span",className:"wc-block-checkout__shipping-method-option-title",onChange:e=>i({shippingText:e}),__unstableDisableFormats:!0,preserveWhiteSpace:!0}),!0===o&&p]})},Rc={...Go({defaultTitle:(0,x.__)("Delivery","woocommerce"),defaultDescription:""}),className:{type:"string",default:""},showIcon:{type:"boolean",default:!0},showPrice:{type:"boolean",default:!1},localPickupText:{type:"string",default:Ec},shippingText:{type:"string",default:Nc},lock:{type:"object",default:{move:!0,remove:!0}}},Tc=JSON.parse('{"name":"woocommerce/checkout-shipping-method-block","title":"Delivery","description":"Select between shipping or local pickup.","category":"woocommerce","supports":{"align":false,"html":false,"multiple":false,"reusable":false,"inserter":false,"lock":false},"attributes":{"lock":{"type":"object","default":{"remove":true,"move":true}}},"parent":["woocommerce/checkout-fields-block"],"textdomain":"woocommerce","$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3}');(0,i.registerBlockType)(Tc,{icon:{src:(0,c.jsx)(a.A,{icon:vc.A,className:"wc-block-editor-components-block-icon"})},attributes:Rc,edit:({attributes:e,setAttributes:t})=>{(0,d.useEffect)(()=>{const o=(0,f.getSetting)("localPickupText",e.localPickupText);t({localPickupText:o})},[t]);const{setPrefersCollection:o}=(0,_.useDispatch)(G.checkoutStore),{prefersCollection:r}=(0,_.useSelect)(e=>({prefersCollection:e(G.checkoutStore).prefersCollection()})),{showPrice:n,showIcon:a,className:i,localPickupText:p,shippingText:m}=e,{shippingRates:u,needsShipping:h,hasCalculatedShipping:g,isCollectable:k}=Ge();if(!(h&&g&&u&&k&&I))return null;const b=e=>{o("pickup"===e)};return(0,c.jsxs)(Yt,{attributes:e,setAttributes:t,className:(0,s.A)("wc-block-checkout__shipping-method",i),children:[(0,c.jsxs)(l.InspectorControls,{children:[(0,c.jsxs)(Ft.PanelBody,{title:(0,x.__)("Appearance","woocommerce"),children:[(0,c.jsx)("p",{className:"wc-block-checkout__controls-text",children:(0,x.__)("Choose how this block is displayed to your customers.","woocommerce")}),(0,c.jsx)(Ft.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,x.__)("Show icon","woocommerce"),checked:a,onChange:()=>t({showIcon:!a})}),(0,c.jsx)(Ft.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,x.__)("Show costs","woocommerce"),checked:n,onChange:()=>t({showPrice:!n})})]}),(0,c.jsxs)(Ft.PanelBody,{title:(0,x.__)("Shipping Methods","woocommerce"),children:[(0,c.jsx)("p",{className:"wc-block-checkout__controls-text",children:(0,x.__)("Methods can be made managed in your store settings.","woocommerce")}),(0,c.jsx)(Cr,{href:`${f.ADMIN_URL}admin.php?page=wc-settings&tab=shipping`,title:(0,x.__)("Shipping","woocommerce"),description:(0,x.__)("Manage your shipping zones, methods, and rates.","woocommerce")},"shipping_methods"),(0,c.jsx)(Cr,{href:`${f.ADMIN_URL}admin.php?page=wc-settings&tab=shipping§ion=pickup_location`,title:(0,x.__)("Pickup","woocommerce"),description:(0,x.__)("Allow customers to choose a local pickup location during checkout.","woocommerce")},"pickup_location")]})]}),(0,c.jsxs)("div",{id:"shipping-method",className:"wc-block-checkout__shipping-method-container",role:"radiogroup",children:[(0,c.jsx)(Ic,{checked:r?"pickup":"shipping",rate:Cc(u[0]?.shipping_rates),onClick:()=>{b("shipping")},showPrice:n,showIcon:a,setAttributes:t,toggleText:m}),(0,c.jsx)(Ac,{checked:r?"pickup":"shipping",rate:Pc(u[0]?.shipping_rates),showPrice:n,onClick:()=>{b("pickup")},showIcon:a,setAttributes:t,toggleText:p})]}),(0,c.jsx)(Gt,{block:Et.innerBlockAreas.SHIPPING_METHOD})]})},save:()=>(0,c.jsx)("div",{...l.useBlockProps.save(),children:(0,c.jsx)(Jt,{})})}),o(31215);const Mc=({rows:e=1})=>(0,c.jsx)("div",{className:"wc-block-components-skeleton wc-block-components-skeleton--checkout-shipping","aria-live":"polite","aria-label":(0,x.__)("Loading shipping options…","woocommerce"),children:Array.from({length:Math.max(1,e)}).map((e,t)=>(0,c.jsxs)("div",{className:"wc-block-components-skeleton__shipping-option",children:[(0,c.jsx)(qs,{height:"20px",width:"20px",borderRadius:"100%"}),(0,c.jsx)(qs,{height:"20px",maxWidth:"148px"}),(0,c.jsx)(qs,{height:"20px",width:"50px"})]},t))}),Bc=({packageData:e})=>(0,c.jsx)("ul",{className:"wc-block-components-shipping-rates-control__package-items",children:Object.values(e.items).map(e=>{const t=(0,_e.decodeEntities)(e.name),o=e.quantity;return(0,c.jsx)("li",{className:"wc-block-components-shipping-rates-control__package-item",children:(0,c.jsx)(qt.Label,{label:o>1?`${t} × ${o}`:`${t}`,allowHTML:!0,screenReaderLabel:(0,x.sprintf)(/* translators: %1$s name of the product (ie: Sunglasses), %2$d number of units in the current cart package */ /* translators: %1$s name of the product (ie: Sunglasses), %2$d number of units in the current cart package */ (0,x._n)("%1$s (%2$d unit)","%1$s (%2$d units)",o,"woocommerce"),t,o)})},e.key)})}),Oc=({image:e={},fallbackAlt:t="",width:o,height:s})=>{const r=e.alt||t;let n;e.thumbnail_srcset&&(n=o?`${o}px`:"100px");const a=e.thumbnail?{src:e.thumbnail,alt:r?(0,_e.decodeEntities)(r):"Product Image",srcSet:e.thumbnail_srcset||void 0,sizes:n}:{src:f.PLACEHOLDER_IMG_SRC,alt:"",srcSet:void 0,sizes:void 0};return(0,c.jsx)("img",{src:a.src,alt:a.alt,srcSet:a.srcSet,sizes:a.sizes,width:o,height:s})},Dc=({packageItem:e,cartItems:t=[]})=>{const o=t?.find(t=>t.key===e.key),s=o?.images||[];return(0,c.jsx)(Oc,{image:s.length?s[0]:{},fallbackAlt:o?.name||""})},Lc=e=>{const t=(0,f.getSetting)("displayCartPricesIncludingTax",!1)?parseInt(e.price,10)+parseInt(e.taxes,10):parseInt(e.price,10);let o=(0,c.jsxs)(c.Fragment,{children:[Number.isFinite(t)&&(0,c.jsx)(qt.FormattedMonetaryAmount,{currency:(0,Ts.getCurrencyFromPriceResponse)(e),value:t}),(0,c.jsxs)("span",{className:"wc-block-components-shipping-rates-control__package__delivery_time",children:[Number.isFinite(t)&&e.delivery_time?" — ":null,(0,_e.decodeEntities)(e.delivery_time)]})]});return 0===t&&(o=(0,c.jsxs)("span",{className:"wc-block-components-shipping-rates-control__package__description--free",children:[(0,x.__)("Free","woocommerce"),(0,c.jsx)("span",{className:"wc-block-components-shipping-rates-control__package__delivery_time",children:e.delivery_time&&" — "+(0,_e.decodeEntities)(e.delivery_time)})]})),{label:(0,_e.decodeEntities)(e.name),value:e.rate_id,description:o}},Fc=({className:e="",noResultsMessage:t,onSelectRate:o,rates:s,renderOption:r=Lc,selectedRate:n,disabled:a=!1,highlightChecked:i=!1,manageSelectionLocally:l=!0})=>{const p=n?.rate_id,[m,u]=(0,d.useState)(()=>Ve(s));if((0,d.useEffect)(()=>{l&&m&&o(m)},[]),(0,d.useEffect)(()=>{l&&p&&p!==m&&u(p)},[p,l]),0===s.length)return t;const h=l?m:p;return(0,c.jsx)(qt.RadioControl,{className:e,onChange:e=>{l&&u(e),o(e)},highlightChecked:i,disabled:a,selected:h??"",options:s.map(r),descriptionStackingDirection:"column"})};o(2793);const Vc=({packageId:e,className:t="",noResultsMessage:o,renderOption:r,packageData:n,collapsible:a,showItems:i,highlightChecked:l=!1,manageSelectionLocally:p=!0})=>{const{selectShippingRate:m,shippingRates:u}=Ge(),{cartItems:h}=Me(),g=u?.length||1,[_,k]=(0,d.useState)(0),b=g>1||_>1;(0,d.useEffect)(()=>{const e=()=>{k(document.querySelectorAll(".wc-block-components-shipping-rates-control__package").length)};e();const t=new MutationObserver(e);return t.observe(document.body,{childList:!0,subtree:!0}),()=>{t.disconnect()}},[]);const w=i??b,y=a??b,f=(0,d.useMemo)(()=>n?.shipping_rates?.find(e=>e?.selected),[n?.shipping_rates]);let x=null;if((y||w)&&(x=(0,c.jsxs)("div",{className:"wc-block-components-shipping-rates-control__package-header",children:[(0,c.jsx)("div",{className:"wc-block-components-shipping-rates-control__package-title",dangerouslySetInnerHTML:{__html:(0,wo.sanitizeHTML)(String(n.name??""))}}),y&&(0,c.jsx)("div",{className:"wc-block-components-totals-shipping__via",children:(0,_e.decodeEntities)(f?.name)}),w&&(0,c.jsx)(Bc,{packageData:n})]}),b)){const e=n.items||[];x=(0,c.jsxs)("div",{className:"wc-block-components-shipping-rates-control__package-container",children:[x,(0,c.jsx)("div",{className:"wc-block-components-shipping-rates-control__package-thumbnails",children:e.slice(0,3).map(e=>(0,c.jsx)(Dc,{packageItem:e,cartItems:h},e.key))})]})}const v=(0,d.useCallback)(t=>{m(t,e)},[e,m]),S={className:t,noResultsMessage:o,rates:n.shipping_rates,onSelectRate:v,selectedRate:n.shipping_rates.find(e=>e.selected),renderOption:r,highlightChecked:l,manageSelectionLocally:p};return y?(0,c.jsx)(qt.Panel,{className:(0,s.A)("wc-block-components-shipping-rates-control__package",b&&"wc-block-components-shipping-rates-control__package--multiple",t),initialOpen:!1,title:x,children:(0,c.jsx)(Fc,{...S})}):(0,c.jsxs)("div",{className:(0,s.A)("wc-block-components-shipping-rates-control__package",b&&"wc-block-components-shipping-rates-control__package--multiple",t),children:[x,(0,c.jsx)(Fc,{...S})]})},$c=({packages:e,showItems:t,collapsible:o,noResultsMessage:s,renderOption:r,context:n=""})=>{const{selectShippingRate:a}=Ge(),{isEditor:i}=b(),l=(0,d.useRef)(new Set);return(0,d.useEffect)(()=>{if(i)return;const t=new Set(e.map(e=>e.package_id));l.current.forEach(e=>{t.has(e)||l.current.delete(e)}),e.forEach(e=>{const t=Ve(e.shipping_rates);t?l.current.has(e.package_id)||(l.current.add(e.package_id),a(t,e.package_id)):l.current.delete(e.package_id)})},[e,a,i]),e.length?(0,c.jsx)(c.Fragment,{children:e.map(({package_id:e,...a})=>(0,c.jsx)(Vc,{highlightChecked:"woocommerce/cart"!==n,packageId:e,packageData:a,collapsible:o,showItems:t,noResultsMessage:s,renderOption:r,manageSelectionLocally:i},e))}):null},Hc=({shippingRates:e,isLoadingRates:t,className:o,collapsible:s,showItems:r,noResultsMessage:n=(0,c.jsx)(c.Fragment,{}),renderOption:a,context:i})=>{const l=Fe(e),p=Be(e),m=tt(l),u=tt(p);(0,d.useEffect)(()=>{var e,o;t||m===l&&u===p||(o=l,1===(e=p)?(0,Fr.speak)((0,x.sprintf)(/* translators: %d number of shipping options found. */ /* translators: %d number of shipping options found. */ (0,x._n)("%d shipping option was found.","%d shipping options were found.",o,"woocommerce"),o)):(0,Fr.speak)((0,x.sprintf)(/* translators: %d number of shipping packages packages. */ /* translators: %d number of shipping packages packages. */ (0,x._n)("Shipping option searched for %d package.","Shipping options searched for %d packages.",e,"woocommerce"),e)+" "+(0,x.sprintf)(/* translators: %d number of shipping options available. */ /* translators: %d number of shipping options available. */ (0,x._n)("%d shipping option was found","%d shipping options were found",o,"woocommerce"),o)))},[t,l,p,m,u]);const{extensions:h,receiveCart:g,..._}=Me(),k={className:o,collapsible:s,showItems:r,noResultsMessage:n,renderOption:a,extensions:h,cart:_,components:{ShippingRatesControlPackage:Vc},context:i},{isEditor:w}=b(),{hasSelectedLocalPickup:y,selectedRates:f}=Ge(),S=(0,v.isObject)(f)?Object.values(f):[],j=S.every(e=>e===S[0]);return t?(0,c.jsx)(Mc,{rows:l}):(0,c.jsxs)(Us,{isLoading:t,screenReaderLabel:(0,x.__)("Loading shipping rates…","woocommerce"),showSpinner:!0,children:[y&&"woocommerce/cart"===i&&e.length>1&&!j&&!w&&(0,c.jsx)(Vr,{className:"wc-block-components-notice",isDismissible:!1,status:"warning",children:(0,x.__)("Multiple shipments must have the same pickup location","woocommerce")}),(0,c.jsx)(Et.ExperimentalOrderShippingPackages.Slot,{...k}),(0,c.jsx)(Et.ExperimentalOrderShippingPackages,{children:(0,c.jsx)($c,{packages:e,noResultsMessage:n,renderOption:a})})]})};function zc(e){let t,o,s,r=[];for(let c=0;c<e.length;c++)t=e.substring(c),o=t.match(/^&[a-z0-9#]+;/),o?(s=o[0],r.push(s),c+=s.length-1):r.push(e[c]);return r}const Uc=(e,t,o="...")=>{const s=function(e,t){const o=(t=t||{}).limit||100,s=void 0===t.preserveTags||t.preserveTags,r=void 0!==t.wordBreak&&t.wordBreak,c=t.suffix||"...",n=t.moreLink||"",a=t.moreText||"»",i=t.preserveWhiteSpace||!1,l=e.replace(/</g,"\n<").replace(/>/g,">\n").replace(/\n\n/g,"\n").replace(/^\n/g,"").replace(/\n$/g,"").split("\n");let d,p,m,u,h,g,_=0,k=[],b=!1;for(let e=0;e<l.length;e++){if(d=l[e],u=i?d:d.replace(/[ ]+/g," "),!d.length)continue;const t=zc(u);if("<"!==d[0])if(_>=o)d="";else if(_+t.length>=o){if(p=o-_," "===t[p-1])for(;p&&(p-=1," "===t[p-1]););else m=t.slice(p).indexOf(" "),r||(-1!==m?p+=m:p=d.length);if(d=t.slice(0,p).join("")+c,n){const e=document.createElement("a");e.href=n,e.style.display="inline",e.textContent=a,d+=e.outerHTML}_=o,b=!0}else _+=t.length;else if(s){if(_>=o)if(h=d.match(/[a-zA-Z]+/),g=h?h[0]:"",g)if("</"!==d.substring(0,2))k.push(g),d="";else{for(;k[k.length-1]!==g&&k.length;)k.pop();k.length&&(d=""),k.pop()}else d=""}else d="";l[e]=d}return{html:l.join("\n").replace(/\n/g,""),more:b}}(e,{suffix:o,limit:t});return s.html},qc=(e,t,o)=>(t<=o?e.start=e.middle+1:e.end=e.middle-1,e),Wc=(e,t,o,s)=>{const r=((e,t,o)=>{let s={start:0,middle:0,end:e.length};for(;s.start<=s.end;)s.middle=Math.floor((s.start+s.end)/2),t.innerHTML=Uc(e,s.middle),s=qc(s,t.clientHeight,o);return s.middle})(e,t,o);return Uc(e,r-s.length,s)},Yc={className:"read-more-content",ellipsis:"…",lessText:(0,x.__)("Read less","woocommerce"),maxLines:3,moreText:(0,x.__)("Read more","woocommerce")};class Gc extends d.Component{static defaultProps=Yc;constructor(e){super(e),this.state={isExpanded:!1,clampEnabled:null,content:e.children,summary:"."},this.reviewContent=(0,d.createRef)(),this.reviewSummary=(0,d.createRef)(),this.getButton=this.getButton.bind(this),this.onClick=this.onClick.bind(this)}componentDidMount(){this.setSummary()}componentDidUpdate(e){e.maxLines===this.props.maxLines&&e.children===this.props.children||this.setState({clampEnabled:null,summary:"."},this.setSummary)}setSummary(){if(this.props.children){const{maxLines:e,ellipsis:t}=this.props;if(!this.reviewSummary.current||!this.reviewContent.current)return;const o=(this.reviewSummary.current.clientHeight+1)*e+1,s=this.reviewContent.current.clientHeight+1>o;this.setState({clampEnabled:s}),s&&this.setState({summary:Wc(this.reviewContent.current.innerHTML,this.reviewSummary.current,o,t)})}}getButton(){const{isExpanded:e}=this.state,{className:t,lessText:o,moreText:s}=this.props,r=e?o:s;if(r)return(0,c.jsx)("a",{href:"#more",className:t+"__read_more",onClick:this.onClick,"aria-expanded":!e,role:"button",children:r})}onClick(e){e.preventDefault();const{isExpanded:t}=this.state;this.setState({isExpanded:!t})}render(){const{className:e}=this.props,{content:t,summary:o,clampEnabled:s,isExpanded:r}=this.state;return t?!1===s?(0,c.jsx)("div",{className:e,children:(0,c.jsx)("div",{ref:this.reviewContent,children:t})}):(0,c.jsxs)("div",{className:e,children:[(!r||null===s)&&(0,c.jsx)("div",{ref:this.reviewSummary,"aria-hidden":r,dangerouslySetInnerHTML:{__html:o}}),(r||null===s)&&(0,c.jsx)("div",{ref:this.reviewContent,"aria-hidden":!r,children:t}),this.getButton()]}):null}}const Jc=Gc,Kc=e=>{const t=(0,f.getSetting)("displayCartPricesIncludingTax",!1)?parseInt(e.price,10)+parseInt(e.taxes,10):parseInt(e.price,10),o=e?.selected,s=0===t?(0,c.jsx)("span",{className:"wc-block-checkout__shipping-option--free",children:(0,x.__)("Free","woocommerce")}):(0,c.jsx)(qt.FormattedMonetaryAmount,{currency:(0,Ts.getCurrencyFromPriceResponse)(e),value:t});return{label:(0,_e.decodeEntities)(e.name),value:e.rate_id,description:(0,_e.decodeEntities)(e.delivery_time),secondaryLabel:s,secondaryDescription:o&&e.description?(0,c.jsx)(Jc,{maxLines:2,children:(0,_e.decodeEntities)(e.description)}):void 0}},Zc=()=>(0,c.jsx)("p",{role:"status","aria-live":"polite",className:"wc-block-components-shipping-rates-control__no-shipping-address-message",children:(0,x.__)("Enter a shipping address to view shipping options.","woocommerce")}),Qc=({noShippingPlaceholder:e=null})=>{const{isEditor:t}=b(),{shippingRates:o,needsShipping:s,isLoadingRates:r,isShippingRatesStale:n,hasCalculatedShipping:a,isCollectable:i}=Ge(),{shippingAddress:l}=ut(),p=(0,d.useMemo)(()=>i?o.map(e=>({...e,shipping_rates:e.shipping_rates.filter(e=>!Le(e.method_id))})):o,[o,i]);if(!s)return null;const m=Be(o),u=xe(l);return n&&u&&!Fe(p)?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(qt.StoreNoticesContainer,{context:me.SHIPPING_METHODS}),(0,c.jsx)(Mc,{})]}):a||m?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(qt.StoreNoticesContainer,{context:me.SHIPPING_METHODS}),t&&!m?e:(0,c.jsx)(Hc,{noResultsMessage:(0,c.jsx)(c.Fragment,{children:u?(0,c.jsx)(Vr,{isDismissible:!1,className:"wc-block-components-shipping-rates-control__no-results-notice",status:"warning",children:(0,x.__)("No shipping options are available for this address. Please verify the address is correct or try a different address.","woocommerce")}):(0,c.jsx)(Zc,{})}),renderOption:Kc,collapsible:!1,shippingRates:p,isLoadingRates:r,context:"woocommerce/checkout"})]}):(0,c.jsx)(Zc,{})};o(1393);const Xc={...Go({defaultTitle:(0,x.__)("Shipping options","woocommerce"),defaultDescription:""}),className:{type:"string",default:""},lock:{type:"object",default:{move:!0,remove:!0}}},en=JSON.parse('{"name":"woocommerce/checkout-shipping-methods-block","title":"Shipping Options","description":"Display shipping options and rates for your store.","category":"woocommerce","supports":{"align":false,"html":false,"multiple":false,"reusable":false,"inserter":false,"lock":false},"attributes":{"lock":{"type":"object","default":{"remove":true,"move":true}}},"parent":["woocommerce/checkout-fields-block"],"textdomain":"woocommerce","$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3}');o(37693),(0,i.registerBlockType)(en,{icon:{src:(0,c.jsx)(a.A,{icon:vc.A,className:"wc-block-editor-components-block-icon"})},attributes:Xc,edit:({attributes:e,setAttributes:t})=>{const o=(0,f.getSetting)("globalShippingMethods"),r=(0,f.getSetting)("activeShippingZones"),{showShippingMethods:n}=ht();return n?(0,c.jsxs)(Yt,{attributes:e,setAttributes:t,className:(0,s.A)("wc-block-checkout__shipping-option",e?.className),children:[(0,c.jsxs)(l.InspectorControls,{children:[(0,c.jsxs)(Ft.PanelBody,{title:(0,x.__)("Shipping Calculations","woocommerce"),children:[(0,c.jsx)("p",{className:"wc-block-checkout__controls-text",children:(0,x.__)("Options that control shipping can be managed in your store settings.","woocommerce")}),(0,c.jsx)(Ft.ExternalLink,{href:`${f.ADMIN_URL}admin.php?page=wc-settings&tab=shipping§ion=options`,children:(0,x.__)("Manage shipping options","woocommerce")})," "]}),o.length>0&&(0,c.jsxs)(Ft.PanelBody,{title:(0,x.__)("Methods","woocommerce"),children:[(0,c.jsx)("p",{className:"wc-block-checkout__controls-text",children:(0,x.__)("The following shipping integrations are active on your store.","woocommerce")}),o.map(e=>(0,c.jsx)(Cr,{href:`${f.ADMIN_URL}admin.php?page=wc-settings&tab=shipping§ion=${e.id}`,title:e.title,description:e.description},e.id)),(0,c.jsx)(Ft.ExternalLink,{href:`${f.ADMIN_URL}admin.php?page=wc-settings&tab=shipping`,children:(0,x.__)("Manage shipping methods","woocommerce")})]}),r.length&&(0,c.jsxs)(Ft.PanelBody,{title:(0,x.__)("Shipping Zones","woocommerce"),children:[(0,c.jsx)("p",{className:"wc-block-checkout__controls-text",children:(0,x.__)("Shipping Zones can be made managed in your store settings.","woocommerce")}),r.map(e=>(0,c.jsx)(Cr,{href:`${f.ADMIN_URL}admin.php?page=wc-settings&tab=shipping&zone_id=${e.id}`,title:e.title,description:e.description},e.id))]})]}),(0,c.jsx)(eo,{children:(0,c.jsx)(Qc,{noShippingPlaceholder:(0,c.jsx)(ac,{icon:vc.A,label:(0,x.__)("Shipping options","woocommerce"),description:(0,x.__)("Your store does not have any Shipping Options configured. Once you have added your Shipping Options they will appear here.","woocommerce"),buttonLabel:(0,x.__)("Configure Shipping Options","woocommerce"),buttonHref:`${f.ADMIN_URL}admin.php?page=wc-settings&tab=shipping`})})}),(0,c.jsx)(Gt,{block:Et.innerBlockAreas.SHIPPING_METHODS})]}):null},save:()=>(0,c.jsx)("div",{...l.useBlockProps.save(),children:(0,c.jsx)(Jt,{})})}),o(11817);const tn=({title:e,packageData:t,showItems:o,selectedOption:r,pickupLocations:n,renderPickupLocation:a,packageCount:i,onChange:l})=>{const{shippingRates:d}=Ge(),{cartItems:p}=Me(),m=(d?.length||1)>1||document.querySelectorAll(".wc-block-components-local-pickup-select .wc-block-components-radio-control").length>1,u=o??m;let h=m&&e&&(0,c.jsx)("div",{children:e});if((m||u)&&t&&(h=(0,c.jsxs)("div",{className:"wc-block-components-shipping-rates-control__package-header",children:[(0,c.jsx)("div",{className:"wc-block-components-shipping-rates-control__package-title",dangerouslySetInnerHTML:{__html:(0,wo.sanitizeHTML)(String(t.name??""))}}),u&&(0,c.jsx)(Bc,{packageData:t})]}),m)){const e=t.items||[];h=(0,c.jsxs)("div",{className:"wc-block-components-shipping-rates-control__package-container",children:[h,(0,c.jsx)("div",{className:"wc-block-components-shipping-rates-control__package-thumbnails",children:e.slice(0,3).map(e=>(0,c.jsx)(Dc,{packageItem:e,cartItems:p},e.key))})]})}return(0,c.jsxs)("div",{className:(0,s.A)("wc-block-components-local-pickup-select",m&&"wc-block-components-local-pickup-select--multiple"),children:[h,(0,c.jsx)(qt.RadioControl,{onChange:l,highlightChecked:!0,selected:r,options:n.map(e=>a(e,i,r))})]})},on=(e,t,o="")=>{const s=(0,f.getSetting)("displayCartPricesIncludingTax",!1)?parseInt(e.price,10)+parseInt(e.taxes,10):parseInt(e.price,10),r=(e=>{if(e?.meta_data){const t=e.meta_data.find(e=>"pickup_location"===e.key);return t?t.value:""}return""})(e),n=(e=>{if(e?.meta_data){const t=e.meta_data.find(e=>"pickup_address"===e.key);return t?t.value:""}return""})(e),i=(e=>{if(e?.meta_data){const t=e.meta_data.find(e=>"pickup_details"===e.key);return t?t.value:""}return""})(e);let l=(0,c.jsx)("em",{children:(0,x.__)("free","woocommerce")});return s>0&&(l=1===t?(0,c.jsx)(qt.FormattedMonetaryAmount,{currency:(0,Ts.getCurrencyFromPriceResponse)(e),value:s}):(0,d.createInterpolateElement)(/* translators: <price/> is the price of the package, <packageCount/> is the number of packages. These must appear in the translated string. */ /* translators: <price/> is the price of the package, <packageCount/> is the number of packages. These must appear in the translated string. */ (0,x._n)("<price/> x <packageCount/> package","<price/> x <packageCount/> packages",t,"woocommerce"),{price:(0,c.jsx)(qt.FormattedMonetaryAmount,{currency:(0,Ts.getCurrencyFromPriceResponse)(e),value:s}),packageCount:(0,c.jsx)(c.Fragment,{children:t})})),{value:e.rate_id,label:r?(0,_e.decodeEntities)(r):(0,_e.decodeEntities)(e.name),secondaryLabel:l,description:n?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(a.A,{icon:Ut.A,className:"wc-block-editor-components-block-icon",width:16,height:16}),(0,_e.decodeEntities)(n)]}):void 0,secondaryDescription:o===e?.rate_id&&i?(0,c.jsx)(Jc,{maxLines:2,children:(0,_e.decodeEntities)(i)}):void 0}},sn=()=>{const{shippingRates:e,selectShippingRate:t}=Ge(),o=(0,d.useMemo)(()=>(e[0]?.shipping_rates||[]).filter(De),[e]),[s,r]=(0,d.useState)(()=>o.find(e=>e.selected)?.rate_id??o[0]?.rate_id),n=(0,d.useCallback)(e=>{r(e),t(e)},[r,t]);(0,d.useEffect)(()=>{s&&t(s)},[]),(0,d.useEffect)(()=>{const e=o.find(e=>e.selected),t=e?.rate_id;t&&t!==s&&r(t)},[o]);const{extensions:a,receiveCart:i,...l}=Me(),p={extensions:a,cart:l,components:{ShippingRatesControlPackage:Vc,LocalPickupSelect:tn},renderPickupLocation:on},m=e[0]||null;return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(Et.ExperimentalOrderLocalPickupPackages.Slot,{...p}),(0,c.jsx)(Et.ExperimentalOrderLocalPickupPackages,{children:(0,c.jsx)(tn,{title:m?.name,packageData:m,selectedOption:s??"",renderPickupLocation:on,pickupLocations:o,packageCount:Be(e),onChange:e=>n(e)})})]})},rn={...Go({defaultTitle:(0,x.__)("Pickup locations","woocommerce"),defaultDescription:""}),className:{type:"string",default:""},lock:{type:"object",default:{move:!0,remove:!0}}},cn=JSON.parse('{"name":"woocommerce/checkout-pickup-options-block","title":"Pickup Method","description":"Shows local pickup locations.","category":"woocommerce","supports":{"align":false,"html":false,"multiple":false,"reusable":false,"inserter":false,"lock":false},"attributes":{"lock":{"type":"object","default":{"remove":true,"move":true}}},"parent":["woocommerce/checkout-fields-block"],"textdomain":"woocommerce","$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3}');o(25991),(0,i.registerBlockType)(cn,{icon:{src:(0,c.jsx)(a.A,{icon:Sc.A,className:"wc-block-editor-components-block-icon"})},attributes:rn,edit:({attributes:e,setAttributes:t})=>{const{prefersCollection:o}=(0,_.useSelect)(e=>({prefersCollection:e(G.checkoutStore).prefersCollection()})),{className:r}=e;return o&&I?(0,c.jsxs)(Yt,{attributes:e,setAttributes:t,className:(0,s.A)("wc-block-checkout__shipping-method",r),children:[(0,c.jsx)(Ft.Disabled,{children:(0,c.jsx)(sn,{})}),(0,c.jsx)(Gt,{block:Et.innerBlockAreas.PICKUP_LOCATION})]}):null},save:()=>(0,c.jsx)("div",{...l.useBlockProps.save(),children:(0,c.jsx)(Jt,{})})});const nn=({className:e=""})=>{const{cartTotals:t}=Me(),{isLoading:o}=dr(),s=(0,Ts.getCurrencyFromPriceResponse)(t);return(0,c.jsx)(qt.TotalsWrapper,{className:e,children:(0,c.jsx)(qt.Subtotal,{currency:s,values:t,showSkeleton:o})})},an=JSON.parse('{"name":"woocommerce/checkout-order-summary-subtotal-block","title":"Subtotal","description":"Shows the cart subtotal row.","category":"woocommerce","supports":{"align":false,"html":false,"multiple":false,"reusable":false,"lock":false},"attributes":{"className":{"type":"string","default":""},"lock":{"type":"object","default":{"remove":true,"move":true}}},"parent":["woocommerce/checkout-order-summary-totals-block"],"textdomain":"woocommerce","$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3}');(0,i.registerBlockType)(an,{icon:{src:(0,c.jsx)(a.A,{icon:nr,className:"wc-block-editor-components-block-icon"})},edit:({attributes:e})=>{const{className:t}=e,o=(0,l.useBlockProps)();return(0,c.jsx)("div",{...o,children:(0,c.jsx)(nn,{className:t})})},save:()=>(0,c.jsx)("div",{...l.useBlockProps.save()})});const ln=({className:e=""})=>{const{cartFees:t,cartTotals:o}=Me(),s=(0,Ts.getCurrencyFromPriceResponse)(o);return(0,c.jsx)(qt.TotalsWrapper,{className:e,children:(0,c.jsx)(qt.TotalsFees,{currency:s,cartFees:t})})},dn=JSON.parse('{"name":"woocommerce/checkout-order-summary-fee-block","title":"Fees","description":"Shows the cart fee row.","category":"woocommerce","supports":{"align":false,"html":false,"multiple":false,"reusable":false,"lock":false},"attributes":{"className":{"type":"string","default":""},"lock":{"type":"object","default":{"remove":true,"move":true}}},"parent":["woocommerce/checkout-order-summary-totals-block"],"textdomain":"woocommerce","$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3}');(0,i.registerBlockType)(dn,{icon:{src:(0,c.jsx)(a.A,{icon:nr,className:"wc-block-editor-components-block-icon"})},edit:({attributes:e})=>{const{className:t}=e,o=(0,l.useBlockProps)();return(0,c.jsx)("div",{...o,children:(0,c.jsx)(ln,{className:t})})},save:()=>(0,c.jsx)("div",{...l.useBlockProps.save()})});const pn=()=>{const{extensions:e,receiveCart:t,...o}=Me(),s={extensions:e,cart:o,context:"woocommerce/checkout"};return(0,c.jsx)(Et.ExperimentalDiscountsMeta.Slot,{...s})},mn=({className:e=""})=>{const{cartTotals:t,cartCoupons:o}=Me(),{removeCoupon:s,isRemovingCoupon:r}=Ws("wc/checkout"),{isLoading:n}=dr(),a=(0,Ts.getCurrencyFromPriceResponse)(t);return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(qt.TotalsWrapper,{className:e,children:(0,c.jsx)(lr,{cartCoupons:o,currency:a,isRemovingCoupon:r,removeCoupon:s,values:t,isLoading:n})}),(0,c.jsx)(pn,{})]})},un=JSON.parse('{"name":"woocommerce/checkout-order-summary-discount-block","title":"Discount","description":"Shows the cart discount row.","category":"woocommerce","supports":{"align":false,"html":false,"multiple":false,"reusable":false,"lock":false},"attributes":{"className":{"type":"string","default":""},"lock":{"type":"object","default":{"remove":true,"move":true}}},"parent":["woocommerce/checkout-order-summary-totals-block"],"textdomain":"woocommerce","$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3}');(0,i.registerBlockType)(un,{icon:{src:(0,c.jsx)(a.A,{icon:nr,className:"wc-block-editor-components-block-icon"})},edit:({attributes:e})=>{const{className:t}=e,o=(0,l.useBlockProps)();return(0,c.jsx)("div",{...o,children:(0,c.jsx)(mn,{className:t})})},save:()=>(0,c.jsx)("div",{...l.useBlockProps.save()})});const hn=({className:e=""})=>{const{cartNeedsShipping:t,shippingRates:o,shippingAddress:s}=Me(),{prefersCollection:r,isShippingRatesStale:n}=(0,_.useSelect)(e=>({prefersCollection:e(G.checkoutStore).prefersCollection(),isShippingRatesStale:e(G.cartStore).isShippingRatesStale()}),[]);if(!t)return null;const a=((e,t)=>e.map(e=>({...e,shipping_rates:e.shipping_rates.filter(e=>{const o=Le(e.method_id);return t?o:!o})})))(o,r??!1),i=xe(s),l=i&&n?(0,c.jsx)(qs,{width:"45px",height:"1em",ariaMessage:(0,x.__)("Loading price…","woocommerce")}):(0,c.jsx)("span",{className:"wc-block-components-shipping-placeholder__value",children:i?(0,x.__)("No available delivery option","woocommerce"):(0,x.__)("Enter address to calculate","woocommerce")});return(0,c.jsx)(Et.TotalsWrapper,{className:e,children:(0,c.jsx)(gr,{shippingRates:a,label:r?(0,x.__)("Pickup","woocommerce"):(0,x.__)("Delivery","woocommerce"),placeholder:l})})},gn=JSON.parse('{"name":"woocommerce/checkout-order-summary-shipping-block","title":"Shipping","description":"Shows the cart shipping row.","category":"woocommerce","supports":{"align":false,"html":false,"multiple":false,"reusable":false,"lock":false},"attributes":{"lock":{"type":"object","default":{"remove":true,"move":true}}},"parent":["woocommerce/checkout-order-summary-totals-block"],"textdomain":"woocommerce","$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3}');(0,i.registerBlockType)(gn,{icon:{src:(0,c.jsx)(a.A,{icon:nr,className:"wc-block-editor-components-block-icon"})},edit:({attributes:e})=>{const{className:t}=e,o=(0,l.useBlockProps)();return(0,c.jsx)("div",{...o,children:(0,c.jsx)(eo,{children:(0,c.jsx)(hn,{className:t})})})},save:()=>(0,c.jsx)("div",{...l.useBlockProps.save()})});var kn=o(49407);const bn=({className:e=""})=>{const t=(0,f.getSetting)("couponsEnabled",!0),{applyCoupon:o,isApplyingCoupon:s}=Ws("wc/checkout");return t?(0,c.jsx)(qt.TotalsWrapper,{className:e,children:(0,c.jsx)(ar,{onSubmit:o,isLoading:s,instanceId:"coupon"})}):null},wn=JSON.parse('{"name":"woocommerce/checkout-order-summary-coupon-form-block","title":"Coupon Form","description":"Shows the apply coupon form.","category":"woocommerce","supports":{"align":false,"html":false,"multiple":false,"reusable":false},"attributes":{"className":{"type":"string","default":""},"lock":{"type":"object","default":{"remove":false,"move":false}}},"parent":["woocommerce/checkout-order-summary-block"],"textdomain":"woocommerce","$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3}');(0,i.registerBlockType)(wn,{icon:{src:(0,c.jsx)(a.A,{icon:kn.A,className:"wc-block-editor-components-block-icon"})},edit:({attributes:e})=>{const{className:t}=e,o=(0,l.useBlockProps)();return(0,c.jsx)("div",{...o,children:(0,c.jsx)(eo,{children:(0,c.jsx)(bn,{className:t})})})},save:()=>(0,c.jsx)("div",{...l.useBlockProps.save()})});const yn=({className:e,showRateAfterTaxName:t})=>{const{cartTotals:o}=Me(),{isLoading:s}=dr();if((0,f.getSetting)("displayCartPricesIncludingTax",!1)||parseInt(o.total_tax,10)<=0)return null;const r=(0,Ts.getCurrencyFromPriceResponse)(o);return(0,c.jsx)(qt.TotalsWrapper,{className:e,children:(0,c.jsx)(qt.TotalsTaxes,{showRateAfterTaxName:t,currency:r,values:o,showSkeleton:s})})},fn={showRateAfterTaxName:{type:"boolean",default:(0,f.getSetting)("displayCartPricesIncludingTax",!1)},lock:{type:"object",default:{remove:!0,move:!0}}},xn=JSON.parse('{"name":"woocommerce/checkout-order-summary-taxes-block","title":"Taxes","description":"Shows the cart taxes row.","category":"woocommerce","supports":{"align":false,"html":false,"multiple":false,"reusable":false,"lock":false},"attributes":{"className":{"type":"string","default":""},"lock":{"type":"object","default":{"remove":true,"move":true}}},"parent":["woocommerce/checkout-order-summary-totals-block"],"textdomain":"woocommerce","$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3}');(0,i.registerBlockType)(xn,{icon:{src:(0,c.jsx)(a.A,{icon:nr,className:"wc-block-editor-components-block-icon"})},attributes:fn,edit:({attributes:e,setAttributes:t})=>{const{className:o,showRateAfterTaxName:s}=e,r=(0,l.useBlockProps)(),n=(0,f.getSetting)("taxesEnabled"),a=(0,f.getSetting)("displayItemizedTaxes",!1),i=(0,f.getSetting)("displayCartPricesIncludingTax",!1);return(0,c.jsxs)("div",{...r,children:[(0,c.jsx)(l.InspectorControls,{children:n&&a&&!i&&(0,c.jsx)(Ft.PanelBody,{title:(0,x.__)("Taxes","woocommerce"),children:(0,c.jsx)(Ft.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,x.__)("Show rate after tax name","woocommerce"),help:(0,x.__)("Show the percentage rate alongside each tax line in the summary.","woocommerce"),checked:s,onChange:()=>t({showRateAfterTaxName:!s})})})}),(0,c.jsx)(yn,{className:o,showRateAfterTaxName:s})]})},save:()=>(0,c.jsx)("div",{...l.useBlockProps.save()})});const vn=(0,c.jsxs)(r.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[(0,c.jsx)("path",{fill:"none",d:"M0 0h24v24H0V0z"}),(0,c.jsx)("path",{d:"M15.55 13c.75 0 1.41-.41 1.75-1.03l3.58-6.49c.37-.66-.11-1.48-.87-1.48H5.21l-.94-2H1v2h2l3.6 7.59-1.35 2.44C4.52 15.37 5.48 17 7 17h12v-2H7l1.1-2h7.45zM6.16 6h12.15l-2.76 5H8.53L6.16 6zM7 18c-1.1 0-1.99.9-1.99 2S5.9 22 7 22s2-.9 2-2-.9-2-2-2zm10 0c-1.1 0-1.99.9-1.99 2s.89 2 1.99 2 2-.9 2-2-.9-2-2-2z"})]});o(60359),o(77826),o(22336);const Sn=({rows:e=2})=>(0,c.jsx)("div",{className:"wc-block-components-order-summary","aria-live":"polite","aria-label":(0,x.__)("Loading products in cart…","woocommerce"),children:(0,c.jsx)("div",{className:"wc-block-components-skeleton wc-block-components-skeleton--cart-line-items-checkout wc-block-components-order-summary__content",children:Array.from({length:e}).map((e,t)=>(0,c.jsxs)("div",{className:"wc-block-components-order-summary-item",children:[(0,c.jsx)("div",{className:"wc-block-components-order-summary-item__image",children:(0,c.jsx)(qs,{width:"48px",height:"48px"})}),(0,c.jsxs)("div",{className:"wc-block-components-order-summary-item__description",children:[(0,c.jsx)(qs,{width:"90%",maxWidth:"173px",height:".875em"}),(0,c.jsx)(qs,{width:"50%",maxWidth:"85px",height:".875em"})]}),(0,c.jsx)("div",{className:"wc-block-components-order-summary-item__total-price",children:(0,c.jsx)(qs,{width:"45px",height:".875em"})})]},t))})});o(8501);const jn=({currency:e,maxPrice:t,minPrice:o,priceClassName:r,priceStyle:n={}})=>(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("span",{className:"screen-reader-text",children:(0,x.sprintf)(/* translators: %1$s min price, %2$s max price */ /* translators: %1$s min price, %2$s max price */ (0,x.__)("Price between %1$s and %2$s","woocommerce"),(0,Ts.formatPrice)(o),(0,Ts.formatPrice)(t))}),(0,c.jsxs)("span",{"aria-hidden":!0,children:[(0,c.jsx)(qt.FormattedMonetaryAmount,{className:(0,s.A)("wc-block-components-product-price__value",r),currency:e,value:o,style:n})," — ",(0,c.jsx)(qt.FormattedMonetaryAmount,{className:(0,s.A)("wc-block-components-product-price__value",r),currency:e,value:t,style:n})]})]}),Cn=({currency:e,regularPriceClassName:t,regularPriceStyle:o,regularPrice:r,priceClassName:n,priceStyle:a,price:i})=>(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("span",{className:"screen-reader-text",children:(0,x.__)("Previous price:","woocommerce")}),(0,c.jsx)("del",{className:(0,s.A)("wc-block-components-product-price__regular",t),style:o,translate:"no",children:(0,c.jsx)(qt.FormattedMonetaryAmount,{currency:e,value:r})}),(0,c.jsx)("span",{className:"screen-reader-text",children:(0,x.__)("Discounted price:","woocommerce")}),(0,c.jsx)("ins",{className:(0,s.A)("wc-block-components-product-price__value","is-discounted",n),style:a,translate:"no",children:(0,c.jsx)(qt.FormattedMonetaryAmount,{currency:e,value:i})})]}),Pn=({align:e,className:t,currency:o,format:r="<price/>",maxPrice:n,minPrice:a,price:i,priceClassName:l,priceStyle:p,regularPrice:m,regularPriceClassName:u,regularPriceStyle:h,style:g})=>{const _=(0,s.A)(t,"price","wc-block-components-product-price",{[`wc-block-components-product-price--align-${e}`]:e});r.includes("<price/>")||(r="<price/>",console.error("Price formats need to include the `<price/>` tag."));const k=void 0!==m&&void 0!==i&&i<m;let b=(0,c.jsx)("span",{className:(0,s.A)("wc-block-components-product-price__value",l)});return k?b=(0,c.jsx)(Cn,{currency:o,price:i,priceClassName:l,priceStyle:p,regularPrice:m,regularPriceClassName:u,regularPriceStyle:h}):void 0!==a&&void 0!==n?b=(0,c.jsx)(jn,{currency:o,maxPrice:n,minPrice:a,priceClassName:l,priceStyle:p}):(i||0===i)&&(b=(0,c.jsx)(qt.FormattedMonetaryAmount,{className:(0,s.A)("wc-block-components-product-price__value",l),currency:o,value:i,style:p})),(0,c.jsx)("span",{className:_,style:g,children:(0,d.createInterpolateElement)(r,{price:b})})};o(40959);const En=({className:e="",disabled:t=!1,name:o,permalink:r="",target:n,rel:a,style:i,onClick:l,disabledTagName:d="span",...p})=>{const m=(0,s.A)("wc-block-components-product-name",e),u=d;if(t){const e=p;return(0,c.jsx)(u,{className:m,...e,dangerouslySetInnerHTML:{__html:o}})}return(0,c.jsx)("a",{className:m,href:r,target:n,...p,dangerouslySetInnerHTML:{__html:o},style:i})};var Nn=o(95754),An=o(5341),In=o(12892);o(37605);const Rn=({children:e,className:t})=>(0,c.jsx)("div",{className:(0,s.A)("wc-block-components-product-badge",t),children:e}),Tn=()=>(0,c.jsx)(Rn,{className:"wc-block-components-product-backorder-badge",children:(0,x.__)("Available on backorder","woocommerce")});var Mn=o(67356);o(3692);const Bn=["a","b","em","i","strong","br","abbr","span"],On=["target","href","rel","name","download","class","title"],Dn=({details:e=[]})=>{if(!Array.isArray(e))return null;const t=e.filter(e=>!e.hidden);return 0===t.length?null:(0,c.jsx)("div",{className:"wc-block-components-product-details",children:t.map((e,o)=>{const s=e?.key||e.name||"",r=document.createElement("div");r.innerHTML=s;const n=r.textContent||r.innerText||"",a=e?.className||(n?`wc-block-components-product-details__${(0,Mn.c)(n)}`:""),i=o===t.length-1;return(0,c.jsxs)("span",{className:a,children:[s&&(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("span",{className:"wc-block-components-product-details__name",dangerouslySetInnerHTML:{__html:(0,wo.sanitizeHTML)(s,{tags:Bn,attr:On})+":"}})," "]}),(0,c.jsx)("span",{className:"wc-block-components-product-details__value",dangerouslySetInnerHTML:{__html:(0,wo.sanitizeHTML)(e.display||e.value,{tags:Bn,attr:On})}}),!i&&(0,c.jsx)("span",{"aria-hidden":"true",children:" / "})]},s+(e.display||e.value))})})},Ln=window.wp.wordcount,Fn=["a","b","em","i","strong","p","br","ul","ol","li","h1","h2","h3","h4","h5","h6","pre","blockquote","img"],Vn=["target","href","rel","name","download","src","class","alt","style"],$n=({source:e,maxLength:t=15,countType:o="words",className:s="",style:r={}})=>{const n=(0,d.useMemo)(()=>((e,t=15,o="words")=>{const s=(0,Pr.autop)(e);if((0,Ln.count)(s,o)<=t)return s;const r=(e=>{const t=e.indexOf("</p>");return-1===t?e:e.substr(0,t+4)})(s);return(0,Ln.count)(r,o)<=t?r:"words"===o?Ar(r,t):Ir(r,t,"characters_including_spaces"===o)})(e,t,o),[e,t,o]);return(0,c.jsx)(d.RawHTML,{style:r,className:s,children:(0,wo.sanitizeHTML)(n,{tags:Fn,attr:Vn})})},Hn=({className:e,shortDescription:t="",fullDescription:o=""})=>{const s=t||o;return s?(0,c.jsx)($n,{className:e,source:s,maxLength:15,countType:S.wordCountType||"words"}):null};o(8879);const zn=({shortDescription:e="",fullDescription:t="",itemData:o=[],variation:s=[]})=>(0,c.jsxs)("div",{className:"wc-block-components-product-metadata",children:[(0,c.jsx)(Hn,{className:"wc-block-components-product-metadata__description",shortDescription:e,fullDescription:t}),(0,c.jsx)(Dn,{details:o}),(0,c.jsx)(Dn,{details:s.map(({attribute:e="",value:t})=>({key:e,value:t}))})]}),Un=({currency:e,saleAmount:t,format:o="<price/>"})=>{if(!t||t<=0)return null;o.includes("<price/>")||(o="<price/>",console.error("Price formats need to include the `<price/>` tag."));const s=(0,x.sprintf)(/* translators: %s will be replaced by the discount amount */ /* translators: %s will be replaced by the discount amount */ (0,x.__)("Save %s","woocommerce"),o);return(0,c.jsx)(Rn,{className:"wc-block-components-sale-badge",children:(0,d.createInterpolateElement)(s,{price:(0,c.jsx)(qt.FormattedMonetaryAmount,{currency:e,value:t})})})},qn=({cartItem:e,disableProductDescriptions:t})=>{const{images:o,show_backorder_badge:r,name:n,permalink:a,prices:i,quantity:l,short_description:p,description:m,item_data:u,variation:h,totals:g,extensions:_}=e,{receiveCart:k,...b}=Me(),w=(0,d.useMemo)(()=>({context:"summary",cartItem:e,cart:b}),[e,b]),y=(0,Ts.getCurrencyFromPriceResponse)(i),S=(0,Et.applyCheckoutFilter)({filterName:"itemName",defaultValue:n,extensions:_,arg:w}),j=(0,v.isString)(i.raw_prices.precision)?parseInt(i.raw_prices.precision,10):i.raw_prices.precision,C=(0,An.i)((0,An.n)((0,Nn.uE)({amount:parseInt(i.raw_prices.regular_price,10),currency:In.B3,scale:j}),y.minorUnit)).amount,P=(0,An.i)((0,An.n)((0,Nn.uE)({amount:parseInt(i.raw_prices.price,10),currency:In.B3,scale:j}),y.minorUnit)).amount,E=(0,Ts.getCurrencyFromPriceResponse)(g);let N=parseInt(g.line_subtotal,10);(0,f.getSetting)("displayCartPricesIncludingTax",!1)&&(N+=parseInt(g.line_subtotal_tax,10));const A=(0,An.i)((0,Nn.uE)({amount:N,currency:In.B3,scale:E.minorUnit})).amount,I=function(e,t){const o="string"==typeof e.raw_prices.precision?parseInt(e.raw_prices.precision,10):e.raw_prices.precision,s=(0,Nn.uE)({amount:parseInt(e.raw_prices.regular_price,10),currency:In.B3,scale:o}),r=(0,Nn.uE)({amount:parseInt(e.raw_prices.price,10),currency:In.B3,scale:o});return(0,An.i)((0,An.n)((0,An.o)(s,r),t)).amount}(i,y.minorUnit),R=(0,Et.applyCheckoutFilter)({filterName:"subtotalPriceFormat",defaultValue:"<price/>",extensions:_,arg:w,validation:Et.productPriceValidation}),T=(0,Et.applyCheckoutFilter)({filterName:"saleBadgePriceFormat",defaultValue:"<price/>",extensions:_,arg:w,validation:Et.productPriceValidation}),M=(0,Et.applyCheckoutFilter)({filterName:"cartItemPrice",defaultValue:"<price/>",extensions:_,arg:w,validation:Et.productPriceValidation}),B=(0,x._n)("Total price for <quantity/> <productName/> item: <price/>","Total price for <quantity/> <productName/> items: <price/>",l,"woocommerce"),O=(0,Et.applyCheckoutFilter)({filterName:"cartItemScreenReaderPrice",defaultValue:B,extensions:_,arg:w,validation:Et.productPriceScreenReaderValidation}).replace(/<(quantity|productName|price)\/>/g,(e,t)=>{switch(t){case"quantity":return String(l);case"productName":return S;case"price":return(0,Ts.formatPrice)(A,E)}return""}),D=(0,Et.applyCheckoutFilter)({filterName:"cartItemClass",defaultValue:"",extensions:_,arg:w}),L=t?{itemData:u,variation:h}:{itemData:u,variation:h,shortDescription:p,fullDescription:m};return(0,c.jsxs)("div",{className:(0,s.A)("wc-block-components-order-summary-item",D),children:[(0,c.jsxs)("div",{className:"wc-block-components-order-summary-item__image",children:[(0,c.jsx)("div",{className:"wc-block-components-order-summary-item__quantity",children:(0,c.jsx)(qt.Label,{label:l.toString(),screenReaderLabel:(0,x.sprintf)(/* translators: %d number of products of the same type in the cart */ /* translators: %d number of products of the same type in the cart */ (0,x._n)("%d item","%d items",l,"woocommerce"),l)})}),(0,c.jsx)(Oc,{image:o.length?o[0]:{},fallbackAlt:S,width:48,height:48})]}),(0,c.jsxs)("div",{className:"wc-block-components-order-summary-item__description",children:[(0,c.jsx)(En,{disabled:!0,name:S,permalink:a,disabledTagName:"h3"}),(0,c.jsx)("div",{className:"wc-block-cart-item__prices",children:(0,c.jsx)(Pn,{currency:y,price:P,regularPrice:C,className:"wc-block-components-order-summary-item__individual-prices",priceClassName:"wc-block-components-order-summary-item__individual-price",regularPriceClassName:"wc-block-components-order-summary-item__regular-individual-price",format:R})}),r&&(0,c.jsx)(Tn,{}),(0,c.jsx)(zn,{...L})]}),(0,c.jsx)("span",{className:"screen-reader-text",children:O}),(0,c.jsx)("div",{className:"wc-block-components-order-summary-item__total-price","aria-hidden":"true",children:(0,c.jsxs)("div",{className:"wc-block-cart-item__total-price-and-sale-badge-wrapper",children:[(0,c.jsx)(Pn,{currency:E,format:M,price:A}),(0,c.jsx)(Un,{currency:y,saleAmount:I*l,format:T})]})})]})};o(26161);const Wn=({cartItems:e=[],disableProductDescriptions:t=!1})=>{const{isLarge:o}=u(),{cartIsLoading:r,hasPendingItemsOperations:n}=Me(),a=r||n;return(0,c.jsx)(pr,{isLoading:a,skeleton:(0,c.jsx)(Sn,{rows:e?.length||2}),children:(0,c.jsx)("div",{className:(0,s.A)("wc-block-components-order-summary",{"is-large":o}),children:(0,c.jsx)("div",{className:"wc-block-components-order-summary__content",children:e.map(e=>(0,c.jsx)(qn,{disableProductDescriptions:t,cartItem:e},e.key))})})})},Yn=({className:e="",disableProductDescriptions:t=!1})=>{const{cartItems:o}=Me();return(0,c.jsx)(qt.TotalsWrapper,{className:e,children:(0,c.jsx)(Wn,{cartItems:o,disableProductDescriptions:t})})},Gn=JSON.parse('{"name":"woocommerce/checkout-order-summary-cart-items-block","title":"Cart Items","description":"Shows cart items.","category":"woocommerce","supports":{"align":false,"html":false,"multiple":false,"reusable":false,"lock":false},"attributes":{"className":{"type":"string","default":""},"disableProductDescriptions":{"type":"boolean","default":false},"lock":{"type":"object","default":{"remove":true,"move":false}}},"parent":["woocommerce/checkout-order-summary-block"],"textdomain":"woocommerce","$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3}');(0,i.registerBlockType)(Gn,{icon:{src:(0,c.jsx)(a.A,{icon:vn,className:"wc-block-editor-components-block-icon"})},edit:({attributes:e,setAttributes:t})=>{const{className:o="",disableProductDescriptions:s=!1}=e,r=(0,l.useBlockProps)();return(0,c.jsxs)("div",{...r,children:[U()&&(0,c.jsx)(l.InspectorControls,{children:(0,c.jsx)(Ft.PanelBody,{title:(0,x.__)("Settings","woocommerce"),children:(0,c.jsx)(Ft.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,x.__)("Disable product descriptions","woocommerce"),help:(0,x.__)("Disable display of product descriptions.","woocommerce"),checked:s,onChange:()=>t({disableProductDescriptions:!s})})})}),(0,c.jsx)(Yn,{disableProductDescriptions:s,className:o})]})},save:()=>(0,c.jsx)("div",{...l.useBlockProps.save()})});const Jn=JSON.parse('{"name":"woocommerce/checkout-order-summary-totals-block","title":"Totals","description":"Shows the subtotal, fees, discounts, shipping and taxes.","category":"woocommerce","supports":{"align":false,"html":false,"multiple":false,"reusable":false,"lock":false},"attributes":{"className":{"type":"string","default":""},"lock":{"type":"object","default":{"remove":true,"move":false}}},"parent":["woocommerce/checkout-order-summary-block"],"textdomain":"woocommerce","$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3}');o(62739),(0,i.registerBlockType)(Jn,{icon:{src:(0,c.jsx)(a.A,{icon:nr,className:"wc-block-editor-components-block-icon"})},edit:({clientId:e})=>{const t=(0,l.useBlockProps)(),o=Dt(Et.innerBlockAreas.CHECKOUT_ORDER_SUMMARY_TOTALS),s=[["woocommerce/checkout-order-summary-subtotal-block",{},[]],["woocommerce/checkout-order-summary-fee-block",{},[]],["woocommerce/checkout-order-summary-discount-block",{},[]],["woocommerce/checkout-order-summary-shipping-block",{},[]],["woocommerce/checkout-order-summary-taxes-block",{},[]]];return Lt({clientId:e,registeredBlocks:o,defaultTemplate:s}),(0,c.jsx)("div",{...t,children:(0,c.jsx)(l.InnerBlocks,{allowedBlocks:o,template:s})})},save:()=>(0,c.jsx)("div",{...l.useBlockProps.save(),children:(0,c.jsx)(l.InnerBlocks.Content,{})})}),o(84259);var Kn=o(48558);const Zn=(e,t=!0)=>{t?window.document.body.classList.add(e):window.document.body.classList.remove(e)},Qn=({attributes:e,setAttributes:t})=>{const{hasDarkControls:o,showFormStepNumbers:s}=e;return(0,c.jsx)(l.InspectorControls,{children:(0,c.jsxs)(Ft.PanelBody,{title:(0,x.__)("Style","woocommerce"),children:[(0,c.jsx)(Ft.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,x.__)("Show form step numbers","woocommerce"),checked:s,onChange:()=>t({showFormStepNumbers:!s})}),(0,c.jsx)(Ft.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,x.__)("Dark mode inputs","woocommerce"),help:(0,x.__)("Inputs styled specifically for use on dark background colors.","woocommerce"),checked:o,onChange:()=>t({hasDarkControls:!o})})]})})},Xn="core/editor";function ea({block:e}){const t="checkout"===e?C:N,o="checkout"===e?"woocommerce_checkout_page_id":"woocommerce_cart_page_id",{saveEntityRecord:s}=(0,_.useDispatch)(At.store),{editPost:r,savePost:n}=(0,_.useDispatch)(Xn),{slug:a,postPublished:i,currentPostId:l}=(0,_.useSelect)(o=>{const{getEntityRecord:s}=o(At.store),r=o(Xn);return{slug:s("postType","page",t)?.slug||e,postPublished:r?.isCurrentPostPublished?.()??!1,currentPostId:r?.getCurrentPostId?.()??0}},[t,e]),[p,m]=(0,d.useState)("pristine"),u=(0,d.useCallback)(()=>{m("updating"),Promise.resolve().then(()=>lt()({path:`/wc/v3/settings/advanced/${o}`,method:"GET"})).catch(e=>{"rest_setting_setting_invalid"===e.code&&m("error")}).then(()=>{if(!i)return r({status:"publish"}),n()}).then(()=>lt()({path:`/wc/v3/settings/advanced/${o}`,method:"POST",data:{value:l.toString()}})).then(()=>{if(0!==t)return s("postType","page",{id:t,slug:`${a}-2`})}).then(()=>r({slug:a})).then(()=>n()).then(()=>m("updated"))},[i,r,n,o,l,t,s,a]);let h;return h="checkout"===e?(0,d.createInterpolateElement)((0,x.__)("If you would like to use this block as your default checkout, <a>update your page settings</a>.","woocommerce"),{a:(0,c.jsx)("a",{href:"#",onClick:u,children:(0,x.__)("update your page settings","woocommerce")})}):(0,d.createInterpolateElement)((0,x.__)("If you would like to use this block as your default cart, <a>update your page settings</a>.","woocommerce"),{a:(0,c.jsx)("a",{href:"#",onClick:u,children:(0,x.__)("update your page settings","woocommerce")})}),"string"==typeof pagenow&&"site-editor"===pagenow||l===t||"dismissed"===p?null:(0,c.jsx)(Ft.Notice,{className:"wc-default-page-notice",status:"updated"===p?"success":"info",onRemove:()=>m("dismissed"),spokenMessage:"updated"===p?(0,x.__)("Page settings updated","woocommerce"):h,children:"updated"===p?(0,x.__)("Page settings updated","woocommerce"):(0,c.jsx)(c.Fragment,{children:(0,c.jsx)("p",{children:h})})})}o(13650);const ta="wc-blocks_dismissed_incompatible_extensions_notices",oa=(e,t)=>e.every(e=>t.includes(e)),sa=e=>"object"==typeof e&&null!==e&&!Array.isArray(e),ra=e=>sa(e),ca=()=>(()=>{if(f.IS_MULTISITE)return[];try{const e=window.localStorage.getItem(ta);if(!e)return[];const t=JSON.parse(e);if(Array.isArray(t))return t}catch{}return console.error(`Value for key '${ta}' could not be carried over from localStorage because it can't be read as a list of dismissals.`),[]})().filter(ra),na=e=>{const[t,o,s,r]=(()=>{const e=(0,f.getSetting)("incompatibleExtensions",void 0),t=Array.isArray(e),o={};t&&e.forEach(e=>{o[e.id]=e.title});const s=Object.keys(o),r=s.length;return[o,s,r,t]})(),[c,n,a]=(()=>{const{incompatiblePaymentMethods:e}=(0,_.useSelect)(e=>{const{getIncompatiblePaymentMethods:t}=e(G.paymentStore);return{incompatiblePaymentMethods:t()}},[]),t=Object.keys(e);return[e,t,t.length]})(),i=(0,_.useSelect)(e=>{const{paymentMethodsInitialized:t,expressPaymentMethodsInitialized:o}=e(G.paymentStore);return t()&&o()},[]),l={...t,...c},p=[...o,...n],m=s+a,u=`${ta}__${f.CURRENT_SITE_ID}`,h=(0,d.useMemo)(()=>((e,t)=>{try{return null===window.localStorage.getItem(e)?t():[]}catch{return[]}})(u,ca),[u]),[g,k]=((e,t)=>{const[o,s]=(0,d.useState)(()=>{const o=window.localStorage.getItem(e);if(o)try{return JSON.parse(o)}catch{console.error(`Value for key '${e}' could not be retrieved from localStorage because it can't be parsed.`)}return t});return(0,d.useEffect)(()=>{try{window.localStorage.setItem(e,JSON.stringify(o))}catch{console.error(`Value for key '${e}' could not be saved in localStorage because it can't be converted into a string.`)}},[e,o]),[o,s]})(u,h),[b,w]=(0,d.useState)(!1),y=(Array.isArray(g)?g:[]).reduce((t,o)=>(t.push(...((e,t)=>{if(!sa(e))return[];const o=e[t];return Array.isArray(o)?o.filter(e=>"string"==typeof e):[]})(o,e)),t),[]),x=oa(p,y),v=0===m||x,S=t=>k(o=>[...(Array.isArray(o)?o:[]).filter(t=>!((e,t)=>sa(e)&&t in e)(t,e)),{[e]:t}]),j=i&&r&&!oa(y,p)?y.filter(e=>p.includes(e)):null;var C;return(0,d.useEffect)(()=>{null!==j&&S(j)}),(0,d.useEffect)(()=>{w(!v)},[v]),[b,()=>{S(p)},(C=l,Object.fromEntries(Object.entries(C).sort(([,e],[,t])=>e.localeCompare(t)))),m]};var aa=o(51512),ia=o.n(aa);ia()("wc-admin:tracks:stats");const la=ia()("wc-admin:tracks");function da(e,t){if(la("recordevent %s %o","wcadmin_"+e,t,{_tqk:window._tkq,shouldRecord:!!window._tkq&&!!window.wcTracks&&!!window.wcTracks.isEnabled}),!window.wcTracks||"function"!=typeof window.wcTracks.recordEvent)return!1;window.wcTracks.recordEvent(e,t)}const pa=({blocks:e,findCondition:t})=>{for(const o of e){if(t(o))return o;if(o.innerBlocks){const e=pa({blocks:o.innerBlocks,findCondition:t});if(e)return e}}},ma=({blockType:e="woocommerce/cart"})=>"woocommerce/cart"===e?(0,c.jsx)("p",{children:(0,x.__)("If you continue, the cart block will be replaced with the classic experience powered by shortcodes. This means that you may lose customizations that you made to the cart block.","woocommerce")}):(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("p",{children:(0,x.__)("If you continue, the checkout block will be replaced with the classic experience powered by shortcodes. This means that you may lose:","woocommerce")}),(0,c.jsxs)("ul",{className:"cross-list",children:[(0,c.jsx)("li",{children:(0,x.__)("Customizations and updates to the block","woocommerce")}),(0,c.jsx)("li",{children:(0,x.__)("Additional local pickup options created for the new checkout","woocommerce")})]})]});function ua({block:e,clientId:t,type:o}){const{createInfoNotice:s}=(0,_.useDispatch)(ot.store),{replaceBlock:r,selectBlock:n}=(0,_.useDispatch)(l.store),[a,p]=(0,d.useState)(!1),m=()=>p(!1),{undo:u}=(0,_.useDispatch)(At.store),[,,h,g]=na(e),k="woocommerce/cart"===e,b=k?(0,x.__)("Switch to classic cart","woocommerce"):(0,x.__)("Switch to classic checkout","woocommerce"),w=k?(0,x.__)("Switched to classic cart.","woocommerce"):(0,x.__)("Switched to classic checkout.","woocommerce"),y=k?"cart":"checkout",f={shortcode:y,notice:"incompatible"===o?"incompatible_notice":"generic_notice",incompatible_extensions_count:g,incompatible_extensions_names:JSON.stringify(h)},{getBlocks:v}=(0,_.useSelect)(e=>({getBlocks:e(l.store).getBlocks}),[]),S=()=>{u(),da("switch_to_classic_shortcode_undo",f)};return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(Ft.Button,{variant:"secondary",onClick:()=>{da("switch_to_classic_shortcode_click",f),p(!0)},children:b}),a&&(0,c.jsxs)(Ft.Modal,{size:"medium",title:b,onRequestClose:m,className:"wc-blocks-switch-to-classic-shortcode-modal-content",children:[(0,c.jsx)(ma,{blockType:e}),(0,c.jsxs)(Ft.TabbableContainer,{className:"wc-blocks-switch-to-classic-shortcode-modal-actions",children:[(0,c.jsx)(Ft.Button,{variant:"primary",isDestructive:!0,onClick:()=>{r(t,(0,i.createBlock)("woocommerce/classic-shortcode",{shortcode:y})),da("switch_to_classic_shortcode_confirm",f),(()=>{const e=pa({blocks:v(),findCondition:e=>"woocommerce/classic-shortcode"===e.name});e&&n(e.clientId)})(),s(w,{actions:[{label:(0,x.__)("Undo","woocommerce"),onClick:S}],type:"snackbar"}),m()},children:(0,x.__)("Switch","woocommerce")})," ",(0,c.jsx)(Ft.Button,{variant:"secondary",onClick:()=>{da("switch_to_classic_shortcode_cancel",f),m()},children:(0,x.__)("Cancel","woocommerce")})]})]})]})}function ha({block:e,clientId:t}){const[o,s,r,n]=na(e);if(!o)return null;const i=(0,c.jsx)(c.Fragment,{children:n>1?(0,d.createInterpolateElement)((0,x.__)("Some active extensions do not yet support this block. This may impact the shopper experience. <a>Learn more</a>","woocommerce"),{a:(0,c.jsx)(Ft.ExternalLink,{href:"https://woocommerce.com/document/woocommerce-store-editing/customizing-cart-and-checkout/#incompatible-extensions/"})}):(0,d.createInterpolateElement)((0,x.sprintf)( // translators: %s is the name of the extension. // translators: %s is the name of the extension. (0,x.__)("<strong>%s</strong> does not yet support this block. This may impact the shopper experience. <a>Learn more</a>","woocommerce"),Object.values(r)[0]),{strong:(0,c.jsx)("strong",{}),a:(0,c.jsx)(Ft.ExternalLink,{href:"https://woocommerce.com/document/woocommerce-store-editing/customizing-cart-and-checkout/#incompatible-extensions/"})})}),l=Object.entries(r),p=l.length-2;return(0,c.jsx)(Ft.Notice,{className:"wc-blocks-incompatible-extensions-notice",status:"warning",onRemove:s,spokenMessage:i,children:(0,c.jsxs)("div",{className:"wc-blocks-incompatible-extensions-notice__content",children:[(0,c.jsx)(a.A,{className:"wc-blocks-incompatible-extensions-notice__warning-icon",icon:(0,c.jsx)(jr,{})}),(0,c.jsxs)("div",{children:[(0,c.jsx)("p",{children:i}),n>1&&(0,c.jsx)("ul",{children:l.slice(0,2).map(([e,t])=>(0,c.jsx)("li",{className:"wc-blocks-incompatible-extensions-notice__element",children:t},e))}),l.length>2&&(0,c.jsxs)("details",{children:[(0,c.jsxs)("summary",{children:[(0,c.jsx)("span",{children:(0,x.sprintf)( // translators: %s is the number of incompatible extensions. // translators: %s is the number of incompatible extensions. (0,x._n)("%s more incompatibility","%s more incompatibilities",p,"woocommerce"),p)}),(0,c.jsx)(a.A,{icon:to.A})]}),(0,c.jsx)("ul",{children:l.slice(2).map(([e,t])=>(0,c.jsx)("li",{className:"wc-blocks-incompatible-extensions-notice__element",children:t},e))})]}),(0,c.jsx)(ua,{block:e,clientId:t,type:"incompatible"})]})]})})}o(54490),o(96342);var ga=o(67078);o(34268);const _a=({text:e,title:t=(0,x.__)("Feedback?","woocommerce"),url:o})=>{const[s,r]=(0,d.useState)(!1);return(0,d.useEffect)(()=>{r(!0)},[]),(0,c.jsx)(c.Fragment,{children:s&&(0,c.jsxs)("div",{className:"wc-block-feedback-prompt",children:[(0,c.jsx)(a.A,{icon:ga.A}),(0,c.jsx)("h2",{className:"wc-block-feedback-prompt__title",children:t}),(0,c.jsx)("p",{className:"wc-block-feedback-prompt__text",children:e}),(0,c.jsxs)("a",{href:o,className:"wc-block-feedback-prompt__link",rel:"noreferrer noopener",target:"_blank",children:[(0,x.__)("Give us your feedback.","woocommerce"),(0,c.jsx)(a.A,{icon:vr.A,size:16})]})]})})},ka=()=>(0,c.jsx)(_a,{text:(0,x.__)("We are currently working on improving our cart and checkout blocks to provide merchants with the tools and customization options they need.","woocommerce"),url:"https://github.com/woocommerce/woocommerce/discussions/new?category=checkout-flow&labels=type%3A+product%20feedback"}),ba=({clientId:e})=>{const{isCart:t,isCheckout:o,parentId:s}=(0,_.useSelect)(t=>{const{getBlockParentsByBlockName:o,getBlockName:s}=t(l.store),r=o(e,["woocommerce/cart","woocommerce/checkout"]).reduce((e,t)=>(e[s(t)]=t,e),{}),c=s(e),n=Object.keys(r).includes("woocommerce/cart"),a=Object.keys(r).includes("woocommerce/checkout"),i="woocommerce/cart"===c||n,d=i?"woocommerce/cart":"woocommerce/checkout";return{isCart:i,isCheckout:"woocommerce/checkout"===c||a,parentId:c===d?e:r[d]}},[e]);return(t||o)&&(0,c.jsxs)(l.InspectorControls,{children:[(0,c.jsx)(ha,{block:t?"woocommerce/cart":"woocommerce/checkout",clientId:s}),(0,c.jsx)(ea,{block:o?"checkout":"cart"}),(0,c.jsx)(ka,{})]})},wa=(0,p.createHigherOrderComponent)(e=>t=>{const{clientId:o,name:s,isSelected:r}=t;return(0,c.jsxs)(c.Fragment,{children:[s.startsWith("woocommerce/")&&r&&(0,c.jsx)(ba,{clientId:o}),(0,c.jsx)(e,{...t},"edit")]})},"withSidebarNotices");(0,We.hasFilter)("editor.BlockEdit","woocommerce/add/sidebar-compatibility-notice")||(0,We.addFilter)("editor.BlockEdit","woocommerce/add/sidebar-compatibility-notice",wa,11),(0,We.hasFilter)("blocks.registerBlockType","core/lock/addAttribute")||(0,_.subscribe)(()=>{const e=(0,_.select)(l.store);if(!e)return;const t=e.getSelectedBlock();t&&(Zn("wc-lock-selected-block--remove",!!t?.attributes?.lock?.remove),Zn("wc-lock-selected-block--move",!!t?.attributes?.lock?.move))});const ya=["woocommerce/checkout-fields-block","woocommerce/checkout-totals-block"],fa={hasDarkControls:{type:"boolean",default:(0,f.getSetting)("hasDarkEditorStyleSupport",!1)},showRateAfterTaxName:{type:"boolean",default:(0,f.getSetting)("displayCartPricesIncludingTax",!1)}},xa={showOrderNotes:{type:"boolean",default:!0},showPolicyLinks:{type:"boolean",default:!0},showReturnToCart:{type:"boolean",default:!0},cartPageId:{type:"number",default:0},showCompanyField:{type:"boolean",default:!1},requireCompanyField:{type:"boolean",default:!1},showApartmentField:{type:"boolean",default:!0},requireApartmentField:{type:"boolean",default:!1},showPhoneField:{type:"boolean",default:!0},requirePhoneField:{type:"boolean",default:!1}},va=JSON.parse('{"name":"woocommerce/checkout","title":"Checkout","description":"Display a checkout form so your customers can submit orders.","category":"woocommerce","keywords":["WooCommerce"],"supports":{"align":["wide"],"html":false,"multiple":false},"example":{"viewportWidth":800},"attributes":{"align":{"type":"string","default":"wide"},"showFormStepNumbers":{"type":"boolean","default":false}},"textdomain":"woocommerce","apiVersion":3,"$schema":"https://schemas.wp.org/trunk/block.json"}'),Sa={icon:{src:(0,c.jsx)(a.A,{icon:n,className:"wc-block-editor-components-block-icon"})},attributes:{...va.attributes,...fa,...xa},edit:({clientId:e,attributes:t,setAttributes:o})=>{const{showOrderNotes:r,showPolicyLinks:n,showReturnToCart:a,showRateAfterTaxName:p,cartPageId:m,showFormStepNumbers:u=!1,hasDarkControls:h=!1}=t,k=(0,_.useSelect)(e=>e(At.store).getEditedEntityRecord("root","site"),[]),b={...f.defaultFields,...Object.fromEntries(Object.entries({phone:"optional",company:"hidden",address_2:"optional"}).map(([e,t])=>{const o=k[`woocommerce_checkout_${e}_field`]||t;return[e,{...f.defaultFields[e],required:"required"===o,hidden:"hidden"===o}]}))},y=(0,d.useRef)((0,Nt.getQueryArg)(window.location.href,"focus"));(0,d.useEffect)(()=>{"checkout"!==y.current||(0,_.select)("core/block-editor").hasSelectedBlock()||((0,_.dispatch)("core/block-editor").selectBlock(e),(0,_.dispatch)("core/interface").enableComplementaryArea("core/edit-site","edit-site/block-inspector"))},[e]);const x=((e={})=>{const t=(0,d.useRef)(),o=(0,l.useBlockProps)({ref:t,...e});return(({ref:e})=>{const t=(0,We.hasFilter)("blocks.registerBlockType","core/lock/addAttribute"),o=e.current;(0,d.useEffect)(()=>{if(o&&!t)return o.addEventListener("keydown",e,{capture:!0,passive:!1}),()=>{o.removeEventListener("keydown",e,{capture:!0})};function e(e){const{keyCode:t,target:o}=e;if(!(o instanceof HTMLElement))return;if(t!==Kn.BACKSPACE&&t!==Kn.DELETE)return;if((0,Zt.isTextField)(o))return;const s=o;if(void 0===s.dataset.block)return;const r=(e=>{if(!e)return!1;const{getBlock:t}=(0,_.select)(l.store),o=t(e);if("boolean"==typeof o?.attributes?.lock?.remove)return o.attributes.lock.remove;const s=(0,i.getBlockType)(o.name);return"boolean"==typeof s?.attributes?.lock?.default?.remove&&s?.attributes?.lock?.default?.remove})(s.dataset.block);r&&(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation())}},[o,t])})({ref:t}),o})();return(0,c.jsxs)("div",{...x,children:[(0,c.jsx)(l.InspectorControls,{children:(0,c.jsx)(Qn,{attributes:t,setAttributes:o})}),(0,c.jsx)(w,{previewData:{previewCart:Ct,previewSavedPaymentMethods:Pt,defaultFields:b},children:(0,c.jsx)(Et.SlotFillProvider,{children:(0,c.jsx)(_t,{children:(0,c.jsx)(g,{className:(0,s.A)("wc-block-checkout",{"has-dark-controls":h}),children:(0,c.jsx)(Mt.Provider,{value:{showOrderNotes:r,showPolicyLinks:n,showReturnToCart:a,cartPageId:m,showRateAfterTaxName:p,showFormStepNumbers:u,defaultFields:b},children:(0,c.jsx)(l.InnerBlocks,{allowedBlocks:ya,template:[["woocommerce/checkout-totals-block",{},[]],["woocommerce/checkout-fields-block",{},[]]],templateLock:"insert"})})})})})})]})},save:()=>(0,c.jsx)("div",{...l.useBlockProps.save({className:"wc-block-checkout is-loading"}),children:(0,c.jsx)(l.InnerBlocks.Content,{})}),transforms:{to:[{type:"block",blocks:["woocommerce/classic-shortcode"],transform:e=>(0,i.createBlock)("woocommerce/classic-shortcode",{shortcode:"checkout",align:e.align},[])}]},deprecated:[{attributes:{...va.attributes,...fa,...xa},save:({attributes:e})=>(0,c.jsx)("div",{className:(0,s.A)("is-loading",e.className)}),migrate:e=>{const{showOrderNotes:t,showPolicyLinks:o,showReturnToCart:s,cartPageId:r}=e;return[e,[(0,i.createBlock)("woocommerce/checkout-fields-block",{},[(0,i.createBlock)("woocommerce/checkout-express-payment-block",{},[]),(0,i.createBlock)("woocommerce/checkout-contact-information-block",{},[]),(0,i.createBlock)("woocommerce/checkout-shipping-address-block",{},[]),(0,i.createBlock)("woocommerce/checkout-billing-address-block",{},[]),(0,i.createBlock)("woocommerce/checkout-shipping-methods-block",{},[]),(0,i.createBlock)("woocommerce/checkout-payment-block",{},[]),(0,i.createBlock)("woocommerce/checkout-additional-information-block",{},[]),!!t&&(0,i.createBlock)("woocommerce/checkout-order-note-block",{},[]),!!o&&(0,i.createBlock)("woocommerce/checkout-terms-block",{},[]),(0,i.createBlock)("woocommerce/checkout-actions-block",{showReturnToCart:s,cartPageId:r},[])].filter(Boolean)),(0,i.createBlock)("woocommerce/checkout-totals-block",{})]]},isEligible:(e,t)=>!t.some(e=>"woocommerce/checkout-fields-block"===e.name)},{save:({attributes:e})=>(0,c.jsx)("div",{className:(0,s.A)("is-loading",e.className)}),isEligible:(e,t)=>{const o=t.find(e=>"woocommerce/checkout-fields-block"===e.name);return!!o&&!o.innerBlocks.some(e=>"woocommerce/checkout-additional-information-block"===e.name)},migrate:(e,t)=>{const o=t.findIndex(e=>"woocommerce/checkout-fields-block"===e.name);if(-1===o)return!1;const s=t[o],r=s.innerBlocks.findIndex(e=>"wp-block-woocommerce-checkout-payment-block"===e.name);return-1!==r&&(t[o]=s.innerBlocks.slice(0,r).concat((0,i.createBlock)("woocommerce/checkout-additional-information-block",{},[])).concat(t.slice(r+1,t.length)),[e,t])}}]};(0,i.registerBlockType)(va,Sa)},45893:()=>{},46882:()=>{},64927:()=>{},60359:()=>{},32770:()=>{},11817:()=>{},26161:()=>{},36713:()=>{},86983:()=>{},29287:()=>{},73793:()=>{},37605:()=>{},3692:()=>{},8879:()=>{},92840:()=>{},2793:()=>{},81962:()=>{},90619:()=>{},48413:()=>{},36562:()=>{},44249:()=>{},99961:()=>{},97575:()=>{},40959:()=>{},8501:()=>{},48306:()=>{},99163:()=>{},22336:()=>{},9249:()=>{},31215:()=>{},42405:()=>{},42831:()=>{},94147:()=>{},85193:()=>{},9725:()=>{},87215:()=>{},77826:()=>{},28796:()=>{},71121:()=>{},62862:()=>{},17883:()=>{},56715:()=>{},94793:()=>{},89003:()=>{},86229:()=>{},62739:()=>{},25991:()=>{},86336:()=>{},1393:()=>{},37693:()=>{},76223:()=>{},88144:()=>{},6811:()=>{},76443:()=>{},84259:()=>{},13650:()=>{},84459:()=>{},34268:()=>{},96342:()=>{},54490:()=>{},51609:e=>{"use strict";e.exports=window.React},10790:e=>{"use strict";e.exports=window.ReactJSXRuntime},20195:e=>{"use strict";e.exports=window.wp.a11y},29491:e=>{"use strict";e.exports=window.wp.compose},64040:e=>{"use strict";e.exports=window.wp.deprecated},28107:e=>{"use strict";e.exports=window.wp.dom},86087:e=>{"use strict";e.exports=window.wp.element},27723:e=>{"use strict";e.exports=window.wp.i18n},20923:e=>{"use strict";e.exports=window.wp.isShallowEqual},48558:e=>{"use strict";e.exports=window.wp.keycodes},5573:e=>{"use strict";e.exports=window.wp.primitives}},r={};function c(e){var t=r[e];if(void 0!==t)return t.exports;var o=r[e]={exports:{}};return s[e](o,o.exports,c),o.exports}c.m=s,e=[],c.O=(t,o,s,r)=>{if(!o){var n=1/0;for(d=0;d<e.length;d++){for(var[o,s,r]=e[d],a=!0,i=0;i<o.length;i++)(!1&r||n>=r)&&Object.keys(c.O).every(e=>c.O[e](o[i]))?o.splice(i--,1):(a=!1,r<n&&(n=r));if(a){e.splice(d--,1);var l=s();void 0!==l&&(t=l)}}return t}r=r||0;for(var d=e.length;d>0&&e[d-1][2]>r;d--)e[d]=e[d-1];e[d]=[o,s,r]},c.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return c.d(t,{a:t}),t},o=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,c.t=function(e,s){if(1&s&&(e=this(e)),8&s)return e;if("object"==typeof e&&e){if(4&s&&e.__esModule)return e;if(16&s&&"function"==typeof e.then)return e}var r=Object.create(null);c.r(r);var n={};t=t||[null,o({}),o([]),o(o)];for(var a=2&s&&e;"object"==typeof a&&!~t.indexOf(a);a=o(a))Object.getOwnPropertyNames(a).forEach(t=>n[t]=()=>e[t]);return n.default=()=>e,c.d(r,n),r},c.d=(e,t)=>{for(var o in t)c.o(t,o)&&!c.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},c.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),c.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),c.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},c.j=251,(()=>{var e={251:0};c.O.j=t=>0===e[t];var t=(t,o)=>{var s,r,[n,a,i]=o,l=0;if(n.some(t=>0!==e[t])){for(s in a)c.o(a,s)&&(c.m[s]=a[s]);if(i)var d=i(c)}for(t&&t(o);l<n.length;l++)r=n[l],c.o(e,r)&&e[r]&&e[r][0](),e[r]=0;return c.O(d)},o=globalThis.webpackChunkwebpackWcBlocksMainJsonp=globalThis.webpackChunkwebpackWcBlocksMainJsonp||[];o.forEach(t.bind(null,0)),o.push=t.bind(null,o.push.bind(o))})();var n=c.O(void 0,[94],()=>c(93970));n=c.O(n),((this.wc=this.wc||{}).blocks=this.wc.blocks||{}).checkout=n})();
Save File
Cancel