diff --git a/includes/assets/js/dist/edit-automation-rule.asset.php b/includes/assets/js/dist/edit-automation-rule.asset.php index f0d7966a..dc972623 100644 --- a/includes/assets/js/dist/edit-automation-rule.asset.php +++ b/includes/assets/js/dist/edit-automation-rule.asset.php @@ -1 +1 @@ - array('react', 'wp-api-fetch', 'wp-components', 'wp-dom-ready', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => '65c915cc467fbb61615f'); + array('react', 'wp-api-fetch', 'wp-components', 'wp-dom-ready', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => 'b36bf84e4ee6354c0a87'); diff --git a/includes/assets/js/dist/edit-automation-rule.js b/includes/assets/js/dist/edit-automation-rule.js index deb70f52..62c3b422 100644 --- a/includes/assets/js/dist/edit-automation-rule.js +++ b/includes/assets/js/dist/edit-automation-rule.js @@ -1,2 +1,2 @@ /*! For license information please see edit-automation-rule.js.LICENSE.txt */ -(()=>{"use strict";var e={679:(e,t,n)=>{var r=n(296),a={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},o={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},i={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},l={};function c(e){return r.isMemo(e)?i:l[e.$$typeof]||a}l[r.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},l[r.Memo]=i;var s=Object.defineProperty,u=Object.getOwnPropertyNames,p=Object.getOwnPropertySymbols,f=Object.getOwnPropertyDescriptor,d=Object.getPrototypeOf,m=Object.prototype;e.exports=function e(t,n,r){if("string"!=typeof n){if(m){var a=d(n);a&&a!==m&&e(t,a,r)}var i=u(n);p&&(i=i.concat(p(n)));for(var l=c(t),g=c(n),y=0;y{var n="function"==typeof Symbol&&Symbol.for,r=n?Symbol.for("react.element"):60103,a=n?Symbol.for("react.portal"):60106,o=n?Symbol.for("react.fragment"):60107,i=n?Symbol.for("react.strict_mode"):60108,l=n?Symbol.for("react.profiler"):60114,c=n?Symbol.for("react.provider"):60109,s=n?Symbol.for("react.context"):60110,u=n?Symbol.for("react.async_mode"):60111,p=n?Symbol.for("react.concurrent_mode"):60111,f=n?Symbol.for("react.forward_ref"):60112,d=n?Symbol.for("react.suspense"):60113,m=n?Symbol.for("react.suspense_list"):60120,g=n?Symbol.for("react.memo"):60115,y=n?Symbol.for("react.lazy"):60116,b=n?Symbol.for("react.block"):60121,v=n?Symbol.for("react.fundamental"):60117,h=n?Symbol.for("react.responder"):60118,_=n?Symbol.for("react.scope"):60119;function w(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case r:switch(e=e.type){case u:case p:case o:case l:case i:case d:return e;default:switch(e=e&&e.$$typeof){case s:case f:case y:case g:case c:return e;default:return t}}case a:return t}}}function x(e){return w(e)===p}t.AsyncMode=u,t.ConcurrentMode=p,t.ContextConsumer=s,t.ContextProvider=c,t.Element=r,t.ForwardRef=f,t.Fragment=o,t.Lazy=y,t.Memo=g,t.Portal=a,t.Profiler=l,t.StrictMode=i,t.Suspense=d,t.isAsyncMode=function(e){return x(e)||w(e)===u},t.isConcurrentMode=x,t.isContextConsumer=function(e){return w(e)===s},t.isContextProvider=function(e){return w(e)===c},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===r},t.isForwardRef=function(e){return w(e)===f},t.isFragment=function(e){return w(e)===o},t.isLazy=function(e){return w(e)===y},t.isMemo=function(e){return w(e)===g},t.isPortal=function(e){return w(e)===a},t.isProfiler=function(e){return w(e)===l},t.isStrictMode=function(e){return w(e)===i},t.isSuspense=function(e){return w(e)===d},t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===o||e===p||e===l||e===i||e===d||e===m||"object"==typeof e&&null!==e&&(e.$$typeof===y||e.$$typeof===g||e.$$typeof===c||e.$$typeof===s||e.$$typeof===f||e.$$typeof===v||e.$$typeof===h||e.$$typeof===_||e.$$typeof===b)},t.typeOf=w},296:(e,t,n)=>{e.exports=n(103)}},t={};function n(r){var a=t[r];if(void 0!==a)return a.exports;var o=t[r]={exports:{}};return e[r](o,o.exports,n),o.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(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.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{function e(t){return e="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},e(t)}function t(t,n,r){return(n=function(t){var n=function(t,n){if("object"!==e(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var a=r.call(t,"string");if("object"!==e(a))return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"===e(n)?n:String(n)}(n))in t?Object.defineProperty(t,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[n]=r,t}const r=window.wp.element,a=window.wp.domReady;var o=n.n(a);function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0?"/noptin/v1/automation_rules/".concat(t.id):"/noptin/v1/automation_rules/",u=[{label:(0,f.__)("ID","newsletter-optin-box"),value:t.id?t.id:(0,f.__)("New","newsletter-optin-box")},{label:(0,f.__)("Status","newsletter-optin-box"),value:(0,r.createElement)(s.ToggleControl,{label:t.status?(0,f.__)("Active","newsletter-optin-box"):(0,f.__)("Inactive","newsletter-optin-box"),checked:!!t.status,className:"noptin-mb0",onChange:function(e){o(b(b({},t),{},{status:e}))},__nextHasNoMarginBottom:!0})}];return t.id>0&&(u.push({label:(0,f.__)("Times Run","newsletter-optin-box"),value:t.times_run},{label:(0,f.__)("Created at","newsletter-optin-box"),value:v(t.created_at)},{label:(0,f.__)("Updated at","newsletter-optin-box"),value:v(t.updated_at)}),Array.isArray(t.metadata)||Object.keys(t.metadata).forEach((function(e){"string"!=typeof t.metadata[e]&&"number"!=typeof t.metadata[e]||u.push({label:e,value:t.metadata[e]})}))),(0,r.createElement)(d,{title:(0,f.__)("Automation Rule","newsletter-optin-box")},(0,r.createElement)(s.CardBody,null,(0,r.createElement)(g,{items:u}),(0,r.createElement)(s.Button,{variant:"primary",onClick:function(){l(!0),n(null),a(null),p()({path:c,method:"POST",data:t}).then((function(e){return a((0,f.__)("Automation rule saved.","newsletter-optin-box")),o(b(b({},t),e)),e})).then((function(e){e.id>0&&window.history.replaceState({},"","?page=noptin-automation-rules&noptin_edit_automation_rule=".concat(e.id))})).catch((function(e){e.message?n(e.message):n((0,f.__)("An error occurred while saving.","newsletter-optin-box"))})).finally((function(){l(!1)}))},disabled:i,isPressed:i},!i&&(0,f.__)("Save Automation","newsletter-optin-box"),i&&(0,f.__)("Saving...","newsletter-optin-box"),i&&(0,r.createElement)(s.Spinner,null))))}function _(e){return function(e){if(Array.isArray(e))return i(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||l(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 w(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}const x=window.wp.primitives,E=(0,r.createElement)(x.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,r.createElement)(x.Path,{d:"M6.6 6L5.4 7l4.5 5-4.5 5 1.1 1 5.5-6-5.4-6zm6 0l-1.1 1 4.5 5-4.5 5 1.1 1 5.5-6-5.5-6z"}));var O=[0,100],k=[0,100],S=function(e){return"".concat(1===e.length?"0":"").concat(e)},C=function(e,t,n){return Math.max(Math.min(e,n),t)},P=function(e,t){return Math.floor(Math.random()*(t-e+1))+e},j=function e(t,n,r){for(var a=P(t,n),o=0;o<(null==r?void 0:r.length);o++){var i=r[o];if(2===(null==i?void 0:i.length)&&a>=i[0]&&a<=i[1])return e(t,n,r)}return a},A=function(e,t){return"number"==typeof t?t:e%Math.abs(t[1]-t[0])+t[0]},T=function(e,t){return"number"==typeof e?C.apply(void 0,[Math.abs(e)].concat(_(t))):1===e.length||e[0]===e[1]?C.apply(void 0,[Math.abs(e[0])].concat(_(t))):[Math.abs(C.apply(void 0,[e[0]].concat(_(t)))),C.apply(void 0,[Math.abs(e[1])].concat(_(t)))]},M=function(e,t,n){return n<0?n+=1:n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e},N=function(e,t,n){var r,a,o;if(e/=360,n/=100,0==(t/=100))r=a=o=n;else{var i=n<.5?n*(1+t):n+t-n*t,l=2*n-i;r=M(l,i,e+1/3),a=M(l,i,e),o=M(l,i,e-1/3)}return[Math.round(255*r),Math.round(255*a),Math.round(255*o)]},$=function(e,t,n,r){return(299*e+587*t+114*n)/1e3>=r},D=function(e,t,n){return"hsl(".concat(e,", ").concat(t,"%, ").concat(n,"%)")},F=function(e,t,n,r){return"rgb"===r?"rgb(".concat(e,", ").concat(t,", ").concat(n,")"):"#".concat(S(e.toString(16))).concat(S(t.toString(16))).concat(S(n.toString(16)))},R=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.format,r=void 0===n?"hex":n,a=t.saturation,o=void 0===a?[50,55]:a,i=t.lightness,l=void 0===i?[50,60]:i,s=t.differencePoint,u=void 0===s?130:s,p=Math.abs(function(e){for(var t=e.length,n=0,r=0;r0&&void 0!==arguments[0]?arguments[0]:{},t=e.format,n=void 0===t?"hex":t,r=e.saturation,a=void 0===r?[50,55]:r,o=e.lightness,i=void 0===o?[50,60]:o,l=e.differencePoint,s=void 0===l?130:l,u=e.excludeHue;a=T(a,O),i=T(i,k);var p=u?j(0,359,u):P(0,359),f="number"==typeof a?a:P.apply(void 0,_(a)),d="number"==typeof i?i:P.apply(void 0,_(i)),m=c(N(p,f,d),3),g=m[0],y=m[1],b=m[2];return{color:"hsl"===n?D(p,f,d):F(g,y,b,n),isLight:$(g,y,b,s)}};const B=R;function I(){return I=Object.assign?Object.assign.bind():function(e){for(var t=1;t0?J(le,--oe):0,re--,10===ie&&(re=1,ne--),ie}function pe(){return ie=oe2||ge(ie)>3?"":" "}function _e(e,t){for(;--t&&pe()&&!(ie<48||ie>102||ie>57&&ie<65||ie>70&&ie<97););return me(e,de()+(t<6&&32==fe()&&32==pe()))}function we(e){for(;pe();)switch(ie){case e:return oe;case 34:case 39:34!==e&&39!==e&&we(ie);break;case 40:41===e&&we(e);break;case 92:pe()}return oe}function xe(e,t){for(;pe()&&e+ie!==57&&(e+ie!==84||47!==fe()););return"/*"+me(t,oe-1)+"*"+W(47===e?e:pe())}function Ee(e){for(;!ge(fe());)pe();return me(e,oe)}var Oe="-ms-",ke="-moz-",Se="-webkit-",Ce="comm",Pe="rule",je="decl",Ae="@keyframes";function Te(e,t){for(var n="",r=ee(e),a=0;a0&&Q(E)-p&&te(d>32?Re(E+";",r,n,p-1):Re(X(E," ","")+";",r,n,p-2),c);break;case 59:E+=";";default:if(te(x=De(E,t,n,s,u,a,l,h,_=[],w=[],p),o),123===v)if(0===u)$e(E,t,x,x,_,o,p,l,w);else switch(99===f&&110===J(E,3)?100:f){case 100:case 108:case 109:case 115:$e(e,x,x,r&&te(De(e,x,x,0,0,a,l,h,a,_=[],p),w),a,w,p,l,r?_:w);break;default:$e(E,x,x,x,[""],w,0,l,w)}}s=u=d=0,g=b=1,h=E="",p=i;break;case 58:p=1+Q(E),d=m;default:if(g<1)if(123==v)--g;else if(125==v&&0==g++&&125==ue())continue;switch(E+=W(v),v*g){case 38:b=u>0?1:(E+="\f",-1);break;case 44:l[s++]=(Q(E)-1)*b,b=1;break;case 64:45===fe()&&(E+=ve(pe())),f=fe(),u=p=Q(h=E+=Ee(de())),v++;break;case 45:45===m&&2==Q(E)&&(g=0)}}return o}function De(e,t,n,r,a,o,i,l,c,s,u){for(var p=a-1,f=0===a?o:[""],d=ee(f),m=0,g=0,y=0;m0?f[b]+" "+v:X(v,/&\f/g,f[b])))&&(c[y++]=h);return ce(e,t,n,0===a?Pe:l,c,s,u)}function Fe(e,t,n){return ce(e,t,n,Ce,W(ie),Z(e,2,-2),0)}function Re(e,t,n,r){return ce(e,t,n,je,Z(e,0,r),Z(e,r+1,-1),r)}var Be=function(e,t,n){for(var r=0,a=0;r=a,a=fe(),38===r&&12===a&&(t[n]=1),!ge(a);)pe();return me(e,oe)},Ie=new WeakMap,Le=function(e){if("rule"===e.type&&e.parent&&!(e.length<1)){for(var t=e.value,n=e.parent,r=e.column===n.column&&e.line===n.line;"rule"!==n.type;)if(!(n=n.parent))return;if((1!==e.props.length||58===t.charCodeAt(0)||Ie.get(n))&&!r){Ie.set(e,!0);for(var a=[],o=function(e,t){return be(function(e,t){var n=-1,r=44;do{switch(ge(r)){case 0:38===r&&12===fe()&&(t[n]=1),e[n]+=Be(oe-1,t,n);break;case 2:e[n]+=ve(r);break;case 4:if(44===r){e[++n]=58===fe()?"&\f":"",t[n]=e[n].length;break}default:e[n]+=W(r)}}while(r=pe());return e}(ye(e),t))}(t,a),i=n.props,l=0,c=0;l6)switch(J(e,t+1)){case 109:if(45!==J(e,t+4))break;case 102:return X(e,/(.+:)(.+)-([^]+)/,"$1"+Se+"$2-$3$1"+ke+(108==J(e,t+3)?"$3":"$2-$3"))+e;case 115:return~Y(e,"stretch")?He(X(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(115!==J(e,t+1))break;case 6444:switch(J(e,Q(e)-3-(~Y(e,"!important")&&10))){case 107:return X(e,":",":"+Se)+e;case 101:return X(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+Se+(45===J(e,14)?"inline-":"")+"box$3$1"+Se+"$2$3$1"+Oe+"$2box$3")+e}break;case 5936:switch(J(e,t+11)){case 114:return Se+e+Oe+X(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return Se+e+Oe+X(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return Se+e+Oe+X(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return Se+e+Oe+e+e}return e}var Ue=[function(e,t,n,r){if(e.length>-1&&!e.return)switch(e.type){case je:e.return=He(e.value,e.length);break;case Ae:return Te([se(e,{value:X(e.value,"@","@"+Se)})],r);case Pe:if(e.length)return function(e,t){return e.map(t).join("")}(e.props,(function(t){switch(function(e,t){return(e=/(::plac\w+|:read-\w+)/.exec(e))?e[0]:e}(t)){case":read-only":case":read-write":return Te([se(e,{props:[X(t,/:(read-\w+)/,":-moz-$1")]})],r);case"::placeholder":return Te([se(e,{props:[X(t,/:(plac\w+)/,":"+Se+"input-$1")]}),se(e,{props:[X(t,/:(plac\w+)/,":-moz-$1")]}),se(e,{props:[X(t,/:(plac\w+)/,Oe+"input-$1")]})],r)}return""}))}}],Ve=function(e){var t=e.key;if("css"===t){var n=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(n,(function(e){-1!==e.getAttribute("data-emotion").indexOf(" ")&&(document.head.appendChild(e),e.setAttribute("data-s",""))}))}var r,a,o=e.stylisPlugins||Ue,i={},l=[];r=e.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+t+' "]'),(function(e){for(var t=e.getAttribute("data-emotion").split(" "),n=1;n=4;++r,a-=4)t=1540483477*(65535&(t=255&e.charCodeAt(r)|(255&e.charCodeAt(++r))<<8|(255&e.charCodeAt(++r))<<16|(255&e.charCodeAt(++r))<<24))+(59797*(t>>>16)<<16),n=1540483477*(65535&(t^=t>>>24))+(59797*(t>>>16)<<16)^1540483477*(65535&n)+(59797*(n>>>16)<<16);switch(a){case 3:n^=(255&e.charCodeAt(r+2))<<16;case 2:n^=(255&e.charCodeAt(r+1))<<8;case 1:n=1540483477*(65535&(n^=255&e.charCodeAt(r)))+(59797*(n>>>16)<<16)}return(((n=1540483477*(65535&(n^=n>>>13))+(59797*(n>>>16)<<16))^n>>>15)>>>0).toString(36)}(a)+c;return{name:s,styles:a,next:Qe}},nt=!!L.useInsertionEffect&&L.useInsertionEffect,rt=nt||function(e){return e()},at=(nt||L.useLayoutEffect,L.createContext("undefined"!=typeof HTMLElement?Ve({key:"css"}):null));at.Provider;var ot=L.createContext({}),it=function(e,t,n){var r=e.key+"-"+t.name;!1===n&&void 0===e.registered[r]&&(e.registered[r]=t.styles)},lt=U,ct=function(e){return"theme"!==e},st=function(e){return"string"==typeof e&&e.charCodeAt(0)>96?lt:ct},ut=function(e,t,n){var r;if(t){var a=t.shouldForwardProp;r=e.__emotion_forwardProp&&a?function(t){return e.__emotion_forwardProp(t)&&a(t)}:a}return"function"!=typeof r&&n&&(r=e.__emotion_forwardProp),r},pt=function(e){var t=e.cache,n=e.serialized,r=e.isStringTag;return it(t,n,r),rt((function(){return function(e,t,n){it(e,t,n);var r=e.key+"-"+t.name;if(void 0===e.inserted[t.name]){var a=t;do{e.insert(t===a?"."+r:"",a,e.sheet,!0),a=a.next}while(void 0!==a)}}(t,n,r)})),null},ft=function e(t,n){var r,a,o=t.__emotion_real===t,i=o&&t.__emotion_base||t;void 0!==n&&(r=n.label,a=n.target);var l=ut(t,n,o),c=l||st(i),s=!c("as");return function(){var u=arguments,p=o&&void 0!==t.__emotion_styles?t.__emotion_styles.slice(0):[];if(void 0!==r&&p.push("label:"+r+";"),null==u[0]||void 0===u[0].raw)p.push.apply(p,u);else{p.push(u[0][0]);for(var f=u.length,d=1;d1;return(0,r.createElement)(s.Flex,{className:"noptin-component__field-lg",wrap:!0},(0,r.createElement)(s.FlexItem,null,(0,r.createElement)(s.SelectControl,{label:(0,f.__)("If","newsletter-optin-box"),hideLabelFromVision:!0,value:n||"allow",options:vt,onChange:function(e){return o("action",e)},size:"default",__nextHasNoMarginBottom:!0})),i&&(0,r.createElement)(r.Fragment,null,(0,r.createElement)(s.FlexItem,null,(0,r.createElement)(s.SelectControl,{label:(0,f.__)("all","newsletter-optin-box"),hideLabelFromVision:!0,value:t||"all",options:ht,onChange:function(e){return o("type",e)},size:"default",__nextHasNoMarginBottom:!0})),(0,r.createElement)(s.FlexBlock,null,(0,f.__)("of the following rules are true:","newsletter-optin-box"))))}function xt(e){var t,n=e.rule,a=e.comparisons,o=e.availableSmartTags,i=e.index,l=e.updateRule,u=e.removeRule,p=(0,r.useCallback)((function(e){return l(i,"value",e)}),[i,l]),d=(0,r.useCallback)((function(e){return l(i,"condition",e)}),[i,l]),m=(0,r.useCallback)((function(){return u(i)}),[i,u]),g=(0,r.useMemo)((function(){var e=n.type;if(void 0!==o[e])return o[e];var t,r=e.replace("_",".",1);if(void 0!==o[r])return o[r];for(var a=0,i=Object.entries(o);a> ").concat(t)}),[n.type,o]),b=_t((t=null==g?void 0:g.options,(0,r.useMemo)((function(){return t?Array.isArray(t)?t.map((function(e,t){return{label:e,value:t}})):Object.keys(t).map((function(e){return{label:t[e],value:e}})):[]}),[t])),(0,f.__)("Select a value","newsletter-optin-box")),v=b.length>1,h=(null==g?void 0:g.conditional_logic)||"string",_=_t((0,r.useMemo)((function(){var e=[];return Object.keys(a).forEach((function(t){var n=a[t].type;if(v){if("string"===h&&"is"!=t&&"is_not"!=t)return;if("is_empty"===t||"is_not_empty"===t||"is_between"===t)return}"any"!==n&&n!=h||e.push({label:a[t].name,value:t})})),e}),[h,a]),(0,f.__)("Select a comparison","newsletter-optin-box")),w="is_empty"===n.condition||"is_not_empty"===n.condition;return(0,r.createElement)(s.Flex,{className:"noptin-component__field-lg",wrap:!0,expanded:!0},(0,r.createElement)(s.FlexBlock,null,(0,r.createElement)(gt,bt({},function(e){if(["subscribed","active","yes","true","1"].includes(e))return{backgroundColor:"#78c67a",color:"#111111"};if(["unsubscribed","inactive","no","false","0"].includes(e))return{backgroundColor:"#fbcfbd",color:"#241c15"};if(["pending","waiting","maybe","2"].includes(e))return{backgroundColor:"#fbeeca",color:"#241c15"};var t=B(e,{saturation:[60,100],lightness:[30,45]});return{backgroundColor:t.color,color:t.isLight?"#111111":"#ffffff"}}(y)),y)),(0,r.createElement)(s.FlexBlock,null,(0,r.createElement)(s.Flex,{justify:"flex-end",wrap:!0},(0,r.createElement)(s.FlexItem,null,(0,r.createElement)(s.SelectControl,{label:(0,f.__)("Comparison","newsletter-optin-box"),hideLabelFromVision:!0,value:n.condition?n.condition:"is",options:_,onChange:d,size:"default",__nextHasNoMarginBottom:!0})),!w&&(0,r.createElement)(s.FlexBlock,null,v&&(0,r.createElement)(s.SelectControl,{label:(0,f.__)("Value","newsletter-optin-box"),hideLabelFromVision:!0,value:n.value?n.value:"",options:b,onChange:p,size:"default",__nextHasNoMarginBottom:!0}),!v&&(0,r.createElement)(s.TextControl,{type:"number"===h?"number":"text",label:(0,f.__)("Value","newsletter-optin-box"),hideLabelFromVision:!0,value:n.value?n.value:"",onChange:p,__nextHasNoMarginBottom:!0})),(0,r.createElement)(s.FlexItem,null,(0,r.createElement)(s.Button,{onClick:m,icon:"trash",variant:"tertiary",isDestructive:!0})))))}function Et(e){var t=e.rules,n=e.comparisons,a=e.availableSmartTags,o=e.setConditionalLogicAttribute,i=(0,r.useMemo)((function(){return Array.isArray(t)?t.filter((function(e){return e.type&&""!==e.type})):[]}),[a]),l=(0,r.useMemo)((function(){var e={};return a.forEach((function(t){t.conditional_logic&&(e[t.smart_tag]=bt(bt({},t),{},{key:t.smart_tag,type:t.conditional_logic}))})),e}),[a]),c=(0,r.useCallback)((function(e){var t=_(i);t.splice(e,1),o("rules",t)}),[i,o]),s=(0,r.useCallback)((function(e,t,n){var r=_(i);r[e][t]=n,o("rules",r)}),[i,o]),u=(0,r.useMemo)((function(){return Object.values(l)}),[l]),p=(0,r.useCallback)((function(e){var t=l[e],n=(null==t?void 0:t.options)||[],r=(null==t?void 0:t.placeholder)||"",a=Array.isArray(n)&&n.length?Object.keys(n)[0]:r;null!=t&&t.default&&(a=t.default);var c=_(i);c.push({type:e,condition:"is",value:a}),o("rules",c)}),[i]),d=i.length?(0,f.__)("Add a rule","newsletter-optin-box"):(0,f.__)("Add another rule","newsletter-optin-box"),m=Ft({availableSmartTags:u,onMergeTagClick:p,raw:!0,icon:"plus",label:d,text:d,toggleProps:{variant:"secondary"}});return(0,r.createElement)("div",{className:"noptin-conditional-logic-rules"},i.map((function(e,t){return(0,r.createElement)(xt,{key:t,rule:e,index:t,updateRule:s,removeRule:c,comparisons:n,availableSmartTags:l})})),m)}function Ot(n){var a=n.onChange,o=n.value,i=n.comparisons,l=n.toggleText,c=n.availableSmartTags,u=n.className;"object"!==e(o)&&(o={enabled:!1,action:"allow",rules:[{condition:"is",type:"date",value:""}],type:"all"});var p=function(e,n){a(bt(bt({},o),{},t({},e,n)))};return(0,r.createElement)("div",{className:u},(0,r.createElement)(s.ToggleControl,{checked:!!o.enabled,onChange:function(e){return p("enabled",e)},className:"noptin-component__field",label:l||(0,f.__)("Optionally enable/disable this trigger depending on specific conditions.","newsletter-optin-box"),__nextHasNoMarginBottom:!0}),o.enabled&&(0,r.createElement)(r.Fragment,null,(0,r.createElement)(wt,{ruleCount:Array.isArray(o.rules)?o.rules.length:0,type:o.type,action:o.action,setConditionalLogicAttribute:p}),(0,r.createElement)(Et,{rules:o.rules,comparisons:i,availableSmartTags:c,setConditionalLogicAttribute:p})))}var kt={"==":function(e,t){return e==t},"===":function(e,t){return e===t},"!=":function(e,t){return e!=t},"!==":function(e,t){return e!==t},">":function(e,t){return e>t},">=":function(e,t){return e>=t},"<":function(e,t){return e0&&(b=(0,r.createElement)(s.DropdownMenu,Mt({icon:u,label:d},m),(function(e){var t=e.onClose;return(0,r.createElement)(r.Fragment,null,Object.keys(g).map((function(e,n){return(0,r.createElement)(s.MenuGroup,{label:y>1?e:void 0,key:n},g[e].map((function(e){return(0,r.createElement)(s.MenuItem,{icon:e.icon||E,iconPosition:"left",onClick:function(){if(o){var n=l?e.smart_tag:"[[".concat((r=e).example?r.example:r.default?"".concat(r.smart_tag,' default="').concat(r.default,'"'):"".concat(r.smart_tag),"]]");o(n)}var r;t()},key:e.smart_tag},e.label)})))})))}))),b}function Rt(e){var t=e.setting,n=e.availableSmartTags,a=e.value,o=e.onChange,i=w(e,jt),l=(0,s.useBaseControlProps)(i),c=l.baseControlProps,u=l.controlProps;Array.isArray(a)||(a=[]);var p=(0,r.useCallback)((function(e){var t=e.item,i=e.index;return(0,r.createElement)(s.Flex,{className:"noptin-repeater-item",wrap:!0},Dt.map((function(e,l){return(0,r.createElement)(Bt,{key:l,availableSmartTags:n,field:e,value:void 0===t[e.id]?"":t[e.id],onChange:function(t){var n=_(a);n[i][e.id]=t,o(n)}})})),(0,r.createElement)(s.FlexItem,null,(0,r.createElement)(s.Button,{icon:"trash",variant:"tertiary",className:"noptin-component__field",label:(0,f.__)("Delete","noptin-addons-pack"),showTooltip:!0,onClick:function(){var e=_(a);e.splice(i,1),o(e)},isDestructive:!0})))}),[a,o]);return(0,r.createElement)(s.BaseControl,Mt({},c),(0,r.createElement)("div",Mt({},u),a.map((function(e,t){return(0,r.createElement)(p,{key:t,item:e,index:t})})),(0,r.createElement)(s.Button,{onClick:function(){var e=_(a);e.push({}),o(e)},variant:"secondary"},t.add_field?t.add_field:(0,f.__)("Add","newsletter-optin-box"))))}function Bt(e){var t=e.field,n=e.availableSmartTags,a=e.value,o=e.onChange,i=Ft({availableSmartTags:n,onMergeTagClick:(0,r.useCallback)((function(e){o&&o(a?"".concat(a," ").concat(e).trim():e)}),[a,o])});return(0,r.createElement)(s.FlexBlock,null,(0,r.createElement)(s.__experimentalInputControl,{label:t.label,type:t.type,value:a,placeholder:(0,f.sprintf)((0,f.__)("Enter %s","noptin-addons-pack"),t.label),className:"noptin-component__field noptin-condition-field",suffix:i,onChange:o,isPressEnterToChange:!0,__nextHasNoMarginBottom:!0,__next36pxDefaultSize:!0}))}function It(e){e.setting;var t=e.value,n=e.options,a=e.onChange,o=w(e,At),i=(0,s.useBaseControlProps)(o),l=i.baseControlProps,c=i.controlProps;return Array.isArray(t)||(t=[]),(0,r.createElement)(s.BaseControl,Mt({},l),(0,r.createElement)("div",Mt({},c),n.map((function(e,n){return(0,r.createElement)(s.CheckboxControl,{key:n,label:e.label,checked:t.includes(e.value),onChange:function(n){a(n?[].concat(_(t),[e.value]):t.filter((function(t){return t!==e.value})))}})}))))}function Lt(e){var n=e.settingKey,a=e.setting,o=e.availableSmartTags,i=e.prop,l=e.saved,c=e.setAttributes,u=(0,r.useCallback)((function(e){if(!i)return c(t({},n,e));var r=l[i]?l[i]:{},a=t({},i,Mt(Mt({},r),{},t({},n,e)));c(a)}),[n,i,l,c]);if(a.if||a.restrict){var p=a.restrict?a.restrict.split("."):a.if.split(".");if(!(2!==p.length||l[p[0]]&&l[p[0]][p[1]]))return null;if(1===p.length&&!l[p[0]])return null}if(Array.isArray(a.conditions)){var d=a.conditions.every((function(e){var t=e.key.split("."),n=e.operator?e.operator:"==",r=l[t[0]];return 2===t.length?r&&r[t[1]]&&St(e.value,n,r[t[1]]):St(e.value,n,r)}));if(!d)return null}if(a.condition&&!a.condition(l))return null;var m=l[n];i&&(m=l[i]?l[i][n]:void 0),(void 0===m||a.disabled)&&(m=a.default);var g=void 0!==m&&""!==m&&null!==m,y=[];a.options&&(y=Object.keys(a.options).map((function(e){return{label:a.options[e],value:e}})));var b=a.fullWidth?"noptin-component__field noptin-component__field-".concat(n):"noptin-component__field-lg noptin-component__field-".concat(n),v=a.description?(0,r.createElement)("span",{dangerouslySetInnerHTML:{__html:a.description}}):"",h={label:a.label,value:g?m:"",onChange:u,className:"".concat(b),help:v};return"select"===a.el?(y.unshift({label:a.placeholder?a.placeholder:(0,f.__)("Select an option","newsletter-optin-box"),value:"",disabled:!a.canSelectPlaceholder}),(0,r.createElement)(s.SelectControl,Mt(Mt({},h),{},{options:y,__nextHasNoMarginBottom:!0,__next36pxDefaultSize:!0}))):"form_token"===a.el?(0,r.createElement)(s.FormTokenField,Mt(Mt({},h),{},{value:Array.isArray(h.value)?h.value:[],suggestions:Array.isArray(a.suggestions)?a.suggestions:[],__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0})):"multi_checkbox"===a.el||"multi_checkbox_alt"===a.el?(0,r.createElement)(It,Mt(Mt({},h),{},{options:y})):"conditional_logic"===a.el?(0,r.createElement)(Ot,Mt(Mt({},h),{},{availableSmartTags:o,comparisons:a.comparisons,toggleText:a.toggle_text})):"input"===a.el?a.type&&["toggle","switch","checkbox","checkbox_alt"].includes(a.type)?(0,r.createElement)(s.ToggleControl,Mt(Mt({},h),{},{checked:!!g&&m,onChange:function(e){u(e)}})):(0,r.createElement)($t,Mt(Mt({},h),{},{setting:a,availableSmartTags:"trigger_settings"===i?[]:o,isPressEnterToChange:!a.isInputToChange})):"textarea"===a.el?(0,r.createElement)(s.TextareaControl,Mt(Mt({},h),{},{setting:a,placeholder:a.placeholder?a.placeholder:"",__nextHasNoMarginBottom:!0})):"paragraph"===a.el?(0,r.createElement)("div",{className:b},(0,r.createElement)(s.Tip,null,a.content)):"hero"===a.el?(0,r.createElement)("div",{className:b},(0,r.createElement)("h3",null,a.content)):"key_value_repeater"===a.el||"webhook_key_value_repeater"===a.el?(0,r.createElement)(Rt,Mt(Mt({},h),{},{setting:a,availableSmartTags:"trigger_settings"===i?[]:o})):n}const zt=(0,L.createContext)(null),Ht={didCatch:!1,error:null};class Ut extends L.Component{constructor(e){super(e),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=Ht}static getDerivedStateFromError(e){return{didCatch:!0,error:e}}resetErrorBoundary(){const{error:e}=this.state;if(null!==e){for(var t,n,r=arguments.length,a=new Array(r),o=0;o0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return e.length!==t.length||e.some(((e,n)=>!Object.is(e,t[n])))}(e.resetKeys,r)&&(null===(a=(o=this.props).onReset)||void 0===a||a.call(o,{next:r,prev:e.resetKeys,reason:"keys"}),this.setState(Ht))}render(){const{children:e,fallbackRender:t,FallbackComponent:n,fallback:r}=this.props,{didCatch:a,error:o}=this.state;let i=e;if(a){const e={error:o,resetErrorBoundary:this.resetErrorBoundary};if((0,L.isValidElement)(r))i=r;else if("function"==typeof t)i=t(e);else{if(!n)throw new Error("react-error-boundary requires either a fallback, fallbackRender, or FallbackComponent prop");i=(0,L.createElement)(n,e)}}return(0,L.createElement)(zt.Provider,{value:{didCatch:a,error:o,resetErrorBoundary:this.resetErrorBoundary}},i)}}function Vt(e){var t=e.error;return(0,r.createElement)(s.Notice,{status:"error",isDismissible:!1},(0,r.createElement)("strong",null,(0,f.__)("Error:","newsletter-optin-box"))," ",t.message)}function Gt(e){var t=e.children;return(0,r.createElement)(Ut,{FallbackComponent:Vt},t)}function Wt(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 qt(e){for(var n=1;n0);return(0,r.createElement)("h1",{className:"wp-heading-inline"},a&&(0,r.createElement)(r.Fragment,null,(0,r.createElement)("span",null,(0,f.__)("Edit Automation Rule","newsletter-optin-box")),(0,r.createElement)("a",{href:n,className:"page-title-action"},(0,f.__)("Add New","newsletter-optin-box"))),!a&&(0,r.createElement)("span",null,(0,f.__)("Add Automation Rule","newsletter-optin-box")))}function rn(e){var t=e.id,n=e.action,a=e.trigger,o=e.settings,i=e.smartTags,l=e.createNewUrl,u={action_id:n,trigger_id:a,action_settings:{},status:!0,trigger_settings:{}};(0,r.useEffect)((function(){o&&Object.values(o).forEach((function(e){["trigger_settings","action_settings"].includes(e.prop)&&e.settings&&Object.keys(e.settings).forEach((function(t){var n=e.settings[t];void 0!==n.default&&(u[e.prop][t]=n.default)}))}))}),[o]);var f=c((0,r.useState)(tn({},u)),2),d=f[0],m=f[1],g=c((0,r.useState)(!1),2),y=g[0],b=g[1],v=c((0,r.useState)(1),2),_=v[0],w=v[1],x=c((0,r.useState)(null),2),E=x[0],O=x[1],k=c((0,r.useState)(null),2),S=k[0],C=k[1],P=function(e,t){var n=[];return e?(Object.keys(e).forEach((function(r){var a=e[r];if(!a.conditions||a.conditions.every((function(e){if(Array.isArray(e.value))var n=e.value.some((function(n){return n==t[e.key]}));else n=e.value==t[e.key];return n===("is"===e.operator)}))){var o=r;a.label?o=a.label:a.description&&(o=a.description),n.push(tn(tn({},a),{},{smart_tag:r,label:o,example:a.example?a.example:"",description:a.description?a.description:"",placeholder:a.placeholder?a.placeholder:"",conditional_logic:!!a.conditional_logic&&a.conditional_logic,options:a.options?a.options:[]}))}})),n):n}(i,d.trigger_settings||{}),j=_>0;(0,r.useEffect)((function(){t>0?(w(_+1),O(null),C(null),p()({path:"/noptin/v1/automation_rules/".concat(t)}).then((function(e){e&&m(e)})).catch((function(e){m(null),O(e.message)})).finally((function(){w(_-1)}))):w(_-1)}),[t]);var A={opacity:j||y?.5:1,pointerEvents:j||y?"none":"auto"};return(0,r.createElement)("div",{className:"noptin-automation-rule__editor",style:A},(0,r.createElement)(Gt,null,(0,r.createElement)(s.SlotFillProvider,null,(0,r.createElement)(nn,{id:d.id,createNewUrl:l}),(0,r.createElement)(s.Flex,{wrap:!0,align:"top"},(0,r.createElement)(s.FlexBlock,{className:"noptin-es6-editor__main"},E&&(0,r.createElement)(s.Notice,{status:"error",onDismiss:function(){O(null)}},E),S&&(0,r.createElement)(s.Notice,{status:"success",onDismiss:function(){C(null)}},S),j&&(0,r.createElement)(s.Spinner,null),!j&&(0,r.createElement)(Yt,{settings:o,automationRule:d,setAutomationRule:m,availableSmartTags:P})),(0,r.createElement)(s.FlexItem,{className:"noptin-component-editor__sidebar"},(0,r.createElement)(h,{automationRule:d,setAutomationRule:m,setError:O,setSuccess:C,isSaving:y,setIsSaving:b}))),!j&&(0,r.createElement)(Qt,{availableSmartTags:P}))))}function an(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 on(e){for(var n=1;n{"use strict";var e={679:(e,t,n)=>{var r=n(296),a={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},o={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},i={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},l={};function c(e){return r.isMemo(e)?i:l[e.$$typeof]||a}l[r.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},l[r.Memo]=i;var s=Object.defineProperty,u=Object.getOwnPropertyNames,p=Object.getOwnPropertySymbols,f=Object.getOwnPropertyDescriptor,d=Object.getPrototypeOf,m=Object.prototype;e.exports=function e(t,n,r){if("string"!=typeof n){if(m){var a=d(n);a&&a!==m&&e(t,a,r)}var i=u(n);p&&(i=i.concat(p(n)));for(var l=c(t),g=c(n),y=0;y{var n="function"==typeof Symbol&&Symbol.for,r=n?Symbol.for("react.element"):60103,a=n?Symbol.for("react.portal"):60106,o=n?Symbol.for("react.fragment"):60107,i=n?Symbol.for("react.strict_mode"):60108,l=n?Symbol.for("react.profiler"):60114,c=n?Symbol.for("react.provider"):60109,s=n?Symbol.for("react.context"):60110,u=n?Symbol.for("react.async_mode"):60111,p=n?Symbol.for("react.concurrent_mode"):60111,f=n?Symbol.for("react.forward_ref"):60112,d=n?Symbol.for("react.suspense"):60113,m=n?Symbol.for("react.suspense_list"):60120,g=n?Symbol.for("react.memo"):60115,y=n?Symbol.for("react.lazy"):60116,b=n?Symbol.for("react.block"):60121,v=n?Symbol.for("react.fundamental"):60117,h=n?Symbol.for("react.responder"):60118,_=n?Symbol.for("react.scope"):60119;function w(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case r:switch(e=e.type){case u:case p:case o:case l:case i:case d:return e;default:switch(e=e&&e.$$typeof){case s:case f:case y:case g:case c:return e;default:return t}}case a:return t}}}function x(e){return w(e)===p}t.AsyncMode=u,t.ConcurrentMode=p,t.ContextConsumer=s,t.ContextProvider=c,t.Element=r,t.ForwardRef=f,t.Fragment=o,t.Lazy=y,t.Memo=g,t.Portal=a,t.Profiler=l,t.StrictMode=i,t.Suspense=d,t.isAsyncMode=function(e){return x(e)||w(e)===u},t.isConcurrentMode=x,t.isContextConsumer=function(e){return w(e)===s},t.isContextProvider=function(e){return w(e)===c},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===r},t.isForwardRef=function(e){return w(e)===f},t.isFragment=function(e){return w(e)===o},t.isLazy=function(e){return w(e)===y},t.isMemo=function(e){return w(e)===g},t.isPortal=function(e){return w(e)===a},t.isProfiler=function(e){return w(e)===l},t.isStrictMode=function(e){return w(e)===i},t.isSuspense=function(e){return w(e)===d},t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===o||e===p||e===l||e===i||e===d||e===m||"object"==typeof e&&null!==e&&(e.$$typeof===y||e.$$typeof===g||e.$$typeof===c||e.$$typeof===s||e.$$typeof===f||e.$$typeof===v||e.$$typeof===h||e.$$typeof===_||e.$$typeof===b)},t.typeOf=w},296:(e,t,n)=>{e.exports=n(103)}},t={};function n(r){var a=t[r];if(void 0!==a)return a.exports;var o=t[r]={exports:{}};return e[r](o,o.exports,n),o.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(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.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{function e(t){return e="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},e(t)}function t(t,n,r){return(n=function(t){var n=function(t,n){if("object"!==e(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var a=r.call(t,"string");if("object"!==e(a))return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"===e(n)?n:String(n)}(n))in t?Object.defineProperty(t,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[n]=r,t}const r=window.wp.element,a=window.wp.domReady;var o=n.n(a);function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0?"/noptin/v1/automation_rules/".concat(t.id):"/noptin/v1/automation_rules/",u=[{label:(0,f.__)("ID","newsletter-optin-box"),value:t.id?t.id:(0,f.__)("New","newsletter-optin-box")},{label:(0,f.__)("Status","newsletter-optin-box"),value:(0,r.createElement)(s.ToggleControl,{label:t.status?(0,f.__)("Active","newsletter-optin-box"):(0,f.__)("Inactive","newsletter-optin-box"),checked:!!t.status,className:"noptin-mb0",onChange:function(e){o(b(b({},t),{},{status:e}))},__nextHasNoMarginBottom:!0})}];return t.id>0&&(u.push({label:(0,f.__)("Times Run","newsletter-optin-box"),value:t.times_run},{label:(0,f.__)("Created at","newsletter-optin-box"),value:v(t.created_at)},{label:(0,f.__)("Updated at","newsletter-optin-box"),value:v(t.updated_at)}),Array.isArray(t.metadata)||Object.keys(t.metadata).forEach((function(e){"string"!=typeof t.metadata[e]&&"number"!=typeof t.metadata[e]||u.push({label:e,value:t.metadata[e]})}))),(0,r.createElement)(d,{title:(0,f.__)("Automation Rule","newsletter-optin-box")},(0,r.createElement)(s.CardBody,null,(0,r.createElement)(g,{items:u}),(0,r.createElement)(s.Button,{variant:"primary",onClick:function(){l(!0),n(null),a(null),p()({path:c,method:"POST",data:t}).then((function(e){return a((0,f.__)("Automation rule saved.","newsletter-optin-box")),o(b(b({},t),e)),e})).then((function(e){e.id>0&&window.history.replaceState({},"","?page=noptin-automation-rules&noptin_edit_automation_rule=".concat(e.id))})).catch((function(e){e.message?n(e.message):n((0,f.__)("An error occurred while saving.","newsletter-optin-box"))})).finally((function(){l(!1)}))},disabled:i,isPressed:i},!i&&(0,f.__)("Save Automation","newsletter-optin-box"),i&&(0,f.__)("Saving...","newsletter-optin-box"),i&&(0,r.createElement)(s.Spinner,null))))}function _(e){return function(e){if(Array.isArray(e))return i(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||l(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 w(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}const x=window.wp.primitives,E=(0,r.createElement)(x.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,r.createElement)(x.Path,{d:"M6.6 6L5.4 7l4.5 5-4.5 5 1.1 1 5.5-6-5.4-6zm6 0l-1.1 1 4.5 5-4.5 5 1.1 1 5.5-6-5.5-6z"}));var O=[0,100],k=[0,100],S=function(e){return"".concat(1===e.length?"0":"").concat(e)},C=function(e,t,n){return Math.max(Math.min(e,n),t)},P=function(e,t){return Math.floor(Math.random()*(t-e+1))+e},j=function e(t,n,r){for(var a=P(t,n),o=0;o<(null==r?void 0:r.length);o++){var i=r[o];if(2===(null==i?void 0:i.length)&&a>=i[0]&&a<=i[1])return e(t,n,r)}return a},A=function(e,t){return"number"==typeof t?t:e%Math.abs(t[1]-t[0])+t[0]},T=function(e,t){return"number"==typeof e?C.apply(void 0,[Math.abs(e)].concat(_(t))):1===e.length||e[0]===e[1]?C.apply(void 0,[Math.abs(e[0])].concat(_(t))):[Math.abs(C.apply(void 0,[e[0]].concat(_(t)))),C.apply(void 0,[Math.abs(e[1])].concat(_(t)))]},M=function(e,t,n){return n<0?n+=1:n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e},N=function(e,t,n){var r,a,o;if(e/=360,n/=100,0==(t/=100))r=a=o=n;else{var i=n<.5?n*(1+t):n+t-n*t,l=2*n-i;r=M(l,i,e+1/3),a=M(l,i,e),o=M(l,i,e-1/3)}return[Math.round(255*r),Math.round(255*a),Math.round(255*o)]},$=function(e,t,n,r){return(299*e+587*t+114*n)/1e3>=r},D=function(e,t,n){return"hsl(".concat(e,", ").concat(t,"%, ").concat(n,"%)")},F=function(e,t,n,r){return"rgb"===r?"rgb(".concat(e,", ").concat(t,", ").concat(n,")"):"#".concat(S(e.toString(16))).concat(S(t.toString(16))).concat(S(n.toString(16)))},R=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.format,r=void 0===n?"hex":n,a=t.saturation,o=void 0===a?[50,55]:a,i=t.lightness,l=void 0===i?[50,60]:i,s=t.differencePoint,u=void 0===s?130:s,p=Math.abs(function(e){for(var t=e.length,n=0,r=0;r0&&void 0!==arguments[0]?arguments[0]:{},t=e.format,n=void 0===t?"hex":t,r=e.saturation,a=void 0===r?[50,55]:r,o=e.lightness,i=void 0===o?[50,60]:o,l=e.differencePoint,s=void 0===l?130:l,u=e.excludeHue;a=T(a,O),i=T(i,k);var p=u?j(0,359,u):P(0,359),f="number"==typeof a?a:P.apply(void 0,_(a)),d="number"==typeof i?i:P.apply(void 0,_(i)),m=c(N(p,f,d),3),g=m[0],y=m[1],b=m[2];return{color:"hsl"===n?D(p,f,d):F(g,y,b,n),isLight:$(g,y,b,s)}};const I=R;function B(){return B=Object.assign?Object.assign.bind():function(e){for(var t=1;t0?J(le,--oe):0,re--,10===ie&&(re=1,ne--),ie}function pe(){return ie=oe2||ge(ie)>3?"":" "}function _e(e,t){for(;--t&&pe()&&!(ie<48||ie>102||ie>57&&ie<65||ie>70&&ie<97););return me(e,de()+(t<6&&32==fe()&&32==pe()))}function we(e){for(;pe();)switch(ie){case e:return oe;case 34:case 39:34!==e&&39!==e&&we(ie);break;case 40:41===e&&we(e);break;case 92:pe()}return oe}function xe(e,t){for(;pe()&&e+ie!==57&&(e+ie!==84||47!==fe()););return"/*"+me(t,oe-1)+"*"+G(47===e?e:pe())}function Ee(e){for(;!ge(fe());)pe();return me(e,oe)}var Oe="-ms-",ke="-moz-",Se="-webkit-",Ce="comm",Pe="rule",je="decl",Ae="@keyframes";function Te(e,t){for(var n="",r=ee(e),a=0;a0&&Q(E)-p&&te(d>32?Re(E+";",r,n,p-1):Re(X(E," ","")+";",r,n,p-2),c);break;case 59:E+=";";default:if(te(x=De(E,t,n,s,u,a,l,h,_=[],w=[],p),o),123===v)if(0===u)$e(E,t,x,x,_,o,p,l,w);else switch(99===f&&110===J(E,3)?100:f){case 100:case 108:case 109:case 115:$e(e,x,x,r&&te(De(e,x,x,0,0,a,l,h,a,_=[],p),w),a,w,p,l,r?_:w);break;default:$e(E,x,x,x,[""],w,0,l,w)}}s=u=d=0,g=b=1,h=E="",p=i;break;case 58:p=1+Q(E),d=m;default:if(g<1)if(123==v)--g;else if(125==v&&0==g++&&125==ue())continue;switch(E+=G(v),v*g){case 38:b=u>0?1:(E+="\f",-1);break;case 44:l[s++]=(Q(E)-1)*b,b=1;break;case 64:45===fe()&&(E+=ve(pe())),f=fe(),u=p=Q(h=E+=Ee(de())),v++;break;case 45:45===m&&2==Q(E)&&(g=0)}}return o}function De(e,t,n,r,a,o,i,l,c,s,u){for(var p=a-1,f=0===a?o:[""],d=ee(f),m=0,g=0,y=0;m0?f[b]+" "+v:X(v,/&\f/g,f[b])))&&(c[y++]=h);return ce(e,t,n,0===a?Pe:l,c,s,u)}function Fe(e,t,n){return ce(e,t,n,Ce,G(ie),Z(e,2,-2),0)}function Re(e,t,n,r){return ce(e,t,n,je,Z(e,0,r),Z(e,r+1,-1),r)}var Ie=function(e,t,n){for(var r=0,a=0;r=a,a=fe(),38===r&&12===a&&(t[n]=1),!ge(a);)pe();return me(e,oe)},Be=new WeakMap,Le=function(e){if("rule"===e.type&&e.parent&&!(e.length<1)){for(var t=e.value,n=e.parent,r=e.column===n.column&&e.line===n.line;"rule"!==n.type;)if(!(n=n.parent))return;if((1!==e.props.length||58===t.charCodeAt(0)||Be.get(n))&&!r){Be.set(e,!0);for(var a=[],o=function(e,t){return be(function(e,t){var n=-1,r=44;do{switch(ge(r)){case 0:38===r&&12===fe()&&(t[n]=1),e[n]+=Ie(oe-1,t,n);break;case 2:e[n]+=ve(r);break;case 4:if(44===r){e[++n]=58===fe()?"&\f":"",t[n]=e[n].length;break}default:e[n]+=G(r)}}while(r=pe());return e}(ye(e),t))}(t,a),i=n.props,l=0,c=0;l6)switch(J(e,t+1)){case 109:if(45!==J(e,t+4))break;case 102:return X(e,/(.+:)(.+)-([^]+)/,"$1"+Se+"$2-$3$1"+ke+(108==J(e,t+3)?"$3":"$2-$3"))+e;case 115:return~Y(e,"stretch")?He(X(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(115!==J(e,t+1))break;case 6444:switch(J(e,Q(e)-3-(~Y(e,"!important")&&10))){case 107:return X(e,":",":"+Se)+e;case 101:return X(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+Se+(45===J(e,14)?"inline-":"")+"box$3$1"+Se+"$2$3$1"+Oe+"$2box$3")+e}break;case 5936:switch(J(e,t+11)){case 114:return Se+e+Oe+X(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return Se+e+Oe+X(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return Se+e+Oe+X(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return Se+e+Oe+e+e}return e}var Ue=[function(e,t,n,r){if(e.length>-1&&!e.return)switch(e.type){case je:e.return=He(e.value,e.length);break;case Ae:return Te([se(e,{value:X(e.value,"@","@"+Se)})],r);case Pe:if(e.length)return function(e,t){return e.map(t).join("")}(e.props,(function(t){switch(function(e,t){return(e=/(::plac\w+|:read-\w+)/.exec(e))?e[0]:e}(t)){case":read-only":case":read-write":return Te([se(e,{props:[X(t,/:(read-\w+)/,":-moz-$1")]})],r);case"::placeholder":return Te([se(e,{props:[X(t,/:(plac\w+)/,":"+Se+"input-$1")]}),se(e,{props:[X(t,/:(plac\w+)/,":-moz-$1")]}),se(e,{props:[X(t,/:(plac\w+)/,Oe+"input-$1")]})],r)}return""}))}}],Ve=function(e){var t=e.key;if("css"===t){var n=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(n,(function(e){-1!==e.getAttribute("data-emotion").indexOf(" ")&&(document.head.appendChild(e),e.setAttribute("data-s",""))}))}var r,a,o=e.stylisPlugins||Ue,i={},l=[];r=e.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+t+' "]'),(function(e){for(var t=e.getAttribute("data-emotion").split(" "),n=1;n=4;++r,a-=4)t=1540483477*(65535&(t=255&e.charCodeAt(r)|(255&e.charCodeAt(++r))<<8|(255&e.charCodeAt(++r))<<16|(255&e.charCodeAt(++r))<<24))+(59797*(t>>>16)<<16),n=1540483477*(65535&(t^=t>>>24))+(59797*(t>>>16)<<16)^1540483477*(65535&n)+(59797*(n>>>16)<<16);switch(a){case 3:n^=(255&e.charCodeAt(r+2))<<16;case 2:n^=(255&e.charCodeAt(r+1))<<8;case 1:n=1540483477*(65535&(n^=255&e.charCodeAt(r)))+(59797*(n>>>16)<<16)}return(((n=1540483477*(65535&(n^=n>>>13))+(59797*(n>>>16)<<16))^n>>>15)>>>0).toString(36)}(a)+c;return{name:s,styles:a,next:Qe}},nt=!!L.useInsertionEffect&&L.useInsertionEffect,rt=nt||function(e){return e()},at=(nt||L.useLayoutEffect,L.createContext("undefined"!=typeof HTMLElement?Ve({key:"css"}):null));at.Provider;var ot=L.createContext({}),it=function(e,t,n){var r=e.key+"-"+t.name;!1===n&&void 0===e.registered[r]&&(e.registered[r]=t.styles)},lt=U,ct=function(e){return"theme"!==e},st=function(e){return"string"==typeof e&&e.charCodeAt(0)>96?lt:ct},ut=function(e,t,n){var r;if(t){var a=t.shouldForwardProp;r=e.__emotion_forwardProp&&a?function(t){return e.__emotion_forwardProp(t)&&a(t)}:a}return"function"!=typeof r&&n&&(r=e.__emotion_forwardProp),r},pt=function(e){var t=e.cache,n=e.serialized,r=e.isStringTag;return it(t,n,r),rt((function(){return function(e,t,n){it(e,t,n);var r=e.key+"-"+t.name;if(void 0===e.inserted[t.name]){var a=t;do{e.insert(t===a?"."+r:"",a,e.sheet,!0),a=a.next}while(void 0!==a)}}(t,n,r)})),null},ft=function e(t,n){var r,a,o=t.__emotion_real===t,i=o&&t.__emotion_base||t;void 0!==n&&(r=n.label,a=n.target);var l=ut(t,n,o),c=l||st(i),s=!c("as");return function(){var u=arguments,p=o&&void 0!==t.__emotion_styles?t.__emotion_styles.slice(0):[];if(void 0!==r&&p.push("label:"+r+";"),null==u[0]||void 0===u[0].raw)p.push.apply(p,u);else{p.push(u[0][0]);for(var f=u.length,d=1;d1;return(0,r.createElement)(s.Flex,{className:"noptin-component__field-lg",wrap:!0},(0,r.createElement)(s.FlexItem,null,(0,r.createElement)(s.SelectControl,{label:(0,f.__)("If","newsletter-optin-box"),hideLabelFromVision:!0,value:n||"allow",options:vt,onChange:function(e){return o("action",e)},size:"default",__nextHasNoMarginBottom:!0})),i&&(0,r.createElement)(r.Fragment,null,(0,r.createElement)(s.FlexItem,null,(0,r.createElement)(s.SelectControl,{label:(0,f.__)("all","newsletter-optin-box"),hideLabelFromVision:!0,value:t||"all",options:ht,onChange:function(e){return o("type",e)},size:"default",__nextHasNoMarginBottom:!0})),(0,r.createElement)(s.FlexBlock,null,(0,f.__)("of the following rules are true:","newsletter-optin-box"))))}function xt(e){var t,n=e.rule,a=e.comparisons,o=e.availableSmartTags,i=e.index,l=e.updateRule,u=e.removeRule,p=(0,r.useCallback)((function(e){return l(i,"value",e)}),[i,l]),d=(0,r.useCallback)((function(e){return l(i,"condition",e)}),[i,l]),m=(0,r.useCallback)((function(){return u(i)}),[i,u]),g=(0,r.useMemo)((function(){var e=n.type;if(void 0!==o[e])return o[e];var t,r=e.replace("_",".",1);if(void 0!==o[r])return o[r];for(var a=0,i=Object.entries(o);a> ").concat(t)}),[n.type,o]),b=_t((t=null==g?void 0:g.options,(0,r.useMemo)((function(){return t?Array.isArray(t)?t.map((function(e,t){return{label:e,value:t}})):Object.keys(t).map((function(e){return{label:t[e],value:e}})):[]}),[t])),(0,f.__)("Select a value","newsletter-optin-box")),v=b.length>1,h=(null==g?void 0:g.conditional_logic)||"string",_=_t((0,r.useMemo)((function(){var e=[];return Object.keys(a).forEach((function(t){var n=a[t].type;if(v){if("string"===h&&"is"!=t&&"is_not"!=t)return;if("is_empty"===t||"is_not_empty"===t||"is_between"===t)return}"any"!==n&&n!=h||e.push({label:a[t].name,value:t})})),e}),[h,a]),(0,f.__)("Select a comparison","newsletter-optin-box")),w="is_empty"===n.condition||"is_not_empty"===n.condition;return(0,r.createElement)(s.Flex,{className:"noptin-component__field-lg",wrap:!0,expanded:!0},(0,r.createElement)(s.FlexBlock,null,(0,r.createElement)(gt,bt({},function(e){if(["subscribed","active","yes","true","1"].includes(e))return{backgroundColor:"#78c67a",color:"#111111"};if(["unsubscribed","inactive","no","false","0"].includes(e))return{backgroundColor:"#fbcfbd",color:"#241c15"};if(["pending","waiting","maybe","2"].includes(e))return{backgroundColor:"#fbeeca",color:"#241c15"};var t=I(e,{saturation:[60,100],lightness:[30,45]});return{backgroundColor:t.color,color:t.isLight?"#111111":"#ffffff"}}(y)),y)),(0,r.createElement)(s.FlexBlock,null,(0,r.createElement)(s.Flex,{justify:"flex-end",wrap:!0},(0,r.createElement)(s.FlexItem,null,(0,r.createElement)(s.SelectControl,{label:(0,f.__)("Comparison","newsletter-optin-box"),hideLabelFromVision:!0,value:n.condition?n.condition:"is",options:_,onChange:d,size:"default",__nextHasNoMarginBottom:!0})),!w&&(0,r.createElement)(s.FlexBlock,null,v&&(0,r.createElement)(s.SelectControl,{label:(0,f.__)("Value","newsletter-optin-box"),hideLabelFromVision:!0,value:n.value?n.value:"",options:b,onChange:p,size:"default",__nextHasNoMarginBottom:!0}),!v&&(0,r.createElement)(s.TextControl,{type:"number"===h?"number":"text",label:(0,f.__)("Value","newsletter-optin-box"),hideLabelFromVision:!0,value:n.value?n.value:"",onChange:p,__nextHasNoMarginBottom:!0})),(0,r.createElement)(s.FlexItem,null,(0,r.createElement)(s.Button,{onClick:m,icon:"trash",variant:"tertiary",isDestructive:!0})))))}function Et(e){var t=e.rules,n=e.comparisons,a=e.availableSmartTags,o=e.setConditionalLogicAttribute,i=(0,r.useMemo)((function(){return Array.isArray(t)?t.filter((function(e){return e.type&&""!==e.type})):[]}),[a]),l=(0,r.useMemo)((function(){var e={};return a.forEach((function(t){t.conditional_logic&&(e[t.smart_tag]=bt(bt({},t),{},{key:t.smart_tag,type:t.conditional_logic}))})),e}),[a]),c=(0,r.useCallback)((function(e){var t=_(i);t.splice(e,1),o("rules",t)}),[i,o]),s=(0,r.useCallback)((function(e,t,n){var r=_(i);r[e][t]=n,o("rules",r)}),[i,o]),u=(0,r.useMemo)((function(){return Object.values(l)}),[l]),p=(0,r.useCallback)((function(e){var t=l[e],n=(null==t?void 0:t.options)||[],r=(null==t?void 0:t.placeholder)||"",a=Array.isArray(n)&&n.length?Object.keys(n)[0]:r;null!=t&&t.default&&(a=t.default);var c=_(i);c.push({type:e,condition:"is",value:a}),o("rules",c)}),[i]),d=i.length?(0,f.__)("Add a rule","newsletter-optin-box"):(0,f.__)("Add another rule","newsletter-optin-box"),m=Ft({availableSmartTags:u,onMergeTagClick:p,raw:!0,icon:"plus",label:d,text:d,toggleProps:{variant:"secondary"}});return(0,r.createElement)("div",{className:"noptin-conditional-logic-rules"},i.map((function(e,t){return(0,r.createElement)(xt,{key:t,rule:e,index:t,updateRule:s,removeRule:c,comparisons:n,availableSmartTags:l})})),m)}function Ot(n){var a=n.onChange,o=n.value,i=n.comparisons,l=n.toggleText,c=n.availableSmartTags,u=n.className;"object"!==e(o)&&(o={enabled:!1,action:"allow",rules:[{condition:"is",type:"date",value:""}],type:"all"});var p=function(e,n){a(bt(bt({},o),{},t({},e,n)))};return(0,r.createElement)("div",{className:u},(0,r.createElement)(s.ToggleControl,{checked:!!o.enabled,onChange:function(e){return p("enabled",e)},className:"noptin-component__field",label:l||(0,f.__)("Optionally enable/disable this trigger depending on specific conditions.","newsletter-optin-box"),__nextHasNoMarginBottom:!0}),o.enabled&&(0,r.createElement)(r.Fragment,null,(0,r.createElement)(wt,{ruleCount:Array.isArray(o.rules)?o.rules.length:0,type:o.type,action:o.action,setConditionalLogicAttribute:p}),(0,r.createElement)(Et,{rules:o.rules,comparisons:i,availableSmartTags:c,setConditionalLogicAttribute:p})))}var kt={"==":function(e,t){return e==t},"===":function(e,t){return e===t},"!=":function(e,t){return e!=t},"!==":function(e,t){return e!==t},">":function(e,t){return e>t},">=":function(e,t){return e>=t},"<":function(e,t){return e0&&(b=(0,r.createElement)(s.DropdownMenu,Mt({icon:u,label:d},m),(function(e){var t=e.onClose;return(0,r.createElement)(r.Fragment,null,Object.keys(g).map((function(e,n){return(0,r.createElement)(s.MenuGroup,{label:y>1?e:void 0,key:n},g[e].map((function(e){return(0,r.createElement)(s.MenuItem,{icon:e.icon||E,iconPosition:"left",onClick:function(){if(o){var n=l?e.smart_tag:"[[".concat((r=e).example?r.example:r.default?"".concat(r.smart_tag,' default="').concat(r.default,'"'):"".concat(r.smart_tag),"]]");o(n)}var r;t()},key:e.smart_tag},e.label)})))})))}))),b}function Rt(e){var t=e.setting,n=e.availableSmartTags,a=e.value,o=e.onChange,i=w(e,jt),l=(0,s.useBaseControlProps)(i),c=l.baseControlProps,u=l.controlProps;Array.isArray(a)||(a=[]);var p=(0,r.useCallback)((function(e){var t=e.item,i=e.index;return(0,r.createElement)(s.Flex,{className:"noptin-repeater-item",wrap:!0},Dt.map((function(e,l){return(0,r.createElement)(It,{key:l,availableSmartTags:n,field:e,value:void 0===t[e.id]?"":t[e.id],onChange:function(t){var n=_(a);n[i][e.id]=t,o(n)}})})),(0,r.createElement)(s.FlexItem,null,(0,r.createElement)(s.Button,{icon:"trash",variant:"tertiary",className:"noptin-component__field",label:(0,f.__)("Delete","noptin-addons-pack"),showTooltip:!0,onClick:function(){var e=_(a);e.splice(i,1),o(e)},isDestructive:!0})))}),[a,o]);return(0,r.createElement)(s.BaseControl,Mt({},c),(0,r.createElement)("div",Mt({},u),a.map((function(e,t){return(0,r.createElement)(p,{key:t,item:e,index:t})})),(0,r.createElement)(s.Button,{onClick:function(){var e=_(a);e.push({}),o(e)},variant:"secondary"},t.add_field?t.add_field:(0,f.__)("Add","newsletter-optin-box"))))}function It(e){var t=e.field,n=e.availableSmartTags,a=e.value,o=e.onChange,i=Ft({availableSmartTags:n,onMergeTagClick:(0,r.useCallback)((function(e){o&&o(a?"".concat(a," ").concat(e).trim():e)}),[a,o])});return(0,r.createElement)(s.FlexBlock,null,(0,r.createElement)(s.__experimentalInputControl,{label:t.label,type:t.type,value:a,placeholder:(0,f.sprintf)((0,f.__)("Enter %s","noptin-addons-pack"),t.label),className:"noptin-component__field noptin-condition-field",suffix:i,onChange:o,isPressEnterToChange:!0,__nextHasNoMarginBottom:!0,__next36pxDefaultSize:!0}))}function Bt(e){e.setting;var t=e.value,n=e.options,a=e.onChange,o=w(e,At),i=(0,s.useBaseControlProps)(o),l=i.baseControlProps,c=i.controlProps;return Array.isArray(t)||(t=[]),(0,r.createElement)(s.BaseControl,Mt({},l),(0,r.createElement)("div",Mt({},c),n.map((function(e,n){return(0,r.createElement)(s.CheckboxControl,{key:n,label:e.label,checked:t.includes(e.value),onChange:function(n){a(n?[].concat(_(t),[e.value]):t.filter((function(t){return t!==e.value})))}})}))))}function Lt(e){var n=e.settingKey,a=e.setting,o=e.availableSmartTags,i=e.prop,l=e.saved,c=e.setAttributes,u=(0,r.useCallback)((function(e){if(!i)return c(t({},n,e));var r=l[i]?l[i]:{},a=t({},i,Mt(Mt({},r),{},t({},n,e)));c(a)}),[n,i,l,c]);if(a.if||a.restrict){var p=a.restrict?a.restrict.split("."):a.if.split(".");if(!(2!==p.length||l[p[0]]&&l[p[0]][p[1]]))return null;if(1===p.length&&!l[p[0]])return null}if(Array.isArray(a.conditions)){var d=a.conditions.every((function(e){var t=e.key.split("."),n=e.operator?e.operator:"==",r=l[t[0]];return 2===t.length?r&&r[t[1]]&&St(e.value,n,r[t[1]]):St(e.value,n,r)}));if(!d)return null}if(a.condition&&!a.condition(l))return null;var m=l[n];i&&(m=l[i]?l[i][n]:void 0),(void 0===m||a.disabled)&&(m=a.default);var g=void 0!==m&&""!==m&&null!==m,y=[];a.options&&(y=Object.keys(a.options).map((function(e){return{label:a.options[e],value:e}})));var b=a.fullWidth?"noptin-component__field noptin-component__field-".concat(n):"noptin-component__field-lg noptin-component__field-".concat(n),v=a.description?(0,r.createElement)("span",{dangerouslySetInnerHTML:{__html:a.description}}):"",h=a.customAttributes?a.customAttributes:{},_=Mt({label:a.label,value:g?m:"",onChange:u,className:"".concat(b),help:v},h);return"select"===a.el?(y.unshift({label:a.placeholder?a.placeholder:(0,f.__)("Select an option","newsletter-optin-box"),value:"",disabled:!a.canSelectPlaceholder}),(0,r.createElement)(s.SelectControl,Mt(Mt({},_),{},{options:y,__nextHasNoMarginBottom:!0,__next36pxDefaultSize:!0}))):"form_token"===a.el?(0,r.createElement)(s.FormTokenField,Mt(Mt({},_),{},{value:Array.isArray(_.value)?_.value:[],suggestions:Array.isArray(a.suggestions)?a.suggestions:[],__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0})):"multi_checkbox"===a.el||"multi_checkbox_alt"===a.el?(0,r.createElement)(Bt,Mt(Mt({},_),{},{options:y})):"conditional_logic"===a.el?(0,r.createElement)(Ot,Mt(Mt({},_),{},{availableSmartTags:o,comparisons:a.comparisons,toggleText:a.toggle_text})):"input"===a.el?a.type&&["toggle","switch","checkbox","checkbox_alt"].includes(a.type)?(0,r.createElement)(s.ToggleControl,Mt(Mt({},_),{},{checked:!!g&&m,onChange:function(e){u(e)}})):(0,r.createElement)($t,Mt(Mt({},_),{},{setting:a,availableSmartTags:"trigger_settings"===i?[]:o,isPressEnterToChange:!a.isInputToChange})):"textarea"===a.el?(0,r.createElement)(s.TextareaControl,Mt(Mt({},_),{},{setting:a,placeholder:a.placeholder?a.placeholder:"",__nextHasNoMarginBottom:!0})):"paragraph"===a.el?(0,r.createElement)("div",{className:b},(0,r.createElement)(s.Tip,null,a.content)):"hero"===a.el?(0,r.createElement)("div",{className:b},(0,r.createElement)("h3",null,a.content)):"key_value_repeater"===a.el||"webhook_key_value_repeater"===a.el?(0,r.createElement)(Rt,Mt(Mt({},_),{},{setting:a,availableSmartTags:"trigger_settings"===i?[]:o})):n}const zt=(0,L.createContext)(null),Ht={didCatch:!1,error:null};class Ut extends L.Component{constructor(e){super(e),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=Ht}static getDerivedStateFromError(e){return{didCatch:!0,error:e}}resetErrorBoundary(){const{error:e}=this.state;if(null!==e){for(var t,n,r=arguments.length,a=new Array(r),o=0;o0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return e.length!==t.length||e.some(((e,n)=>!Object.is(e,t[n])))}(e.resetKeys,r)&&(null===(a=(o=this.props).onReset)||void 0===a||a.call(o,{next:r,prev:e.resetKeys,reason:"keys"}),this.setState(Ht))}render(){const{children:e,fallbackRender:t,FallbackComponent:n,fallback:r}=this.props,{didCatch:a,error:o}=this.state;let i=e;if(a){const e={error:o,resetErrorBoundary:this.resetErrorBoundary};if((0,L.isValidElement)(r))i=r;else if("function"==typeof t)i=t(e);else{if(!n)throw new Error("react-error-boundary requires either a fallback, fallbackRender, or FallbackComponent prop");i=(0,L.createElement)(n,e)}}return(0,L.createElement)(zt.Provider,{value:{didCatch:a,error:o,resetErrorBoundary:this.resetErrorBoundary}},i)}}function Vt(e){var t=e.error;return(0,r.createElement)(s.Notice,{status:"error",isDismissible:!1},(0,r.createElement)("strong",null,(0,f.__)("Error:","newsletter-optin-box"))," ",t.message)}function Wt(e){var t=e.children;return(0,r.createElement)(Ut,{FallbackComponent:Vt},t)}function Gt(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 qt(e){for(var n=1;n0);return(0,r.createElement)("h1",{className:"wp-heading-inline"},a&&(0,r.createElement)(r.Fragment,null,(0,r.createElement)("span",null,(0,f.__)("Edit Automation Rule","newsletter-optin-box")),(0,r.createElement)("a",{href:n,className:"page-title-action"},(0,f.__)("Add New","newsletter-optin-box"))),!a&&(0,r.createElement)("span",null,(0,f.__)("Add Automation Rule","newsletter-optin-box")))}function rn(e){var t=e.id,n=e.action,a=e.trigger,o=e.settings,i=e.smartTags,l=e.createNewUrl,u={action_id:n,trigger_id:a,action_settings:{},status:!0,trigger_settings:{}};(0,r.useEffect)((function(){o&&Object.values(o).forEach((function(e){["trigger_settings","action_settings"].includes(e.prop)&&e.settings&&Object.keys(e.settings).forEach((function(t){var n=e.settings[t];void 0!==n.default&&(u[e.prop][t]=n.default)}))}))}),[o]);var f=c((0,r.useState)(tn({},u)),2),d=f[0],m=f[1],g=c((0,r.useState)(!1),2),y=g[0],b=g[1],v=c((0,r.useState)(1),2),_=v[0],w=v[1],x=c((0,r.useState)(null),2),E=x[0],O=x[1],k=c((0,r.useState)(null),2),S=k[0],C=k[1],P=function(e,t){var n=[];return e?(Object.keys(e).forEach((function(r){var a=e[r];if(!a.conditions||a.conditions.every((function(e){if(Array.isArray(e.value))var n=e.value.some((function(n){return n==t[e.key]}));else n=e.value==t[e.key];return n===("is"===e.operator)}))){var o=r;a.label?o=a.label:a.description&&(o=a.description),n.push(tn(tn({},a),{},{smart_tag:r,label:o,example:a.example?a.example:"",description:a.description?a.description:"",placeholder:a.placeholder?a.placeholder:"",conditional_logic:!!a.conditional_logic&&a.conditional_logic,options:a.options?a.options:[]}))}})),n):n}(i,d.trigger_settings||{}),j=_>0;(0,r.useEffect)((function(){t>0?(w(_+1),O(null),C(null),p()({path:"/noptin/v1/automation_rules/".concat(t)}).then((function(e){e&&m(e)})).catch((function(e){m(null),O(e.message)})).finally((function(){w(_-1)}))):w(_-1)}),[t]);var A={opacity:j||y?.5:1,pointerEvents:j||y?"none":"auto"};return(0,r.createElement)("div",{className:"noptin-automation-rule__editor",style:A},(0,r.createElement)(Wt,null,(0,r.createElement)(s.SlotFillProvider,null,(0,r.createElement)(nn,{id:d.id,createNewUrl:l}),(0,r.createElement)(s.Flex,{wrap:!0,align:"top"},(0,r.createElement)(s.FlexBlock,{className:"noptin-es6-editor__main"},E&&(0,r.createElement)(s.Notice,{status:"error",onDismiss:function(){O(null)}},E),S&&(0,r.createElement)(s.Notice,{status:"success",onDismiss:function(){C(null)}},S),j&&(0,r.createElement)(s.Spinner,null),!j&&(0,r.createElement)(Yt,{settings:o,automationRule:d,setAutomationRule:m,availableSmartTags:P})),(0,r.createElement)(s.FlexItem,{className:"noptin-component-editor__sidebar"},(0,r.createElement)(h,{automationRule:d,setAutomationRule:m,setError:O,setSuccess:C,isSaving:y,setIsSaving:b}))),!j&&(0,r.createElement)(Qt,{availableSmartTags:P}))))}function an(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 on(e){for(var n=1;n array('react', 'wp-api-fetch', 'wp-components', 'wp-dom-ready', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => 'bad418e814cff2fa9b92'); + array('react', 'wp-api-fetch', 'wp-components', 'wp-dom-ready', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => '1be426678f7ea9720583'); diff --git a/includes/assets/js/dist/edit-email-campaign.js b/includes/assets/js/dist/edit-email-campaign.js index 58e5648a..55d7087b 100644 --- a/includes/assets/js/dist/edit-email-campaign.js +++ b/includes/assets/js/dist/edit-email-campaign.js @@ -1,2 +1,2 @@ /*! For license information please see edit-email-campaign.js.LICENSE.txt */ -(()=>{"use strict";var e={249:(e,t,n)=>{n.d(t,{Z:()=>r});const r={initial_form:null,init:function(){var e=jQuery;e(".noptin-send-test-email").on("click",this.send_test_email),e(".noptin-filter-recipients").on("click",this.filter_recipients),e(".noptin-filter-post-notifications-post-types").on("click",this.new_post_notifications_filter_post_types),e(".noptin-filter-post-notifications-taxonomies").on("click",this.new_post_notifications_filter_taxonomies),e(".noptin-stop-campaign").on("click",this.stop_campaign)},stop_campaign:function(e){e.preventDefault();var t={id:jQuery(this).data("id"),_wpnonce:noptin_params.nonce,action:"noptin_stop_campaign"};Swal.fire({titleText:"Are you sure?",text:"This campaign will stop sending and be reverted to draft status.",type:"warning",showCancelButton:!0,confirmButtonColor:"#d33",cancelButtonColor:"#9e9e9e",confirmButtonText:"Yes, stop it!",showLoaderOnConfirm:!0,showCloseButton:!0,focusConfirm:!1,allowOutsideClick:function(){return!Swal.isLoading()},preConfirm:function(){return jQuery.get(noptin_params.ajaxurl,t).done((function(){window.location=window.location,Swal.fire("Success","Your campaign was reverted to draft","success")})).fail((function(){Swal.fire("Error","Unable to stop your campaign. Try again.","error")})),jQuery.Deferred()}})},send_test_email:function(e){e.preventDefault(),tinyMCE.triggerSave();var t=jQuery(this).closest("form").serialize();Swal.fire({titleText:"Send a test email to:",showCancelButton:!0,confirmButtonColor:"#3085d6",cancelButtonColor:"#d33",confirmButtonText:"Send",showLoaderOnConfirm:!0,showCloseButton:!0,input:"email",inputValue:noptin_params.admin_email,inputPlaceholder:noptin_params.admin_email,allowOutsideClick:function(){return!Swal.isLoading()},preConfirm:function(e){return t+="&email="+e,t+="&action=noptin_send_test_email",jQuery.post(noptin_params.ajaxurl,t).done((function(e){e.success?Swal.fire("Success",e.data,"success"):Swal.fire({type:"error",title:"Error!",text:e.data,showCloseButton:!0,confirmButtonText:"Close",confirmButtonColor:"#9e9e9e",footer:'How to troubleshoot this error.'})})).fail((function(e){Swal.fire({type:"error",title:"Unable to connect",text:"This might be a problem with your server or your internet connection",showCloseButton:!0,confirmButtonText:"Close",confirmButtonColor:"#9e9e9e",footer:"Status: ".concat(e.status,"   Status text: ").concat(e.statusText,"")})})),jQuery.Deferred()}})}}},679:(e,t,n)=>{var r=n(296),o={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},a={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},i={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},l={};function c(e){return r.isMemo(e)?i:l[e.$$typeof]||o}l[r.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},l[r.Memo]=i;var s=Object.defineProperty,u=Object.getOwnPropertyNames,p=Object.getOwnPropertySymbols,f=Object.getOwnPropertyDescriptor,d=Object.getPrototypeOf,m=Object.prototype;e.exports=function e(t,n,r){if("string"!=typeof n){if(m){var o=d(n);o&&o!==m&&e(t,o,r)}var i=u(n);p&&(i=i.concat(p(n)));for(var l=c(t),g=c(n),h=0;h{var n="function"==typeof Symbol&&Symbol.for,r=n?Symbol.for("react.element"):60103,o=n?Symbol.for("react.portal"):60106,a=n?Symbol.for("react.fragment"):60107,i=n?Symbol.for("react.strict_mode"):60108,l=n?Symbol.for("react.profiler"):60114,c=n?Symbol.for("react.provider"):60109,s=n?Symbol.for("react.context"):60110,u=n?Symbol.for("react.async_mode"):60111,p=n?Symbol.for("react.concurrent_mode"):60111,f=n?Symbol.for("react.forward_ref"):60112,d=n?Symbol.for("react.suspense"):60113,m=n?Symbol.for("react.suspense_list"):60120,g=n?Symbol.for("react.memo"):60115,h=n?Symbol.for("react.lazy"):60116,y=n?Symbol.for("react.block"):60121,v=n?Symbol.for("react.fundamental"):60117,b=n?Symbol.for("react.responder"):60118,w=n?Symbol.for("react.scope"):60119;function _(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case r:switch(e=e.type){case u:case p:case a:case l:case i:case d:return e;default:switch(e=e&&e.$$typeof){case s:case f:case h:case g:case c:return e;default:return t}}case o:return t}}}function x(e){return _(e)===p}t.AsyncMode=u,t.ConcurrentMode=p,t.ContextConsumer=s,t.ContextProvider=c,t.Element=r,t.ForwardRef=f,t.Fragment=a,t.Lazy=h,t.Memo=g,t.Portal=o,t.Profiler=l,t.StrictMode=i,t.Suspense=d,t.isAsyncMode=function(e){return x(e)||_(e)===u},t.isConcurrentMode=x,t.isContextConsumer=function(e){return _(e)===s},t.isContextProvider=function(e){return _(e)===c},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===r},t.isForwardRef=function(e){return _(e)===f},t.isFragment=function(e){return _(e)===a},t.isLazy=function(e){return _(e)===h},t.isMemo=function(e){return _(e)===g},t.isPortal=function(e){return _(e)===o},t.isProfiler=function(e){return _(e)===l},t.isStrictMode=function(e){return _(e)===i},t.isSuspense=function(e){return _(e)===d},t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===a||e===p||e===l||e===i||e===d||e===m||"object"==typeof e&&null!==e&&(e.$$typeof===h||e.$$typeof===g||e.$$typeof===c||e.$$typeof===s||e.$$typeof===f||e.$$typeof===v||e.$$typeof===b||e.$$typeof===w||e.$$typeof===y)},t.typeOf=_},296:(e,t,n)=>{e.exports=n(103)}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var a=t[r]={exports:{}};return e[r](a,a.exports,n),a.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(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.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{function e(t){return e="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},e(t)}function t(t,n,r){return(n=function(t){var n=function(t,n){if("object"!==e(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,"string");if("object"!==e(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"===e(n)?n:String(n)}(n))in t?Object.defineProperty(t,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[n]=r,t}const r=window.wp.element,o=window.wp.domReady;var a=n.n(o);function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}const d=window.wp.primitives,m=(0,r.createElement)(d.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,r.createElement)(d.Path,{d:"M6.6 6L5.4 7l4.5 5-4.5 5 1.1 1 5.5-6-5.4-6zm6 0l-1.1 1 4.5 5-4.5 5 1.1 1 5.5-6-5.5-6z"}));var g=[0,100],h=[0,100],y=function(e){return"".concat(1===e.length?"0":"").concat(e)},v=function(e,t,n){return Math.max(Math.min(e,n),t)},b=function(e,t){return Math.floor(Math.random()*(t-e+1))+e},w=function e(t,n,r){for(var o=b(t,n),a=0;a<(null==r?void 0:r.length);a++){var i=r[a];if(2===(null==i?void 0:i.length)&&o>=i[0]&&o<=i[1])return e(t,n,r)}return o},_=function(e,t){return"number"==typeof t?t:e%Math.abs(t[1]-t[0])+t[0]},x=function(e,t){return"number"==typeof e?v.apply(void 0,[Math.abs(e)].concat(p(t))):1===e.length||e[0]===e[1]?v.apply(void 0,[Math.abs(e[0])].concat(p(t))):[Math.abs(v.apply(void 0,[e[0]].concat(p(t)))),v.apply(void 0,[Math.abs(e[1])].concat(p(t)))]},k=function(e,t,n){return n<0?n+=1:n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e},S=function(e,t,n){var r,o,a;if(e/=360,n/=100,0==(t/=100))r=o=a=n;else{var i=n<.5?n*(1+t):n+t-n*t,l=2*n-i;r=k(l,i,e+1/3),o=k(l,i,e),a=k(l,i,e-1/3)}return[Math.round(255*r),Math.round(255*o),Math.round(255*a)]},C=function(e,t,n,r){return(299*e+587*t+114*n)/1e3>=r},O=function(e,t,n){return"hsl(".concat(e,", ").concat(t,"%, ").concat(n,"%)")},E=function(e,t,n,r){return"rgb"===r?"rgb(".concat(e,", ").concat(t,", ").concat(n,")"):"#".concat(y(e.toString(16))).concat(y(t.toString(16))).concat(y(n.toString(16)))},P=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.format,r=void 0===n?"hex":n,o=t.saturation,a=void 0===o?[50,55]:o,i=t.lightness,l=void 0===i?[50,60]:i,s=t.differencePoint,u=void 0===s?130:s,p=Math.abs(function(e){for(var t=e.length,n=0,r=0;r0&&void 0!==arguments[0]?arguments[0]:{},t=e.format,n=void 0===t?"hex":t,r=e.saturation,o=void 0===r?[50,55]:r,a=e.lightness,i=void 0===a?[50,60]:a,l=e.differencePoint,s=void 0===l?130:l,u=e.excludeHue;o=x(o,g),i=x(i,h);var f=u?w(0,359,u):b(0,359),d="number"==typeof o?o:b.apply(void 0,p(o)),m="number"==typeof i?i:b.apply(void 0,p(i)),y=c(S(f,d,m),3),v=y[0],_=y[1],k=y[2];return{color:"hsl"===n?O(f,d,m):E(v,_,k,n),isLight:C(v,_,k,s)}};const j=P;function T(){return T=Object.assign?Object.assign.bind():function(e){for(var t=1;t0?H(J,--X):0,Y--,10===K&&(Y=1,q--),K}function ne(){return K=X2||ie(K)>3?"":" "}function pe(e,t){for(;--t&&ne()&&!(K<48||K>102||K>57&&K<65||K>70&&K<97););return ae(e,oe()+(t<6&&32==re()&&32==ne()))}function fe(e){for(;ne();)switch(K){case e:return X;case 34:case 39:34!==e&&39!==e&&fe(K);break;case 40:41===e&&fe(e);break;case 92:ne()}return X}function de(e,t){for(;ne()&&e+K!==57&&(e+K!==84||47!==re()););return"/*"+ae(t,X-1)+"*"+B(47===e?e:ne())}function me(e){for(;!ie(re());)ne();return ae(e,X)}var ge="-ms-",he="-moz-",ye="-webkit-",ve="comm",be="rule",we="decl",_e="@keyframes";function xe(e,t){for(var n="",r=G(e),o=0;o0&&U(k)-p&&W(d>32?Pe(k+";",r,n,p-1):Pe(R(k," ","")+";",r,n,p-2),c);break;case 59:k+=";";default:if(W(x=Oe(k,t,n,s,u,o,l,b,w=[],_=[],p),a),123===v)if(0===u)Ce(k,t,x,x,w,a,p,l,_);else switch(99===f&&110===H(k,3)?100:f){case 100:case 108:case 109:case 115:Ce(e,x,x,r&&W(Oe(e,x,x,0,0,o,l,b,o,w=[],p),_),o,_,p,l,r?w:_);break;default:Ce(k,x,x,x,[""],_,0,l,_)}}s=u=d=0,g=y=1,b=k="",p=i;break;case 58:p=1+U(k),d=m;default:if(g<1)if(123==v)--g;else if(125==v&&0==g++&&125==te())continue;switch(k+=B(v),v*g){case 38:y=u>0?1:(k+="\f",-1);break;case 44:l[s++]=(U(k)-1)*y,y=1;break;case 64:45===re()&&(k+=se(ne())),f=re(),u=p=U(b=k+=me(oe())),v++;break;case 45:45===m&&2==U(k)&&(g=0)}}return a}function Oe(e,t,n,r,o,a,i,l,c,s,u){for(var p=o-1,f=0===o?a:[""],d=G(f),m=0,g=0,h=0;m0?f[y]+" "+v:R(v,/&\f/g,f[y])))&&(c[h++]=b);return Z(e,t,n,0===o?be:l,c,s,u)}function Ee(e,t,n){return Z(e,t,n,ve,B(K),V(e,2,-2),0)}function Pe(e,t,n,r){return Z(e,t,n,we,V(e,0,r),V(e,r+1,-1),r)}var je=function(e,t,n){for(var r=0,o=0;r=o,o=re(),38===r&&12===o&&(t[n]=1),!ie(o);)ne();return ae(e,X)},Te=new WeakMap,Ae=function(e){if("rule"===e.type&&e.parent&&!(e.length<1)){for(var t=e.value,n=e.parent,r=e.column===n.column&&e.line===n.line;"rule"!==n.type;)if(!(n=n.parent))return;if((1!==e.props.length||58===t.charCodeAt(0)||Te.get(n))&&!r){Te.set(e,!0);for(var o=[],a=function(e,t){return ce(function(e,t){var n=-1,r=44;do{switch(ie(r)){case 0:38===r&&12===re()&&(t[n]=1),e[n]+=je(X-1,t,n);break;case 2:e[n]+=se(r);break;case 4:if(44===r){e[++n]=58===re()?"&\f":"",t[n]=e[n].length;break}default:e[n]+=B(r)}}while(r=ne());return e}(le(e),t))}(t,o),i=n.props,l=0,c=0;l6)switch(H(e,t+1)){case 109:if(45!==H(e,t+4))break;case 102:return R(e,/(.+:)(.+)-([^]+)/,"$1"+ye+"$2-$3$1"+he+(108==H(e,t+3)?"$3":"$2-$3"))+e;case 115:return~z(e,"stretch")?$e(R(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(115!==H(e,t+1))break;case 6444:switch(H(e,U(e)-3-(~z(e,"!important")&&10))){case 107:return R(e,":",":"+ye)+e;case 101:return R(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+ye+(45===H(e,14)?"inline-":"")+"box$3$1"+ye+"$2$3$1"+ge+"$2box$3")+e}break;case 5936:switch(H(e,t+11)){case 114:return ye+e+ge+R(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return ye+e+ge+R(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return ye+e+ge+R(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return ye+e+ge+e+e}return e}var Ne=[function(e,t,n,r){if(e.length>-1&&!e.return)switch(e.type){case we:e.return=$e(e.value,e.length);break;case _e:return xe([ee(e,{value:R(e.value,"@","@"+ye)})],r);case be:if(e.length)return function(e,t){return e.map(t).join("")}(e.props,(function(t){switch(function(e,t){return(e=/(::plac\w+|:read-\w+)/.exec(e))?e[0]:e}(t)){case":read-only":case":read-write":return xe([ee(e,{props:[R(t,/:(read-\w+)/,":-moz-$1")]})],r);case"::placeholder":return xe([ee(e,{props:[R(t,/:(plac\w+)/,":"+ye+"input-$1")]}),ee(e,{props:[R(t,/:(plac\w+)/,":-moz-$1")]}),ee(e,{props:[R(t,/:(plac\w+)/,ge+"input-$1")]})],r)}return""}))}}],De=function(e){var t=e.key;if("css"===t){var n=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(n,(function(e){-1!==e.getAttribute("data-emotion").indexOf(" ")&&(document.head.appendChild(e),e.setAttribute("data-s",""))}))}var r,o,a=e.stylisPlugins||Ne,i={},l=[];r=e.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+t+' "]'),(function(e){for(var t=e.getAttribute("data-emotion").split(" "),n=1;n=4;++r,o-=4)t=1540483477*(65535&(t=255&e.charCodeAt(r)|(255&e.charCodeAt(++r))<<8|(255&e.charCodeAt(++r))<<16|(255&e.charCodeAt(++r))<<24))+(59797*(t>>>16)<<16),n=1540483477*(65535&(t^=t>>>24))+(59797*(t>>>16)<<16)^1540483477*(65535&n)+(59797*(n>>>16)<<16);switch(o){case 3:n^=(255&e.charCodeAt(r+2))<<16;case 2:n^=(255&e.charCodeAt(r+1))<<8;case 1:n=1540483477*(65535&(n^=255&e.charCodeAt(r)))+(59797*(n>>>16)<<16)}return(((n=1540483477*(65535&(n^=n>>>13))+(59797*(n>>>16)<<16))^n>>>15)>>>0).toString(36)}(o)+c;return{name:s,styles:o,next:Ue}},qe=!!A.useInsertionEffect&&A.useInsertionEffect,Ye=qe||function(e){return e()},Qe=(qe||A.useLayoutEffect,A.createContext("undefined"!=typeof HTMLElement?De({key:"css"}):null));Qe.Provider;var Xe=A.createContext({}),Ke=function(e,t,n){var r=e.key+"-"+t.name;!1===n&&void 0===e.registered[r]&&(e.registered[r]=t.styles)},Je=N,Ze=function(e){return"theme"!==e},et=function(e){return"string"==typeof e&&e.charCodeAt(0)>96?Je:Ze},tt=function(e,t,n){var r;if(t){var o=t.shouldForwardProp;r=e.__emotion_forwardProp&&o?function(t){return e.__emotion_forwardProp(t)&&o(t)}:o}return"function"!=typeof r&&n&&(r=e.__emotion_forwardProp),r},nt=function(e){var t=e.cache,n=e.serialized,r=e.isStringTag;return Ke(t,n,r),Ye((function(){return function(e,t,n){Ke(e,t,n);var r=e.key+"-"+t.name;if(void 0===e.inserted[t.name]){var o=t;do{e.insert(t===o?"."+r:"",o,e.sheet,!0),o=o.next}while(void 0!==o)}}(t,n,r)})),null},rt=function e(t,n){var r,o,a=t.__emotion_real===t,i=a&&t.__emotion_base||t;void 0!==n&&(r=n.label,o=n.target);var l=tt(t,n,a),c=l||et(i),s=!c("as");return function(){var u=arguments,p=a&&void 0!==t.__emotion_styles?t.__emotion_styles.slice(0):[];if(void 0!==r&&p.push("label:"+r+";"),null==u[0]||void 0===u[0].raw)p.push.apply(p,u);else{p.push(u[0][0]);for(var f=u.length,d=1;d1;return(0,r.createElement)(s.Flex,{className:"noptin-component__field-lg",wrap:!0},(0,r.createElement)(s.FlexItem,null,(0,r.createElement)(s.SelectControl,{label:(0,u.__)("If","newsletter-optin-box"),hideLabelFromVision:!0,value:n||"allow",options:st,onChange:function(e){return a("action",e)},size:"default",__nextHasNoMarginBottom:!0})),i&&(0,r.createElement)(r.Fragment,null,(0,r.createElement)(s.FlexItem,null,(0,r.createElement)(s.SelectControl,{label:(0,u.__)("all","newsletter-optin-box"),hideLabelFromVision:!0,value:t||"all",options:ut,onChange:function(e){return a("type",e)},size:"default",__nextHasNoMarginBottom:!0})),(0,r.createElement)(s.FlexBlock,null,(0,u.__)("of the following rules are true:","newsletter-optin-box"))))}function dt(e){var t,n=e.rule,o=e.comparisons,a=e.availableSmartTags,i=e.index,l=e.updateRule,p=e.removeRule,f=(0,r.useCallback)((function(e){return l(i,"value",e)}),[i,l]),d=(0,r.useCallback)((function(e){return l(i,"condition",e)}),[i,l]),m=(0,r.useCallback)((function(){return p(i)}),[i,p]),g=(0,r.useMemo)((function(){var e=n.type;if(void 0!==a[e])return a[e];var t,r=e.replace("_",".",1);if(void 0!==a[r])return a[r];for(var o=0,i=Object.entries(a);o> ").concat(t)}),[n.type,a]),y=pt((t=null==g?void 0:g.options,(0,r.useMemo)((function(){return t?Array.isArray(t)?t.map((function(e,t){return{label:e,value:t}})):Object.keys(t).map((function(e){return{label:t[e],value:e}})):[]}),[t])),(0,u.__)("Select a value","newsletter-optin-box")),v=y.length>1,b=(null==g?void 0:g.conditional_logic)||"string",w=pt((0,r.useMemo)((function(){var e=[];return Object.keys(o).forEach((function(t){var n=o[t].type;if(v){if("string"===b&&"is"!=t&&"is_not"!=t)return;if("is_empty"===t||"is_not_empty"===t||"is_between"===t)return}"any"!==n&&n!=b||e.push({label:o[t].name,value:t})})),e}),[b,o]),(0,u.__)("Select a comparison","newsletter-optin-box")),_="is_empty"===n.condition||"is_not_empty"===n.condition;return(0,r.createElement)(s.Flex,{className:"noptin-component__field-lg",wrap:!0,expanded:!0},(0,r.createElement)(s.FlexBlock,null,(0,r.createElement)(it,ct({},function(e){if(["subscribed","active","yes","true","1"].includes(e))return{backgroundColor:"#78c67a",color:"#111111"};if(["unsubscribed","inactive","no","false","0"].includes(e))return{backgroundColor:"#fbcfbd",color:"#241c15"};if(["pending","waiting","maybe","2"].includes(e))return{backgroundColor:"#fbeeca",color:"#241c15"};var t=j(e,{saturation:[60,100],lightness:[30,45]});return{backgroundColor:t.color,color:t.isLight?"#111111":"#ffffff"}}(h)),h)),(0,r.createElement)(s.FlexBlock,null,(0,r.createElement)(s.Flex,{justify:"flex-end",wrap:!0},(0,r.createElement)(s.FlexItem,null,(0,r.createElement)(s.SelectControl,{label:(0,u.__)("Comparison","newsletter-optin-box"),hideLabelFromVision:!0,value:n.condition?n.condition:"is",options:w,onChange:d,size:"default",__nextHasNoMarginBottom:!0})),!_&&(0,r.createElement)(s.FlexBlock,null,v&&(0,r.createElement)(s.SelectControl,{label:(0,u.__)("Value","newsletter-optin-box"),hideLabelFromVision:!0,value:n.value?n.value:"",options:y,onChange:f,size:"default",__nextHasNoMarginBottom:!0}),!v&&(0,r.createElement)(s.TextControl,{type:"number"===b?"number":"text",label:(0,u.__)("Value","newsletter-optin-box"),hideLabelFromVision:!0,value:n.value?n.value:"",onChange:f,__nextHasNoMarginBottom:!0})),(0,r.createElement)(s.FlexItem,null,(0,r.createElement)(s.Button,{onClick:m,icon:"trash",variant:"tertiary",isDestructive:!0})))))}function mt(e){var t=e.rules,n=e.comparisons,o=e.availableSmartTags,a=e.setConditionalLogicAttribute,i=(0,r.useMemo)((function(){return Array.isArray(t)?t.filter((function(e){return e.type&&""!==e.type})):[]}),[o]),l=(0,r.useMemo)((function(){var e={};return o.forEach((function(t){t.conditional_logic&&(e[t.smart_tag]=ct(ct({},t),{},{key:t.smart_tag,type:t.conditional_logic}))})),e}),[o]),c=(0,r.useCallback)((function(e){var t=p(i);t.splice(e,1),a("rules",t)}),[i,a]),s=(0,r.useCallback)((function(e,t,n){var r=p(i);r[e][t]=n,a("rules",r)}),[i,a]),f=(0,r.useMemo)((function(){return Object.values(l)}),[l]),d=(0,r.useCallback)((function(e){var t=l[e],n=(null==t?void 0:t.options)||[],r=(null==t?void 0:t.placeholder)||"",o=Array.isArray(n)&&n.length?Object.keys(n)[0]:r;null!=t&&t.default&&(o=t.default);var c=p(i);c.push({type:e,condition:"is",value:o}),a("rules",c)}),[i]),m=i.length?(0,u.__)("Add a rule","newsletter-optin-box"):(0,u.__)("Add another rule","newsletter-optin-box"),g=Et({availableSmartTags:f,onMergeTagClick:d,raw:!0,icon:"plus",label:m,text:m,toggleProps:{variant:"secondary"}});return(0,r.createElement)("div",{className:"noptin-conditional-logic-rules"},i.map((function(e,t){return(0,r.createElement)(dt,{key:t,rule:e,index:t,updateRule:s,removeRule:c,comparisons:n,availableSmartTags:l})})),g)}function gt(n){var o=n.onChange,a=n.value,i=n.comparisons,l=n.toggleText,c=n.availableSmartTags,p=n.className;"object"!==e(a)&&(a={enabled:!1,action:"allow",rules:[{condition:"is",type:"date",value:""}],type:"all"});var f=function(e,n){o(ct(ct({},a),{},t({},e,n)))};return(0,r.createElement)("div",{className:p},(0,r.createElement)(s.ToggleControl,{checked:!!a.enabled,onChange:function(e){return f("enabled",e)},className:"noptin-component__field",label:l||(0,u.__)("Optionally enable/disable this trigger depending on specific conditions.","newsletter-optin-box"),__nextHasNoMarginBottom:!0}),a.enabled&&(0,r.createElement)(r.Fragment,null,(0,r.createElement)(ft,{ruleCount:Array.isArray(a.rules)?a.rules.length:0,type:a.type,action:a.action,setConditionalLogicAttribute:f}),(0,r.createElement)(mt,{rules:a.rules,comparisons:i,availableSmartTags:c,setConditionalLogicAttribute:f})))}var ht={"==":function(e,t){return e==t},"===":function(e,t){return e===t},"!=":function(e,t){return e!=t},"!==":function(e,t){return e!==t},">":function(e,t){return e>t},">=":function(e,t){return e>=t},"<":function(e,t){return e0&&(b=(0,r.createElement)(s.DropdownMenu,kt({icon:p,label:g},h),(function(e){var t=e.onClose;return(0,r.createElement)(r.Fragment,null,Object.keys(y).map((function(e,n){return(0,r.createElement)(s.MenuGroup,{label:v>1?e:void 0,key:n},y[e].map((function(e){return(0,r.createElement)(s.MenuItem,{icon:e.icon||m,iconPosition:"left",onClick:function(){if(a){var n=l?e.smart_tag:"[[".concat((r=e).example?r.example:r.default?"".concat(r.smart_tag,' default="').concat(r.default,'"'):"".concat(r.smart_tag),"]]");a(n)}var r;t()},key:e.smart_tag},e.label)})))})))}))),b}function Pt(e){var t=e.setting,n=e.availableSmartTags,o=e.value,a=e.onChange,i=f(e,wt),l=(0,s.useBaseControlProps)(i),c=l.baseControlProps,d=l.controlProps;Array.isArray(o)||(o=[]);var m=(0,r.useCallback)((function(e){var t=e.item,i=e.index;return(0,r.createElement)(s.Flex,{className:"noptin-repeater-item",wrap:!0},Ot.map((function(e,l){return(0,r.createElement)(jt,{key:l,availableSmartTags:n,field:e,value:void 0===t[e.id]?"":t[e.id],onChange:function(t){var n=p(o);n[i][e.id]=t,a(n)}})})),(0,r.createElement)(s.FlexItem,null,(0,r.createElement)(s.Button,{icon:"trash",variant:"tertiary",className:"noptin-component__field",label:(0,u.__)("Delete","noptin-addons-pack"),showTooltip:!0,onClick:function(){var e=p(o);e.splice(i,1),a(e)},isDestructive:!0})))}),[o,a]);return(0,r.createElement)(s.BaseControl,kt({},c),(0,r.createElement)("div",kt({},d),o.map((function(e,t){return(0,r.createElement)(m,{key:t,item:e,index:t})})),(0,r.createElement)(s.Button,{onClick:function(){var e=p(o);e.push({}),a(e)},variant:"secondary"},t.add_field?t.add_field:(0,u.__)("Add","newsletter-optin-box"))))}function jt(e){var t=e.field,n=e.availableSmartTags,o=e.value,a=e.onChange,i=Et({availableSmartTags:n,onMergeTagClick:(0,r.useCallback)((function(e){a&&a(o?"".concat(o," ").concat(e).trim():e)}),[o,a])});return(0,r.createElement)(s.FlexBlock,null,(0,r.createElement)(s.__experimentalInputControl,{label:t.label,type:t.type,value:o,placeholder:(0,u.sprintf)((0,u.__)("Enter %s","noptin-addons-pack"),t.label),className:"noptin-component__field noptin-condition-field",suffix:i,onChange:a,isPressEnterToChange:!0,__nextHasNoMarginBottom:!0,__next36pxDefaultSize:!0}))}function Tt(e){e.setting;var t=e.value,n=e.options,o=e.onChange,a=f(e,_t),i=(0,s.useBaseControlProps)(a),l=i.baseControlProps,c=i.controlProps;return Array.isArray(t)||(t=[]),(0,r.createElement)(s.BaseControl,kt({},l),(0,r.createElement)("div",kt({},c),n.map((function(e,n){return(0,r.createElement)(s.CheckboxControl,{key:n,label:e.label,checked:t.includes(e.value),onChange:function(n){o(n?[].concat(p(t),[e.value]):t.filter((function(t){return t!==e.value})))}})}))))}function At(e){var n=e.settingKey,o=e.setting,a=e.availableSmartTags,i=e.prop,l=e.saved,c=e.setAttributes,p=(0,r.useCallback)((function(e){if(!i)return c(t({},n,e));var r=l[i]?l[i]:{},o=t({},i,kt(kt({},r),{},t({},n,e)));c(o)}),[n,i,l,c]);if(o.if||o.restrict){var f=o.restrict?o.restrict.split("."):o.if.split(".");if(!(2!==f.length||l[f[0]]&&l[f[0]][f[1]]))return null;if(1===f.length&&!l[f[0]])return null}if(Array.isArray(o.conditions)){var d=o.conditions.every((function(e){var t=e.key.split("."),n=e.operator?e.operator:"==",r=l[t[0]];return 2===t.length?r&&r[t[1]]&&yt(e.value,n,r[t[1]]):yt(e.value,n,r)}));if(!d)return null}if(o.condition&&!o.condition(l))return null;var m=l[n];i&&(m=l[i]?l[i][n]:void 0),(void 0===m||o.disabled)&&(m=o.default);var g=void 0!==m&&""!==m&&null!==m,h=[];o.options&&(h=Object.keys(o.options).map((function(e){return{label:o.options[e],value:e}})));var y=o.fullWidth?"noptin-component__field noptin-component__field-".concat(n):"noptin-component__field-lg noptin-component__field-".concat(n),v=o.description?(0,r.createElement)("span",{dangerouslySetInnerHTML:{__html:o.description}}):"",b={label:o.label,value:g?m:"",onChange:p,className:"".concat(y),help:v};return"select"===o.el?(h.unshift({label:o.placeholder?o.placeholder:(0,u.__)("Select an option","newsletter-optin-box"),value:"",disabled:!o.canSelectPlaceholder}),(0,r.createElement)(s.SelectControl,kt(kt({},b),{},{options:h,__nextHasNoMarginBottom:!0,__next36pxDefaultSize:!0}))):"form_token"===o.el?(0,r.createElement)(s.FormTokenField,kt(kt({},b),{},{value:Array.isArray(b.value)?b.value:[],suggestions:Array.isArray(o.suggestions)?o.suggestions:[],__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0})):"multi_checkbox"===o.el||"multi_checkbox_alt"===o.el?(0,r.createElement)(Tt,kt(kt({},b),{},{options:h})):"conditional_logic"===o.el?(0,r.createElement)(gt,kt(kt({},b),{},{availableSmartTags:a,comparisons:o.comparisons,toggleText:o.toggle_text})):"input"===o.el?o.type&&["toggle","switch","checkbox","checkbox_alt"].includes(o.type)?(0,r.createElement)(s.ToggleControl,kt(kt({},b),{},{checked:!!g&&m,onChange:function(e){p(e)}})):(0,r.createElement)(Ct,kt(kt({},b),{},{setting:o,availableSmartTags:"trigger_settings"===i?[]:a,isPressEnterToChange:!o.isInputToChange})):"textarea"===o.el?(0,r.createElement)(s.TextareaControl,kt(kt({},b),{},{setting:o,placeholder:o.placeholder?o.placeholder:"",__nextHasNoMarginBottom:!0})):"paragraph"===o.el?(0,r.createElement)("div",{className:y},(0,r.createElement)(s.Tip,null,o.content)):"hero"===o.el?(0,r.createElement)("div",{className:y},(0,r.createElement)("h3",null,o.content)):"key_value_repeater"===o.el||"webhook_key_value_repeater"===o.el?(0,r.createElement)(Pt,kt(kt({},b),{},{setting:o,availableSmartTags:"trigger_settings"===i?[]:a})):n}var Mt,$t=function(e){var t=e.mergeTag,n=e.onMergeTagClick,o=function(){if(t.example)return t.example;var e="default value";return t.replacement&&(e=t.replacement),t.default&&(e=t.default),e?"".concat(t.smart_tag,' default="').concat(e,'"'):"".concat(t.smart_tag)},a=t.description&&t.description!==t.label;return(0,r.createElement)("tr",{className:"noptin-merge-tag"},(0,r.createElement)("td",null,(0,r.createElement)("label",null,(0,r.createElement)("span",{className:"noptin-merge-tag-label"},t.label),(0,r.createElement)("input",{type:"text",className:"widefat",value:"[[".concat(o(),"]]"),onFocus:function(e){e.target.select(),n&&n("[[".concat(o(),"]]"))},readOnly:!0})),a&&(0,r.createElement)("p",{className:"description noptin-mb0"},t.description)))},Nt=function(e){var t=e.availableSmartTags,n=e.onMergeTagClick;return(0,r.createElement)("div",{className:"noptin-merge-tags-wrapper"},(0,r.createElement)("table",{className:"widefat striped"},(0,r.createElement)("tbody",null,t.map((function(e){return(0,r.createElement)($t,{key:e.smart_tag,mergeTag:e,onMergeTagClick:n})})))))},Dt=function(e){var t=e.availableSmartTags;return(0,r.createElement)("div",{id:"noptin-automation-rule-smart-tags",style:{display:"none"}},(0,r.createElement)("h2",null,(0,u.__)("Smart Tags","newsletter-optin-box")),(0,r.createElement)("p",null,(0,u.__)("You can use the following smart tags to generate dynamic values.","newsletter-optin-box")),(0,r.createElement)(Nt,{availableSmartTags:t}))};function Ft(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 Bt(e){for(var n=1;n{"use strict";var e={249:(e,t,n)=>{n.d(t,{Z:()=>r});const r={initial_form:null,init:function(){var e=jQuery;e(".noptin-send-test-email").on("click",this.send_test_email),e(".noptin-filter-recipients").on("click",this.filter_recipients),e(".noptin-filter-post-notifications-post-types").on("click",this.new_post_notifications_filter_post_types),e(".noptin-filter-post-notifications-taxonomies").on("click",this.new_post_notifications_filter_taxonomies),e(".noptin-stop-campaign").on("click",this.stop_campaign)},stop_campaign:function(e){e.preventDefault();var t={id:jQuery(this).data("id"),_wpnonce:noptin_params.nonce,action:"noptin_stop_campaign"};Swal.fire({titleText:"Are you sure?",text:"This campaign will stop sending and be reverted to draft status.",type:"warning",showCancelButton:!0,confirmButtonColor:"#d33",cancelButtonColor:"#9e9e9e",confirmButtonText:"Yes, stop it!",showLoaderOnConfirm:!0,showCloseButton:!0,focusConfirm:!1,allowOutsideClick:function(){return!Swal.isLoading()},preConfirm:function(){return jQuery.get(noptin_params.ajaxurl,t).done((function(){window.location=window.location,Swal.fire("Success","Your campaign was reverted to draft","success")})).fail((function(){Swal.fire("Error","Unable to stop your campaign. Try again.","error")})),jQuery.Deferred()}})},send_test_email:function(e){e.preventDefault(),tinyMCE.triggerSave();var t=jQuery(this).closest("form").serialize();Swal.fire({titleText:"Send a test email to:",showCancelButton:!0,confirmButtonColor:"#3085d6",cancelButtonColor:"#d33",confirmButtonText:"Send",showLoaderOnConfirm:!0,showCloseButton:!0,input:"email",inputValue:noptin_params.admin_email,inputPlaceholder:noptin_params.admin_email,allowOutsideClick:function(){return!Swal.isLoading()},preConfirm:function(e){return t+="&email="+e,t+="&action=noptin_send_test_email",jQuery.post(noptin_params.ajaxurl,t).done((function(e){e.success?Swal.fire("Success",e.data,"success"):Swal.fire({type:"error",title:"Error!",text:e.data,showCloseButton:!0,confirmButtonText:"Close",confirmButtonColor:"#9e9e9e",footer:'How to troubleshoot this error.'})})).fail((function(e){Swal.fire({type:"error",title:"Unable to connect",text:"This might be a problem with your server or your internet connection",showCloseButton:!0,confirmButtonText:"Close",confirmButtonColor:"#9e9e9e",footer:"Status: ".concat(e.status,"   Status text: ").concat(e.statusText,"")})})),jQuery.Deferred()}})}}},679:(e,t,n)=>{var r=n(296),o={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},a={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},i={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},l={};function c(e){return r.isMemo(e)?i:l[e.$$typeof]||o}l[r.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},l[r.Memo]=i;var s=Object.defineProperty,u=Object.getOwnPropertyNames,p=Object.getOwnPropertySymbols,f=Object.getOwnPropertyDescriptor,d=Object.getPrototypeOf,m=Object.prototype;e.exports=function e(t,n,r){if("string"!=typeof n){if(m){var o=d(n);o&&o!==m&&e(t,o,r)}var i=u(n);p&&(i=i.concat(p(n)));for(var l=c(t),g=c(n),h=0;h{var n="function"==typeof Symbol&&Symbol.for,r=n?Symbol.for("react.element"):60103,o=n?Symbol.for("react.portal"):60106,a=n?Symbol.for("react.fragment"):60107,i=n?Symbol.for("react.strict_mode"):60108,l=n?Symbol.for("react.profiler"):60114,c=n?Symbol.for("react.provider"):60109,s=n?Symbol.for("react.context"):60110,u=n?Symbol.for("react.async_mode"):60111,p=n?Symbol.for("react.concurrent_mode"):60111,f=n?Symbol.for("react.forward_ref"):60112,d=n?Symbol.for("react.suspense"):60113,m=n?Symbol.for("react.suspense_list"):60120,g=n?Symbol.for("react.memo"):60115,h=n?Symbol.for("react.lazy"):60116,y=n?Symbol.for("react.block"):60121,v=n?Symbol.for("react.fundamental"):60117,b=n?Symbol.for("react.responder"):60118,w=n?Symbol.for("react.scope"):60119;function _(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case r:switch(e=e.type){case u:case p:case a:case l:case i:case d:return e;default:switch(e=e&&e.$$typeof){case s:case f:case h:case g:case c:return e;default:return t}}case o:return t}}}function x(e){return _(e)===p}t.AsyncMode=u,t.ConcurrentMode=p,t.ContextConsumer=s,t.ContextProvider=c,t.Element=r,t.ForwardRef=f,t.Fragment=a,t.Lazy=h,t.Memo=g,t.Portal=o,t.Profiler=l,t.StrictMode=i,t.Suspense=d,t.isAsyncMode=function(e){return x(e)||_(e)===u},t.isConcurrentMode=x,t.isContextConsumer=function(e){return _(e)===s},t.isContextProvider=function(e){return _(e)===c},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===r},t.isForwardRef=function(e){return _(e)===f},t.isFragment=function(e){return _(e)===a},t.isLazy=function(e){return _(e)===h},t.isMemo=function(e){return _(e)===g},t.isPortal=function(e){return _(e)===o},t.isProfiler=function(e){return _(e)===l},t.isStrictMode=function(e){return _(e)===i},t.isSuspense=function(e){return _(e)===d},t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===a||e===p||e===l||e===i||e===d||e===m||"object"==typeof e&&null!==e&&(e.$$typeof===h||e.$$typeof===g||e.$$typeof===c||e.$$typeof===s||e.$$typeof===f||e.$$typeof===v||e.$$typeof===b||e.$$typeof===w||e.$$typeof===y)},t.typeOf=_},296:(e,t,n)=>{e.exports=n(103)}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var a=t[r]={exports:{}};return e[r](a,a.exports,n),a.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(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.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{function e(t){return e="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},e(t)}function t(t,n,r){return(n=function(t){var n=function(t,n){if("object"!==e(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,"string");if("object"!==e(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"===e(n)?n:String(n)}(n))in t?Object.defineProperty(t,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[n]=r,t}const r=window.wp.element,o=window.wp.domReady;var a=n.n(o);function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}const d=window.wp.primitives,m=(0,r.createElement)(d.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,r.createElement)(d.Path,{d:"M6.6 6L5.4 7l4.5 5-4.5 5 1.1 1 5.5-6-5.4-6zm6 0l-1.1 1 4.5 5-4.5 5 1.1 1 5.5-6-5.5-6z"}));var g=[0,100],h=[0,100],y=function(e){return"".concat(1===e.length?"0":"").concat(e)},v=function(e,t,n){return Math.max(Math.min(e,n),t)},b=function(e,t){return Math.floor(Math.random()*(t-e+1))+e},w=function e(t,n,r){for(var o=b(t,n),a=0;a<(null==r?void 0:r.length);a++){var i=r[a];if(2===(null==i?void 0:i.length)&&o>=i[0]&&o<=i[1])return e(t,n,r)}return o},_=function(e,t){return"number"==typeof t?t:e%Math.abs(t[1]-t[0])+t[0]},x=function(e,t){return"number"==typeof e?v.apply(void 0,[Math.abs(e)].concat(p(t))):1===e.length||e[0]===e[1]?v.apply(void 0,[Math.abs(e[0])].concat(p(t))):[Math.abs(v.apply(void 0,[e[0]].concat(p(t)))),v.apply(void 0,[Math.abs(e[1])].concat(p(t)))]},k=function(e,t,n){return n<0?n+=1:n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e},S=function(e,t,n){var r,o,a;if(e/=360,n/=100,0==(t/=100))r=o=a=n;else{var i=n<.5?n*(1+t):n+t-n*t,l=2*n-i;r=k(l,i,e+1/3),o=k(l,i,e),a=k(l,i,e-1/3)}return[Math.round(255*r),Math.round(255*o),Math.round(255*a)]},C=function(e,t,n,r){return(299*e+587*t+114*n)/1e3>=r},O=function(e,t,n){return"hsl(".concat(e,", ").concat(t,"%, ").concat(n,"%)")},E=function(e,t,n,r){return"rgb"===r?"rgb(".concat(e,", ").concat(t,", ").concat(n,")"):"#".concat(y(e.toString(16))).concat(y(t.toString(16))).concat(y(n.toString(16)))},P=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.format,r=void 0===n?"hex":n,o=t.saturation,a=void 0===o?[50,55]:o,i=t.lightness,l=void 0===i?[50,60]:i,s=t.differencePoint,u=void 0===s?130:s,p=Math.abs(function(e){for(var t=e.length,n=0,r=0;r0&&void 0!==arguments[0]?arguments[0]:{},t=e.format,n=void 0===t?"hex":t,r=e.saturation,o=void 0===r?[50,55]:r,a=e.lightness,i=void 0===a?[50,60]:a,l=e.differencePoint,s=void 0===l?130:l,u=e.excludeHue;o=x(o,g),i=x(i,h);var f=u?w(0,359,u):b(0,359),d="number"==typeof o?o:b.apply(void 0,p(o)),m="number"==typeof i?i:b.apply(void 0,p(i)),y=c(S(f,d,m),3),v=y[0],_=y[1],k=y[2];return{color:"hsl"===n?O(f,d,m):E(v,_,k,n),isLight:C(v,_,k,s)}};const j=P;function T(){return T=Object.assign?Object.assign.bind():function(e){for(var t=1;t0?H(J,--X):0,Y--,10===K&&(Y=1,q--),K}function ne(){return K=X2||ie(K)>3?"":" "}function pe(e,t){for(;--t&&ne()&&!(K<48||K>102||K>57&&K<65||K>70&&K<97););return ae(e,oe()+(t<6&&32==re()&&32==ne()))}function fe(e){for(;ne();)switch(K){case e:return X;case 34:case 39:34!==e&&39!==e&&fe(K);break;case 40:41===e&&fe(e);break;case 92:ne()}return X}function de(e,t){for(;ne()&&e+K!==57&&(e+K!==84||47!==re()););return"/*"+ae(t,X-1)+"*"+B(47===e?e:ne())}function me(e){for(;!ie(re());)ne();return ae(e,X)}var ge="-ms-",he="-moz-",ye="-webkit-",ve="comm",be="rule",we="decl",_e="@keyframes";function xe(e,t){for(var n="",r=W(e),o=0;o0&&U(k)-p&&G(d>32?Pe(k+";",r,n,p-1):Pe(R(k," ","")+";",r,n,p-2),c);break;case 59:k+=";";default:if(G(x=Oe(k,t,n,s,u,o,l,b,w=[],_=[],p),a),123===v)if(0===u)Ce(k,t,x,x,w,a,p,l,_);else switch(99===f&&110===H(k,3)?100:f){case 100:case 108:case 109:case 115:Ce(e,x,x,r&&G(Oe(e,x,x,0,0,o,l,b,o,w=[],p),_),o,_,p,l,r?w:_);break;default:Ce(k,x,x,x,[""],_,0,l,_)}}s=u=d=0,g=y=1,b=k="",p=i;break;case 58:p=1+U(k),d=m;default:if(g<1)if(123==v)--g;else if(125==v&&0==g++&&125==te())continue;switch(k+=B(v),v*g){case 38:y=u>0?1:(k+="\f",-1);break;case 44:l[s++]=(U(k)-1)*y,y=1;break;case 64:45===re()&&(k+=se(ne())),f=re(),u=p=U(b=k+=me(oe())),v++;break;case 45:45===m&&2==U(k)&&(g=0)}}return a}function Oe(e,t,n,r,o,a,i,l,c,s,u){for(var p=o-1,f=0===o?a:[""],d=W(f),m=0,g=0,h=0;m0?f[y]+" "+v:R(v,/&\f/g,f[y])))&&(c[h++]=b);return Z(e,t,n,0===o?be:l,c,s,u)}function Ee(e,t,n){return Z(e,t,n,ve,B(K),V(e,2,-2),0)}function Pe(e,t,n,r){return Z(e,t,n,we,V(e,0,r),V(e,r+1,-1),r)}var je=function(e,t,n){for(var r=0,o=0;r=o,o=re(),38===r&&12===o&&(t[n]=1),!ie(o);)ne();return ae(e,X)},Te=new WeakMap,Ae=function(e){if("rule"===e.type&&e.parent&&!(e.length<1)){for(var t=e.value,n=e.parent,r=e.column===n.column&&e.line===n.line;"rule"!==n.type;)if(!(n=n.parent))return;if((1!==e.props.length||58===t.charCodeAt(0)||Te.get(n))&&!r){Te.set(e,!0);for(var o=[],a=function(e,t){return ce(function(e,t){var n=-1,r=44;do{switch(ie(r)){case 0:38===r&&12===re()&&(t[n]=1),e[n]+=je(X-1,t,n);break;case 2:e[n]+=se(r);break;case 4:if(44===r){e[++n]=58===re()?"&\f":"",t[n]=e[n].length;break}default:e[n]+=B(r)}}while(r=ne());return e}(le(e),t))}(t,o),i=n.props,l=0,c=0;l6)switch(H(e,t+1)){case 109:if(45!==H(e,t+4))break;case 102:return R(e,/(.+:)(.+)-([^]+)/,"$1"+ye+"$2-$3$1"+he+(108==H(e,t+3)?"$3":"$2-$3"))+e;case 115:return~z(e,"stretch")?$e(R(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(115!==H(e,t+1))break;case 6444:switch(H(e,U(e)-3-(~z(e,"!important")&&10))){case 107:return R(e,":",":"+ye)+e;case 101:return R(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+ye+(45===H(e,14)?"inline-":"")+"box$3$1"+ye+"$2$3$1"+ge+"$2box$3")+e}break;case 5936:switch(H(e,t+11)){case 114:return ye+e+ge+R(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return ye+e+ge+R(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return ye+e+ge+R(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return ye+e+ge+e+e}return e}var Ne=[function(e,t,n,r){if(e.length>-1&&!e.return)switch(e.type){case we:e.return=$e(e.value,e.length);break;case _e:return xe([ee(e,{value:R(e.value,"@","@"+ye)})],r);case be:if(e.length)return function(e,t){return e.map(t).join("")}(e.props,(function(t){switch(function(e,t){return(e=/(::plac\w+|:read-\w+)/.exec(e))?e[0]:e}(t)){case":read-only":case":read-write":return xe([ee(e,{props:[R(t,/:(read-\w+)/,":-moz-$1")]})],r);case"::placeholder":return xe([ee(e,{props:[R(t,/:(plac\w+)/,":"+ye+"input-$1")]}),ee(e,{props:[R(t,/:(plac\w+)/,":-moz-$1")]}),ee(e,{props:[R(t,/:(plac\w+)/,ge+"input-$1")]})],r)}return""}))}}],De=function(e){var t=e.key;if("css"===t){var n=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(n,(function(e){-1!==e.getAttribute("data-emotion").indexOf(" ")&&(document.head.appendChild(e),e.setAttribute("data-s",""))}))}var r,o,a=e.stylisPlugins||Ne,i={},l=[];r=e.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+t+' "]'),(function(e){for(var t=e.getAttribute("data-emotion").split(" "),n=1;n=4;++r,o-=4)t=1540483477*(65535&(t=255&e.charCodeAt(r)|(255&e.charCodeAt(++r))<<8|(255&e.charCodeAt(++r))<<16|(255&e.charCodeAt(++r))<<24))+(59797*(t>>>16)<<16),n=1540483477*(65535&(t^=t>>>24))+(59797*(t>>>16)<<16)^1540483477*(65535&n)+(59797*(n>>>16)<<16);switch(o){case 3:n^=(255&e.charCodeAt(r+2))<<16;case 2:n^=(255&e.charCodeAt(r+1))<<8;case 1:n=1540483477*(65535&(n^=255&e.charCodeAt(r)))+(59797*(n>>>16)<<16)}return(((n=1540483477*(65535&(n^=n>>>13))+(59797*(n>>>16)<<16))^n>>>15)>>>0).toString(36)}(o)+c;return{name:s,styles:o,next:Ue}},qe=!!A.useInsertionEffect&&A.useInsertionEffect,Ye=qe||function(e){return e()},Qe=(qe||A.useLayoutEffect,A.createContext("undefined"!=typeof HTMLElement?De({key:"css"}):null));Qe.Provider;var Xe=A.createContext({}),Ke=function(e,t,n){var r=e.key+"-"+t.name;!1===n&&void 0===e.registered[r]&&(e.registered[r]=t.styles)},Je=N,Ze=function(e){return"theme"!==e},et=function(e){return"string"==typeof e&&e.charCodeAt(0)>96?Je:Ze},tt=function(e,t,n){var r;if(t){var o=t.shouldForwardProp;r=e.__emotion_forwardProp&&o?function(t){return e.__emotion_forwardProp(t)&&o(t)}:o}return"function"!=typeof r&&n&&(r=e.__emotion_forwardProp),r},nt=function(e){var t=e.cache,n=e.serialized,r=e.isStringTag;return Ke(t,n,r),Ye((function(){return function(e,t,n){Ke(e,t,n);var r=e.key+"-"+t.name;if(void 0===e.inserted[t.name]){var o=t;do{e.insert(t===o?"."+r:"",o,e.sheet,!0),o=o.next}while(void 0!==o)}}(t,n,r)})),null},rt=function e(t,n){var r,o,a=t.__emotion_real===t,i=a&&t.__emotion_base||t;void 0!==n&&(r=n.label,o=n.target);var l=tt(t,n,a),c=l||et(i),s=!c("as");return function(){var u=arguments,p=a&&void 0!==t.__emotion_styles?t.__emotion_styles.slice(0):[];if(void 0!==r&&p.push("label:"+r+";"),null==u[0]||void 0===u[0].raw)p.push.apply(p,u);else{p.push(u[0][0]);for(var f=u.length,d=1;d1;return(0,r.createElement)(s.Flex,{className:"noptin-component__field-lg",wrap:!0},(0,r.createElement)(s.FlexItem,null,(0,r.createElement)(s.SelectControl,{label:(0,u.__)("If","newsletter-optin-box"),hideLabelFromVision:!0,value:n||"allow",options:st,onChange:function(e){return a("action",e)},size:"default",__nextHasNoMarginBottom:!0})),i&&(0,r.createElement)(r.Fragment,null,(0,r.createElement)(s.FlexItem,null,(0,r.createElement)(s.SelectControl,{label:(0,u.__)("all","newsletter-optin-box"),hideLabelFromVision:!0,value:t||"all",options:ut,onChange:function(e){return a("type",e)},size:"default",__nextHasNoMarginBottom:!0})),(0,r.createElement)(s.FlexBlock,null,(0,u.__)("of the following rules are true:","newsletter-optin-box"))))}function dt(e){var t,n=e.rule,o=e.comparisons,a=e.availableSmartTags,i=e.index,l=e.updateRule,p=e.removeRule,f=(0,r.useCallback)((function(e){return l(i,"value",e)}),[i,l]),d=(0,r.useCallback)((function(e){return l(i,"condition",e)}),[i,l]),m=(0,r.useCallback)((function(){return p(i)}),[i,p]),g=(0,r.useMemo)((function(){var e=n.type;if(void 0!==a[e])return a[e];var t,r=e.replace("_",".",1);if(void 0!==a[r])return a[r];for(var o=0,i=Object.entries(a);o> ").concat(t)}),[n.type,a]),y=pt((t=null==g?void 0:g.options,(0,r.useMemo)((function(){return t?Array.isArray(t)?t.map((function(e,t){return{label:e,value:t}})):Object.keys(t).map((function(e){return{label:t[e],value:e}})):[]}),[t])),(0,u.__)("Select a value","newsletter-optin-box")),v=y.length>1,b=(null==g?void 0:g.conditional_logic)||"string",w=pt((0,r.useMemo)((function(){var e=[];return Object.keys(o).forEach((function(t){var n=o[t].type;if(v){if("string"===b&&"is"!=t&&"is_not"!=t)return;if("is_empty"===t||"is_not_empty"===t||"is_between"===t)return}"any"!==n&&n!=b||e.push({label:o[t].name,value:t})})),e}),[b,o]),(0,u.__)("Select a comparison","newsletter-optin-box")),_="is_empty"===n.condition||"is_not_empty"===n.condition;return(0,r.createElement)(s.Flex,{className:"noptin-component__field-lg",wrap:!0,expanded:!0},(0,r.createElement)(s.FlexBlock,null,(0,r.createElement)(it,ct({},function(e){if(["subscribed","active","yes","true","1"].includes(e))return{backgroundColor:"#78c67a",color:"#111111"};if(["unsubscribed","inactive","no","false","0"].includes(e))return{backgroundColor:"#fbcfbd",color:"#241c15"};if(["pending","waiting","maybe","2"].includes(e))return{backgroundColor:"#fbeeca",color:"#241c15"};var t=j(e,{saturation:[60,100],lightness:[30,45]});return{backgroundColor:t.color,color:t.isLight?"#111111":"#ffffff"}}(h)),h)),(0,r.createElement)(s.FlexBlock,null,(0,r.createElement)(s.Flex,{justify:"flex-end",wrap:!0},(0,r.createElement)(s.FlexItem,null,(0,r.createElement)(s.SelectControl,{label:(0,u.__)("Comparison","newsletter-optin-box"),hideLabelFromVision:!0,value:n.condition?n.condition:"is",options:w,onChange:d,size:"default",__nextHasNoMarginBottom:!0})),!_&&(0,r.createElement)(s.FlexBlock,null,v&&(0,r.createElement)(s.SelectControl,{label:(0,u.__)("Value","newsletter-optin-box"),hideLabelFromVision:!0,value:n.value?n.value:"",options:y,onChange:f,size:"default",__nextHasNoMarginBottom:!0}),!v&&(0,r.createElement)(s.TextControl,{type:"number"===b?"number":"text",label:(0,u.__)("Value","newsletter-optin-box"),hideLabelFromVision:!0,value:n.value?n.value:"",onChange:f,__nextHasNoMarginBottom:!0})),(0,r.createElement)(s.FlexItem,null,(0,r.createElement)(s.Button,{onClick:m,icon:"trash",variant:"tertiary",isDestructive:!0})))))}function mt(e){var t=e.rules,n=e.comparisons,o=e.availableSmartTags,a=e.setConditionalLogicAttribute,i=(0,r.useMemo)((function(){return Array.isArray(t)?t.filter((function(e){return e.type&&""!==e.type})):[]}),[o]),l=(0,r.useMemo)((function(){var e={};return o.forEach((function(t){t.conditional_logic&&(e[t.smart_tag]=ct(ct({},t),{},{key:t.smart_tag,type:t.conditional_logic}))})),e}),[o]),c=(0,r.useCallback)((function(e){var t=p(i);t.splice(e,1),a("rules",t)}),[i,a]),s=(0,r.useCallback)((function(e,t,n){var r=p(i);r[e][t]=n,a("rules",r)}),[i,a]),f=(0,r.useMemo)((function(){return Object.values(l)}),[l]),d=(0,r.useCallback)((function(e){var t=l[e],n=(null==t?void 0:t.options)||[],r=(null==t?void 0:t.placeholder)||"",o=Array.isArray(n)&&n.length?Object.keys(n)[0]:r;null!=t&&t.default&&(o=t.default);var c=p(i);c.push({type:e,condition:"is",value:o}),a("rules",c)}),[i]),m=i.length?(0,u.__)("Add a rule","newsletter-optin-box"):(0,u.__)("Add another rule","newsletter-optin-box"),g=Et({availableSmartTags:f,onMergeTagClick:d,raw:!0,icon:"plus",label:m,text:m,toggleProps:{variant:"secondary"}});return(0,r.createElement)("div",{className:"noptin-conditional-logic-rules"},i.map((function(e,t){return(0,r.createElement)(dt,{key:t,rule:e,index:t,updateRule:s,removeRule:c,comparisons:n,availableSmartTags:l})})),g)}function gt(n){var o=n.onChange,a=n.value,i=n.comparisons,l=n.toggleText,c=n.availableSmartTags,p=n.className;"object"!==e(a)&&(a={enabled:!1,action:"allow",rules:[{condition:"is",type:"date",value:""}],type:"all"});var f=function(e,n){o(ct(ct({},a),{},t({},e,n)))};return(0,r.createElement)("div",{className:p},(0,r.createElement)(s.ToggleControl,{checked:!!a.enabled,onChange:function(e){return f("enabled",e)},className:"noptin-component__field",label:l||(0,u.__)("Optionally enable/disable this trigger depending on specific conditions.","newsletter-optin-box"),__nextHasNoMarginBottom:!0}),a.enabled&&(0,r.createElement)(r.Fragment,null,(0,r.createElement)(ft,{ruleCount:Array.isArray(a.rules)?a.rules.length:0,type:a.type,action:a.action,setConditionalLogicAttribute:f}),(0,r.createElement)(mt,{rules:a.rules,comparisons:i,availableSmartTags:c,setConditionalLogicAttribute:f})))}var ht={"==":function(e,t){return e==t},"===":function(e,t){return e===t},"!=":function(e,t){return e!=t},"!==":function(e,t){return e!==t},">":function(e,t){return e>t},">=":function(e,t){return e>=t},"<":function(e,t){return e0&&(b=(0,r.createElement)(s.DropdownMenu,kt({icon:p,label:g},h),(function(e){var t=e.onClose;return(0,r.createElement)(r.Fragment,null,Object.keys(y).map((function(e,n){return(0,r.createElement)(s.MenuGroup,{label:v>1?e:void 0,key:n},y[e].map((function(e){return(0,r.createElement)(s.MenuItem,{icon:e.icon||m,iconPosition:"left",onClick:function(){if(a){var n=l?e.smart_tag:"[[".concat((r=e).example?r.example:r.default?"".concat(r.smart_tag,' default="').concat(r.default,'"'):"".concat(r.smart_tag),"]]");a(n)}var r;t()},key:e.smart_tag},e.label)})))})))}))),b}function Pt(e){var t=e.setting,n=e.availableSmartTags,o=e.value,a=e.onChange,i=f(e,wt),l=(0,s.useBaseControlProps)(i),c=l.baseControlProps,d=l.controlProps;Array.isArray(o)||(o=[]);var m=(0,r.useCallback)((function(e){var t=e.item,i=e.index;return(0,r.createElement)(s.Flex,{className:"noptin-repeater-item",wrap:!0},Ot.map((function(e,l){return(0,r.createElement)(jt,{key:l,availableSmartTags:n,field:e,value:void 0===t[e.id]?"":t[e.id],onChange:function(t){var n=p(o);n[i][e.id]=t,a(n)}})})),(0,r.createElement)(s.FlexItem,null,(0,r.createElement)(s.Button,{icon:"trash",variant:"tertiary",className:"noptin-component__field",label:(0,u.__)("Delete","noptin-addons-pack"),showTooltip:!0,onClick:function(){var e=p(o);e.splice(i,1),a(e)},isDestructive:!0})))}),[o,a]);return(0,r.createElement)(s.BaseControl,kt({},c),(0,r.createElement)("div",kt({},d),o.map((function(e,t){return(0,r.createElement)(m,{key:t,item:e,index:t})})),(0,r.createElement)(s.Button,{onClick:function(){var e=p(o);e.push({}),a(e)},variant:"secondary"},t.add_field?t.add_field:(0,u.__)("Add","newsletter-optin-box"))))}function jt(e){var t=e.field,n=e.availableSmartTags,o=e.value,a=e.onChange,i=Et({availableSmartTags:n,onMergeTagClick:(0,r.useCallback)((function(e){a&&a(o?"".concat(o," ").concat(e).trim():e)}),[o,a])});return(0,r.createElement)(s.FlexBlock,null,(0,r.createElement)(s.__experimentalInputControl,{label:t.label,type:t.type,value:o,placeholder:(0,u.sprintf)((0,u.__)("Enter %s","noptin-addons-pack"),t.label),className:"noptin-component__field noptin-condition-field",suffix:i,onChange:a,isPressEnterToChange:!0,__nextHasNoMarginBottom:!0,__next36pxDefaultSize:!0}))}function Tt(e){e.setting;var t=e.value,n=e.options,o=e.onChange,a=f(e,_t),i=(0,s.useBaseControlProps)(a),l=i.baseControlProps,c=i.controlProps;return Array.isArray(t)||(t=[]),(0,r.createElement)(s.BaseControl,kt({},l),(0,r.createElement)("div",kt({},c),n.map((function(e,n){return(0,r.createElement)(s.CheckboxControl,{key:n,label:e.label,checked:t.includes(e.value),onChange:function(n){o(n?[].concat(p(t),[e.value]):t.filter((function(t){return t!==e.value})))}})}))))}function At(e){var n=e.settingKey,o=e.setting,a=e.availableSmartTags,i=e.prop,l=e.saved,c=e.setAttributes,p=(0,r.useCallback)((function(e){if(!i)return c(t({},n,e));var r=l[i]?l[i]:{},o=t({},i,kt(kt({},r),{},t({},n,e)));c(o)}),[n,i,l,c]);if(o.if||o.restrict){var f=o.restrict?o.restrict.split("."):o.if.split(".");if(!(2!==f.length||l[f[0]]&&l[f[0]][f[1]]))return null;if(1===f.length&&!l[f[0]])return null}if(Array.isArray(o.conditions)){var d=o.conditions.every((function(e){var t=e.key.split("."),n=e.operator?e.operator:"==",r=l[t[0]];return 2===t.length?r&&r[t[1]]&&yt(e.value,n,r[t[1]]):yt(e.value,n,r)}));if(!d)return null}if(o.condition&&!o.condition(l))return null;var m=l[n];i&&(m=l[i]?l[i][n]:void 0),(void 0===m||o.disabled)&&(m=o.default);var g=void 0!==m&&""!==m&&null!==m,h=[];o.options&&(h=Object.keys(o.options).map((function(e){return{label:o.options[e],value:e}})));var y=o.fullWidth?"noptin-component__field noptin-component__field-".concat(n):"noptin-component__field-lg noptin-component__field-".concat(n),v=o.description?(0,r.createElement)("span",{dangerouslySetInnerHTML:{__html:o.description}}):"",b=o.customAttributes?o.customAttributes:{},w=kt({label:o.label,value:g?m:"",onChange:p,className:"".concat(y),help:v},b);return"select"===o.el?(h.unshift({label:o.placeholder?o.placeholder:(0,u.__)("Select an option","newsletter-optin-box"),value:"",disabled:!o.canSelectPlaceholder}),(0,r.createElement)(s.SelectControl,kt(kt({},w),{},{options:h,__nextHasNoMarginBottom:!0,__next36pxDefaultSize:!0}))):"form_token"===o.el?(0,r.createElement)(s.FormTokenField,kt(kt({},w),{},{value:Array.isArray(w.value)?w.value:[],suggestions:Array.isArray(o.suggestions)?o.suggestions:[],__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0})):"multi_checkbox"===o.el||"multi_checkbox_alt"===o.el?(0,r.createElement)(Tt,kt(kt({},w),{},{options:h})):"conditional_logic"===o.el?(0,r.createElement)(gt,kt(kt({},w),{},{availableSmartTags:a,comparisons:o.comparisons,toggleText:o.toggle_text})):"input"===o.el?o.type&&["toggle","switch","checkbox","checkbox_alt"].includes(o.type)?(0,r.createElement)(s.ToggleControl,kt(kt({},w),{},{checked:!!g&&m,onChange:function(e){p(e)}})):(0,r.createElement)(Ct,kt(kt({},w),{},{setting:o,availableSmartTags:"trigger_settings"===i?[]:a,isPressEnterToChange:!o.isInputToChange})):"textarea"===o.el?(0,r.createElement)(s.TextareaControl,kt(kt({},w),{},{setting:o,placeholder:o.placeholder?o.placeholder:"",__nextHasNoMarginBottom:!0})):"paragraph"===o.el?(0,r.createElement)("div",{className:y},(0,r.createElement)(s.Tip,null,o.content)):"hero"===o.el?(0,r.createElement)("div",{className:y},(0,r.createElement)("h3",null,o.content)):"key_value_repeater"===o.el||"webhook_key_value_repeater"===o.el?(0,r.createElement)(Pt,kt(kt({},w),{},{setting:o,availableSmartTags:"trigger_settings"===i?[]:a})):n}var Mt,$t=function(e){var t=e.mergeTag,n=e.onMergeTagClick,o=function(){if(t.example)return t.example;var e="default value";return t.replacement&&(e=t.replacement),t.default&&(e=t.default),e?"".concat(t.smart_tag,' default="').concat(e,'"'):"".concat(t.smart_tag)},a=t.description&&t.description!==t.label;return(0,r.createElement)("tr",{className:"noptin-merge-tag"},(0,r.createElement)("td",null,(0,r.createElement)("label",null,(0,r.createElement)("span",{className:"noptin-merge-tag-label"},t.label),(0,r.createElement)("input",{type:"text",className:"widefat",value:"[[".concat(o(),"]]"),onFocus:function(e){e.target.select(),n&&n("[[".concat(o(),"]]"))},readOnly:!0})),a&&(0,r.createElement)("p",{className:"description noptin-mb0"},t.description)))},Nt=function(e){var t=e.availableSmartTags,n=e.onMergeTagClick;return(0,r.createElement)("div",{className:"noptin-merge-tags-wrapper"},(0,r.createElement)("table",{className:"widefat striped"},(0,r.createElement)("tbody",null,t.map((function(e){return(0,r.createElement)($t,{key:e.smart_tag,mergeTag:e,onMergeTagClick:n})})))))},Dt=function(e){var t=e.availableSmartTags;return(0,r.createElement)("div",{id:"noptin-automation-rule-smart-tags",style:{display:"none"}},(0,r.createElement)("h2",null,(0,u.__)("Smart Tags","newsletter-optin-box")),(0,r.createElement)("p",null,(0,u.__)("You can use the following smart tags to generate dynamic values.","newsletter-optin-box")),(0,r.createElement)(Nt,{availableSmartTags:t}))};function Ft(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 Bt(e){for(var n=1;n array('lodash', 'react', 'wp-components', 'wp-data', 'wp-data-controls', 'wp-date', 'wp-dom-ready', 'wp-element', 'wp-i18n', 'wp-polyfill', 'wp-primitives', 'wp-url'), 'version' => 'b072d528b8d428c857b3'); + array('lodash', 'react', 'wp-components', 'wp-data', 'wp-data-controls', 'wp-date', 'wp-dom-ready', 'wp-element', 'wp-i18n', 'wp-polyfill', 'wp-primitives', 'wp-url'), 'version' => '81b72f8223f94894d458'); diff --git a/includes/assets/js/dist/table.js b/includes/assets/js/dist/table.js index 5adb876f..32b40307 100644 --- a/includes/assets/js/dist/table.js +++ b/includes/assets/js/dist/table.js @@ -1,2 +1,2 @@ /*! For license information please see table.js.LICENSE.txt */ -(()=>{var e={184:(e,t)=>{var n;!function(){"use strict";var r={}.hasOwnProperty;function a(){for(var e=[],t=0;t{"use strict";var r=n(742),a={"text/plain":"Text","text/html":"Url",default:"Text"};e.exports=function(e,t){var n,o,i,l,c,s,u=!1;t||(t={}),n=t.debug||!1;try{if(i=r(),l=document.createRange(),c=document.getSelection(),(s=document.createElement("span")).textContent=e,s.ariaHidden="true",s.style.all="unset",s.style.position="fixed",s.style.top=0,s.style.clip="rect(0, 0, 0, 0)",s.style.whiteSpace="pre",s.style.webkitUserSelect="text",s.style.MozUserSelect="text",s.style.msUserSelect="text",s.style.userSelect="text",s.addEventListener("copy",(function(r){if(r.stopPropagation(),t.format)if(r.preventDefault(),void 0===r.clipboardData){n&&console.warn("unable to use e.clipboardData"),n&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var o=a[t.format]||a.default;window.clipboardData.setData(o,e)}else r.clipboardData.clearData(),r.clipboardData.setData(t.format,e);t.onCopy&&(r.preventDefault(),t.onCopy(r.clipboardData))})),document.body.appendChild(s),l.selectNodeContents(s),c.addRange(l),!document.execCommand("copy"))throw new Error("copy command was unsuccessful");u=!0}catch(r){n&&console.error("unable to copy using execCommand: ",r),n&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),u=!0}catch(r){n&&console.error("unable to copy using clipboardData: ",r),n&&console.error("falling back to prompt"),o=function(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}("message"in t?t.message:"Copy to clipboard: #{key}, Enter"),window.prompt(o,e)}}finally{c&&("function"==typeof c.removeRange?c.removeRange(l):c.removeAllRanges()),s&&document.body.removeChild(s),i()}return u}},679:(e,t,n)=>{"use strict";var r=n(296),a={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},o={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},i={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},l={};function c(e){return r.isMemo(e)?i:l[e.$$typeof]||a}l[r.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},l[r.Memo]=i;var s=Object.defineProperty,u=Object.getOwnPropertyNames,p=Object.getOwnPropertySymbols,d=Object.getOwnPropertyDescriptor,f=Object.getPrototypeOf,m=Object.prototype;e.exports=function e(t,n,r){if("string"!=typeof n){if(m){var a=f(n);a&&a!==m&&e(t,a,r)}var i=u(n);p&&(i=i.concat(p(n)));for(var l=c(t),h=c(n),g=0;g{"use strict";var n="function"==typeof Symbol&&Symbol.for,r=n?Symbol.for("react.element"):60103,a=n?Symbol.for("react.portal"):60106,o=n?Symbol.for("react.fragment"):60107,i=n?Symbol.for("react.strict_mode"):60108,l=n?Symbol.for("react.profiler"):60114,c=n?Symbol.for("react.provider"):60109,s=n?Symbol.for("react.context"):60110,u=n?Symbol.for("react.async_mode"):60111,p=n?Symbol.for("react.concurrent_mode"):60111,d=n?Symbol.for("react.forward_ref"):60112,f=n?Symbol.for("react.suspense"):60113,m=n?Symbol.for("react.suspense_list"):60120,h=n?Symbol.for("react.memo"):60115,g=n?Symbol.for("react.lazy"):60116,v=n?Symbol.for("react.block"):60121,b=n?Symbol.for("react.fundamental"):60117,y=n?Symbol.for("react.responder"):60118,w=n?Symbol.for("react.scope"):60119;function E(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case r:switch(e=e.type){case u:case p:case o:case l:case i:case f:return e;default:switch(e=e&&e.$$typeof){case s:case d:case g:case h:case c:return e;default:return t}}case a:return t}}}function _(e){return E(e)===p}t.AsyncMode=u,t.ConcurrentMode=p,t.ContextConsumer=s,t.ContextProvider=c,t.Element=r,t.ForwardRef=d,t.Fragment=o,t.Lazy=g,t.Memo=h,t.Portal=a,t.Profiler=l,t.StrictMode=i,t.Suspense=f,t.isAsyncMode=function(e){return _(e)||E(e)===u},t.isConcurrentMode=_,t.isContextConsumer=function(e){return E(e)===s},t.isContextProvider=function(e){return E(e)===c},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===r},t.isForwardRef=function(e){return E(e)===d},t.isFragment=function(e){return E(e)===o},t.isLazy=function(e){return E(e)===g},t.isMemo=function(e){return E(e)===h},t.isPortal=function(e){return E(e)===a},t.isProfiler=function(e){return E(e)===l},t.isStrictMode=function(e){return E(e)===i},t.isSuspense=function(e){return E(e)===f},t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===o||e===p||e===l||e===i||e===f||e===m||"object"==typeof e&&null!==e&&(e.$$typeof===g||e.$$typeof===h||e.$$typeof===c||e.$$typeof===s||e.$$typeof===d||e.$$typeof===b||e.$$typeof===y||e.$$typeof===w||e.$$typeof===v)},t.typeOf=E},296:(e,t,n)=>{"use strict";e.exports=n(103)},460:function(e,t){var n,r;n=function e(){"use strict";var t="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==t?t:{},n=!t.document&&!!t.postMessage,r=t.IS_PAPA_WORKER||!1,a={},o=0,i={parse:function(n,r){var l=(r=r||{}).dynamicTyping||!1;if(E(l)&&(r.dynamicTypingFunction=l,l={}),r.dynamicTyping=l,r.transform=!!E(r.transform)&&r.transform,r.worker&&i.WORKERS_SUPPORTED){var c=function(){if(!i.WORKERS_SUPPORTED)return!1;var n,r,l=(n=t.URL||t.webkitURL||null,r=e.toString(),i.BLOB_URL||(i.BLOB_URL=n.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ","(",r,")();"],{type:"text/javascript"})))),c=new t.Worker(l);return c.onmessage=g,c.id=o++,a[c.id]=c}();return c.userStep=r.step,c.userChunk=r.chunk,c.userComplete=r.complete,c.userError=r.error,r.step=E(r.step),r.chunk=E(r.chunk),r.complete=E(r.complete),r.error=E(r.error),delete r.worker,void c.postMessage({input:n,config:r,workerId:c.id})}var f=null;return i.NODE_STREAM_INPUT,"string"==typeof n?(n=function(e){return 65279===e.charCodeAt(0)?e.slice(1):e}(n),f=r.download?new s(r):new p(r)):!0===n.readable&&E(n.read)&&E(n.on)?f=new d(r):(t.File&&n instanceof File||n instanceof Object)&&(f=new u(r)),f.stream(n)},unparse:function(e,t){var n=!1,r=!0,a=",",o="\r\n",l='"',c=l+l,s=!1,u=null,p=!1;!function(){if("object"==typeof t){if("string"!=typeof t.delimiter||i.BAD_DELIMITERS.filter((function(e){return-1!==t.delimiter.indexOf(e)})).length||(a=t.delimiter),("boolean"==typeof t.quotes||"function"==typeof t.quotes||Array.isArray(t.quotes))&&(n=t.quotes),"boolean"!=typeof t.skipEmptyLines&&"string"!=typeof t.skipEmptyLines||(s=t.skipEmptyLines),"string"==typeof t.newline&&(o=t.newline),"string"==typeof t.quoteChar&&(l=t.quoteChar),"boolean"==typeof t.header&&(r=t.header),Array.isArray(t.columns)){if(0===t.columns.length)throw new Error("Option columns is empty");u=t.columns}void 0!==t.escapeChar&&(c=t.escapeChar+l),("boolean"==typeof t.escapeFormulae||t.escapeFormulae instanceof RegExp)&&(p=t.escapeFormulae instanceof RegExp?t.escapeFormulae:/^[=+\-@\t\r].*$/)}}();var d=new RegExp(m(l),"g");if("string"==typeof e&&(e=JSON.parse(e)),Array.isArray(e)){if(!e.length||Array.isArray(e[0]))return f(null,e,s);if("object"==typeof e[0])return f(u||Object.keys(e[0]),e,s)}else if("object"==typeof e)return"string"==typeof e.data&&(e.data=JSON.parse(e.data)),Array.isArray(e.data)&&(e.fields||(e.fields=e.meta&&e.meta.fields||u),e.fields||(e.fields=Array.isArray(e.data[0])?e.fields:"object"==typeof e.data[0]?Object.keys(e.data[0]):[]),Array.isArray(e.data[0])||"object"==typeof e.data[0]||(e.data=[e.data])),f(e.fields||[],e.data||[],s);throw new Error("Unable to serialize unrecognized input");function f(e,t,n){var i="";"string"==typeof e&&(e=JSON.parse(e)),"string"==typeof t&&(t=JSON.parse(t));var l=Array.isArray(e)&&0=this._config.preview;if(r)t.postMessage({results:l,workerId:i.WORKER_ID,finished:s});else if(E(this._config.chunk)&&!n){if(this._config.chunk(l,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);l=void 0,this._completeResults=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(l.data),this._completeResults.errors=this._completeResults.errors.concat(l.errors),this._completeResults.meta=l.meta),this._completed||!s||!E(this._config.complete)||l&&l.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),s||l&&l.meta.paused||this._nextChunk(),l}this._halted=!0},this._sendError=function(e){E(this._config.error)?this._config.error(e):r&&this._config.error&&t.postMessage({workerId:i.WORKER_ID,error:e,finished:!1})}}function s(e){var t;(e=e||{}).chunkSize||(e.chunkSize=i.RemoteChunkSize),c.call(this,e),this._nextChunk=n?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(e){this._input=e,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(t=new XMLHttpRequest,this._config.withCredentials&&(t.withCredentials=this._config.withCredentials),n||(t.onload=w(this._chunkLoaded,this),t.onerror=w(this._chunkError,this)),t.open(this._config.downloadRequestBody?"POST":"GET",this._input,!n),this._config.downloadRequestHeaders){var e=this._config.downloadRequestHeaders;for(var r in e)t.setRequestHeader(r,e[r])}if(this._config.chunkSize){var a=this._start+this._config.chunkSize-1;t.setRequestHeader("Range","bytes="+this._start+"-"+a)}try{t.send(this._config.downloadRequestBody)}catch(e){this._chunkError(e.message)}n&&0===t.status&&this._chunkError()}},this._chunkLoaded=function(){4===t.readyState&&(t.status<200||400<=t.status?this._chunkError():(this._start+=this._config.chunkSize?this._config.chunkSize:t.responseText.length,this._finished=!this._config.chunkSize||this._start>=function(e){var t=e.getResponseHeader("Content-Range");return null===t?-1:parseInt(t.substring(t.lastIndexOf("/")+1))}(t),this.parseChunk(t.responseText)))},this._chunkError=function(e){var n=t.statusText||e;this._sendError(new Error(n))}}function u(e){var t,n;(e=e||{}).chunkSize||(e.chunkSize=i.LocalChunkSize),c.call(this,e);var r="undefined"!=typeof FileReader;this.stream=function(e){this._input=e,n=e.slice||e.webkitSlice||e.mozSlice,r?((t=new FileReader).onload=w(this._chunkLoaded,this),t.onerror=w(this._chunkError,this)):t=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount=this._input.size,this.parseChunk(e.target.result)},this._chunkError=function(){this._sendError(t.error)}}function p(e){var t;c.call(this,e=e||{}),this.stream=function(e){return t=e,this._nextChunk()},this._nextChunk=function(){if(!this._finished){var e,n=this._config.chunkSize;return n?(e=t.substring(0,n),t=t.substring(n)):(e=t,t=""),this._finished=!t,this.parseChunk(e)}}}function d(e){c.call(this,e=e||{});var t=[],n=!0,r=!1;this.pause=function(){c.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){c.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(e){this._input=e,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){r&&1===t.length&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),t.length?this.parseChunk(t.shift()):n=!0},this._streamData=w((function(e){try{t.push("string"==typeof e?e:e.toString(this._config.encoding)),n&&(n=!1,this._checkIsFinished(),this.parseChunk(t.shift()))}catch(e){this._streamError(e)}}),this),this._streamError=w((function(e){this._streamCleanUp(),this._sendError(e)}),this),this._streamEnd=w((function(){this._streamCleanUp(),r=!0,this._streamData("")}),this),this._streamCleanUp=w((function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)}),this)}function f(e){var t,n,r,a=Math.pow(2,53),o=-a,l=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,c=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,s=this,u=0,p=0,d=!1,f=!1,g=[],v={data:[],errors:[],meta:{}};if(E(e.step)){var b=e.step;e.step=function(t){if(v=t,x())_();else{if(_(),0===v.data.length)return;u+=t.data.length,e.preview&&u>e.preview?n.abort():(v.data=v.data[0],b(v,s))}}}function w(t){return"greedy"===e.skipEmptyLines?""===t.join("").trim():1===t.length&&0===t[0].length}function _(){return v&&r&&(k("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+i.DefaultDelimiter+"'"),r=!1),e.skipEmptyLines&&(v.data=v.data.filter((function(e){return!w(e)}))),x()&&function(){if(v)if(Array.isArray(v.data[0])){for(var t=0;x()&&t=g.length?"__parsed_extra":g[r]),e.transform&&(i=e.transform(i,o)),i=O(o,i),"__parsed_extra"===o?(a[o]=a[o]||[],a[o].push(i)):a[o]=i}return e.header&&(r>g.length?k("FieldMismatch","TooManyFields","Too many fields: expected "+g.length+" fields but parsed "+r,p+n):r=r.length/2?"\r\n":"\r"}(a,c)),r=!1,e.delimiter)E(e.delimiter)&&(e.delimiter=e.delimiter(a),v.meta.delimiter=e.delimiter);else{var s=function(t,n,r,a,o){var l,c,s,u;o=o||[",","\t","|",";",i.RECORD_SEP,i.UNIT_SEP];for(var p=0;p=l)return V(!0)}else for(L=u,u++;;){if(-1===(L=i.indexOf(t,L+1)))return f||_.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:w.length,index:u}),q();if(L===h-1)return q(i.substring(u,L).replace(B,t));if(t!==s||i[L+1]!==s){if(t===s||0===L||i[L-1]!==s){-1!==M&&M=l)return V(!0);break}_.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:w.length,index:u}),L++}}else L++}return q();function H(e){w.push(e),O=u}function U(e){var t=0;if(-1!==e){var n=i.substring(L+1,e);n&&""===n.trim()&&(t=n.length)}return t}function q(e){return f||(void 0===e&&(e=i.substring(u)),x.push(e),u=h,H(x),y&&K()),V()}function W(e){u=e,H(x),x=[],N=i.indexOf(r,u)}function V(e){return{data:w,errors:_,meta:{delimiter:n,linebreak:r,aborted:p,truncated:!!e,cursor:O+(d||0)}}}function K(){o(V()),w=[],_=[]}},this.abort=function(){p=!0},this.getCharIndex=function(){return u}}function g(e){var t=e.data,n=a[t.workerId],r=!1;if(t.error)n.userError(t.error,t.file);else if(t.results&&t.results.data){var o={abort:function(){r=!0,v(t.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:b,resume:b};if(E(n.userStep)){for(var i=0;i{e.exports=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,n=[],r=0;r{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(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.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{"use strict";var e={};n.r(e),n.d(e,{apiFetch:()=>Be.apiFetch,beforeDeleteRecord:()=>Ue,setPartialRecords:()=>Le,setRecord:()=>$e,setRecordOverview:()=>We,setRecords:()=>ze,setSchema:()=>He,setTabContent:()=>qe});var t={};n.r(t),n.d(t,{getAllRecords:()=>pt,getPartialRecords:()=>ft,getQuerySummary:()=>ut,getQueryTotal:()=>st,getRecord:()=>mt,getRecordIDs:()=>ct,getRecordOverview:()=>vt,getRecords:()=>dt,getSchema:()=>ht,getTabContent:()=>gt});const r=window.wp.element,a=window.wp.domReady;var o=n.n(a);const i=window.wp.url,l=window.wp.components,c=window.React;var s,u;function p(e,t){if(!1===e||null==e)throw new Error(t)}function d(e,t){if(!e){"undefined"!=typeof console&&console.warn(t);try{throw new Error(t)}catch(e){}}}function f(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function m(e,t,n){void 0===n&&(n="/");let r=j(("string"==typeof t?f(t):t).pathname||"/",n);if(null==r)return null;let a=h(e);!function(e){e.sort(((e,t)=>e.score!==t.score?t.score-e.score:function(e,t){return e.length===t.length&&e.slice(0,-1).every(((e,n)=>e===t[n]))?e[e.length-1]-t[t.length-1]:0}(e.routesMeta.map((e=>e.childrenIndex)),t.routesMeta.map((e=>e.childrenIndex)))))}(a);let o=null;for(let e=0;null==o&&e{let i={relativePath:void 0===o?e.path||"":o,caseSensitive:!0===e.caseSensitive,childrenIndex:a,route:e};i.relativePath.startsWith("/")&&(p(i.relativePath.startsWith(r),'Absolute route path "'+i.relativePath+'" nested under path "'+r+'" is not valid. An absolute child route path must start with the combined path of all its parent routes.'),i.relativePath=i.relativePath.slice(r.length));let l=P([r,i.relativePath]),c=n.concat(i);e.children&&e.children.length>0&&(p(!0!==e.index,'Index routes must not have child routes. Please remove all child routes from route path "'+l+'".'),h(e.children,t,c,l)),(null!=e.path||e.index)&&t.push({path:l,score:O(l,e.index),routesMeta:c})};return e.forEach(((e,t)=>{var n;if(""!==e.path&&null!=(n=e.path)&&n.includes("?"))for(let n of g(e.path))a(e,t,n);else a(e,t)})),t}function g(e){let t=e.split("/");if(0===t.length)return[];let[n,...r]=t,a=n.endsWith("?"),o=n.replace(/\?$/,"");if(0===r.length)return a?[o,""]:[o];let i=g(r.join("/")),l=[];return l.push(...i.map((e=>""===e?o:[o,e].join("/")))),a&&l.push(...i),l.map((t=>e.startsWith("/")&&""===t?"/":t))}!function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"}(s||(s={})),function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"}(u||(u={})),new Set(["lazy","caseSensitive","path","id","index","children"]);const v=/^:\w+$/,b=3,y=2,w=1,E=10,_=-2,x=e=>"*"===e;function O(e,t){let n=e.split("/"),r=n.length;return n.some(x)&&(r+=_),t&&(r+=y),n.filter((e=>!x(e))).reduce(((e,t)=>e+(v.test(t)?b:""===t?w:E)),r)}function k(e,t){let{routesMeta:n}=e,r={},a="/",o=[];for(let e=0;e(r.push(t),"/([^\\/]+)")));return e.endsWith("*")?(r.push("*"),a+="*"===e||"/*"===e?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?a+="\\/*$":""!==e&&"/"!==e&&(a+="(?:(?=\\/|$))"),[new RegExp(a,t?void 0:"i"),r]}(e.path,e.caseSensitive,e.end),a=t.match(n);if(!a)return null;let o=a[0],i=o.replace(/(.)\/+$/,"$1"),l=a.slice(1);return{params:r.reduce(((e,t,n)=>{if("*"===t){let e=l[n]||"";i=o.slice(0,o.length-e.length).replace(/(.)\/+$/,"$1")}return e[t]=function(e,t){try{return decodeURIComponent(e)}catch(n){return d(!1,'The value for the URL param "'+t+'" will not be decoded because the string "'+e+'" is a malformed URL segment. This is probably due to a bad percent encoding ('+n+")."),e}}(l[n]||"",t),e}),{}),pathname:o,pathnameBase:i,pattern:e}}function C(e){try{return decodeURI(e)}catch(t){return d(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent encoding ('+t+")."),e}}function j(e,t){if("/"===t)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&"/"!==r?null:e.slice(n)||"/"}const P=e=>e.join("/").replace(/\/\/+/g,"/"),R=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/");Error;const D=["post","put","patch","delete"],A=(new Set(D),["get",...D]);function F(){return F=Object.assign?Object.assign.bind():function(e){for(var t=1;te.route.id&&(null==i?void 0:i[e.route.id])));e>=0||p(!1),o=o.slice(0,Math.min(o.length,e+1))}return o.reduceRight(((e,r,a)=>{let l=r.route.id?null==i?void 0:i[r.route.id]:null,s=null;n&&(s=r.route.errorElement||W);let u=t.concat(o.slice(0,a+1)),p=()=>{let t;return t=l?s:r.route.Component?c.createElement(r.route.Component,null):r.route.element?r.route.element:e,c.createElement(K,{match:r,routeContext:{outlet:e,matches:u,isDataRoute:null!=n},children:t})};return n&&(r.route.ErrorBoundary||r.route.errorElement||0===a)?c.createElement(V,{location:n.location,revalidation:n.revalidation,component:s,error:l,children:p(),routeContext:{outlet:null,matches:u,isDataRoute:!0}}):p()}),null)}(v&&v.map((e=>Object.assign({},e,{params:Object.assign({},i,e.params),pathname:P([l,r.encodeLocation?r.encodeLocation(e.pathname).pathname:e.pathname]),pathnameBase:"/"===e.pathnameBase?l:P([l,r.encodeLocation?r.encodeLocation(e.pathnameBase).pathname:e.pathnameBase])}))),a,n);return t&&b?c.createElement(N.Provider,{value:{location:F({pathname:"/",search:"",hash:"",state:null,key:"default"},u),navigationType:s.Pop}},b):b}function q(){let e=function(){var e;let t=c.useContext(L),n=function(e){let t=c.useContext(I);return t||p(!1),t}(G.UseRouteError),r=function(e){let t=function(e){let t=c.useContext(B);return t||p(!1),t}(),n=t.matches[t.matches.length-1];return n.route.id||p(!1),n.route.id}(G.UseRouteError);return t||(null==(e=n.errors)?void 0:e[r])}(),t=function(e){return null!=e&&"number"==typeof e.status&&"string"==typeof e.statusText&&"boolean"==typeof e.internal&&"data"in e}(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return c.createElement(c.Fragment,null,c.createElement("h2",null,"Unexpected Application Error!"),c.createElement("h3",{style:{fontStyle:"italic"}},t),n?c.createElement("pre",{style:r},n):null,null)}const W=c.createElement(q,null);class V extends c.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||"idle"!==t.revalidation&&"idle"===e.revalidation?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error||t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){console.error("React Router caught the following error during render",e,t)}render(){return this.state.error?c.createElement(B.Provider,{value:this.props.routeContext},c.createElement(L.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function K(e){let{routeContext:t,match:n,children:r}=e,a=c.useContext(T);return a&&a.static&&a.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=n.route.id),c.createElement(B.Provider,{value:t},r)}var Q,G,Y;function X(e){return function(e){let t=c.useContext(B).outlet;return t?c.createElement($.Provider,{value:e},t):t}(e.context)}function J(e){p(!1)}function Z(e){let{basename:t="/",children:n=null,location:r,navigationType:a=s.Pop,navigator:o,static:i=!1}=e;z()&&p(!1);let l=t.replace(/^\/*/,"/"),u=c.useMemo((()=>({basename:l,navigator:o,static:i})),[l,o,i]);"string"==typeof r&&(r=f(r));let{pathname:d="/",search:m="",hash:h="",state:g=null,key:v="default"}=r,b=c.useMemo((()=>{let e=j(d,l);return null==e?null:{location:{pathname:e,search:m,hash:h,state:g,key:v},navigationType:a}}),[l,d,m,h,g,v,a]);return null==b?null:c.createElement(M.Provider,{value:u},c.createElement(N.Provider,{children:n,value:b}))}function ee(e){let{children:t,location:n}=e;return U(te(t),n)}function te(e,t){void 0===t&&(t=[]);let n=[];return c.Children.forEach(e,((e,r)=>{if(!c.isValidElement(e))return;let a=[...t,r];if(e.type===c.Fragment)return void n.push.apply(n,te(e.props.children,a));e.type!==J&&p(!1),e.props.index&&e.props.children&&p(!1);let o={id:e.props.id||a.join("-"),caseSensitive:e.props.caseSensitive,element:e.props.element,Component:e.props.Component,index:e.props.index,path:e.props.path,loader:e.props.loader,action:e.props.action,errorElement:e.props.errorElement,ErrorBoundary:e.props.ErrorBoundary,hasErrorBoundary:null!=e.props.ErrorBoundary||null!=e.props.errorElement,shouldRevalidate:e.props.shouldRevalidate,handle:e.props.handle,lazy:e.props.lazy};e.props.children&&(o.children=te(e.props.children,a)),n.push(o)})),n}!function(e){e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate"}(Q||(Q={})),function(e){e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId"}(G||(G={})),c.startTransition,function(e){e[e.pending=0]="pending",e[e.success=1]="success",e[e.error=2]="error"}(Y||(Y={})),new Promise((()=>{})),c.Component,new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);const ne=c.startTransition;function re(e){let{basename:t,children:n,future:r,history:a}=e,[o,i]=c.useState({action:a.action,location:a.location}),{v7_startTransition:l}=r||{},s=c.useCallback((e=>{l&&ne?ne((()=>i(e))):i(e)}),[i,l]);return c.useLayoutEffect((()=>a.listen(s)),[a,s]),c.createElement(Z,{basename:t,children:n,location:o.location,navigationType:o.action,navigator:a})}var ae,oe;"undefined"!=typeof window&&void 0!==window.document&&window.document.createElement,function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher"}(ae||(ae={})),function(e){e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"}(oe||(oe={}));const ie=(0,c.createContext)(null),le={didCatch:!1,error:null};class ce extends c.Component{constructor(e){super(e),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=le}static getDerivedStateFromError(e){return{didCatch:!0,error:e}}resetErrorBoundary(){const{error:e}=this.state;if(null!==e){for(var t,n,r=arguments.length,a=new Array(r),o=0;o0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return e.length!==t.length||e.some(((e,n)=>!Object.is(e,t[n])))}(e.resetKeys,r)&&(null===(a=(o=this.props).onReset)||void 0===a||a.call(o,{next:r,prev:e.resetKeys,reason:"keys"}),this.setState(le))}render(){const{children:e,fallbackRender:t,FallbackComponent:n,fallback:r}=this.props,{didCatch:a,error:o}=this.state;let i=e;if(a){const e={error:o,resetErrorBoundary:this.resetErrorBoundary};if((0,c.isValidElement)(r))i=r;else if("function"==typeof t)i=t(e);else{if(!n)throw new Error("react-error-boundary requires either a fallback, fallbackRender, or FallbackComponent prop");i=(0,c.createElement)(n,e)}}return(0,c.createElement)(ie.Provider,{value:{didCatch:a,error:o,resetErrorBoundary:this.resetErrorBoundary}},i)}}const se=window.wp.i18n;function ue(e){var t=e.error;return(0,r.createElement)(l.Notice,{status:"error",isDismissible:!1},(0,r.createElement)("strong",null,(0,se.__)("Error:","newsletter-optin-box"))," ",t.message)}function pe(e){var t=e.children;return(0,r.createElement)(ce,{FallbackComponent:ue},t)}function de(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&void 0!==arguments[0]?arguments[0]:"/";if(!ye){var t=function(e){void 0===e&&(e={});var t=e.window,n=void 0===t?document.defaultView:t,r=n.history;function a(){var e=n.location,t=e.pathname,a=e.search,o=e.hash,i=r.state||{};return[i.idx,we({pathname:t,search:a,hash:o,state:i.usr||null,key:i.key||"default"})]}var o=null;n.addEventListener(_e,(function(){if(o)p.call(o),o=null;else{var e=be.Pop,t=a(),n=t[0],r=t[1];if(p.length){if(null!=n){var i=c-n;i&&(o={action:e,location:r,retry:function(){v(-1*i)}},v(i))}}else g(e)}}));var i=be.Pop,l=a(),c=l[0],s=l[1],u=Oe(),p=Oe();function d(e){return"string"==typeof e?e:function(e){var t=e.pathname,n=void 0===t?"/":t,r=e.search,a=void 0===r?"":r,o=e.hash,i=void 0===o?"":o;return a&&"?"!==a&&(n+="?"===a.charAt(0)?a:"?"+a),i&&"#"!==i&&(n+="#"===i.charAt(0)?i:"#"+i),n}(e)}function f(e,t){return void 0===t&&(t=null),we(ve({pathname:s.pathname,hash:"",search:""},"string"==typeof e?function(e){var t={};if(e){var n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));var r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}(e):e,{state:t,key:Math.random().toString(36).substr(2,8)}))}function m(e,t){return[{usr:e.state,key:e.key,idx:t},d(e)]}function h(e,t,n){return!p.length||(p.call({action:e,location:t,retry:n}),!1)}function g(e){i=e;var t=a();c=t[0],s=t[1],u.call({action:i,location:s})}function v(e){r.go(e)}return null==c&&(c=0,r.replaceState(ve({},r.state,{idx:c}),"")),{get action(){return i},get location(){return s},createHref:d,push:function e(t,a){var o=be.Push,i=f(t,a);if(h(o,i,(function(){e(t,a)}))){var l=m(i,c+1),s=l[0],u=l[1];try{r.pushState(s,"",u)}catch(e){n.location.assign(u)}g(o)}},replace:function e(t,n){var a=be.Replace,o=f(t,n);if(h(a,o,(function(){e(t,n)}))){var i=m(o,c),l=i[0],s=i[1];r.replaceState(l,"",s),g(a)}},go:v,back:function(){v(-1)},forward:function(){v(1)},listen:function(e){return u.push(e)},block:function(e){var t=p.push(e);return 1===p.length&&n.addEventListener(Ee,xe),function(){t(),p.length||n.removeEventListener(Ee,xe)}}}}();ye={get action(){return t.action},get location(){var n=t.location,r=(0,i.getQueryArgs)(n.search).hizzle_path||e;return Se(Se({},n),{},{pathname:r})},createHref:t.createHref,push:t.push,replace:t.replace,go:t.go,back:t.back,forward:t.forward,block:t.block,listen:function(e){var n=this;return t.listen((function(){e({action:n.action,location:n.location})}))}}}return window._history=ye,ye}const je=window.lodash;function Pe(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;t1&&void 0!==arguments[1]?arguments[1]:De(),n=Re(Re({},arguments.length>2&&void 0!==arguments[2]?arguments[2]:Ae()),e);return"/"!==t&&(n.hizzle_path=t),Object.keys(n).forEach((function(e){""===n[e]&&delete n[e]})),(0,i.addQueryArgs)("admin.php",n)}function Te(e){var t=Fe(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:De(),arguments.length>2&&void 0!==arguments[2]?arguments[2]:Ae());Ce().push(t)}var Ie=function(){var e=me((0,r.useState)({}),2),t=e[0],n=e[1],a=me((0,r.useState)(!0),2),o=a[0],i=a[1];return(0,r.useLayoutEffect)((function(){return e=function(){i(!0)},window.hizzleNavigation=null!==(t=window.hizzleNavigation)&&void 0!==t?t:{},window.hizzleNavigation.historyPatched||(n=window.history,r=n.pushState,a=n.replaceState,n.pushState=function(e){var t=new CustomEvent("pushstate",{state:e});return window.dispatchEvent(t),r.apply(n,arguments)},n.replaceState=function(e){var t=new CustomEvent("replacestate",{state:e});return window.dispatchEvent(t),a.apply(n,arguments)},window.hizzleNavigation.historyPatched=!0),window.addEventListener("popstate",e),window.addEventListener("pushstate",e),window.addEventListener("replacestate",e),function(){window.removeEventListener("popstate",e),window.removeEventListener("pushstate",e),window.removeEventListener("replacestate",e)};var e,t,n,r,a}),[]),(0,r.useEffect)((function(){if(o){var e=Ae();n(e),i(!1)}}),[o]),t},Me=function(e){Ce().push((0,i.addQueryArgs)("admin.php",(0,i.getQueryArgs)(e))),window.scrollTo({top:0,behavior:"smooth"})};const Ne=window.wp.data,Be=window.wp.dataControls;var Le=function(e,t){return{type:"SET_PARTIAL_RECORDS",records:e,queryString:t}},ze=function(e,t){return{type:"SET_RECORDS",records:e,queryString:t}},$e=function(e){return{type:"SET_RECORD",record:e}},He=function(e){return{type:"SET_SCHEMA",schema:e}},Ue=function(e){return{type:"BEFORE_DELETE_RECORD",id:e}},qe=function(e,t,n){return{type:"SET_TAB_CONTENT",id:e,tab_id:t,content:n}},We=function(e,t){return{type:"SET_RECORD_OVERVIEW",id:e,overview:t}};const Ve=window.regeneratorRuntime;var Ke=n.n(Ve);function Qe(e,t){return{createRecord:Ke().mark((function n(r,a){var o,i;return Ke().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return o="".concat(e,"/v1/").concat(t),n.next=4,(0,Be.apiFetch)({path:o,method:"POST",data:r});case 4:if(!(i=n.sent)){n.next=17;break}return n.next=8,a.invalidateResolutionForStoreSelector("getRecords");case 8:return n.next=10,a.invalidateResolutionForStoreSelector("getPartialRecords");case 10:return n.next=12,a.invalidateResolution("getRecord",[i.id]);case 12:return n.next=14,a.startResolution("getRecord",[i.id]);case 14:return n.next=16,a.finishResolution("getRecord",[i.id]);case 16:return n.abrupt("return",$e(i));case 17:case"end":return n.stop()}}),n)})),updateRecord:Ke().mark((function n(r,a,o){var i,l;return Ke().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return i="".concat(e,"/v1/").concat(t,"/").concat(r),n.next=4,(0,Be.apiFetch)({path:i,method:"PUT",data:a});case 4:if(!(l=n.sent)){n.next=11;break}return n.next=8,o.startResolution("getRecord",[l.id]);case 8:return n.next=10,o.finishResolution("getRecord",[l.id]);case 10:return n.abrupt("return",o.setRecord(l));case 11:case"end":return n.stop()}}),n)})),deleteRecord:Ke().mark((function n(r,a){var o;return Ke().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,a.beforeDeleteRecord(r);case 2:return o="".concat(e,"/v1/").concat(t,"/").concat(r),n.next=6,(0,Be.apiFetch)({path:o,method:"DELETE"});case 6:return n.next=8,a.emptyCache(a);case 8:return n.abrupt("return",{type:"DELETE_RECORD",id:r});case 9:case"end":return n.stop()}}),n)})),deleteRecords:Ke().mark((function n(r,a){var o;return Ke().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return o="".concat(e,"/v1/").concat(t).concat(r),n.next=4,(0,Be.apiFetch)({path:o,method:"DELETE"});case 4:return n.next=6,a.emptyCache(a);case 6:return n.abrupt("return",{type:"DELETE_RECORDS"});case 7:case"end":return n.stop()}}),n)})),batchAction:Ke().mark((function n(r,a){var o,i;return Ke().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return o="".concat(e,"/v1/").concat(t,"/batch"),n.next=4,(0,Be.apiFetch)({path:o,method:"POST",data:r});case 4:return i=n.sent,n.next=7,a.emptyCache(a);case 7:return n.abrupt("return",{type:"BATCH_ACTION",result:i});case 8:case"end":return n.stop()}}),n)})),emptyCache:Ke().mark((function e(t){return Ke().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.invalidateResolutionForStoreSelector("getRecords");case 2:return e.next=4,t.invalidateResolutionForStoreSelector("getPartialRecords");case 4:return e.next=6,t.invalidateResolutionForStoreSelector("getRecord");case 6:return e.next=8,t.invalidateResolutionForStoreSelector("getRecordOverview");case 8:return e.next=10,t.invalidateResolutionForStoreSelector("getTabContent");case 10:case"end":return e.stop()}}),e)}))}}var Ge={records:{byID:{},queries:{}},partialRecords:{},schema:{},tabContent:{},recordOverview:{}};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 Xe(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return"SET_SCHEMA"===t.type?t.schema:e},records:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{byID:{},queries:{}},t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"SET_RECORDS":var n=""===t.queryString?"all":t.queryString;return{byID:Xe(Xe({},e.byID),t.records.items.reduce((function(e,t){return Xe(Xe({},e),{},ge({},t.id,t))}),{})),queries:Xe(Xe({},e.queries),{},ge({},n,{items:t.records.items.map((function(e){return e.id})),summary:t.records.summary,total:t.records.total}))};case"SET_RECORD":return Xe(Xe({},e),{},{byID:Xe(Xe({},e.byID),{},ge({},t.record.id,t.record))});case"BEFORE_DELETE_RECORD":var r=Xe({},e.queries);return Object.keys(r).forEach((function(e){var n=r[e].items.indexOf(t.id);-1!==n&&(r[e].items.splice(n,1),r[e].total-=1)})),Xe(Xe({},e),{},{queries:r});case"DELETE_RECORD":var a=Xe({},e.byID);return delete a[t.id],Xe(Xe({},e),{},{byID:a});case"DELETE_RECORDS":return Xe(Xe({},e),{},{queries:{},byID:{}})}return e},partialRecords:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;if("SET_PARTIAL_RECORDS"===t.type){var n=""===t.queryString?"all":t.queryString;return Xe(Xe({},e),{},ge({},n,t.records))}return e},tabContent:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return"SET_TAB_CONTENT"===t.type?Xe(Xe({},e),{},ge({},"".concat(t.id,"_").concat(t.tab_id),t.content)):e},recordOverview:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return"SET_RECORD_OVERVIEW"===t.type?Xe(Xe({},e),{},ge({},t.id,t.overview)):e}});var Ze=function(e){return(0,i.addQueryArgs)(e,{uniqid:Math.random()})};function et(e,t){return{getRecords:Ke().mark((function n(r){var a,o,i,l;return Ke().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return a=Ze("".concat(e,"/v1/").concat(t).concat(r)),n.next=3,(0,Be.apiFetch)({path:a});case 3:if(!(o=n.sent)){n.next=12;break}return i="".concat(e,"/").concat(t),l=o.items.map((function(e){return[e.id]})),n.next=9,Ne.controls.dispatch(i,"startResolutions","getRecord",l);case 9:return n.next=11,Ne.controls.dispatch(i,"finishResolutions","getRecord",l);case 11:return n.abrupt("return",ze(o,r));case 12:case"end":return n.stop()}}),n)})),getPartialRecords:Ke().mark((function n(r){var a,o;return Ke().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return a=Ze("".concat(e,"/v1/").concat(t).concat(r)),n.next=3,(0,Be.apiFetch)({path:a});case 3:if(!(o=n.sent)){n.next=6;break}return n.abrupt("return",Le(o.items,r));case 6:case"end":return n.stop()}}),n)})),getRecord:Ke().mark((function n(r){var a,o;return Ke().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return a=Ze("".concat(e,"/v1/").concat(t,"/").concat(r)),n.next=3,(0,Be.apiFetch)({path:a});case 3:return o=n.sent,n.abrupt("return",$e(o));case 5:case"end":return n.stop()}}),n)})),getSchema:Ke().mark((function n(){var r,a;return Ke().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=Ze("".concat(e,"/v1/").concat(t,"/collection_schema")),n.next=3,(0,Be.apiFetch)({path:r});case 3:return a=n.sent,n.abrupt("return",He(a));case 5:case"end":return n.stop()}}),n)})),getTabContent:Ke().mark((function n(r,a){var o,i;return Ke().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return o=Ze("".concat(e,"/v1/").concat(t,"/").concat(r,"/").concat(a)),n.next=3,(0,Be.apiFetch)({path:o});case 3:return i=n.sent,n.abrupt("return",qe(r,a,i));case 5:case"end":return n.stop()}}),n)})),getRecordOverview:Ke().mark((function n(r){var a,o;return Ke().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return a=Ze("".concat(e,"/v1/").concat(t,"/").concat(r,"/overview")),n.next=3,(0,Be.apiFetch)({path:a});case 3:return o=n.sent,n.abrupt("return",We(r,o));case 5:case"end":return n.stop()}}),n)}))}}var tt="NOT_FOUND",nt=function(e,t){return e===t};function rt(e,t){var n,r,a="object"==typeof t?t:{equalityCheck:t},o=a.equalityCheck,i=void 0===o?nt:o,l=a.maxSize,c=void 0===l?1:l,s=a.resultEqualityCheck,u=function(e){return function(t,n){if(null===t||null===n||t.length!==n.length)return!1;for(var r=t.length,a=0;a-1){var a=n[r];return r>0&&(n.splice(r,1),n.unshift(a)),a.value}return tt}return{get:r,put:function(t,a){r(t)===tt&&(n.unshift({key:t,value:a}),n.length>e&&n.pop())},getEntries:function(){return n},clear:function(){n=[]}}}(c,u);function d(){var t=p.get(arguments);if(t===tt){if(t=e.apply(null,arguments),s){var n=p.getEntries().find((function(e){return s(e.value,t)}));n&&(t=n.value)}p.put(arguments,t)}return t}return d.clearCache=function(){return p.clear()},d}function at(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r1?arguments[1]:void 0;return t=""===t?"all":t,null!==(e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ge).records.queries[t])&&void 0!==e?e:lt},st=function(){var e,t=arguments.length>1?arguments[1]:void 0;return t=""===t?"all":t,(null===(e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ge).records.queries[t])||void 0===e?void 0:e.total)||0},ut=function(){var e,t=arguments.length>1?arguments[1]:void 0;return t=""===t?"all":t,(null===(e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ge).records.queries[t])||void 0===e?void 0:e.summary)||{}},pt=function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ge).records.byID||{}},dt=at(rt)(ct,pt,(function(e,t){return it(it({},e),{},{items:e.items.map((function(e){return t[e]}))})})),ft=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ge,t=arguments.length>1?arguments[1]:void 0;return t=""===t?"all":t,Array.isArray(e.partialRecords[t])?e.partialRecords[t]:[]},mt=function(){var e=arguments.length>1?arguments[1]:void 0;return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ge).records.byID[e]||null},ht=function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ge).schema||{}},gt=function(){var e=arguments.length>1?arguments[1]:void 0,t=arguments.length>2?arguments[2]:void 0;return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ge).tabContent["".concat(e,"_").concat(t)]||{}},vt=function(){var e=arguments.length>1?arguments[1]:void 0;return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ge).recordOverview[e]||[]};function bt(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 yt(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:"";return Me(Fe({},"/".concat(t,"/").concat(n,"/").concat(e)))}}function At(){var e=H();return Ot(e.namespace,e.collection)}function Ft(){var e=H();return function(e,t,n){var a="".concat(e,"/").concat(t);n=parseInt(n,10);var o=(0,Ne.useDispatch)(a),i=(0,r.useMemo)((function(){return{save:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return o.updateRecord(n,e,o)},delete:function(){return o.deleteRecord(n,o).catch((function(e){console.error(e)}))}}}),[n]);return yt(yt({},_t((function(e){return e(a).getRecord(n)}),[e,t,n])),i)}(e.namespace,e.collection,e.id)}function Tt(){var e=H();return function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r="".concat(e,"/").concat(t),a=Et(n);return _t((function(e){return e(r).getRecords(a)}),[e,t,a])}(e.namespace,e.collection,Ae())}function It(){return Tt().data.total||0}function Mt(e){var t=Object.create(null);return function(n){return void 0===t[n]&&(t[n]=e(n)),t[n]}}var Nt=/^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|download|draggable|encType|enterKeyHint|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/,Bt=Mt((function(e){return Nt.test(e)||111===e.charCodeAt(0)&&110===e.charCodeAt(1)&&e.charCodeAt(2)<91})),Lt=function(){function e(e){var t=this;this._insertTag=function(e){var n;n=0===t.tags.length?t.insertionPoint?t.insertionPoint.nextSibling:t.prepend?t.container.firstChild:t.before:t.tags[t.tags.length-1].nextSibling,t.container.insertBefore(e,n),t.tags.push(e)},this.isSpeedy=void 0===e.speedy||e.speedy,this.tags=[],this.ctr=0,this.nonce=e.nonce,this.key=e.key,this.container=e.container,this.prepend=e.prepend,this.insertionPoint=e.insertionPoint,this.before=null}var t=e.prototype;return t.hydrate=function(e){e.forEach(this._insertTag)},t.insert=function(e){this.ctr%(this.isSpeedy?65e3:1)==0&&this._insertTag(function(e){var t=document.createElement("style");return t.setAttribute("data-emotion",e.key),void 0!==e.nonce&&t.setAttribute("nonce",e.nonce),t.appendChild(document.createTextNode("")),t.setAttribute("data-s",""),t}(this));var t=this.tags[this.tags.length-1];if(this.isSpeedy){var n=function(e){if(e.sheet)return e.sheet;for(var t=0;t0?Vt(nn,--en):0,Jt--,10===tn&&(Jt=1,Xt--),tn}function ln(){return tn=en2||pn(tn)>3?"":" "}function gn(e,t){for(;--t&&ln()&&!(tn<48||tn>102||tn>57&&tn<65||tn>70&&tn<97););return un(e,sn()+(t<6&&32==cn()&&32==ln()))}function vn(e){for(;ln();)switch(tn){case e:return en;case 34:case 39:34!==e&&39!==e&&vn(tn);break;case 40:41===e&&vn(e);break;case 92:ln()}return en}function bn(e,t){for(;ln()&&e+tn!==57&&(e+tn!==84||47!==cn()););return"/*"+un(t,en-1)+"*"+$t(47===e?e:ln())}function yn(e){for(;!pn(cn());)ln();return un(e,en)}var wn="-ms-",En="-moz-",_n="-webkit-",xn="comm",On="rule",kn="decl",Sn="@keyframes";function Cn(e,t){for(var n="",r=Gt(e),a=0;a0&&Qt(x)-p&&Yt(f>32?Fn(x+";",r,n,p-1):Fn(qt(x," ","")+";",r,n,p-2),c);break;case 59:x+=";";default:if(Yt(_=Dn(x,t,n,s,u,a,l,y,w=[],E=[],p),o),123===b)if(0===u)Rn(x,t,_,_,w,o,p,l,E);else switch(99===d&&110===Vt(x,3)?100:d){case 100:case 108:case 109:case 115:Rn(e,_,_,r&&Yt(Dn(e,_,_,0,0,a,l,y,a,w=[],p),E),a,E,p,l,r?w:E);break;default:Rn(x,_,_,_,[""],E,0,l,E)}}s=u=f=0,h=v=1,y=x="",p=i;break;case 58:p=1+Qt(x),f=m;default:if(h<1)if(123==b)--h;else if(125==b&&0==h++&&125==on())continue;switch(x+=$t(b),b*h){case 38:v=u>0?1:(x+="\f",-1);break;case 44:l[s++]=(Qt(x)-1)*v,v=1;break;case 64:45===cn()&&(x+=mn(ln())),d=cn(),u=p=Qt(y=x+=yn(sn())),b++;break;case 45:45===m&&2==Qt(x)&&(h=0)}}return o}function Dn(e,t,n,r,a,o,i,l,c,s,u){for(var p=a-1,d=0===a?o:[""],f=Gt(d),m=0,h=0,g=0;m0?d[v]+" "+b:qt(b,/&\f/g,d[v])))&&(c[g++]=y);return rn(e,t,n,0===a?On:l,c,s,u)}function An(e,t,n){return rn(e,t,n,xn,$t(tn),Kt(e,2,-2),0)}function Fn(e,t,n,r){return rn(e,t,n,kn,Kt(e,0,r),Kt(e,r+1,-1),r)}var Tn=function(e,t,n){for(var r=0,a=0;r=a,a=cn(),38===r&&12===a&&(t[n]=1),!pn(a);)ln();return un(e,en)},In=new WeakMap,Mn=function(e){if("rule"===e.type&&e.parent&&!(e.length<1)){for(var t=e.value,n=e.parent,r=e.column===n.column&&e.line===n.line;"rule"!==n.type;)if(!(n=n.parent))return;if((1!==e.props.length||58===t.charCodeAt(0)||In.get(n))&&!r){In.set(e,!0);for(var a=[],o=function(e,t){return fn(function(e,t){var n=-1,r=44;do{switch(pn(r)){case 0:38===r&&12===cn()&&(t[n]=1),e[n]+=Tn(en-1,t,n);break;case 2:e[n]+=mn(r);break;case 4:if(44===r){e[++n]=58===cn()?"&\f":"",t[n]=e[n].length;break}default:e[n]+=$t(r)}}while(r=ln());return e}(dn(e),t))}(t,a),i=n.props,l=0,c=0;l6)switch(Vt(e,t+1)){case 109:if(45!==Vt(e,t+4))break;case 102:return qt(e,/(.+:)(.+)-([^]+)/,"$1"+_n+"$2-$3$1"+En+(108==Vt(e,t+3)?"$3":"$2-$3"))+e;case 115:return~Wt(e,"stretch")?Bn(qt(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(115!==Vt(e,t+1))break;case 6444:switch(Vt(e,Qt(e)-3-(~Wt(e,"!important")&&10))){case 107:return qt(e,":",":"+_n)+e;case 101:return qt(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+_n+(45===Vt(e,14)?"inline-":"")+"box$3$1"+_n+"$2$3$1"+wn+"$2box$3")+e}break;case 5936:switch(Vt(e,t+11)){case 114:return _n+e+wn+qt(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return _n+e+wn+qt(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return _n+e+wn+qt(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return _n+e+wn+e+e}return e}var Ln=[function(e,t,n,r){if(e.length>-1&&!e.return)switch(e.type){case kn:e.return=Bn(e.value,e.length);break;case Sn:return Cn([an(e,{value:qt(e.value,"@","@"+_n)})],r);case On:if(e.length)return function(e,t){return e.map(t).join("")}(e.props,(function(t){switch(function(e,t){return(e=/(::plac\w+|:read-\w+)/.exec(e))?e[0]:e}(t)){case":read-only":case":read-write":return Cn([an(e,{props:[qt(t,/:(read-\w+)/,":-moz-$1")]})],r);case"::placeholder":return Cn([an(e,{props:[qt(t,/:(plac\w+)/,":"+_n+"input-$1")]}),an(e,{props:[qt(t,/:(plac\w+)/,":-moz-$1")]}),an(e,{props:[qt(t,/:(plac\w+)/,wn+"input-$1")]})],r)}return""}))}}],zn=function(e){var t=e.key;if("css"===t){var n=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(n,(function(e){-1!==e.getAttribute("data-emotion").indexOf(" ")&&(document.head.appendChild(e),e.setAttribute("data-s",""))}))}var r,a,o=e.stylisPlugins||Ln,i={},l=[];r=e.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+t+' "]'),(function(e){for(var t=e.getAttribute("data-emotion").split(" "),n=1;n=4;++r,a-=4)t=1540483477*(65535&(t=255&e.charCodeAt(r)|(255&e.charCodeAt(++r))<<8|(255&e.charCodeAt(++r))<<16|(255&e.charCodeAt(++r))<<24))+(59797*(t>>>16)<<16),n=1540483477*(65535&(t^=t>>>24))+(59797*(t>>>16)<<16)^1540483477*(65535&n)+(59797*(n>>>16)<<16);switch(a){case 3:n^=(255&e.charCodeAt(r+2))<<16;case 2:n^=(255&e.charCodeAt(r+1))<<8;case 1:n=1540483477*(65535&(n^=255&e.charCodeAt(r)))+(59797*(n>>>16)<<16)}return(((n=1540483477*(65535&(n^=n>>>13))+(59797*(n>>>16)<<16))^n>>>15)>>>0).toString(36)}(a)+c;return{name:s,styles:a,next:Gn}},Jn=!!c.useInsertionEffect&&c.useInsertionEffect,Zn=Jn||function(e){return e()},er=(Jn||c.useLayoutEffect,c.createContext("undefined"!=typeof HTMLElement?zn({key:"css"}):null));er.Provider;var tr=c.createContext({}),nr=function(e,t,n){var r=e.key+"-"+t.name;!1===n&&void 0===e.registered[r]&&(e.registered[r]=t.styles)},rr=Bt,ar=function(e){return"theme"!==e},or=function(e){return"string"==typeof e&&e.charCodeAt(0)>96?rr:ar},ir=function(e,t,n){var r;if(t){var a=t.shouldForwardProp;r=e.__emotion_forwardProp&&a?function(t){return e.__emotion_forwardProp(t)&&a(t)}:a}return"function"!=typeof r&&n&&(r=e.__emotion_forwardProp),r},lr=function(e){var t=e.cache,n=e.serialized,r=e.isStringTag;return nr(t,n,r),Zn((function(){return function(e,t,n){nr(e,t,n);var r=e.key+"-"+t.name;if(void 0===e.inserted[t.name]){var a=t;do{e.insert(t===a?"."+r:"",a,e.sheet,!0),a=a.next}while(void 0!==a)}}(t,n,r)})),null},cr=function e(t,n){var r,a,o=t.__emotion_real===t,i=o&&t.__emotion_base||t;void 0!==n&&(r=n.label,a=n.target);var l=ir(t,n,o),s=l||or(i),u=!s("as");return function(){var p=arguments,d=o&&void 0!==t.__emotion_styles?t.__emotion_styles.slice(0):[];if(void 0!==r&&d.push("label:"+r+";"),null==p[0]||void 0===p[0].raw)d.push.apply(d,p);else{d.push(p[0][0]);for(var f=p.length,m=1;mtable{width:100%;border-collapse:collapse;}"}),jr=cr("tr",{target:"er8lhlf5"})({name:"o3suck",styles:"background-color:transparent;&:hover,&:focus-within,&:hover td,&:hover th{background-color:#f8f9fa;}&:last-child td,&:last-child th:not(.noptin-table__header){border-bottom:0;}"}),Pr=function(e){var t=e.align,n=void 0===t?"left":t,r=e.minWidth,a=void 0===r?"160px":r;a=a||"auto";var o="center"===(n=n||"left")?"center":"space-between",i="";return e.isSorted&&(i="\n\t\t\tbackground-color: #f8f9fa;\n\t\t\t&:not(:first-child) {\n\t\t\t\tborder-left: 1px solid ".concat(ur,";\n\t\t\t}\n\t\t\t&:not(:last-child) {\n\t\t\t\tborder-right: 1px solid ").concat(ur,";\n\t\t\t}\n\t\t\t& > .components-button svg,\n\t\t\t& > .components-button .dashicon {\n\t\t\t\tvisibility: visible !important;\n\t\t\t}\n\t\t")),sr("text-align:",n,";min-width:",a,";",i," &>.components-button{justify-content:",o,";}&>a:only-child{display:block;}","")},Rr=cr("th",{target:"er8lhlf4"})("padding:16px;background-color:#f8f9fa;font-weight:bold;white-space:nowrap;",Pr,";border-bottom:1px solid ",ur,";&>.components-button{height:auto;width:100%;text-align:left;vertical-align:middle;line-height:1;font-weight:bold;background:transparent!important;box-shadow:none!important;padding:0;}&>.components-button svg,&>.components-button .dashicon{visibility:hidden;margin-left:4px;}&>.components-button:hover svg,&>.components-button:hover .dashicon{visibility:visible;}"),Dr=cr("td",{target:"er8lhlf3"})("padding:16px;border-bottom:1px solid ",ur,";font-weight:normal;",Pr,";"),Ar=cr("td",{target:"er8lhlf2"})({name:"17w81qe",styles:"text-align:left;color:#757575;font-weight:bold;padding:16px 24px;@media (min-width: 782px){padding:2rem;font-size:1.125rem;}"}),Fr=cr("ul",{target:"er8lhlf1"})({name:"t5eiud",styles:"text-align:center;margin:0;&>li{display:inline-block;margin-bottom:0;margin-left:8px;margin-right:8px;}&>li>strong{margin-right:4px;display:inline-block;}"}),Tr=function(e){var t=e.color,n=e.backgroundColor;return sr("background-color:",n=n||"#efeeea",";color:",t=t||"#241c15",";","")},Ir=cr("span",{shouldForwardProp:function(e){return!["color","backgroundColor"].includes(e)},target:"er8lhlf0"})(Tr," white-space:nowrap;border-radius:200px;height:24px;line-height:24px;padding:3px 9px;display:inline-block;");const Mr=window.wp.date;function Nr(e){return function(e){if(Array.isArray(e))return de(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||fe(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 Br=[0,100],Lr=[0,100],zr=function(e){return"".concat(1===e.length?"0":"").concat(e)},$r=function(e,t,n){return Math.max(Math.min(e,n),t)},Hr=function(e,t){return Math.floor(Math.random()*(t-e+1))+e},Ur=function e(t,n,r){for(var a=Hr(t,n),o=0;o<(null==r?void 0:r.length);o++){var i=r[o];if(2===(null==i?void 0:i.length)&&a>=i[0]&&a<=i[1])return e(t,n,r)}return a},qr=function(e,t){return"number"==typeof t?t:e%Math.abs(t[1]-t[0])+t[0]},Wr=function(e,t){return"number"==typeof e?$r.apply(void 0,[Math.abs(e)].concat(Nr(t))):1===e.length||e[0]===e[1]?$r.apply(void 0,[Math.abs(e[0])].concat(Nr(t))):[Math.abs($r.apply(void 0,[e[0]].concat(Nr(t)))),$r.apply(void 0,[Math.abs(e[1])].concat(Nr(t)))]},Vr=function(e,t,n){return n<0?n+=1:n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e},Kr=function(e,t,n){var r,a,o;if(e/=360,n/=100,0==(t/=100))r=a=o=n;else{var i=n<.5?n*(1+t):n+t-n*t,l=2*n-i;r=Vr(l,i,e+1/3),a=Vr(l,i,e),o=Vr(l,i,e-1/3)}return[Math.round(255*r),Math.round(255*a),Math.round(255*o)]},Qr=function(e,t,n,r){return(299*e+587*t+114*n)/1e3>=r},Gr=function(e,t,n){return"hsl(".concat(e,", ").concat(t,"%, ").concat(n,"%)")},Yr=function(e,t,n,r){return"rgb"===r?"rgb(".concat(e,", ").concat(t,", ").concat(n,")"):"#".concat(zr(e.toString(16))).concat(zr(t.toString(16))).concat(zr(n.toString(16)))},Xr=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.format,r=void 0===n?"hex":n,a=t.saturation,o=void 0===a?[50,55]:a,i=t.lightness,l=void 0===i?[50,60]:i,c=t.differencePoint,s=void 0===c?130:c,u=Math.abs(function(e){for(var t=e.length,n=0,r=0;r0&&void 0!==arguments[0]?arguments[0]:{},t=e.format,n=void 0===t?"hex":t,r=e.saturation,a=void 0===r?[50,55]:r,o=e.lightness,i=void 0===o?[50,60]:o,l=e.differencePoint,c=void 0===l?130:l,s=e.excludeHue;a=Wr(a,Br),i=Wr(i,Lr);var u=s?Ur(0,359,s):Hr(0,359),p="number"==typeof a?a:Hr.apply(void 0,Nr(a)),d="number"==typeof i?i:Hr.apply(void 0,Nr(i)),f=me(Kr(u,p,d),3),m=f[0],h=f[1],g=f[2];return{color:"hsl"===n?Gr(u,p,d):Yr(m,h,g,n),isLight:Qr(m,h,g,c)}};const Jr=Xr;function Zr(e){if(["subscribed","active","yes","true","1"].includes(e))return{backgroundColor:"#78c67a",color:"#111111"};if(["unsubscribed","inactive","no","false","0"].includes(e))return{backgroundColor:"#fbcfbd",color:"#241c15"};if(["pending","waiting","maybe","2"].includes(e))return{backgroundColor:"#fbeeca",color:"#241c15"};var t=Jr(e,{saturation:[60,100],lightness:[30,45]});return{backgroundColor:t.color,color:t.isLight?"#111111":"#ffffff"}}function ea(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 ta(e){for(var t=1;t1?r[1]:n,o=Zr(t||a),l=n.indexOf("/64/");return-1!==l?(0,i.addQueryArgs)(e,{d:"".concat(n.substring(0,l+4),"/").concat(o.backgroundColor.replace("#",""),"/").concat(o.color.replace("#",""))}):e},ra=function(e){var t=e.record,n=e.name,a=Dt(),o=t[n],i=na(t.avatar_url,o),c=i?(0,r.createElement)(xr,{src:i,alt:o}):null,s=c?(0,r.createElement)(l.Flex,null,(0,r.createElement)(l.FlexItem,null,c),(0,r.createElement)(l.FlexBlock,null,o)):o;return(0,r.createElement)(l.Button,{variant:"link",style:{width:"100%",alignItems:"start",textDecoration:"none"},onClick:function(){return a(t.id)}},s)},aa=function(e){var t=e.value,n=e.enums,a=void 0===n?{}:n,o=me((0,r.useState)(!1),2),i=o[0],c=o[1],s=i?t:t.slice(0,2),u=t.length>2;return(0,r.createElement)(l.Flex,{gap:2,justify:"flex-start",wrap:!0},s.map((function(e){return(0,r.createElement)(l.FlexItem,{key:e},(0,r.createElement)(Ir,ta({},Zr(e)),a[e]||e))})),u&&(0,r.createElement)(l.FlexItem,null,(0,r.createElement)(l.Button,{variant:"link",onClick:function(){return c(!i)}},i?(0,se.__)("Hide","newsletter-optin-box"):(0,se.__)("Show all","newsletter-optin-box"))))};function oa(e){var t,n=e.row,a=e.header,o=e.headerKey,i=n[o];if(null==i||""===i)return(0,r.createElement)("span",{className:"noptin-table__cell--null"},"–");if(Array.isArray(i)&&0===i.length)return(0,r.createElement)("span",{className:"noptin-table__cell--null"},"–");if(a.is_primary&&"string"==typeof i)return(0,r.createElement)(ra,{record:n,name:o});if(a.is_boolean){var c=i?"yes":"no",s=i?"#3a9001":"#880000";return(0,r.createElement)(l.Icon,{size:24,style:{color:s},icon:c})}if(a.is_date&&i){var u=Mr.getSettings?(0,Mr.getSettings)():(0,Mr.__experimentalGetSettings)();return 10===i.length?(0,Mr.dateI18n)(u.formats.date,i):(0,Mr.dateI18n)(u.formats.datetime,i)}return a.is_tokens&&Array.isArray(i)?(0,r.createElement)(aa,{value:i}):a.enum&&Array.isArray(i)?(0,r.createElement)(aa,{value:i,enums:a.enum}):a.is_numeric||a.is_float||"string"==typeof i?(t=a.enum)&&"object"===he(t)&&t.constructor===Object?(0,r.createElement)(Ir,ta({},Zr(i)),a.enum[i]||i):i:JSON.stringify(i)}var ia=function(e){var t,n,a=e.append,o=e.avatarURL,i=e.isSingle,c=H(),s=c.namespace,u=c.collection,p=At().data;o=na(o||(null==p?void 0:p.avatar_url),a),a=a?" - ".concat(a):"";var d=(0,r.useMemo)((function(){var e,t;return i&&null!==(e=p.labels)&&void 0!==e&&e.singular_name?"".concat(p.labels.singular_name).concat(a):null!==(t=p.labels)&&void 0!==t&&t.name?"".concat(p.labels.name).concat(a):"Noptin".concat(a)}),[p,a]);return(0,r.createElement)(l.Flex,{justify:"start",wrap:!0},(0,r.createElement)(l.FlexItem,null,o&&(0,r.createElement)(xr,{src:o,alt:d,width:24,height:24})),(0,r.createElement)(l.FlexItem,null,(0,r.createElement)(l.__experimentalText,{size:16,weight:600,as:"h2",color:"#23282d"},d)),(0,r.createElement)(l.FlexItem,null,"/".concat(s,"/").concat(u)!==De()?(0,r.createElement)(l.Button,{variant:"primary",onClick:function(){return Me(Fe({},"/".concat(s,"/").concat(u)))},style:{marginLeft:"10px"}},(null===(t=p.labels)||void 0===t?void 0:t.view_items)||(0,se.__)("View Records","newsletter-optin-box")):(0,r.createElement)(l.Button,{variant:"primary",onClick:function(){return Me(Fe({},"/".concat(s,"/").concat(u,"/add")))},style:{marginLeft:"10px"}},(null===(n=p.labels)||void 0===n?void 0:n.add_new)||(0,se.__)("Add New","newsletter-optin-box"))))},la=function(){var e=At().data,t=Ft();if("SUCCESS"!==t.status)return(0,r.createElement)(ia,null);var n=e.id_prop?t.data[e.id_prop]:t.data.id,a=t.data.avatar_url;return(0,r.createElement)(ia,{append:n,avatarURL:a,isSingle:!0})},ca=function(){var e=At().data,t=H().id;return(0,r.createElement)(l.Card,null,(0,r.createElement)(l.CardHeader,null,(0,r.createElement)(l.Flex,{wrap:!0},(0,r.createElement)(l.FlexBlock,null,t?(0,r.createElement)(la,null):(0,r.createElement)(ia,null)),e.routes&&Object.keys(e.routes).map((function(t){return(0,r.createElement)(l.FlexItem,{key:t},e.routes[t].href?(0,r.createElement)(l.Button,{href:e.routes[t].href,variant:"secondary"},e.routes[t].title):(0,r.createElement)(l.Button,{onClick:function(){return Me(Fe({},t))},variant:"secondary"},e.routes[t].title))})))))};const sa=function(e){var t=e.upsell;if(!t)return null;var n=t.content,a=t.buttonURL,o=t.buttonText;return(0,r.createElement)(hr,null,(0,r.createElement)(l.Tip,null,n,(0,r.createElement)(l.Button,{href:a,target:"_blank",variant:"link"},o)))};var ua=function(){var n=H(),a=n.namespace,o=n.collection;!function(n,r){var a="".concat(n,"/").concat(r);Ct[a]||(Ct[a]=(0,Ne.createReduxStore)(a,{reducer:Je,actions:St(St({},e),Qe(n,r)),selectors:St({},t),controls:Be.controls,resolvers:et(n,r)}),(0,Ne.register)(Ct[a])),Ct[a]}(a,o);var i,c=Ot(a,o);return c.isResolving||!c.hasResolved?(0,r.createElement)(jt,{title:(0,se.__)("Loading","newsletter-optin-box")},(0,r.createElement)(l.CardBody,null,(0,r.createElement)(l.Spinner,null))):"ERROR"===c.status?(0,r.createElement)(jt,{title:(0,se.__)("Error","newsletter-optin-box")},(0,r.createElement)(l.CardBody,null,(0,r.createElement)(l.Notice,{status:"error",isDismissible:!1},(null===(i=c.error)||void 0===i?void 0:i.message)||(0,se.__)("An unknown error occurred.","newsletter-optin-box")))):(0,r.createElement)(l.Flex,{gap:2,direction:"column"},(0,r.createElement)(l.FlexItem,null,(0,r.createElement)(ca,null)),(0,r.createElement)(l.FlexBlock,null,(0,r.createElement)(pe,null,(0,r.createElement)(X,null)),(0,r.createElement)(pe,null,(0,r.createElement)(pa,null))))},pa=function(){var e=At().data;if(null!=e&&e.fills)return e.fills.map((function(e){return(0,r.createElement)(l.Fill,{key:e.name,name:e.name},e.content&&(0,r.createElement)("span",{dangerouslySetInnerHTML:{__html:e.content}}),e.upsell&&(0,r.createElement)(sa,{upsell:e.upsell}))}))};function da(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}const fa=window.wp.primitives,ma=(0,r.createElement)(fa.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,r.createElement)(fa.Path,{d:"M6.6 6L5.4 7l4.5 5-4.5 5 1.1 1 5.5-6-5.4-6zm6 0l-1.1 1 4.5 5-4.5 5 1.1 1 5.5-6-5.5-6z"}));function ha(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 ga(e){for(var t=1;t1;return(0,r.createElement)(l.Flex,{className:"noptin-component__field-lg",wrap:!0},(0,r.createElement)(l.FlexItem,null,(0,r.createElement)(l.SelectControl,{label:(0,se.__)("If","newsletter-optin-box"),hideLabelFromVision:!0,value:n||"allow",options:va,onChange:function(e){return o("action",e)},size:"default",__nextHasNoMarginBottom:!0})),i&&(0,r.createElement)(r.Fragment,null,(0,r.createElement)(l.FlexItem,null,(0,r.createElement)(l.SelectControl,{label:(0,se.__)("all","newsletter-optin-box"),hideLabelFromVision:!0,value:t||"all",options:ba,onChange:function(e){return o("type",e)},size:"default",__nextHasNoMarginBottom:!0})),(0,r.createElement)(l.FlexBlock,null,(0,se.__)("of the following rules are true:","newsletter-optin-box"))))}function Ea(e){var t,n=e.rule,a=e.comparisons,o=e.availableSmartTags,i=e.index,c=e.updateRule,s=e.removeRule,u=(0,r.useCallback)((function(e){return c(i,"value",e)}),[i,c]),p=(0,r.useCallback)((function(e){return c(i,"condition",e)}),[i,c]),d=(0,r.useCallback)((function(){return s(i)}),[i,s]),f=(0,r.useMemo)((function(){var e=n.type;if(void 0!==o[e])return o[e];var t,r=e.replace("_",".",1);if(void 0!==o[r])return o[r];for(var a=0,i=Object.entries(o);a> ").concat(t)}),[n.type,o]),h=ya((t=null==f?void 0:f.options,(0,r.useMemo)((function(){return t?Array.isArray(t)?t.map((function(e,t){return{label:e,value:t}})):Object.keys(t).map((function(e){return{label:t[e],value:e}})):[]}),[t])),(0,se.__)("Select a value","newsletter-optin-box")),g=h.length>1,v=(null==f?void 0:f.conditional_logic)||"string",b=ya((0,r.useMemo)((function(){var e=[];return Object.keys(a).forEach((function(t){var n=a[t].type;if(g){if("string"===v&&"is"!=t&&"is_not"!=t)return;if("is_empty"===t||"is_not_empty"===t||"is_between"===t)return}"any"!==n&&n!=v||e.push({label:a[t].name,value:t})})),e}),[v,a]),(0,se.__)("Select a comparison","newsletter-optin-box")),y="is_empty"===n.condition||"is_not_empty"===n.condition;return(0,r.createElement)(l.Flex,{className:"noptin-component__field-lg",wrap:!0,expanded:!0},(0,r.createElement)(l.FlexBlock,null,(0,r.createElement)(Ir,ga({},Zr(m)),m)),(0,r.createElement)(l.FlexBlock,null,(0,r.createElement)(l.Flex,{justify:"flex-end",wrap:!0},(0,r.createElement)(l.FlexItem,null,(0,r.createElement)(l.SelectControl,{label:(0,se.__)("Comparison","newsletter-optin-box"),hideLabelFromVision:!0,value:n.condition?n.condition:"is",options:b,onChange:p,size:"default",__nextHasNoMarginBottom:!0})),!y&&(0,r.createElement)(l.FlexBlock,null,g&&(0,r.createElement)(l.SelectControl,{label:(0,se.__)("Value","newsletter-optin-box"),hideLabelFromVision:!0,value:n.value?n.value:"",options:h,onChange:u,size:"default",__nextHasNoMarginBottom:!0}),!g&&(0,r.createElement)(l.TextControl,{type:"number"===v?"number":"text",label:(0,se.__)("Value","newsletter-optin-box"),hideLabelFromVision:!0,value:n.value?n.value:"",onChange:u,__nextHasNoMarginBottom:!0})),(0,r.createElement)(l.FlexItem,null,(0,r.createElement)(l.Button,{onClick:d,icon:"trash",variant:"tertiary",isDestructive:!0})))))}function _a(e){var t=e.rules,n=e.comparisons,a=e.availableSmartTags,o=e.setConditionalLogicAttribute,i=(0,r.useMemo)((function(){return Array.isArray(t)?t.filter((function(e){return e.type&&""!==e.type})):[]}),[a]),l=(0,r.useMemo)((function(){var e={};return a.forEach((function(t){t.conditional_logic&&(e[t.smart_tag]=ga(ga({},t),{},{key:t.smart_tag,type:t.conditional_logic}))})),e}),[a]),c=(0,r.useCallback)((function(e){var t=Nr(i);t.splice(e,1),o("rules",t)}),[i,o]),s=(0,r.useCallback)((function(e,t,n){var r=Nr(i);r[e][t]=n,o("rules",r)}),[i,o]),u=(0,r.useMemo)((function(){return Object.values(l)}),[l]),p=(0,r.useCallback)((function(e){var t=l[e],n=(null==t?void 0:t.options)||[],r=(null==t?void 0:t.placeholder)||"",a=Array.isArray(n)&&n.length?Object.keys(n)[0]:r;null!=t&&t.default&&(a=t.default);var c=Nr(i);c.push({type:e,condition:"is",value:a}),o("rules",c)}),[i]),d=i.length?(0,se.__)("Add a rule","newsletter-optin-box"):(0,se.__)("Add another rule","newsletter-optin-box"),f=Ia({availableSmartTags:u,onMergeTagClick:p,raw:!0,icon:"plus",label:d,text:d,toggleProps:{variant:"secondary"}});return(0,r.createElement)("div",{className:"noptin-conditional-logic-rules"},i.map((function(e,t){return(0,r.createElement)(Ea,{key:t,rule:e,index:t,updateRule:s,removeRule:c,comparisons:n,availableSmartTags:l})})),f)}function xa(e){var t=e.onChange,n=e.value,a=e.comparisons,o=e.toggleText,i=e.availableSmartTags,c=e.className;"object"!==he(n)&&(n={enabled:!1,action:"allow",rules:[{condition:"is",type:"date",value:""}],type:"all"});var s=function(e,r){t(ga(ga({},n),{},ge({},e,r)))};return(0,r.createElement)("div",{className:c},(0,r.createElement)(l.ToggleControl,{checked:!!n.enabled,onChange:function(e){return s("enabled",e)},className:"noptin-component__field",label:o||(0,se.__)("Optionally enable/disable this trigger depending on specific conditions.","newsletter-optin-box"),__nextHasNoMarginBottom:!0}),n.enabled&&(0,r.createElement)(r.Fragment,null,(0,r.createElement)(wa,{ruleCount:Array.isArray(n.rules)?n.rules.length:0,type:n.type,action:n.action,setConditionalLogicAttribute:s}),(0,r.createElement)(_a,{rules:n.rules,comparisons:a,availableSmartTags:i,setConditionalLogicAttribute:s})))}var Oa={"==":function(e,t){return e==t},"===":function(e,t){return e===t},"!=":function(e,t){return e!=t},"!==":function(e,t){return e!==t},">":function(e,t){return e>t},">=":function(e,t){return e>=t},"<":function(e,t){return e0&&(g=(0,r.createElement)(l.DropdownMenu,Da({icon:u,label:d},f),(function(e){var t=e.onClose;return(0,r.createElement)(r.Fragment,null,Object.keys(m).map((function(e,n){return(0,r.createElement)(l.MenuGroup,{label:h>1?e:void 0,key:n},m[e].map((function(e){return(0,r.createElement)(l.MenuItem,{icon:e.icon||ma,iconPosition:"left",onClick:function(){if(o){var n=c?e.smart_tag:"[[".concat((r=e).example?r.example:r.default?"".concat(r.smart_tag,' default="').concat(r.default,'"'):"".concat(r.smart_tag),"]]");o(n)}var r;t()},key:e.smart_tag},e.label)})))})))}))),g}function Ma(e){var t=e.setting,n=e.availableSmartTags,a=e.value,o=e.onChange,i=da(e,ja),c=(0,l.useBaseControlProps)(i),s=c.baseControlProps,u=c.controlProps;Array.isArray(a)||(a=[]);var p=(0,r.useCallback)((function(e){var t=e.item,i=e.index;return(0,r.createElement)(l.Flex,{className:"noptin-repeater-item",wrap:!0},Ta.map((function(e,l){return(0,r.createElement)(Na,{key:l,availableSmartTags:n,field:e,value:void 0===t[e.id]?"":t[e.id],onChange:function(t){var n=Nr(a);n[i][e.id]=t,o(n)}})})),(0,r.createElement)(l.FlexItem,null,(0,r.createElement)(l.Button,{icon:"trash",variant:"tertiary",className:"noptin-component__field",label:(0,se.__)("Delete","noptin-addons-pack"),showTooltip:!0,onClick:function(){var e=Nr(a);e.splice(i,1),o(e)},isDestructive:!0})))}),[a,o]);return(0,r.createElement)(l.BaseControl,Da({},s),(0,r.createElement)("div",Da({},u),a.map((function(e,t){return(0,r.createElement)(p,{key:t,item:e,index:t})})),(0,r.createElement)(l.Button,{onClick:function(){var e=Nr(a);e.push({}),o(e)},variant:"secondary"},t.add_field?t.add_field:(0,se.__)("Add","newsletter-optin-box"))))}function Na(e){var t=e.field,n=e.availableSmartTags,a=e.value,o=e.onChange,i=Ia({availableSmartTags:n,onMergeTagClick:(0,r.useCallback)((function(e){o&&o(a?"".concat(a," ").concat(e).trim():e)}),[a,o])});return(0,r.createElement)(l.FlexBlock,null,(0,r.createElement)(l.__experimentalInputControl,{label:t.label,type:t.type,value:a,placeholder:(0,se.sprintf)((0,se.__)("Enter %s","noptin-addons-pack"),t.label),className:"noptin-component__field noptin-condition-field",suffix:i,onChange:o,isPressEnterToChange:!0,__nextHasNoMarginBottom:!0,__next36pxDefaultSize:!0}))}function Ba(e){e.setting;var t=e.value,n=e.options,a=e.onChange,o=da(e,Pa),i=(0,l.useBaseControlProps)(o),c=i.baseControlProps,s=i.controlProps;return Array.isArray(t)||(t=[]),(0,r.createElement)(l.BaseControl,Da({},c),(0,r.createElement)("div",Da({},s),n.map((function(e,n){return(0,r.createElement)(l.CheckboxControl,{key:n,label:e.label,checked:t.includes(e.value),onChange:function(n){a(n?[].concat(Nr(t),[e.value]):t.filter((function(t){return t!==e.value})))}})}))))}function La(e){var t=e.settingKey,n=e.setting,a=e.availableSmartTags,o=e.prop,i=e.saved,c=e.setAttributes,s=(0,r.useCallback)((function(e){if(!o)return c(ge({},t,e));var n=i[o]?i[o]:{},r=ge({},o,Da(Da({},n),{},ge({},t,e)));c(r)}),[t,o,i,c]);if(n.if||n.restrict){var u=n.restrict?n.restrict.split("."):n.if.split(".");if(!(2!==u.length||i[u[0]]&&i[u[0]][u[1]]))return null;if(1===u.length&&!i[u[0]])return null}if(Array.isArray(n.conditions)){var p=n.conditions.every((function(e){var t=e.key.split("."),n=e.operator?e.operator:"==",r=i[t[0]];return 2===t.length?r&&r[t[1]]&&ka(e.value,n,r[t[1]]):ka(e.value,n,r)}));if(!p)return null}if(n.condition&&!n.condition(i))return null;var d=i[t];o&&(d=i[o]?i[o][t]:void 0),(void 0===d||n.disabled)&&(d=n.default);var f=void 0!==d&&""!==d&&null!==d,m=[];n.options&&(m=Object.keys(n.options).map((function(e){return{label:n.options[e],value:e}})));var h=n.fullWidth?"noptin-component__field noptin-component__field-".concat(t):"noptin-component__field-lg noptin-component__field-".concat(t),g=n.description?(0,r.createElement)("span",{dangerouslySetInnerHTML:{__html:n.description}}):"",v={label:n.label,value:f?d:"",onChange:s,className:"".concat(h),help:g};return"select"===n.el?(m.unshift({label:n.placeholder?n.placeholder:(0,se.__)("Select an option","newsletter-optin-box"),value:"",disabled:!n.canSelectPlaceholder}),(0,r.createElement)(l.SelectControl,Da(Da({},v),{},{options:m,__nextHasNoMarginBottom:!0,__next36pxDefaultSize:!0}))):"form_token"===n.el?(0,r.createElement)(l.FormTokenField,Da(Da({},v),{},{value:Array.isArray(v.value)?v.value:[],suggestions:Array.isArray(n.suggestions)?n.suggestions:[],__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0})):"multi_checkbox"===n.el||"multi_checkbox_alt"===n.el?(0,r.createElement)(Ba,Da(Da({},v),{},{options:m})):"conditional_logic"===n.el?(0,r.createElement)(xa,Da(Da({},v),{},{availableSmartTags:a,comparisons:n.comparisons,toggleText:n.toggle_text})):"input"===n.el?n.type&&["toggle","switch","checkbox","checkbox_alt"].includes(n.type)?(0,r.createElement)(l.ToggleControl,Da(Da({},v),{},{checked:!!f&&d,onChange:function(e){s(e)}})):(0,r.createElement)(Fa,Da(Da({},v),{},{setting:n,availableSmartTags:"trigger_settings"===o?[]:a,isPressEnterToChange:!n.isInputToChange})):"textarea"===n.el?(0,r.createElement)(l.TextareaControl,Da(Da({},v),{},{setting:n,placeholder:n.placeholder?n.placeholder:"",__nextHasNoMarginBottom:!0})):"paragraph"===n.el?(0,r.createElement)("div",{className:h},(0,r.createElement)(l.Tip,null,n.content)):"hero"===n.el?(0,r.createElement)("div",{className:h},(0,r.createElement)("h3",null,n.content)):"key_value_repeater"===n.el||"webhook_key_value_repeater"===n.el?(0,r.createElement)(Ma,Da(Da({},v),{},{setting:n,availableSmartTags:"trigger_settings"===o?[]:a})):t}function za(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 $a(e){for(var t=1;t0&&void 0!==arguments[0]&&arguments[0],t=At().data;return(0,r.useMemo)((function(){return t.schema.filter((function(n){return!(n.readonly&&e||n.is_dynamic||t.ignore&&t.ignore.includes(n.name)||t.hidden&&t.hidden.includes(n.name)||!n.is_tokens&&(e||!(n.is_numeric||n.is_float||n.is_date))&&(!n.enum||Array.isArray(n.enum)))}))}),[t,e])},Wa=function(e){var t={default:e.default,label:e.label,el:"input",type:"text",name:e.name,isInputToChange:!0};return e.is_tokens?(t.el="form_token",t.suggestions=e.suggestions):e.enum&&!Array.isArray(e.enum)?(t.el="select",t.options=e.enum,e.multiple&&(t.el="multi_checkbox")):e.isLongText&&(t.el="textarea"),(e.is_numeric||e.is_float)&&(t.type="number"),e.is_date&&(t.type="date"),e.is_boolean&&(t.type="toggle"),e.description&&e.description!==e.label&&(t.description=e.description),t},Va=function(e){var t=Ie();return(0,r.useMemo)((function(){var n={};return e.forEach((function(e){["","_not","_min","_max","_before","_after"].forEach((function(r){var a=e.name+r;t[a]&&(n[a]=t[a])}))})),n}),[t,e])};function Ka(){var e=me((0,r.useState)(!1),2),t=e[0],n=e[1],a=qa(),o=Va(a),i=Object.keys(o).length,c=i>0?(0,se.sprintf)((0,se.__)("Filters (%d)","newsletter-optin-box"),i):(0,se.__)("Filter Records","newsletter-optin-box");return(0,r.createElement)(r.Fragment,null,a.length>0&&(0,r.createElement)(r.Fragment,null,(0,r.createElement)(l.Button,{onClick:function(){return n(!0)},variant:"tertiary",icon:"filter",text:c}),t&&(0,r.createElement)(l.Modal,{title:(0,se.__)("Filter records","newsletter-optin-box"),onRequestClose:function(){return n(!1)}},(0,r.createElement)(Ua,{fields:a,currentFilters:o,setOpen:n}))))}var Qa=function(e){var t=e.record,n=e.error,a=e.onSaveRecord,o=e.setAttributes,i=At().data,c=(0,r.useMemo)((function(){return(0,je.compact)(i.schema.map((function(e){return e.readonly||e.is_dynamic||i.hidden&&i.hidden.includes(e.name)||i.ignore&&i.ignore.includes(e.name)?null:Wa(e)})))}),[i]);return(0,r.createElement)("form",{onSubmit:a},c.map((function(e){return(0,r.createElement)("div",{style:{marginBottom:"1.6rem"},key:e.name},(0,r.createElement)(La,{settingKey:e.name,saved:t,setAttributes:o,setting:e}))})),n&&(0,r.createElement)(l.Notice,{status:"error"},n.message))},Ga=n(640),Ya=n.n(Ga);function Xa(e){var t=e.label,n=e.value,a=t.toLowerCase().replace(/[^a-z0-9]/g,"-");return(0,r.createElement)("li",{className:"noptin-list-item noptin-list-item__".concat(a)},(0,r.createElement)("div",{className:"noptin-list-item__key"},t),(0,r.createElement)("div",{className:"noptin-list-item__value"},n))}function Ja(e){var t=e.items;return(0,r.createElement)("ul",{className:"noptin-component__list"},t.map((function(e){return(0,r.createElement)(Xa,{key:e.label,label:e.label,value:e.value})})))}var Za={name:"173gwd3",styles:"background-color:#f8f9fa;color:#212529;& h2,& h3{color:#212529;}"},eo={name:"p3ituj",styles:"background-color:#212529;color:#f8f9fa;& h2,& h3{color:#f8f9fa;}"},to={name:"1qvos4g",styles:"background-color:#f8cbcb;color:#cc1818;& h2,& h3{color:#cc1818;}"},no={name:"1kbuu37",styles:"background-color:#fff3cd;color:#856404;& h2,& h3{color:#856404;}"},ro={name:"1k1g68i",styles:"background-color:#cbeeff;color:#0c5460;& h2,& h3{color:#0c5460;}"},ao={name:"1dlti2z",styles:"background-color:#d4edda;color:#155724;& h2,& h3{color:#155724;}"},oo=function(e){var t=e.status;return"success"===t?ao:"info"===t?ro:"warning"===t?no:"error"===t?to:"dark"===t?eo:Za},io=cr("div",{target:"ec8eek20"})(oo,";padding:0.25rem;text-align:center;box-shadow:2px 2px 2px rgb(0 0 0 / 5%);min-width:100px;border-radius:4px;");function lo(e){var t=e.value,n=e.label,a=e.status;return(0,r.createElement)(io,{status:a},(0,r.createElement)(l.Flex,{direction:"column",justify:"center",style:{minHeight:"100px"}},(0,r.createElement)(l.FlexItem,null,(0,r.createElement)(l.__experimentalText,{size:48,weight:600,as:"h2"},t)),(0,r.createElement)(l.FlexItem,null,(0,r.createElement)(l.__experimentalText,{size:13,weight:400,as:"h3"},n))))}function co(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 so(e){for(var t=1;t1,i=t-1,c=tr&&n({paged:r})}return p<=1?a>Po[0]&&(0,r.createElement)(l.Flex,{className:d,wrap:!0,gap:4,align:"center",justify:"center"},(0,r.createElement)(Do,{perPage:u,onChange:f}))||null:(0,r.createElement)(l.Flex,{className:d,wrap:!0,gap:2,align:"center",justify:"center"},(0,r.createElement)(Ro,{page:s,pageCount:p,onPageChange:function(e){var t=parseInt(e,10);!t||t<1?t=1:t>p&&(t=p),n({paged:t})}}),c&&(0,r.createElement)(Do,{perPage:u,onChange:f}))}function Fo(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 To(e){for(var t=1;t0&&o.length===c.length,u=(0,r.useCallback)((function(){i(s?[]:c)}),[s,c,i]);return(0,r.createElement)(Mo,{columnLabel:(0,se.__)("Toggle selection","newsletter-optin-box"),columnKey:"cb",align:"center",minWidth:"20px",display:(0,r.createElement)(l.CheckboxControl,{checked:s,onChange:u,__nextHasNoMarginBottom:!0}),cellClassName:"noptin-table-column__cb"})},Xo=function(e){var t=e.row,n=e.id,a=me(Ho(),2),o=a[0],i=a[1],c=(0,r.useCallback)((function(e){i(e?[].concat(Nr(o),[n]):o.filter((function(e){return e!==n})))}),[o,i,n]);return(0,r.createElement)(Lo,{headerKey:"cb",row:t,header:{key:"cb",align:"center",minWidth:"20px"},cellClassName:"noptin-table-column__cb",DisplayCell:(0,r.createElement)(l.CheckboxControl,{checked:o.includes(n),onChange:c,__nextHasNoMarginBottom:!0})})},Jo=function(e){var t=e.headers,n=e.hasData,a=e.sortBy,o=e.sortDir,i=e.onQueryChange,l=e.rows,c=e.idProp,s=e.canSelectRows,u=(0,r.useCallback)((function(e){i(e===a?{order:"asc"===o?Qo:"asc"}:{orderby:e})}),[a,o,i]),p=(0,r.useMemo)((function(){return t.map((function(e){var t=e.key,i=e.label,l=e.isSortable,c=da(e,Uo);return(0,r.createElement)(Mo,Ko({key:t,columnLabel:i,columnKey:t,isSortable:l&&n,isSorted:a===t,sortDir:o,setSortBy:u,cellClassName:"noptin-table-column__"+t.replace(/_/g,"-")},c))}))}),[t,n,a,o,u]);return(0,r.createElement)("thead",null,(0,r.createElement)(jr,{className:"noptin-table__row"},s&&n&&(0,r.createElement)(Yo,{rows:l,idProp:c}),p))},Zo=function(e){var t=e.sortBy,n=e.headers,a=e.DisplayCell,o=e.canSelectRows,i=e.hasData,l=e.row,c=e.id,s=(0,r.useMemo)((function(){return n.map((function(e){var n=e.key,o=da(e,qo);return(0,r.createElement)(Lo,{key:"".concat(c,"__").concat(n),headerKey:n,row:l,header:o,isSorted:t===n,cellClassName:"noptin-table__col-"+(null==n?void 0:n.replace(/_/g,"-")),DisplayCell:a})}))}),[n,l,t,a,c]);return(0,r.createElement)(jr,{className:"noptin-table__row"},o&&i&&(0,r.createElement)(Xo,{row:l,id:c}),s)};const ei=function(e){var t=e.query,n=e.headers,a=void 0===n?[]:n,o=e.rows,i=void 0===o?[]:o,l=e.caption,c=e.emptyMessage,s=e.onQueryChange,u=e.DisplayCell,p=e.canSelectRows,d=e.idProp,f=void 0===d?"id":d,m=da(e,Wo),h=t.orderby||"id",g=t.order||Qo,v=!!i.length;return(0,r.createElement)(Cr,Ko({tabIndex:"0","aria-label":"".concat(l," - ").concat((0,se.__)("(scroll to see more)","newsletter-optin-box")),role:"group"},m),(0,r.createElement)("table",null,(0,r.createElement)(Jo,{headers:a,hasData:v,sortBy:h,sortDir:g,onQueryChange:s,canSelectRows:p,rows:i,idProp:f}),(0,r.createElement)("tbody",null,v?i.map((function(e,t){var n=Go(e,t,f);return(0,r.createElement)(Zo,{key:n,sortBy:h,headers:a,DisplayCell:u,canSelectRows:p,hasData:v,row:e,id:n})})):(0,r.createElement)(jr,{className:"noptin-table__row"},(0,r.createElement)(Ar,{colSpan:a.length},null!=c?c:(0,se.__)("No data to display","newsletter-optin-box"))))))};var ti=["query","headers"];function ni(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 ri(e){for(var t=1;t=t||n<0||g&&e-o.current>=v},b=function(t){return i.current=null,h&&l.current?e(t):(l.current=s.current=null,u.current)},y=function e(){var r=Date.now();if(c(r))return b(r);if(d.current){var i=t-(r-a.current),l=g?Math.min(i,v-(r-o.current)):i;n(e,l)}},w=function(){var p=Date.now(),f=c(p);if(l.current=[].slice.call(arguments),s.current=r,a.current=p,f){if(!i.current&&d.current)return o.current=a.current,n(y,t),m?e(a.current):u.current;if(g)return n(y,t),e(a.current)}return i.current||n(y,t),u.current};return w.cancel=function(){i.current&&(f?cancelAnimationFrame(i.current):clearTimeout(i.current)),o.current=0,l.current=a.current=s.current=i.current=null},w.isPending=function(){return!!i.current},w.flush=function(){return i.current?b(Date.now()):u.current},w}),[m,g,t,v,h,f]);return b}((function(e){n(e)}),500);return(0,r.createElement)(l.FlexBlock,{style:{minWidth:"200px"}},(0,r.createElement)(l.SearchControl,{value:i,onChange:function(e){s(e),u(e)},placeholder:a,__nextHasNoMarginBottom:!0}))};var ci=["actions","filtersButton","className","hasSearch","searchPlaceholder","headers","ids","isLoading","onQueryChange","onRefresh","query","initialHiddenHeaders","rows","showMenu","showFooter","summary","title","totalRows","canSelectRows","DisplayCell"];function si(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 ui(e){for(var t=1;t0&&h,v))},mi=function(e){var t=e.isLoading,n=e.summary,a=e.query,o=e.onQueryChange,i=e.totalRows;return(0,r.createElement)(l.CardFooter,{justify:"center"},t?(0,r.createElement)(ii,null):(0,r.createElement)(r.Fragment,null,(0,r.createElement)(Ao,{query:a,onQueryChange:o,total:i}),n&&(0,r.createElement)(oi,{data:n})))};const hi=function(e){var t=e.actions,n=e.filtersButton,a=e.className,o=e.hasSearch,i=e.searchPlaceholder,c=e.headers,s=void 0===c?[]:c,u=(e.ids,e.isLoading),p=void 0!==u&&u,d=e.onQueryChange,f=void 0===d?function(){}:d,m=e.onRefresh,h=void 0!==m&&m,g=e.query,v=void 0===g?{}:g,b=e.initialHiddenHeaders,y=void 0===b?[]:b,w=e.rows,E=void 0===w?[]:w,_=(e.showMenu,e.showFooter),x=void 0===_||_,O=e.summary,k=e.title,S=e.totalRows,C=e.canSelectRows,j=e.DisplayCell,P=da(e,ci),R=me((0,r.useState)(y),2),D=R[0],A=R[1],F=ui({headers:(0,r.useMemo)((function(){return s.filter((function(e){return!D.includes(e.key)}))}),[s,D]),caption:k,onQueryChange:f,query:v},P);return(0,r.createElement)(l.Card,{className:xo()("noptin-table",a),elevation:0},(0,r.createElement)(fi,{title:k,hasSearch:o,query:v,onQueryChange:f,onRefresh:!p&&h,searchPlaceholder:i,actions:!p&&t,filtersButton:n,headers:s,hiddenHeaders:D,setHiddenHeaders:A,totalRows:S}),p?(0,r.createElement)(pi,ui({},F)):(0,r.createElement)(ei,ui({rows:E,DisplayCell:j,canSelectRows:C},F)),x&&(0,r.createElement)(mi,{isLoading:p,summary:O,query:v,onQueryChange:f,totalRows:S}))};function gi(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 vi(e){for(var t=1;t1&&(0,r.createElement)(Or,{orientation:"horizontal",onNavigate:d},s.map((function(e,t){return(0,r.createElement)(l.Button,{key:e.name,isPressed:e.name===i||!i&&0===t,onClick:function(){return d(t)}},e.title)}))),(0,r.createElement)(X,null))},_i=n(460),xi=n.n(_i);function Oi(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 ki(e){for(var t=1;t2&&void 0!==arguments[2]?arguments[2]:{},r="".concat(e,"/").concat(t),a=Et(n);return _t((function(e){return e(r).getPartialRecords(a)}),[e,t,a])}(c,s,p),f=(0,r.useMemo)((function(){var e;if(null===(e=d.data)||void 0===e||!e.length)return[];var t=a.reduce((function(e,t){return e[t.name]=t.label,e}),{});return Object.keys(d.data[0]).map((function(e){return t[e]||e}))}),[a,d.data]),m=(0,r.useMemo)((function(){var e;return null!==(e=d.data)&&void 0!==e&&e.length?d.data.map((function(e){return Object.values(e)})):[]}),[d.data]),h=(0,r.createElement)(l.Button,{variant:"link",onClick:n},(0,se.__)("Go Back","newsletter-optin-box"));if(d.isResolving)return(0,r.createElement)(l.__experimentalText,{size:16,as:"p"},(0,r.createElement)(l.Spinner,{style:{marginLeft:0}}),(0,se.__)("Preparing records...","newsletter-optin-box"));if("ERROR"===d.status)return(0,r.createElement)(dr,{status:"error",isDismissible:!1},d.error.message||(0,se.__)("An unknown error occurred.","newsletter-optin-box"),"   ",h);if(!d.data.length)return(0,r.createElement)(dr,{status:"info",isDismissible:!1},(0,se.__)("Found no records to export.","newsletter-optin-box"),"   ",h);var g=xi().unparse({fields:f,data:m},{escapeFormulae:!0}),v="".concat(c,"-").concat(s,"-").concat(Date.now(),".csv");return(0,r.createElement)(dr,{status:"success",isDismissible:!1},(0,se.__)("Done! Click the button below to download records.","newsletter-optin-box"),"   ",(0,r.createElement)(l.Button,{variant:"primary",href:"data:text/csv;charset=utf-8,".concat(encodeURIComponent(g)),download:v,text:(0,se.__)("Download CSV","newsletter-optin-box")}))},Ci=function(e){var t=e.fields,n=e.setFields,a=e.schema,o=a.schema,i=a.ignore,c=e.next;return(0,r.createElement)(l.Flex,{direction:"column",gap:4},(0,r.createElement)(l.FlexItem,null,(0,r.createElement)("p",{className:"description"},(0,se.__)("Select the fields to include in your exported file","newsletter-optin-box"))),o.map((function(e){if(!i.includes(e.name))return(0,r.createElement)(l.FlexItem,{key:e.name},(0,r.createElement)(l.ToggleControl,{label:e.label===e.description?e.label:"".concat(e.label," (").concat(e.description,")"),checked:t.includes(e.name),onChange:function(){t.includes(e.name)?n(t.filter((function(t){return t!==e.name}))):n([].concat(Nr(t),[e.name]))},__nextHasNoMarginBottom:!0}))})),(0,r.createElement)(l.FlexItem,null,(0,r.createElement)(mr,{variant:"primary",onClick:c},(0,r.createElement)(l.Icon,{icon:"download"}),(0,se.__)("Download","newsletter-optin-box"))))},ji=function(){var e=At(),t=me((0,r.useState)((0,je.compact)(e.data.schema.map((function(t){return e.data.hidden.includes(t.name)||e.data.ignore.includes(t.name)?null:t.name})))),2),n=t[0],a=t[1],o=me((0,r.useState)("fields"),2),i=o[0],l=o[1];return"fields"===i?(0,r.createElement)(Ci,{fields:n,setFields:a,schema:e.data,next:function(){return l("progress")}}):"progress"===i?(0,r.createElement)(Si,{fields:n,schema:e.data.schema,back:function(){return l("fields")}}):void 0};function Pi(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 Ri(e){for(var t=1;t0)return{include:e.join(","),number:-1};var t=Rt(Rt({},Ae()),{},{number:-1});return["order","hizzle_path","orderby","paged","page"].forEach((function(e){delete t[e]})),t}(v),_=It(),x=Object.keys(y).length>0,O=function(e){if(null==e||e.preventDefault(),!d){f(!0);var t={bulk_update:{merge:y,query:E}};i.batchAction(t,i).then((function(){g(!0),w({})})).catch((function(e){u(e)})).finally((function(){f(!1)}))}};return(0,r.createElement)(r.Fragment,null,(0,r.createElement)(Fi,{editableFields:t,changes:y,onSave:O,setAttributes:function(e){w(Ai(Ai({},y),e)),s&&u(null),h&&g(!1)}}),x&&(0,r.createElement)(mr,{variant:"primary",onClick:O,isBusy:d},!d&&(0,r.createElement)(l.Icon,{icon:"cloud-saved"})," ",(0,se.sprintf)(d?(0,se.__)("Saving %d records...","newsletter-optin-box"):(0,se.__)("Edit %d records","newsletter-optin-box"),v.length>0?v.length:_),d&&(0,r.createElement)(l.Spinner,null)),s&&!x&&(0,r.createElement)(l.Notice,{status:"error",isDismissible:!0},s.message),h&&!x&&(0,r.createElement)(l.Notice,{status:"success",isDismissible:!0},(0,se.__)("Records updated successfully.","newsletter-optin-box")))};function Ii(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}var Mi=(0,r.createElement)(l.Flex,{gap:2,wrap:!0},(0,r.createElement)(l.FlexItem,null,(0,r.createElement)((function(){var e=me((0,r.useState)(!1),2),t=e[0],n=e[1],a=qa(!0),o=a.length>0;return(0,r.createElement)(r.Fragment,null,o&&(0,r.createElement)(r.Fragment,null,(0,r.createElement)(l.Button,{onClick:function(){return n(!0)},variant:"tertiary",text:(0,se.__)("Bulk Edit","newsletter-optin-box")}),t&&(0,r.createElement)(l.Modal,{title:(0,se.__)("Bulk Edit","newsletter-optin-box"),onRequestClose:function(){return n(!1)}},(0,r.createElement)(Ti,{editableFields:a}))))}),null)),(0,r.createElement)(l.FlexItem,null,(0,r.createElement)((function(){var e=me((0,r.useState)(!1),2),t=e[0],n=e[1],a=me(Ho(),1)[0],o=0===a.length,i=It(),c=o?(0,se.__)("Download","newsletter-optin-box"):(0,se.__)("Download Selected","newsletter-optin-box"),s=o?(0,se.sprintf)((0,se.__)("Download all %s records","newsletter-optin-box"),i):(0,se.sprintf)((0,se.__)("Download %s selected records","newsletter-optin-box"),a.length);return(0,r.createElement)(r.Fragment,null,(0,r.createElement)(l.Button,{onClick:function(){return n(!0)},variant:"tertiary",text:c}),t&&(0,r.createElement)(l.Modal,{title:s,onRequestClose:function(){return n(!1)}},(0,r.createElement)("div",{className:"hizzle-records-export-modal__body"},(0,r.createElement)(pe,null,(0,r.createElement)(ji,null)))))}),null)),(0,r.createElement)(l.FlexItem,null,(0,r.createElement)((function(){var e=Ie(),t=H(),n=t.namespace,a=t.collection,o=(0,Ne.useDispatch)("".concat(n,"/").concat(a)),c=me((0,r.useState)(!1),2),s=c[0],u=c[1],p=me((0,r.useState)(null),2),d=p[0],f=p[1],m=me((0,r.useState)(!1),2),h=m[0],g=m[1],v=me(Ho(),2),b=v[0],y=v[1],w=0===b.length,E=It(),_=w?(0,se.__)("Delete","newsletter-optin-box"):(0,se.__)("Delete Selected","newsletter-optin-box"),x=w?Ri(Ri({},e),{},{number:-1}):{include:b.join(",")};return(0,r.createElement)(r.Fragment,null,(0,r.createElement)(l.Button,{onClick:function(){return u(!0)},variant:"tertiary",icon:"trash",text:_,isDestructive:!0}),s&&(0,r.createElement)(l.Modal,{title:_,onRequestClose:function(){return u(!1)}},(0,r.createElement)((function(){return(0,r.createElement)(r.Fragment,null,h?(0,r.createElement)(r.Fragment,null,(0,r.createElement)(l.Spinner,null),(0,se.__)("Deleting...","newsletter-optin-box")):(0,r.createElement)(r.Fragment,null,d?(0,r.createElement)(gr,null,d.message):(0,r.createElement)(gr,null,w&&(0,se.sprintf)((0,se.__)("Are you sure you want to delete %d matching records?","newsletter-optin-box"),E),!w&&(0,se.sprintf)((0,se.__)("Are you sure you want to delete %d selected records?","newsletter-optin-box"),b.length)),(0,r.createElement)(mr,{isDestructive:!0,onClick:function(){g(!0),o.deleteRecords((0,i.addQueryArgs)("",x),o).then((function(e){u(!1),y([])})).catch((function(e){f(e)})).finally((function(){g(!1)}))}},(0,se.__)("Yes, Delete!","newsletter-optin-box")),(0,r.createElement)(mr,{onClick:function(){return u(!1)},variant:"secondary",__withNoMargin:!0},(0,se.__)("Cancel","newsletter-optin-box"))))}),null)))}),null))),Ni=function(e){var t=e.schema,n=t.schema,a=t.hidden,o=t.ignore,i=t.labels,l=e.total,c=e.summary,s=e.records,u=e.isLoading,p=H(),d=p.namespace,f=p.collection,m=(0,r.useMemo)((function(){var e=[];return n.forEach((function(t){o.includes(t.name)||e.push(function(e){for(var t=1;t0&&(0,r.createElement)(wo,null,e)})))))}var Hi=cr("div",{target:"ei95lsh0"})({name:"1kd8sf",styles:"margin:1.6rem 0;max-width:600px"}),Ui=mr.withComponent(l.FormFileUpload,{target:"ei95lsh1"});const qi=function(e){var t=e.onUpload;return(0,r.createElement)(Hi,null,(0,r.createElement)(l.__experimentalText,{weight:600,as:"h3"},(0,se.__)("This tool allows you to import existing records from a CSV file.","newsletter-optin-box")),(0,r.createElement)(Ui,{accept:"text/csv",onChange:function(e){return t(e.currentTarget.files[0])},variant:"primary"},(0,r.createElement)(l.Icon,{icon:"cloud-upload"}),(0,se.__)("Select a CSV file","newsletter-optin-box")),(0,r.createElement)(l.Tip,null,(0,se.__)("The first row of the CSV file should contain the field names/headers.","newsletter-optin-box"),(0,r.createElement)("br",null),(0,se.__)(" Have a different file type?","newsletter-optin-box")," ",(0,r.createElement)(l.Button,{variant:"link",href:"https://convertio.co/csv-converter/",target:"_blank",text:(0,se.__)("Convert it to CSV","newsletter-optin-box")})))};function Wi(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 Vi(e){for(var t=1;t0&&(0,r.createElement)(l.FlexItem,null,(0,r.createElement)(lo,{value:(0,r.createElement)(Ji,{from:$,to:B,duration:m||w?300:v}),label:(0,se.__)("Records Created","newsletter-optin-box"),status:"success"})),A>0&&(0,r.createElement)(l.FlexItem,null,(0,r.createElement)(lo,{value:(0,r.createElement)(Ji,{from:I,to:A,duration:m||w?300:v}),label:(0,se.__)("Records Updated","newsletter-optin-box"),status:"success"})),W>0&&(0,r.createElement)(l.FlexItem,null,(0,r.createElement)(lo,{value:(0,r.createElement)(Ji,{from:Q,to:W,duration:m||w?300:v}),label:(0,se.__)("Records Failed","newsletter-optin-box"),status:"error"})),X>0&&(0,r.createElement)(l.FlexItem,null,(0,r.createElement)(lo,{value:(0,r.createElement)(Ji,{from:ee,to:X,duration:m||w?300:v}),label:(0,se.__)("Records Skipped","newsletter-optin-box"),status:"info"}))),m&&(0,r.createElement)(mr,{variant:"primary",text:(0,se.__)("View Records","newsletter-optin-box"),onClick:function(){return s()},maxWidth:"200px"}),p.length>0&&(0,r.createElement)(vr,{as:"h3"},(0,se.__)("Errors","newsletter-optin-box")," ",m&&(0,r.createElement)(l.Button,{onClick:function(){return d([])},variant:"link"},(0,se.__)("Clear","newsletter-optin-box"))),p.map((function(e,t){return(0,r.createElement)(gr,{key:t},e.message)}))):(0,r.createElement)(vr,{as:"h3"},(0,se.__)("Parsing","newsletter-optin-box"),(0,r.createElement)("code",null,t.name),"...  ",(0,r.createElement)(l.Spinner,null))},el=function(e){var t=e.file,n=e.schema,a=n.schema,o=n.ignore,i=n.hidden,l=n.id_prop,c=e.back,s=me((0,r.useState)(null),2),u=s[0],p=s[1],d=me((0,r.useState)(!1),2),f=d[0],m=d[1];return u?(0,r.createElement)(Zi,{file:t,headers:u,updateRecords:f,back:c,id_prop:l}):(0,r.createElement)(Xi,{file:t,schema:a,ignore:o,hidden:i,back:c,onContinue:function(e,t){p(e),m(t),window.scrollTo({top:0,behavior:"smooth"})}})};function tl(){var e,t=At().data,n=me((0,r.useState)(null),2),a=n[0],o=n[1];return(0,r.createElement)(jt,{title:(null===(e=t.labels)||void 0===e?void 0:e.import)||(0,se.__)("Import","newsletter-optin-box")},(0,r.createElement)(l.CardBody,null,a?(0,r.createElement)(el,{file:a,schema:t,back:function(){return o(null)}}):(0,r.createElement)(qi,{onUpload:function(e){o(e),window.scrollTo({top:0,behavior:"smooth"})}})))}var nl=function(e){var t=e.defaultRoute,n=document.location.pathname,a=n.substring(0,n.lastIndexOf("/"));return(0,r.createElement)(l.SlotFillProvider,null,(0,r.createElement)(pe,null,(0,r.createElement)(re,{history:Ce(t)},(0,r.createElement)(ee,{basename:a},(0,r.createElement)(J,{path:"/:namespace/:collection",exact:!0,element:(0,r.createElement)(ua,null)},(0,r.createElement)(J,{path:":id",exact:!0,element:(0,r.createElement)(Ei,null)},(0,r.createElement)(J,{path:":tab",exact:!0,element:(0,r.createElement)(wi,null)}),(0,r.createElement)(J,{index:!0,element:(0,r.createElement)(wi,null)})),(0,r.createElement)(J,{path:"add",exact:!0,element:(0,r.createElement)($i,null),handle:{title:function(e){var t,n=e.labels,r=e.collection;return null!==(t=null==n?void 0:n.add_new_item)&&void 0!==t?t:r}}}),(0,r.createElement)(J,{path:"import",exact:!0,element:(0,r.createElement)(tl,null)}),(0,r.createElement)(J,{index:!0,element:(0,r.createElement)(Bi,null)}))))))};o()((function(){var e=document.getElementById("noptin-collection__overview-app");if(e){var t=e.dataset.defaultRoute,n=(0,i.getQueryArg)(window.location.search,"hizzle_path");n&&n.split("/").length>1&&(t=n),r.createRoot?(0,r.createRoot)(e).render((0,r.createElement)(nl,{defaultRoute:t})):(0,r.render)((0,r.createElement)(nl,{defaultRoute:t}),e)}}))})()})(); \ No newline at end of file +(()=>{var e={184:(e,t)=>{var n;!function(){"use strict";var r={}.hasOwnProperty;function a(){for(var e=[],t=0;t{"use strict";var r=n(742),a={"text/plain":"Text","text/html":"Url",default:"Text"};e.exports=function(e,t){var n,o,i,l,c,s,u=!1;t||(t={}),n=t.debug||!1;try{if(i=r(),l=document.createRange(),c=document.getSelection(),(s=document.createElement("span")).textContent=e,s.ariaHidden="true",s.style.all="unset",s.style.position="fixed",s.style.top=0,s.style.clip="rect(0, 0, 0, 0)",s.style.whiteSpace="pre",s.style.webkitUserSelect="text",s.style.MozUserSelect="text",s.style.msUserSelect="text",s.style.userSelect="text",s.addEventListener("copy",(function(r){if(r.stopPropagation(),t.format)if(r.preventDefault(),void 0===r.clipboardData){n&&console.warn("unable to use e.clipboardData"),n&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var o=a[t.format]||a.default;window.clipboardData.setData(o,e)}else r.clipboardData.clearData(),r.clipboardData.setData(t.format,e);t.onCopy&&(r.preventDefault(),t.onCopy(r.clipboardData))})),document.body.appendChild(s),l.selectNodeContents(s),c.addRange(l),!document.execCommand("copy"))throw new Error("copy command was unsuccessful");u=!0}catch(r){n&&console.error("unable to copy using execCommand: ",r),n&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),u=!0}catch(r){n&&console.error("unable to copy using clipboardData: ",r),n&&console.error("falling back to prompt"),o=function(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}("message"in t?t.message:"Copy to clipboard: #{key}, Enter"),window.prompt(o,e)}}finally{c&&("function"==typeof c.removeRange?c.removeRange(l):c.removeAllRanges()),s&&document.body.removeChild(s),i()}return u}},679:(e,t,n)=>{"use strict";var r=n(296),a={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},o={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},i={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},l={};function c(e){return r.isMemo(e)?i:l[e.$$typeof]||a}l[r.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},l[r.Memo]=i;var s=Object.defineProperty,u=Object.getOwnPropertyNames,p=Object.getOwnPropertySymbols,d=Object.getOwnPropertyDescriptor,f=Object.getPrototypeOf,m=Object.prototype;e.exports=function e(t,n,r){if("string"!=typeof n){if(m){var a=f(n);a&&a!==m&&e(t,a,r)}var i=u(n);p&&(i=i.concat(p(n)));for(var l=c(t),h=c(n),g=0;g{"use strict";var n="function"==typeof Symbol&&Symbol.for,r=n?Symbol.for("react.element"):60103,a=n?Symbol.for("react.portal"):60106,o=n?Symbol.for("react.fragment"):60107,i=n?Symbol.for("react.strict_mode"):60108,l=n?Symbol.for("react.profiler"):60114,c=n?Symbol.for("react.provider"):60109,s=n?Symbol.for("react.context"):60110,u=n?Symbol.for("react.async_mode"):60111,p=n?Symbol.for("react.concurrent_mode"):60111,d=n?Symbol.for("react.forward_ref"):60112,f=n?Symbol.for("react.suspense"):60113,m=n?Symbol.for("react.suspense_list"):60120,h=n?Symbol.for("react.memo"):60115,g=n?Symbol.for("react.lazy"):60116,v=n?Symbol.for("react.block"):60121,b=n?Symbol.for("react.fundamental"):60117,y=n?Symbol.for("react.responder"):60118,w=n?Symbol.for("react.scope"):60119;function E(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case r:switch(e=e.type){case u:case p:case o:case l:case i:case f:return e;default:switch(e=e&&e.$$typeof){case s:case d:case g:case h:case c:return e;default:return t}}case a:return t}}}function _(e){return E(e)===p}t.AsyncMode=u,t.ConcurrentMode=p,t.ContextConsumer=s,t.ContextProvider=c,t.Element=r,t.ForwardRef=d,t.Fragment=o,t.Lazy=g,t.Memo=h,t.Portal=a,t.Profiler=l,t.StrictMode=i,t.Suspense=f,t.isAsyncMode=function(e){return _(e)||E(e)===u},t.isConcurrentMode=_,t.isContextConsumer=function(e){return E(e)===s},t.isContextProvider=function(e){return E(e)===c},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===r},t.isForwardRef=function(e){return E(e)===d},t.isFragment=function(e){return E(e)===o},t.isLazy=function(e){return E(e)===g},t.isMemo=function(e){return E(e)===h},t.isPortal=function(e){return E(e)===a},t.isProfiler=function(e){return E(e)===l},t.isStrictMode=function(e){return E(e)===i},t.isSuspense=function(e){return E(e)===f},t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===o||e===p||e===l||e===i||e===f||e===m||"object"==typeof e&&null!==e&&(e.$$typeof===g||e.$$typeof===h||e.$$typeof===c||e.$$typeof===s||e.$$typeof===d||e.$$typeof===b||e.$$typeof===y||e.$$typeof===w||e.$$typeof===v)},t.typeOf=E},296:(e,t,n)=>{"use strict";e.exports=n(103)},460:function(e,t){var n,r;n=function e(){"use strict";var t="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==t?t:{},n=!t.document&&!!t.postMessage,r=t.IS_PAPA_WORKER||!1,a={},o=0,i={parse:function(n,r){var l=(r=r||{}).dynamicTyping||!1;if(E(l)&&(r.dynamicTypingFunction=l,l={}),r.dynamicTyping=l,r.transform=!!E(r.transform)&&r.transform,r.worker&&i.WORKERS_SUPPORTED){var c=function(){if(!i.WORKERS_SUPPORTED)return!1;var n,r,l=(n=t.URL||t.webkitURL||null,r=e.toString(),i.BLOB_URL||(i.BLOB_URL=n.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ","(",r,")();"],{type:"text/javascript"})))),c=new t.Worker(l);return c.onmessage=g,c.id=o++,a[c.id]=c}();return c.userStep=r.step,c.userChunk=r.chunk,c.userComplete=r.complete,c.userError=r.error,r.step=E(r.step),r.chunk=E(r.chunk),r.complete=E(r.complete),r.error=E(r.error),delete r.worker,void c.postMessage({input:n,config:r,workerId:c.id})}var f=null;return i.NODE_STREAM_INPUT,"string"==typeof n?(n=function(e){return 65279===e.charCodeAt(0)?e.slice(1):e}(n),f=r.download?new s(r):new p(r)):!0===n.readable&&E(n.read)&&E(n.on)?f=new d(r):(t.File&&n instanceof File||n instanceof Object)&&(f=new u(r)),f.stream(n)},unparse:function(e,t){var n=!1,r=!0,a=",",o="\r\n",l='"',c=l+l,s=!1,u=null,p=!1;!function(){if("object"==typeof t){if("string"!=typeof t.delimiter||i.BAD_DELIMITERS.filter((function(e){return-1!==t.delimiter.indexOf(e)})).length||(a=t.delimiter),("boolean"==typeof t.quotes||"function"==typeof t.quotes||Array.isArray(t.quotes))&&(n=t.quotes),"boolean"!=typeof t.skipEmptyLines&&"string"!=typeof t.skipEmptyLines||(s=t.skipEmptyLines),"string"==typeof t.newline&&(o=t.newline),"string"==typeof t.quoteChar&&(l=t.quoteChar),"boolean"==typeof t.header&&(r=t.header),Array.isArray(t.columns)){if(0===t.columns.length)throw new Error("Option columns is empty");u=t.columns}void 0!==t.escapeChar&&(c=t.escapeChar+l),("boolean"==typeof t.escapeFormulae||t.escapeFormulae instanceof RegExp)&&(p=t.escapeFormulae instanceof RegExp?t.escapeFormulae:/^[=+\-@\t\r].*$/)}}();var d=new RegExp(m(l),"g");if("string"==typeof e&&(e=JSON.parse(e)),Array.isArray(e)){if(!e.length||Array.isArray(e[0]))return f(null,e,s);if("object"==typeof e[0])return f(u||Object.keys(e[0]),e,s)}else if("object"==typeof e)return"string"==typeof e.data&&(e.data=JSON.parse(e.data)),Array.isArray(e.data)&&(e.fields||(e.fields=e.meta&&e.meta.fields||u),e.fields||(e.fields=Array.isArray(e.data[0])?e.fields:"object"==typeof e.data[0]?Object.keys(e.data[0]):[]),Array.isArray(e.data[0])||"object"==typeof e.data[0]||(e.data=[e.data])),f(e.fields||[],e.data||[],s);throw new Error("Unable to serialize unrecognized input");function f(e,t,n){var i="";"string"==typeof e&&(e=JSON.parse(e)),"string"==typeof t&&(t=JSON.parse(t));var l=Array.isArray(e)&&0=this._config.preview;if(r)t.postMessage({results:l,workerId:i.WORKER_ID,finished:s});else if(E(this._config.chunk)&&!n){if(this._config.chunk(l,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);l=void 0,this._completeResults=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(l.data),this._completeResults.errors=this._completeResults.errors.concat(l.errors),this._completeResults.meta=l.meta),this._completed||!s||!E(this._config.complete)||l&&l.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),s||l&&l.meta.paused||this._nextChunk(),l}this._halted=!0},this._sendError=function(e){E(this._config.error)?this._config.error(e):r&&this._config.error&&t.postMessage({workerId:i.WORKER_ID,error:e,finished:!1})}}function s(e){var t;(e=e||{}).chunkSize||(e.chunkSize=i.RemoteChunkSize),c.call(this,e),this._nextChunk=n?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(e){this._input=e,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(t=new XMLHttpRequest,this._config.withCredentials&&(t.withCredentials=this._config.withCredentials),n||(t.onload=w(this._chunkLoaded,this),t.onerror=w(this._chunkError,this)),t.open(this._config.downloadRequestBody?"POST":"GET",this._input,!n),this._config.downloadRequestHeaders){var e=this._config.downloadRequestHeaders;for(var r in e)t.setRequestHeader(r,e[r])}if(this._config.chunkSize){var a=this._start+this._config.chunkSize-1;t.setRequestHeader("Range","bytes="+this._start+"-"+a)}try{t.send(this._config.downloadRequestBody)}catch(e){this._chunkError(e.message)}n&&0===t.status&&this._chunkError()}},this._chunkLoaded=function(){4===t.readyState&&(t.status<200||400<=t.status?this._chunkError():(this._start+=this._config.chunkSize?this._config.chunkSize:t.responseText.length,this._finished=!this._config.chunkSize||this._start>=function(e){var t=e.getResponseHeader("Content-Range");return null===t?-1:parseInt(t.substring(t.lastIndexOf("/")+1))}(t),this.parseChunk(t.responseText)))},this._chunkError=function(e){var n=t.statusText||e;this._sendError(new Error(n))}}function u(e){var t,n;(e=e||{}).chunkSize||(e.chunkSize=i.LocalChunkSize),c.call(this,e);var r="undefined"!=typeof FileReader;this.stream=function(e){this._input=e,n=e.slice||e.webkitSlice||e.mozSlice,r?((t=new FileReader).onload=w(this._chunkLoaded,this),t.onerror=w(this._chunkError,this)):t=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount=this._input.size,this.parseChunk(e.target.result)},this._chunkError=function(){this._sendError(t.error)}}function p(e){var t;c.call(this,e=e||{}),this.stream=function(e){return t=e,this._nextChunk()},this._nextChunk=function(){if(!this._finished){var e,n=this._config.chunkSize;return n?(e=t.substring(0,n),t=t.substring(n)):(e=t,t=""),this._finished=!t,this.parseChunk(e)}}}function d(e){c.call(this,e=e||{});var t=[],n=!0,r=!1;this.pause=function(){c.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){c.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(e){this._input=e,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){r&&1===t.length&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),t.length?this.parseChunk(t.shift()):n=!0},this._streamData=w((function(e){try{t.push("string"==typeof e?e:e.toString(this._config.encoding)),n&&(n=!1,this._checkIsFinished(),this.parseChunk(t.shift()))}catch(e){this._streamError(e)}}),this),this._streamError=w((function(e){this._streamCleanUp(),this._sendError(e)}),this),this._streamEnd=w((function(){this._streamCleanUp(),r=!0,this._streamData("")}),this),this._streamCleanUp=w((function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)}),this)}function f(e){var t,n,r,a=Math.pow(2,53),o=-a,l=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,c=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,s=this,u=0,p=0,d=!1,f=!1,g=[],v={data:[],errors:[],meta:{}};if(E(e.step)){var b=e.step;e.step=function(t){if(v=t,x())_();else{if(_(),0===v.data.length)return;u+=t.data.length,e.preview&&u>e.preview?n.abort():(v.data=v.data[0],b(v,s))}}}function w(t){return"greedy"===e.skipEmptyLines?""===t.join("").trim():1===t.length&&0===t[0].length}function _(){return v&&r&&(k("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+i.DefaultDelimiter+"'"),r=!1),e.skipEmptyLines&&(v.data=v.data.filter((function(e){return!w(e)}))),x()&&function(){if(v)if(Array.isArray(v.data[0])){for(var t=0;x()&&t=g.length?"__parsed_extra":g[r]),e.transform&&(i=e.transform(i,o)),i=O(o,i),"__parsed_extra"===o?(a[o]=a[o]||[],a[o].push(i)):a[o]=i}return e.header&&(r>g.length?k("FieldMismatch","TooManyFields","Too many fields: expected "+g.length+" fields but parsed "+r,p+n):r=r.length/2?"\r\n":"\r"}(a,c)),r=!1,e.delimiter)E(e.delimiter)&&(e.delimiter=e.delimiter(a),v.meta.delimiter=e.delimiter);else{var s=function(t,n,r,a,o){var l,c,s,u;o=o||[",","\t","|",";",i.RECORD_SEP,i.UNIT_SEP];for(var p=0;p=l)return V(!0)}else for(L=u,u++;;){if(-1===(L=i.indexOf(t,L+1)))return f||_.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:w.length,index:u}),U();if(L===h-1)return U(i.substring(u,L).replace(B,t));if(t!==s||i[L+1]!==s){if(t===s||0===L||i[L-1]!==s){-1!==N&&N=l)return V(!0);break}_.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:w.length,index:u}),L++}}else L++}return U();function $(e){w.push(e),O=u}function H(e){var t=0;if(-1!==e){var n=i.substring(L+1,e);n&&""===n.trim()&&(t=n.length)}return t}function U(e){return f||(void 0===e&&(e=i.substring(u)),x.push(e),u=h,$(x),y&&Q()),V()}function W(e){u=e,$(x),x=[],M=i.indexOf(r,u)}function V(e){return{data:w,errors:_,meta:{delimiter:n,linebreak:r,aborted:p,truncated:!!e,cursor:O+(d||0)}}}function Q(){o(V()),w=[],_=[]}},this.abort=function(){p=!0},this.getCharIndex=function(){return u}}function g(e){var t=e.data,n=a[t.workerId],r=!1;if(t.error)n.userError(t.error,t.file);else if(t.results&&t.results.data){var o={abort:function(){r=!0,v(t.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:b,resume:b};if(E(n.userStep)){for(var i=0;i{e.exports=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,n=[],r=0;r{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(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.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{"use strict";var e={};n.r(e),n.d(e,{apiFetch:()=>Be.apiFetch,beforeDeleteRecord:()=>He,setPartialRecords:()=>Le,setRecord:()=>qe,setRecordOverview:()=>We,setRecords:()=>ze,setSchema:()=>$e,setTabContent:()=>Ue});var t={};n.r(t),n.d(t,{getAllRecords:()=>pt,getPartialRecords:()=>ft,getQuerySummary:()=>ut,getQueryTotal:()=>st,getRecord:()=>mt,getRecordIDs:()=>ct,getRecordOverview:()=>vt,getRecords:()=>dt,getSchema:()=>ht,getTabContent:()=>gt});const r=window.wp.element,a=window.wp.domReady;var o=n.n(a);const i=window.wp.url,l=window.wp.components,c=window.React;var s,u;function p(e,t){if(!1===e||null==e)throw new Error(t)}function d(e,t){if(!e){"undefined"!=typeof console&&console.warn(t);try{throw new Error(t)}catch(e){}}}function f(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function m(e,t,n){void 0===n&&(n="/");let r=j(("string"==typeof t?f(t):t).pathname||"/",n);if(null==r)return null;let a=h(e);!function(e){e.sort(((e,t)=>e.score!==t.score?t.score-e.score:function(e,t){return e.length===t.length&&e.slice(0,-1).every(((e,n)=>e===t[n]))?e[e.length-1]-t[t.length-1]:0}(e.routesMeta.map((e=>e.childrenIndex)),t.routesMeta.map((e=>e.childrenIndex)))))}(a);let o=null;for(let e=0;null==o&&e{let i={relativePath:void 0===o?e.path||"":o,caseSensitive:!0===e.caseSensitive,childrenIndex:a,route:e};i.relativePath.startsWith("/")&&(p(i.relativePath.startsWith(r),'Absolute route path "'+i.relativePath+'" nested under path "'+r+'" is not valid. An absolute child route path must start with the combined path of all its parent routes.'),i.relativePath=i.relativePath.slice(r.length));let l=P([r,i.relativePath]),c=n.concat(i);e.children&&e.children.length>0&&(p(!0!==e.index,'Index routes must not have child routes. Please remove all child routes from route path "'+l+'".'),h(e.children,t,c,l)),(null!=e.path||e.index)&&t.push({path:l,score:O(l,e.index),routesMeta:c})};return e.forEach(((e,t)=>{var n;if(""!==e.path&&null!=(n=e.path)&&n.includes("?"))for(let n of g(e.path))a(e,t,n);else a(e,t)})),t}function g(e){let t=e.split("/");if(0===t.length)return[];let[n,...r]=t,a=n.endsWith("?"),o=n.replace(/\?$/,"");if(0===r.length)return a?[o,""]:[o];let i=g(r.join("/")),l=[];return l.push(...i.map((e=>""===e?o:[o,e].join("/")))),a&&l.push(...i),l.map((t=>e.startsWith("/")&&""===t?"/":t))}!function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"}(s||(s={})),function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"}(u||(u={})),new Set(["lazy","caseSensitive","path","id","index","children"]);const v=/^:\w+$/,b=3,y=2,w=1,E=10,_=-2,x=e=>"*"===e;function O(e,t){let n=e.split("/"),r=n.length;return n.some(x)&&(r+=_),t&&(r+=y),n.filter((e=>!x(e))).reduce(((e,t)=>e+(v.test(t)?b:""===t?w:E)),r)}function k(e,t){let{routesMeta:n}=e,r={},a="/",o=[];for(let e=0;e(r.push(t),"/([^\\/]+)")));return e.endsWith("*")?(r.push("*"),a+="*"===e||"/*"===e?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?a+="\\/*$":""!==e&&"/"!==e&&(a+="(?:(?=\\/|$))"),[new RegExp(a,t?void 0:"i"),r]}(e.path,e.caseSensitive,e.end),a=t.match(n);if(!a)return null;let o=a[0],i=o.replace(/(.)\/+$/,"$1"),l=a.slice(1);return{params:r.reduce(((e,t,n)=>{if("*"===t){let e=l[n]||"";i=o.slice(0,o.length-e.length).replace(/(.)\/+$/,"$1")}return e[t]=function(e,t){try{return decodeURIComponent(e)}catch(n){return d(!1,'The value for the URL param "'+t+'" will not be decoded because the string "'+e+'" is a malformed URL segment. This is probably due to a bad percent encoding ('+n+")."),e}}(l[n]||"",t),e}),{}),pathname:o,pathnameBase:i,pattern:e}}function C(e){try{return decodeURI(e)}catch(t){return d(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent encoding ('+t+")."),e}}function j(e,t){if("/"===t)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&"/"!==r?null:e.slice(n)||"/"}const P=e=>e.join("/").replace(/\/\/+/g,"/"),R=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/");Error;const D=["post","put","patch","delete"],A=(new Set(D),["get",...D]);function F(){return F=Object.assign?Object.assign.bind():function(e){for(var t=1;te.route.id&&(null==i?void 0:i[e.route.id])));e>=0||p(!1),o=o.slice(0,Math.min(o.length,e+1))}return o.reduceRight(((e,r,a)=>{let l=r.route.id?null==i?void 0:i[r.route.id]:null,s=null;n&&(s=r.route.errorElement||W);let u=t.concat(o.slice(0,a+1)),p=()=>{let t;return t=l?s:r.route.Component?c.createElement(r.route.Component,null):r.route.element?r.route.element:e,c.createElement(Q,{match:r,routeContext:{outlet:e,matches:u,isDataRoute:null!=n},children:t})};return n&&(r.route.ErrorBoundary||r.route.errorElement||0===a)?c.createElement(V,{location:n.location,revalidation:n.revalidation,component:s,error:l,children:p(),routeContext:{outlet:null,matches:u,isDataRoute:!0}}):p()}),null)}(v&&v.map((e=>Object.assign({},e,{params:Object.assign({},i,e.params),pathname:P([l,r.encodeLocation?r.encodeLocation(e.pathname).pathname:e.pathname]),pathnameBase:"/"===e.pathnameBase?l:P([l,r.encodeLocation?r.encodeLocation(e.pathnameBase).pathname:e.pathnameBase])}))),a,n);return t&&b?c.createElement(M.Provider,{value:{location:F({pathname:"/",search:"",hash:"",state:null,key:"default"},u),navigationType:s.Pop}},b):b}function U(){let e=function(){var e;let t=c.useContext(L),n=function(e){let t=c.useContext(I);return t||p(!1),t}(G.UseRouteError),r=function(e){let t=function(e){let t=c.useContext(B);return t||p(!1),t}(),n=t.matches[t.matches.length-1];return n.route.id||p(!1),n.route.id}(G.UseRouteError);return t||(null==(e=n.errors)?void 0:e[r])}(),t=function(e){return null!=e&&"number"==typeof e.status&&"string"==typeof e.statusText&&"boolean"==typeof e.internal&&"data"in e}(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return c.createElement(c.Fragment,null,c.createElement("h2",null,"Unexpected Application Error!"),c.createElement("h3",{style:{fontStyle:"italic"}},t),n?c.createElement("pre",{style:r},n):null,null)}const W=c.createElement(U,null);class V extends c.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||"idle"!==t.revalidation&&"idle"===e.revalidation?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error||t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){console.error("React Router caught the following error during render",e,t)}render(){return this.state.error?c.createElement(B.Provider,{value:this.props.routeContext},c.createElement(L.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function Q(e){let{routeContext:t,match:n,children:r}=e,a=c.useContext(T);return a&&a.static&&a.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=n.route.id),c.createElement(B.Provider,{value:t},r)}var K,G,Y;function X(e){return function(e){let t=c.useContext(B).outlet;return t?c.createElement(q.Provider,{value:e},t):t}(e.context)}function J(e){p(!1)}function Z(e){let{basename:t="/",children:n=null,location:r,navigationType:a=s.Pop,navigator:o,static:i=!1}=e;z()&&p(!1);let l=t.replace(/^\/*/,"/"),u=c.useMemo((()=>({basename:l,navigator:o,static:i})),[l,o,i]);"string"==typeof r&&(r=f(r));let{pathname:d="/",search:m="",hash:h="",state:g=null,key:v="default"}=r,b=c.useMemo((()=>{let e=j(d,l);return null==e?null:{location:{pathname:e,search:m,hash:h,state:g,key:v},navigationType:a}}),[l,d,m,h,g,v,a]);return null==b?null:c.createElement(N.Provider,{value:u},c.createElement(M.Provider,{children:n,value:b}))}function ee(e){let{children:t,location:n}=e;return H(te(t),n)}function te(e,t){void 0===t&&(t=[]);let n=[];return c.Children.forEach(e,((e,r)=>{if(!c.isValidElement(e))return;let a=[...t,r];if(e.type===c.Fragment)return void n.push.apply(n,te(e.props.children,a));e.type!==J&&p(!1),e.props.index&&e.props.children&&p(!1);let o={id:e.props.id||a.join("-"),caseSensitive:e.props.caseSensitive,element:e.props.element,Component:e.props.Component,index:e.props.index,path:e.props.path,loader:e.props.loader,action:e.props.action,errorElement:e.props.errorElement,ErrorBoundary:e.props.ErrorBoundary,hasErrorBoundary:null!=e.props.ErrorBoundary||null!=e.props.errorElement,shouldRevalidate:e.props.shouldRevalidate,handle:e.props.handle,lazy:e.props.lazy};e.props.children&&(o.children=te(e.props.children,a)),n.push(o)})),n}!function(e){e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate"}(K||(K={})),function(e){e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId"}(G||(G={})),c.startTransition,function(e){e[e.pending=0]="pending",e[e.success=1]="success",e[e.error=2]="error"}(Y||(Y={})),new Promise((()=>{})),c.Component,new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);const ne=c.startTransition;function re(e){let{basename:t,children:n,future:r,history:a}=e,[o,i]=c.useState({action:a.action,location:a.location}),{v7_startTransition:l}=r||{},s=c.useCallback((e=>{l&&ne?ne((()=>i(e))):i(e)}),[i,l]);return c.useLayoutEffect((()=>a.listen(s)),[a,s]),c.createElement(Z,{basename:t,children:n,location:o.location,navigationType:o.action,navigator:a})}var ae,oe;"undefined"!=typeof window&&void 0!==window.document&&window.document.createElement,function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher"}(ae||(ae={})),function(e){e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"}(oe||(oe={}));const ie=(0,c.createContext)(null),le={didCatch:!1,error:null};class ce extends c.Component{constructor(e){super(e),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=le}static getDerivedStateFromError(e){return{didCatch:!0,error:e}}resetErrorBoundary(){const{error:e}=this.state;if(null!==e){for(var t,n,r=arguments.length,a=new Array(r),o=0;o0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return e.length!==t.length||e.some(((e,n)=>!Object.is(e,t[n])))}(e.resetKeys,r)&&(null===(a=(o=this.props).onReset)||void 0===a||a.call(o,{next:r,prev:e.resetKeys,reason:"keys"}),this.setState(le))}render(){const{children:e,fallbackRender:t,FallbackComponent:n,fallback:r}=this.props,{didCatch:a,error:o}=this.state;let i=e;if(a){const e={error:o,resetErrorBoundary:this.resetErrorBoundary};if((0,c.isValidElement)(r))i=r;else if("function"==typeof t)i=t(e);else{if(!n)throw new Error("react-error-boundary requires either a fallback, fallbackRender, or FallbackComponent prop");i=(0,c.createElement)(n,e)}}return(0,c.createElement)(ie.Provider,{value:{didCatch:a,error:o,resetErrorBoundary:this.resetErrorBoundary}},i)}}const se=window.wp.i18n;function ue(e){var t=e.error;return(0,r.createElement)(l.Notice,{status:"error",isDismissible:!1},(0,r.createElement)("strong",null,(0,se.__)("Error:","newsletter-optin-box"))," ",t.message)}function pe(e){var t=e.children;return(0,r.createElement)(ce,{FallbackComponent:ue},t)}var de;function fe(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&void 0!==arguments[0]?arguments[0]:"/";if(!ye){var t=function(e){void 0===e&&(e={});var t=e.window,n=void 0===t?document.defaultView:t,r=n.history;function a(){var e=n.location,t=e.pathname,a=e.search,o=e.hash,i=r.state||{};return[i.idx,we({pathname:t,search:a,hash:o,state:i.usr||null,key:i.key||"default"})]}var o=null;n.addEventListener(_e,(function(){if(o)p.call(o),o=null;else{var e=de.Pop,t=a(),n=t[0],r=t[1];if(p.length){if(null!=n){var i=c-n;i&&(o={action:e,location:r,retry:function(){v(-1*i)}},v(i))}}else g(e)}}));var i=de.Pop,l=a(),c=l[0],s=l[1],u=Oe(),p=Oe();function d(e){return"string"==typeof e?e:function(e){var t=e.pathname,n=void 0===t?"/":t,r=e.search,a=void 0===r?"":r,o=e.hash,i=void 0===o?"":o;return a&&"?"!==a&&(n+="?"===a.charAt(0)?a:"?"+a),i&&"#"!==i&&(n+="#"===i.charAt(0)?i:"#"+i),n}(e)}function f(e,t){return void 0===t&&(t=null),we(be({pathname:s.pathname,hash:"",search:""},"string"==typeof e?function(e){var t={};if(e){var n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));var r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}(e):e,{state:t,key:Math.random().toString(36).substr(2,8)}))}function m(e,t){return[{usr:e.state,key:e.key,idx:t},d(e)]}function h(e,t,n){return!p.length||(p.call({action:e,location:t,retry:n}),!1)}function g(e){i=e;var t=a();c=t[0],s=t[1],u.call({action:i,location:s})}function v(e){r.go(e)}return null==c&&(c=0,r.replaceState(be({},r.state,{idx:c}),"")),{get action(){return i},get location(){return s},createHref:d,push:function e(t,a){var o=de.Push,i=f(t,a);if(h(o,i,(function(){e(t,a)}))){var l=m(i,c+1),s=l[0],u=l[1];try{r.pushState(s,"",u)}catch(e){n.location.assign(u)}g(o)}},replace:function e(t,n){var a=de.Replace,o=f(t,n);if(h(a,o,(function(){e(t,n)}))){var i=m(o,c),l=i[0],s=i[1];r.replaceState(l,"",s),g(a)}},go:v,back:function(){v(-1)},forward:function(){v(1)},listen:function(e){return u.push(e)},block:function(e){var t=p.push(e);return 1===p.length&&n.addEventListener(Ee,xe),function(){t(),p.length||n.removeEventListener(Ee,xe)}}}}();ye={get action(){return t.action},get location(){var n=t.location,r=(0,i.getQueryArgs)(n.search).hizzle_path||e;return Se(Se({},n),{},{pathname:r})},createHref:t.createHref,push:t.push,replace:t.replace,go:t.go,back:t.back,forward:t.forward,block:t.block,listen:function(e){var n=this;return t.listen((function(){e({action:n.action,location:n.location})}))}}}return window._history=ye,ye}const je=window.lodash;function Pe(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;t1&&void 0!==arguments[1]?arguments[1]:De(),n=Re(Re({},arguments.length>2&&void 0!==arguments[2]?arguments[2]:Ae()),e);return"/"!==t&&(n.hizzle_path=t),Object.keys(n).forEach((function(e){""===n[e]&&delete n[e]})),(0,i.addQueryArgs)("admin.php",n)}function Te(e){var t=Fe(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:De(),arguments.length>2&&void 0!==arguments[2]?arguments[2]:Ae());Ce().push(t)}var Ie=function(e){Ce().push((0,i.addQueryArgs)("admin.php",(0,i.getQueryArgs)(e))),window.scrollTo({top:0,behavior:"smooth"})};const Ne=(0,r.forwardRef)((function(e,t){var n=e.actions,a=e.className,o=e.title,i=e.menu,c=e.children;return(0,r.createElement)(l.Card,{className:a,ref:t},(0,r.createElement)(pe,null,(0,r.createElement)(l.CardHeader,null,(0,r.createElement)(l.Flex,{justify:"start",wrap:!0},(0,r.createElement)(l.FlexItem,null,(0,r.createElement)(l.__experimentalText,{size:16,weight:600,as:"h2",color:"#23282d"},o)),n&&(0,r.createElement)(l.FlexItem,{className:"noptin-screen__actions"}," ",n," ")),i&&i),c))})),Me=window.wp.data,Be=window.wp.dataControls;var Le=function(e,t){return{type:"SET_PARTIAL_RECORDS",records:e,queryString:t}},ze=function(e,t){return{type:"SET_RECORDS",records:e,queryString:t}},qe=function(e){return{type:"SET_RECORD",record:e}},$e=function(e){return{type:"SET_SCHEMA",schema:e}},He=function(e){return{type:"BEFORE_DELETE_RECORD",id:e}},Ue=function(e,t,n){return{type:"SET_TAB_CONTENT",id:e,tab_id:t,content:n}},We=function(e,t){return{type:"SET_RECORD_OVERVIEW",id:e,overview:t}};const Ve=window.regeneratorRuntime;var Qe=n.n(Ve);function Ke(e,t){return{createRecord:Qe().mark((function n(r,a){var o,i;return Qe().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return o="".concat(e,"/v1/").concat(t),n.next=4,(0,Be.apiFetch)({path:o,method:"POST",data:r});case 4:if(!(i=n.sent)){n.next=17;break}return n.next=8,a.invalidateResolutionForStoreSelector("getRecords");case 8:return n.next=10,a.invalidateResolutionForStoreSelector("getPartialRecords");case 10:return n.next=12,a.invalidateResolution("getRecord",[i.id]);case 12:return n.next=14,a.startResolution("getRecord",[i.id]);case 14:return n.next=16,a.finishResolution("getRecord",[i.id]);case 16:return n.abrupt("return",qe(i));case 17:case"end":return n.stop()}}),n)})),updateRecord:Qe().mark((function n(r,a,o){var i,l;return Qe().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return i="".concat(e,"/v1/").concat(t,"/").concat(r),n.next=4,(0,Be.apiFetch)({path:i,method:"PUT",data:a});case 4:if(!(l=n.sent)){n.next=11;break}return n.next=8,o.startResolution("getRecord",[l.id]);case 8:return n.next=10,o.finishResolution("getRecord",[l.id]);case 10:return n.abrupt("return",o.setRecord(l));case 11:case"end":return n.stop()}}),n)})),deleteRecord:Qe().mark((function n(r,a){var o;return Qe().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,a.beforeDeleteRecord(r);case 2:return o="".concat(e,"/v1/").concat(t,"/").concat(r),n.next=6,(0,Be.apiFetch)({path:o,method:"DELETE"});case 6:return n.next=8,a.emptyCache(a);case 8:return n.abrupt("return",{type:"DELETE_RECORD",id:r});case 9:case"end":return n.stop()}}),n)})),deleteRecords:Qe().mark((function n(r,a){var o;return Qe().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return o="".concat(e,"/v1/").concat(t).concat(r),n.next=4,(0,Be.apiFetch)({path:o,method:"DELETE"});case 4:return n.next=6,a.emptyCache(a);case 6:return n.abrupt("return",{type:"DELETE_RECORDS"});case 7:case"end":return n.stop()}}),n)})),batchAction:Qe().mark((function n(r,a){var o,i;return Qe().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return o="".concat(e,"/v1/").concat(t,"/batch"),n.next=4,(0,Be.apiFetch)({path:o,method:"POST",data:r});case 4:return i=n.sent,n.next=7,a.emptyCache(a);case 7:return n.abrupt("return",{type:"BATCH_ACTION",result:i});case 8:case"end":return n.stop()}}),n)})),emptyCache:Qe().mark((function e(t){return Qe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.invalidateResolutionForStoreSelector("getRecords");case 2:return e.next=4,t.invalidateResolutionForStoreSelector("getPartialRecords");case 4:return e.next=6,t.invalidateResolutionForStoreSelector("getRecord");case 6:return e.next=8,t.invalidateResolutionForStoreSelector("getRecordOverview");case 8:return e.next=10,t.invalidateResolutionForStoreSelector("getTabContent");case 10:case"end":return e.stop()}}),e)}))}}var Ge={records:{byID:{},queries:{}},partialRecords:{},schema:{},tabContent:{},recordOverview:{}};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 Xe(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return"SET_SCHEMA"===t.type?t.schema:e},records:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{byID:{},queries:{}},t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"SET_RECORDS":var n=""===t.queryString?"all":t.queryString;return{byID:Xe(Xe({},e.byID),t.records.items.reduce((function(e,t){return Xe(Xe({},e),{},ve({},t.id,t))}),{})),queries:Xe(Xe({},e.queries),{},ve({},n,{items:t.records.items.map((function(e){return e.id})),summary:t.records.summary,total:t.records.total}))};case"SET_RECORD":return Xe(Xe({},e),{},{byID:Xe(Xe({},e.byID),{},ve({},t.record.id,t.record))});case"BEFORE_DELETE_RECORD":var r=Xe({},e.queries);return Object.keys(r).forEach((function(e){var n=r[e].items.indexOf(t.id);-1!==n&&(r[e].items.splice(n,1),r[e].total-=1)})),Xe(Xe({},e),{},{queries:r});case"DELETE_RECORD":var a=Xe({},e.byID);return delete a[t.id],Xe(Xe({},e),{},{byID:a});case"DELETE_RECORDS":return Xe(Xe({},e),{},{queries:{},byID:{}})}return e},partialRecords:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;if("SET_PARTIAL_RECORDS"===t.type){var n=""===t.queryString?"all":t.queryString;return Xe(Xe({},e),{},ve({},n,t.records))}return e},tabContent:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return"SET_TAB_CONTENT"===t.type?Xe(Xe({},e),{},ve({},"".concat(t.id,"_").concat(t.tab_id),t.content)):e},recordOverview:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return"SET_RECORD_OVERVIEW"===t.type?Xe(Xe({},e),{},ve({},t.id,t.overview)):e}});var Ze=function(e){return(0,i.addQueryArgs)(e,{uniqid:Math.random()})};function et(e,t){return{getRecords:Qe().mark((function n(r){var a,o,i,l;return Qe().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return a=Ze("".concat(e,"/v1/").concat(t).concat(r)),n.next=3,(0,Be.apiFetch)({path:a});case 3:if(!(o=n.sent)){n.next=12;break}return i="".concat(e,"/").concat(t),l=o.items.map((function(e){return[e.id]})),n.next=9,Me.controls.dispatch(i,"startResolutions","getRecord",l);case 9:return n.next=11,Me.controls.dispatch(i,"finishResolutions","getRecord",l);case 11:return n.abrupt("return",ze(o,r));case 12:case"end":return n.stop()}}),n)})),getPartialRecords:Qe().mark((function n(r){var a,o;return Qe().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return a=Ze("".concat(e,"/v1/").concat(t).concat(r)),n.next=3,(0,Be.apiFetch)({path:a});case 3:if(!(o=n.sent)){n.next=6;break}return n.abrupt("return",Le(o.items,r));case 6:case"end":return n.stop()}}),n)})),getRecord:Qe().mark((function n(r){var a,o;return Qe().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(r){n.next=2;break}throw new Error("Record not found.");case 2:return a=Ze("".concat(e,"/v1/").concat(t,"/").concat(r)),n.next=5,(0,Be.apiFetch)({path:a});case 5:return o=n.sent,n.abrupt("return",qe(o));case 7:case"end":return n.stop()}}),n)})),getSchema:Qe().mark((function n(){var r,a;return Qe().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=Ze("".concat(e,"/v1/").concat(t,"/collection_schema")),n.next=3,(0,Be.apiFetch)({path:r});case 3:return a=n.sent,n.abrupt("return",$e(a));case 5:case"end":return n.stop()}}),n)})),getTabContent:Qe().mark((function n(r,a){var o,i;return Qe().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(r){n.next=2;break}throw new Error("Record not found.");case 2:return o=Ze("".concat(e,"/v1/").concat(t,"/").concat(r,"/").concat(a)),n.next=5,(0,Be.apiFetch)({path:o});case 5:return i=n.sent,n.abrupt("return",Ue(r,a,i));case 7:case"end":return n.stop()}}),n)})),getRecordOverview:Qe().mark((function n(r){var a,o;return Qe().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(r){n.next=2;break}throw new Error("Record not found.");case 2:return a=Ze("".concat(e,"/v1/").concat(t,"/").concat(r,"/overview")),n.next=5,(0,Be.apiFetch)({path:a});case 5:return o=n.sent,n.abrupt("return",We(r,o));case 7:case"end":return n.stop()}}),n)}))}}var tt="NOT_FOUND",nt=function(e,t){return e===t};function rt(e,t){var n,r,a="object"==typeof t?t:{equalityCheck:t},o=a.equalityCheck,i=void 0===o?nt:o,l=a.maxSize,c=void 0===l?1:l,s=a.resultEqualityCheck,u=function(e){return function(t,n){if(null===t||null===n||t.length!==n.length)return!1;for(var r=t.length,a=0;a-1){var a=n[r];return r>0&&(n.splice(r,1),n.unshift(a)),a.value}return tt}return{get:r,put:function(t,a){r(t)===tt&&(n.unshift({key:t,value:a}),n.length>e&&n.pop())},getEntries:function(){return n},clear:function(){n=[]}}}(c,u);function d(){var t=p.get(arguments);if(t===tt){if(t=e.apply(null,arguments),s){var n=p.getEntries().find((function(e){return s(e.value,t)}));n&&(t=n.value)}p.put(arguments,t)}return t}return d.clearCache=function(){return p.clear()},d}function at(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r1?arguments[1]:void 0;return t=""===t?"all":t,null!==(e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ge).records.queries[t])&&void 0!==e?e:lt},st=function(){var e,t=arguments.length>1?arguments[1]:void 0;return t=""===t?"all":t,(null===(e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ge).records.queries[t])||void 0===e?void 0:e.total)||0},ut=function(){var e,t=arguments.length>1?arguments[1]:void 0;return t=""===t?"all":t,(null===(e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ge).records.queries[t])||void 0===e?void 0:e.summary)||{}},pt=function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ge).records.byID||{}},dt=at(rt)(ct,pt,(function(e,t){return it(it({},e),{},{items:e.items.map((function(e){return t[e]}))})})),ft=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ge,t=arguments.length>1?arguments[1]:void 0;return t=""===t?"all":t,Array.isArray(e.partialRecords[t])?e.partialRecords[t]:[]},mt=function(){var e=arguments.length>1?arguments[1]:void 0;return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ge).records.byID[e]||null},ht=function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ge).schema||{}},gt=function(){var e=arguments.length>1?arguments[1]:void 0,t=arguments.length>2?arguments[2]:void 0;return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ge).tabContent["".concat(e,"_").concat(t)]||{}},vt=function(){var e=arguments.length>1?arguments[1]:void 0;return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ge).recordOverview[e]||[]};function bt(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 yt(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:{};return o.updateRecord(n,e,o)},delete:function(){return o.deleteRecord(n,o).catch((function(e){console.error(e)}))}}}),[n]);return _t(_t({},St((function(e){return e(a).getRecord(n)}),[e,t,n])),i)}function Pt(e,t){var n=kt(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{});return St((function(r){return r(xt(e,t)).getRecords(n)}),[e,t,n])}function Rt(e,t){return St((function(n){return n(xt(e,t)).getSchema()}),[e,t])}function Dt(e){var t=Object.create(null);return function(n){return void 0===t[n]&&(t[n]=e(n)),t[n]}}var At=/^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|download|draggable|encType|enterKeyHint|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/,Ft=Dt((function(e){return At.test(e)||111===e.charCodeAt(0)&&110===e.charCodeAt(1)&&e.charCodeAt(2)<91})),Tt=function(){function e(e){var t=this;this._insertTag=function(e){var n;n=0===t.tags.length?t.insertionPoint?t.insertionPoint.nextSibling:t.prepend?t.container.firstChild:t.before:t.tags[t.tags.length-1].nextSibling,t.container.insertBefore(e,n),t.tags.push(e)},this.isSpeedy=void 0===e.speedy||e.speedy,this.tags=[],this.ctr=0,this.nonce=e.nonce,this.key=e.key,this.container=e.container,this.prepend=e.prepend,this.insertionPoint=e.insertionPoint,this.before=null}var t=e.prototype;return t.hydrate=function(e){e.forEach(this._insertTag)},t.insert=function(e){this.ctr%(this.isSpeedy?65e3:1)==0&&this._insertTag(function(e){var t=document.createElement("style");return t.setAttribute("data-emotion",e.key),void 0!==e.nonce&&t.setAttribute("nonce",e.nonce),t.appendChild(document.createTextNode("")),t.setAttribute("data-s",""),t}(this));var t=this.tags[this.tags.length-1];if(this.isSpeedy){var n=function(e){if(e.sheet)return e.sheet;for(var t=0;t0?qt(Xt,--Gt):0,Qt--,10===Yt&&(Qt=1,Vt--),Yt}function tn(){return Yt=Gt2||on(Yt)>3?"":" "}function pn(e,t){for(;--t&&tn()&&!(Yt<48||Yt>102||Yt>57&&Yt<65||Yt>70&&Yt<97););return an(e,rn()+(t<6&&32==nn()&&32==tn()))}function dn(e){for(;tn();)switch(Yt){case e:return Gt;case 34:case 39:34!==e&&39!==e&&dn(Yt);break;case 40:41===e&&dn(e);break;case 92:tn()}return Gt}function fn(e,t){for(;tn()&&e+Yt!==57&&(e+Yt!==84||47!==nn()););return"/*"+an(t,Gt-1)+"*"+Nt(47===e?e:tn())}function mn(e){for(;!on(nn());)tn();return an(e,Gt)}var hn="-ms-",gn="-moz-",vn="-webkit-",bn="comm",yn="rule",wn="decl",En="@keyframes";function _n(e,t){for(var n="",r=Ut(e),a=0;a0&&Ht(x)-p&&Wt(f>32?jn(x+";",r,n,p-1):jn(Lt(x," ","")+";",r,n,p-2),c);break;case 59:x+=";";default:if(Wt(_=Sn(x,t,n,s,u,a,l,y,w=[],E=[],p),o),123===b)if(0===u)kn(x,t,_,_,w,o,p,l,E);else switch(99===d&&110===qt(x,3)?100:d){case 100:case 108:case 109:case 115:kn(e,_,_,r&&Wt(Sn(e,_,_,0,0,a,l,y,a,w=[],p),E),a,E,p,l,r?w:E);break;default:kn(x,_,_,_,[""],E,0,l,E)}}s=u=f=0,h=v=1,y=x="",p=i;break;case 58:p=1+Ht(x),f=m;default:if(h<1)if(123==b)--h;else if(125==b&&0==h++&&125==en())continue;switch(x+=Nt(b),b*h){case 38:v=u>0?1:(x+="\f",-1);break;case 44:l[s++]=(Ht(x)-1)*v,v=1;break;case 64:45===nn()&&(x+=sn(tn())),d=nn(),u=p=Ht(y=x+=mn(rn())),b++;break;case 45:45===m&&2==Ht(x)&&(h=0)}}return o}function Sn(e,t,n,r,a,o,i,l,c,s,u){for(var p=a-1,d=0===a?o:[""],f=Ut(d),m=0,h=0,g=0;m0?d[v]+" "+b:Lt(b,/&\f/g,d[v])))&&(c[g++]=y);return Jt(e,t,n,0===a?yn:l,c,s,u)}function Cn(e,t,n){return Jt(e,t,n,bn,Nt(Yt),$t(e,2,-2),0)}function jn(e,t,n,r){return Jt(e,t,n,wn,$t(e,0,r),$t(e,r+1,-1),r)}var Pn=function(e,t,n){for(var r=0,a=0;r=a,a=nn(),38===r&&12===a&&(t[n]=1),!on(a);)tn();return an(e,Gt)},Rn=new WeakMap,Dn=function(e){if("rule"===e.type&&e.parent&&!(e.length<1)){for(var t=e.value,n=e.parent,r=e.column===n.column&&e.line===n.line;"rule"!==n.type;)if(!(n=n.parent))return;if((1!==e.props.length||58===t.charCodeAt(0)||Rn.get(n))&&!r){Rn.set(e,!0);for(var a=[],o=function(e,t){return cn(function(e,t){var n=-1,r=44;do{switch(on(r)){case 0:38===r&&12===nn()&&(t[n]=1),e[n]+=Pn(Gt-1,t,n);break;case 2:e[n]+=sn(r);break;case 4:if(44===r){e[++n]=58===nn()?"&\f":"",t[n]=e[n].length;break}default:e[n]+=Nt(r)}}while(r=tn());return e}(ln(e),t))}(t,a),i=n.props,l=0,c=0;l6)switch(qt(e,t+1)){case 109:if(45!==qt(e,t+4))break;case 102:return Lt(e,/(.+:)(.+)-([^]+)/,"$1"+vn+"$2-$3$1"+gn+(108==qt(e,t+3)?"$3":"$2-$3"))+e;case 115:return~zt(e,"stretch")?Fn(Lt(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(115!==qt(e,t+1))break;case 6444:switch(qt(e,Ht(e)-3-(~zt(e,"!important")&&10))){case 107:return Lt(e,":",":"+vn)+e;case 101:return Lt(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+vn+(45===qt(e,14)?"inline-":"")+"box$3$1"+vn+"$2$3$1"+hn+"$2box$3")+e}break;case 5936:switch(qt(e,t+11)){case 114:return vn+e+hn+Lt(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return vn+e+hn+Lt(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return vn+e+hn+Lt(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return vn+e+hn+e+e}return e}var Tn=[function(e,t,n,r){if(e.length>-1&&!e.return)switch(e.type){case wn:e.return=Fn(e.value,e.length);break;case En:return _n([Zt(e,{value:Lt(e.value,"@","@"+vn)})],r);case yn:if(e.length)return function(e,t){return e.map(t).join("")}(e.props,(function(t){switch(function(e,t){return(e=/(::plac\w+|:read-\w+)/.exec(e))?e[0]:e}(t)){case":read-only":case":read-write":return _n([Zt(e,{props:[Lt(t,/:(read-\w+)/,":-moz-$1")]})],r);case"::placeholder":return _n([Zt(e,{props:[Lt(t,/:(plac\w+)/,":"+vn+"input-$1")]}),Zt(e,{props:[Lt(t,/:(plac\w+)/,":-moz-$1")]}),Zt(e,{props:[Lt(t,/:(plac\w+)/,hn+"input-$1")]})],r)}return""}))}}],In=function(e){var t=e.key;if("css"===t){var n=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(n,(function(e){-1!==e.getAttribute("data-emotion").indexOf(" ")&&(document.head.appendChild(e),e.setAttribute("data-s",""))}))}var r,a,o=e.stylisPlugins||Tn,i={},l=[];r=e.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+t+' "]'),(function(e){for(var t=e.getAttribute("data-emotion").split(" "),n=1;n=4;++r,a-=4)t=1540483477*(65535&(t=255&e.charCodeAt(r)|(255&e.charCodeAt(++r))<<8|(255&e.charCodeAt(++r))<<16|(255&e.charCodeAt(++r))<<24))+(59797*(t>>>16)<<16),n=1540483477*(65535&(t^=t>>>24))+(59797*(t>>>16)<<16)^1540483477*(65535&n)+(59797*(n>>>16)<<16);switch(a){case 3:n^=(255&e.charCodeAt(r+2))<<16;case 2:n^=(255&e.charCodeAt(r+1))<<8;case 1:n=1540483477*(65535&(n^=255&e.charCodeAt(r)))+(59797*(n>>>16)<<16)}return(((n=1540483477*(65535&(n^=n>>>13))+(59797*(n>>>16)<<16))^n>>>15)>>>0).toString(36)}(a)+c;return{name:s,styles:a,next:Un}},Qn=!!c.useInsertionEffect&&c.useInsertionEffect,Kn=Qn||function(e){return e()},Gn=(Qn||c.useLayoutEffect,c.createContext("undefined"!=typeof HTMLElement?In({key:"css"}):null));Gn.Provider;var Yn=c.createContext({}),Xn=function(e,t,n){var r=e.key+"-"+t.name;!1===n&&void 0===e.registered[r]&&(e.registered[r]=t.styles)},Jn=Ft,Zn=function(e){return"theme"!==e},er=function(e){return"string"==typeof e&&e.charCodeAt(0)>96?Jn:Zn},tr=function(e,t,n){var r;if(t){var a=t.shouldForwardProp;r=e.__emotion_forwardProp&&a?function(t){return e.__emotion_forwardProp(t)&&a(t)}:a}return"function"!=typeof r&&n&&(r=e.__emotion_forwardProp),r},nr=function(e){var t=e.cache,n=e.serialized,r=e.isStringTag;return Xn(t,n,r),Kn((function(){return function(e,t,n){Xn(e,t,n);var r=e.key+"-"+t.name;if(void 0===e.inserted[t.name]){var a=t;do{e.insert(t===a?"."+r:"",a,e.sheet,!0),a=a.next}while(void 0!==a)}}(t,n,r)})),null},rr=function e(t,n){var r,a,o=t.__emotion_real===t,i=o&&t.__emotion_base||t;void 0!==n&&(r=n.label,a=n.target);var l=tr(t,n,o),s=l||er(i),u=!s("as");return function(){var p=arguments,d=o&&void 0!==t.__emotion_styles?t.__emotion_styles.slice(0):[];if(void 0!==r&&d.push("label:"+r+";"),null==p[0]||void 0===p[0].raw)d.push.apply(d,p);else{d.push(p[0][0]);for(var f=p.length,m=1;mtable{width:100%;border-collapse:collapse;}"}),xr=rr("tr",{target:"er8lhlf5"})({name:"o3suck",styles:"background-color:transparent;&:hover,&:focus-within,&:hover td,&:hover th{background-color:#f8f9fa;}&:last-child td,&:last-child th:not(.noptin-table__header){border-bottom:0;}"}),Or=function(e){var t=e.align,n=void 0===t?"left":t,r=e.minWidth,a=void 0===r?"160px":r;a=a||"auto";var o="center"===(n=n||"left")?"center":"space-between",i="";return e.isSorted&&(i="\n\t\t\tbackground-color: #f8f9fa;\n\t\t\t&:not(:first-child) {\n\t\t\t\tborder-left: 1px solid ".concat(or,";\n\t\t\t}\n\t\t\t&:not(:last-child) {\n\t\t\t\tborder-right: 1px solid ").concat(or,";\n\t\t\t}\n\t\t\t& > .components-button svg,\n\t\t\t& > .components-button .dashicon {\n\t\t\t\tvisibility: visible !important;\n\t\t\t}\n\t\t")),ar("text-align:",n,";min-width:",a,";",i," &>.components-button{justify-content:",o,";}&>a:only-child{display:block;}","")},kr=rr("th",{target:"er8lhlf4"})("padding:16px;background-color:#f8f9fa;font-weight:bold;white-space:nowrap;",Or,";border-bottom:1px solid ",or,";&>.components-button{height:auto;width:100%;text-align:left;vertical-align:middle;line-height:1;font-weight:bold;background:transparent!important;box-shadow:none!important;padding:0;}&>.components-button svg,&>.components-button .dashicon{visibility:hidden;margin-left:4px;}&>.components-button:hover svg,&>.components-button:hover .dashicon{visibility:visible;}"),Sr=rr("td",{target:"er8lhlf3"})("padding:16px;border-bottom:1px solid ",or,";font-weight:normal;",Or,";"),Cr=rr("td",{target:"er8lhlf2"})({name:"17w81qe",styles:"text-align:left;color:#757575;font-weight:bold;padding:16px 24px;@media (min-width: 782px){padding:2rem;font-size:1.125rem;}"}),jr=rr("ul",{target:"er8lhlf1"})({name:"t5eiud",styles:"text-align:center;margin:0;&>li{display:inline-block;margin-bottom:0;margin-left:8px;margin-right:8px;}&>li>strong{margin-right:4px;display:inline-block;}"}),Pr=function(e){var t=e.color,n=e.backgroundColor;return ar("background-color:",n=n||"#efeeea",";color:",t=t||"#241c15",";","")},Rr=rr("span",{shouldForwardProp:function(e){return!["color","backgroundColor"].includes(e)},target:"er8lhlf0"})(Pr," white-space:nowrap;border-radius:200px;height:24px;line-height:24px;padding:3px 9px;display:inline-block;");const Dr=window.wp.date;function Ar(e){return function(e){if(Array.isArray(e))return fe(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||me(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 Fr=[0,100],Tr=[0,100],Ir=function(e){return"".concat(1===e.length?"0":"").concat(e)},Nr=function(e,t,n){return Math.max(Math.min(e,n),t)},Mr=function(e,t){return Math.floor(Math.random()*(t-e+1))+e},Br=function e(t,n,r){for(var a=Mr(t,n),o=0;o<(null==r?void 0:r.length);o++){var i=r[o];if(2===(null==i?void 0:i.length)&&a>=i[0]&&a<=i[1])return e(t,n,r)}return a},Lr=function(e,t){return"number"==typeof t?t:e%Math.abs(t[1]-t[0])+t[0]},zr=function(e,t){return"number"==typeof e?Nr.apply(void 0,[Math.abs(e)].concat(Ar(t))):1===e.length||e[0]===e[1]?Nr.apply(void 0,[Math.abs(e[0])].concat(Ar(t))):[Math.abs(Nr.apply(void 0,[e[0]].concat(Ar(t)))),Nr.apply(void 0,[Math.abs(e[1])].concat(Ar(t)))]},qr=function(e,t,n){return n<0?n+=1:n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e},$r=function(e,t,n){var r,a,o;if(e/=360,n/=100,0==(t/=100))r=a=o=n;else{var i=n<.5?n*(1+t):n+t-n*t,l=2*n-i;r=qr(l,i,e+1/3),a=qr(l,i,e),o=qr(l,i,e-1/3)}return[Math.round(255*r),Math.round(255*a),Math.round(255*o)]},Hr=function(e,t,n,r){return(299*e+587*t+114*n)/1e3>=r},Ur=function(e,t,n){return"hsl(".concat(e,", ").concat(t,"%, ").concat(n,"%)")},Wr=function(e,t,n,r){return"rgb"===r?"rgb(".concat(e,", ").concat(t,", ").concat(n,")"):"#".concat(Ir(e.toString(16))).concat(Ir(t.toString(16))).concat(Ir(n.toString(16)))},Vr=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.format,r=void 0===n?"hex":n,a=t.saturation,o=void 0===a?[50,55]:a,i=t.lightness,l=void 0===i?[50,60]:i,c=t.differencePoint,s=void 0===c?130:c,u=Math.abs(function(e){for(var t=e.length,n=0,r=0;r0&&void 0!==arguments[0]?arguments[0]:{},t=e.format,n=void 0===t?"hex":t,r=e.saturation,a=void 0===r?[50,55]:r,o=e.lightness,i=void 0===o?[50,60]:o,l=e.differencePoint,c=void 0===l?130:l,s=e.excludeHue;a=zr(a,Fr),i=zr(i,Tr);var u=s?Br(0,359,s):Mr(0,359),p="number"==typeof a?a:Mr.apply(void 0,Ar(a)),d="number"==typeof i?i:Mr.apply(void 0,Ar(i)),f=he($r(u,p,d),3),m=f[0],h=f[1],g=f[2];return{color:"hsl"===n?Ur(u,p,d):Wr(m,h,g,n),isLight:Hr(m,h,g,c)}};const Qr=Vr;function Kr(e){if(["subscribed","active","yes","true","1"].includes(e))return{backgroundColor:"#78c67a",color:"#111111"};if(["unsubscribed","inactive","no","false","0"].includes(e))return{backgroundColor:"#fbcfbd",color:"#241c15"};if(["pending","waiting","maybe","2"].includes(e))return{backgroundColor:"#fbeeca",color:"#241c15"};var t=Qr(e,{saturation:[60,100],lightness:[30,45]});return{backgroundColor:t.color,color:t.isLight?"#111111":"#ffffff"}}function Gr(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 Yr(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:"";return Ie(Fe({},"/".concat(t,"/").concat(n,"/").concat(e)))}}function Jr(){return function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=De();t.endsWith("/")&&(t.substring(0,t.length-1),function(e){throw new TypeError('"path" is read-only')}()),e.startsWith("/")||(e="/".concat(e)),Ie(Fe({},"".concat(t).concat(e)))}}function Zr(e,t){if(e.length>0)return{include:e.join(","),number:-1};var n=Yr(Yr({},t),{},{number:-1});return["order","hizzle_path","orderby","paged","page"].forEach((function(e){delete n[e]})),n}function ea(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 ta(e){for(var t=1;t1?r[1]:n,o=Kr(t||a),l=n.indexOf("/64/");return-1!==l?(0,i.addQueryArgs)(e,{d:"".concat(n.substring(0,l+4),"/").concat(o.backgroundColor.replace("#",""),"/").concat(o.color.replace("#",""))}):e},ra=function(e){var t=e.record,n=e.name,a=e.basePath,o=void 0===a?"":a,i=Xr(),c=t[n],s=na(t.avatar_url,c),u=s?(0,r.createElement)(br,{src:s,alt:c}):null,p=(0,r.useCallback)((function(){return i("".concat(o).concat(t.id))}),[o,t.id]),d=u?(0,r.createElement)(l.Flex,null,(0,r.createElement)(l.FlexItem,null,u),(0,r.createElement)(l.FlexBlock,null,c)):c;return(0,r.createElement)(l.Button,{variant:"link",style:{width:"100%",alignItems:"start",textDecoration:"none"},onClick:p},d)},aa=function(e){var t=e.value,n=e.enums,a=void 0===n?{}:n,o=he((0,r.useState)(!1),2),i=o[0],c=o[1],s=i?t:t.slice(0,2),u=t.length>2;return(0,r.createElement)(l.Flex,{gap:2,justify:"flex-start",wrap:!0},s.map((function(e){return(0,r.createElement)(l.FlexItem,{key:e},(0,r.createElement)(Rr,ta({},Kr(e)),a[e]||e))})),u&&(0,r.createElement)(l.FlexItem,null,(0,r.createElement)(l.Button,{variant:"link",onClick:function(){return c(!i)}},i?(0,se.__)("Hide","newsletter-optin-box"):(0,se.__)("Show all","newsletter-optin-box"))))};function oa(e){var t,n=e.row,a=e.header,o=e.headerKey,i=n[o];if(null==i||""===i)return(0,r.createElement)("span",{className:"noptin-table__cell--null"},"–");if(Array.isArray(i)&&0===i.length)return(0,r.createElement)("span",{className:"noptin-table__cell--null"},"–");if(a.is_primary&&"string"==typeof i)return(0,r.createElement)(ra,{record:n,name:o,basePath:a.basePath||""});if(a.is_boolean){var c=i?"yes":"no",s=i?"#3a9001":"#880000";return(0,r.createElement)(l.Icon,{size:24,style:{color:s},icon:c})}if(a.is_date&&i){var u=Dr.getSettings?(0,Dr.getSettings)():(0,Dr.__experimentalGetSettings)();return 10===i.length?(0,Dr.dateI18n)(u.formats.date,i):(0,Dr.dateI18n)(u.formats.datetime,i)}return a.is_tokens&&Array.isArray(i)?(0,r.createElement)(aa,{value:i}):a.enum&&Array.isArray(i)?(0,r.createElement)(aa,{value:i,enums:a.enum}):a.is_numeric||a.is_float||"string"==typeof i?(t=a.enum)&&"object"===ge(t)&&t.constructor===Object?(0,r.createElement)(Rr,ta({},Kr(i)),a.enum[i]||i):i:JSON.stringify(i)}var ia=function(e){var t,n,a=e.namespace,o=e.collection,i=e.append,c=e.avatarURL,s=e.isSingle,u=e.schema;c=na(c||(null==u?void 0:u.avatar_url),i),i=i?" - ".concat(i):"";var p=(0,r.useMemo)((function(){var e,t;return s&&null!=u&&null!==(e=u.labels)&&void 0!==e&&e.singular_name?"".concat(u.labels.singular_name).concat(i):null!=u&&null!==(t=u.labels)&&void 0!==t&&t.name?"".concat(u.labels.name).concat(i):"Noptin".concat(i)}),[u,i]);return(0,r.createElement)(l.Flex,{justify:"start",wrap:!0},(0,r.createElement)(l.FlexItem,null,c&&(0,r.createElement)(br,{src:c,alt:p,width:24,height:24})),(0,r.createElement)(l.FlexItem,null,(0,r.createElement)(l.__experimentalText,{size:16,weight:600,as:"h2",color:"#23282d"},p)),(0,r.createElement)(l.FlexItem,null,"/".concat(a,"/").concat(o)!==De()?(0,r.createElement)(l.Button,{variant:"primary",onClick:function(){return Ie(Fe({},"/".concat(a,"/").concat(o)))},style:{marginLeft:"10px"}},(null==u||null===(t=u.labels)||void 0===t?void 0:t.view_items)||(0,se.__)("View Records","newsletter-optin-box")):(0,r.createElement)(l.Button,{variant:"primary",onClick:function(){return Ie(Fe({},"/".concat(a,"/").concat(o,"/add")))},style:{marginLeft:"10px"}},(null==u||null===(n=u.labels)||void 0===n?void 0:n.add_new)||(0,se.__)("Add New","newsletter-optin-box"))))},la=function(e){var t=e.namespace,n=e.collection,a=e.id,o=e.schema,i=jt(t,n,a);if("SUCCESS"!==i.status)return(0,r.createElement)(ia,{namespace:t,collection:n,schema:o,isSingle:!0});var l=o.id_prop?i.data[o.id_prop]:"",c=i.data.avatar_url;return(0,r.createElement)(ia,{namespace:t,collection:n,append:l,avatarURL:c,schema:o,isSingle:!0})},ca=function(e){var t=e.schema,n=e.namespace,a=e.collection,o=e.id;return(0,r.createElement)(l.Card,null,(0,r.createElement)(l.CardHeader,null,(0,r.createElement)(l.Flex,{wrap:!0},(0,r.createElement)(l.FlexBlock,null,o?(0,r.createElement)(la,{namespace:n,collection:a,id:o,schema:t}):(0,r.createElement)(ia,{namespace:n,collection:a,schema:t})),t.routes&&Object.keys(t.routes).map((function(e){return(0,r.createElement)(l.FlexItem,{key:e},t.routes[e].href?(0,r.createElement)(l.Button,{href:t.routes[e].href,variant:"secondary"},t.routes[e].title):(0,r.createElement)(l.Button,{onClick:function(){return Ie(Fe({},e))},variant:"secondary"},t.routes[e].title))})))))};const sa=function(e){var t=e.upsell;if(!t)return null;var n=t.content,a=t.buttonURL,o=t.buttonText;return(0,r.createElement)(ur,null,(0,r.createElement)(l.Tip,null,n,(0,r.createElement)(l.Button,{href:a,target:"_blank",variant:"link"},o)))};function ua(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 pa(e){for(var t=1;t(0,c.createElement)(ce,t,(0,c.createElement)(e,{...n,ref:r})))),r=e.displayName||e.name||"Unknown";return n.displayName="withErrorBoundary(".concat(r,")"),n}(e,{FallbackComponent:ue})}((function(t){var n,a=Rt(t.namespace,t.collection);return a.isResolving||!a.hasResolved?(0,r.createElement)(Ne,{title:(0,se.__)("Loading","newsletter-optin-box")},(0,r.createElement)(l.CardBody,null,(0,r.createElement)(l.Spinner,null))):"ERROR"===a.status?(0,r.createElement)(Ne,{title:(0,se.__)("Error","newsletter-optin-box")},(0,r.createElement)(l.CardBody,null,(0,r.createElement)(l.Notice,{status:"error",isDismissible:!1},(null===(n=a.error)||void 0===n?void 0:n.message)||(0,se.__)("An unknown error occurred.","newsletter-optin-box")))):(0,r.createElement)(e,pa(pa({},t),{},{schema:a.data}))}))},fa=da((function(e){var t=e.namespace,n=e.collection,a=e.isParent,o=e.id,i=e.schema;return(0,r.createElement)(l.Flex,{gap:2,direction:"column"},a&&(0,r.createElement)(l.FlexItem,null,(0,r.createElement)(ca,{namespace:t,collection:n,id:o,schema:i})),(0,r.createElement)(l.FlexBlock,null,(0,r.createElement)(pe,null,(0,r.createElement)(X,null))),i.fills&&i.fills.map((function(e){return(0,r.createElement)(l.Fill,{key:e.name,name:"".concat(e.name).concat(a?"":"--inner")},(0,r.createElement)(pe,null,e.content&&(0,r.createElement)("span",{dangerouslySetInnerHTML:{__html:e.content}}),e.upsell&&(0,r.createElement)(sa,{upsell:e.upsell})))})))})),ma=function(){var e=$(),t=e.namespace,n=e.collection,a=e.id;return(0,r.createElement)(fa,{namespace:t,collection:n,id:a,isParent:!0})},ha=function(){var e,t=$(),n=t.id,a=t.tab,o=t.innerTab,i=t.innerNamespace,c=t.innerCollection,s=t.innerId,u=Xr(),p=(0,r.useCallback)((function(){return u("".concat(n,"/").concat(a))}),[u,a,n]),d=(null===(e=Rt(i,c).data)||void 0===e?void 0:e.labels)||{},f={add_new_item:(0,se.__)("Add New Item","newsletter-optin-box"),view_item:(0,se.__)("View Item","newsletter-optin-box")},m={add:"add_new_item",edit:"view_item"},h=m[o]?d[m[o]]||f[m[o]]:d.name||(0,se.__)("Items","newsletter-optin-box");return(0,r.createElement)(l.Modal,{title:h,onRequestClose:p},(0,r.createElement)(fa,{namespace:i,collection:c,id:s,isParent:!1}))};function ga(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var va=n(640),ba=n.n(va);function ya(e){var t=e.label,n=e.value,a=t.toLowerCase().replace(/[^a-z0-9]/g,"-");return(0,r.createElement)("li",{className:"noptin-list-item noptin-list-item__".concat(a)},(0,r.createElement)("div",{className:"noptin-list-item__key"},t),(0,r.createElement)("div",{className:"noptin-list-item__value"},n))}function wa(e){var t=e.items;return(0,r.createElement)("ul",{className:"noptin-component__list"},t.map((function(e){return(0,r.createElement)(ya,{key:e.label,label:e.label,value:e.value})})))}var Ea={name:"173gwd3",styles:"background-color:#f8f9fa;color:#212529;& h2,& h3{color:#212529;}"},_a={name:"p3ituj",styles:"background-color:#212529;color:#f8f9fa;& h2,& h3{color:#f8f9fa;}"},xa={name:"1qvos4g",styles:"background-color:#f8cbcb;color:#cc1818;& h2,& h3{color:#cc1818;}"},Oa={name:"1kbuu37",styles:"background-color:#fff3cd;color:#856404;& h2,& h3{color:#856404;}"},ka={name:"1k1g68i",styles:"background-color:#cbeeff;color:#0c5460;& h2,& h3{color:#0c5460;}"},Sa={name:"1dlti2z",styles:"background-color:#d4edda;color:#155724;& h2,& h3{color:#155724;}"},Ca=function(e){var t=e.status;return"success"===t?Sa:"info"===t?ka:"warning"===t?Oa:"error"===t?xa:"dark"===t?_a:Ea},ja=rr("div",{target:"ec8eek20"})(Ca,";padding:0.25rem;text-align:center;box-shadow:2px 2px 2px rgb(0 0 0 / 5%);min-width:100px;border-radius:4px;");function Pa(e){var t=e.value,n=e.label,a=e.status;return(0,r.createElement)(ja,{status:a},(0,r.createElement)(l.Flex,{direction:"column",justify:"center",style:{minHeight:"100px"}},(0,r.createElement)(l.FlexItem,null,(0,r.createElement)(l.__experimentalText,{size:48,weight:600,as:"h2"},t)),(0,r.createElement)(l.FlexItem,null,(0,r.createElement)(l.__experimentalText,{size:13,weight:400,as:"h3"},n))))}var Ra=["links"];function Da(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 Aa(e){for(var t=1;t1;return(0,r.createElement)(l.Flex,{className:"noptin-component__field-lg",wrap:!0},(0,r.createElement)(l.FlexItem,null,(0,r.createElement)(l.SelectControl,{label:(0,se.__)("If","newsletter-optin-box"),hideLabelFromVision:!0,value:n||"allow",options:Ua,onChange:function(e){return o("action",e)},size:"default",__nextHasNoMarginBottom:!0})),i&&(0,r.createElement)(r.Fragment,null,(0,r.createElement)(l.FlexItem,null,(0,r.createElement)(l.SelectControl,{label:(0,se.__)("all","newsletter-optin-box"),hideLabelFromVision:!0,value:t||"all",options:Wa,onChange:function(e){return o("type",e)},size:"default",__nextHasNoMarginBottom:!0})),(0,r.createElement)(l.FlexBlock,null,(0,se.__)("of the following rules are true:","newsletter-optin-box"))))}function Ka(e){var t,n=e.rule,a=e.comparisons,o=e.availableSmartTags,i=e.index,c=e.updateRule,s=e.removeRule,u=(0,r.useCallback)((function(e){return c(i,"value",e)}),[i,c]),p=(0,r.useCallback)((function(e){return c(i,"condition",e)}),[i,c]),d=(0,r.useCallback)((function(){return s(i)}),[i,s]),f=(0,r.useMemo)((function(){var e=n.type;if(void 0!==o[e])return o[e];var t,r=e.replace("_",".",1);if(void 0!==o[r])return o[r];for(var a=0,i=Object.entries(o);a> ").concat(t)}),[n.type,o]),h=Va((t=null==f?void 0:f.options,(0,r.useMemo)((function(){return t?Array.isArray(t)?t.map((function(e,t){return{label:e,value:t}})):Object.keys(t).map((function(e){return{label:t[e],value:e}})):[]}),[t])),(0,se.__)("Select a value","newsletter-optin-box")),g=h.length>1,v=(null==f?void 0:f.conditional_logic)||"string",b=Va((0,r.useMemo)((function(){var e=[];return Object.keys(a).forEach((function(t){var n=a[t].type;if(g){if("string"===v&&"is"!=t&&"is_not"!=t)return;if("is_empty"===t||"is_not_empty"===t||"is_between"===t)return}"any"!==n&&n!=v||e.push({label:a[t].name,value:t})})),e}),[v,a]),(0,se.__)("Select a comparison","newsletter-optin-box")),y="is_empty"===n.condition||"is_not_empty"===n.condition;return(0,r.createElement)(l.Flex,{className:"noptin-component__field-lg",wrap:!0,expanded:!0},(0,r.createElement)(l.FlexBlock,null,(0,r.createElement)(Rr,Ha({},Kr(m)),m)),(0,r.createElement)(l.FlexBlock,null,(0,r.createElement)(l.Flex,{justify:"flex-end",wrap:!0},(0,r.createElement)(l.FlexItem,null,(0,r.createElement)(l.SelectControl,{label:(0,se.__)("Comparison","newsletter-optin-box"),hideLabelFromVision:!0,value:n.condition?n.condition:"is",options:b,onChange:p,size:"default",__nextHasNoMarginBottom:!0})),!y&&(0,r.createElement)(l.FlexBlock,null,g&&(0,r.createElement)(l.SelectControl,{label:(0,se.__)("Value","newsletter-optin-box"),hideLabelFromVision:!0,value:n.value?n.value:"",options:h,onChange:u,size:"default",__nextHasNoMarginBottom:!0}),!g&&(0,r.createElement)(l.TextControl,{type:"number"===v?"number":"text",label:(0,se.__)("Value","newsletter-optin-box"),hideLabelFromVision:!0,value:n.value?n.value:"",onChange:u,__nextHasNoMarginBottom:!0})),(0,r.createElement)(l.FlexItem,null,(0,r.createElement)(l.Button,{onClick:d,icon:"trash",variant:"tertiary",isDestructive:!0})))))}function Ga(e){var t=e.rules,n=e.comparisons,a=e.availableSmartTags,o=e.setConditionalLogicAttribute,i=(0,r.useMemo)((function(){return Array.isArray(t)?t.filter((function(e){return e.type&&""!==e.type})):[]}),[a]),l=(0,r.useMemo)((function(){var e={};return a.forEach((function(t){t.conditional_logic&&(e[t.smart_tag]=Ha(Ha({},t),{},{key:t.smart_tag,type:t.conditional_logic}))})),e}),[a]),c=(0,r.useCallback)((function(e){var t=Ar(i);t.splice(e,1),o("rules",t)}),[i,o]),s=(0,r.useCallback)((function(e,t,n){var r=Ar(i);r[e][t]=n,o("rules",r)}),[i,o]),u=(0,r.useMemo)((function(){return Object.values(l)}),[l]),p=(0,r.useCallback)((function(e){var t=l[e],n=(null==t?void 0:t.options)||[],r=(null==t?void 0:t.placeholder)||"",a=Array.isArray(n)&&n.length?Object.keys(n)[0]:r;null!=t&&t.default&&(a=t.default);var c=Ar(i);c.push({type:e,condition:"is",value:a}),o("rules",c)}),[i]),d=i.length?(0,se.__)("Add a rule","newsletter-optin-box"):(0,se.__)("Add another rule","newsletter-optin-box"),f=co({availableSmartTags:u,onMergeTagClick:p,raw:!0,icon:"plus",label:d,text:d,toggleProps:{variant:"secondary"}});return(0,r.createElement)("div",{className:"noptin-conditional-logic-rules"},i.map((function(e,t){return(0,r.createElement)(Ka,{key:t,rule:e,index:t,updateRule:s,removeRule:c,comparisons:n,availableSmartTags:l})})),f)}function Ya(e){var t=e.onChange,n=e.value,a=e.comparisons,o=e.toggleText,i=e.availableSmartTags,c=e.className;"object"!==ge(n)&&(n={enabled:!1,action:"allow",rules:[{condition:"is",type:"date",value:""}],type:"all"});var s=function(e,r){t(Ha(Ha({},n),{},ve({},e,r)))};return(0,r.createElement)("div",{className:c},(0,r.createElement)(l.ToggleControl,{checked:!!n.enabled,onChange:function(e){return s("enabled",e)},className:"noptin-component__field",label:o||(0,se.__)("Optionally enable/disable this trigger depending on specific conditions.","newsletter-optin-box"),__nextHasNoMarginBottom:!0}),n.enabled&&(0,r.createElement)(r.Fragment,null,(0,r.createElement)(Qa,{ruleCount:Array.isArray(n.rules)?n.rules.length:0,type:n.type,action:n.action,setConditionalLogicAttribute:s}),(0,r.createElement)(Ga,{rules:n.rules,comparisons:a,availableSmartTags:i,setConditionalLogicAttribute:s})))}var Xa={"==":function(e,t){return e==t},"===":function(e,t){return e===t},"!=":function(e,t){return e!=t},"!==":function(e,t){return e!==t},">":function(e,t){return e>t},">=":function(e,t){return e>=t},"<":function(e,t){return e0&&(g=(0,r.createElement)(l.DropdownMenu,ao({icon:u,label:d},f),(function(e){var t=e.onClose;return(0,r.createElement)(r.Fragment,null,Object.keys(m).map((function(e,n){return(0,r.createElement)(l.MenuGroup,{label:h>1?e:void 0,key:n},m[e].map((function(e){return(0,r.createElement)(l.MenuItem,{icon:e.icon||qa,iconPosition:"left",onClick:function(){if(o){var n=c?e.smart_tag:"[[".concat((r=e).example?r.example:r.default?"".concat(r.smart_tag,' default="').concat(r.default,'"'):"".concat(r.smart_tag),"]]");o(n)}var r;t()},key:e.smart_tag},e.label)})))})))}))),g}function so(e){var t=e.setting,n=e.availableSmartTags,a=e.value,o=e.onChange,i=ga(e,to),c=(0,l.useBaseControlProps)(i),s=c.baseControlProps,u=c.controlProps;Array.isArray(a)||(a=[]);var p=(0,r.useCallback)((function(e){var t=e.item,i=e.index;return(0,r.createElement)(l.Flex,{className:"noptin-repeater-item",wrap:!0},lo.map((function(e,l){return(0,r.createElement)(uo,{key:l,availableSmartTags:n,field:e,value:void 0===t[e.id]?"":t[e.id],onChange:function(t){var n=Ar(a);n[i][e.id]=t,o(n)}})})),(0,r.createElement)(l.FlexItem,null,(0,r.createElement)(l.Button,{icon:"trash",variant:"tertiary",className:"noptin-component__field",label:(0,se.__)("Delete","noptin-addons-pack"),showTooltip:!0,onClick:function(){var e=Ar(a);e.splice(i,1),o(e)},isDestructive:!0})))}),[a,o]);return(0,r.createElement)(l.BaseControl,ao({},s),(0,r.createElement)("div",ao({},u),a.map((function(e,t){return(0,r.createElement)(p,{key:t,item:e,index:t})})),(0,r.createElement)(l.Button,{onClick:function(){var e=Ar(a);e.push({}),o(e)},variant:"secondary"},t.add_field?t.add_field:(0,se.__)("Add","newsletter-optin-box"))))}function uo(e){var t=e.field,n=e.availableSmartTags,a=e.value,o=e.onChange,i=co({availableSmartTags:n,onMergeTagClick:(0,r.useCallback)((function(e){o&&o(a?"".concat(a," ").concat(e).trim():e)}),[a,o])});return(0,r.createElement)(l.FlexBlock,null,(0,r.createElement)(l.__experimentalInputControl,{label:t.label,type:t.type,value:a,placeholder:(0,se.sprintf)((0,se.__)("Enter %s","noptin-addons-pack"),t.label),className:"noptin-component__field noptin-condition-field",suffix:i,onChange:o,isPressEnterToChange:!0,__nextHasNoMarginBottom:!0,__next36pxDefaultSize:!0}))}function po(e){e.setting;var t=e.value,n=e.options,a=e.onChange,o=ga(e,no),i=(0,l.useBaseControlProps)(o),c=i.baseControlProps,s=i.controlProps;return Array.isArray(t)||(t=[]),(0,r.createElement)(l.BaseControl,ao({},c),(0,r.createElement)("div",ao({},s),n.map((function(e,n){return(0,r.createElement)(l.CheckboxControl,{key:n,label:e.label,checked:t.includes(e.value),onChange:function(n){a(n?[].concat(Ar(t),[e.value]):t.filter((function(t){return t!==e.value})))}})}))))}function fo(e){var t=e.settingKey,n=e.setting,a=e.availableSmartTags,o=e.prop,i=e.saved,c=e.setAttributes,s=(0,r.useCallback)((function(e){if(!o)return c(ve({},t,e));var n=i[o]?i[o]:{},r=ve({},o,ao(ao({},n),{},ve({},t,e)));c(r)}),[t,o,i,c]);if(n.if||n.restrict){var u=n.restrict?n.restrict.split("."):n.if.split(".");if(!(2!==u.length||i[u[0]]&&i[u[0]][u[1]]))return null;if(1===u.length&&!i[u[0]])return null}if(Array.isArray(n.conditions)){var p=n.conditions.every((function(e){var t=e.key.split("."),n=e.operator?e.operator:"==",r=i[t[0]];return 2===t.length?r&&r[t[1]]&&Ja(e.value,n,r[t[1]]):Ja(e.value,n,r)}));if(!p)return null}if(n.condition&&!n.condition(i))return null;var d=i[t];o&&(d=i[o]?i[o][t]:void 0),(void 0===d||n.disabled)&&(d=n.default);var f=void 0!==d&&""!==d&&null!==d,m=[];n.options&&(m=Object.keys(n.options).map((function(e){return{label:n.options[e],value:e}})));var h=n.fullWidth?"noptin-component__field noptin-component__field-".concat(t):"noptin-component__field-lg noptin-component__field-".concat(t),g=n.description?(0,r.createElement)("span",{dangerouslySetInnerHTML:{__html:n.description}}):"",v=n.customAttributes?n.customAttributes:{},b=ao({label:n.label,value:f?d:"",onChange:s,className:"".concat(h),help:g},v);return"select"===n.el?(m.unshift({label:n.placeholder?n.placeholder:(0,se.__)("Select an option","newsletter-optin-box"),value:"",disabled:!n.canSelectPlaceholder}),(0,r.createElement)(l.SelectControl,ao(ao({},b),{},{options:m,__nextHasNoMarginBottom:!0,__next36pxDefaultSize:!0}))):"form_token"===n.el?(0,r.createElement)(l.FormTokenField,ao(ao({},b),{},{value:Array.isArray(b.value)?b.value:[],suggestions:Array.isArray(n.suggestions)?n.suggestions:[],__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0})):"multi_checkbox"===n.el||"multi_checkbox_alt"===n.el?(0,r.createElement)(po,ao(ao({},b),{},{options:m})):"conditional_logic"===n.el?(0,r.createElement)(Ya,ao(ao({},b),{},{availableSmartTags:a,comparisons:n.comparisons,toggleText:n.toggle_text})):"input"===n.el?n.type&&["toggle","switch","checkbox","checkbox_alt"].includes(n.type)?(0,r.createElement)(l.ToggleControl,ao(ao({},b),{},{checked:!!f&&d,onChange:function(e){s(e)}})):(0,r.createElement)(io,ao(ao({},b),{},{setting:n,availableSmartTags:"trigger_settings"===o?[]:a,isPressEnterToChange:!n.isInputToChange})):"textarea"===n.el?(0,r.createElement)(l.TextareaControl,ao(ao({},b),{},{setting:n,placeholder:n.placeholder?n.placeholder:"",__nextHasNoMarginBottom:!0})):"paragraph"===n.el?(0,r.createElement)("div",{className:h},(0,r.createElement)(l.Tip,null,n.content)):"hero"===n.el?(0,r.createElement)("div",{className:h},(0,r.createElement)("h3",null,n.content)):"key_value_repeater"===n.el||"webhook_key_value_repeater"===n.el?(0,r.createElement)(so,ao(ao({},b),{},{setting:n,availableSmartTags:"trigger_settings"===o?[]:a})):t}var mo=["query","setQuery"];function ho(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 go(e){for(var t=1;t0?(0,se.sprintf)((0,se.__)("Filters (%d)","newsletter-optin-box"),p):(0,se.__)("Filter Records","newsletter-optin-box");return(0,r.createElement)(r.Fragment,null,s.length>0&&(0,r.createElement)(r.Fragment,null,(0,r.createElement)(l.Button,{onClick:function(){return c(!0)},variant:"tertiary",icon:"filter",text:d}),i&&(0,r.createElement)(l.Modal,{title:(0,se.__)("Filter records","newsletter-optin-box"),onRequestClose:function(){return c(!1)}},(0,r.createElement)(bo,{fields:s,currentFilters:u,setOpen:c,setQuery:n}))))}function _o(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 xo(e){for(var t=1;t0&&(0,r.createElement)(Ro,null,e)})))))}function Co(){var e=$(),t=e.namespace,n=e.collection,a=e.innerNamespace,o=e.innerCollection,i=e.id,c=e.tab,s=Rt(t,n).data;if(!c||!s)return!1;var u=s.tabs[c];return(0,r.createElement)(ko,{namespace:a,collection:o,basePath:"".concat(i,"/").concat(c,"/").concat(a,"/").concat(o),defaultProps:ve({},u.filter_by,i),isInner:!0},(0,r.createElement)(l.Slot,{name:"".concat(a,"_").concat(o,"_record_create_upsell--inner")}))}function jo(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 Po(e){for(var t=1;t1,i=t-1,c=tr&&n({paged:r})}return p<=1?a>$o[0]&&(0,r.createElement)(l.Flex,{className:d,wrap:!0,gap:4,align:"center",justify:"center"},(0,r.createElement)(Uo,{perPage:u,onChange:f}))||null:(0,r.createElement)(l.Flex,{className:d,wrap:!0,gap:2,align:"center",justify:"center"},(0,r.createElement)(Ho,{page:s,pageCount:p,onPageChange:function(e){var t=parseInt(e,10);!t||t<1?t=1:t>p&&(t=p),n({paged:t})}}),c&&(0,r.createElement)(Uo,{perPage:u,onChange:f}))}function Vo(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 Qo(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:"default",t=(0,r.useContext)(ti);return[t.selected[e]||[],(0,r.useCallback)((function(n){t.setSelected(ei(ei({},t.selected),{},ve({},e,n)))}),[e,t.setSelected])]},ai=["key","label","isSortable"],oi=["key"],ii=["query","headers","rows","caption","emptyMessage","emptyAction","onQueryChange","DisplayCell","canSelectRows","idProp","storeName"];function li(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 ci(e){for(var t=1;t0&&i.length===s.length,p=(0,r.useCallback)((function(){c(u?[]:s)}),[u,s,c]);return(0,r.createElement)(Go,{columnLabel:(0,se.__)("Toggle selection","newsletter-optin-box"),columnKey:"cb",align:"center",minWidth:"20px",display:(0,r.createElement)(l.CheckboxControl,{checked:u,onChange:p,__nextHasNoMarginBottom:!0}),cellClassName:"noptin-table-column__cb"})},di=function(e){var t=e.row,n=e.id,a=e.storeName,o=he(ri(a),2),i=o[0],c=o[1],s=(0,r.useCallback)((function(e){c(e?[].concat(Ar(i),[n]):i.filter((function(e){return e!==n})))}),[i,c,n]);return(0,r.createElement)(Jo,{headerKey:"cb",row:t,header:{key:"cb",align:"center",minWidth:"20px"},cellClassName:"noptin-table-column__cb",DisplayCell:(0,r.createElement)(l.CheckboxControl,{checked:i.includes(n),onChange:s,__nextHasNoMarginBottom:!0})})},fi=function(e){var t=e.headers,n=e.hasData,a=e.sortBy,o=e.sortDir,i=e.onQueryChange,l=e.rows,c=e.idProp,s=e.canSelectRows,u=e.storeName,p=(0,r.useCallback)((function(e){i(e===a?{order:"asc"===o?si:"asc"}:{orderby:e})}),[a,o,i]),d=(0,r.useMemo)((function(){return t.map((function(e){var t=e.key,i=e.label,l=e.isSortable,c=ga(e,ai);return(0,r.createElement)(Go,ci({key:t,columnLabel:i,columnKey:t,isSortable:l&&n,isSorted:a===t,sortDir:o,setSortBy:p,cellClassName:"noptin-table-column__"+t.replace(/_/g,"-")},c))}))}),[t,n,a,o,p]);return(0,r.createElement)("thead",null,(0,r.createElement)(xr,{className:"noptin-table__row"},s&&n&&(0,r.createElement)(pi,{rows:l,idProp:c,storeName:u}),d))},mi=function(e){var t=e.sortBy,n=e.headers,a=e.DisplayCell,o=e.canSelectRows,i=e.hasData,l=e.row,c=e.id,s=e.storeName,u=(0,r.useMemo)((function(){return n.map((function(e){var n=e.key,o=ga(e,oi);return(0,r.createElement)(Jo,{key:"".concat(c,"__").concat(n),headerKey:n,row:l,header:o,isSorted:t===n,cellClassName:"noptin-table__col-"+(null==n?void 0:n.replace(/_/g,"-")),DisplayCell:a})}))}),[n,l,t,a,c]);return(0,r.createElement)(xr,{className:"noptin-table__row"},o&&i&&(0,r.createElement)(di,{row:l,id:c,storeName:s}),u)};const hi=function(e){var t=e.query,n=e.headers,a=void 0===n?[]:n,o=e.rows,i=void 0===o?[]:o,l=e.caption,c=e.emptyMessage,s=e.emptyAction,u=e.onQueryChange,p=e.DisplayCell,d=e.canSelectRows,f=e.idProp,m=void 0===f?"id":f,h=e.storeName,g=ga(e,ii),v=t.orderby||"id",b=t.order||si,y=!!i.length;return(0,r.createElement)(_r,ci({tabIndex:"0","aria-label":"".concat(l," - ").concat((0,se.__)("(scroll to see more)","newsletter-optin-box")),role:"group"},g),(0,r.createElement)("table",null,(0,r.createElement)(fi,{headers:a,hasData:y,sortBy:v,sortDir:b,onQueryChange:u,canSelectRows:d,rows:i,idProp:m,storeName:h}),(0,r.createElement)("tbody",null,y?i.map((function(e,t){var n=ui(e,t,m);return(0,r.createElement)(mi,{key:n,sortBy:v,headers:a,DisplayCell:p,canSelectRows:d,storeName:h,hasData:y,row:e,id:n})})):(0,r.createElement)(xr,{className:"noptin-table__row"},(0,r.createElement)(Cr,{colSpan:a.length},null!=c?c:(0,se.__)("No data to display","newsletter-optin-box"),s)))))};var gi=["query","headers"];function vi(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 bi(e){for(var t=1;t=t||n<0||g&&e-o.current>=v},b=function(t){return i.current=null,h&&l.current?e(t):(l.current=s.current=null,u.current)},y=function e(){var r=Date.now();if(c(r))return b(r);if(d.current){var i=t-(r-a.current),l=g?Math.min(i,v-(r-o.current)):i;n(e,l)}},w=function(){var p=Date.now(),f=c(p);if(l.current=[].slice.call(arguments),s.current=r,a.current=p,f){if(!i.current&&d.current)return o.current=a.current,n(y,t),m?e(a.current):u.current;if(g)return n(y,t),e(a.current)}return i.current||n(y,t),u.current};return w.cancel=function(){i.current&&(f?cancelAnimationFrame(i.current):clearTimeout(i.current)),o.current=0,l.current=a.current=s.current=i.current=null},w.isPending=function(){return!!i.current},w.flush=function(){return i.current?b(Date.now()):u.current},w}),[m,g,t,v,h,f]);return b}((function(e){n(e)}),500);return(0,r.createElement)(l.FlexBlock,{style:{minWidth:"200px"}},(0,r.createElement)(l.SearchControl,{value:i,onChange:function(e){s(e),u(e)},placeholder:a,__nextHasNoMarginBottom:!0}))};var xi=["actions","filtersButton","className","hasSearch","searchPlaceholder","headers","ids","isLoading","onQueryChange","onRefresh","query","initialHiddenHeaders","rows","showMenu","showFooter","summary","title","totalRows","canSelectRows","DisplayCell","storeName"];function Oi(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 ki(e){for(var t=1;t0&&h,v))},Pi=function(e){var t=e.isLoading,n=e.summary,a=e.query,o=e.onQueryChange,i=e.totalRows;return(0,r.createElement)(l.CardFooter,{justify:"center"},t?(0,r.createElement)(Ei,null):(0,r.createElement)(r.Fragment,null,(0,r.createElement)(Wo,{query:a,onQueryChange:o,total:i}),n&&(0,r.createElement)(wi,{data:n})))};const Ri=function(e){var t=e.actions,n=e.filtersButton,a=e.className,o=e.hasSearch,i=e.searchPlaceholder,c=e.headers,s=void 0===c?[]:c,u=(e.ids,e.isLoading),p=void 0!==u&&u,d=e.onQueryChange,f=void 0===d?function(){}:d,m=e.onRefresh,h=void 0!==m&&m,g=e.query,v=void 0===g?{}:g,b=e.initialHiddenHeaders,y=void 0===b?[]:b,w=e.rows,E=void 0===w?[]:w,_=(e.showMenu,e.showFooter),x=void 0===_||_,O=e.summary,k=e.title,S=e.totalRows,C=e.canSelectRows,j=e.DisplayCell,P=e.storeName,R=void 0===P?"default":P,D=ga(e,xi),A=he((0,r.useState)(y),2),F=A[0],T=A[1],I=ki({headers:(0,r.useMemo)((function(){return s.filter((function(e){return!F.includes(e.key)}))}),[s,F]),caption:k,onQueryChange:f,query:v,storeName:R},D);return(0,r.createElement)(l.Card,{className:No()("noptin-table",a),elevation:0},(0,r.createElement)(ji,{title:k,hasSearch:o,query:v,onQueryChange:f,onRefresh:!p&&h,searchPlaceholder:i,actions:!p&&t,filtersButton:n,headers:s,hiddenHeaders:F,setHiddenHeaders:T,totalRows:S}),p?(0,r.createElement)(Si,ki({},I)):(0,r.createElement)(hi,ki({rows:E,DisplayCell:j,canSelectRows:C},I)),x&&(0,r.createElement)(Pi,{isLoading:p,summary:O,query:v,onQueryChange:f,totalRows:S}))};function Di(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 Ai(e){for(var t=1;t2&&void 0!==arguments[2]?arguments[2]:{});return St((function(r){return r(xt(e,t)).getPartialRecords(n)}),[e,t,n])}(o,i,u),d=(0,r.useMemo)((function(){var e;if(null===(e=p.data)||void 0===e||!e.length)return[];var t=a.reduce((function(e,t){return e[t.name]=t.label,e}),{});return Object.keys(p.data[0]).map((function(e){return t[e]||e}))}),[a,p.data]),f=(0,r.useMemo)((function(){var e;return null!==(e=p.data)&&void 0!==e&&e.length?p.data.map((function(e){return Object.values(e)})):[]}),[p.data]),m=(0,r.createElement)(l.Button,{variant:"link",onClick:n},(0,se.__)("Go Back","newsletter-optin-box"));if(p.isResolving)return(0,r.createElement)(l.__experimentalText,{size:16,as:"p"},(0,r.createElement)(l.Spinner,{style:{marginLeft:0}}),(0,se.__)("Preparing records...","newsletter-optin-box"));if("ERROR"===p.status)return(0,r.createElement)(lr,{status:"error",isDismissible:!1},p.error.message||(0,se.__)("An unknown error occurred.","newsletter-optin-box"),"   ",m);if(!p.data.length)return(0,r.createElement)(lr,{status:"info",isDismissible:!1},(0,se.__)("Found no records to export.","newsletter-optin-box"),"   ",m);var h=Ni().unparse({fields:d,data:f},{escapeFormulae:!0}),g="".concat(o,"-").concat(i,"-").concat(Date.now(),".csv");return(0,r.createElement)(lr,{status:"success",isDismissible:!1},(0,se.__)("Done! Click the button below to download records.","newsletter-optin-box"),"   ",(0,r.createElement)(l.Button,{variant:"primary",href:"data:text/csv;charset=utf-8,".concat(encodeURIComponent(h)),download:g,text:(0,se.__)("Download CSV","newsletter-optin-box")}))},$i=function(e){var t=e.fields,n=e.setFields,a=e.schema,o=a.schema,i=a.ignore,c=e.next;return(0,r.createElement)(l.Flex,{direction:"column",gap:4},(0,r.createElement)(l.FlexItem,null,(0,r.createElement)("p",{className:"description"},(0,se.__)("Select the fields to include in your exported file","newsletter-optin-box"))),o.map((function(e){if(!i.includes(e.name))return(0,r.createElement)(l.FlexItem,{key:e.name},(0,r.createElement)(l.ToggleControl,{label:e.label===e.description?e.label:"".concat(e.label," (").concat(e.description,")"),checked:t.includes(e.name),onChange:function(){t.includes(e.name)?n(t.filter((function(t){return t!==e.name}))):n([].concat(Ar(t),[e.name]))},__nextHasNoMarginBottom:!0}))})),(0,r.createElement)(l.FlexItem,null,(0,r.createElement)(sr,{variant:"primary",onClick:c},(0,r.createElement)(l.Icon,{icon:"download"}),(0,se.__)("Download","newsletter-optin-box"))))},Hi=function(e){var t=e.namespace,n=e.collection,a=ga(e,Mi),o=Rt(t,n),i=he((0,r.useState)((0,je.compact)(o.data.schema.map((function(e){return o.data.hidden.includes(e.name)||o.data.ignore.includes(e.name)?null:e.name})))),2),l=i[0],c=i[1],s=he((0,r.useState)("fields"),2),u=s[0],p=s[1];return"fields"===u?(0,r.createElement)($i,{fields:l,setFields:c,schema:o.data,next:function(){return p("progress")}}):"progress"===u?(0,r.createElement)(qi,zi({fields:l,schema:o.data.schema,back:function(){return p("fields")},namespace:t,collection:n},a)):void 0};function Ui(e){var t=e.count,n=e.selected,a=ga(e,Bi),o=he((0,r.useState)(!1),2),i=o[0],c=o[1],s=0===n.length,u=s?(0,se.__)("Download","newsletter-optin-box"):(0,se.__)("Download Selected","newsletter-optin-box"),p=s?(0,se.sprintf)((0,se.__)("Download all %s records","newsletter-optin-box"),t):(0,se.sprintf)((0,se.__)("Download %s selected records","newsletter-optin-box"),n.length);return(0,r.createElement)(r.Fragment,null,(0,r.createElement)(l.Button,{onClick:function(){return c(!0)},variant:"tertiary",text:u}),i&&(0,r.createElement)(l.Modal,{title:p,onRequestClose:function(){return c(!1)}},(0,r.createElement)("div",{className:"hizzle-records-export-modal__body"},(0,r.createElement)(pe,null,(0,r.createElement)(Hi,zi({count:t,selected:n},a))))))}function Wi(e){var t=e.namespace,n=e.collection,a=e.query,o=e.count,c=e.selected,s=e.setSelected,u=(0,Me.useDispatch)("".concat(t,"/").concat(n)),p=he((0,r.useState)(!1),2),d=p[0],f=p[1],m=he((0,r.useState)(null),2),h=m[0],g=m[1],v=he((0,r.useState)(!1),2),b=v[0],y=v[1],w=0===c.length,E=w?(0,se.__)("Delete","newsletter-optin-box"):(0,se.__)("Delete Selected","newsletter-optin-box"),_=Zr(c,a);return(0,r.createElement)(r.Fragment,null,(0,r.createElement)(l.Button,{onClick:function(){return f(!0)},variant:"tertiary",icon:"trash",text:E,isDestructive:!0}),d&&(0,r.createElement)(l.Modal,{title:E,onRequestClose:function(){return f(!1)}},(0,r.createElement)((function(){return(0,r.createElement)(r.Fragment,null,b?(0,r.createElement)(r.Fragment,null,(0,r.createElement)(l.Spinner,null),(0,se.__)("Deleting...","newsletter-optin-box")):(0,r.createElement)(r.Fragment,null,h?(0,r.createElement)(pr,null,h.message):(0,r.createElement)(pr,null,w&&(0,se.sprintf)((0,se.__)("Are you sure you want to delete %d matching records?","newsletter-optin-box"),o),!w&&(0,se.sprintf)((0,se.__)("Are you sure you want to delete %d selected records?","newsletter-optin-box"),c.length)),(0,r.createElement)(sr,{isDestructive:!0,onClick:function(){y(!0),u.deleteRecords((0,i.addQueryArgs)("",_),u).then((function(e){f(!1),s([])})).catch((function(e){g(e)})).finally((function(){y(!1)}))}},(0,se.__)("Yes, Delete!","newsletter-optin-box")),(0,r.createElement)(sr,{onClick:function(){return f(!1)},variant:"secondary",__withNoMargin:!0},(0,se.__)("Cancel","newsletter-optin-box"))))}),null)))}function Vi(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 Qi(e){for(var t=1;t0,O=function(e){if(null==e||e.preventDefault(),!m){h(!0);var t={bulk_update:{merge:w,query:_}};s.batchAction(t,s).then((function(){b(!0),E({})})).catch((function(e){d(e)})).finally((function(){h(!1)}))}};return(0,r.createElement)(r.Fragment,null,(0,r.createElement)(Ki,{editableFields:t,changes:w,onSave:O,setAttributes:function(e){E(Qi(Qi({},w),e)),p&&d(null),v&&b(!1)}}),x&&(0,r.createElement)(sr,{variant:"primary",onClick:O,isBusy:m},!m&&(0,r.createElement)(l.Icon,{icon:"cloud-saved"})," ",(0,se.sprintf)(m?(0,se.__)("Saving %d records...","newsletter-optin-box"):(0,se.__)("Edit %d records","newsletter-optin-box"),i.length>0?i.length:c),m&&(0,r.createElement)(l.Spinner,null)),p&&!x&&(0,r.createElement)(l.Notice,{status:"error",isDismissible:!0},p.message),v&&!x&&(0,r.createElement)(l.Notice,{status:"success",isDismissible:!0},(0,se.__)("Records updated successfully.","newsletter-optin-box")))};function Yi(e){var t=he((0,r.useState)(!1),2),n=t[0],a=t[1],o=yo(e),i=o.length>0;return(0,r.createElement)(r.Fragment,null,i&&(0,r.createElement)(r.Fragment,null,(0,r.createElement)(l.Button,{onClick:function(){return a(!0)},variant:"tertiary",text:(0,se.__)("Bulk Edit","newsletter-optin-box")}),n&&(0,r.createElement)(l.Modal,{title:(0,se.__)("Bulk Edit","newsletter-optin-box"),onRequestClose:function(){return a(!1)}},(0,r.createElement)(Gi,Qi({editableFields:o},e)))))}var Xi=["namespace","collection","query","setQuery","schema"],Ji=["namespace","collection","defaultProps","inline"];function Zi(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 el(e){for(var t=1;t1&&(0,r.createElement)(yr,{orientation:"horizontal",onNavigate:g},f.map((function(e,t){return(0,r.createElement)(l.Button,{key:e.name,isPressed:e.name===s||!s&&0===t,onClick:function(){return g(t)}},e.title)}))),n)})),fl=function(){var e=$(),t=e.namespace,n=e.collection,a=e.id,o=e.tab;return(0,r.createElement)(dl,{namespace:t,collection:n,recordId:a,tab:o,basePath:a},(0,r.createElement)(X,null))},ml=function(){var e=$(),t=e.innerNamespace,n=e.innerCollection,a=e.innerTab,o=e.innerId,i=e.id,l=e.tab;return(0,r.createElement)(dl,{namespace:t,collection:n,recordId:o,tab:a,basePath:"".concat(i,"/").concat(l,"/").concat(t,"/").concat(n,"/").concat(o)},(0,r.createElement)(X,null))},hl=rr("div",{target:"ei95lsh0"})({name:"1kd8sf",styles:"margin:1.6rem 0;max-width:600px"}),gl=sr.withComponent(l.FormFileUpload,{target:"ei95lsh1"});const vl=function(e){var t=e.onUpload;return(0,r.createElement)(hl,null,(0,r.createElement)(l.__experimentalText,{weight:600,as:"h3"},(0,se.__)("This tool allows you to import existing records from a CSV file.","newsletter-optin-box")),(0,r.createElement)(gl,{accept:"text/csv",onChange:function(e){return t(e.currentTarget.files[0])},variant:"primary"},(0,r.createElement)(l.Icon,{icon:"cloud-upload"}),(0,se.__)("Select a CSV file","newsletter-optin-box")),(0,r.createElement)(l.Tip,null,(0,se.__)("The first row of the CSV file should contain the field names/headers.","newsletter-optin-box"),(0,r.createElement)("br",null),(0,se.__)(" Have a different file type?","newsletter-optin-box")," ",(0,r.createElement)(l.Button,{variant:"link",href:"https://convertio.co/csv-converter/",target:"_blank",text:(0,se.__)("Convert it to CSV","newsletter-optin-box")})))};function bl(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 yl(e){for(var t=1;t0&&(0,r.createElement)(l.FlexItem,null,(0,r.createElement)(Pa,{value:(0,r.createElement)(kl,{from:$,to:L,duration:h||E?300:b}),label:(0,se.__)("Records Created","newsletter-optin-box"),status:"success"})),F>0&&(0,r.createElement)(l.FlexItem,null,(0,r.createElement)(Pa,{value:(0,r.createElement)(kl,{from:N,to:F,duration:h||E?300:b}),label:(0,se.__)("Records Updated","newsletter-optin-box"),status:"success"})),W>0&&(0,r.createElement)(l.FlexItem,null,(0,r.createElement)(Pa,{value:(0,r.createElement)(kl,{from:K,to:W,duration:h||E?300:b}),label:(0,se.__)("Records Failed","newsletter-optin-box"),status:"error"})),X>0&&(0,r.createElement)(l.FlexItem,null,(0,r.createElement)(Pa,{value:(0,r.createElement)(kl,{from:ee,to:X,duration:h||E?300:b}),label:(0,se.__)("Records Skipped","newsletter-optin-box"),status:"info"}))),h&&(0,r.createElement)(sr,{variant:"primary",text:(0,se.__)("View Records","newsletter-optin-box"),onClick:function(){return u(s)},maxWidth:"200px"}),d.length>0&&(0,r.createElement)(dr,{as:"h3"},(0,se.__)("Errors","newsletter-optin-box")," ",h&&(0,r.createElement)(l.Button,{onClick:function(){return f([])},variant:"link"},(0,se.__)("Clear","newsletter-optin-box"))),d.map((function(e,t){return(0,r.createElement)(pr,{key:t},e.message)}))):(0,r.createElement)(dr,{as:"h3"},(0,se.__)("Parsing","newsletter-optin-box"),(0,r.createElement)("code",null,t.name),"...  ",(0,r.createElement)(l.Spinner,null))};var Cl=["file","schema","back"];function jl(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 Pl(e){for(var t=1;t1&&(t=n),r.createRoot?(0,r.createRoot)(e).render((0,r.createElement)(Al,{defaultRoute:t})):(0,r.render)((0,r.createElement)(Al,{defaultRoute:t}),e)}}))})()})(); \ No newline at end of file diff --git a/includes/assets/js/dist/welcome-wizard.asset.php b/includes/assets/js/dist/welcome-wizard.asset.php index f26ceca3..e5fe6ec9 100644 --- a/includes/assets/js/dist/welcome-wizard.asset.php +++ b/includes/assets/js/dist/welcome-wizard.asset.php @@ -1 +1 @@ - array('react', 'wp-api-fetch', 'wp-components', 'wp-dom-ready', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => '1714b483ec206089bb88'); + array('react', 'wp-api-fetch', 'wp-components', 'wp-dom-ready', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => '81aa81b9f9b55b44106e'); diff --git a/includes/assets/js/dist/welcome-wizard.js b/includes/assets/js/dist/welcome-wizard.js index 5512ee44..882cb0c9 100644 --- a/includes/assets/js/dist/welcome-wizard.js +++ b/includes/assets/js/dist/welcome-wizard.js @@ -1,2 +1,2 @@ /*! For license information please see welcome-wizard.js.LICENSE.txt */ -(()=>{"use strict";var e={679:(e,t,n)=>{var r=n(296),o={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},a={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},i={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},l={};function s(e){return r.isMemo(e)?i:l[e.$$typeof]||o}l[r.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},l[r.Memo]=i;var c=Object.defineProperty,u=Object.getOwnPropertyNames,p=Object.getOwnPropertySymbols,f=Object.getOwnPropertyDescriptor,d=Object.getPrototypeOf,m=Object.prototype;e.exports=function e(t,n,r){if("string"!=typeof n){if(m){var o=d(n);o&&o!==m&&e(t,o,r)}var i=u(n);p&&(i=i.concat(p(n)));for(var l=s(t),g=s(n),y=0;y{var n="function"==typeof Symbol&&Symbol.for,r=n?Symbol.for("react.element"):60103,o=n?Symbol.for("react.portal"):60106,a=n?Symbol.for("react.fragment"):60107,i=n?Symbol.for("react.strict_mode"):60108,l=n?Symbol.for("react.profiler"):60114,s=n?Symbol.for("react.provider"):60109,c=n?Symbol.for("react.context"):60110,u=n?Symbol.for("react.async_mode"):60111,p=n?Symbol.for("react.concurrent_mode"):60111,f=n?Symbol.for("react.forward_ref"):60112,d=n?Symbol.for("react.suspense"):60113,m=n?Symbol.for("react.suspense_list"):60120,g=n?Symbol.for("react.memo"):60115,y=n?Symbol.for("react.lazy"):60116,b=n?Symbol.for("react.block"):60121,h=n?Symbol.for("react.fundamental"):60117,v=n?Symbol.for("react.responder"):60118,_=n?Symbol.for("react.scope"):60119;function w(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case r:switch(e=e.type){case u:case p:case a:case l:case i:case d:return e;default:switch(e=e&&e.$$typeof){case c:case f:case y:case g:case s:return e;default:return t}}case o:return t}}}function x(e){return w(e)===p}t.AsyncMode=u,t.ConcurrentMode=p,t.ContextConsumer=c,t.ContextProvider=s,t.Element=r,t.ForwardRef=f,t.Fragment=a,t.Lazy=y,t.Memo=g,t.Portal=o,t.Profiler=l,t.StrictMode=i,t.Suspense=d,t.isAsyncMode=function(e){return x(e)||w(e)===u},t.isConcurrentMode=x,t.isContextConsumer=function(e){return w(e)===c},t.isContextProvider=function(e){return w(e)===s},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===r},t.isForwardRef=function(e){return w(e)===f},t.isFragment=function(e){return w(e)===a},t.isLazy=function(e){return w(e)===y},t.isMemo=function(e){return w(e)===g},t.isPortal=function(e){return w(e)===o},t.isProfiler=function(e){return w(e)===l},t.isStrictMode=function(e){return w(e)===i},t.isSuspense=function(e){return w(e)===d},t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===a||e===p||e===l||e===i||e===d||e===m||"object"==typeof e&&null!==e&&(e.$$typeof===y||e.$$typeof===g||e.$$typeof===s||e.$$typeof===c||e.$$typeof===f||e.$$typeof===h||e.$$typeof===v||e.$$typeof===_||e.$$typeof===b)},t.typeOf=w},296:(e,t,n)=>{e.exports=n(103)}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var a=t[r]={exports:{}};return e[r](a,a.exports,n),a.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(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.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{function e(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}const g=window.wp.primitives,y=(0,o.createElement)(g.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,o.createElement)(g.Path,{d:"M6.6 6L5.4 7l4.5 5-4.5 5 1.1 1 5.5-6-5.4-6zm6 0l-1.1 1 4.5 5-4.5 5 1.1 1 5.5-6-5.5-6z"}));var b=[0,100],h=[0,100],v=function(e){return"".concat(1===e.length?"0":"").concat(e)},_=function(e,t,n){return Math.max(Math.min(e,n),t)},w=function(e,t){return Math.floor(Math.random()*(t-e+1))+e},x=function e(t,n,r){for(var o=w(t,n),a=0;a<(null==r?void 0:r.length);a++){var i=r[a];if(2===(null==i?void 0:i.length)&&o>=i[0]&&o<=i[1])return e(t,n,r)}return o},k=function(e,t){return"number"==typeof t?t:e%Math.abs(t[1]-t[0])+t[0]},C=function(e,t){return"number"==typeof e?_.apply(void 0,[Math.abs(e)].concat(d(t))):1===e.length||e[0]===e[1]?_.apply(void 0,[Math.abs(e[0])].concat(d(t))):[Math.abs(_.apply(void 0,[e[0]].concat(d(t)))),_.apply(void 0,[Math.abs(e[1])].concat(d(t)))]},S=function(e,t,n){return n<0?n+=1:n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e},E=function(e,t,n){var r,o,a;if(e/=360,n/=100,0==(t/=100))r=o=a=n;else{var i=n<.5?n*(1+t):n+t-n*t,l=2*n-i;r=S(l,i,e+1/3),o=S(l,i,e),a=S(l,i,e-1/3)}return[Math.round(255*r),Math.round(255*o),Math.round(255*a)]},O=function(e,t,n,r){return(299*e+587*t+114*n)/1e3>=r},P=function(e,t,n){return"hsl(".concat(e,", ").concat(t,"%, ").concat(n,"%)")},A=function(e,t,n,r){return"rgb"===r?"rgb(".concat(e,", ").concat(t,", ").concat(n,")"):"#".concat(v(e.toString(16))).concat(v(t.toString(16))).concat(v(n.toString(16)))},j=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.format,o=void 0===n?"hex":n,a=t.saturation,i=void 0===a?[50,55]:a,l=t.lightness,s=void 0===l?[50,60]:l,c=t.differencePoint,u=void 0===c?130:c,p=Math.abs(function(e){for(var t=e.length,n=0,r=0;r0&&void 0!==arguments[0]?arguments[0]:{},t=e.format,n=void 0===t?"hex":t,o=e.saturation,a=void 0===o?[50,55]:o,i=e.lightness,l=void 0===i?[50,60]:i,s=e.differencePoint,c=void 0===s?130:s,u=e.excludeHue;a=C(a,b),l=C(l,h);var p=u?x(0,359,u):w(0,359),f="number"==typeof a?a:w.apply(void 0,d(a)),m="number"==typeof l?l:w.apply(void 0,d(l)),g=r(E(p,f,m),3),y=g[0],v=g[1],_=g[2];return{color:"hsl"===n?P(p,f,m):A(y,v,_,n),isLight:O(y,v,_,c)}};const T=j;function M(){return M=Object.assign?Object.assign.bind():function(e){for(var t=1;t0?V(ee,--J):0,X--,10===Q&&(X=1,q--),Q}function oe(){return Q=J2||se(Q)>3?"":" "}function de(e,t){for(;--t&&oe()&&!(Q<48||Q>102||Q>57&&Q<65||Q>70&&Q<97););return le(e,ie()+(t<6&&32==ae()&&32==oe()))}function me(e){for(;oe();)switch(Q){case e:return J;case 34:case 39:34!==e&&39!==e&&me(Q);break;case 40:41===e&&me(e);break;case 92:oe()}return J}function ge(e,t){for(;oe()&&e+Q!==57&&(e+Q!==84||47!==ae()););return"/*"+le(t,J-1)+"*"+I(47===e?e:oe())}function ye(e){for(;!se(ae());)oe();return le(e,J)}var be="-ms-",he="-moz-",ve="-webkit-",_e="comm",we="rule",xe="decl",ke="@keyframes";function Ce(e,t){for(var n="",r=G(e),o=0;o0&&U(k)-p&&Y(d>32?je(k+";",r,n,p-1):je(H(k," ","")+";",r,n,p-2),s);break;case 59:k+=";";default:if(Y(x=Pe(k,t,n,c,u,o,l,v,_=[],w=[],p),a),123===h)if(0===u)Oe(k,t,x,x,_,a,p,l,w);else switch(99===f&&110===V(k,3)?100:f){case 100:case 108:case 109:case 115:Oe(e,x,x,r&&Y(Pe(e,x,x,0,0,o,l,v,o,_=[],p),w),o,w,p,l,r?_:w);break;default:Oe(k,x,x,x,[""],w,0,l,w)}}c=u=d=0,g=b=1,v=k="",p=i;break;case 58:p=1+U(k),d=m;default:if(g<1)if(123==h)--g;else if(125==h&&0==g++&&125==re())continue;switch(k+=I(h),h*g){case 38:b=u>0?1:(k+="\f",-1);break;case 44:l[c++]=(U(k)-1)*b,b=1;break;case 64:45===ae()&&(k+=pe(oe())),f=ae(),u=p=U(v=k+=ye(ie())),h++;break;case 45:45===m&&2==U(k)&&(g=0)}}return a}function Pe(e,t,n,r,o,a,i,l,s,c,u){for(var p=o-1,f=0===o?a:[""],d=G(f),m=0,g=0,y=0;m0?f[b]+" "+h:H(h,/&\f/g,f[b])))&&(s[y++]=v);return te(e,t,n,0===o?we:l,s,c,u)}function Ae(e,t,n){return te(e,t,n,_e,I(Q),W(e,2,-2),0)}function je(e,t,n,r){return te(e,t,n,xe,W(e,0,r),W(e,r+1,-1),r)}var Te=function(e,t,n){for(var r=0,o=0;r=o,o=ae(),38===r&&12===o&&(t[n]=1),!se(o);)oe();return le(e,J)},Me=new WeakMap,$e=function(e){if("rule"===e.type&&e.parent&&!(e.length<1)){for(var t=e.value,n=e.parent,r=e.column===n.column&&e.line===n.line;"rule"!==n.type;)if(!(n=n.parent))return;if((1!==e.props.length||58===t.charCodeAt(0)||Me.get(n))&&!r){Me.set(e,!0);for(var o=[],a=function(e,t){return ue(function(e,t){var n=-1,r=44;do{switch(se(r)){case 0:38===r&&12===ae()&&(t[n]=1),e[n]+=Te(J-1,t,n);break;case 2:e[n]+=pe(r);break;case 4:if(44===r){e[++n]=58===ae()?"&\f":"",t[n]=e[n].length;break}default:e[n]+=I(r)}}while(r=oe());return e}(ce(e),t))}(t,o),i=n.props,l=0,s=0;l6)switch(V(e,t+1)){case 109:if(45!==V(e,t+4))break;case 102:return H(e,/(.+:)(.+)-([^]+)/,"$1"+ve+"$2-$3$1"+he+(108==V(e,t+3)?"$3":"$2-$3"))+e;case 115:return~K(e,"stretch")?Fe(H(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(115!==V(e,t+1))break;case 6444:switch(V(e,U(e)-3-(~K(e,"!important")&&10))){case 107:return H(e,":",":"+ve)+e;case 101:return H(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+ve+(45===V(e,14)?"inline-":"")+"box$3$1"+ve+"$2$3$1"+be+"$2box$3")+e}break;case 5936:switch(V(e,t+11)){case 114:return ve+e+be+H(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return ve+e+be+H(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return ve+e+be+H(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return ve+e+be+e+e}return e}var De=[function(e,t,n,r){if(e.length>-1&&!e.return)switch(e.type){case xe:e.return=Fe(e.value,e.length);break;case ke:return Ce([ne(e,{value:H(e.value,"@","@"+ve)})],r);case we:if(e.length)return function(e,t){return e.map(t).join("")}(e.props,(function(t){switch(function(e,t){return(e=/(::plac\w+|:read-\w+)/.exec(e))?e[0]:e}(t)){case":read-only":case":read-write":return Ce([ne(e,{props:[H(t,/:(read-\w+)/,":-moz-$1")]})],r);case"::placeholder":return Ce([ne(e,{props:[H(t,/:(plac\w+)/,":"+ve+"input-$1")]}),ne(e,{props:[H(t,/:(plac\w+)/,":-moz-$1")]}),ne(e,{props:[H(t,/:(plac\w+)/,be+"input-$1")]})],r)}return""}))}}],Be=function(e){var t=e.key;if("css"===t){var n=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(n,(function(e){-1!==e.getAttribute("data-emotion").indexOf(" ")&&(document.head.appendChild(e),e.setAttribute("data-s",""))}))}var r,o,a=e.stylisPlugins||De,i={},l=[];r=e.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+t+' "]'),(function(e){for(var t=e.getAttribute("data-emotion").split(" "),n=1;n=4;++r,o-=4)t=1540483477*(65535&(t=255&e.charCodeAt(r)|(255&e.charCodeAt(++r))<<8|(255&e.charCodeAt(++r))<<16|(255&e.charCodeAt(++r))<<24))+(59797*(t>>>16)<<16),n=1540483477*(65535&(t^=t>>>24))+(59797*(t>>>16)<<16)^1540483477*(65535&n)+(59797*(n>>>16)<<16);switch(o){case 3:n^=(255&e.charCodeAt(r+2))<<16;case 2:n^=(255&e.charCodeAt(r+1))<<8;case 1:n=1540483477*(65535&(n^=255&e.charCodeAt(r)))+(59797*(n>>>16)<<16)}return(((n=1540483477*(65535&(n^=n>>>13))+(59797*(n>>>16)<<16))^n>>>15)>>>0).toString(36)}(o)+s;return{name:c,styles:o,next:Ue}},qe=!!$.useInsertionEffect&&$.useInsertionEffect,Xe=qe||function(e){return e()},Ze=(qe||$.useLayoutEffect,$.createContext("undefined"!=typeof HTMLElement?Be({key:"css"}):null));Ze.Provider;var Je=$.createContext({}),Qe=function(e,t,n){var r=e.key+"-"+t.name;!1===n&&void 0===e.registered[r]&&(e.registered[r]=t.styles)},et=D,tt=function(e){return"theme"!==e},nt=function(e){return"string"==typeof e&&e.charCodeAt(0)>96?et:tt},rt=function(e,t,n){var r;if(t){var o=t.shouldForwardProp;r=e.__emotion_forwardProp&&o?function(t){return e.__emotion_forwardProp(t)&&o(t)}:o}return"function"!=typeof r&&n&&(r=e.__emotion_forwardProp),r},ot=function(e){var t=e.cache,n=e.serialized,r=e.isStringTag;return Qe(t,n,r),Xe((function(){return function(e,t,n){Qe(e,t,n);var r=e.key+"-"+t.name;if(void 0===e.inserted[t.name]){var o=t;do{e.insert(t===o?"."+r:"",o,e.sheet,!0),o=o.next}while(void 0!==o)}}(t,n,r)})),null},at=function e(t,n){var r,o,a=t.__emotion_real===t,i=a&&t.__emotion_base||t;void 0!==n&&(r=n.label,o=n.target);var l=rt(t,n,a),s=l||nt(i),c=!s("as");return function(){var u=arguments,p=a&&void 0!==t.__emotion_styles?t.__emotion_styles.slice(0):[];if(void 0!==r&&p.push("label:"+r+";"),null==u[0]||void 0===u[0].raw)p.push.apply(p,u);else{p.push(u[0][0]);for(var f=u.length,d=1;d1;return(0,o.createElement)(a.Flex,{className:"noptin-component__field-lg",wrap:!0},(0,o.createElement)(a.FlexItem,null,(0,o.createElement)(a.SelectControl,{label:(0,i.__)("If","newsletter-optin-box"),hideLabelFromVision:!0,value:n||"allow",options:pt,onChange:function(e){return l("action",e)},size:"default",__nextHasNoMarginBottom:!0})),s&&(0,o.createElement)(o.Fragment,null,(0,o.createElement)(a.FlexItem,null,(0,o.createElement)(a.SelectControl,{label:(0,i.__)("all","newsletter-optin-box"),hideLabelFromVision:!0,value:t||"all",options:ft,onChange:function(e){return l("type",e)},size:"default",__nextHasNoMarginBottom:!0})),(0,o.createElement)(a.FlexBlock,null,(0,i.__)("of the following rules are true:","newsletter-optin-box"))))}function gt(e){var t,n=e.rule,l=e.comparisons,s=e.availableSmartTags,c=e.index,u=e.updateRule,p=e.removeRule,f=(0,o.useCallback)((function(e){return u(c,"value",e)}),[c,u]),d=(0,o.useCallback)((function(e){return u(c,"condition",e)}),[c,u]),m=(0,o.useCallback)((function(){return p(c)}),[c,p]),g=(0,o.useMemo)((function(){var e=n.type;if(void 0!==s[e])return s[e];var t,o=e.replace("_",".",1);if(void 0!==s[o])return s[o];for(var a=0,i=Object.entries(s);a> ").concat(t)}),[n.type,s]),b=dt((t=null==g?void 0:g.options,(0,o.useMemo)((function(){return t?Array.isArray(t)?t.map((function(e,t){return{label:e,value:t}})):Object.keys(t).map((function(e){return{label:t[e],value:e}})):[]}),[t])),(0,i.__)("Select a value","newsletter-optin-box")),h=b.length>1,v=(null==g?void 0:g.conditional_logic)||"string",_=dt((0,o.useMemo)((function(){var e=[];return Object.keys(l).forEach((function(t){var n=l[t].type;if(h){if("string"===v&&"is"!=t&&"is_not"!=t)return;if("is_empty"===t||"is_not_empty"===t||"is_between"===t)return}"any"!==n&&n!=v||e.push({label:l[t].name,value:t})})),e}),[v,l]),(0,i.__)("Select a comparison","newsletter-optin-box")),w="is_empty"===n.condition||"is_not_empty"===n.condition;return(0,o.createElement)(a.Flex,{className:"noptin-component__field-lg",wrap:!0,expanded:!0},(0,o.createElement)(a.FlexBlock,null,(0,o.createElement)(st,ut({},function(e){if(["subscribed","active","yes","true","1"].includes(e))return{backgroundColor:"#78c67a",color:"#111111"};if(["unsubscribed","inactive","no","false","0"].includes(e))return{backgroundColor:"#fbcfbd",color:"#241c15"};if(["pending","waiting","maybe","2"].includes(e))return{backgroundColor:"#fbeeca",color:"#241c15"};var t=T(e,{saturation:[60,100],lightness:[30,45]});return{backgroundColor:t.color,color:t.isLight?"#111111":"#ffffff"}}(y)),y)),(0,o.createElement)(a.FlexBlock,null,(0,o.createElement)(a.Flex,{justify:"flex-end",wrap:!0},(0,o.createElement)(a.FlexItem,null,(0,o.createElement)(a.SelectControl,{label:(0,i.__)("Comparison","newsletter-optin-box"),hideLabelFromVision:!0,value:n.condition?n.condition:"is",options:_,onChange:d,size:"default",__nextHasNoMarginBottom:!0})),!w&&(0,o.createElement)(a.FlexBlock,null,h&&(0,o.createElement)(a.SelectControl,{label:(0,i.__)("Value","newsletter-optin-box"),hideLabelFromVision:!0,value:n.value?n.value:"",options:b,onChange:f,size:"default",__nextHasNoMarginBottom:!0}),!h&&(0,o.createElement)(a.TextControl,{type:"number"===v?"number":"text",label:(0,i.__)("Value","newsletter-optin-box"),hideLabelFromVision:!0,value:n.value?n.value:"",onChange:f,__nextHasNoMarginBottom:!0})),(0,o.createElement)(a.FlexItem,null,(0,o.createElement)(a.Button,{onClick:m,icon:"trash",variant:"tertiary",isDestructive:!0})))))}function yt(e){var t=e.rules,n=e.comparisons,r=e.availableSmartTags,a=e.setConditionalLogicAttribute,l=(0,o.useMemo)((function(){return Array.isArray(t)?t.filter((function(e){return e.type&&""!==e.type})):[]}),[r]),s=(0,o.useMemo)((function(){var e={};return r.forEach((function(t){t.conditional_logic&&(e[t.smart_tag]=ut(ut({},t),{},{key:t.smart_tag,type:t.conditional_logic}))})),e}),[r]),c=(0,o.useCallback)((function(e){var t=d(l);t.splice(e,1),a("rules",t)}),[l,a]),u=(0,o.useCallback)((function(e,t,n){var r=d(l);r[e][t]=n,a("rules",r)}),[l,a]),p=(0,o.useMemo)((function(){return Object.values(s)}),[s]),f=(0,o.useCallback)((function(e){var t=s[e],n=(null==t?void 0:t.options)||[],r=(null==t?void 0:t.placeholder)||"",o=Array.isArray(n)&&n.length?Object.keys(n)[0]:r;null!=t&&t.default&&(o=t.default);var i=d(l);i.push({type:e,condition:"is",value:o}),a("rules",i)}),[l]),m=l.length?(0,i.__)("Add a rule","newsletter-optin-box"):(0,i.__)("Add another rule","newsletter-optin-box"),g=At({availableSmartTags:p,onMergeTagClick:f,raw:!0,icon:"plus",label:m,text:m,toggleProps:{variant:"secondary"}});return(0,o.createElement)("div",{className:"noptin-conditional-logic-rules"},l.map((function(e,t){return(0,o.createElement)(gt,{key:t,rule:e,index:t,updateRule:u,removeRule:c,comparisons:n,availableSmartTags:s})})),g)}function bt(e){var t=e.onChange,n=e.value,r=e.comparisons,l=e.toggleText,s=e.availableSmartTags,c=e.className;"object"!==p(n)&&(n={enabled:!1,action:"allow",rules:[{condition:"is",type:"date",value:""}],type:"all"});var u=function(e,r){t(ut(ut({},n),{},f({},e,r)))};return(0,o.createElement)("div",{className:c},(0,o.createElement)(a.ToggleControl,{checked:!!n.enabled,onChange:function(e){return u("enabled",e)},className:"noptin-component__field",label:l||(0,i.__)("Optionally enable/disable this trigger depending on specific conditions.","newsletter-optin-box"),__nextHasNoMarginBottom:!0}),n.enabled&&(0,o.createElement)(o.Fragment,null,(0,o.createElement)(mt,{ruleCount:Array.isArray(n.rules)?n.rules.length:0,type:n.type,action:n.action,setConditionalLogicAttribute:u}),(0,o.createElement)(yt,{rules:n.rules,comparisons:r,availableSmartTags:s,setConditionalLogicAttribute:u})))}var ht={"==":function(e,t){return e==t},"===":function(e,t){return e===t},"!=":function(e,t){return e!=t},"!==":function(e,t){return e!==t},">":function(e,t){return e>t},">=":function(e,t){return e>=t},"<":function(e,t){return e0&&(v=(0,o.createElement)(a.DropdownMenu,St({icon:p,label:d},g),(function(e){var t=e.onClose;return(0,o.createElement)(o.Fragment,null,Object.keys(b).map((function(e,n){return(0,o.createElement)(a.MenuGroup,{label:h>1?e:void 0,key:n},b[e].map((function(e){return(0,o.createElement)(a.MenuItem,{icon:e.icon||y,iconPosition:"left",onClick:function(){if(l){var n=c?e.smart_tag:"[[".concat((r=e).example?r.example:r.default?"".concat(r.smart_tag,' default="').concat(r.default,'"'):"".concat(r.smart_tag),"]]");l(n)}var r;t()},key:e.smart_tag},e.label)})))})))}))),v}function jt(e){var t=e.setting,n=e.availableSmartTags,r=e.value,l=e.onChange,s=m(e,xt),c=(0,a.useBaseControlProps)(s),u=c.baseControlProps,p=c.controlProps;Array.isArray(r)||(r=[]);var f=(0,o.useCallback)((function(e){var t=e.item,s=e.index;return(0,o.createElement)(a.Flex,{className:"noptin-repeater-item",wrap:!0},Pt.map((function(e,a){return(0,o.createElement)(Tt,{key:a,availableSmartTags:n,field:e,value:void 0===t[e.id]?"":t[e.id],onChange:function(t){var n=d(r);n[s][e.id]=t,l(n)}})})),(0,o.createElement)(a.FlexItem,null,(0,o.createElement)(a.Button,{icon:"trash",variant:"tertiary",className:"noptin-component__field",label:(0,i.__)("Delete","noptin-addons-pack"),showTooltip:!0,onClick:function(){var e=d(r);e.splice(s,1),l(e)},isDestructive:!0})))}),[r,l]);return(0,o.createElement)(a.BaseControl,St({},u),(0,o.createElement)("div",St({},p),r.map((function(e,t){return(0,o.createElement)(f,{key:t,item:e,index:t})})),(0,o.createElement)(a.Button,{onClick:function(){var e=d(r);e.push({}),l(e)},variant:"secondary"},t.add_field?t.add_field:(0,i.__)("Add","newsletter-optin-box"))))}function Tt(e){var t=e.field,n=e.availableSmartTags,r=e.value,l=e.onChange,s=At({availableSmartTags:n,onMergeTagClick:(0,o.useCallback)((function(e){l&&l(r?"".concat(r," ").concat(e).trim():e)}),[r,l])});return(0,o.createElement)(a.FlexBlock,null,(0,o.createElement)(a.__experimentalInputControl,{label:t.label,type:t.type,value:r,placeholder:(0,i.sprintf)((0,i.__)("Enter %s","noptin-addons-pack"),t.label),className:"noptin-component__field noptin-condition-field",suffix:s,onChange:l,isPressEnterToChange:!0,__nextHasNoMarginBottom:!0,__next36pxDefaultSize:!0}))}function Mt(e){e.setting;var t=e.value,n=e.options,r=e.onChange,i=m(e,kt),l=(0,a.useBaseControlProps)(i),s=l.baseControlProps,c=l.controlProps;return Array.isArray(t)||(t=[]),(0,o.createElement)(a.BaseControl,St({},s),(0,o.createElement)("div",St({},c),n.map((function(e,n){return(0,o.createElement)(a.CheckboxControl,{key:n,label:e.label,checked:t.includes(e.value),onChange:function(n){r(n?[].concat(d(t),[e.value]):t.filter((function(t){return t!==e.value})))}})}))))}function $t(e){var t=e.settingKey,n=e.setting,r=e.availableSmartTags,l=e.prop,s=e.saved,c=e.setAttributes,u=(0,o.useCallback)((function(e){if(!l)return c(f({},t,e));var n=s[l]?s[l]:{},r=f({},l,St(St({},n),{},f({},t,e)));c(r)}),[t,l,s,c]);if(n.if||n.restrict){var p=n.restrict?n.restrict.split("."):n.if.split(".");if(!(2!==p.length||s[p[0]]&&s[p[0]][p[1]]))return null;if(1===p.length&&!s[p[0]])return null}if(Array.isArray(n.conditions)){var d=n.conditions.every((function(e){var t=e.key.split("."),n=e.operator?e.operator:"==",r=s[t[0]];return 2===t.length?r&&r[t[1]]&&vt(e.value,n,r[t[1]]):vt(e.value,n,r)}));if(!d)return null}if(n.condition&&!n.condition(s))return null;var m=s[t];l&&(m=s[l]?s[l][t]:void 0),(void 0===m||n.disabled)&&(m=n.default);var g=void 0!==m&&""!==m&&null!==m,y=[];n.options&&(y=Object.keys(n.options).map((function(e){return{label:n.options[e],value:e}})));var b=n.fullWidth?"noptin-component__field noptin-component__field-".concat(t):"noptin-component__field-lg noptin-component__field-".concat(t),h=n.description?(0,o.createElement)("span",{dangerouslySetInnerHTML:{__html:n.description}}):"",v={label:n.label,value:g?m:"",onChange:u,className:"".concat(b),help:h};return"select"===n.el?(y.unshift({label:n.placeholder?n.placeholder:(0,i.__)("Select an option","newsletter-optin-box"),value:"",disabled:!n.canSelectPlaceholder}),(0,o.createElement)(a.SelectControl,St(St({},v),{},{options:y,__nextHasNoMarginBottom:!0,__next36pxDefaultSize:!0}))):"form_token"===n.el?(0,o.createElement)(a.FormTokenField,St(St({},v),{},{value:Array.isArray(v.value)?v.value:[],suggestions:Array.isArray(n.suggestions)?n.suggestions:[],__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0})):"multi_checkbox"===n.el||"multi_checkbox_alt"===n.el?(0,o.createElement)(Mt,St(St({},v),{},{options:y})):"conditional_logic"===n.el?(0,o.createElement)(bt,St(St({},v),{},{availableSmartTags:r,comparisons:n.comparisons,toggleText:n.toggle_text})):"input"===n.el?n.type&&["toggle","switch","checkbox","checkbox_alt"].includes(n.type)?(0,o.createElement)(a.ToggleControl,St(St({},v),{},{checked:!!g&&m,onChange:function(e){u(e)}})):(0,o.createElement)(Ot,St(St({},v),{},{setting:n,availableSmartTags:"trigger_settings"===l?[]:r,isPressEnterToChange:!n.isInputToChange})):"textarea"===n.el?(0,o.createElement)(a.TextareaControl,St(St({},v),{},{setting:n,placeholder:n.placeholder?n.placeholder:"",__nextHasNoMarginBottom:!0})):"paragraph"===n.el?(0,o.createElement)("div",{className:b},(0,o.createElement)(a.Tip,null,n.content)):"hero"===n.el?(0,o.createElement)("div",{className:b},(0,o.createElement)("h3",null,n.content)):"key_value_repeater"===n.el||"webhook_key_value_repeater"===n.el?(0,o.createElement)(jt,St(St({},v),{},{setting:n,availableSmartTags:"trigger_settings"===l?[]:r})):t}function Nt(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 Ft(e){for(var t=1;t".concat(Rt,"\n\n

").concat(It,"

"),if:"double_optin"},{settingKey:"pages_unsubscribe_page_message",label:(0,i.__)("Unsubscribe Page Message","newsletter-optin-box"),el:"textarea",help:(0,i.__)("This is the message shown to people after they unsubscribe from your newsletter.","newsletter-optin-box"),placeholder:"

".concat(zt,"

\n\n

").concat(Lt,"

")}],handler:Bt},{title:(0,i.__)("Email Sending","newsletter-optin-box"),description:(0,i.__)("Who's the sender of the emails you'll be sending?","newsletter-optin-box"),settings:[{settingKey:"from_name",label:(0,i.__)('"From" Name',"newsletter-optin-box"),el:"input",type:"text",help:(0,i.__)("How the sender name appears in outgoing emails","newsletter-optin-box")},{settingKey:"from_email",label:(0,i.__)('"From" Email',"newsletter-optin-box"),el:"input",type:"email",help:(0,i.__)("How the sender email appears in outgoing emails","newsletter-optin-box")},{settingKey:"reply_to",label:(0,i.__)('"Reply-to" Email',"newsletter-optin-box"),el:"input",type:"email",help:(0,i.__)("Where replies to your emails should be sent","newsletter-optin-box")}],handler:Bt},{title:(0,i.__)("Newsletter","newsletter-optin-box"),description:(0,i.__)("Subscribe to our newsletter to get the latest news and updates.","newsletter-optin-box"),settings:[{settingKey:"noptin_signup_name",label:(0,i.__)("Your Name","newsletter-optin-box"),el:"input",type:"text"},{settingKey:"noptin_signup_email",label:(0,i.__)("Your Email Address","newsletter-optin-box"),el:"input",type:"email"}],handler:function(e,t){e.noptin_signup_email.length>0&&window.fetch("https://noptin.com/wp-json/noptin/v1/subscribers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:e.noptin_signup_email,name:e.noptin_signup_name,source:"settings-wizard"})}).catch((function(e){console.error(e)})),t(e)}}];function Kt(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 Vt(e){var t=e.saved,n=r((0,o.useState)(0),2),l=n[0],s=n[1],c=l===Ht.length-1,u=0===l,p=Ht[l]?Ht[l]:null;return(0,o.createElement)(a.Card,{className:"noptin-settings-wizard noptin-component__section",style:{maxWidth:"520px"}},p&&(0,o.createElement)(Dt,function(e){for(var t=1;t{"use strict";var e={679:(e,t,n)=>{var r=n(296),o={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},a={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},i={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},l={};function s(e){return r.isMemo(e)?i:l[e.$$typeof]||o}l[r.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},l[r.Memo]=i;var c=Object.defineProperty,u=Object.getOwnPropertyNames,p=Object.getOwnPropertySymbols,f=Object.getOwnPropertyDescriptor,d=Object.getPrototypeOf,m=Object.prototype;e.exports=function e(t,n,r){if("string"!=typeof n){if(m){var o=d(n);o&&o!==m&&e(t,o,r)}var i=u(n);p&&(i=i.concat(p(n)));for(var l=s(t),g=s(n),y=0;y{var n="function"==typeof Symbol&&Symbol.for,r=n?Symbol.for("react.element"):60103,o=n?Symbol.for("react.portal"):60106,a=n?Symbol.for("react.fragment"):60107,i=n?Symbol.for("react.strict_mode"):60108,l=n?Symbol.for("react.profiler"):60114,s=n?Symbol.for("react.provider"):60109,c=n?Symbol.for("react.context"):60110,u=n?Symbol.for("react.async_mode"):60111,p=n?Symbol.for("react.concurrent_mode"):60111,f=n?Symbol.for("react.forward_ref"):60112,d=n?Symbol.for("react.suspense"):60113,m=n?Symbol.for("react.suspense_list"):60120,g=n?Symbol.for("react.memo"):60115,y=n?Symbol.for("react.lazy"):60116,b=n?Symbol.for("react.block"):60121,h=n?Symbol.for("react.fundamental"):60117,v=n?Symbol.for("react.responder"):60118,_=n?Symbol.for("react.scope"):60119;function w(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case r:switch(e=e.type){case u:case p:case a:case l:case i:case d:return e;default:switch(e=e&&e.$$typeof){case c:case f:case y:case g:case s:return e;default:return t}}case o:return t}}}function x(e){return w(e)===p}t.AsyncMode=u,t.ConcurrentMode=p,t.ContextConsumer=c,t.ContextProvider=s,t.Element=r,t.ForwardRef=f,t.Fragment=a,t.Lazy=y,t.Memo=g,t.Portal=o,t.Profiler=l,t.StrictMode=i,t.Suspense=d,t.isAsyncMode=function(e){return x(e)||w(e)===u},t.isConcurrentMode=x,t.isContextConsumer=function(e){return w(e)===c},t.isContextProvider=function(e){return w(e)===s},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===r},t.isForwardRef=function(e){return w(e)===f},t.isFragment=function(e){return w(e)===a},t.isLazy=function(e){return w(e)===y},t.isMemo=function(e){return w(e)===g},t.isPortal=function(e){return w(e)===o},t.isProfiler=function(e){return w(e)===l},t.isStrictMode=function(e){return w(e)===i},t.isSuspense=function(e){return w(e)===d},t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===a||e===p||e===l||e===i||e===d||e===m||"object"==typeof e&&null!==e&&(e.$$typeof===y||e.$$typeof===g||e.$$typeof===s||e.$$typeof===c||e.$$typeof===f||e.$$typeof===h||e.$$typeof===v||e.$$typeof===_||e.$$typeof===b)},t.typeOf=w},296:(e,t,n)=>{e.exports=n(103)}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var a=t[r]={exports:{}};return e[r](a,a.exports,n),a.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(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.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{function e(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}const g=window.wp.primitives,y=(0,o.createElement)(g.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,o.createElement)(g.Path,{d:"M6.6 6L5.4 7l4.5 5-4.5 5 1.1 1 5.5-6-5.4-6zm6 0l-1.1 1 4.5 5-4.5 5 1.1 1 5.5-6-5.5-6z"}));var b=[0,100],h=[0,100],v=function(e){return"".concat(1===e.length?"0":"").concat(e)},_=function(e,t,n){return Math.max(Math.min(e,n),t)},w=function(e,t){return Math.floor(Math.random()*(t-e+1))+e},x=function e(t,n,r){for(var o=w(t,n),a=0;a<(null==r?void 0:r.length);a++){var i=r[a];if(2===(null==i?void 0:i.length)&&o>=i[0]&&o<=i[1])return e(t,n,r)}return o},k=function(e,t){return"number"==typeof t?t:e%Math.abs(t[1]-t[0])+t[0]},C=function(e,t){return"number"==typeof e?_.apply(void 0,[Math.abs(e)].concat(d(t))):1===e.length||e[0]===e[1]?_.apply(void 0,[Math.abs(e[0])].concat(d(t))):[Math.abs(_.apply(void 0,[e[0]].concat(d(t)))),_.apply(void 0,[Math.abs(e[1])].concat(d(t)))]},S=function(e,t,n){return n<0?n+=1:n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e},E=function(e,t,n){var r,o,a;if(e/=360,n/=100,0==(t/=100))r=o=a=n;else{var i=n<.5?n*(1+t):n+t-n*t,l=2*n-i;r=S(l,i,e+1/3),o=S(l,i,e),a=S(l,i,e-1/3)}return[Math.round(255*r),Math.round(255*o),Math.round(255*a)]},O=function(e,t,n,r){return(299*e+587*t+114*n)/1e3>=r},P=function(e,t,n){return"hsl(".concat(e,", ").concat(t,"%, ").concat(n,"%)")},A=function(e,t,n,r){return"rgb"===r?"rgb(".concat(e,", ").concat(t,", ").concat(n,")"):"#".concat(v(e.toString(16))).concat(v(t.toString(16))).concat(v(n.toString(16)))},j=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.format,o=void 0===n?"hex":n,a=t.saturation,i=void 0===a?[50,55]:a,l=t.lightness,s=void 0===l?[50,60]:l,c=t.differencePoint,u=void 0===c?130:c,p=Math.abs(function(e){for(var t=e.length,n=0,r=0;r0&&void 0!==arguments[0]?arguments[0]:{},t=e.format,n=void 0===t?"hex":t,o=e.saturation,a=void 0===o?[50,55]:o,i=e.lightness,l=void 0===i?[50,60]:i,s=e.differencePoint,c=void 0===s?130:s,u=e.excludeHue;a=C(a,b),l=C(l,h);var p=u?x(0,359,u):w(0,359),f="number"==typeof a?a:w.apply(void 0,d(a)),m="number"==typeof l?l:w.apply(void 0,d(l)),g=r(E(p,f,m),3),y=g[0],v=g[1],_=g[2];return{color:"hsl"===n?P(p,f,m):A(y,v,_,n),isLight:O(y,v,_,c)}};const T=j;function M(){return M=Object.assign?Object.assign.bind():function(e){for(var t=1;t0?W(ee,--J):0,X--,10===Q&&(X=1,q--),Q}function oe(){return Q=J2||se(Q)>3?"":" "}function de(e,t){for(;--t&&oe()&&!(Q<48||Q>102||Q>57&&Q<65||Q>70&&Q<97););return le(e,ie()+(t<6&&32==ae()&&32==oe()))}function me(e){for(;oe();)switch(Q){case e:return J;case 34:case 39:34!==e&&39!==e&&me(Q);break;case 40:41===e&&me(e);break;case 92:oe()}return J}function ge(e,t){for(;oe()&&e+Q!==57&&(e+Q!==84||47!==ae()););return"/*"+le(t,J-1)+"*"+R(47===e?e:oe())}function ye(e){for(;!se(ae());)oe();return le(e,J)}var be="-ms-",he="-moz-",ve="-webkit-",_e="comm",we="rule",xe="decl",ke="@keyframes";function Ce(e,t){for(var n="",r=G(e),o=0;o0&&U(k)-p&&Y(d>32?je(k+";",r,n,p-1):je(H(k," ","")+";",r,n,p-2),s);break;case 59:k+=";";default:if(Y(x=Pe(k,t,n,c,u,o,l,v,_=[],w=[],p),a),123===h)if(0===u)Oe(k,t,x,x,_,a,p,l,w);else switch(99===f&&110===W(k,3)?100:f){case 100:case 108:case 109:case 115:Oe(e,x,x,r&&Y(Pe(e,x,x,0,0,o,l,v,o,_=[],p),w),o,w,p,l,r?_:w);break;default:Oe(k,x,x,x,[""],w,0,l,w)}}c=u=d=0,g=b=1,v=k="",p=i;break;case 58:p=1+U(k),d=m;default:if(g<1)if(123==h)--g;else if(125==h&&0==g++&&125==re())continue;switch(k+=R(h),h*g){case 38:b=u>0?1:(k+="\f",-1);break;case 44:l[c++]=(U(k)-1)*b,b=1;break;case 64:45===ae()&&(k+=pe(oe())),f=ae(),u=p=U(v=k+=ye(ie())),h++;break;case 45:45===m&&2==U(k)&&(g=0)}}return a}function Pe(e,t,n,r,o,a,i,l,s,c,u){for(var p=o-1,f=0===o?a:[""],d=G(f),m=0,g=0,y=0;m0?f[b]+" "+h:H(h,/&\f/g,f[b])))&&(s[y++]=v);return te(e,t,n,0===o?we:l,s,c,u)}function Ae(e,t,n){return te(e,t,n,_e,R(Q),V(e,2,-2),0)}function je(e,t,n,r){return te(e,t,n,xe,V(e,0,r),V(e,r+1,-1),r)}var Te=function(e,t,n){for(var r=0,o=0;r=o,o=ae(),38===r&&12===o&&(t[n]=1),!se(o);)oe();return le(e,J)},Me=new WeakMap,$e=function(e){if("rule"===e.type&&e.parent&&!(e.length<1)){for(var t=e.value,n=e.parent,r=e.column===n.column&&e.line===n.line;"rule"!==n.type;)if(!(n=n.parent))return;if((1!==e.props.length||58===t.charCodeAt(0)||Me.get(n))&&!r){Me.set(e,!0);for(var o=[],a=function(e,t){return ue(function(e,t){var n=-1,r=44;do{switch(se(r)){case 0:38===r&&12===ae()&&(t[n]=1),e[n]+=Te(J-1,t,n);break;case 2:e[n]+=pe(r);break;case 4:if(44===r){e[++n]=58===ae()?"&\f":"",t[n]=e[n].length;break}default:e[n]+=R(r)}}while(r=oe());return e}(ce(e),t))}(t,o),i=n.props,l=0,s=0;l6)switch(W(e,t+1)){case 109:if(45!==W(e,t+4))break;case 102:return H(e,/(.+:)(.+)-([^]+)/,"$1"+ve+"$2-$3$1"+he+(108==W(e,t+3)?"$3":"$2-$3"))+e;case 115:return~K(e,"stretch")?Fe(H(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(115!==W(e,t+1))break;case 6444:switch(W(e,U(e)-3-(~K(e,"!important")&&10))){case 107:return H(e,":",":"+ve)+e;case 101:return H(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+ve+(45===W(e,14)?"inline-":"")+"box$3$1"+ve+"$2$3$1"+be+"$2box$3")+e}break;case 5936:switch(W(e,t+11)){case 114:return ve+e+be+H(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return ve+e+be+H(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return ve+e+be+H(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return ve+e+be+e+e}return e}var De=[function(e,t,n,r){if(e.length>-1&&!e.return)switch(e.type){case xe:e.return=Fe(e.value,e.length);break;case ke:return Ce([ne(e,{value:H(e.value,"@","@"+ve)})],r);case we:if(e.length)return function(e,t){return e.map(t).join("")}(e.props,(function(t){switch(function(e,t){return(e=/(::plac\w+|:read-\w+)/.exec(e))?e[0]:e}(t)){case":read-only":case":read-write":return Ce([ne(e,{props:[H(t,/:(read-\w+)/,":-moz-$1")]})],r);case"::placeholder":return Ce([ne(e,{props:[H(t,/:(plac\w+)/,":"+ve+"input-$1")]}),ne(e,{props:[H(t,/:(plac\w+)/,":-moz-$1")]}),ne(e,{props:[H(t,/:(plac\w+)/,be+"input-$1")]})],r)}return""}))}}],Be=function(e){var t=e.key;if("css"===t){var n=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(n,(function(e){-1!==e.getAttribute("data-emotion").indexOf(" ")&&(document.head.appendChild(e),e.setAttribute("data-s",""))}))}var r,o,a=e.stylisPlugins||De,i={},l=[];r=e.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+t+' "]'),(function(e){for(var t=e.getAttribute("data-emotion").split(" "),n=1;n=4;++r,o-=4)t=1540483477*(65535&(t=255&e.charCodeAt(r)|(255&e.charCodeAt(++r))<<8|(255&e.charCodeAt(++r))<<16|(255&e.charCodeAt(++r))<<24))+(59797*(t>>>16)<<16),n=1540483477*(65535&(t^=t>>>24))+(59797*(t>>>16)<<16)^1540483477*(65535&n)+(59797*(n>>>16)<<16);switch(o){case 3:n^=(255&e.charCodeAt(r+2))<<16;case 2:n^=(255&e.charCodeAt(r+1))<<8;case 1:n=1540483477*(65535&(n^=255&e.charCodeAt(r)))+(59797*(n>>>16)<<16)}return(((n=1540483477*(65535&(n^=n>>>13))+(59797*(n>>>16)<<16))^n>>>15)>>>0).toString(36)}(o)+s;return{name:c,styles:o,next:Ue}},qe=!!$.useInsertionEffect&&$.useInsertionEffect,Xe=qe||function(e){return e()},Ze=(qe||$.useLayoutEffect,$.createContext("undefined"!=typeof HTMLElement?Be({key:"css"}):null));Ze.Provider;var Je=$.createContext({}),Qe=function(e,t,n){var r=e.key+"-"+t.name;!1===n&&void 0===e.registered[r]&&(e.registered[r]=t.styles)},et=D,tt=function(e){return"theme"!==e},nt=function(e){return"string"==typeof e&&e.charCodeAt(0)>96?et:tt},rt=function(e,t,n){var r;if(t){var o=t.shouldForwardProp;r=e.__emotion_forwardProp&&o?function(t){return e.__emotion_forwardProp(t)&&o(t)}:o}return"function"!=typeof r&&n&&(r=e.__emotion_forwardProp),r},ot=function(e){var t=e.cache,n=e.serialized,r=e.isStringTag;return Qe(t,n,r),Xe((function(){return function(e,t,n){Qe(e,t,n);var r=e.key+"-"+t.name;if(void 0===e.inserted[t.name]){var o=t;do{e.insert(t===o?"."+r:"",o,e.sheet,!0),o=o.next}while(void 0!==o)}}(t,n,r)})),null},at=function e(t,n){var r,o,a=t.__emotion_real===t,i=a&&t.__emotion_base||t;void 0!==n&&(r=n.label,o=n.target);var l=rt(t,n,a),s=l||nt(i),c=!s("as");return function(){var u=arguments,p=a&&void 0!==t.__emotion_styles?t.__emotion_styles.slice(0):[];if(void 0!==r&&p.push("label:"+r+";"),null==u[0]||void 0===u[0].raw)p.push.apply(p,u);else{p.push(u[0][0]);for(var f=u.length,d=1;d1;return(0,o.createElement)(a.Flex,{className:"noptin-component__field-lg",wrap:!0},(0,o.createElement)(a.FlexItem,null,(0,o.createElement)(a.SelectControl,{label:(0,i.__)("If","newsletter-optin-box"),hideLabelFromVision:!0,value:n||"allow",options:pt,onChange:function(e){return l("action",e)},size:"default",__nextHasNoMarginBottom:!0})),s&&(0,o.createElement)(o.Fragment,null,(0,o.createElement)(a.FlexItem,null,(0,o.createElement)(a.SelectControl,{label:(0,i.__)("all","newsletter-optin-box"),hideLabelFromVision:!0,value:t||"all",options:ft,onChange:function(e){return l("type",e)},size:"default",__nextHasNoMarginBottom:!0})),(0,o.createElement)(a.FlexBlock,null,(0,i.__)("of the following rules are true:","newsletter-optin-box"))))}function gt(e){var t,n=e.rule,l=e.comparisons,s=e.availableSmartTags,c=e.index,u=e.updateRule,p=e.removeRule,f=(0,o.useCallback)((function(e){return u(c,"value",e)}),[c,u]),d=(0,o.useCallback)((function(e){return u(c,"condition",e)}),[c,u]),m=(0,o.useCallback)((function(){return p(c)}),[c,p]),g=(0,o.useMemo)((function(){var e=n.type;if(void 0!==s[e])return s[e];var t,o=e.replace("_",".",1);if(void 0!==s[o])return s[o];for(var a=0,i=Object.entries(s);a> ").concat(t)}),[n.type,s]),b=dt((t=null==g?void 0:g.options,(0,o.useMemo)((function(){return t?Array.isArray(t)?t.map((function(e,t){return{label:e,value:t}})):Object.keys(t).map((function(e){return{label:t[e],value:e}})):[]}),[t])),(0,i.__)("Select a value","newsletter-optin-box")),h=b.length>1,v=(null==g?void 0:g.conditional_logic)||"string",_=dt((0,o.useMemo)((function(){var e=[];return Object.keys(l).forEach((function(t){var n=l[t].type;if(h){if("string"===v&&"is"!=t&&"is_not"!=t)return;if("is_empty"===t||"is_not_empty"===t||"is_between"===t)return}"any"!==n&&n!=v||e.push({label:l[t].name,value:t})})),e}),[v,l]),(0,i.__)("Select a comparison","newsletter-optin-box")),w="is_empty"===n.condition||"is_not_empty"===n.condition;return(0,o.createElement)(a.Flex,{className:"noptin-component__field-lg",wrap:!0,expanded:!0},(0,o.createElement)(a.FlexBlock,null,(0,o.createElement)(st,ut({},function(e){if(["subscribed","active","yes","true","1"].includes(e))return{backgroundColor:"#78c67a",color:"#111111"};if(["unsubscribed","inactive","no","false","0"].includes(e))return{backgroundColor:"#fbcfbd",color:"#241c15"};if(["pending","waiting","maybe","2"].includes(e))return{backgroundColor:"#fbeeca",color:"#241c15"};var t=T(e,{saturation:[60,100],lightness:[30,45]});return{backgroundColor:t.color,color:t.isLight?"#111111":"#ffffff"}}(y)),y)),(0,o.createElement)(a.FlexBlock,null,(0,o.createElement)(a.Flex,{justify:"flex-end",wrap:!0},(0,o.createElement)(a.FlexItem,null,(0,o.createElement)(a.SelectControl,{label:(0,i.__)("Comparison","newsletter-optin-box"),hideLabelFromVision:!0,value:n.condition?n.condition:"is",options:_,onChange:d,size:"default",__nextHasNoMarginBottom:!0})),!w&&(0,o.createElement)(a.FlexBlock,null,h&&(0,o.createElement)(a.SelectControl,{label:(0,i.__)("Value","newsletter-optin-box"),hideLabelFromVision:!0,value:n.value?n.value:"",options:b,onChange:f,size:"default",__nextHasNoMarginBottom:!0}),!h&&(0,o.createElement)(a.TextControl,{type:"number"===v?"number":"text",label:(0,i.__)("Value","newsletter-optin-box"),hideLabelFromVision:!0,value:n.value?n.value:"",onChange:f,__nextHasNoMarginBottom:!0})),(0,o.createElement)(a.FlexItem,null,(0,o.createElement)(a.Button,{onClick:m,icon:"trash",variant:"tertiary",isDestructive:!0})))))}function yt(e){var t=e.rules,n=e.comparisons,r=e.availableSmartTags,a=e.setConditionalLogicAttribute,l=(0,o.useMemo)((function(){return Array.isArray(t)?t.filter((function(e){return e.type&&""!==e.type})):[]}),[r]),s=(0,o.useMemo)((function(){var e={};return r.forEach((function(t){t.conditional_logic&&(e[t.smart_tag]=ut(ut({},t),{},{key:t.smart_tag,type:t.conditional_logic}))})),e}),[r]),c=(0,o.useCallback)((function(e){var t=d(l);t.splice(e,1),a("rules",t)}),[l,a]),u=(0,o.useCallback)((function(e,t,n){var r=d(l);r[e][t]=n,a("rules",r)}),[l,a]),p=(0,o.useMemo)((function(){return Object.values(s)}),[s]),f=(0,o.useCallback)((function(e){var t=s[e],n=(null==t?void 0:t.options)||[],r=(null==t?void 0:t.placeholder)||"",o=Array.isArray(n)&&n.length?Object.keys(n)[0]:r;null!=t&&t.default&&(o=t.default);var i=d(l);i.push({type:e,condition:"is",value:o}),a("rules",i)}),[l]),m=l.length?(0,i.__)("Add a rule","newsletter-optin-box"):(0,i.__)("Add another rule","newsletter-optin-box"),g=At({availableSmartTags:p,onMergeTagClick:f,raw:!0,icon:"plus",label:m,text:m,toggleProps:{variant:"secondary"}});return(0,o.createElement)("div",{className:"noptin-conditional-logic-rules"},l.map((function(e,t){return(0,o.createElement)(gt,{key:t,rule:e,index:t,updateRule:u,removeRule:c,comparisons:n,availableSmartTags:s})})),g)}function bt(e){var t=e.onChange,n=e.value,r=e.comparisons,l=e.toggleText,s=e.availableSmartTags,c=e.className;"object"!==p(n)&&(n={enabled:!1,action:"allow",rules:[{condition:"is",type:"date",value:""}],type:"all"});var u=function(e,r){t(ut(ut({},n),{},f({},e,r)))};return(0,o.createElement)("div",{className:c},(0,o.createElement)(a.ToggleControl,{checked:!!n.enabled,onChange:function(e){return u("enabled",e)},className:"noptin-component__field",label:l||(0,i.__)("Optionally enable/disable this trigger depending on specific conditions.","newsletter-optin-box"),__nextHasNoMarginBottom:!0}),n.enabled&&(0,o.createElement)(o.Fragment,null,(0,o.createElement)(mt,{ruleCount:Array.isArray(n.rules)?n.rules.length:0,type:n.type,action:n.action,setConditionalLogicAttribute:u}),(0,o.createElement)(yt,{rules:n.rules,comparisons:r,availableSmartTags:s,setConditionalLogicAttribute:u})))}var ht={"==":function(e,t){return e==t},"===":function(e,t){return e===t},"!=":function(e,t){return e!=t},"!==":function(e,t){return e!==t},">":function(e,t){return e>t},">=":function(e,t){return e>=t},"<":function(e,t){return e0&&(v=(0,o.createElement)(a.DropdownMenu,St({icon:p,label:d},g),(function(e){var t=e.onClose;return(0,o.createElement)(o.Fragment,null,Object.keys(b).map((function(e,n){return(0,o.createElement)(a.MenuGroup,{label:h>1?e:void 0,key:n},b[e].map((function(e){return(0,o.createElement)(a.MenuItem,{icon:e.icon||y,iconPosition:"left",onClick:function(){if(l){var n=c?e.smart_tag:"[[".concat((r=e).example?r.example:r.default?"".concat(r.smart_tag,' default="').concat(r.default,'"'):"".concat(r.smart_tag),"]]");l(n)}var r;t()},key:e.smart_tag},e.label)})))})))}))),v}function jt(e){var t=e.setting,n=e.availableSmartTags,r=e.value,l=e.onChange,s=m(e,xt),c=(0,a.useBaseControlProps)(s),u=c.baseControlProps,p=c.controlProps;Array.isArray(r)||(r=[]);var f=(0,o.useCallback)((function(e){var t=e.item,s=e.index;return(0,o.createElement)(a.Flex,{className:"noptin-repeater-item",wrap:!0},Pt.map((function(e,a){return(0,o.createElement)(Tt,{key:a,availableSmartTags:n,field:e,value:void 0===t[e.id]?"":t[e.id],onChange:function(t){var n=d(r);n[s][e.id]=t,l(n)}})})),(0,o.createElement)(a.FlexItem,null,(0,o.createElement)(a.Button,{icon:"trash",variant:"tertiary",className:"noptin-component__field",label:(0,i.__)("Delete","noptin-addons-pack"),showTooltip:!0,onClick:function(){var e=d(r);e.splice(s,1),l(e)},isDestructive:!0})))}),[r,l]);return(0,o.createElement)(a.BaseControl,St({},u),(0,o.createElement)("div",St({},p),r.map((function(e,t){return(0,o.createElement)(f,{key:t,item:e,index:t})})),(0,o.createElement)(a.Button,{onClick:function(){var e=d(r);e.push({}),l(e)},variant:"secondary"},t.add_field?t.add_field:(0,i.__)("Add","newsletter-optin-box"))))}function Tt(e){var t=e.field,n=e.availableSmartTags,r=e.value,l=e.onChange,s=At({availableSmartTags:n,onMergeTagClick:(0,o.useCallback)((function(e){l&&l(r?"".concat(r," ").concat(e).trim():e)}),[r,l])});return(0,o.createElement)(a.FlexBlock,null,(0,o.createElement)(a.__experimentalInputControl,{label:t.label,type:t.type,value:r,placeholder:(0,i.sprintf)((0,i.__)("Enter %s","noptin-addons-pack"),t.label),className:"noptin-component__field noptin-condition-field",suffix:s,onChange:l,isPressEnterToChange:!0,__nextHasNoMarginBottom:!0,__next36pxDefaultSize:!0}))}function Mt(e){e.setting;var t=e.value,n=e.options,r=e.onChange,i=m(e,kt),l=(0,a.useBaseControlProps)(i),s=l.baseControlProps,c=l.controlProps;return Array.isArray(t)||(t=[]),(0,o.createElement)(a.BaseControl,St({},s),(0,o.createElement)("div",St({},c),n.map((function(e,n){return(0,o.createElement)(a.CheckboxControl,{key:n,label:e.label,checked:t.includes(e.value),onChange:function(n){r(n?[].concat(d(t),[e.value]):t.filter((function(t){return t!==e.value})))}})}))))}function $t(e){var t=e.settingKey,n=e.setting,r=e.availableSmartTags,l=e.prop,s=e.saved,c=e.setAttributes,u=(0,o.useCallback)((function(e){if(!l)return c(f({},t,e));var n=s[l]?s[l]:{},r=f({},l,St(St({},n),{},f({},t,e)));c(r)}),[t,l,s,c]);if(n.if||n.restrict){var p=n.restrict?n.restrict.split("."):n.if.split(".");if(!(2!==p.length||s[p[0]]&&s[p[0]][p[1]]))return null;if(1===p.length&&!s[p[0]])return null}if(Array.isArray(n.conditions)){var d=n.conditions.every((function(e){var t=e.key.split("."),n=e.operator?e.operator:"==",r=s[t[0]];return 2===t.length?r&&r[t[1]]&&vt(e.value,n,r[t[1]]):vt(e.value,n,r)}));if(!d)return null}if(n.condition&&!n.condition(s))return null;var m=s[t];l&&(m=s[l]?s[l][t]:void 0),(void 0===m||n.disabled)&&(m=n.default);var g=void 0!==m&&""!==m&&null!==m,y=[];n.options&&(y=Object.keys(n.options).map((function(e){return{label:n.options[e],value:e}})));var b=n.fullWidth?"noptin-component__field noptin-component__field-".concat(t):"noptin-component__field-lg noptin-component__field-".concat(t),h=n.description?(0,o.createElement)("span",{dangerouslySetInnerHTML:{__html:n.description}}):"",v=n.customAttributes?n.customAttributes:{},_=St({label:n.label,value:g?m:"",onChange:u,className:"".concat(b),help:h},v);return"select"===n.el?(y.unshift({label:n.placeholder?n.placeholder:(0,i.__)("Select an option","newsletter-optin-box"),value:"",disabled:!n.canSelectPlaceholder}),(0,o.createElement)(a.SelectControl,St(St({},_),{},{options:y,__nextHasNoMarginBottom:!0,__next36pxDefaultSize:!0}))):"form_token"===n.el?(0,o.createElement)(a.FormTokenField,St(St({},_),{},{value:Array.isArray(_.value)?_.value:[],suggestions:Array.isArray(n.suggestions)?n.suggestions:[],__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0})):"multi_checkbox"===n.el||"multi_checkbox_alt"===n.el?(0,o.createElement)(Mt,St(St({},_),{},{options:y})):"conditional_logic"===n.el?(0,o.createElement)(bt,St(St({},_),{},{availableSmartTags:r,comparisons:n.comparisons,toggleText:n.toggle_text})):"input"===n.el?n.type&&["toggle","switch","checkbox","checkbox_alt"].includes(n.type)?(0,o.createElement)(a.ToggleControl,St(St({},_),{},{checked:!!g&&m,onChange:function(e){u(e)}})):(0,o.createElement)(Ot,St(St({},_),{},{setting:n,availableSmartTags:"trigger_settings"===l?[]:r,isPressEnterToChange:!n.isInputToChange})):"textarea"===n.el?(0,o.createElement)(a.TextareaControl,St(St({},_),{},{setting:n,placeholder:n.placeholder?n.placeholder:"",__nextHasNoMarginBottom:!0})):"paragraph"===n.el?(0,o.createElement)("div",{className:b},(0,o.createElement)(a.Tip,null,n.content)):"hero"===n.el?(0,o.createElement)("div",{className:b},(0,o.createElement)("h3",null,n.content)):"key_value_repeater"===n.el||"webhook_key_value_repeater"===n.el?(0,o.createElement)(jt,St(St({},_),{},{setting:n,availableSmartTags:"trigger_settings"===l?[]:r})):t}function Nt(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 Ft(e){for(var t=1;t".concat(It,"\n\n

").concat(Rt,"

"),if:"double_optin"},{settingKey:"pages_unsubscribe_page_message",label:(0,i.__)("Unsubscribe Page Message","newsletter-optin-box"),el:"textarea",help:(0,i.__)("This is the message shown to people after they unsubscribe from your newsletter.","newsletter-optin-box"),placeholder:"

".concat(zt,"

\n\n

").concat(Lt,"

")}],handler:Bt},{title:(0,i.__)("Email Sending","newsletter-optin-box"),description:(0,i.__)("Who's the sender of the emails you'll be sending?","newsletter-optin-box"),settings:[{settingKey:"from_name",label:(0,i.__)('"From" Name',"newsletter-optin-box"),el:"input",type:"text",help:(0,i.__)("How the sender name appears in outgoing emails","newsletter-optin-box")},{settingKey:"from_email",label:(0,i.__)('"From" Email',"newsletter-optin-box"),el:"input",type:"email",help:(0,i.__)("How the sender email appears in outgoing emails","newsletter-optin-box")},{settingKey:"reply_to",label:(0,i.__)('"Reply-to" Email',"newsletter-optin-box"),el:"input",type:"email",help:(0,i.__)("Where replies to your emails should be sent","newsletter-optin-box")}],handler:Bt},{title:(0,i.__)("Newsletter","newsletter-optin-box"),description:(0,i.__)("Subscribe to our newsletter to get the latest news and updates.","newsletter-optin-box"),settings:[{settingKey:"noptin_signup_name",label:(0,i.__)("Your Name","newsletter-optin-box"),el:"input",type:"text"},{settingKey:"noptin_signup_email",label:(0,i.__)("Your Email Address","newsletter-optin-box"),el:"input",type:"email"}],handler:function(e,t){e.noptin_signup_email.length>0&&window.fetch("https://noptin.com/wp-json/noptin/v1/subscribers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:e.noptin_signup_email,name:e.noptin_signup_name,source:"settings-wizard"})}).catch((function(e){console.error(e)})),t(e)}}];function Kt(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 Wt(e){var t=e.saved,n=r((0,o.useState)(0),2),l=n[0],s=n[1],c=l===Ht.length-1,u=0===l,p=Ht[l]?Ht[l]:null;return(0,o.createElement)(a.Card,{className:"noptin-settings-wizard noptin-component__section",style:{maxWidth:"520px"}},p&&(0,o.createElement)(Dt,function(e){for(var t=1;t ( compact( + schema.map( ( field ) => { + + // Abort for readonly and dynamic fields. + if ( field.readonly || field.is_dynamic || 'metadata' === field.name ) { + return null; + } + + // Abort for hidden fields... + if ( Array.isArray( hidden ) && hidden.includes( field.name ) ) { + return null; + } + + // ... and fields to ignore. + if ( Array.isArray( ignore ) && ignore.includes( field.name ) ) { + return null; + } + + return prepareField( field ); + } ) +) ); + +export const EditSchemaForm = ({record, onChange, schema, hidden, ignore, onSubmit, loading, children, isInner, slotName, submitText, error } ) => { + + // Prepare form fields. + const fields = useMemo( () => prepareEditableSchemaFields( schema, hidden, ignore ), [schema, hidden, ignore] ); + + return ( +
+ + {children} + + {fields.map( ( field ) => ( +
+ +
+ ) )} + + + {( fills ) => ( + fills.map( ( fill, index ) => ( + {fill} + ) ) + )} + + + + {submitText} + {loading && } + + + {error && ( + + {error.message} + + )} + +
+ ) +} + /** - * Allows the user to export all records. + * Displays the record creation form. * */ -export default function CreateRecord() { +const CreateRecordForm = withSchema( function CreateRecordForm( { namespace, collection, basePath = '', isInner = false, defaultProps = {}, schema: { schema, hidden, ignore } } ) { // Prepare the state. + const dispatch = useDispatch( `${namespace}/${collection}` ); + const [error, setError] = useState( null ); + const [loading, setLoading] = useState( false ); + const [record, setRecord] = useState( {} ); const navigateTo = useNavigateCollection(); - const { namespace, collection } = useParams(); - const dispatch = useDispatch( `${namespace}/${collection}` ); - const [ error, setError ] = useState( null ); - const [ loading, setLoading ] = useState( false ); - const [ record, setRecord ] = useState( {} ); - const schema = useCurrentSchema(); + const newIgnore = [ ...ignore, ...Object.keys(defaultProps) ]; // A function to create a new record. - const onCreateRecord = ( e ) => { + const handleSubmit = ( e ) => { e?.preventDefault(); @@ -43,11 +110,11 @@ export default function CreateRecord() { return; } - setLoading ( true ); + setLoading( true ); - dispatch.createRecord( record, dispatch ) + dispatch.createRecord( { ...record, ...defaultProps }, dispatch ) .then( ( savedRecord ) => { - navigateTo( savedRecord?.record?.id || '' ); + navigateTo( `${basePath}/${savedRecord.record.id}` ); } ) .catch( ( error ) => { setError( error ); @@ -66,71 +133,49 @@ export default function CreateRecord() { } } - // Prepare form fields. - const fields = useMemo( () => ( compact( - schema.data.schema.map( ( field ) => { - - // Abort for readonly and dynamic fields. - if ( field.readonly || field.is_dynamic ) { - return null; - } + // Display the add record form. + return ( +