(()=>{var e={5338:(e,t,o)=>{"use strict";var n=o(5795);t.H=n.createRoot,n.hydrateRoot},5795:e=>{"use strict";e.exports=window.ReactDOM}},t={};function o(n){var r=t[n];if(void 0!==r)return r.exports;var c=t[n]={exports:{}};return e[n](c,c.exports,o),c.exports}o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e;o.g.importScripts&&(e=o.g.location+"");var t=o.g.document;if(!e&&t&&(t.currentScript&&(e=t.currentScript.src),!e)){var n=t.getElementsByTagName("script");if(n.length)for(var r=n.length-1;r>-1&&(!e||!/^http(s?):/.test(e));)e=n[r--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),o.p=e})(),o.p=window.wcpayAssets.url,(()=>{"use strict";const e=window.React;var t=o.n(e),n=o(5338);const r=window.wp.i18n;function c(e){return e.startsWith("{{/")?{type:"componentClose",value:e.replace(/\W/g,"")}:e.endsWith("/}}")?{type:"componentSelfClosing",value:e.replace(/\W/g,"")}:e.startsWith("{{")?{type:"componentOpen",value:e.replace(/\W/g,"")}:{type:"string",value:e}}function s(t,o){let n,r,c=[];for(let e=0;e(0,l.addQueryArgs)("admin.php",e)),p=window.wp.apiFetch;var u=o.n(p);const d=window.wp.domReady;var w=o.n(d),y=function(e,t,o,n){return new(o||(o=Promise))((function(r,c){function s(e){try{a(n.next(e))}catch(e){c(e)}}function i(e){try{a(n.throw(e))}catch(e){c(e)}}function a(e){var t;e.done?r(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(s,i)}a((n=n.apply(e,t||[])).next())}))};const v=({accept:e})=>y(void 0,void 0,void 0,(function*(){return u()({path:"/wc/v3/payments/tos",method:"POST",data:{accept:e}})})),f=()=>y(void 0,void 0,void 0,(function*(){const e=wcpay_tos_settings.trackStripeConnected;wcTracks.isEnabled&&e&&(((e,t={})=>{var o;if(window.wcpaySettings){Object.assign(t,{is_test_mode:wcpaySettings.testMode,jetpack_connected:wcpaySettings.isJetpackConnected,wcpay_version:wcpaySettings.version,woo_country_code:wcpaySettings.connect.country,hosting_provider:null===(o=wcpaySettings.trackingInfo)||void 0===o?void 0:o.hosting_provider});for(const e in t)void 0===t[e]&&delete t[e]}w()((()=>{var o,n;(null!==(n=null===(o=null===wc||void 0===wc?void 0:wc.tracks)||void 0===o?void 0:o.recordEvent)&&void 0!==n?n:wcTracks.recordEvent)(e,t)}))})("wcpay_stripe_connected",{is_existing_stripe_account:e.is_existing_stripe_account}),u()({path:"/wc/v3/payments/tos/stripe_track_connected",method:"POST"}))}));var _=function(e,t,o,n){return new(o||(o=Promise))((function(r,c){function s(e){try{a(n.next(e))}catch(e){c(e)}}function i(e){try{a(n.throw(e))}catch(e){c(e)}}function a(e){var t;e.done?r(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(s,i)}a((n=n.apply(e,t||[])).next())}))};const g=e=>t().createElement(a.ExternalLink,Object.assign({},e,{href:"https://wordpress.com/tos"})),h=({onAccept:e,onDecline:o,isBusy:n,hasError:c})=>{const s=(0,r.sprintf)((0,r.__)("%s: Terms of Service","woocommerce-payments"),"WooPayments"),l=i({mixedString:(0,r.sprintf)((0,r.__)("To continue using %s, please review and agree to our {{link}}Terms of Service{{/link}}. By clicking “Accept” you agree to the Terms of Service.","woocommerce-payments"),"WooPayments"),components:{link:t().createElement(g,null)}});return t().createElement(a.Modal,{title:s,isDismissible:!1,shouldCloseOnClickOutside:!1,shouldCloseOnEsc:!1,onRequestClose:o,className:"woocommerce-payments__tos-modal"},c&&t().createElement(a.Notice,{status:"error",isDismissible:!1,className:"woocommerce-payments__tos-error"},(0,r.__)("Something went wrong. Please try accepting the Terms of Service again!","woocommerce-payments")),t().createElement("div",{className:"woocommerce-payments__tos-wrapper"},t().createElement("div",{className:"woocommerce-payments__tos-modal-message"},l),t().createElement("div",{className:"woocommerce-payments__tos-footer"},t().createElement(a.Button,{variant:"secondary",onClick:o,disabled:n,__next40pxDefaultSize:!0},(0,r.__)("Decline","woocommerce-payments")),t().createElement(a.Button,{variant:"primary",onClick:e,isBusy:n,__next40pxDefaultSize:!0},(0,r.__)("Accept","woocommerce-payments")))))},E=({onDisable:e,onCancel:o,isBusy:n,hasError:c})=>{const s=(0,r.sprintf)((0,r.__)("Disable %s","woocommerce-payments"),"WooPayments"),l=i({mixedString:(0,r.sprintf)((0,r.__)("By declining our {{link}}Terms of Service{{/link}}, you’ll no longer be able to capture credit card payments using %s. Your previous transaction and payout data will still be available.","woocommerce-payments"),"WooPayments"),components:{link:t().createElement(g,null)}});return t().createElement(a.Modal,{title:s,isDismissible:!1,shouldCloseOnClickOutside:!1,shouldCloseOnEsc:!1,onRequestClose:e,className:"woocommerce-payments__tos-modal"},c&&t().createElement(a.Notice,{status:"error",isDismissible:!1,className:"woocommerce-payments__tos-error"},(0,r.__)("Something went wrong. Please try again!","woocommerce-payments")),t().createElement("div",{className:"woocommerce-payments__tos-wrapper"},t().createElement("div",{className:"woocommerce-payments__tos-modal-message"},l),t().createElement("div",{className:"woocommerce-payments__tos-footer"},t().createElement(a.Button,{variant:"tertiary",onClick:o,isBusy:n,__next40pxDefaultSize:!0},(0,r.__)("Back","woocommerce-payments")),t().createElement(a.Button,{variant:"primary",onClick:e,isBusy:n,__next40pxDefaultSize:!0},(0,r.__)("Disable","woocommerce-payments")))))},b=()=>{const[o,n]=(0,e.useState)(!0),[r,c]=(0,e.useState)(!1),[s,i]=(0,e.useState)(!1),[a,p]=(0,e.useState)(!1),[u,d]=(0,e.useState)(!1),w=()=>n(!1),y=()=>c(!1);return r?t().createElement(E,{onDisable:()=>_(void 0,void 0,void 0,(function*(){try{d(!1),i(!0),yield v({accept:!1}),y(),window.location.href=(0,l.addQueryArgs)(m({page:"wc-settings",tab:"checkout"}),{"tos-disabled":1})}catch(e){d(!0)}finally{i(!1)}})),onCancel:()=>{y(),n(!0)},isBusy:s,hasError:u}):o?t().createElement(h,{onAccept:()=>_(void 0,void 0,void 0,(function*(){try{p(!1),i(!0),yield v({accept:!0}),f(),w()}catch(e){p(!0)}finally{i(!1)}})),onDecline:()=>{w(),c(!0)},isBusy:s,hasError:a}):null},S=window.wp.data;wcpay_tos_settings.tosAgreementDeclined&&window.addEventListener("load",(()=>{const{settingsUrl:e}=wcpay_tos_settings;(e=>{const{createInfoNotice:t}=(0,S.dispatch)("core/notices");t((0,r.sprintf)((0,r.__)("Disabled %s","woocommerce-payments"),"WooPayments"),{actions:[{label:(0,r.__)("Undo","woocommerce-payments"),onClick:async()=>{try{await y(void 0,void 0,void 0,(function*(){return u()({path:"/wc/v3/payments/tos/reactivate",method:"POST"})}))}finally{window.location=e}}}]})})(e)})),wcpay_tos_settings.tosAgreementRequired?function(){const e=document.createElement("div");e.id="wcpay-tos-container",document.body.appendChild(e),(0,n.H)(e).render(t().createElement(b,null))}():f()})()})();