/*! For license information please see screen-onboarding.js.LICENSE.txt */ (()=>{var e={20:(e,t,r)=>{"use strict";var n=r(540),o=Symbol.for("react.element"),a=Symbol.for("react.fragment"),i=Object.prototype.hasOwnProperty,c=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function l(e,t,r){var n,a={},l=null,u=null;for(n in void 0!==r&&(l=""+r),void 0!==t.key&&(l=""+t.key),void 0!==t.ref&&(u=t.ref),t)i.call(t,n)&&!s.hasOwnProperty(n)&&(a[n]=t[n]);if(e&&e.defaultProps)for(n in t=e.defaultProps)void 0===a[n]&&(a[n]=t[n]);return{$$typeof:o,type:e,key:l,ref:u,props:a,_owner:c.current}}t.Fragment=a,t.jsx=l,t.jsxs=l},287:(e,t)=>{"use strict";var r=Symbol.for("react.element"),n=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),c=Symbol.for("react.provider"),s=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),p=Symbol.iterator;var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},m=Object.assign,y={};function b(e,t,r){this.props=e,this.context=t,this.refs=y,this.updater=r||h}function v(){}function g(e,t,r){this.props=e,this.context=t,this.refs=y,this.updater=r||h}b.prototype.isReactComponent={},b.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},b.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},v.prototype=b.prototype;var j=g.prototype=new v;j.constructor=g,m(j,b.prototype),j.isPureReactComponent=!0;var x=Array.isArray,w=Object.prototype.hasOwnProperty,O={current:null},S={key:!0,ref:!0,__self:!0,__source:!0};function z(e,t,n){var o,a={},i=null,c=null;if(null!=t)for(o in void 0!==t.ref&&(c=t.ref),void 0!==t.key&&(i=""+t.key),t)w.call(t,o)&&!S.hasOwnProperty(o)&&(a[o]=t[o]);var s=arguments.length-2;if(1===s)a.children=n;else if(1{"use strict";e.exports=r(287)},848:(e,t,r)=>{"use strict";e.exports=r(20)},942:(e,t)=>{var r;!function(){"use strict";var n={}.hasOwnProperty;function o(){for(var e="",t=0;t{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";const e=wp.domReady;var t=r.n(e);const n=wp.element;var o=r(942),a=r.n(o);const i=(0,n.createContext)({isLoading:!1,isFirstStep:!0,isLastStep:!1,stepCount:0,activeStep:0});function c(){var e=(0,n.useContext)(i);if(!e)throw Error("Wrap your step with `Wizard`");return e}var s=r(848);function l(e){return l="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},l(e)}function u(){u=function(){return t};var e,t={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(e,t,r){e[t]=r.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",c=a.asyncIterator||"@@asyncIterator",s=a.toStringTag||"@@toStringTag";function f(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{f({},"")}catch(e){f=function(e,t,r){return e[t]=r}}function d(e,t,r,n){var a=t&&t.prototype instanceof g?t:g,i=Object.create(a.prototype),c=new k(n||[]);return o(i,"_invoke",{value:P(e,r,c)}),i}function p(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=d;var h="suspendedStart",m="suspendedYield",y="executing",b="completed",v={};function g(){}function j(){}function x(){}var w={};f(w,i,(function(){return this}));var O=Object.getPrototypeOf,S=O&&O(O(M([])));S&&S!==r&&n.call(S,i)&&(w=S);var z=x.prototype=g.prototype=Object.create(w);function _(e){["next","throw","return"].forEach((function(t){f(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function r(o,a,i,c){var s=p(e[o],e,a);if("throw"!==s.type){var u=s.arg,f=u.value;return f&&"object"==l(f)&&n.call(f,"__await")?t.resolve(f.__await).then((function(e){r("next",e,i,c)}),(function(e){r("throw",e,i,c)})):t.resolve(f).then((function(e){u.value=e,i(u)}),(function(e){return r("throw",e,i,c)}))}c(s.arg)}var a;o(this,"_invoke",{value:function(e,n){function o(){return new t((function(t,o){r(e,n,t,o)}))}return a=a?a.then(o,o):o()}})}function P(t,r,n){var o=h;return function(a,i){if(o===y)throw Error("Generator is already running");if(o===b){if("throw"===a)throw i;return{value:e,done:!0}}for(n.method=a,n.arg=i;;){var c=n.delegate;if(c){var s=E(c,n);if(s){if(s===v)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=b,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=y;var l=p(t,r,n);if("normal"===l.type){if(o=n.done?b:m,l.arg===v)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=b,n.method="throw",n.arg=l.arg)}}}function E(t,r){var n=r.method,o=t.iterator[n];if(o===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,E(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),v;var a=p(o,t.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,v;var i=a.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,v):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,v)}function A(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function k(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(A,this),this.reset(!0)}function M(t){if(t||""===t){var r=t[i];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function r(){for(;++o=0;--a){var i=this.tryEntries[a],c=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var s=n.call(i,"catchLoc"),l=n.call(i,"finallyLoc");if(s&&l){if(this.prev=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),L(r),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:M(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),v}},t}function f(e,t,r,n,o,a,i){try{var c=e[a](i),s=c.value}catch(e){return void r(e)}c.done?t(s):Promise.resolve(s).then(n,o)}function d(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function i(e){f(a,n,o,i,c,"next",e)}function c(e){f(a,n,o,i,c,"throw",e)}i(void 0)}))}}function p(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a,i,c=[],s=!0,l=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=a.call(r)).done)&&(c.push(n.value),c.length!==t);s=!0);}catch(e){l=!0,o=e}finally{try{if(!s&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(l)throw o}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return h(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?h(e,t):void 0}}(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 h(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r0;var O=(0,n.useRef)((function(){g.current&&m((function(e){return e+1}))})),S=(0,n.useRef)((function(){j.current&&(x.current=null,m((function(e){return e-1})))})),z=(0,n.useRef)((function(e){e>=0&&et?"is-done":"",r?"is-active":"");return(0,s.jsx)("div",{className:o,children:(0,s.jsx)("div",{className:"advads-wizard-progress--count",children:r?"Step ".concat(t+1):t+1})},"step-".concat(t))}))})]})}const v=advancedAds.i18n;function g(){return c().isLastStep?null:(0,s.jsx)("div",{className:"text-center",children:(0,s.jsx)("a",{href:y("admin.php?page=advanced-ads"),className:"no-underline text-base border-0 border-b-2 pb-0.5 border-solid border-gray-800 text-gray-800",children:v.wizard.exitLabel})})}function j(e){var t=e.children,r=e.className,n=void 0===r?"":r;return(0,s.jsx)("div",{className:"bg-white mt-4 mb-8 p-8 border-solid border-gray-200 rounded-sm ".concat(n),children:t})}function x(e){return x="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},x(e)}function w(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function O(e){for(var t=1;t=0;--a){var i=this.tryEntries[a],c=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var s=n.call(i,"catchLoc"),l=n.call(i,"finallyLoc");if(s&&l){if(this.prev=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),E(r),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;E(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:L(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),y}},t}function X(e,t,r,n,o,a,i){try{var c=e[a](i),s=c.value}catch(e){return void r(e)}c.done?t(s):Promise.resolve(s).then(n,o)}function ee(e){var t=e.isEnabled,r=e.enableText,n=e.disableText,o=e.onNext,a=c(),i=a.previousStep,l=a.nextStep,u=function(){var e,t=(e=Q().mark((function e(){return Q().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:o&&o(),l();case 2:case"end":return e.stop()}}),e)})),function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function i(e){X(a,n,o,i,c,"next",e)}function c(e){X(a,n,o,i,c,"throw",e)}i(void 0)}))});return function(){return t.apply(this,arguments)}}();return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(Z,{className:"mb-4"}),(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsx)("div",{children:(0,s.jsx)("button",{onClick:i,className:"button-onboarding !bg-white !border-gray-100 !text-gray-600",children:v.wizard.btnGoBack})}),(0,s.jsx)("div",{children:t?(0,s.jsx)("button",{className:"button-onboarding",onClick:u,children:r}):(0,s.jsx)("button",{className:"button-onboarding",disabled:!0,children:n})})]})]})}function te(){return(0,s.jsx)("div",{className:"absolute inset-0 flex justify-center items-center z-10 bg-white bg-opacity-70",children:(0,s.jsx)("img",{alt:v.wizard.processing,src:"".concat(advancedAds.endpoints.adminUrl,"images/spinner-2x.gif")})})}function re(e){var t=e.accounts,r=e.tokenData,n=e.done,o=e.fail,a=new URLSearchParams(document.location.search),i=[(0,s.jsx)("option",{value:"",children:v.wizard.selectAccount.optionZero},"select-account")];for(var c in t)i.push((0,s.jsxs)("option",{value:JSON.stringify(t[c]),children:[t[c].name," (",c,")"]},c));return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("h2",{children:v.wizard.selectAccount.title}),(0,s.jsx)("label",{htmlFor:"g-account",children:(0,s.jsx)("select",{id:"g-account",onChange:function(e){return function(e){if(e.target.value){e.target.disabled=!0;var t=JSON.parse(e.target.value);wp.ajax.post("advads_gadsense_mapi_select_account",{nonce:a.get("nonce"),account:t,token_data:r}).done((function(e){"function"==typeof n&&n.call(null,e)})).fail((function(t){"function"==typeof o&&o.call(null,t),e.target.disabled=!1}))}}(e)},children:i})})]})}function ne(e){return function(e){if(Array.isArray(e))return oe(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return oe(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?oe(e,t):void 0}}(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.")}()}function oe(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r-1?t.splice(o,1):t.push(e),n("autoAdsOptions",t)}})]})]}),(0,s.jsx)(ee,{isEnabled:r.googleAdsPlacement,enableText:o,disableText:v.wizard.googleAd.footerDisableText})]})}function ie(e){var t=e.options,r=e.setOptions,o=null,a=function(e){if(e.preventDefault(),o)return o.uploader.uploader.param("post_id",0),void o.open();(o=wp.media.frames.file_frame=wp.media({title:v.wizard.bannerAd.mediaFrameTitle,button:{text:v.wizard.bannerAd.mediaFrameButton},multiple:!1})).on("select",(function(){var e=o.state().get("selection").first().toJSON();r("adImage",e)})),o.open()};return(0,n.useEffect)((function(){if(t.adImage){var e=t.adImage.url.split("/").pop(),n=document.createElement("p");n.style.visibility="hidden",n.style.whiteSpace="nowrap",n.style.position="absolute",n.innerText=e,document.body.appendChild(n);var o=n.offsetWidth>250;document.body.removeChild(n),r("isTextLong",o)}}),[t.adImage]),(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("h1",{className:"!mt-0 ".concat(t.adImage?"text-gray-300":""),children:v.wizard.stepTitles.adImage}),t.adImage?(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"flex items-center gap-5",children:[(0,s.jsx)("button",{className:"button-onboarding button-onboarding--gray",onClick:a,children:v.wizard.bannerAd.mediaBtnReplace}),(0,s.jsx)("div",{className:"file-name-rtl m-0 ".concat(t.isTextLong?"truncate":""),children:(0,s.jsx)("p",{children:t.adImage.url.split("/").pop()})}),(0,s.jsx)("span",{className:"dashicons dashicons-yes-alt flex items-center justify-center text-4xl w-9 h-9 text-primary"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("h2",{children:v.wizard.bannerAd.stepHeading}),(0,s.jsx)("input",{type:"url",name:"ad_image_url",id:"ad_image_url",className:"advads-input-text",placeholder:v.wizard.bannerAd.inputPlaceholder,onChange:function(e){return r("adImageUrl",e.target.value)}})]})]}):(0,s.jsx)("button",{className:"button-onboarding",onClick:a,children:v.wizard.bannerAd.mediaBtnUpload}),(0,s.jsx)(ee,{isEnabled:t.adImage,enableText:v.wizard.bannerAd.footerEnableText,disableText:v.wizard.bannerAd.footerDisableText,onNext:function(){}})]})}function ce(e){var t=e.options,r=e.setOptions;return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("h1",{className:"!mt-0 ".concat(t.adCode?"text-gray-300":""),children:v.wizard.stepTitles.adCode}),(0,s.jsx)("div",{className:"space-y-4",children:(0,s.jsx)("div",{children:(0,s.jsx)("textarea",{name:"ad_code_code",id:"ad_code_code",className:"w-full p-4 text-base",rows:6,placeholder:v.wizard.codeAd.inputPlaceholder,onChange:function(e){return r("adCode",e.target.value)}})})}),(0,s.jsx)(ee,{isEnabled:t.adCode,enableText:v.wizard.codeAd.footerEnableText,disableText:v.wizard.codeAd.footerDisableText,onNext:function(){}})]})}const se=wp.apiFetch;var le=r.n(se);function ue(e){return ue="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},ue(e)}function fe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function de(e){for(var t=1;te.length)&&(t=e.length);for(var r=0,n=Array(t);re.length)&&(t=e.length);for(var r=0,n=Array(t);r