subscription-product-onboarding-modal.js 43.5 KB
/*! For license information please see subscription-product-onboarding-modal.js.LICENSE.txt */
!function(){var e={4184:function(e,t){var n;!function(){"use strict";var r={}.hasOwnProperty;function o(){for(var e=[],t=0;t<arguments.length;t++){var n=arguments[t];if(n){var i=typeof n;if("string"===i||"number"===i)e.push(n);else if(Array.isArray(n)){if(n.length){var c=o.apply(null,n);c&&e.push(c)}}else if("object"===i)if(n.toString===Object.prototype.toString)for(var u in n)r.call(n,u)&&n[u]&&e.push(u);else e.push(n.toString())}}return e.join(" ")}e.exports?(o.default=o,e.exports=o):void 0===(n=function(){return o}.apply(t,[]))||(e.exports=n)}()},4155:function(e){var t,n,r=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function c(e){if(t===setTimeout)return setTimeout(e,0);if((t===o||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:o}catch(e){t=o}try{n="function"==typeof clearTimeout?clearTimeout:i}catch(e){n=i}}();var u,a=[],s=!1,l=-1;function f(){s&&u&&(s=!1,u.length?a=u.concat(a):l=-1,a.length&&p())}function p(){if(!s){var e=c(f);s=!0;for(var t=a.length;t;){for(u=a,a=[];++l<t;)u&&u[l].run();l=-1,t=a.length}u=null,s=!1,function(e){if(n===clearTimeout)return clearTimeout(e);if((n===i||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(e);try{n(e)}catch(t){try{return n.call(null,e)}catch(t){return n.call(this,e)}}}(e)}}function d(e,t){this.fun=e,this.array=t}function h(){}r.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];a.push(new d(e,t)),1!==a.length||s||c(p)},d.prototype.run=function(){this.fun.apply(null,this.array)},r.title="browser",r.browser=!0,r.env={},r.argv=[],r.version="",r.versions={},r.on=h,r.addListener=h,r.once=h,r.off=h,r.removeListener=h,r.removeAllListeners=h,r.emit=h,r.prependListener=h,r.prependOnceListener=h,r.listeners=function(e){return[]},r.binding=function(e){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(e){throw new Error("process.chdir is not supported")},r.umask=function(){return 0}}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},function(){var e;n.g.importScripts&&(e=n.g.location+"");var t=n.g.document;if(!e&&t&&(t.currentScript&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName("script");r.length&&(e=r[r.length-1].src)}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),n.p=e}(),n.p=window.wcpayAssets.url,function(){"use strict";var e=window.wp.element;function t(){return t=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},t.apply(this,arguments)}function r(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}window.React;var o=n(4184),i=n.n(o),c=window.lodash,u=window.wp.deprecated,a=n.n(u);function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function f(e,t,n){return t&&l(e.prototype,t),n&&l(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function p(e,t){return p=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},p(e,t)}function d(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&p(e,t)}function h(e){return h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},h(e)}function m(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function v(e,t){if(t&&("object"===h(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return m(e)}function y(e){return y=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},y(e)}function b(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function g(e,t){if(e){if("string"==typeof e)return b(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?b(e,t):void 0}}function w(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i=[],c=!0,u=!1;try{for(n=n.call(e);!(c=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);c=!0);}catch(e){u=!0,o=e}finally{try{c||null==n.return||n.return()}finally{if(u)throw o}}return i}}(e,t)||g(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var _=window.wp.dom,O=window.wp.keycodes,E=window.wp.compose,C=window.wp.primitives,T=(0,e.createElement)(C.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,e.createElement)(C.Path,{d:"M13 11.8l6.1-6.3-1-1-6.1 6.2-6.1-6.2-1 1 6.1 6.3-6.5 6.7 1 1 6.5-6.6 6.5 6.6 1-1z"}));function S(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function R(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function P(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?R(Object(n),!0).forEach((function(t){S(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):R(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function D(e,t,n,r,o,i,c){var u=t.width,a="rtl"===document.documentElement.dir;"left"===n&&a?n="right":"right"===n&&a&&(n="left"),"left"===r&&a?r="right":"right"===r&&a&&(r="left");var s=Math.round(e.left+e.width/2),l={popoverLeft:s,contentWidth:(s-u/2>0?u/2:s)+(s+u/2>window.innerWidth?window.innerWidth-s:u/2)},f=e.left;"right"===r?f=e.right:"middle"!==i&&(f=s);var p=e.right;"left"===r?p=e.left:"middle"!==i&&(p=s);var d,h={popoverLeft:f,contentWidth:f-u>0?u:f},m={popoverLeft:p,contentWidth:p+u>window.innerWidth?window.innerWidth-p:u},v=n,y=null;if(!o)if("center"===n&&l.contentWidth===u)v="center";else if("left"===n&&h.contentWidth===u)v="left";else if("right"===n&&m.contentWidth===u)v="right";else{var b="left"==(v=h.contentWidth>m.contentWidth?"left":"right")?h.contentWidth:m.contentWidth;y=b!==u?b:null}if(d="center"===v?l.popoverLeft:"left"===v?h.popoverLeft:m.popoverLeft,c){var g=c.getBoundingClientRect();d=Math.min(d,g.right-u)}return{xAxis:v,popoverLeft:d,contentWidth:y}}function N(e,t,n,r,o,i,c){var u=t.height;if(o){var a=((0,_.getScrollContainer)(i)||document.body).getBoundingClientRect().top+u-c;if(e.top<=a)return{yAxis:n,popoverTop:Math.min(e.bottom,a)}}var s=e.top+e.height/2;"bottom"===r?s=e.bottom:"top"===r&&(s=e.top);var l={popoverTop:s,contentHeight:(s-u/2>0?u/2:s)+(s+u/2>window.innerHeight?window.innerHeight-s:u/2)},f={popoverTop:e.top,contentHeight:e.top-10-u>0?u:e.top-10},p={popoverTop:e.bottom,contentHeight:e.bottom+10+u>window.innerHeight?window.innerHeight-10-e.bottom:u},d=n,h=null;if(!o)if("middle"===n&&l.contentHeight===u)d="middle";else if("top"===n&&f.contentHeight===u)d="top";else if("bottom"===n&&p.contentHeight===u)d="bottom";else{var m="top"==(d=f.contentHeight>p.contentHeight?"top":"bottom")?f.contentHeight:p.contentHeight;h=m!==u?m:null}return{yAxis:d,popoverTop:"middle"===d?l.popoverTop:"top"===d?f.popoverTop:p.popoverTop,contentHeight:h}}function k(e){return function(e){if(Array.isArray(e))return b(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||g(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var F=(0,e.createContext)({focusHistory:[]}),I=F.Provider,A=F.Consumer;I.displayName="FocusReturnProvider",A.displayName="FocusReturnConsumer",e.Component;var M=(0,E.createHigherOrderComponent)((function t(n){if((o=n)instanceof e.Component||"function"==typeof o){var r=n;return t({})(r)}var o,i=n.onFocusReturn,u=void 0===i?c.stubTrue:i;return function(t){var n=function(n){d(a,n);var r,o,i=(r=a,o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=y(r);if(o){var n=y(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return v(this,e)});function a(){var e;return s(this,a),(e=i.apply(this,arguments)).ownFocusedElements=new Set,e.activeElementOnMount=document.activeElement,e.setIsFocusedFalse=function(){return e.isFocused=!1},e.setIsFocusedTrue=function(t){e.ownFocusedElements.add(t.target),e.isFocused=!0},e}return f(a,[{key:"componentWillUnmount",value:function(){var e=this.activeElementOnMount,t=this.isFocused,n=this.ownFocusedElements;if(t&&!1!==u())for(var r,o=[].concat(k(c.without.apply(void 0,[this.props.focus.focusHistory].concat(k(n)))),[e]);r=o.pop();)if(document.body.contains(r))return void r.focus()}},{key:"render",value:function(){return(0,e.createElement)("div",{onFocus:this.setIsFocusedTrue,onBlur:this.setIsFocusedFalse},(0,e.createElement)(t,this.props.childProps))}}]),a}(e.Component);return function(t){return(0,e.createElement)(A,null,(function(r){return(0,e.createElement)(n,{childProps:t,focus:r})}))}}}),"withFocusReturn");var j=(0,E.createHigherOrderComponent)((function(t){return function(n){d(c,n);var r,o,i=(r=c,o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=y(r);if(o){var n=y(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return v(this,e)});function c(){var t;return s(this,c),(t=i.apply(this,arguments)).focusContainRef=(0,e.createRef)(),t.handleTabBehaviour=t.handleTabBehaviour.bind(m(t)),t}return f(c,[{key:"handleTabBehaviour",value:function(e){if(e.keyCode===O.TAB){var t=_.focus.tabbable.find(this.focusContainRef.current);if(t.length){var n=t[0],r=t[t.length-1];e.shiftKey&&e.target===n?(e.preventDefault(),r.focus()):(e.shiftKey||e.target!==r)&&t.includes(e.target)||(e.preventDefault(),n.focus())}}}},{key:"render",value:function(){return(0,e.createElement)("div",{onKeyDown:this.handleTabBehaviour,ref:this.focusContainRef,tabIndex:"-1"},(0,e.createElement)(t,this.props))}}]),c}(e.Component)}),"withConstrainedTabbing"),L=j;var U=["button","submit"],x=(0,E.createHigherOrderComponent)((function(n){return function(r){d(a,r);var o,i,u=(o=a,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=y(o);if(i){var n=y(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return v(this,e)});function a(){var e;return s(this,a),(e=u.apply(this,arguments)).bindNode=e.bindNode.bind(m(e)),e.cancelBlurCheck=e.cancelBlurCheck.bind(m(e)),e.queueBlurCheck=e.queueBlurCheck.bind(m(e)),e.normalizeButtonFocus=e.normalizeButtonFocus.bind(m(e)),e}return f(a,[{key:"componentWillUnmount",value:function(){this.cancelBlurCheck()}},{key:"bindNode",value:function(e){e?this.node=e:(delete this.node,this.cancelBlurCheck())}},{key:"queueBlurCheck",value:function(e){var t=this;e.persist(),this.preventBlurCheck||(this.blurCheckTimeout=setTimeout((function(){document.hasFocus()?"function"==typeof t.node.handleFocusOutside&&t.node.handleFocusOutside(e):e.preventDefault()}),0))}},{key:"cancelBlurCheck",value:function(){clearTimeout(this.blurCheckTimeout)}},{key:"normalizeButtonFocus",value:function(e){var t=e.type,n=e.target;(0,c.includes)(["mouseup","touchend"],t)?this.preventBlurCheck=!1:function(e){switch(e.nodeName){case"A":case"BUTTON":return!0;case"INPUT":return(0,c.includes)(U,e.type)}return!1}(n)&&(this.preventBlurCheck=!0)}},{key:"render",value:function(){return(0,e.createElement)("div",{onFocus:this.cancelBlurCheck,onMouseDown:this.normalizeButtonFocus,onMouseUp:this.normalizeButtonFocus,onTouchStart:this.normalizeButtonFocus,onTouchEnd:this.normalizeButtonFocus,onBlur:this.queueBlurCheck},(0,e.createElement)(n,t({ref:this.bindNode},this.props)))}}]),a}(e.Component)}),"withFocusOutside");var B=function(e){d(o,e);var t,n,r=(t=o,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=y(t);if(n){var o=y(this).constructor;e=Reflect.construct(r,arguments,o)}else e=r.apply(this,arguments);return v(this,e)});function o(){return s(this,o),r.apply(this,arguments)}return f(o,[{key:"handleFocusOutside",value:function(e){this.props.onFocusOutside(e)}},{key:"render",value:function(){return this.props.children}}]),o}(e.Component),H=x(B);function W(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=y(e);if(t){var o=y(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return v(this,n)}}var K=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.htmlDocument,r=void 0===n?document:n,o=t.className,i=void 0===o?"lockscroll":o,c=0,u=0;function a(e){var t=r.scrollingElement||r.body;e&&(u=t.scrollTop);var n=e?"add":"remove";t.classList[n](i),r.documentElement.classList[n](i),e||(t.scrollTop=u)}function l(){0===c&&a(!0),++c}function p(){1===c&&a(!1),--c}return function(e){d(n,e);var t=W(n);function n(){return s(this,n),t.apply(this,arguments)}return f(n,[{key:"componentDidMount",value:function(){l()}},{key:"componentWillUnmount",value:function(){p()}},{key:"render",value:function(){return null}}]),n}(e.Component)}();function z(e){e.stopPropagation()}var q=(0,e.forwardRef)((function(n,o){var i=n.children,c=r(n,["children"]);return(0,e.createElement)("div",t({},c,{ref:o,onMouseDown:z}),i)}));function V(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=y(e)););return e}function Y(){return Y="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=V(e,t);if(r){var o=Object.getOwnPropertyDescriptor(r,t);return o.get?o.get.call(arguments.length<3?e:n):o.value}},Y.apply(this,arguments)}window.wp.isShallowEqual;var G=(window.wp.warning,n(4155)),$=(0,e.createContext)({slots:{},fills:{},registerSlot:function(){void 0!==G&&G.env},updateSlot:function(){},unregisterSlot:function(){},registerFill:function(){},unregisterFill:function(){}});var Q=(0,e.createContext)({registerSlot:function(){},unregisterSlot:function(){},registerFill:function(){},unregisterFill:function(){},getSlot:function(){},getFills:function(){},subscribe:function(){}}),X=(Q.Provider,Q.Consumer);e.Component;var J=function(t){d(i,t);var n,r,o=(n=i,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=y(n);if(r){var o=y(this).constructor;e=Reflect.construct(t,arguments,o)}else e=t.apply(this,arguments);return v(this,e)});function i(){var e;return s(this,i),(e=o.apply(this,arguments)).isUnmounted=!1,e.bindNode=e.bindNode.bind(m(e)),e}return f(i,[{key:"componentDidMount",value:function(){(0,this.props.registerSlot)(this.props.name,this)}},{key:"componentWillUnmount",value:function(){var e=this.props.unregisterSlot;this.isUnmounted=!0,e(this.props.name,this)}},{key:"componentDidUpdate",value:function(e){var t=this.props,n=t.name,r=t.unregisterSlot,o=t.registerSlot;e.name!==n&&(r(e.name),o(n,this))}},{key:"bindNode",value:function(e){this.node=e}},{key:"forceUpdate",value:function(){this.isUnmounted||Y(y(i.prototype),"forceUpdate",this).call(this)}},{key:"render",value:function(){var t=this.props,n=t.children,r=t.name,o=t.fillProps,i=void 0===o?{}:o,u=t.getFills,a=(0,c.map)(u(r,this),(function(t){var n=t.occurrence,r=(0,c.isFunction)(t.children)?t.children(i):t.children;return e.Children.map(r,(function(t,r){if(!t||(0,c.isString)(t))return t;var o="".concat(n,"---").concat(t.key||r);return(0,e.cloneElement)(t,{key:o})}))})).filter((0,c.negate)(e.isEmptyElement));return(0,e.createElement)(e.Fragment,null,(0,c.isFunction)(n)?n(a):a)}}]),i}(e.Component),Z=function(n){return(0,e.createElement)(X,null,(function(r){var o=r.registerSlot,i=r.unregisterSlot,c=r.getFills;return(0,e.createElement)(J,t({},n,{registerSlot:o,unregisterSlot:i,getFills:c}))}))},ee=0;function te(t){var n=t.name,r=t.children,o=t.registerFill,i=t.unregisterFill,u=function(t){var n=(0,e.useContext)(Q),r=n.getSlot,o=n.subscribe,i=w((0,e.useState)(r(t)),2),c=i[0],u=i[1];return(0,e.useEffect)((function(){return u(r(t)),o((function(){u(r(t))}))}),[t]),c}(n),a=(0,e.useRef)({name:n,children:r});return a.current.occurrence||(a.current.occurrence=++ee),(0,e.useLayoutEffect)((function(){return o(n,a.current),function(){return i(n,a.current)}}),[]),(0,e.useLayoutEffect)((function(){a.current.children=r,u&&u.forceUpdate()}),[r]),(0,e.useLayoutEffect)((function(){n!==a.current.name&&(i(a.current.name,a.current),a.current.name=n,o(n,a.current))}),[n]),u&&u.node?((0,c.isFunction)(r)&&(r=r(u.props.fillProps)),(0,e.createPortal)(r,u.node)):null}var ne=function(n){return(0,e.createElement)(X,null,(function(r){var o=r.registerFill,i=r.unregisterFill;return(0,e.createElement)(te,t({},n,{registerFill:o,unregisterFill:i}))}))};function re(n){var o=n.name,i=n.fillProps,c=void 0===i?{}:i,u=n.as,a=void 0===u?"div":u,s=r(n,["name","fillProps","as"]),l=(0,e.useContext)($),f=(0,e.useRef)();return(0,e.useLayoutEffect)((function(){return l.registerSlot(o,f,c),function(){l.unregisterSlot(o,f)}}),[l.registerSlot,l.unregisterSlot,o]),(0,e.useLayoutEffect)((function(){l.updateSlot(o,c)})),(0,e.createElement)(a,t({ref:f},s))}function oe(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function ie(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?oe(Object(n),!0).forEach((function(t){S(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):oe(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ce(t){var n=(0,e.useContext)($),r=n.slots[t]||{},o=n.fills[t],i=(0,e.useMemo)((function(){return o||[]}),[o]),c=(0,e.useCallback)((function(e){n.updateSlot(t,e)}),[t,n.updateSlot]),u=(0,e.useCallback)((function(e){n.unregisterSlot(t,e)}),[t,n.unregisterSlot]),a=(0,e.useCallback)((function(e){n.registerFill(t,e)}),[t,n.registerFill]),s=(0,e.useCallback)((function(e){n.unregisterFill(t,e)}),[t,n.unregisterFill]);return ie(ie({},r),{},{updateSlot:c,unregisterSlot:u,fills:i,registerFill:a,unregisterFill:s})}function ue(t){var n,r=t.name,o=t.children,i=ce(r),c=(0,e.useRef)({rerender:(n=w((0,e.useState)({}),2)[1],function(){return n({})})});return(0,e.useEffect)((function(){return i.registerFill(c),function(){i.unregisterFill(c)}}),[i.registerFill,i.unregisterFill]),i.ref&&i.ref.current?("function"==typeof o&&(o=o(i.fillProps)),(0,e.createPortal)(o,i.ref.current)):null}function ae(t){var n=t.bubblesVirtually,o=r(t,["bubblesVirtually"]);return n?(0,e.createElement)(re,o):(0,e.createElement)(Z,o)}function se(t){return(0,e.createElement)(e.Fragment,null,(0,e.createElement)(ne,t),(0,e.createElement)(ue,t))}function le(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function fe(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?le(Object(n),!0).forEach((function(t){S(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):le(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function pe(e){var t=e.type,n=e.origin,r=void 0===n?function(e){return"appear"===e?"top":"left"}(t):n;if("appear"===t){var o,c=w(r.split(" "),2),u=c[0],a=c[1],s=void 0===a?"center":a;return i()("components-animate__appear",(S(o={},"is-from-"+s,"center"!==s),S(o,"is-from-"+u,"middle"!==u),o))}return"slide-in"===t?i()("components-animate__slide-in","is-from-"+r):"loading"===t?i()("components-animate__loading"):void 0}function de(e){var t=e.type,n=e.options,r=void 0===n?{}:n;return(0,e.children)({className:pe(fe({type:t},r))})}var he=L(M((function(e){return e.children}))),me="Popover";function ve(e,t){var n,r=(n=t).ownerDocument.defaultView.getComputedStyle(n),o=r.paddingTop,i=r.paddingBottom,c=r.paddingLeft,u=r.paddingRight,a=o?parseInt(o,10):0,s=i?parseInt(i,10):0,l=c?parseInt(c,10):0,f=u?parseInt(u,10):0;return{x:e.left+l,y:e.top+a,width:e.width-l-f,height:e.height-a-s,left:e.left+l,right:e.right-f,top:e.top+a,bottom:e.bottom-s}}function ye(e,t,n){n?e.getAttribute(t)!==n&&e.setAttribute(t,n):e.hasAttribute(t)&&e.removeAttribute(t)}function be(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";e.style[t]!==n&&(e.style[t]=n)}function ge(e,t,n){n?e.classList.contains(t)||e.classList.add(t):e.classList.contains(t)&&e.classList.remove(t)}var we=function(n){var o=n.headerTitle,c=n.onClose,u=n.onKeyDown,s=n.children,l=n.className,f=n.noArrow,p=void 0===f||f,d=n.isAlternate,h=n.position,m=void 0===h?"bottom right":h,v=(n.range,n.focusOnMount),y=void 0===v?"firstElement":v,b=n.anchorRef,g=n.shouldAnchorIncludePadding,C=n.anchorRect,S=n.getAnchorRect,R=n.expandOnMobile,k=n.animate,F=void 0===k||k,I=n.onClickOutside,A=n.onFocusOutside,M=n.__unstableSticky,j=n.__unstableSlotName,L=void 0===j?me:j,U=n.__unstableObserveElement,x=n.__unstableBoundaryParent,B=r(n,["headerTitle","onClose","onKeyDown","children","className","noArrow","isAlternate","position","range","focusOnMount","anchorRef","shouldAnchorIncludePadding","anchorRect","getAnchorRect","expandOnMobile","animate","onClickOutside","onFocusOutside","__unstableSticky","__unstableSlotName","__unstableObserveElement","__unstableBoundaryParent"]),W=(0,e.useRef)(null),z=(0,e.useRef)(null),V=(0,e.useRef)(),Y=(0,E.useViewportMatch)("medium","<"),G=w((0,e.useState)(),2),$=G[0],Q=G[1],X=ce(L),J=R&&Y,Z=w((0,E.useResizeObserver)(),2),ee=Z[0],te=Z[1];p=J||p,(0,e.useLayoutEffect)((function(){if(J)return ge(V.current,"is-without-arrow",p),ge(V.current,"is-alternate",d),ye(V.current,"data-x-axis"),ye(V.current,"data-y-axis"),be(V.current,"top"),be(V.current,"left"),be(z.current,"maxHeight"),void be(z.current,"maxWidth");var e=function(){if(V.current&&z.current){var e=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],o=arguments.length>4?arguments[4]:void 0;if(t)return t;if(n){if(!e.current)return;return n(e.current)}if(!1!==r){if(!(r&&window.Range&&window.Element&&window.DOMRect))return;if(r instanceof window.Range)return(0,_.getRectangleFromRange)(r);if(r instanceof window.Element){var i=r.getBoundingClientRect();return o?i:ve(i,r)}var c=r.top,u=r.bottom,a=c.getBoundingClientRect(),s=u.getBoundingClientRect(),l=new window.DOMRect(a.left,a.top,a.width,s.bottom-a.top);return o?l:ve(l,r)}if(e.current){var f=e.current.parentNode,p=f.getBoundingClientRect();return o?p:ve(p,f)}}(W,C,S,b,g);if(e){var t,n,r=V.current,o=r.offsetParent,i=r.ownerDocument,c=0;if(o&&o!==i.body){var u=o.getBoundingClientRect();c=u.top,e=new window.DOMRect(e.left-u.left,e.top-u.top,e.width,e.height)}x&&(t=null===(n=V.current.closest(".popover-slot"))||void 0===n?void 0:n.parentNode);var a=function(e,t){var n=arguments.length>3?arguments[3]:void 0,r=arguments.length>4?arguments[4]:void 0,o=arguments.length>5?arguments[5]:void 0,i=arguments.length>6?arguments[6]:void 0,c=w((arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top").split(" "),3),u=c[0],a=c[1],s=void 0===a?"center":a,l=c[2],f=N(e,t,u,l,n,r,o);return P(P({},D(e,t,s,l,n,f.yAxis,i)),f)}(e,te.height?te:z.current.getBoundingClientRect(),m,M,V.current,c,t),s=a.popoverTop,l=a.popoverLeft,f=a.xAxis,h=a.yAxis,v=a.contentHeight,y=a.contentWidth;"number"==typeof s&&"number"==typeof l&&(be(V.current,"top",s+"px"),be(V.current,"left",l+"px")),ge(V.current,"is-without-arrow",p||"center"===f&&"middle"===h),ge(V.current,"is-alternate",d),ye(V.current,"data-x-axis",f),ye(V.current,"data-y-axis",h),be(z.current,"maxHeight","number"==typeof v?v+"px":""),be(z.current,"maxWidth","number"==typeof y?y+"px":""),Q(({left:"right",right:"left"}[f]||"center")+" "+({top:"bottom",bottom:"top"}[h]||"middle"))}}};e();var t,n,r=window.setInterval(e,500),o=function(){window.cancelAnimationFrame(t),t=window.requestAnimationFrame(e)};return window.addEventListener("click",o),window.addEventListener("resize",e),window.addEventListener("scroll",e,!0),U&&(n=new window.MutationObserver(e)).observe(U,{attributes:!0}),function(){window.clearInterval(r),window.removeEventListener("resize",e),window.removeEventListener("scroll",e,!0),window.removeEventListener("click",o),window.cancelAnimationFrame(t),n&&n.disconnect()}}),[J,C,S,b,g,m,te,M,U,x]),function(t,n){(0,e.useEffect)((function(){var e=setTimeout((function(){if(t&&n.current)if("firstElement"!==t)"container"===t&&n.current.focus();else{var e=_.focus.tabbable.find(n.current)[0];e?e.focus():n.current.focus()}}),0);return function(){return clearTimeout(e)}}),[])}(y,z);var ne=function(e){e.keyCode===O.ESCAPE&&c&&(e.stopPropagation(),c()),u&&u(e)},re=(0,e.createElement)(H,{onFocusOutside:function(e){if(A)A(e);else if(I){var t;try{t=new window.MouseEvent("click")}catch(e){(t=document.createEvent("MouseEvent")).initMouseEvent("click",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null)}Object.defineProperty(t,"target",{get:function(){return e.relatedTarget}}),a()("Popover onClickOutside prop",{alternative:"onFocusOutside"}),I(t)}else c&&c()}},(0,e.createElement)(de,{type:F&&$?"appear":null,options:{origin:$}},(function(n){var r=n.className;return(0,e.createElement)(q,t({className:i()("components-popover",l,r,{"is-expanded":J,"is-without-arrow":p,"is-alternate":d})},B,{onKeyDown:ne,ref:V}),J&&(0,e.createElement)(K,null),J&&(0,e.createElement)("div",{className:"components-popover__header"},(0,e.createElement)("span",{className:"components-popover__header-title"},o),(0,e.createElement)(ke,{className:"components-popover__close",icon:T,onClick:c})),(0,e.createElement)("div",{ref:z,className:"components-popover__content",tabIndex:"-1"},(0,e.createElement)("div",{style:{position:"relative"}},ee,s)))})));return y&&(re=(0,e.createElement)(he,null,re)),X.ref&&(re=(0,e.createElement)(se,{name:L},re)),b||C?re:(0,e.createElement)("span",{ref:W},re)};we.Slot=function(t){var n=t.name,r=void 0===n?me:n;return(0,e.createElement)(ae,{bubblesVirtually:!0,name:r,className:"popover-slot"})};var _e=we,Oe=function(t){var n,r,o=t.shortcut,i=t.className;return o?((0,c.isString)(o)&&(n=o),(0,c.isObject)(o)&&(n=o.display,r=o.ariaLabel),(0,e.createElement)("span",{className:i,"aria-label":r},n)):null};var Ee=function(t){d(i,t);var n,r,o=(n=i,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=y(n);if(r){var o=y(this).constructor;e=Reflect.construct(t,arguments,o)}else e=t.apply(this,arguments);return v(this,e)});function i(){var e;return s(this,i),(e=o.apply(this,arguments)).delayedSetIsOver=(0,c.debounce)((function(t){return e.setState({isOver:t})}),700),e.cancelIsMouseDown=e.createSetIsMouseDown(!1),e.isInMouseDown=!1,e.state={isOver:!1},e}return f(i,[{key:"componentWillUnmount",value:function(){this.delayedSetIsOver.cancel(),document.removeEventListener("mouseup",this.cancelIsMouseDown)}},{key:"emitToChild",value:function(t,n){var r=this.props.children;if(1===e.Children.count(r)){var o=e.Children.only(r);"function"==typeof o.props[t]&&o.props[t](n)}}},{key:"createToggleIsOver",value:function(e,t){var n=this;return function(r){if(n.emitToChild(e,r),!(r.currentTarget.disabled||"focus"===r.type&&n.isInMouseDown)){n.delayedSetIsOver.cancel();var o=(0,c.includes)(["focus","mouseenter"],r.type);o!==n.state.isOver&&(t?n.delayedSetIsOver(o):n.setState({isOver:o}))}}}},{key:"createSetIsMouseDown",value:function(e){var t=this;return function(n){t.emitToChild(e?"onMouseDown":"onMouseUp",n),document[e?"addEventListener":"removeEventListener"]("mouseup",t.cancelIsMouseDown),t.isInMouseDown=e}}},{key:"render",value:function(){var t=this.props,n=t.children,r=t.position,o=t.text,i=t.shortcut;if(1!==e.Children.count(n))return n;var c=e.Children.only(n),u=this.state.isOver;return(0,e.cloneElement)(c,{onMouseEnter:this.createToggleIsOver("onMouseEnter",!0),onMouseLeave:this.createToggleIsOver("onMouseLeave"),onClick:this.createToggleIsOver("onClick"),onFocus:this.createToggleIsOver("onFocus"),onBlur:this.createToggleIsOver("onBlur"),onMouseDown:this.createSetIsMouseDown(!0),children:(0,e.concatChildren)(c.props.children,u&&(0,e.createElement)(_e,{focusOnMount:!1,position:r,className:"components-tooltip","aria-hidden":"true",animate:!1,noArrow:!0},o,(0,e.createElement)(Oe,{className:"components-tooltip__shortcut",shortcut:i})))})}}]),i}(e.Component),Ce=Ee,Te=function(n){var o=n.icon,i=n.className,c=r(n,["icon","className"]),u=["dashicon","dashicons","dashicons-"+o,i].filter(Boolean).join(" ");return(0,e.createElement)("span",t({className:u},c))};function Se(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Re(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Se(Object(n),!0).forEach((function(t){S(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Se(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var Pe=function(n){var o=n.icon,i=void 0===o?null:o,c=n.size,u=r(n,["icon","size"]);if("string"==typeof i)return(0,e.createElement)(Te,t({icon:i},u));if(i&&Te===i.type)return(0,e.cloneElement)(i,Re({},u));var a=c||24;if("function"==typeof i)return i.prototype instanceof e.Component?(0,e.createElement)(i,Re({size:a},u)):i(Re({size:a},u));if(i&&("svg"===i.type||i.type===C.SVG)){var s=Re(Re({width:a,height:a},i.props),u);return(0,e.createElement)(C.SVG,s)}return(0,e.isValidElement)(i)?(0,e.cloneElement)(i,Re({size:a},u)):i};function De(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Ne=["onMouseDown","onClick"],ke=(0,e.forwardRef)((function(n,o){var u=n.href,s=n.target,l=n.isPrimary,f=n.isSmall,p=n.isTertiary,d=n.isPressed,h=n.isBusy,m=n.isDefault,v=n.isSecondary,y=n.isLink,b=n.isDestructive,g=n.className,w=n.disabled,_=n.icon,O=n.iconSize,E=n.showTooltip,C=n.tooltipPosition,T=n.shortcut,S=n.label,R=n.children,P=n.__experimentalIsFocusable,D=r(n,["href","target","isPrimary","isSmall","isTertiary","isPressed","isBusy","isDefault","isSecondary","isLink","isDestructive","className","disabled","icon","iconSize","showTooltip","tooltipPosition","shortcut","label","children","__experimentalIsFocusable"]);m&&a()("Button isDefault prop",{alternative:"isSecondary"});var N=i()("components-button",g,{"is-secondary":m||v,"is-primary":l,"is-small":f,"is-tertiary":p,"is-pressed":d,"is-busy":h,"is-link":y,"is-destructive":b,"has-text":!!_&&!!R,"has-icon":!!_}),k=w&&!P,F=void 0===u||k?"button":"a",I="a"===F?{href:u,target:s}:{type:"button",disabled:k,"aria-pressed":d};if(w&&P){I["aria-disabled"]=!0;var A,M=function(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return De(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?De(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,c=!0,u=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return c=e.done,e},e:function(e){u=!0,i=e},f:function(){try{c||null==n.return||n.return()}finally{if(u)throw i}}}}(Ne);try{for(M.s();!(A=M.n()).done;)D[A.value]=function(e){e.stopPropagation(),e.preventDefault()}}catch(e){M.e(e)}finally{M.f()}}var j=!k&&(E&&S||T||!!S&&(!R||(0,c.isArray)(R)&&!R.length)&&!1!==E),L=(0,e.createElement)(F,t({},I,D,{className:N,"aria-label":D["aria-label"]||S,ref:o}),_&&(0,e.createElement)(Pe,{icon:_,size:O}),R);return j?(0,e.createElement)(Ce,{text:S,shortcut:T,position:C},L):L}));var Fe=function(t){d(c,t);var n,r,o=(n=c,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=y(n);if(r){var o=y(this).constructor;e=Reflect.construct(t,arguments,o)}else e=t.apply(this,arguments);return v(this,e)});function c(){var t;return s(this,c),(t=o.apply(this,arguments)).containerRef=(0,e.createRef)(),t.handleKeyDown=t.handleKeyDown.bind(m(t)),t.handleFocusOutside=t.handleFocusOutside.bind(m(t)),t}return f(c,[{key:"componentDidMount",value:function(){this.props.focusOnMount&&this.containerRef.current.focus()}},{key:"handleFocusOutside",value:function(e){this.props.shouldCloseOnClickOutside&&this.onRequestClose(e)}},{key:"handleKeyDown",value:function(e){e.keyCode===O.ESCAPE&&this.handleEscapeKeyDown(e)}},{key:"handleEscapeKeyDown",value:function(e){this.props.shouldCloseOnEsc&&(e.stopPropagation(),this.onRequestClose(e))}},{key:"onRequestClose",value:function(e){var t=this.props.onRequestClose;t&&t(e)}},{key:"render",value:function(){var t=this.props,n=t.overlayClassName,r=t.contentLabel,o=t.aria,c=o.describedby,u=o.labelledby,a=t.children,s=t.className,l=t.role,f=t.style;return(0,e.createElement)(q,{className:i()("components-modal__screen-overlay",n),onKeyDown:this.handleKeyDown},(0,e.createElement)("div",{className:i()("components-modal__frame",s),style:f,ref:this.containerRef,role:l,"aria-label":r,"aria-labelledby":r?null:u,"aria-describedby":c,tabIndex:"-1"},a))}}]),c}(e.Component),Ie=(0,E.compose)([M,L,x])(Fe),Ae=window.wp.i18n,Me=function(t){var n=t.icon,r=t.title,o=t.onClose,i=t.closeLabel,c=t.headingId,u=t.isDismissible,a=i||(0,Ae.__)("Close dialog");return(0,e.createElement)("div",{className:"components-modal__header"},(0,e.createElement)("div",{className:"components-modal__header-heading-container"},n&&(0,e.createElement)("span",{className:"components-modal__icon-container","aria-hidden":!0},n),r&&(0,e.createElement)("h1",{id:c,className:"components-modal__header-heading"},r)),u&&(0,e.createElement)(ke,{onClick:o,icon:T,label:a}))},je=new Set(["alert","status","log","marquee","timer"]),Le=[],Ue=!1;var xe,Be=0,He=function(n){d(l,n);var o,i,u=(o=l,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=y(o);if(i){var n=y(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return v(this,e)});function l(e){var t;return s(this,l),(t=u.call(this,e)).prepareDOM(),t}return f(l,[{key:"componentDidMount",value:function(){1==++Be&&this.openFirstModal()}},{key:"componentWillUnmount",value:function(){0==--Be&&this.closeLastModal(),this.cleanDOM()}},{key:"prepareDOM",value:function(){xe||(xe=document.createElement("div"),document.body.appendChild(xe)),this.node=document.createElement("div"),xe.appendChild(this.node)}},{key:"cleanDOM",value:function(){xe.removeChild(this.node)}},{key:"openFirstModal",value:function(){(function(e){if(!Ue){var t=document.body.children;(0,c.forEach)(t,(function(t){t!==e&&function(e){var t=e.getAttribute("role");return!("SCRIPT"===e.tagName||e.hasAttribute("aria-hidden")||e.hasAttribute("aria-live")||je.has(t))}(t)&&(t.setAttribute("aria-hidden","true"),Le.push(t))})),Ue=!0}})(xe),document.body.classList.add(this.props.bodyOpenClassName)}},{key:"closeLastModal",value:function(){document.body.classList.remove(this.props.bodyOpenClassName),Ue&&((0,c.forEach)(Le,(function(e){e.removeAttribute("aria-hidden")})),Le=[],Ue=!1)}},{key:"render",value:function(){var n=this.props,o=n.onRequestClose,i=n.title,c=n.icon,u=n.closeButtonLabel,s=n.children,l=n.aria,f=n.instanceId,p=n.isDismissible,d=n.isDismissable,h=r(n,["onRequestClose","title","icon","closeButtonLabel","children","aria","instanceId","isDismissible","isDismissable"]),m=l.labelledby||"components-modal-header-".concat(f);return d&&a()("isDismissable prop of the Modal component",{alternative:"isDismissible prop (renamed) of the Modal component"}),(0,e.createPortal)((0,e.createElement)(Ie,t({onRequestClose:o,aria:{labelledby:i?m:null,describedby:l.describedby}},h),(0,e.createElement)("div",{className:"components-modal__content",role:"document"},(0,e.createElement)(Me,{closeLabel:u,headingId:m,icon:c,isDismissible:p||d,onClose:o,title:i}),s)),this.node)}}]),l}(e.Component);He.defaultProps={bodyOpenClassName:"modal-open",role:"dialog",title:null,focusOnMount:!0,shouldCloseOnEsc:!0,shouldCloseOnClickOutside:!0,isDismissible:!0,aria:{labelledby:null,describedby:null}};var We=(0,E.withInstanceId)(He),Ke=window.wp.plugins,ze=window.wp.url,qe=window.wp.domReady,Ve=n.n(qe);var Ye=function(e,t){Ve()((()=>{var n,r,o;(null!==(n=null===(r=window.wc)||void 0===r||null===(o=r.tracks)||void 0===o?void 0:o.recordEvent)&&void 0!==n?n:window.wcTracks.recordEvent)(e,t)}))},Ge={CONNECT_ACCOUNT_CLICKED:"wcpay_connect_account_clicked",CONNECT_ACCOUNT_VIEW:"page_view",CONNECT_ACCOUNT_LEARN_MORE:"wcpay_welcome_learn_more",CONNECT_ACCOUNT_STRIPE_CONNECTED:"wcpay_stripe_connected",CONNECT_ACCOUNT_KYC_MODAL_OPENED:"wcpay_connect_account_kyc_modal_opened",UPE_ENABLED:"wcpay_upe_enabled",UPE_DISABLED:"wcpay_upe_disabled",MULTI_CURRENCY_ENABLED_CURRENCIES_UPDATED:"wcpay_multi_currency_enabled_currencies_updated",PAYMENT_REQUEST_SETTINGS_CHANGE:"wcpay_payment_request_settings_change",SUBSCRIPTIONS_EMPTY_STATE_VIEW:"wcpay_subscriptions_empty_state_view",SUBSCRIPTIONS_EMPTY_STATE_FINISH_SETUP:"wcpay_subscriptions_empty_state_finish_setup",SUBSCRIPTIONS_EMPTY_STATE_CREATE_PRODUCT:"wcpay_subscriptions_empty_state_create_product",SUBSCRIPTIONS_ACCOUNT_NOT_CONNECTED_PRODUCT_MODAL_VIEW:"wcpay_subscriptions_account_not_connected_product_modal_view",SUBSCRIPTIONS_ACCOUNT_NOT_CONNECTED_PRODUCT_MODAL_FINISH_SETUP:"wcpay_subscriptions_account_not_connected_product_modal_finish_setup",SUBSCRIPTIONS_ACCOUNT_NOT_CONNECTED_PRODUCT_MODAL_DISMISS:"wcpay_subscriptions_account_not_connected_product_modal_dismiss",PLATFORM_CHECKOUT_OFFERED:"platform_checkout_offered",PLATFORM_CHECKOUT_OTP_START:"platform_checkout_otp_prompt_start",PLATFORM_CHECKOUT_OTP_COMPLETE:"platform_checkout_otp_prompt_complete",PLATFORM_CHECKOUT_OTP_FAILED:"platform_checkout_otp_prompt_failed",PLATFORM_CHECKOUT_AUTO_REDIRECT:"platform_checkout_auto_redirect",PLATFORM_CHECKOUT_SKIPPED:"platform_checkout_skipped",PLATFORM_CHECKOUT_EXPRESS_BUTTON_OFFERED:"platform_checkout_express_button_offered",PLATFORM_CHECKOUT_EXPRESS_BUTTON_CLICKED:"platform_checkout_express_button_clicked"};const{connectUrl:$e,pluginScope:Qe}=window.wcpaySubscriptionProductOnboardingModal,Xe=()=>{const[t,n]=(0,e.useState)(!1);return(0,e.createElement)(ke,{disabled:t,href:$e,isBusy:t,isPrimary:!0,onClick:()=>{Ye(Ge.SUBSCRIPTIONS_ACCOUNT_NOT_CONNECTED_PRODUCT_MODAL_FINISH_SETUP),n(!0)}},(0,Ae.__)("Finish setup","woocommerce-payments"))},Je=t=>{let{onRequestClose:n=(()=>{})}=t;return(0,e.useEffect)((()=>{Ye(Ge.SUBSCRIPTIONS_ACCOUNT_NOT_CONNECTED_PRODUCT_MODAL_VIEW)}),[]),(0,e.createElement)(We,{className:"wcpay-subscription-product-modal",onRequestClose:()=>{Ye(Ge.SUBSCRIPTIONS_ACCOUNT_NOT_CONNECTED_PRODUCT_MODAL_DISMISS),n()},shouldCloseOnClickOutside:!1},(0,e.createElement)("p",{className:"wcpay-subscription-product-modal__title"},(0,Ae.__)("One more step to accept recurring payments","woocommerce-payments")),(0,e.createElement)("p",null,(0,Ae.__)("Verify your business details with WooCommerce Payments to accept recurring payments for this subscription product.","woocommerce-payments")),(0,e.createElement)("p",{className:"wcpay-subscription-product-modal__tos"},(0,e.createInterpolateElement)((0,Ae.__)('By clicking "Finish setup", you agree to the <a>Terms of Service</a>',"woocommerce-payments"),{a:(0,e.createElement)("a",{href:"https://wordpress.com/tos/",target:"_blank",rel:"noreferrer"})})),(0,e.createElement)("div",{className:"wcpay-subscription-product-modal__footer"},(0,e.createElement)("div",{className:"wcpay-subscription-product-modal__saved-indicator"},(0,e.createElement)(Pe,{icon:"saved"}),(0,e.createElement)("p",null,(0,Ae.__)("We’ve saved your product as a draft.","woocommerce-payments"))),(0,e.createElement)(Xe,null)))};(0,Ke.registerPlugin)("wcpay-subscription-product-onboarding-modal",{icon:null,render:()=>{const[t,n]=(0,e.useState)(!0);return(0,e.useEffect)((()=>{var e;null!==(e=window)&&void 0!==e&&e.history&&window.history.replaceState(null,null,(0,ze.removeQueryArgs)(window.location.href,"wcpay-subscription-saved-as-draft"))}),[]),t?(0,e.createElement)(Je,{onRequestClose:()=>{n(!1)}}):null},scope:Qe})}()}();