File: /home/wwwrenee/public_html/wp-content/plugins/woocommerce-payments/dist/tos.js
/*! For license information please see tos.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 a in n)r.call(n,a)&&n[a]&&e.push(a);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)}()},139:function(e){"use strict";function t(e){return function(){return e}}var n=function(){};n.thatReturns=t,n.thatReturnsFalse=t(!1),n.thatReturnsTrue=t(!0),n.thatReturnsNull=t(null),n.thatReturnsThis=function(){return this},n.thatReturnsArgument=function(e){return e},e.exports=n},3759:function(e){"use strict";e.exports=function(e,t,n,r,o,i,c,a){if(!e){var s;if(void 0===t)s=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var u=[n,r,o,i,c,a],l=0;(s=new Error(t.replace(/%s/g,(function(){return u[l++]})))).name="Invariant Violation"}throw s.framesToPop=1,s}}},3620:function(e,t,n){"use strict";var r=n(139);e.exports=r},6746:function(e,t,n){"use strict";var r="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},o=a(n(9196)),i=a(n(9156)),c=a(n(6743));function a(e){return e&&e.__esModule?e:{default:e}}var s=void 0;function u(e,t){var n,c,a,l,f,p,d,m,h=[],y={};for(p=0;p<e.length;p++)if("string"!==(f=e[p]).type){if(!t.hasOwnProperty(f.value)||void 0===t[f.value])throw new Error("Invalid interpolation, missing component node: `"+f.value+"`");if("object"!==r(t[f.value]))throw new Error("Invalid interpolation, component node must be a ReactElement or null: `"+f.value+"`","\n> "+s);if("componentClose"===f.type)throw new Error("Missing opening component token: `"+f.value+"`");if("componentOpen"===f.type){n=t[f.value],a=p;break}h.push(t[f.value])}else h.push(f.value);return n&&(l=function(e,t){var n,r,o=t[e],i=0;for(r=e+1;r<t.length;r++)if((n=t[r]).value===o.value){if("componentOpen"===n.type){i++;continue}if("componentClose"===n.type){if(0===i)return r;i--}}throw new Error("Missing closing component token `"+o.value+"`")}(a,e),d=u(e.slice(a+1,l),t),c=o.default.cloneElement(n,{},d),h.push(c),l<e.length-1&&(m=u(e.slice(l+1),t),h=h.concat(m))),1===h.length?h[0]:(h.forEach((function(e,t){e&&(y["interpolation-child-"+t]=e)})),(0,i.default)(y))}t.Z=function(e){var t=e.mixedString,n=e.components,o=e.throwErrors;if(s=t,!n)return t;if("object"!==(void 0===n?"undefined":r(n))){if(o)throw new Error("Interpolation Error: unable to process `"+t+"` because components is not an object");return t}var i=(0,c.default)(t);try{return u(i,n)}catch(e){if(o)throw new Error("Interpolation Error: unable to process `"+t+"` because of error `"+e.message+"`");return t}}},6743:function(e){"use strict";function t(e){return e.match(/^\{\{\//)?{type:"componentClose",value:e.replace(/\W/g,"")}:e.match(/\/\}\}$/)?{type:"componentSelfClosing",value:e.replace(/\W/g,"")}:e.match(/^\{\{/)?{type:"componentOpen",value:e.replace(/\W/g,"")}:{type:"string",value:e}}e.exports=function(e){return e.split(/(\{\{\/?\s*\w+\s*\/?\}\})/g).map(t)}},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 a,s=[],u=!1,l=-1;function f(){u&&a&&(u=!1,a.length?s=a.concat(s):l=-1,s.length&&p())}function p(){if(!u){var e=c(f);u=!0;for(var t=s.length;t;){for(a=s,s=[];++l<t;)a&&a[l].run();l=-1,t=s.length}a=null,u=!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 m(){}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];s.push(new d(e,t)),1!==s.length||u||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=m,r.addListener=m,r.once=m,r.off=m,r.removeListener=m,r.removeAllListeners=m,r.emit=m,r.prependListener=m,r.prependOnceListener=m,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}},9156:function(e,t,n){"use strict";var r=n(9196),o="function"==typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,i=n(139),c=n(3759),a=n(3620),s="function"==typeof Symbol&&Symbol.iterator;function u(e,t){return e&&"object"==typeof e&&null!=e.key?(n=e.key,r={"=":"=0",":":"=2"},"$"+(""+n).replace(/[=:]/g,(function(e){return r[e]}))):t.toString(36);var n,r}function l(e,t,n,r){var i,a=typeof e;if("undefined"!==a&&"boolean"!==a||(e=null),null===e||"string"===a||"number"===a||"object"===a&&e.$$typeof===o)return n(r,e,""===t?"."+u(e,0):t),1;var f=0,p=""===t?".":t+":";if(Array.isArray(e))for(var d=0;d<e.length;d++)f+=l(i=e[d],p+u(i,d),n,r);else{var m=function(e){var t=e&&(s&&e[s]||e["@@iterator"]);if("function"==typeof t)return t}(e);if(m)for(var h,y=m.call(e),v=0;!(h=y.next()).done;)f+=l(i=h.value,p+u(i,v++),n,r);else if("object"===a){var b=""+e;c(!1,"Objects are not valid as a React child (found: %s).%s","[object Object]"===b?"object with keys {"+Object.keys(e).join(", ")+"}":b,"")}}return f}var f=/\/+/g;function p(e){return(""+e).replace(f,"$&/")}var d,m,h=y,y=function(e){var t=this;if(t.instancePool.length){var n=t.instancePool.pop();return t.call(n,e),n}return new t(e)};function v(e,t,n,r){this.result=e,this.keyPrefix=t,this.func=n,this.context=r,this.count=0}function b(e,t,n){var o,c,a=e.result,s=e.keyPrefix,u=e.func,l=e.context,f=u.call(l,t,e.count++);Array.isArray(f)?w(f,a,n,i.thatReturnsArgument):null!=f&&(r.isValidElement(f)&&(o=f,c=s+(!f.key||t&&t.key===f.key?"":p(f.key)+"/")+n,f=r.cloneElement(o,{key:c},void 0!==o.props?o.props.children:void 0)),a.push(f))}function w(e,t,n,r,o){var i="";null!=n&&(i=p(n)+"/");var c=v.getPooled(t,i,r,o);!function(e,t,n){null==e||l(e,"",t,n)}(e,b,c),v.release(c)}v.prototype.destructor=function(){this.result=null,this.keyPrefix=null,this.func=null,this.context=null,this.count=0},d=function(e,t,n,r){var o=this;if(o.instancePool.length){var i=o.instancePool.pop();return o.call(i,e,t,n,r),i}return new o(e,t,n,r)},(m=v).instancePool=[],m.getPooled=d||h,m.poolSize||(m.poolSize=10),m.release=function(e){var t=this;c(e instanceof t,"Trying to release an instance into a pool of a different type."),e.destructor(),t.instancePool.length<t.poolSize&&t.instancePool.push(e)},e.exports=function(e){if("object"!=typeof e||!e||Array.isArray(e))return a(!1,"React.addons.createFragment only accepts a single object. Got: %s",e),e;if(r.isValidElement(e))return a(!1,"React.addons.createFragment does not accept a ReactElement without a wrapper object."),e;c(1!==e.nodeType,"React.addons.createFragment(...): Encountered an invalid child; DOM elements are not valid children of React components.");var t=[];for(var n in e)w(e[n],t,n,i.thatReturnsArgument);return t}},9196:function(e){"use strict";e.exports=window.React}},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,t=(n(9196),window.ReactDOM),r=n.n(t);function o(){return o=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},o.apply(this,arguments)}var i=window.wp.i18n,c=n(6746);function a(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}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(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 l(e,t,n){return t&&u(e.prototype,t),n&&u(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function f(e,t){return f=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},f(e,t)}function p(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&&f(e,t)}function d(e){return d="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},d(e)}function m(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function h(e,t){if(t&&("object"===d(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)}var v=window.wp.compose,b=window.wp.deprecated,w=n.n(b),g=n(4184),_=n.n(g),E=window.wp.keycodes;function O(e){e.stopPropagation()}var C=(0,e.forwardRef)((function(t,n){var r=t.children,i=a(t,["children"]);return(0,e.createElement)("div",o({},i,{ref:n,onMouseDown:O}),r)})),S=window.lodash;var T=["button","submit"],P=(0,v.createHigherOrderComponent)((function(t){return function(n){p(a,n);var r,i,c=(r=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(r);if(i){var n=y(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return h(this,e)});function a(){var e;return s(this,a),(e=c.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 l(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,S.includes)(["mouseup","touchend"],t)?this.preventBlurCheck=!1:function(e){switch(e.nodeName){case"A":case"BUTTON":return!0;case"INPUT":return(0,S.includes)(T,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)(t,o({ref:this.bindNode},this.props)))}}]),a}(e.Component)}),"withFocusOutside");function R(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 k(e,t){if(e){if("string"==typeof e)return R(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)?R(e,t):void 0}}function D(e){return function(e){if(Array.isArray(e))return R(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||k(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 N=(0,e.createContext)({focusHistory:[]}),A=N.Provider,F=N.Consumer;A.displayName="FocusReturnProvider",F.displayName="FocusReturnConsumer",e.Component;var j=(0,v.createHigherOrderComponent)((function t(n){if((o=n)instanceof e.Component||"function"==typeof o){var r=n;return t({})(r)}var o,i=n.onFocusReturn,c=void 0===i?S.stubTrue:i;return function(t){var n=function(n){p(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 h(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 l(a,[{key:"componentWillUnmount",value:function(){var e=this.activeElementOnMount,t=this.isFocused,n=this.ownFocusedElements;if(t&&!1!==c())for(var r,o=[].concat(D(S.without.apply(void 0,[this.props.focus.focusHistory].concat(D(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)(F,null,(function(r){return(0,e.createElement)(n,{childProps:t,focus:r})}))}}}),"withFocusReturn"),I=window.wp.dom;var M=(0,v.createHigherOrderComponent)((function(t){return function(n){p(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 h(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 l(c,[{key:"handleTabBehaviour",value:function(e){if(e.keyCode===E.TAB){var t=I.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"),x=M;var L=function(t){p(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 h(this,e)});function i(){var t;return s(this,i),(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 l(i,[{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===E.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,i=o.describedby,c=o.labelledby,a=t.children,s=t.className,u=t.role,l=t.style;return(0,e.createElement)(C,{className:_()("components-modal__screen-overlay",n),onKeyDown:this.handleKeyDown},(0,e.createElement)("div",{className:_()("components-modal__frame",s),style:l,ref:this.containerRef,role:u,"aria-label":r,"aria-labelledby":r?null:c,"aria-describedby":i,tabIndex:"-1"},a))}}]),i}(e.Component),B=(0,v.compose)([j,x,P])(L),U=window.wp.primitives,H=(0,e.createElement)(U.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,e.createElement)(U.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 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,a=!1;try{for(n=n.call(e);!(c=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);c=!0);}catch(e){a=!0,o=e}finally{try{c||null==n.return||n.return()}finally{if(a)throw o}}return i}}(e,t)||k(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.")}()}function K(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function z(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 q(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?z(Object(n),!0).forEach((function(t){K(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):z(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function V(e,t,n,r,o,i,c){var a=t.width,s="rtl"===document.documentElement.dir;"left"===n&&s?n="right":"right"===n&&s&&(n="left"),"left"===r&&s?r="right":"right"===r&&s&&(r="left");var u=Math.round(e.left+e.width/2),l={popoverLeft:u,contentWidth:(u-a/2>0?a/2:u)+(u+a/2>window.innerWidth?window.innerWidth-u:a/2)},f=e.left;"right"===r?f=e.right:"middle"!==i&&(f=u);var p=e.right;"left"===r?p=e.left:"middle"!==i&&(p=u);var d,m={popoverLeft:f,contentWidth:f-a>0?a:f},h={popoverLeft:p,contentWidth:p+a>window.innerWidth?window.innerWidth-p:a},y=n,v=null;if(!o)if("center"===n&&l.contentWidth===a)y="center";else if("left"===n&&m.contentWidth===a)y="left";else if("right"===n&&h.contentWidth===a)y="right";else{var b="left"==(y=m.contentWidth>h.contentWidth?"left":"right")?m.contentWidth:h.contentWidth;v=b!==a?b:null}if(d="center"===y?l.popoverLeft:"left"===y?m.popoverLeft:h.popoverLeft,c){var w=c.getBoundingClientRect();d=Math.min(d,w.right-a)}return{xAxis:y,popoverLeft:d,contentWidth:v}}function $(e,t,n,r,o,i,c){var a=t.height;if(o){var s=((0,I.getScrollContainer)(i)||document.body).getBoundingClientRect().top+a-c;if(e.top<=s)return{yAxis:n,popoverTop:Math.min(e.bottom,s)}}var u=e.top+e.height/2;"bottom"===r?u=e.bottom:"top"===r&&(u=e.top);var l={popoverTop:u,contentHeight:(u-a/2>0?a/2:u)+(u+a/2>window.innerHeight?window.innerHeight-u:a/2)},f={popoverTop:e.top,contentHeight:e.top-10-a>0?a:e.top-10},p={popoverTop:e.bottom,contentHeight:e.bottom+10+a>window.innerHeight?window.innerHeight-10-e.bottom:a},d=n,m=null;if(!o)if("middle"===n&&l.contentHeight===a)d="middle";else if("top"===n&&f.contentHeight===a)d="top";else if("bottom"===n&&p.contentHeight===a)d="bottom";else{var h="top"==(d=f.contentHeight>p.contentHeight?"top":"bottom")?f.contentHeight:p.contentHeight;m=h!==a?h:null}return{yAxis:d,popoverTop:"middle"===d?l.popoverTop:"top"===d?f.popoverTop:p.popoverTop,contentHeight:m}}var Y=function(e){p(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 h(this,e)});function o(){return s(this,o),r.apply(this,arguments)}return l(o,[{key:"handleFocusOutside",value:function(e){this.props.onFocusOutside(e)}},{key:"render",value:function(){return this.props.children}}]),o}(e.Component),G=P(Y);function Q(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 h(this,n)}}var Z=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,a=0;function u(e){var t=r.scrollingElement||r.body;e&&(a=t.scrollTop);var n=e?"add":"remove";t.classList[n](i),r.documentElement.classList[n](i),e||(t.scrollTop=a)}function f(){0===c&&u(!0),++c}function d(){1===c&&u(!1),--c}return function(e){p(n,e);var t=Q(n);function n(){return s(this,n),t.apply(this,arguments)}return l(n,[{key:"componentDidMount",value:function(){f()}},{key:"componentWillUnmount",value:function(){d()}},{key:"render",value:function(){return null}}]),n}(e.Component)}();function X(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=y(e)););return e}function J(){return J="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=X(e,t);if(r){var o=Object.getOwnPropertyDescriptor(r,t);return o.get?o.get.call(arguments.length<3?e:n):o.value}},J.apply(this,arguments)}window.wp.isShallowEqual;var ee=(window.wp.warning,n(4155)),te=(0,e.createContext)({slots:{},fills:{},registerSlot:function(){void 0!==ee&&ee.env},updateSlot:function(){},unregisterSlot:function(){},registerFill:function(){},unregisterFill:function(){}});var ne=(0,e.createContext)({registerSlot:function(){},unregisterSlot:function(){},registerFill:function(){},unregisterFill:function(){},getSlot:function(){},getFills:function(){},subscribe:function(){}}),re=(ne.Provider,ne.Consumer);e.Component;var oe=function(t){p(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 h(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 l(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||J(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,c=t.getFills,a=(0,S.map)(c(r,this),(function(t){var n=t.occurrence,r=(0,S.isFunction)(t.children)?t.children(i):t.children;return e.Children.map(r,(function(t,r){if(!t||(0,S.isString)(t))return t;var o="".concat(n,"---").concat(t.key||r);return(0,e.cloneElement)(t,{key:o})}))})).filter((0,S.negate)(e.isEmptyElement));return(0,e.createElement)(e.Fragment,null,(0,S.isFunction)(n)?n(a):a)}}]),i}(e.Component),ie=function(t){return(0,e.createElement)(re,null,(function(n){var r=n.registerSlot,i=n.unregisterSlot,c=n.getFills;return(0,e.createElement)(oe,o({},t,{registerSlot:r,unregisterSlot:i,getFills:c}))}))},ce=0;function ae(t){var n=t.name,r=t.children,o=t.registerFill,i=t.unregisterFill,c=function(t){var n=(0,e.useContext)(ne),r=n.getSlot,o=n.subscribe,i=W((0,e.useState)(r(t)),2),c=i[0],a=i[1];return(0,e.useEffect)((function(){return a(r(t)),o((function(){a(r(t))}))}),[t]),c}(n),a=(0,e.useRef)({name:n,children:r});return a.current.occurrence||(a.current.occurrence=++ce),(0,e.useLayoutEffect)((function(){return o(n,a.current),function(){return i(n,a.current)}}),[]),(0,e.useLayoutEffect)((function(){a.current.children=r,c&&c.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]),c&&c.node?((0,S.isFunction)(r)&&(r=r(c.props.fillProps)),(0,e.createPortal)(r,c.node)):null}var se=function(t){return(0,e.createElement)(re,null,(function(n){var r=n.registerFill,i=n.unregisterFill;return(0,e.createElement)(ae,o({},t,{registerFill:r,unregisterFill:i}))}))};function ue(t){var n=t.name,r=t.fillProps,i=void 0===r?{}:r,c=t.as,s=void 0===c?"div":c,u=a(t,["name","fillProps","as"]),l=(0,e.useContext)(te),f=(0,e.useRef)();return(0,e.useLayoutEffect)((function(){return l.registerSlot(n,f,i),function(){l.unregisterSlot(n,f)}}),[l.registerSlot,l.unregisterSlot,n]),(0,e.useLayoutEffect)((function(){l.updateSlot(n,i)})),(0,e.createElement)(s,o({ref:f},u))}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){K(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(t){var n=(0,e.useContext)(te),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]),a=(0,e.useCallback)((function(e){n.unregisterSlot(t,e)}),[t,n.unregisterSlot]),s=(0,e.useCallback)((function(e){n.registerFill(t,e)}),[t,n.registerFill]),u=(0,e.useCallback)((function(e){n.unregisterFill(t,e)}),[t,n.unregisterFill]);return fe(fe({},r),{},{updateSlot:c,unregisterSlot:a,fills:i,registerFill:s,unregisterFill:u})}function de(t){var n,r=t.name,o=t.children,i=pe(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 me(t){var n=t.bubblesVirtually,r=a(t,["bubblesVirtually"]);return n?(0,e.createElement)(ue,r):(0,e.createElement)(ie,r)}function he(t){return(0,e.createElement)(e.Fragment,null,(0,e.createElement)(se,t),(0,e.createElement)(de,t))}function ye(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 ve(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ye(Object(n),!0).forEach((function(t){K(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ye(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function be(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,i=W(r.split(" "),2),c=i[0],a=i[1],s=void 0===a?"center":a;return _()("components-animate__appear",(K(o={},"is-from-"+s,"center"!==s),K(o,"is-from-"+c,"middle"!==c),o))}return"slide-in"===t?_()("components-animate__slide-in","is-from-"+r):"loading"===t?_()("components-animate__loading"):void 0}function we(e){var t=e.type,n=e.options,r=void 0===n?{}:n;return(0,e.children)({className:be(ve({type:t},r))})}var ge=x(j((function(e){return e.children}))),_e="Popover";function Ee(e,t){var n,r=(n=t).ownerDocument.defaultView.getComputedStyle(n),o=r.paddingTop,i=r.paddingBottom,c=r.paddingLeft,a=r.paddingRight,s=o?parseInt(o,10):0,u=i?parseInt(i,10):0,l=c?parseInt(c,10):0,f=a?parseInt(a,10):0;return{x:e.left+l,y:e.top+s,width:e.width-l-f,height:e.height-s-u,left:e.left+l,right:e.right-f,top:e.top+s,bottom:e.bottom-u}}function Oe(e,t,n){n?e.getAttribute(t)!==n&&e.setAttribute(t,n):e.hasAttribute(t)&&e.removeAttribute(t)}function Ce(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";e.style[t]!==n&&(e.style[t]=n)}function Se(e,t,n){n?e.classList.contains(t)||e.classList.add(t):e.classList.contains(t)&&e.classList.remove(t)}var Te=function(t){var n=t.headerTitle,r=t.onClose,i=t.onKeyDown,c=t.children,s=t.className,u=t.noArrow,l=void 0===u||u,f=t.isAlternate,p=t.position,d=void 0===p?"bottom right":p,m=(t.range,t.focusOnMount),h=void 0===m?"firstElement":m,y=t.anchorRef,b=t.shouldAnchorIncludePadding,g=t.anchorRect,O=t.getAnchorRect,S=t.expandOnMobile,T=t.animate,P=void 0===T||T,R=t.onClickOutside,k=t.onFocusOutside,D=t.__unstableSticky,N=t.__unstableSlotName,A=void 0===N?_e:N,F=t.__unstableObserveElement,j=t.__unstableBoundaryParent,M=a(t,["headerTitle","onClose","onKeyDown","children","className","noArrow","isAlternate","position","range","focusOnMount","anchorRef","shouldAnchorIncludePadding","anchorRect","getAnchorRect","expandOnMobile","animate","onClickOutside","onFocusOutside","__unstableSticky","__unstableSlotName","__unstableObserveElement","__unstableBoundaryParent"]),x=(0,e.useRef)(null),L=(0,e.useRef)(null),B=(0,e.useRef)(),U=(0,v.useViewportMatch)("medium","<"),K=W((0,e.useState)(),2),z=K[0],Y=K[1],Q=pe(A),X=S&&U,J=W((0,v.useResizeObserver)(),2),ee=J[0],te=J[1];l=X||l,(0,e.useLayoutEffect)((function(){if(X)return Se(B.current,"is-without-arrow",l),Se(B.current,"is-alternate",f),Oe(B.current,"data-x-axis"),Oe(B.current,"data-y-axis"),Ce(B.current,"top"),Ce(B.current,"left"),Ce(L.current,"maxHeight"),void Ce(L.current,"maxWidth");var e=function(){if(B.current&&L.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,I.getRectangleFromRange)(r);if(r instanceof window.Element){var i=r.getBoundingClientRect();return o?i:Ee(i,r)}var c=r.top,a=r.bottom,s=c.getBoundingClientRect(),u=a.getBoundingClientRect(),l=new window.DOMRect(s.left,s.top,s.width,u.bottom-s.top);return o?l:Ee(l,r)}if(e.current){var f=e.current.parentNode,p=f.getBoundingClientRect();return o?p:Ee(p,f)}}(x,g,O,y,b);if(e){var t,n,r=B.current,o=r.offsetParent,i=r.ownerDocument,c=0;if(o&&o!==i.body){var a=o.getBoundingClientRect();c=a.top,e=new window.DOMRect(e.left-a.left,e.top-a.top,e.width,e.height)}j&&(t=null===(n=B.current.closest(".popover-slot"))||void 0===n?void 0:n.parentNode);var s=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),a=c[0],s=c[1],u=void 0===s?"center":s,l=c[2],f=$(e,t,a,l,n,r,o);return q(q({},V(e,t,u,l,n,f.yAxis,i)),f)}(e,te.height?te:L.current.getBoundingClientRect(),d,D,B.current,c,t),u=s.popoverTop,p=s.popoverLeft,m=s.xAxis,h=s.yAxis,v=s.contentHeight,w=s.contentWidth;"number"==typeof u&&"number"==typeof p&&(Ce(B.current,"top",u+"px"),Ce(B.current,"left",p+"px")),Se(B.current,"is-without-arrow",l||"center"===m&&"middle"===h),Se(B.current,"is-alternate",f),Oe(B.current,"data-x-axis",m),Oe(B.current,"data-y-axis",h),Ce(L.current,"maxHeight","number"==typeof v?v+"px":""),Ce(L.current,"maxWidth","number"==typeof w?w+"px":""),Y(({left:"right",right:"left"}[m]||"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),F&&(n=new window.MutationObserver(e)).observe(F,{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()}}),[X,g,O,y,b,d,te,D,F,j]),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=I.focus.tabbable.find(n.current)[0];e?e.focus():n.current.focus()}}),0);return function(){return clearTimeout(e)}}),[])}(h,L);var ne=function(e){e.keyCode===E.ESCAPE&&r&&(e.stopPropagation(),r()),i&&i(e)},re=(0,e.createElement)(G,{onFocusOutside:function(e){if(k)k(e);else if(R){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}}),w()("Popover onClickOutside prop",{alternative:"onFocusOutside"}),R(t)}else r&&r()}},(0,e.createElement)(we,{type:P&&z?"appear":null,options:{origin:z}},(function(t){var i=t.className;return(0,e.createElement)(C,o({className:_()("components-popover",s,i,{"is-expanded":X,"is-without-arrow":l,"is-alternate":f})},M,{onKeyDown:ne,ref:B}),X&&(0,e.createElement)(Z,null),X&&(0,e.createElement)("div",{className:"components-popover__header"},(0,e.createElement)("span",{className:"components-popover__header-title"},n),(0,e.createElement)(xe,{className:"components-popover__close",icon:H,onClick:r})),(0,e.createElement)("div",{ref:L,className:"components-popover__content",tabIndex:"-1"},(0,e.createElement)("div",{style:{position:"relative"}},ee,c)))})));return h&&(re=(0,e.createElement)(ge,null,re)),Q.ref&&(re=(0,e.createElement)(he,{name:A},re)),y||g?re:(0,e.createElement)("span",{ref:x},re)};Te.Slot=function(t){var n=t.name,r=void 0===n?_e:n;return(0,e.createElement)(me,{bubblesVirtually:!0,name:r,className:"popover-slot"})};var Pe=Te,Re=function(t){var n,r,o=t.shortcut,i=t.className;return o?((0,S.isString)(o)&&(n=o),(0,S.isObject)(o)&&(n=o.display,r=o.ariaLabel),(0,e.createElement)("span",{className:i,"aria-label":r},n)):null};var ke=function(t){p(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 h(this,e)});function i(){var e;return s(this,i),(e=o.apply(this,arguments)).delayedSetIsOver=(0,S.debounce)((function(t){return e.setState({isOver:t})}),700),e.cancelIsMouseDown=e.createSetIsMouseDown(!1),e.isInMouseDown=!1,e.state={isOver:!1},e}return l(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,S.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),a=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,a&&(0,e.createElement)(Pe,{focusOnMount:!1,position:r,className:"components-tooltip","aria-hidden":"true",animate:!1,noArrow:!0},o,(0,e.createElement)(Re,{className:"components-tooltip__shortcut",shortcut:i})))})}}]),i}(e.Component),De=ke,Ne=function(t){var n=t.icon,r=t.className,i=a(t,["icon","className"]),c=["dashicon","dashicons","dashicons-"+n,r].filter(Boolean).join(" ");return(0,e.createElement)("span",o({className:c},i))};function Ae(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?Ae(Object(n),!0).forEach((function(t){K(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ae(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var je=function(t){var n=t.icon,r=void 0===n?null:n,i=t.size,c=a(t,["icon","size"]);if("string"==typeof r)return(0,e.createElement)(Ne,o({icon:r},c));if(r&&Ne===r.type)return(0,e.cloneElement)(r,Fe({},c));var s=i||24;if("function"==typeof r)return r.prototype instanceof e.Component?(0,e.createElement)(r,Fe({size:s},c)):r(Fe({size:s},c));if(r&&("svg"===r.type||r.type===U.SVG)){var u=Fe(Fe({width:s,height:s},r.props),c);return(0,e.createElement)(U.SVG,u)}return(0,e.isValidElement)(r)?(0,e.cloneElement)(r,Fe({size:s},c)):r};function Ie(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 Me=["onMouseDown","onClick"],xe=(0,e.forwardRef)((function(t,n){var r=t.href,i=t.target,c=t.isPrimary,s=t.isSmall,u=t.isTertiary,l=t.isPressed,f=t.isBusy,p=t.isDefault,d=t.isSecondary,m=t.isLink,h=t.isDestructive,y=t.className,v=t.disabled,b=t.icon,g=t.iconSize,E=t.showTooltip,O=t.tooltipPosition,C=t.shortcut,T=t.label,P=t.children,R=t.__experimentalIsFocusable,k=a(t,["href","target","isPrimary","isSmall","isTertiary","isPressed","isBusy","isDefault","isSecondary","isLink","isDestructive","className","disabled","icon","iconSize","showTooltip","tooltipPosition","shortcut","label","children","__experimentalIsFocusable"]);p&&w()("Button isDefault prop",{alternative:"isSecondary"});var D=_()("components-button",y,{"is-secondary":p||d,"is-primary":c,"is-small":s,"is-tertiary":u,"is-pressed":l,"is-busy":f,"is-link":m,"is-destructive":h,"has-text":!!b&&!!P,"has-icon":!!b}),N=v&&!R,A=void 0===r||N?"button":"a",F="a"===A?{href:r,target:i}:{type:"button",disabled:N,"aria-pressed":l};if(v&&R){F["aria-disabled"]=!0;var j,I=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 Ie(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)?Ie(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,a=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return c=e.done,e},e:function(e){a=!0,i=e},f:function(){try{c||null==n.return||n.return()}finally{if(a)throw i}}}}(Me);try{for(I.s();!(j=I.n()).done;)k[j.value]=function(e){e.stopPropagation(),e.preventDefault()}}catch(e){I.e(e)}finally{I.f()}}var M=!N&&(E&&T||C||!!T&&(!P||(0,S.isArray)(P)&&!P.length)&&!1!==E),x=(0,e.createElement)(A,o({},F,k,{className:D,"aria-label":k["aria-label"]||T,ref:n}),b&&(0,e.createElement)(je,{icon:b,size:g}),P);return M?(0,e.createElement)(De,{text:T,shortcut:C,position:O},x):x})),Le=function(t){var n=t.icon,r=t.title,o=t.onClose,c=t.closeLabel,a=t.headingId,s=t.isDismissible,u=c||(0,i.__)("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:a,className:"components-modal__header-heading"},r)),s&&(0,e.createElement)(xe,{onClick:o,icon:H,label:u}))},Be=new Set(["alert","status","log","marquee","timer"]),Ue=[],He=!1;var We,Ke=0,ze=function(t){p(c,t);var n,r,i=(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 h(this,e)});function c(e){var t;return s(this,c),(t=i.call(this,e)).prepareDOM(),t}return l(c,[{key:"componentDidMount",value:function(){1==++Ke&&this.openFirstModal()}},{key:"componentWillUnmount",value:function(){0==--Ke&&this.closeLastModal(),this.cleanDOM()}},{key:"prepareDOM",value:function(){We||(We=document.createElement("div"),document.body.appendChild(We)),this.node=document.createElement("div"),We.appendChild(this.node)}},{key:"cleanDOM",value:function(){We.removeChild(this.node)}},{key:"openFirstModal",value:function(){(function(e){if(!He){var t=document.body.children;(0,S.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")||Be.has(t))}(t)&&(t.setAttribute("aria-hidden","true"),Ue.push(t))})),He=!0}})(We),document.body.classList.add(this.props.bodyOpenClassName)}},{key:"closeLastModal",value:function(){document.body.classList.remove(this.props.bodyOpenClassName),He&&((0,S.forEach)(Ue,(function(e){e.removeAttribute("aria-hidden")})),Ue=[],He=!1)}},{key:"render",value:function(){var t=this.props,n=t.onRequestClose,r=t.title,i=t.icon,c=t.closeButtonLabel,s=t.children,u=t.aria,l=t.instanceId,f=t.isDismissible,p=t.isDismissable,d=a(t,["onRequestClose","title","icon","closeButtonLabel","children","aria","instanceId","isDismissible","isDismissable"]),m=u.labelledby||"components-modal-header-".concat(l);return p&&w()("isDismissable prop of the Modal component",{alternative:"isDismissible prop (renamed) of the Modal component"}),(0,e.createPortal)((0,e.createElement)(B,o({onRequestClose:n,aria:{labelledby:r?m:null,describedby:u.describedby}},d),(0,e.createElement)("div",{className:"components-modal__content",role:"document"},(0,e.createElement)(Le,{closeLabel:c,headingId:m,icon:i,isDismissible:f||p,onClose:n,title:r}),s)),this.node)}}]),c}(e.Component);ze.defaultProps={bodyOpenClassName:"modal-open",role:"dialog",title:null,focusOnMount:!0,shouldCloseOnEsc:!0,shouldCloseOnClickOutside:!0,isDismissible:!0,aria:{labelledby:null,describedby:null}};var qe=(0,v.withInstanceId)(ze),Ve=window.wp.a11y,$e=function(t){var n=t.className,r=t.status,o=void 0===r?"info":r,c=t.children,a=t.spokenMessage,s=void 0===a?c:a,u=t.onRemove,l=void 0===u?S.noop:u,f=t.isDismissible,p=void 0===f||f,d=t.actions,m=void 0===d?[]:d,h=t.politeness,y=void 0===h?function(e){switch(e){case"success":case"warning":case"info":return"polite";default:return"assertive"}}(o):h,v=t.__unstableHTML;!function(t,n){var r="string"==typeof t?t:(0,e.renderToString)(t);(0,e.useEffect)((function(){r&&(0,Ve.speak)(r,n)}),[r,n])}(s,y);var b=_()(n,"components-notice","is-"+o,{"is-dismissible":p});return v&&(c=(0,e.createElement)(e.RawHTML,null,c)),(0,e.createElement)("div",{className:b},(0,e.createElement)("div",{className:"components-notice__content"},c,m.map((function(t,n){var r=t.className,o=t.label,i=t.isPrimary,c=t.noDefaultClasses,a=void 0!==c&&c,s=t.onClick,u=t.url;return(0,e.createElement)(xe,{key:n,href:u,isPrimary:i,isSecondary:!a&&!u,isLink:!a&&!!u,onClick:u?void 0:s,className:_()("components-notice__action",r)},o)}))),p&&(0,e.createElement)(xe,{className:"components-notice__dismiss",icon:H,label:(0,i.__)("Dismiss this notice"),onClick:l,showTooltip:!1}))},Ye=window.wc.components,Ge=window.wp.url;window.moment,window.wp.date,window.wc.number;var Qe=window.wp.apiFetch,Ze=n.n(Qe),Xe=window.wp.domReady,Je=n.n(Xe);var et=function(){return window.wcTracks.isEnabled},tt=function(e,t){Je()((()=>{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)}))},nt={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",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 rt=async e=>{let{accept:t}=e;return Ze()({path:"/wc/v3/payments/tos",method:"POST",data:{accept:t}})},ot=async()=>{const e=wcpay_tos_settings.trackStripeConnected;et()&&e&&(tt(nt.CONNECT_ACCOUNT_STRIPE_CONNECTED,{is_existing_stripe_account:e.is_existing_stripe_account}),Ze()({path:"/wc/v3/payments/tos/stripe_track_connected",method:"POST"}))},it=t=>(0,e.createElement)(Ye.Link,o({},t,{href:"https://wordpress.com/tos",target:"_blank",rel:"noopener noreferrer",type:"external"})),ct=t=>{let{onAccept:n,onDecline:r,isBusy:o,hasError:a}=t;const s=(0,i.__)("WooCommerce Payments: Terms of Service","woocommerce-payments"),u=(0,c.Z)({mixedString:(0,i.__)("To continue using WooCommerce Payments, please review and agree to our {{link}}Terms of Service{{/link}}. By clicking “Accept” you agree to the Terms of Service.","woocommerce-payments"),components:{link:(0,e.createElement)(it,null)}});return(0,e.createElement)(qe,{title:s,isDismissible:!1,shouldCloseOnClickOutside:!1,shouldCloseOnEsc:!1,onRequestClose:r,className:"woocommerce-payments__tos-modal"},a&&(0,e.createElement)($e,{status:"error",isDismissible:!1,className:"woocommerce-payments__tos-error"},(0,i.__)("Something went wrong. Please try accepting the Terms of Service again!","woocommerce-payments")),(0,e.createElement)("div",{className:"woocommerce-payments__tos-wrapper"},(0,e.createElement)("div",{className:"woocommerce-payments__tos-modal-message"},u),(0,e.createElement)("div",{className:"woocommerce-payments__tos-footer"},(0,e.createElement)(xe,{isSecondary:!0,onClick:r,isBusy:o},(0,i.__)("Decline","woocommerce-payments")),(0,e.createElement)(xe,{isPrimary:!0,onClick:n,isBusy:o},(0,i.__)("Accept","woocommerce-payments")))))},at=t=>{let{onDisable:n,onCancel:r,isBusy:o,hasError:a}=t;const s=(0,i.__)("Disable WooCommerce Payments","woocommerce-payments"),u=(0,c.Z)({mixedString:(0,i.__)("By declining our {{link}}Terms of Service{{/link}}, you’ll no longer be able to capture credit card payments using WooCommerce Payments. Your previous transaction and deposit data will still be available.","woocommerce-payments"),components:{link:(0,e.createElement)(it,null)}});return(0,e.createElement)(qe,{title:s,isDismissible:!1,shouldCloseOnClickOutside:!1,shouldCloseOnEsc:!1,onRequestClose:n,className:"woocommerce-payments__tos-modal"},a&&(0,e.createElement)($e,{status:"error",isDismissible:!1,className:"woocommerce-payments__tos-error"},(0,i.__)("Something went wrong. Please try again!","woocommerce-payments")),(0,e.createElement)("div",{className:"woocommerce-payments__tos-wrapper"},(0,e.createElement)("div",{className:"woocommerce-payments__tos-modal-message"},u),(0,e.createElement)("div",{className:"woocommerce-payments__tos-footer"},(0,e.createElement)(xe,{isTertiary:!0,onClick:r,isBusy:o},(0,i.__)("Back","woocommerce-payments")),(0,e.createElement)(xe,{isPrimary:!0,onClick:n,isBusy:o},(0,i.__)("Disable","woocommerce-payments")))))};var st=()=>{const[t,n]=(0,e.useState)(!0),[r,o]=(0,e.useState)(!1),[i,c]=(0,e.useState)(!1),[a,s]=(0,e.useState)(!1),[u,l]=(0,e.useState)(!1),f=()=>n(!1),p=()=>o(!1);return r?(0,e.createElement)(at,{onDisable:async()=>{try{l(!1),c(!0),await rt({accept:!1}),p(),window.location=(0,Ge.addQueryArgs)((e={page:"wc-settings",tab:"checkout"},(0,Ge.addQueryArgs)("admin.php",e)),{"tos-disabled":1})}catch(e){l(!0)}finally{c(!1)}var e},onCancel:()=>{p(),n(!0)},isBusy:i,hasError:u}):t?(0,e.createElement)(ct,{onAccept:async()=>{try{s(!1),c(!0),await rt({accept:!0}),ot(),f()}catch(e){s(!0)}finally{c(!1)}},onDecline:()=>{f(),o(!0)},isBusy:i,hasError:a}):null},ut=window.wp.data;wcpay_tos_settings.tosAgreementRequired?function(){const t=document.createElement("div");t.id="wcpay-tos-container",document.body.appendChild(t),r().render((0,e.createElement)(st,null),t)}():ot(),wcpay_tos_settings.tosAgreementDeclined&&window.addEventListener("load",(()=>{const{settingsUrl:e}=wcpay_tos_settings;(e=>{const{createInfoNotice:t}=(0,ut.dispatch)("core/notices");t((0,i.__)("Disabled WooCommerce Payments","woocommerce-payments"),{actions:[{label:(0,i.__)("Undo","woocommerce-payments"),onClick:async()=>{try{await(async()=>Ze()({path:"/wc/v3/payments/tos/reactivate",method:"POST"}))()}finally{window.location=e}}}]})})(e)}))}()}();