(()=>{"use strict";var e={20(e,o,l){var t=l(609),r=Symbol.for("react.element"),s=(Symbol.for("react.fragment"),Object.prototype.hasOwnProperty),c=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,d={key:!0,ref:!0,__self:!0,__source:!0};function a(e,o,l){var t,a={},i=null,n=null;for(t in void 0!==l&&(i=""+l),void 0!==o.key&&(i=""+o.key),void 0!==o.ref&&(n=o.ref),o)s.call(o,t)&&!d.hasOwnProperty(t)&&(a[t]=o[t]);if(e&&e.defaultProps)for(t in o=e.defaultProps)void 0===a[t]&&(a[t]=o[t]);return{$$typeof:r,type:e,key:i,ref:n,props:a,_owner:c.current}}o.jsx=a,o.jsxs=a},848(e,o,l){e.exports=l(20)},609(e){e.exports=window.React}},o={};const l=window.wc.blocksCheckout,t=window.wp.element,r=window.wp.components,s=window.wp.data,c=window.wc.wcBlocksData,d=window.lodash,a=window.wp.i18n;var i=function l(t){var r=o[t];if(void 0!==r)return r.exports;var s=o[t]={exports:{}};return e[t](s,s.exports,l),s.exports}(848);const n=JSON.parse('{"apiVersion":3,"name":"pr-dhl/dhl-closest-drop-point","version":"1.0.0","title":"DHL Order Block","category":"woocommerce","description":"Adds DHL block to checkout.","supports":{"html":false,"align":true,"multiple":false,"reusable":false},"parent":["woocommerce/checkout-order-summary-block"],"attributes":{"lock":{"type":"object","default":{"remove":true,"move":true}},"mainTitle":{"type":"string","default":"Closest drop-off point."},"infoText":{"type":"string","default":"Preferred delivery to a parcel shop/parcel locker close to the specified home address."},"homeDeliveryLabel":{"type":"string","default":"Home delivery"},"closestDropPointLabel":{"type":"string","default":"Closest Drop Point"}},"textdomain":"dhl-for-woocommerce","editorStyle":"file:../../../build/style-dhl-closest-drop-point.css"}');(0,l.registerCheckoutBlock)({metadata:n,component:({checkoutExtensionData:e})=>{const{setExtensionData:o}=e,l=prDhlGlobals?.pluginUrl+"/assets/img/dhl-official.png",n=prDhlGlobals.dhlSettings,[p,h]=(0,t.useState)(null),[m,u]=(0,t.useState)("no"),[_,f]=(0,t.useState)(!0),x=n?.closest_drop_point,w=prDhlGlobals?.valid_countries||[],y=(0,s.useSelect)(e=>e(c.CART_STORE_KEY).getCustomerData(),[]),v=y?y.shippingAddress:null,j=(0,t.useCallback)((0,d.debounce)((e,l,t)=>{o(e,l,t)},500),[o]),b=!0===((0,s.useSelect)(e=>e(c.CART_STORE_KEY).getCartData(),[])||{}).needsShipping;return(0,t.useEffect)(()=>v&&x&&w.includes(v.country)?void f(!0):void f(!1),[v,x]),(0,t.useEffect)(()=>{o("pr-dhl","closest_drop_point",m),j("pr-dhl","closest_drop_point",m)},[m]),!1===b?null:_?p?(0,i.jsx)(r.Notice,{status:"error",isDismissible:!1,children:(0,a.__)(p,"dhl-for-woocommerce")}):(0,i.jsx)("table",{className:"dhl-co-table",children:(0,i.jsxs)("tbody",{children:[(0,i.jsx)("tr",{className:"dhl-co-tr dhl-co-tr-first",children:(0,i.jsx)("td",{colSpan:2,children:(0,i.jsx)("img",{src:l,alt:"DHL logo",className:"dhl-co-logo"})})}),(0,i.jsx)("tr",{className:"dhl-co-tr",children:(0,i.jsxs)("th",{colSpan:2,children:[(0,a.__)("Closest drop-off point","dhl-for-woocommerce"),(0,i.jsx)("hr",{})]})}),(0,i.jsx)("tr",{className:"dhl-co-tr",children:(0,i.jsx)("td",{colSpan:2,children:(0,a.__)("Preferred delivery to a parcel shop/parcel locker close to the specified home address","dhl-for-woocommerce")})}),(0,i.jsxs)("tr",{className:"dhl-co-tr",children:[(0,i.jsx)("th",{className:"dhl-cdp",children:(0,a.__)("Delivery option","dhl-for-woocommerce")}),(0,i.jsx)("td",{className:"dhl-cdp",children:(0,i.jsxs)("ul",{className:"dhl-preferred-location",children:[(0,i.jsxs)("li",{children:[(0,i.jsx)("input",{defaultChecked:!0,type:"radio",name:"pr_dhl_cdp_delivery","data-index":0,id:"dhl_home_deliver_option",value:"no",className:"",onChange:e=>u(e.target.value)}),(0,i.jsx)("label",{htmlFor:"dhl_home_deliver_option",children:(0,a.__)("Home delivery","dhl-for-woocommerce")})]}),(0,i.jsxs)("li",{children:[(0,i.jsx)("input",{type:"radio",name:"pr_dhl_cdp_delivery","data-index":0,id:"dhl_cdp_option",value:"yes",className:"",onChange:e=>u(e.target.value)}),(0,i.jsx)("label",{htmlFor:"dhl_cdp_option",children:(0,a.__)("Closest Drop Point","dhl-for-woocommerce")})]})]})})]}),(0,i.jsx)("tr",{className:"dhl-co-tr dhl-co-tr-last",children:(0,i.jsx)("td",{colSpan:2})})]})}):null}})})();