Files
roi-theme/wp-content/plugins/wp-marketing-automations/admin/frontend/dist/33.57ce1ec716d687574d5c.js
root a22573bf0b Commit inicial - WordPress Análisis de Precios Unitarios
- WordPress core y plugins
- Tema Twenty Twenty-Four configurado
- Plugin allow-unfiltered-html.php simplificado
- .gitignore configurado para excluir wp-config.php y uploads

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 21:04:30 -06:00

1 line
431 KiB
JavaScript
Executable File
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
(window.webpackJsonp=window.webpackJsonp||[]).push([[33],{1069:function(e,t,n){"use strict";var r=n(76),a=n(0),o=n(1),i=n(3),c=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n={workflow:{name:Object(o.__)("Workflow","wp-marketing-automations"),link:t?"admin.php?page=autonami&path=/automation/".concat(e):"admin.php?page=autonami-automations&edit=".concat(e),redirect:!t}};return t&&(n.single_a_contacts={name:Object(o.__)("Contacts","wp-marketing-automations"),link:"admin.php?page=autonami&path=/automation/".concat(e,"/contacts"),showOnClick:!0},n.analytics={name:Object(o.__)("Analytics","wp-marketing-automations"),link:t?"admin.php?page=autonami&path=/automation/".concat(e,"/analytics"):"admin.php?page=autonami&path=/automation-v1/".concat(e,"/analytics"),isPro:!0,showOnClick:!0}),n.engagement={name:Object(o.__)("Engagements","wp-marketing-automations"),link:t?"admin.php?page=autonami&path=/automation/".concat(e,"/engagements"):"admin.php?page=autonami&path=/automation-v1/".concat(e,"/engagements"),isPro:!0,showOnClick:!0},Object(i.qc)()&&(n.orders={name:Object(o.__)("Orders","wp-marketing-automations"),link:t?"admin.php?page=autonami&path=/automation/".concat(e,"/orders"):"admin.php?page=autonami&path=/automation-v1/".concat(e,"/orders"),isPro:!0,showOnClick:!0}),n};t.a=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",i=arguments.length>3&&void 0!==arguments[3]&&arguments[3],l=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,u=arguments.length>6&&void 0!==arguments[6]&&arguments[6],f=arguments.length>7&&void 0!==arguments[7]&&arguments[7],m=arguments.length>8&&void 0!==arguments[8]&&arguments[8],b=bwfcrm_contacts_data&&bwfcrm_contacts_data.header_data?bwfcrm_contacts_data.header_data:{},p=(b.automation_nav,b.automationv2_nav),d=Object(r.a)(),h=d.setActiveMultiple,y=d.resetHeaderMenu,v=d.setL2NavType,O=d.setL2Nav,w=d.setBackLink,j=d.setL2Title,g=d.setL2Content,E=d.setBackLinkLabel,_=d.setL2NavAlign,k=d.setPageHeader,N=d.setTabHeader;return Object(a.useEffect)((function(){y(!0),!i&&v("menu");var r=c(s,f);m||O(s?r:p),e&&r.hasOwnProperty(e)&&r[e].hasOwnProperty("name")&&N(r[e].name),h({leftNav:"automations-v2",rightNav:e}),n&&w(n),s&&w(n&&!f?"admin.php?page=autonami&path=/automations-v1":"admin.php?page=autonami&path=/automations"),i||f&&s&&E(Object(o.__)("All Automations","wp-marketing-automations")),!f&&s&&E(Object(o.__)("All Automations","wp-marketing-automations")),s&&_("left"),t&&""!==t&&j(t),!n&&l&&g(l),k(Object(o.__)("Automations","wp-marketing-automations")),u&&O({})}),[e,f,m]),!0}},1070:function(e,t){e.exports=function(e,t,n,r){for(var a=e.length,o=n+(r?1:-1);r?o--:++o<a;)if(t(e[o],o,e))return o;return-1}},1074:function(e,t){e.exports=function(e){return e!=e}},1075:function(e,t){e.exports=function(e,t,n){for(var r=n-1,a=e.length;++r<a;)if(e[r]===t)return r;return-1}},1084:function(e,t,n){var r=n(1070),a=n(1074),o=n(1075);e.exports=function(e,t,n){return t==t?o(e,t,n):r(e,a,n)}},1091:function(e,t){var n=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");e.exports=function(e){return n.test(e)}},1130:function(e,t,n){},1162:function(e,t,n){},1164:function(e,t,n){"use strict";var r=n(0),a=n(6),o=n.n(a),i=n(2),c=n(57),l=n(1),s=n(9),u=n.n(s),f=n(8),m=(n(1165),n(3)),b=n(17);function p(e){return(p="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)}function d(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 h(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?d(Object(n),!0).forEach((function(t){y(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):d(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function y(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=p(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=p(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==p(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function v(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(s)throw a}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return O(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?O(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function O(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}t.a=function(e){var t=e.header,n=void 0===t?Object(l.__)("View Analytics","wp-marketing-automations"):t,a=e.icon,s=void 0===a?"analytic":a,p=e.automationId,d=e.analyticsId,y=e.mode,O=void 0===y?"":y,w=e.extraData,j=void 0===w?{}:w,g=v(Object(r.useState)(!0),2),E=g[0],_=g[1],k=v(Object(r.useState)(!1),2),N=k[0],S=k[1],P=v(Object(r.useState)({}),2),x=P[0],L=P[1],C=function(){parseInt(d)>0&&Object(m.ac)()?(_(!0),L({}),function(){try{var e=h(h({},j),{},{mode:O});u()({path:Object(m.A)("/automation/".concat(p,"/analytics/").concat(d,"?").concat(Object(b.stringify)(e))),method:"GET"}).then((function(e){200===e.code?Object(i.isEmpty)(e.result)||L(e.result):S(!0),_(!1)}))}catch(e){S(!0),_(!1)}}()):_(!1)},A=function(){var e,t=x.tile,n=void 0===t?[]:t;return N?Object(r.createElement)(r.Fragment,null,Object(l.__)("Error while fetching the Analytics.","wp-marketing-automations")):Object(m.ac)()?Object(r.createElement)(r.Fragment,null,Object(i.isEmpty)(n)?Object(r.createElement)("div",{className:"bwf-normal-text"},Object(l.__)("No analytics found.","wp-marketing-automations")):Object(r.createElement)("div",{className:"bwf-info-brick"},n.map((function(e,t){var n=e.label,a=void 0===n?"":n,o=e.value,i=void 0===o?"-":o;if(""!==a)return Object(r.createElement)("div",{className:"bwf-info-item",key:t},Object(r.createElement)("span",{className:"bwf-node-content-type"},a),Object(r.createElement)("span",{className:"bwf-node-content-label"},i))})))):(e=[{label:Object(l.__)("Sent","wp-marketing-automations")},{label:Object(l.__)("Open Rate","wp-marketing-automations")}],"email"===O&&e.push({label:Object(l.__)("Click Rate","wp-marketing-automations")},{label:Object(l.__)("Click to Open Rate","wp-marketing-automations")}),e.push({label:Object(l.__)("Revenue","wp-marketing-automations")},{label:Object(l.__)("Revenue/Contact","wp-marketing-automations")},{label:Object(l.__)("Unsubscribe Rate","wp-marketing-automations")}),Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"bwf-info-brick"},e.map((function(e,t){return Object(r.createElement)("div",{className:"bwf-info-item",key:t},Object(r.createElement)("span",{className:"bwf-node-content-type"},e.label),Object(r.createElement)("span",{className:"bwf-node-content-label"},"-"))}))),Object(r.createElement)("div",{className:"bwf_clear_10"}),Object(r.createElement)("div",{className:"bwf-normal-text"},Object(l.__)("Email Analytics is a PRO feature.","wp-marketing-automations")+" ",Object(r.createElement)("a",{target:"__blank",className:"bwf-normal-a-t bwf-font-light",href:Object(m.fb)("upgrade",{utm_medium:"Automation+Email+Analytics"})},Object(l.__)("Upgrade to PRO","wp-marketing-automations")))))};return Object(r.createElement)("div",{className:"bwf-info-popup"},Object(r.createElement)(c.a,{contentClassName:"bwf-info__popover",position:"top center",renderToggle:function(e){var t=e.onToggle,a=e.isOpen,i=o()("bwf-info__toggle bwf-cursor-pointer",{"is-opened":a});return Object(r.createElement)("div",{className:i,onClick:function(){t(),C()},"aria-expanded":a},Object(r.createElement)(f.a,{size:14,icon:s}),n)},renderContent:function(e){var t=e.onToggle;return Object(r.createElement)("div",{className:"bwf-info-popover-container"},Object(r.createElement)("div",{className:"bwf-info-popover-header"},Object(r.createElement)("div",{className:"bwf-info-header-text"},n,!Object(m.ac)()&&m.e),Object(r.createElement)("span",{className:"bwf-info-close",onClick:t},Object(r.createElement)(f.a,{icon:"close",size:20}))),Object(r.createElement)("div",{className:"bwf-info-popover-body"},Object(r.createElement)("div",{className:"bwf-info-wrapper"},Object(r.createElement)("div",{className:"bwf-info--content"},E?Object(r.createElement)("div",{className:"bwf-info-brick"},[1,2,3,4,5,6].map((function(e){return Object(r.createElement)("div",{className:"bwf-info-item",key:e},Object(r.createElement)("span",{className:"bwf-node-content-type"},Object(r.createElement)("div",{className:"bwf-placeholder-temp bwf-w-60 bwf-h-15"})),Object(r.createElement)("span",{className:"bwf-node-content-label"},Object(r.createElement)("div",{className:"bwf-placeholder-temp bwf-w-90 bwf-h-15"})))}))):A()))))},focusOnMount:!0}))}},1165:function(e,t,n){},1406:function(e,t,n){},1407:function(e,t,n){},1408:function(e,t,n){},1409:function(e,t,n){},1410:function(e,t,n){},1411:function(e,t,n){},1412:function(e,t,n){},1475:function(e,t,n){"use strict";n.r(t);var r=n(0),a=n(1062),o=n(2),i=n(6),c=n.n(i),l=n(1),s=(n(1128),n(8)),u=n(5),f=n(333),m=n(147),b=n(3);var p=n(9),d=n.n(p),h=(n(1130),n(55)),y=n(11),v=n(40),O=n(26);function w(e){return(w="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)}function j(){j=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof h?t:h,i=Object.create(o.prototype),c=new C(r||[]);return a(i,"_invoke",{value:S(e,n,c)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var m="suspendedStart",b="executing",p="completed",d={};function h(){}function y(){}function v(){}var O={};s(O,i,(function(){return this}));var g=Object.getPrototypeOf,E=g&&g(g(A([])));E&&E!==n&&r.call(E,i)&&(O=E);var _=v.prototype=h.prototype=Object.create(O);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function n(a,o,i,c){var l=f(e[a],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==w(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,i,c)}),(function(e){n("throw",e,i,c)})):t.resolve(u).then((function(e){s.value=e,i(s)}),(function(e){return n("throw",e,i,c)}))}c(l.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function S(t,n,r){var a=m;return function(o,i){if(a===b)throw Error("Generator is already running");if(a===p){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var c=r.delegate;if(c){var l=P(c,r);if(l){if(l===d)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=p,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=b;var s=f(t,n,r);if("normal"===s.type){if(a=r.done?p:"suspendedYield",s.arg===d)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(a=p,r.method="throw",r.arg=s.arg)}}}function P(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,P(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),d;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,d;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,d):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,d)}function x(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function C(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(x,this),this.reset(!0)}function A(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(w(t)+" is not iterable")}return y.prototype=v,a(_,"constructor",{value:v,configurable:!0}),a(v,"constructor",{value:y,configurable:!0}),y.displayName=s(v,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===y||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,v):(e.__proto__=v,s(e,l,"GeneratorFunction")),e.prototype=Object.create(_),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,c,(function(){return this})),t.AsyncIterator=N,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new N(u(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},k(_),s(_,l,"Generator"),s(_,i,(function(){return this})),s(_,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=A,C.prototype={constructor:C,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(L),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function a(r,a){return c.type="throw",c.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],c=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var l=r.call(i,"catchLoc"),s=r.call(i,"finallyLoc");if(l&&s){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,d):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),d},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),L(n),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var a=r.arg;L(n)}return a}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:A(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),d}},t}function g(e,t,n,r,a,o,i){try{var c=e[o](i),l=c.value}catch(e){return void n(e)}c.done?t(l):Promise.resolve(l).then(r,a)}function E(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){g(o,r,a,i,c,"next",e)}function c(e){g(o,r,a,i,c,"throw",e)}i(void 0)}))}}function _(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 k(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?_(Object(n),!0).forEach((function(t){N(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function N(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=w(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=w(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==w(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function S(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(s)throw a}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return P(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?P(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function P(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var x=function(e){var t=Object(r.useContext)(b.h),n=e.isOpen,a=e.onRequestClose,i=e.node,p=e.isEvent,w=void 0===p||p,g=e.automationID,_=i.id,N=Object(f.a)(),P=N.setNodeDatabyId,x=N.fetchAutomation,L=N.setAutomationData,C=N.showSidebar,A=Object(m.a)(),T=A.getEventsList,I=A.getActionsList,D=A.getAutomationSteps,M=A.getAutomationLinks,F=A.getCount,G=A.getAutomationData,z=A.getNodeDataByID,Y=A.getautomationMeta,U=w?T():I(),q=S(Object(r.useState)({loading:!1,status:!1}),2),B=q[0],R=q[1],H=U.group,V=void 0===H?[]:H,J=U.list,$=void 0===J?{}:J,W=U.subgroup,Q=void 0===W?[]:W,X=U.subgroup_priority,Z=void 0===X?{}:X,K=U.subgroup_desc,ee=void 0===K?{}:K,te=S(Object(r.useState)(""),2),ne=te[0],re=te[1],ae=S(Object(r.useState)(""),2),oe=ae[0],ie=ae[1],ce=S(Object(r.useState)(""),2),le=ce[0],se=ce[1],ue=S(Object(r.useState)(""),2),fe=ue[0],me=ue[1],be=S(Object(r.useState)(!1),2),pe=be[0],de=be[1],he=S(Object(r.useState)({status:!1}),2),ye=he[0],ve=he[1],Oe=D(),we=M(),je=F(),ge=G("data"),Ee=z(_),_e=Ee.data,ke=void 0===_e?{}:_e,Ne=Ee.stepId,Se=void 0===Ne?0:Ne,Pe=Y(),xe=Object.keys(Z).sort((function(e,t){return Z[e]-Z[t]})),Le=ge.source,Ce=void 0===Le?"":Le,Ae=ge.event,Te=void 0===Ae?"":Ae,Ie=function(e){var t=[],n="";return V.map((function(r){(Object(o.isArray)(r.subgroup)&&r.subgroup.includes(e)||Object(o.isObject)(r.subgroup)&&Object.values(r.subgroup).includes(e))&&(t=r.subgroup,n=r.group_slug)})),{acsubgp:t,acgrp:n}};Object(r.useEffect)((function(){if(Object(o.isEmpty)(V)||(""!=Ce||""!=Te)&&w){var e=Ie(Ce),t=e.acsubgp,n=e.acgrp;se(Object(o.isObject)(t)?Object.values(t):t),ie(n),me(Te)}else ie(V[0].group_slug),se(Object(o.isObject)(V[0].subgroup)?Object.values(V[0].subgroup):V[0].subgroup)}),[n]),Object(r.useEffect)((function(){if(Object(o.isEmpty)(ne))if(Object(o.isEmpty)(V)||(""!=Ce||""!=Te)&&w){var e=Ie(Ce),t=e.acsubgp,n=e.acgrp;se(Object(o.isObject)(t)?Object.values(t):t),ie(n),me(Te)}else ie(V[0].group_slug);else ie("")}),[ne]);var De,Me,Fe=function(){a&&a()},Ge=function(){var e=E(j().mark((function e(n,r,a,c){var s,u;return j().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=!1,c.hasOwnProperty("event")&&$.hasOwnProperty(c.event)&&$[c.event].hasOwnProperty("need_unique_key")&&$[c.event].need_unique_key&&(s=!0),u={},u=""==Te?{steps:Object(o.cloneDeep)(n).map((function(e){return e.hasOwnProperty("data")&&e.data.hasOwnProperty("sidebarValues")&&(e.data.sidebarValues={}),e})),links:r,count:a,data:c,need_unique_key:s}:{data:c,need_unique_key:s},e.prev=4,de(!0),t(Object(l.__)("Updating automation…","wp-marketing-automations")),e.next=9,d()({path:Object(b.A)("/automation/".concat(g)),method:"POST",data:{data:u}}).then(function(){var e=E(j().mark((function e(n){return j().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(200!==n.code){e.next=7;break}return e.next=3,x(g).then((function(){L("openStartSidebar",!0)})).then((function(){var e=Object(o.cloneDeep)(i);e.data.selected="start",L("sidebarNodeData",e),C(!0)}));case 3:t(n.message),Object(b.Lb)(t,3e3),e.next=8;break;case 7:throw Error(Object(b.u)(null==n?void 0:n.message));case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}());case 9:e.next=16;break;case 11:e.prev=11,e.t0=e.catch(4),Object(b.Lb)(t,3e3),de(!1),setTimeout((function(){R({status:!0,error:e.t0.message})}),[1500]);case 16:case"end":return e.stop()}}),e,null,[[4,11]])})));return function(t,n,r,a){return e.apply(this,arguments)}}(),ze=function(){var e=E(j().mark((function e(n,r){var a;return j().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a={steps:Object(o.cloneDeep)(Oe).map((function(e){return e.hasOwnProperty("data")&&e.data.hasOwnProperty("sidebarValues")&&(e.data.sidebarValues={}),e})),links:we,count:je,data:{action:{action:n,intergration:r}},updateStatus:2},e.prev=1,de(!0),t(Object(l.__)("Updating automation…","wp-marketing-automations")),e.next=6,d()({path:Object(b.A)("/automation/".concat(g,"/step/").concat(Se)),method:"POST",data:a}).then((function(e){if(200!==e.code)throw Error(Object(b.u)(null==e?void 0:e.message));P(i.id,{selected:n},{step_status:2}),e.hasOwnProperty("result")&&e.result.hasOwnProperty("meta")&&L("meta",k(k({},Pe),e.result.meta)),t(e.message)})).then((function(){var e=Object(o.cloneDeep)(i);e.data.selected=n,L("sidebarNodeData",e),C(!0),de(!1),Fe(),Object(b.Lb)(t,3e3)}));case 6:e.next=13;break;case 8:e.prev=8,e.t0=e.catch(1),Object(b.Lb)(t,3e3),de(!1),setTimeout((function(){R({status:!0,error:e.t0.message})}),[1500]);case 13:case"end":return e.stop()}}),e,null,[[1,8]])})));return function(t,n){return e.apply(this,arguments)}}(),Ye=function(e){if("string"==typeof e&&""!==e&&Te!==e)if("start"===_&&w)ke.evtGroup=$[e].source_type,ke.event=e,function(e){var t={};t=Oe.map((function(t){return"start"==t.id&&(t.data=e),t}));var n=[];1==Oe.length?(t.push({id:"end",type:"end",data:{label:Object(l.__)("End Automation","wp-marketing-automations")},hidden:!1,position:{x:250,y:600}}),n=[{id:"endlink",source:"start",target:"end",sourceHandle:"",animated:!1}]):n=Object(o.cloneDeep)(we);var r=Object(o.cloneDeep)(ge);r.event=e.event,r.source=e.evtGroup,Ge(t,n,2,r)}(ke);else{var n=$[e].integration_slug;ze(e,n)}else t(Te===e?Object(l.__)("Please choose a different event to save.","wp-marketing-automations"):w?Object(l.__)("Please choose an event.","wp-marketing-automations"):Object(l.__)("Please choose an action.","wp-marketing-automations")),Object(b.Lb)(t,3e3)};return n?Object(r.createElement)(u.Modal,{className:"bwf-admin-modal bwf-event-search-modal bwf-admin-modal-xl",shouldCloseOnClickOutside:!1,shouldCloseOnEsc:!1},Object(r.createElement)("div",{className:"bwf-modal-search-header"},Object(r.createElement)("div",{className:"bwf-modal-title"},w?Object(l.__)("Select an Event","wp-marketing-automations"):Object(l.__)("Select an Action","wp-marketing-automations")),Object(r.createElement)("div",{className:"bwf-modal-search-wrap"},Object(r.createElement)("div",{className:"bwf-component-search-control"},Object(r.createElement)(s.a,{icon:"search",size:15}),Object(r.createElement)(u.TextControl,{value:ne,onChange:re,placeholder:Object(l.__)("Search…","wp-marketing-automations")}))),Object(r.createElement)("div",{className:"bwf-modal-close bwf-cursor-pointer",onClick:Fe},Object(r.createElement)(s.a,{icon:"close",size:20}))),Object(r.createElement)("div",{className:"bwf-event-modal-main"},Object(r.createElement)("div",{className:"bwf-event-modal-body"},Object(r.createElement)("div",{className:"bwf-modal-sidebar"},Object(r.createElement)("div",{className:"bwf-modal-filter-wrap"},V.map((function(e,t){if(function(e){var t=!1;if(e.hasOwnProperty("subgroup")&&!Object(o.isEmpty)(e.subgroup)){var n=[];(Object(o.isObject)(e.subgroup)?Object.values(e.subgroup):e.subgroup).map((function(e){Q.hasOwnProperty(e)&&n.push(e)})),Object(o.isEmpty)(n)||(t=!0)}return t}(e))return Object(r.createElement)("div",{key:t,className:c()("bwf-modal-filter",{active:oe===e.group_slug}),onClick:function(){me(""),ie(e.group_slug),se(Object(o.isObject)(e.subgroup)?Object.values(e.subgroup):e.subgroup)}},e.label)})))),Object(r.createElement)("div",{className:"bwf-modal-content-content"},Object(r.createElement)("div",{className:"bwf-modal-content-brick"},Object(r.createElement)("div",{className:"modal-brick-wrap bwfan_pb20"},Object(r.createElement)("div",{className:"bwf-brick-content"},(De=[],Me={},Object(o.isEmpty)(ne)?le.map((function(e){Me=k(k({},Me),Q[e])})):Object.values(Q).map((function(e){Me=k(k({},Me),e)})),De.push(Me),De).map((function(e,t){if(Object(o.isEmpty)(e))return Object(r.createElement)(r.Fragment,{key:t});var n=[],a=Object.keys(e);return Object(o.isEmpty)(xe)?n=a:xe.map((function(e){a.includes(e)&&n.push(e)})),Object(r.createElement)("div",{key:t+"-2"},n.map((function(t,n){var a=[];return a=function(e){var t=[];return(Object(o.isObject)(e)?Object.values(e):e).map((function(e){if($.hasOwnProperty(e)&&$[e].hasOwnProperty(w?"event_name":"action_name")){var n=w?$[e].event_name:$[e].action_name;(Object(o.isEmpty)(ne)||n.toLowerCase().includes(ne.toLowerCase()))&&t.push(e)}})),t}(e[t]),!Object(o.isEmpty)(a)&&Object(r.createElement)(r.Fragment,{key:n},Object(r.createElement)("div",{className:"bwf-brick-content-header",key:n},t),ee.hasOwnProperty(t)&&""!==ee[t]&&Object(r.createElement)(O.a,{status:"warning",icon:"shield",className:"bwf-mtb-12"},ee[t]),a.map((function(e,t){var n=!!$[e].hasOwnProperty("lock")&&$[e].lock;return Object(r.createElement)(y.a,{key:t,isPrimary:fe===e,isSecondary:fe!==e,className:"bwf-secondary-alter "+(Object(b.ac)()?n?"locked":"":n?"not-pro locked":"not-pro"),onClick:function(){!Object(b.ac)()&&n?ve({status:!0,featureTitle:w?$[e].event_name:$[e].action_name}):me(e)},disabled:Object(b.ac)()&&n},fe===e&&Object(r.createElement)("span",{className:"bwf-circle-tick"},Object(r.createElement)(s.a,{icon:"tick",size:10})),w?$[e].event_name:$[e].action_name,n&&!Object(b.ac)()&&Object(r.createElement)("span",{className:"bwf-display-flex bwf-ml-5"},Object(r.createElement)(s.a,{icon:"king",size:15})))})))})))}))))),Object(r.createElement)("div",{className:"bwf-modal-inner-footer bwf_text_right"},Object(r.createElement)(y.a,{className:"bwf-modal-cancel-btn",onClick:Fe},Object(l.__)("Cancel","wp-marketing-automations")),Object(r.createElement)(y.a,{isPrimary:!0,isBusy:pe,className:"bwf-no-ripple",onClick:function(){pe||Ye(fe)}},Object(l.__)("Done","wp-marketing-automations")))))),Object(r.createElement)(h.a,{modalTitle:w?Object(l.__)("Event Selection","wp-marketing-automations"):Object(l.__)("Action Selection","wp-marketing-automations"),errorMessage:B.error,onRequestClose:function(){return R({status:!1})},isOpen:B.status}),!Object(b.ac)()&&Object(r.createElement)(v.b,{isOpen:ye.status,onRequestClose:function(){return ve({status:!1})},modalContent:{title:Object(l.sprintf)(Object(l.__)("%s is a PRO Event","wp-marketing-automations"),ye.featureTitle),proLink:Object(b.fb)("upgrade",{utm_medium:"Automation+Event+Upgrade+Modal"})}})):""};function L(e){return(L="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function C(){C=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof h?t:h,i=Object.create(o.prototype),c=new x(r||[]);return a(i,"_invoke",{value:k(e,n,c)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var m="suspendedStart",b="executing",p="completed",d={};function h(){}function y(){}function v(){}var O={};s(O,i,(function(){return this}));var w=Object.getPrototypeOf,j=w&&w(w(A([])));j&&j!==n&&r.call(j,i)&&(O=j);var g=v.prototype=h.prototype=Object.create(O);function E(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function _(e,t){function n(a,o,i,c){var l=f(e[a],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==L(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,i,c)}),(function(e){n("throw",e,i,c)})):t.resolve(u).then((function(e){s.value=e,i(s)}),(function(e){return n("throw",e,i,c)}))}c(l.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function k(t,n,r){var a=m;return function(o,i){if(a===b)throw Error("Generator is already running");if(a===p){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===d)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=p,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=b;var s=f(t,n,r);if("normal"===s.type){if(a=r.done?p:"suspendedYield",s.arg===d)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(a=p,r.method="throw",r.arg=s.arg)}}}function N(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),d;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,d;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,d):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,d)}function S(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(S,this),this.reset(!0)}function A(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(L(t)+" is not iterable")}return y.prototype=v,a(g,"constructor",{value:v,configurable:!0}),a(v,"constructor",{value:y,configurable:!0}),y.displayName=s(v,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===y||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,v):(e.__proto__=v,s(e,l,"GeneratorFunction")),e.prototype=Object.create(g),e},t.awrap=function(e){return{__await:e}},E(_.prototype),s(_.prototype,c,(function(){return this})),t.AsyncIterator=_,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new _(u(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},E(g),s(g,l,"Generator"),s(g,i,(function(){return this})),s(g,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=A,x.prototype={constructor:x,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function a(r,a){return c.type="throw",c.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],c=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var l=r.call(i,"catchLoc"),s=r.call(i,"finallyLoc");if(l&&s){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,d):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),d},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var a=r.arg;P(n)}return a}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:A(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),d}},t}function A(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 T(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?A(Object(n),!0).forEach((function(t){I(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):A(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function I(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=L(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=L(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==L(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function D(e,t,n,r,a,o,i){try{var c=e[o](i),l=c.value}catch(e){return void n(e)}c.done?t(l):Promise.resolve(l).then(r,a)}function M(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(s)throw a}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return F(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?F(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function F(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var G=function(e){var t=Object(r.useContext)(b.h),n=e.isOpen,a=e.onRequestClose,i=e.node,p=e.automationID,h=i.id,v=Object(f.a)(),O=v.setNodeDatabyId,w=v.setAutomationData,j=v.showSidebar,g=Object(m.a)(),E=g.getGoals,_=g.getAutomationSteps,k=g.getAutomationLinks,N=g.getCount,S=g.getNodeDataByID,P=(0,g.getautomationMeta)(),x=E(),L=x.group,A=void 0===L?[]:L,I=x.list,F=void 0===I?{}:I,G=x.subgroup,z=void 0===G?[]:G,Y=x.subgroup_priority,U=void 0===Y?{}:Y,q=M(Object(r.useState)(""),2),B=q[0],R=q[1],H=M(Object(r.useState)(""),2),V=H[0],J=H[1],$=M(Object(r.useState)(""),2),W=$[0],Q=$[1],X=M(Object(r.useState)(""),2),Z=X[0],K=X[1],ee=M(Object(r.useState)(!1),2),te=ee[0],ne=ee[1],re=_(),ae=k(),oe=N(),ie=S(h),ce=ie.data,le=void 0===ce?{}:ce,se=ie.stepId,ue=void 0===se?0:se,fe=U[V]?U[V]:{},me=le.source,be=void 0===me?"":me,pe=le.benchmark,de=void 0===pe?"":pe,he=function(e){var t=[],n="";return A.map((function(r){r.subgroup.includes(e)&&(t=r.subgroup,n=r.group_slug)})),{acsubgp:t,acgrp:n}};Object(r.useEffect)((function(){if(Object(o.isEmpty)(A)||""!=be||""!=de){var e=he(be),t=e.acsubgp,n=e.acgrp;Q(t),J(n),K(de)}else J(A[0].group_slug),Q(A[0].subgroup)}),[n]),Object(r.useEffect)((function(){if(Object(o.isEmpty)(B))if(Object(o.isEmpty)(A)||""!=be||""!=de){var e=he(be),t=e.acsubgp,n=e.acgrp;Q(t),J(n),K(de)}else J(A[0].group_slug);else J("")}),[B]);var ye,ve=function(){a&&a()},Oe=function(){var e,n=(e=C().mark((function e(n,r){var a,c;return C().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=le,ne(!0),a.benchmark=n,t(Object(l.__)("Adding benchmark..","wp-marketing-automations")),e.prev=4,c={steps:Object(o.cloneDeep)(re).map((function(e){return e.hasOwnProperty("data")&&e.data.hasOwnProperty("sidebarValues")&&(e.data.sidebarValues={}),e})),links:ae,count:oe,data:{action:{benchmark:n,source:r}},updateStatus:2},e.next=8,d()({path:Object(b.A)("/automation/".concat(p,"/step/").concat(ue)),method:"POST",data:c}).then((function(e){200===e.code&&(t(e.message),O(parseInt(h),a,{step_status:2}),e.hasOwnProperty("result")&&e.result.hasOwnProperty("meta")&&w("meta",T(T({},P),e.result.meta)))})).then((function(){var e=Object(o.cloneDeep)(i);e.data.benchmark=n,w("sidebarNodeData",e),j(!0),ne(!1),ve()}));case 8:e.next=14;break;case 10:e.prev=10,e.t0=e.catch(4),console.log(e.t0),ne(!0);case 14:Object(b.Lb)(t,3e3);case 15:case"end":return e.stop()}}),e,null,[[4,10]])})),function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){D(o,r,a,i,c,"next",e)}function c(e){D(o,r,a,i,c,"throw",e)}i(void 0)}))});return function(e,t){return n.apply(this,arguments)}}();return n?Object(r.createElement)(u.Modal,{className:"bwf-admin-modal bwf-event-search-modal bwf-admin-modal-xl",shouldCloseOnClickOutside:!1,shouldCloseOnEsc:!1},Object(r.createElement)("div",{className:"bwf-modal-search-header"},Object(r.createElement)("div",{className:"bwf-modal-title"},Object(l.__)("Select an Goal","wp-marketing-automations")),Object(r.createElement)("div",{className:"bwf-modal-search-wrap"},Object(r.createElement)("div",{className:"bwf-component-search-control"},Object(r.createElement)(s.a,{icon:"search",size:15}),Object(r.createElement)(u.TextControl,{value:B,onChange:R,placeholder:Object(l.__)("Search…..")}))),Object(r.createElement)("div",{className:"bwf-modal-close bwf-cursor-pointer",onClick:ve},Object(r.createElement)(s.a,{icon:"close",size:20}))),Object(r.createElement)("div",{className:"bwf-event-modal-main"},Object(r.createElement)("div",{className:"bwf-event-modal-body"},Object(r.createElement)("div",{className:"bwf-modal-sidebar"},Object(r.createElement)("div",{className:"bwf-modal-filter-wrap"},A.map((function(e,t){if(function(e){var t=!1;if(e.hasOwnProperty("subgroup")&&!Object(o.isEmpty)(e.subgroup)){var n=[];e.subgroup.map((function(e){z.hasOwnProperty(e)&&n.push(e)})),Object(o.isEmpty)(n)||(t=!0)}return t}(e))return Object(r.createElement)("div",{key:t,className:c()("bwf-modal-filter",{active:V===e.group_slug}),onClick:function(){K(""),J(e.group_slug),Q(e.subgroup)}},e.label)})))),Object(r.createElement)("div",{className:"bwf-modal-content-content"},Object(r.createElement)("div",{className:"bwf-modal-content-brick"},Object(r.createElement)("div",{className:"modal-brick-wrap bwfan_pb20"},Object(r.createElement)("div",{className:"bwf-brick-content"},(ye=[],Object(o.isEmpty)(B)&&!Object(o.isEmpty)(W)?W.map((function(e){ye.push(z[e])})):Object.values(z).map((function(e){ye.push(e)})),ye).map((function(e,t){if(Object(o.isEmpty)(e))return Object(r.createElement)("div",{key:t});var n=[];return n=fe&&Object.keys(fe).length>0?Object.keys(e).sort((function(e,t){return fe[e]||fe[t]?fe[e]&&!fe[t]?1:!fe[e]&&fe[t]?-1:fe[e]-fe[t]:1})):Object.keys(e),Object(r.createElement)("div",{key:t},n.map((function(t,n){var a=function(e){var t=[];return e.map((function(e){if(F.hasOwnProperty(e)&&F[e].hasOwnProperty("event_name")){var n=F[e].event_name;(Object(o.isEmpty)(B)||n.toLowerCase().includes(B.toLowerCase()))&&t.push(e)}})),t}(e[t]);return!Object(o.isEmpty)(a)&&Object(r.createElement)("div",{key:n},Object(r.createElement)("div",{className:"bwf-brick-content-header"},t),a.map((function(e){return Object(r.createElement)(y.a,{key:e,isPrimary:Z===e,isSecondary:Z!==e,className:"bwf-secondary-alter",onClick:function(){K(e)}},Z===e&&Object(r.createElement)("span",{className:"bwf-circle-tick"},Object(r.createElement)(s.a,{icon:"tick",size:10})),Object(r.createElement)(r.Fragment,null,F[e].event_name))})))})))}))))),Object(r.createElement)("div",{className:"bwf-modal-inner-footer bwf_text_right"},Object(r.createElement)(y.a,{className:"bwf-modal-cancel-btn",onClick:ve},Object(l.__)("Cancel","wp-marketing-automations")),Object(r.createElement)(y.a,{isPrimary:!0,className:"bwf-no-ripple",isBusy:te,onClick:function(){te||function(e){if("string"==typeof e&&""!==e){var n=F[e].source_type;Oe(e,n)}else t(Object(l.__)("Please choose an benchmark.","wp-marketing-automations")),Object(b.Lb)(t,3e3)}(Z)}},Object(l.__)("Done","wp-marketing-automations"))))))):""},z=function(e){var t=e.onNodeClick,n=e.onNoteToggleClick,a=e.onElipsisToggleClick,o=e.onInfoToggleClick,i=e.onNodeStatClick,c=e.onNodeQueuedStatClick,l=e.onNodeFailedStatClick,s=e.onAnalyticsClick,u=e.onNodeSkippedStatClick,f=Object(m.a)(),b=f.getEnableCopy,p=f.getEnableMove,d=b(),h=p(),y=Object(r.useCallback)((function(e,t){var n=!(!e.target||"string"!=typeof e.target.className)&&e.target.className;return!!n&&n.includes(t)||e.target.closest("."+t)}),[]);return function(e){if(!d&&!h)if(y(e,"bwf-note__toggle"))n&&n();else if(y(e,"bwf-ellipsis-menu__toggle"))a&&a();else if(y(e,"bwf-info__toggle"))o&&o();else if(y(e,"bwf-queued-status-wrap"))c&&c();else if(y(e,"bwf-failed-status-wrap"))l&&l();else if(y(e,"bwf-skipped-status-wrap"))u&&u();else if(y(e,"bwf-node-analytics"))s&&s();else if(y(e,"bwf-status-wrap"))i&&i();else{var r=y(e,"bwf-ellipsis-menu"),f=y(e,"bwf-note-popup"),m=y(e,"bwf-info-popup");r||f||m||t&&t()}}},Y=n(62),U=n(19),q=n(61),B=n(12);function R(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(s)throw a}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return H(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?H(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function H(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var V=function(e){var t=e.selected,n=void 0!==t&&t,i=R(Object(r.useState)(!1),2),c=i[0],u=i[1],p=Object(m.a)(),d=p.getEventsList,h=p.getAutomationData,y=p.getOpenStartSidebar,v=p.getEnableMove,O=p.getEnableCopy,w=p.getStatLoading,j=p.getStatData,g=O(),E=v(),_=h(),k=y(),N=w(),S=j(),P=_.ID,L=_.event,C=void 0===L?"":L,A=S.hasOwnProperty("start")?S.start:{};Object(r.useEffect)((function(){k&&(I("sidebarNodeData",e),D(!0))}),[k]);var T=Object(f.a)(),I=T.setAutomationData,D=T.showSidebar,M=d(),F=z({onNodeClick:!Object(o.isEmpty)(C)&&M.list.hasOwnProperty(C)&&function(){Object(B.l)({stepid:"start"},"/"),M.list[C].hasOwnProperty("fields")&&!Object(o.isEmpty)(M.list[C].fields)&&(I("sidebarNodeData",e),D(!0))},onNodeStatClick:function(){I("showContactModalId",C),I("showContactModalType","completed")},onNodeQueuedStatClick:function(){I("showContactModalId",C),I("showContactModalType","active")}});return Object(r.createElement)("div",{className:"bwf-node-wrapper"},Object(r.createElement)("div",{className:"bwf-inner-wrapper "+(n?"bwf-selected-node":"")+(Object(o.isEmpty)(C)?" bwf-empty-start-node":""),onClick:F},Object(o.isEmpty)(C)?Object(r.createElement)("div",{className:"bwf-node-brick is-start-node",onClick:function(){return u(!0)}},Object(r.createElement)("div",{className:"bwf-node-icon"},Object(r.createElement)(s.a,{size:22,icon:"tap-icon"})),Object(r.createElement)("div",{className:"bwf-display-flex bwf-h4"},Object(l.__)("Select an Event","wp-marketing-automations"))):Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"bwf-node-brick is-start-node-selected"},Object(r.createElement)("div",{className:"bwf-node-icon icon-start"},Object(r.createElement)(s.a,{size:22,icon:"rocket"})),Object(r.createElement)("div",{className:"bwf-node-inner-content"},Object(r.createElement)("div",{className:"bwf-node-content-type"},M.list.hasOwnProperty(C)&&M.list[C].hasOwnProperty("source_label")?M.list[C].source_label:""),Object(r.createElement)("div",{className:"bwf-node-content-label"},M.list.hasOwnProperty(C)&&M.list[C].hasOwnProperty("event_name")?M.list[C].event_name:Object(l.__)("Event Not Found","wp-marketing-automations"))),Object(r.createElement)("div",{className:"bwf-node-action"},!Object(o.isEmpty)(C)&&Object(r.createElement)(r.Fragment,null,Object(r.createElement)(q.a,{label:Object(l.__)("Quick Actions","wp-marketing-automations"),classes:"bwf-event-action",isDisable:!(!g&&!E),renderContent:function(e){var t=e.onToggle;return Object(r.createElement)(r.Fragment,null,Object(r.createElement)(Y.a,{isClickable:!0,onInvoke:function(){u(!0),t()}},Object(r.createElement)(U.a,{justify:"flex-start"},Object(r.createElement)(U.c,null,Object(l.__)("Change Event","wp-marketing-automations")))))}})))),Object(r.createElement)("div",{className:"bwf-node-status bwf-node-m-0"},Object(r.createElement)("div",{className:"bwf-queued-status-wrap"},Object(r.createElement)("span",{className:"bwf-node-status-label"},Object(l.__)("Active","wp-marketing-automations")),Object(r.createElement)("span",{className:"bwf-node-status-count"},N?Object(r.createElement)("div",{className:"bwf-placeholder-temp bwf-w-20 bwf-h-10"}):Object(r.createElement)(r.Fragment,null,A.hasOwnProperty("active")?Object(b.tc)(parseInt(A.active)):0))),Object(r.createElement)("div",{className:"bwf-status-wrap"},Object(r.createElement)("span",{className:"bwf-node-status-label"},Object(l.__)("Completed","wp-marketing-automations")),Object(r.createElement)("span",{className:"bwf-node-status-count"},N?Object(r.createElement)("div",{className:"bwf-placeholder-temp bwf-w-20 bwf-h-10"}):Object(r.createElement)(r.Fragment,null,A.hasOwnProperty("completed")?Object(b.tc)(parseInt(A.completed)):0)))))),!Object(o.isEmpty)(C)&&Object(r.createElement)(a.d,{type:"source",position:"bottom",isConnectable:!1}),Object(r.createElement)(x,{isOpen:c,node:e,onRequestClose:function(){return u(!1)},automationID:P}))},J=(n(57),n(1406),n(41));function $(e){return($="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)}function W(){W=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof h?t:h,i=Object.create(o.prototype),c=new x(r||[]);return a(i,"_invoke",{value:k(e,n,c)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var m="suspendedStart",b="executing",p="completed",d={};function h(){}function y(){}function v(){}var O={};s(O,i,(function(){return this}));var w=Object.getPrototypeOf,j=w&&w(w(L([])));j&&j!==n&&r.call(j,i)&&(O=j);var g=v.prototype=h.prototype=Object.create(O);function E(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function _(e,t){function n(a,o,i,c){var l=f(e[a],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==$(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,i,c)}),(function(e){n("throw",e,i,c)})):t.resolve(u).then((function(e){s.value=e,i(s)}),(function(e){return n("throw",e,i,c)}))}c(l.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function k(t,n,r){var a=m;return function(o,i){if(a===b)throw Error("Generator is already running");if(a===p){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===d)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=p,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=b;var s=f(t,n,r);if("normal"===s.type){if(a=r.done?p:"suspendedYield",s.arg===d)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(a=p,r.method="throw",r.arg=s.arg)}}}function N(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),d;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,d;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,d):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,d)}function S(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(S,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError($(t)+" is not iterable")}return y.prototype=v,a(g,"constructor",{value:v,configurable:!0}),a(v,"constructor",{value:y,configurable:!0}),y.displayName=s(v,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===y||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,v):(e.__proto__=v,s(e,l,"GeneratorFunction")),e.prototype=Object.create(g),e},t.awrap=function(e){return{__await:e}},E(_.prototype),s(_.prototype,c,(function(){return this})),t.AsyncIterator=_,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new _(u(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},E(g),s(g,l,"Generator"),s(g,i,(function(){return this})),s(g,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=L,x.prototype={constructor:x,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function a(r,a){return c.type="throw",c.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],c=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var l=r.call(i,"catchLoc"),s=r.call(i,"finallyLoc");if(l&&s){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,d):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),d},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var a=r.arg;P(n)}return a}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),d}},t}function Q(e,t,n,r,a,o,i){try{var c=e[o](i),l=c.value}catch(e){return void n(e)}c.done?t(l):Promise.resolve(l).then(r,a)}function X(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(s)throw a}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Z(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Z(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Z(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var K=function(e){var t,n,a=e.node,i=a.id,p=void 0===i?"":i,h=a.data,y=Object(r.useContext)(b.h),v=X(Object(r.useState)(!1),2),O=v[0],w=v[1],j=X(Object(r.useState)(h.hasOwnProperty("note")?h.note:""),2),g=j[0],E=j[1],_=X(Object(r.useState)(!1),2),k=_[0],N=_[1],S=Object(f.a)().setNodeDatabyId,P=Object(m.a)(),x=P.getAutomationData,L=P.getNodeDataByID,C=P.getEnableMove,A=P.getEnableCopy,T=C(),I=A(),D=Object(o.isEmpty)(p)?{}:L(p),M=D.stepId,F=void 0===M?0:M,G=D.data,z=(void 0===G?{}:G).note,U=void 0===z?"":z,B=x().ID,R=function(){var e,t=(e=W().mark((function e(t){return W().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return w(!0),e.prev=1,e.next=4,d()({path:Object(b.A)("/automation/".concat(B,"/step/").concat(F)),method:"POST",data:{data:{data:{note:t}}}}).then((function(e){200===e.code&&(y(e.message),h.note=t,S(p,h),N(!1))}));case 4:w(!1),e.next=11;break;case 7:e.prev=7,e.t0=e.catch(1),y(e.t0.message),w(!1);case 11:Object(b.Lb)(y,3e3);case 12:case"end":return e.stop()}}),e,null,[[1,7]])})),function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){Q(o,r,a,i,c,"next",e)}function c(e){Q(o,r,a,i,c,"throw",e)}i(void 0)}))});return function(e){return t.apply(this,arguments)}}(),H=X(Object(r.useState)(!1),2),V=H[0],$=H[1];return Object(r.createElement)("div",{className:"bwf-note-popup"},function(e,t){var n=c()("bwf-note__toggle bwf-cursor-pointer",{"is-opened":t});return Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:n,onClick:function(t){T||I||e(t)},"aria-expanded":t},!Object(o.isEmpty)(g)&&Object(r.createElement)("span",{className:"bwf-has-note"}),Object(r.createElement)(s.a,{size:16,icon:"note"})))}((function(){return $(!V)}),!0),V&&Object(r.createElement)(J.a,{position:"top right",className:"bwf-note__popover",onClose:function(){return $(!1)},focusOnMount:!0},(t=function(){return $(!V)},Object(r.createElement)("div",{className:"bwf-note-popover-container"},Object(r.createElement)("div",{className:"bwf-note-popover-header"},Object(r.createElement)("div",{className:"bwf-note-header-text"},Object(l.__)("Notes","wp-marketing-automations")),Object(r.createElement)("span",{className:"bwf-note-close",onClick:t},Object(r.createElement)(s.a,{icon:"close",size:20}))),Object(r.createElement)("div",{className:"bwf-note-popover-body"},Object(o.isEmpty)(g)||k?Object(r.createElement)(r.Fragment,null,Object(r.createElement)(u.TextareaControl,{value:g,onChange:function(e){N(!0),E(e)}}),Object(r.createElement)("div",{className:"bwf_text_right",onClick:function(){return R(g)}},Object(r.createElement)(u.Button,{isPrimary:!0,isBusy:O},Object(o.isEmpty)(U)?Object(l.__)("Add","wp-marketing-automations"):Object(l.__)("Update","wp-marketing-automations")))):Object(r.createElement)("div",{className:"bwf-note-wrapper"},Object(r.createElement)("div",{className:"bwf-note--content"},Object(r.createElement)("div",{dangerouslySetInnerHTML:{__html:(n=g,n.replace(/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/gi,'<a href="$1" target="_blank" class="bwf-a-no-underline">$1</a>'))}})),Object(r.createElement)(q.a,{label:Object(l.__)("Event note action","wp-marketing-automations"),renderContent:function(e){var t=e.onToggle;return Object(r.createElement)(r.Fragment,null,Object(r.createElement)(Y.a,{isClickable:!0,onInvoke:function(){N(!0)}},Object(l.__)("Edit","wp-marketing-automations")),Object(r.createElement)(Y.a,{isClickable:!0,onInvoke:function(){t(),E(""),R("")}},Object(l.__)("Delete","wp-marketing-automations")))}})))))))},ee=n(1131);function te(e){return(te="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)}function ne(){ne=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof h?t:h,i=Object.create(o.prototype),c=new x(r||[]);return a(i,"_invoke",{value:k(e,n,c)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var m="suspendedStart",b="executing",p="completed",d={};function h(){}function y(){}function v(){}var O={};s(O,i,(function(){return this}));var w=Object.getPrototypeOf,j=w&&w(w(L([])));j&&j!==n&&r.call(j,i)&&(O=j);var g=v.prototype=h.prototype=Object.create(O);function E(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function _(e,t){function n(a,o,i,c){var l=f(e[a],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==te(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,i,c)}),(function(e){n("throw",e,i,c)})):t.resolve(u).then((function(e){s.value=e,i(s)}),(function(e){return n("throw",e,i,c)}))}c(l.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function k(t,n,r){var a=m;return function(o,i){if(a===b)throw Error("Generator is already running");if(a===p){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===d)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=p,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=b;var s=f(t,n,r);if("normal"===s.type){if(a=r.done?p:"suspendedYield",s.arg===d)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(a=p,r.method="throw",r.arg=s.arg)}}}function N(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),d;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,d;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,d):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,d)}function S(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(S,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(te(t)+" is not iterable")}return y.prototype=v,a(g,"constructor",{value:v,configurable:!0}),a(v,"constructor",{value:y,configurable:!0}),y.displayName=s(v,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===y||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,v):(e.__proto__=v,s(e,l,"GeneratorFunction")),e.prototype=Object.create(g),e},t.awrap=function(e){return{__await:e}},E(_.prototype),s(_.prototype,c,(function(){return this})),t.AsyncIterator=_,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new _(u(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},E(g),s(g,l,"Generator"),s(g,i,(function(){return this})),s(g,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=L,x.prototype={constructor:x,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function a(r,a){return c.type="throw",c.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],c=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var l=r.call(i,"catchLoc"),s=r.call(i,"finallyLoc");if(l&&s){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,d):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),d},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var a=r.arg;P(n)}return a}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),d}},t}function re(e,t,n,r,a,o,i){try{var c=e[o](i),l=c.value}catch(e){return void n(e)}c.done?t(l):Promise.resolve(l).then(r,a)}function ae(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(s)throw a}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return oe(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?oe(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function oe(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var ie=function(e){var t=e.readables;return Object(r.createElement)("div",{className:"bwf-step-brick"},t.map((function(e,t){var n=e.map((function(e,t){return Object(o.isEmpty)(e)?Object(r.createElement)(r.Fragment,null):Object(r.createElement)("div",{key:t},0!==t&&Object(r.createElement)("div",{className:"bwf-step-divider"},Object(r.createElement)("span",{className:"bwf-divider"},"AND")),Object(r.createElement)("div",{className:"bwf-step-content-content bwf-two-line-ellipse-text"},e))}));return 0!==t?Object(o.isEmpty)(n)?Object(r.createElement)(r.Fragment,null):Object(r.createElement)("div",{key:t+"-or"},Object(r.createElement)("div",{className:"bwf-step-divider divider-line bwf-or"},Object(r.createElement)("span",{className:"bwf-divider"},"OR")),n):n})))},ce=function(e){var t=e.data,n=void 0===t?{}:t,i=e.selected,c=void 0!==i&&i,u=e.id,p=ae(Object(r.useState)({status:!1,loading:!0}),2),d=p[0],y=p[1],v=Object(f.a)(),O=v.deleteNode,w=v.setAutomationData,j=v.showSidebar,g=v.setNodeForAdd,E=v.copyNodeHere,_=v.setOpenStepModal,k=v.setModalAnchorNode,N=v.fetchSplitPathNodes,S=Object(m.a)(),P=S.getAutomationId,x=S.getAutomationData,L=S.getEnableCopy,C=S.getEnableMove,A=S.getNodeDataByID,T=S.getLastAddedNode,I=S.getStatLoading,D=S.getStatData,M=T(),F=x().event,G=P(),R=I(),H=D();Object(r.useEffect)((function(){M==u&&(w("sidebarNodeData",e),j(!0),w("lastAddedNode",0))}),[M]);var V,J,$=L(),W=C(),Q=A(e.id),X=Q.hasMultiParents,Z=void 0!==X&&X,te=Q.stepId,oe=Q.step_status,ce=void 0===oe?1:oe,le=H.hasOwnProperty(te)?H[te]:{},se=Object(o.isEmpty)(F)||b.Yb?{}:Object(ee.a)(F,parseInt(G)),ue=se.isLoading,fe=se.error,me=se.getReadableTexts,be=se.rules,pe=b.Yb?[]:(V=n.sidebarValues,J=[],Object(o.isEmpty)(V)?[]:(Object.keys(V).map((function(e){var t=V[e],n=[];!Object(o.isEmpty)(t)&&Object(o.isArray)(t)&&(t.map((function(e){be.hasOwnProperty(e.filter)&&n.push(e)})),Object(o.isEmpty)(n)||J.push(n))})),J)),de=b.Yb||ue||fe||Object(o.isEmpty)(F)?[]:me(pe),he=z({onNodeClick:function(){te&&Object(B.l)({stepid:te},"/"),w("sidebarNodeData",e),j(!0)},onNodeStatClick:function(){b.Yb?(w("proModalContent",Object(l.__)("Conditional Step","wp-marketing-automations")),w("showProModal",!0)):(w("showContactModalId",te),w("showContactModalType","completed"))}});return Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"bwf-node-wrapper","data-stepid":te},Object(r.createElement)(a.d,{type:"target",position:"top",isConnectable:!1}),b.Yb?Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"bwf-inner-wrapper "+(c?"bwf-selected-node":"")+(2===parseInt(ce)?" bwf-draft-node":""),onClick:function(){w("proModalContent",Object(l.__)("Conditional Step","wp-marketing-automations")),w("showProModal",!0)}},Object(r.createElement)("div",{className:"bwf-node-brick"},Object(r.createElement)("div",{className:"bwf-node-icon"},Object(r.createElement)(s.a,{size:26,icon:"condition"})),Object(r.createElement)("div",{className:"bwf-node-inner-content"},Object(r.createElement)("div",{className:"bwf-node-content-type"},Object(l.__)("Step","wp-marketing-automations")+" "+te),Object(r.createElement)("div",{className:"bwf-node-content-label"},Object(l.__)("Condition","wp-marketing-automations"))),Object(r.createElement)("div",{className:"bwf-node-action"})),Object(r.createElement)("div",{className:"bwf-control-event-error"},Object(r.createElement)("div",{className:"bwf-control-error-msg bwf-cursor-pointer bwf-display-flex"},Object(r.createElement)(s.a,{icon:"king",size:16,color:"#E15334"}),Object(l.__)("Pro Feature","wp-marketing-automations")))),Object(r.createElement)(a.d,{type:"source",position:"bottom",isConnectable:!1})):Object(r.createElement)("div",{className:"bwf-inner-wrapper "+(c?"bwf-selected-node":"")+(2===parseInt(ce)?" bwf-draft-node":""),onClick:he},Object(r.createElement)("div",{className:"bwf-node-brick"},Object(r.createElement)("div",{className:"bwf-node-icon"},Object(r.createElement)(s.a,{size:26,icon:"condition"})),Object(r.createElement)("div",{className:"bwf-node-inner-content"},Object(r.createElement)("div",{className:"bwf-node-content-type"},Object(l.__)("Step","wp-marketing-automations")+" "+u),Object(r.createElement)("div",{className:"bwf-node-content-label"},Object(l.__)("Condition","wp-marketing-automations"))),Object(r.createElement)("div",{className:"bwf-node-action"},Object(r.createElement)(K,{node:e}),Object(r.createElement)(q.a,{label:Object(l.__)("Quick Actions","wp-marketing-automations"),classes:"bwf-event-action",isDisable:!(!$&&!W),renderContent:function(t){var n=t.onToggle,a=N();return Object(r.createElement)(r.Fragment,null,Object(r.createElement)(Y.a,{isClickable:!0,onInvoke:function(){Object(b.ac)()?(w("enableCopy",!0),w("copyData",{type:"conditional",data:e.data,id:e.id})):(w("proModalContent",Object(l.__)("Copy Step","wp-marketing-automations")),w("showProModal",!0)),n()}},Object(r.createElement)(U.a,{justify:"space-between"},Object(r.createElement)(U.c,null,Object(l.__)("Copy","wp-marketing-automations")),!Object(b.ac)()&&Object(r.createElement)(U.c,null,b.e))),!a.includes(u)&&Object(r.createElement)(Y.a,{isClickable:!0,onInvoke:function(){Object(b.ac)()?(w("enableMove",!0),w("moveID",e.id),w("copyData",{type:"conditional",data:e.data,id:e.id})):(w("proModalContent",Object(l.__)("Move Step","wp-marketing-automations")),w("showProModal",!0)),n()}},Object(r.createElement)(U.a,{justify:"space-between"},Object(r.createElement)(U.c,null,Object(l.__)("Move","wp-marketing-automations")),!Object(b.ac)()&&Object(r.createElement)(U.c,null,b.e))),Object(r.createElement)(Y.a,{isClickable:!0,onInvoke:function(){var t,r;y({status:!0,onConfirm:(t=ne().mark((function t(){return ne().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,O(e).then((function(){return y({status:!1})})).catch((function(e){y({status:!0,err:e.message})}));case 2:case"end":return t.stop()}}),t)})),r=function(){var e=this,n=arguments;return new Promise((function(r,a){var o=t.apply(e,n);function i(e){re(o,r,a,i,c,"next",e)}function c(e){re(o,r,a,i,c,"throw",e)}i(void 0)}))},function(){return r.apply(this,arguments)})}),n()}},Object(r.createElement)(U.a,{justify:"flex-start"},Object(r.createElement)(U.c,null,Object(l.__)("Delete","wp-marketing-automations")))))}}))),Array.isArray(de)&&de.length?Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"bwf-node-step-content"},Object(r.createElement)("div",{className:"bwf-step-content"},Object(r.createElement)(ie,{readables:de}))),Object(r.createElement)("div",{className:"bwf-node-status"},Object(r.createElement)("div",{className:"bwf-status-wrap"},Object(r.createElement)("span",{className:"bwf-node-status-label"},Object(l.__)("Completed","wp-marketing-automations")),Object(r.createElement)("span",{className:"bwf-node-status-count"},R?Object(r.createElement)("div",{className:"bwf-placeholder-temp bwf-w-20 bwf-h-10"}):Object(r.createElement)(r.Fragment,null,le.hasOwnProperty("completed")?Object(b.tc)(parseInt(le.completed)):0))))):Object(r.createElement)(r.Fragment,null,ue?Object(r.createElement)("div",{className:"bwf-node-step-content"},Object(r.createElement)("div",{className:"bwf-step-brick"},Object(r.createElement)("div",{className:"bwf-step-content-content"},Object(r.createElement)("div",{className:"bwf-step-brick"},Object(r.createElement)("div",{className:"bwf-step-content-content bwf-mb-16"},Object(l.__)("Loading","wp-marketing-automations")))))):Object(r.createElement)("div",{className:"bwf-control-event-error"},Object(r.createElement)("div",{className:"bwf-control-error-msg bwf-cursor-pointer"},Object(l.__)("Not Configured","wp-marketing-automations")))),Object(r.createElement)(a.d,{type:"source",position:"bottom",isConnectable:!1})),Z&&Object(r.createElement)("div",{className:"bwf-node-plus-paste-wrap bwf-pos-top"},$||W?Object(r.createElement)("div",{className:"bwf-drag-area",onClick:function(){return E(e,"before","")}},Object(r.createElement)("div",{className:"bwf-drag-node is-copy-paste"},Object(r.createElement)("div",{className:"bwf-node-add"})),Object(r.createElement)("div",{className:"bwf-paste-label"},Object(l.__)("Paste Here","wp-marketing-automations"))):Object(r.createElement)("div",{className:"bwf-node-add",onClick:function(t){g(e.id,{option:"",position:"before"}),_(!0),k(t.target)}}))),Object(r.createElement)(h.a,{modalTitle:Object(l.__)("Delete Conditional Step","wp-marketing-automations"),deleteEntityName:Object(l.__)("conditional step","wp-marketing-automations"),confirmButtonText:Object(l.__)("Delete","wp-marketing-automations"),onConfirm:d.onConfirm,isLoading:!1,onRequestClose:function(){return y({status:!1})},isOpen:d.status,isDelete:!0,showSupportLink:!0,errorMessage:null==d?void 0:d.err}))},le=n(1164),se=n(149);function ue(e){return(ue="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function fe(){fe=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof h?t:h,i=Object.create(o.prototype),c=new x(r||[]);return a(i,"_invoke",{value:k(e,n,c)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var m="suspendedStart",b="executing",p="completed",d={};function h(){}function y(){}function v(){}var O={};s(O,i,(function(){return this}));var w=Object.getPrototypeOf,j=w&&w(w(L([])));j&&j!==n&&r.call(j,i)&&(O=j);var g=v.prototype=h.prototype=Object.create(O);function E(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function _(e,t){function n(a,o,i,c){var l=f(e[a],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==ue(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,i,c)}),(function(e){n("throw",e,i,c)})):t.resolve(u).then((function(e){s.value=e,i(s)}),(function(e){return n("throw",e,i,c)}))}c(l.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function k(t,n,r){var a=m;return function(o,i){if(a===b)throw Error("Generator is already running");if(a===p){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===d)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=p,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=b;var s=f(t,n,r);if("normal"===s.type){if(a=r.done?p:"suspendedYield",s.arg===d)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(a=p,r.method="throw",r.arg=s.arg)}}}function N(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),d;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,d;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,d):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,d)}function S(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(S,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(ue(t)+" is not iterable")}return y.prototype=v,a(g,"constructor",{value:v,configurable:!0}),a(v,"constructor",{value:y,configurable:!0}),y.displayName=s(v,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===y||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,v):(e.__proto__=v,s(e,l,"GeneratorFunction")),e.prototype=Object.create(g),e},t.awrap=function(e){return{__await:e}},E(_.prototype),s(_.prototype,c,(function(){return this})),t.AsyncIterator=_,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new _(u(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},E(g),s(g,l,"Generator"),s(g,i,(function(){return this})),s(g,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=L,x.prototype={constructor:x,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function a(r,a){return c.type="throw",c.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],c=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var l=r.call(i,"catchLoc"),s=r.call(i,"finallyLoc");if(l&&s){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,d):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),d},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var a=r.arg;P(n)}return a}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),d}},t}function me(e,t,n,r,a,o,i){try{var c=e[o](i),l=c.value}catch(e){return void n(e)}c.done?t(l):Promise.resolve(l).then(r,a)}function be(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){me(o,r,a,i,c,"next",e)}function c(e){me(o,r,a,i,c,"throw",e)}i(void 0)}))}}function pe(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(s)throw a}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return de(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?de(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function de(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var he=function(e){var t=e.data,n=void 0===t?{}:t,i=e.selected,c=void 0!==i&&i,u=e.id,p=pe(Object(r.useState)(!1),2),d=p[0],y=p[1],v=pe(Object(r.useState)({status:!1,loading:!0}),2),O=v[0],w=v[1],j=Object(f.a)(),g=j.deleteNode,E=j.setAutomationData,_=j.showSidebar,k=j.setNodeForAdd,N=j.copyNodeHere,S=j.setOpenStepModal,P=j.setModalAnchorNode,L=j.fetchSplitPathNodes,C=Object(m.a)(),A=C.getActionsList,T=C.getAutomationData,I=C.getNodeDataByID,D=C.getEnableCopy,M=C.getEnableMove,F=C.getLastAddedNode,G=C.getStatLoading,R=C.getStatData,H=F(),V=A(),J=T(),$=G(),W=R(),Q=J.ID,X=D(),Z=M(),ee=I(e.id),te=ee.hasMultiParents,ne=void 0!==te&&te,re=ee.stepId,ae=ee.step_status,oe=void 0===ae?1:ae,ie=W.hasOwnProperty(re)?W[re]:{},ce=n.sidebarValues,ue=void 0===ce?{}:ce,me=n.desc_text,de=void 0===me?"":me;Object(r.useEffect)((function(){H==u&&(y(!0),E("lastAddedNode",0))}),[H]);var he,ye,ve,Oe=z({onNodeClick:!!n.selected&&function(){V.list.hasOwnProperty(n.selected)&&(re&&Object(B.l)({stepid:re},"/"),E("sidebarNodeData",e),_(!0))},onNodeStatClick:function(){E("showContactModalId",re),E("showContactModalType","completed")},onNodeFailedStatClick:function(){E("showContactModalId",re),E("showContactModalType","failed")},onNodeSkippedStatClick:function(){E("showContactModalId",re),E("showContactModalType","skipped")},onInfoToggleClick:function(){return E("analyticNodeId",re)}}),we=!$&&ie.hasOwnProperty("failed")&&parseInt(ie.failed)>0&&ie.hasOwnProperty("skipped")&&parseInt(ie.skipped)>0;return Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"bwf-node-wrapper ".concat(we?"bwf-width-2":""),"data-stepid":re},Object(r.createElement)(a.d,{type:"target",position:"top",isConnectable:!1}),Object(r.createElement)("div",{className:"bwf-inner-wrapper "+(c?"bwf-selected-node":"")+(n.hasOwnProperty("selected")&&n.selected&&V.list.hasOwnProperty(n.selected)&&2===parseInt(oe)&&V.list[n.selected].hasOwnProperty("fields")&&!Object(o.isEmpty)(V.list[n.selected].fields)?" bwf-draft-node":""),onClick:Oe},Object(r.createElement)("div",{className:"bwf-node-brick"},Object(r.createElement)("div",{className:"bwf-node-icon icon-action"},Object(r.createElement)(s.a,{size:22,icon:"charge"})),Object(r.createElement)("div",{className:"bwf-node-inner-content"},Object(r.createElement)("div",{className:"bwf-node-content-type"},Object(l.__)("Step","wp-marketing-automations")+" "+u),Object(r.createElement)("div",{className:"bwf-node-content-label"},Object(l.__)("Action","wp-marketing-automations"))),Object(r.createElement)("div",{className:"bwf-node-action"},n.hasOwnProperty("selected")&&!Object(o.isEmpty)(n.selected)&&Object(r.createElement)(K,{id:u,node:e}),Object(r.createElement)(q.a,{label:Object(l.__)("Quick Actions","wp-marketing-automations"),classes:"bwf-event-action",isDisable:!(!X&&!Z),renderContent:function(t){var a=t.onToggle,i=L();return Object(r.createElement)(r.Fragment,null,n.hasOwnProperty("selected")&&!Object(o.isEmpty)(n.selected)&&Object(r.createElement)(r.Fragment,null,Object(r.createElement)(Y.a,{isClickable:!0,onInvoke:function(){Object(b.ac)()?(E("enableCopy",!0),E("copyData",{type:"action",data:e.data})):(E("proModalContent",{featureTitle:Object(l.__)("Copy Step","wp-marketing-automations"),proLink:Object(b.fb)("upgrade",{utm_medium:"Automation+Copy+step+Upgrade+Modal"})}),E("showProModal",!0)),a()}},Object(r.createElement)(U.a,{justify:"space-between"},Object(r.createElement)(U.c,null,Object(l.__)("Copy","wp-marketing-automations")),!Object(b.ac)()&&Object(r.createElement)(U.c,null,b.e))),!i.includes(u)&&Object(r.createElement)(Y.a,{isClickable:!0,onInvoke:be(fe().mark((function t(){return fe().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:Object(b.ac)()?(E("enableMove",!0),E("moveID",e.id),E("copyData",{type:"action",data:e.data})):(E("proModalContent",{featureTitle:Object(l.__)("Move Step","wp-marketing-automations"),proLink:Object(b.fb)("upgrade",{utm_medium:"Automation+Copy+step+Upgrade+Modal"})}),E("showProModal",!0)),a();case 2:case"end":return t.stop()}}),t)})))},Object(r.createElement)(U.a,{justify:"space-between"},Object(r.createElement)(U.c,null,Object(l.__)("Move","wp-marketing-automations")),!Object(b.ac)()&&Object(r.createElement)(U.c,null,b.e)))),Object(r.createElement)(Y.a,{isClickable:!0,onInvoke:function(){var t;w({status:!0,onConfirm:(t=be(fe().mark((function t(){return fe().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,g(e).then((function(){return w({status:!1})}));case 2:case"end":return t.stop()}}),t)}))),function(){return t.apply(this,arguments)})}),a()}},Object(r.createElement)(U.a,{justify:"flex-start"},Object(r.createElement)(U.c,null,Object(l.__)("Delete","wp-marketing-automations")))))}}))),n.hasOwnProperty("selected")&&!Object(o.isEmpty)(n.selected)?Object(r.createElement)("div",{className:"bwf-node-step-content"},Object(r.createElement)("div",{className:"bwf-step-content"},Object(r.createElement)("div",{className:"bwf-step-brick"},Object(r.createElement)("div",{className:"bwf-step-content-content"},!Object(o.isEmpty)(n)&&n.hasOwnProperty("selected")&&(ve=Object(r.createElement)(r.Fragment,null),"wp_sendemail"===n.selected?(he=ue.bwfan_email_data,ye=void 0===he?{}:he,ve=Object(r.createElement)(r.Fragment,null,!Object(o.isEmpty)(ye)&&Object(r.createElement)("div",{className:"bwf-display-flex bwf-flex-start bwf-mt-3 bwf-cursor-pointer bwf-info__toggle "},Object(r.createElement)(le.a,{automationId:Q,analyticsId:re,mode:"email"})))):"twilio_send_sms"!==n.selected&&"bulkgate_send_transactional_sms"!==n.selected&&"linkmobility_send_sms"!==n.selected&&"unifonic_send_sms"!==n.selected||(ve=Object(r.createElement)("div",{className:"bwf-display-flex bwf-flex-start bwf-mt-3 bwf-cursor-pointer bwf-info__toggle"},Object(r.createElement)(le.a,{automationId:Q,analyticsId:re,mode:"sms"}))),Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"bwf-node-content-type"},V.list.hasOwnProperty(n.selected)&&V.list[n.selected].hasOwnProperty("integration_nicename")?V.list[n.selected].integration_nicename:""),Object(r.createElement)("div",{className:"bwf-node-content-label"},V.list.hasOwnProperty(n.selected)?V.list[n.selected].action_name:Object(l.__)("Action Not Found","wp-marketing-automations")),!Object(o.isEmpty)(de)&&Object(r.createElement)("div",{className:"bwf-node-content-label bwf-node-desc"+(Object(o.isArray)(de)?"":" bwf-two-line-ellipse-text")},function(e){if(Object(o.isEmpty)(e))return Object(r.createElement)(r.Fragment,null);if(Object(o.isArray)(e)){var t="",n=[];return e.map((function(e){Object(o.isEmpty)(t)&&(t=e),n.push(Object(r.createElement)("span",{key:e},e))})),Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"bwf-table-v-center"},Object(r.createElement)("span",null,!Object(o.isEmpty)(t)&&t),!Object(o.isEmpty)(n)&&n.length>1&&Object(r.createElement)("div",{className:"bwf-display-inline",onClick:function(e){e.preventDefault(),e.stopPropagation()}},Object(r.createElement)(se.a,{items:n}))))}return Object(o.isObject)(e)?Object(r.createElement)(r.Fragment,null):e}(de)),ve,V.list.hasOwnProperty(n.selected)&&V.list[n.selected].hasOwnProperty("analytics_mode")&&""!==V.list[n.selected].analytics_mode?Object(r.createElement)("div",{className:"bwf-display-flex bwf-flex-start bwf-mt-3 bwf-cursor-pointer bwf-info__toggle"},Object(r.createElement)(le.a,{automationId:Q,analyticsId:re,mode:V.list[n.selected].analytics_mode})):null)))))):Object(r.createElement)("div",{className:"bwf-control-event-error"},Object(r.createElement)("div",{className:"bwf-control-error-msg bwf-cursor-pointer",onClick:function(){return y(!0)}},Object(l.__)("Not Configured","wp-marketing-automations"))),n.hasOwnProperty("selected")&&!Object(o.isEmpty)(n.selected)&&Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"bwf-node-status"},Object(r.createElement)("div",{className:"bwf-status-wrap"},Object(r.createElement)("span",{className:"bwf-node-status-label"},Object(l.__)("Completed","wp-marketing-automations")),Object(r.createElement)("span",{className:"bwf-node-status-count"},$?Object(r.createElement)("div",{className:"bwf-placeholder-temp bwf-w-20 bwf-h-10"}):Object(r.createElement)(r.Fragment,null,ie.hasOwnProperty("completed")?Object(b.tc)(parseInt(ie.completed)):0))),!$&&ie.hasOwnProperty("skipped")&&parseInt(ie.skipped)>0&&Object(r.createElement)("div",{className:"bwf-skipped-status-wrap"},Object(r.createElement)("span",{className:"bwf-node-status-label"},Object(l.__)("Skipped","wp-marketing-automations")),Object(r.createElement)("span",{className:"bwf-node-status-count bwf-skipped-status"},Object(b.tc)(parseInt(ie.skipped)))),!$&&ie.hasOwnProperty("failed")&&parseInt(ie.failed)>0&&Object(r.createElement)("div",{className:"bwf-failed-status-wrap"},Object(r.createElement)("span",{className:"bwf-node-status-label"},Object(l.__)("Failed","wp-marketing-automations")),Object(r.createElement)("span",{className:"bwf-node-status-count bwf-failed-status"},Object(b.tc)(parseInt(ie.failed))))))),ne&&Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"bwf-node-plus-paste-wrap bwf-pos-top"},X||Z?Object(r.createElement)("div",{className:"bwf-drag-area",onClick:function(){return N(e,"before","")}},Object(r.createElement)("div",{className:"bwf-drag-node is-copy-paste"},Object(r.createElement)("div",{className:"bwf-node-add"})),Object(r.createElement)("div",{className:"bwf-paste-label"},Object(l.__)("Paste Here","wp-marketing-automations"))):Object(r.createElement)("div",{className:"bwf-node-add",onClick:function(t){k(e.id,{option:"",position:"before"}),S(!0),P(t.target)}})))),Object(r.createElement)(a.d,{type:"source",isConnectable:!1,position:"bottom"}),Object(r.createElement)(x,{isOpen:d,onRequestClose:function(){return y(!1)},node:e,isEvent:!1,automationID:Q}),Object(r.createElement)(h.a,{modalTitle:Object(l.__)("Delete Action Step","wp-marketing-automations"),deleteEntityName:Object(l.__)("action step","wp-marketing-automations"),confirmButtonText:Object(l.__)("Delete","wp-marketing-automations"),onConfirm:O.onConfirm,isLoading:!1,onRequestClose:function(){return w({status:!1})},isOpen:O.status,isDelete:!0}))},ye=function(e){var t=Object(m.a)(),n=t.getEnableCopy,o=t.getEnableMove,i=t.getNodeDataByID,c=n(),s=o(),u=Object(f.a)(),b=u.copyNodeHere,p=u.setNodeForAdd,d=u.setOpenStepModal,h=u.setModalAnchorNode,y=i(e.id).hasMultiParents,v=void 0!==y&&y;return Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"bwf-node-wrapper"},v?Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"bwf-node-plus-paste-wrap bwf-pos-top"},c||s?Object(r.createElement)("div",{className:"bwf-drag-area",onClick:function(){return b(e,"before","")}},Object(r.createElement)("div",{className:"bwf-drag-node is-copy-paste"},Object(r.createElement)("div",{className:"bwf-node-add"})),Object(r.createElement)("div",{className:"bwf-paste-label"},Object(l.__)("Paste Here","wp-marketing-automations"))):Object(r.createElement)("div",{className:"bwf-node-add",onClick:function(t){p(e.id,{option:"",position:"before"}),d(!0),h(t.target)}})),Object(r.createElement)(a.d,{type:"source",position:"top",isConnectable:!1})):Object(r.createElement)(a.d,{type:"source",position:"top",isConnectable:!1}),Object(r.createElement)("div",{className:"bwf-node-content bwf-end"},Object(r.createElement)("div",{className:"bwf-node-content-item"},Object(l.__)("End Automation","wp-marketing-automations")))))};function ve(e){return(ve="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)}function Oe(){Oe=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof h?t:h,i=Object.create(o.prototype),c=new x(r||[]);return a(i,"_invoke",{value:k(e,n,c)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var m="suspendedStart",b="executing",p="completed",d={};function h(){}function y(){}function v(){}var O={};s(O,i,(function(){return this}));var w=Object.getPrototypeOf,j=w&&w(w(L([])));j&&j!==n&&r.call(j,i)&&(O=j);var g=v.prototype=h.prototype=Object.create(O);function E(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function _(e,t){function n(a,o,i,c){var l=f(e[a],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==ve(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,i,c)}),(function(e){n("throw",e,i,c)})):t.resolve(u).then((function(e){s.value=e,i(s)}),(function(e){return n("throw",e,i,c)}))}c(l.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function k(t,n,r){var a=m;return function(o,i){if(a===b)throw Error("Generator is already running");if(a===p){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===d)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=p,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=b;var s=f(t,n,r);if("normal"===s.type){if(a=r.done?p:"suspendedYield",s.arg===d)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(a=p,r.method="throw",r.arg=s.arg)}}}function N(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),d;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,d;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,d):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,d)}function S(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(S,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(ve(t)+" is not iterable")}return y.prototype=v,a(g,"constructor",{value:v,configurable:!0}),a(v,"constructor",{value:y,configurable:!0}),y.displayName=s(v,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===y||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,v):(e.__proto__=v,s(e,l,"GeneratorFunction")),e.prototype=Object.create(g),e},t.awrap=function(e){return{__await:e}},E(_.prototype),s(_.prototype,c,(function(){return this})),t.AsyncIterator=_,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new _(u(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},E(g),s(g,l,"Generator"),s(g,i,(function(){return this})),s(g,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=L,x.prototype={constructor:x,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function a(r,a){return c.type="throw",c.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],c=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var l=r.call(i,"catchLoc"),s=r.call(i,"finallyLoc");if(l&&s){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,d):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),d},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var a=r.arg;P(n)}return a}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),d}},t}function we(e,t,n,r,a,o,i){try{var c=e[o](i),l=c.value}catch(e){return void n(e)}c.done?t(l):Promise.resolve(l).then(r,a)}function je(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(s)throw a}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ge(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ge(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ge(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var Ee=function(e){var t=e.data,n=void 0===t?{}:t,i=e.selected,c=void 0!==i&&i,u=e.id,p=je(Object(r.useState)(!1),2),d=p[0],y=p[1],v=je(Object(r.useState)({status:!1,loading:!0}),2),O=v[0],w=v[1],j=Object(f.a)(),g=j.deleteNode,E=j.setAutomationData,_=j.showSidebar,k=j.setNodeForAdd,N=j.copyNodeHere,S=j.setOpenStepModal,P=j.setModalAnchorNode,x=Object(m.a)(),L=x.getGoals,C=x.getNodeDataByID,A=x.getEnableCopy,T=x.getEnableMove,I=x.getLastAddedNode,D=x.getAutomationData,M=x.getStatLoading,F=x.getStatData,R=L().list,H=I(),V=A(),J=T(),$=M(),W=F();Object(r.useEffect)((function(){H==u&&(y(!0),E("lastAddedNode",0))}),[H]);var Q=D(),X=C(e.id),Z=X.hasMultiParents,ee=void 0!==Z&&Z,te=X.stepId,ne=X.step_status,re=void 0===ne?1:ne,ae=Q.ID,oe=W.hasOwnProperty(te)?W[te]:{},ie=n.desc_text,ce=void 0===ie?"":ie,le=z({onNodeClick:!!n&&!!n.benchmark&&function(){te&&Object(B.l)({stepid:te},"/"),E("sidebarNodeData",e),_(!0)},onNodeStatClick:function(){b.Yb?(E("proModalContent",Object(l.__)("Goal Step","wp-marketing-automations")),E("showProModal",!0)):(E("showContactModalId",te),E("showContactModalType","completed"))},onNodeQueuedStatClick:function(){b.Yb?(E("proModalContent",Object(l.__)("Goal Step","wp-marketing-automations")),E("showProModal",!0)):(E("showContactModalId",te),E("showContactModalType","queued"))},onNodeFailedStatClick:function(){b.Yb?(E("proModalContent",Object(l.__)("Goal Step","wp-marketing-automations")),E("showProModal",!0)):(E("showContactModalId",te),E("showContactModalType","failed"))}});return Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"bwf-node-wrapper","data-stepid":te},Object(r.createElement)(a.d,{type:"target",position:"top",isConnectable:!1}),b.Yb?Object(r.createElement)("div",{className:"bwf-inner-wrapper "+(c?"bwf-selected-node":"")+(2===parseInt(re)?" bwf-draft-node":""),onClick:function(){E("proModalContent","Goal Step"),E("showProModal",!0)}},Object(r.createElement)("div",{className:"bwf-node-brick"},Object(r.createElement)("div",{className:"bwf-node-icon icon-goal"},Object(r.createElement)(s.a,{size:26,icon:"goal"})),Object(r.createElement)("div",{className:"bwf-node-inner-content"},Object(r.createElement)("div",{className:"bwf-node-content-type"},Object(l.__)("Step","wp-marketing-automations")+" "+u),Object(r.createElement)("div",{className:"bwf-node-content-label"},Object(l.__)("Goal","wp-marketing-automations"))),Object(r.createElement)("div",{className:"bwf-node-action"})),Object(r.createElement)("div",{className:"bwf-control-event-error"},Object(r.createElement)("div",{className:"bwf-control-error-msg bwf-cursor-pointer bwf-display-flex"},Object(r.createElement)(s.a,{icon:"king",size:16,color:"#E15334"}),Object(l.__)("Pro Feature","wp-marketing-automations")))):Object(r.createElement)("div",{className:"bwf-inner-wrapper "+(c?"bwf-selected-node":"")+(2===parseInt(re)?" bwf-draft-node":""),onClick:le},Object(r.createElement)("div",{className:"bwf-node-brick"},Object(r.createElement)("div",{className:"bwf-node-icon icon-goal"},Object(r.createElement)(s.a,{size:26,icon:"goal"})),Object(r.createElement)("div",{className:"bwf-node-inner-content"},Object(r.createElement)("div",{className:"bwf-node-content-type"},Object(l.__)("Step","wp-marketing-automations")+" "+u),Object(r.createElement)("div",{className:"bwf-node-content-label"},Object(l.__)("Goal","wp-marketing-automations"))),Object(r.createElement)("div",{className:"bwf-node-action"},n.hasOwnProperty("benchmark")&&!Object(o.isEmpty)(n.benchmark)&&Object(r.createElement)(K,{node:e}),Object(r.createElement)(q.a,{label:Object(l.__)("Quick Actions","wp-marketing-automations"),classes:"bwf-event-action",isDisable:!(!V&&!J),renderContent:function(t){var a=t.onToggle;return Object(r.createElement)(r.Fragment,null,n.hasOwnProperty("benchmark")&&!Object(o.isEmpty)(n.benchmark)&&Object(r.createElement)(r.Fragment,null,Object(r.createElement)(Y.a,{isClickable:!0,onInvoke:function(){Object(b.ac)()?(E("enableCopy",!0),E("copyData",{type:"benchmark",data:e.data})):(E("proModalContent",Object(l.__)("Copy Step","wp-marketing-automations")),E("showProModal",!0)),a()}},Object(r.createElement)(U.a,{justify:"space-between"},Object(r.createElement)(U.c,null,Object(l.__)("Copy","wp-marketing-automations")),!Object(b.ac)()&&Object(r.createElement)(U.c,null,b.e))),Object(r.createElement)(Y.a,{isClickable:!0,onInvoke:function(){E("enableMove",!0),E("moveID",e.id),E("copyData",{type:"benchmark",data:e.data}),a()}},Object(r.createElement)(U.a,{justify:"flex-start"},Object(r.createElement)(U.c,null,Object(l.__)("Move","wp-marketing-automations"))))),Object(r.createElement)(Y.a,{isClickable:!0,onInvoke:function(){var t,n;w({status:!0,onConfirm:(t=Oe().mark((function t(){return Oe().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,g(e).then((function(){return w({status:!1})}));case 2:case"end":return t.stop()}}),t)})),n=function(){var e=this,n=arguments;return new Promise((function(r,a){var o=t.apply(e,n);function i(e){we(o,r,a,i,c,"next",e)}function c(e){we(o,r,a,i,c,"throw",e)}i(void 0)}))},function(){return n.apply(this,arguments)})}),a()}},Object(r.createElement)(U.a,{justify:"flex-start"},Object(r.createElement)(U.c,null,Object(l.__)("Delete","wp-marketing-automations")))))}}))),!n.hasOwnProperty("benchmark")||Object(o.isEmpty)(n.benchmark)?Object(r.createElement)("div",{className:"bwf-control-event-error"},Object(r.createElement)("div",{className:"bwf-control-error-msg",onClick:function(){return y(!0)}},Object(l.__)("Not Configured","wp-marketing-automations"))):Object(r.createElement)("div",{className:"bwf-node-step-content"},Object(r.createElement)("div",{className:"bwf-step-content"},Object(r.createElement)("div",{className:"bwf-step-brick"},Object(r.createElement)("div",{className:"bwf-step-content-content"},Object(r.createElement)("div",{className:"bwf-node-content-type"},R.hasOwnProperty(n.benchmark)&&R[n.benchmark].hasOwnProperty("source_label")?R[n.benchmark].source_label:""),Object(r.createElement)("div",{className:"bwf-node-content-label"},R.hasOwnProperty(n.benchmark)?R[n.benchmark].event_name:"Goal Not Found"),!Object(o.isEmpty)(ce)&&Object(r.createElement)("div",{className:"bwf-node-content-label bwf-node-desc"+(Object(o.isArray)(ce)?"":" bwf-two-line-ellipse-text")},function(e){if(Object(o.isEmpty)(e))return Object(r.createElement)(r.Fragment,null);if(Object(o.isArray)(e)){var t="",n=[];return e.map((function(e){Object(o.isEmpty)(t)&&(t=e),n.push(Object(r.createElement)("span",{key:e},e))})),Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"bwf-table-v-center"},Object(r.createElement)("span",null,!Object(o.isEmpty)(t)&&t),!Object(o.isEmpty)(n)&&n.length>1&&Object(r.createElement)("div",{className:"bwf-display-inline",onClick:function(e){e.preventDefault(),e.stopPropagation()}},Object(r.createElement)(se.a,{items:n}))))}return e}(ce)))))),!$&&Object(r.createElement)("div",{className:"bwf-node-status "+(Object(o.isEmpty)(n.benchmark)?"bwf-mt-0":"")},Object(r.createElement)("div",{className:"bwf-queued-status-wrap"},Object(r.createElement)("span",{className:"bwf-node-status-label"},Object(l.__)("Queued","wp-marketing-automations")),Object(r.createElement)("span",{className:"bwf-node-status-count"},$?Object(r.createElement)("div",{className:"bwf-placeholder-temp bwf-w-20 bwf-h-10"}):Object(r.createElement)(r.Fragment,null,oe.hasOwnProperty("queued")?Object(b.tc)(parseInt(oe.queued)):0))),!Object(o.isEmpty)(n.benchmark)&&Object(r.createElement)("div",{className:"bwf-status-wrap"},Object(r.createElement)("span",{className:"bwf-node-status-label"},Object(l.__)("Completed","wp-marketing-automations")),Object(r.createElement)("span",{className:"bwf-node-status-count"},$?Object(r.createElement)("div",{className:"bwf-placeholder-temp bwf-w-20 bwf-h-10"}):Object(r.createElement)(r.Fragment,null,oe.hasOwnProperty("completed")?Object(b.tc)(parseInt(oe.completed)):0))),oe.hasOwnProperty("failed")&&parseInt(oe.failed)>0&&Object(r.createElement)("div",{className:"bwf-failed-status-wrap"},Object(r.createElement)("span",{className:"bwf-node-status-label"},Object(l.__)("Failed","wp-marketing-automations")),Object(r.createElement)("span",{className:"bwf-node-status-count bwf-failed-status"},Object(b.tc)(parseInt(oe.failed)))))),ee&&Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"bwf-node-plus-paste-wrap bwf-pos-top"},V||J?Object(r.createElement)("div",{className:"bwf-drag-area",onClick:function(){return N(e,"before","")}},Object(r.createElement)("div",{className:"bwf-drag-node is-copy-paste"},Object(r.createElement)("div",{className:"bwf-node-add"})),Object(r.createElement)("div",{className:"bwf-paste-label"},"Paste Here")):Object(r.createElement)("div",{className:"bwf-node-add",onClick:function(t){k(e.id,{option:"",position:"before"}),S(!0),P(t.target)}})))),Object(r.createElement)(a.d,{type:"source",position:"bottom",isConnectable:!1}),Object(r.createElement)(G,{isOpen:d,onRequestClose:function(){return y(!1)},node:e,automationID:ae}),Object(r.createElement)(h.a,{modalTitle:Object(l.__)("Delete Goal Step","wp-marketing-automations"),deleteEntityName:Object(l.__)("goal step","wp-marketing-automations"),confirmButtonText:Object(l.__)("Delete","wp-marketing-automations"),onConfirm:O.onConfirm,isLoading:!1,onRequestClose:function(){return w({status:!1})},isOpen:O.status,isDelete:!0,deleteDescriptionText:Object(l.__)("Once you delete this step, all the queued contacts will move to next step right away.","wp-marketing-automations")}))},_e=n(101),ke=n(10),Ne=n.n(ke);function Se(e){return(Se="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)}function Pe(){Pe=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof h?t:h,i=Object.create(o.prototype),c=new x(r||[]);return a(i,"_invoke",{value:k(e,n,c)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var m="suspendedStart",b="executing",p="completed",d={};function h(){}function y(){}function v(){}var O={};s(O,i,(function(){return this}));var w=Object.getPrototypeOf,j=w&&w(w(L([])));j&&j!==n&&r.call(j,i)&&(O=j);var g=v.prototype=h.prototype=Object.create(O);function E(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function _(e,t){function n(a,o,i,c){var l=f(e[a],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==Se(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,i,c)}),(function(e){n("throw",e,i,c)})):t.resolve(u).then((function(e){s.value=e,i(s)}),(function(e){return n("throw",e,i,c)}))}c(l.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function k(t,n,r){var a=m;return function(o,i){if(a===b)throw Error("Generator is already running");if(a===p){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===d)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=p,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=b;var s=f(t,n,r);if("normal"===s.type){if(a=r.done?p:"suspendedYield",s.arg===d)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(a=p,r.method="throw",r.arg=s.arg)}}}function N(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),d;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,d;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,d):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,d)}function S(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(S,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(Se(t)+" is not iterable")}return y.prototype=v,a(g,"constructor",{value:v,configurable:!0}),a(v,"constructor",{value:y,configurable:!0}),y.displayName=s(v,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===y||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,v):(e.__proto__=v,s(e,l,"GeneratorFunction")),e.prototype=Object.create(g),e},t.awrap=function(e){return{__await:e}},E(_.prototype),s(_.prototype,c,(function(){return this})),t.AsyncIterator=_,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new _(u(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},E(g),s(g,l,"Generator"),s(g,i,(function(){return this})),s(g,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=L,x.prototype={constructor:x,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function a(r,a){return c.type="throw",c.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],c=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var l=r.call(i,"catchLoc"),s=r.call(i,"finallyLoc");if(l&&s){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,d):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),d},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var a=r.arg;P(n)}return a}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),d}},t}function xe(e,t,n,r,a,o,i){try{var c=e[o](i),l=c.value}catch(e){return void n(e)}c.done?t(l):Promise.resolve(l).then(r,a)}function Le(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(s)throw a}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Ce(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ce(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ce(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var Ae={1:Object(l.__)("Delay for a specific period","wp-marketing-automations"),2:Object(l.__)("Delay until a specific date and time","wp-marketing-automations"),3:Object(l.__)("Delay until a custom field date","wp-marketing-automations"),4:Object(l.__)("Delay with variable","wp-marketing-automations")},Te={1:Object(l.__)("Sun","wp-marketing-automations"),2:Object(l.__)("Mon","wp-marketing-automations"),3:Object(l.__)("Tue","wp-marketing-automations"),4:Object(l.__)("Wed","wp-marketing-automations"),5:Object(l.__)("Thu","wp-marketing-automations"),6:Object(l.__)("Fri","wp-marketing-automations"),7:Object(l.__)("Sat","wp-marketing-automations")},Ie=function(e){var t=e.data,n=e.selected,i=void 0!==n&&n,c=e.id,u=Le(Object(r.useState)({status:!1,loading:!0}),2),p=u[0],d=u[1],y=Object(f.a)(),v=y.deleteNode,O=y.setAutomationData,w=y.showSidebar,j=y.setNodeForAdd,g=y.copyNodeHere,E=y.setOpenStepModal,_=y.setModalAnchorNode,k=y.fetchSplitPathNodes,N=Object(m.a)(),S=N.getNodeDataByID,P=N.getEnableCopy,x=N.getEnableMove,L=N.getLastAddedNode,C=N.getStatLoading,A=N.getStatData,T=L(),I=!Object(o.isEmpty)(t)&&t.hasOwnProperty("sidebarValues")?t.sidebarValues:{},D=I.type,M=void 0===D?0:D,F=I.data,G=void 0===F?{}:F,R=C(),H=A();Object(r.useEffect)((function(){T==c&&(O("sidebarNodeData",e),w(!0),O("lastAddedNode",0))}),[T]);var V=function(){switch(parseInt(M)){case 1:var e=G.day_delay,t=void 0===e?{}:e,n=G.enable_time_delay,a=void 0!==n&&n,i=G.enable_week_delay,c=void 0!==i&&i,s=G.time_delay,u=void 0===s?{time:""}:s,f=G.week_delay,m=void 0===f?[]:f;if(!Object(o.isEmpty)(t)){var b=Object(l.__)("Delay of","wp-marketing-automations")+" "+t.text+" "+function(e,t){switch(e){case"min":return parseInt(t)>1?Object(l.__)("Minutes","wp-marketing-automations"):Object(l.__)("Minute","wp-marketing-automations");case"hours":return parseInt(t)>1?Object(l.__)("Hours","wp-marketing-automations"):Object(l.__)("Hour","wp-marketing-automations");case"days":return parseInt(t)>1?Object(l.__)("Days","wp-marketing-automations"):Object(l.__)("Day","wp-marketing-automations");case"weeks":return parseInt(t)>1?Object(l.__)("Weeks","wp-marketing-automations"):Object(l.__)("Week","wp-marketing-automations");case"months":return parseInt(t)>1?Object(l.__)("Months","wp-marketing-automations"):Object(l.__)("Month","wp-marketing-automations");default:return""}}(t.unit,t.text),p=[];c&&!Object(o.isEmpty)(m)&&m.map((function(e){Te.hasOwnProperty(e)&&p.push(Te[e])}));var d=Object(o.isEmpty)(p)?Object(l.__)("Skip to next day if time has passed","wp-marketing-automations"):Object(l.__)("Skip to next occurrence if time has passed","wp-marketing-automations");return a&&u.hasOwnProperty("time")&&!Object(o.isEmpty)(u.time)?(b+=" till "+Object(_e.format)(bwfcrm_contacts_data.time_format,Ne()(u.time,"HH:mm:ss")),Object(o.isEmpty)(p)||(b+=" "+p.join("/")),u.hasOwnProperty("in_contact_timezone")&&u.in_contact_timezone&&(b+=" ".concat(Object(l.__)("in Contact's Timezone","wp-marketing-automations"))),b+=". "+d):Object(o.isEmpty)(p)||(b+=" "+p.join("/"),b+=". "+d),b+"."}break;case 2:var h=G.date,y=void 0===h?"":h,v=G.time_delay,O=void 0===v?{time:"",in_contact_timezone:!1}:v,w=G.enable_step_skip,j=void 0!==w&&w,g=G.skip_to_step,E=void 0===g?{step:"",name:""}:g;if(!Object(o.isEmpty)(y)&&!Object(o.isEmpty)(O.time)){var _="",k="";if(O.hasOwnProperty("in_contact_timezone")&&O.in_contact_timezone?_+=" ".concat(Object(l.__)("in Contact's Timezone.","wp-marketing-automations")):_+=".",j&&!Object(o.isEmpty)(E)&&E.hasOwnProperty("step")&&""!=E.step&&E.hasOwnProperty("name")&&""!=E.name){var N=E.name.split(":");k=" ".concat(Object(l.__)("Jumps to","wp-marketing-automations")," ").concat(N[0]," ").concat(Object(l.__)("if time has passed","wp-marketing-automations"))}return Object(l.__)("Delay till ","wp-marketing-automations")+" "+Object(_e.format)(bwfcrm_contacts_data.date_format,Ne()(y))+" "+Object(l.__)("at","wp-marketing-automations")+" "+Object(_e.format)(bwfcrm_contacts_data.time_format,Ne()(O.time,"HH:mm:ss"))+" "+_+k}break;case 3:var S=G.custom_field,P=G.enable_time_delay,x=void 0!==P&&P,L=G.time_delay,C=G.enable_step_skip,A=void 0!==C&&C,T=G.skip_to_step,I=G.occurrence,D=void 0===I?"daymonth":I;if(S.hasOwnProperty("field")&&""!==S.field){var F=Object(l.__)("Delay","wp-marketing-automations");if(x?L.hasOwnProperty("duration")&&(F+=" ".concat(Object(l.__)("of","wp-marketing-automations")," ").concat(L.duration," ").concat(L.type," ").concat(L.timing," ")):F+=" ".concat(Object(l.__)("till","wp-marketing-automations")),S.hasOwnProperty("custom_field_label")&&""!==S.custom_field_label?F+=" ".concat(Object(l.__)("Contact's","wp-marketing-automations")," '").concat(S.custom_field_label,"' "):F+=" ".concat(Object(l.__)("Contacts","wp-marketing-automations")," ( ").concat(S.field," ) ").concat(Object(l.__)("field value","wp-marketing-automations")),"fulldatetime"!==D&&S.hasOwnProperty("time")&&""!==S.time&&(F+=" till ".concat(Object(_e.format)(bwfcrm_contacts_data.time_format,Ne()(S.time,"HH:mm:ss")))),S.hasOwnProperty("in_contact_timezone")&&S.in_contact_timezone?F+=" ".concat(Object(l.__)("in Contact's Timezone.","wp-marketing-automations")):F+=".",A&&!Object(o.isEmpty)(T)&&T.hasOwnProperty("step")&&""!=T.step&&T.hasOwnProperty("name")&&""!=T.name){var z=T.name.split(":");F+=" ".concat(Object(l.__)("Jumps to","wp-marketing-automations")," ").concat(z[0]," ").concat(Object(l.__)("if time has passed","wp-marketing-automations"),".")}return F}break;case 4:var Y=G.variable_field,U=G.enable_time_delay,q=void 0!==U&&U,B=G.time_delay,R=G.enable_step_skip,H=void 0!==R&&R,V=G.skip_to_step;if(Y.hasOwnProperty("variable")&&""!==Y.variable){var J=Object(l.__)("Delay","wp-marketing-automations");if(q?B.hasOwnProperty("duration")&&(J+=" ".concat(Object(l.__)("of","wp-marketing-automations")," ").concat(B.duration," ").concat(B.type," ").concat(B.timing," ")):J+=" "+Object(l.__)("till","wp-marketing-automations"),Y.hasOwnProperty("variable")&&""!==Y.variable&&(J+=" ".concat(Object(l.__)("Orders meta key","wp-marketing-automations")," ").concat(Y.variable," value")),Y.hasOwnProperty("time")&&""!==Y.time&&(J+=" till ".concat(Object(_e.format)(bwfcrm_contacts_data.time_format,Ne()(Y.time,"HH:mm:ss")))),Y.hasOwnProperty("in_contact_timezone")&&Y.in_contact_timezone?J+=" ".concat(Object(l.__)("in Contact's Timezone.","wp-marketing-automations")):J+=".",H&&!Object(o.isEmpty)(V)&&V.hasOwnProperty("step")&&""!=V.step&&V.hasOwnProperty("name")&&""!=V.name){var $=V.name.split(":");J+=" ".concat(Object(l.__)("Jumps to","wp-marketing-automations")," ").concat($[0]," ").concat(Object(l.__)("if time has passed","wp-marketing-automations"),".")}return J}break;default:return Object(r.createElement)(r.Fragment,null)}return Object(r.createElement)(r.Fragment,null)},J=P(),$=x(),W=S(e.id),Q=W.hasMultiParents,X=void 0!==Q&&Q,Z=W.stepId,ee=W.step_status,te=void 0===ee?1:ee,ne=H.hasOwnProperty(Z)?H[Z]:{},re=z({onNodeClick:function(){Z&&Object(B.l)({stepid:Z},"/"),O("sidebarNodeData",e),w(!0)},onNodeStatClick:function(){O("showContactModalId",Z),O("showContactModalType","completed")},onNodeQueuedStatClick:function(){O("showContactModalId",Z),O("showContactModalType","queued")},onNodeFailedStatClick:function(){O("showContactModalId",Z),O("showContactModalType","failed")}});return Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"bwf-node-wrapper","data-stepid":Z},Object(r.createElement)(a.d,{type:"target",position:"top",isConnectable:!1}),Object(r.createElement)("div",{className:"bwf-inner-wrapper "+(i?"bwf-selected-node":"")+(2===parseInt(te)?" bwf-draft-node":""),onClick:re},Object(r.createElement)("div",{className:"bwf-node-brick"},Object(r.createElement)("div",{className:"bwf-node-icon icon-delay"},Object(r.createElement)(s.a,{size:28,icon:"time-left"})),Object(r.createElement)("div",{className:"bwf-node-inner-content"},Object(r.createElement)("div",{className:"bwf-node-content-type"},Object(l.__)("Step","wp-marketing-automations")+" "+c),Object(r.createElement)("div",{className:"bwf-node-content-label"},Object(l.__)("Delay","wp-marketing-automations"))),Object(r.createElement)("div",{className:"bwf-node-action"},Object(r.createElement)(K,{node:e}),Object(r.createElement)(q.a,{label:Object(l.__)("Quick Actions","wp-marketing-automations"),classes:"bwf-event-action",isDisable:!(!J&&!$),renderContent:function(t){var n=t.onToggle,a=k();return Object(r.createElement)(r.Fragment,null,Object(r.createElement)(Y.a,{isClickable:!0,onInvoke:function(){Object(b.ac)()?(O("enableCopy",!0),O("copyData",{type:"wait",data:e.data})):(O("proModalContent",{featureTitle:Object(l.__)("Copy Step","wp-marketing-automations"),proLink:Object(b.fb)("upgrade",{utm_medium:"Automation+Copy+step+Upgrade+Modal"})}),O("showProModal",!0)),n()}},Object(r.createElement)(U.a,{justify:"space-between"},Object(r.createElement)(U.c,null,Object(l.__)("Copy","wp-marketing-automations")),!Object(b.ac)()&&Object(r.createElement)(U.c,null,b.e))),!a.includes(c)&&Object(r.createElement)(Y.a,{isClickable:!0,onInvoke:function(){Object(b.ac)()?(O("enableMove",!0),O("moveID",e.id),O("copyData",{type:"wait",data:e.data})):(O("proModalContent",{featureTitle:Object(l.__)("Move Step","wp-marketing-automations"),proLink:Object(b.fb)("upgrade",{utm_medium:"Automation+Copy+step+Upgrade+Modal"})}),O("showProModal",!0)),n()}},Object(r.createElement)(U.a,{justify:"space-between"},Object(r.createElement)(U.c,null,Object(l.__)("Move","wp-marketing-automations")),!Object(b.ac)()&&Object(r.createElement)(U.c,null,b.e))),Object(r.createElement)(Y.a,{isClickable:!0,onInvoke:function(){var t,r;d({status:!0,onConfirm:(t=Pe().mark((function t(){return Pe().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,v(e).then((function(){return d({status:!1})}));case 2:case"end":return t.stop()}}),t)})),r=function(){var e=this,n=arguments;return new Promise((function(r,a){var o=t.apply(e,n);function i(e){xe(o,r,a,i,c,"next",e)}function c(e){xe(o,r,a,i,c,"throw",e)}i(void 0)}))},function(){return r.apply(this,arguments)})}),n()}},Object(r.createElement)(U.a,{justify:"flex-start"},Object(r.createElement)(U.c,null,Object(l.__)("Delete","wp-marketing-automations")))))}}))),Object(o.isEmpty)(t)||!parseInt(M)>0?Object(r.createElement)("div",{className:"bwf-control-event-error"},Object(r.createElement)("div",{className:"bwf-control-error-msg bwf-cursor-pointer"},Object(l.__)("Not Configured","wp-marketing-automations"))):Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"bwf-node-step-content"},Object(r.createElement)("div",{className:"bwf-step-content"},Object(r.createElement)("div",{className:"bwf-step-brick"},Object(r.createElement)("div",{className:"bwf-step-content-content"},Ae.hasOwnProperty(M)&&Object(r.createElement)("div",{className:"bwf-node-content-type"},Ae[M]),Object(r.createElement)("div",{className:"bwf-node-content-label bwf-two-line-ellipse-text",title:V()},V())))))),Object(r.createElement)("div",{className:"bwf-node-status "+(Object(o.isEmpty)(t)?"bwf-mt-0":"")},Object(r.createElement)("div",{className:"bwf-queued-status-wrap"},Object(r.createElement)("span",{className:"bwf-node-status-label"},Object(l.__)("Queued","wp-marketing-automations")),Object(r.createElement)("span",{className:"bwf-node-status-count"},R?Object(r.createElement)("div",{className:"bwf-placeholder-temp bwf-w-20 bwf-h-10"}):Object(r.createElement)(r.Fragment,null,ne.hasOwnProperty("queued")?Object(b.tc)(parseInt(ne.queued)):0))),!Object(o.isEmpty)(t)&&Object(r.createElement)("div",{className:"bwf-status-wrap"},Object(r.createElement)("span",{className:"bwf-node-status-label"},Object(l.__)("Completed","wp-marketing-automations")),Object(r.createElement)("span",{className:"bwf-node-status-count"},R?Object(r.createElement)("div",{className:"bwf-placeholder-temp bwf-w-20 bwf-h-10"}):Object(r.createElement)(r.Fragment,null,ne.hasOwnProperty("completed")?Object(b.tc)(parseInt(ne.completed)):0))),!R&&ne.hasOwnProperty("failed")&&parseInt(ne.failed)>0&&Object(r.createElement)("div",{className:"bwf-failed-status-wrap"},Object(r.createElement)("span",{className:"bwf-node-status-label"},Object(l.__)("Failed","wp-marketing-automations")),Object(r.createElement)("span",{className:"bwf-node-status-count bwf-failed-status"},Object(b.tc)(parseInt(ne.failed))))),Object(r.createElement)(a.d,{type:"source",position:"bottom",isConnectable:!1})),X&&Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"bwf-node-plus-paste-wrap bwf-pos-top"},J||$?Object(r.createElement)("div",{className:"bwf-drag-area",onClick:function(){return g(e,"before","")}},Object(r.createElement)("div",{className:"bwf-drag-node is-copy-paste"},Object(r.createElement)("div",{className:"bwf-node-add"})),Object(r.createElement)("div",{className:"bwf-paste-label"},Object(l.__)("Paste Here","wp-marketing-automations"))):Object(r.createElement)("div",{className:"bwf-node-add",onClick:function(t){j(e.id,{option:"",position:"before"}),E(!0),_(t.target)}})))),Object(r.createElement)(h.a,{modalTitle:Object(l.__)("Delete Delay Step","wp-marketing-automations"),deleteEntityName:Object(l.__)("delay step","wp-marketing-automations"),confirmButtonText:Object(l.__)("Delete","wp-marketing-automations"),onConfirm:p.onConfirm,isLoading:!1,onRequestClose:function(){return d({status:!1})},isOpen:p.status,isDelete:!0,deleteDescriptionText:Object(l.__)("Once you delete this step, all the queued contacts will move to next step right away.","wp-marketing-automations")}))},De=function(e){var t=Object(f.a)().deleteNode;return Object(r.createElement)("div",{className:e&&e.data&&e.data.direction&&"no"===e.data.direction?"bwf-yes-no-node bwf-no-node":"bwf-yes-no-node bwf-yes-node"},Object(r.createElement)(a.d,{type:"target",position:"top",style:{opacity:0},isConnectable:!1}),Object(r.createElement)("span",{className:"bwf-yes-no-wrap"},e&&e.data&&e.data.direction&&"no"===e.data.direction?Object(l.__)("No","wp-marketing-automations"):Object(l.__)("Yes","wp-marketing-automations"),Object(r.createElement)("button",{style:{display:"none"},onClick:function(){return t(e)}},"del")),Object(r.createElement)(a.d,{type:"source",position:"bottom",style:{opacity:0},isConnectable:!1}))};function Me(e){return(Me="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)}function Fe(){Fe=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof h?t:h,i=Object.create(o.prototype),c=new x(r||[]);return a(i,"_invoke",{value:k(e,n,c)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var m="suspendedStart",b="executing",p="completed",d={};function h(){}function y(){}function v(){}var O={};s(O,i,(function(){return this}));var w=Object.getPrototypeOf,j=w&&w(w(L([])));j&&j!==n&&r.call(j,i)&&(O=j);var g=v.prototype=h.prototype=Object.create(O);function E(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function _(e,t){function n(a,o,i,c){var l=f(e[a],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==Me(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,i,c)}),(function(e){n("throw",e,i,c)})):t.resolve(u).then((function(e){s.value=e,i(s)}),(function(e){return n("throw",e,i,c)}))}c(l.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function k(t,n,r){var a=m;return function(o,i){if(a===b)throw Error("Generator is already running");if(a===p){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===d)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=p,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=b;var s=f(t,n,r);if("normal"===s.type){if(a=r.done?p:"suspendedYield",s.arg===d)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(a=p,r.method="throw",r.arg=s.arg)}}}function N(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),d;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,d;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,d):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,d)}function S(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(S,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(Me(t)+" is not iterable")}return y.prototype=v,a(g,"constructor",{value:v,configurable:!0}),a(v,"constructor",{value:y,configurable:!0}),y.displayName=s(v,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===y||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,v):(e.__proto__=v,s(e,l,"GeneratorFunction")),e.prototype=Object.create(g),e},t.awrap=function(e){return{__await:e}},E(_.prototype),s(_.prototype,c,(function(){return this})),t.AsyncIterator=_,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new _(u(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},E(g),s(g,l,"Generator"),s(g,i,(function(){return this})),s(g,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=L,x.prototype={constructor:x,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function a(r,a){return c.type="throw",c.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],c=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var l=r.call(i,"catchLoc"),s=r.call(i,"finallyLoc");if(l&&s){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,d):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),d},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var a=r.arg;P(n)}return a}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),d}},t}function Ge(e,t,n,r,a,o,i){try{var c=e[o](i),l=c.value}catch(e){return void n(e)}c.done?t(l):Promise.resolve(l).then(r,a)}function ze(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(s)throw a}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Ye(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ye(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ye(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var Ue=function(e){var t=e.selected,n=void 0!==t&&t,o=e.id,i=ze(Object(r.useState)({status:!1,loading:!0}),2),c=i[0],u=i[1],p=Object(f.a)(),d=p.deleteNode,y=p.setAutomationData,v=p.setNodeForAdd,O=p.copyNodeHere,w=p.setOpenStepModal,j=p.setModalAnchorNode,g=Object(m.a)(),E=g.getNodeDataByID,_=g.getEnableCopy,k=g.getEnableMove,N=g.getLastAddedNode,S=g.getStatLoading,P=g.getStatData,x=N(),L=_(),C=k(),A=S(),T=P();Object(r.useEffect)((function(){x==o&&y("lastAddedNode",0)}),[x]);var I=E(e.id),D=I.hasMultiParents,M=void 0!==D&&D,F=I.stepId,G=T.hasOwnProperty(F)?T[F]:{},B=z({onNodeStatClick:function(){y("showContactModalId",F),y("showContactModalType","completed")}});return Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"bwf-node-wrapper","data-stepid":F},Object(r.createElement)(a.d,{type:"target",position:"top",isConnectable:!1}),b.Yb?Object(r.createElement)("div",{className:"bwf-inner-wrapper "+(n?"bwf-selected-node":""),onClick:function(){y("proModalContent","Exit Step"),y("showProModal",!0)}},Object(r.createElement)("div",{className:"bwf-node-brick"},Object(r.createElement)("div",{className:"bwf-node-icon icon-exit"},Object(r.createElement)(s.a,{size:26,icon:"exit"})),Object(r.createElement)("div",{className:"bwf-node-inner-content"},Object(r.createElement)("div",{className:"bwf-node-content-type"},Object(l.__)("Step","wp-marketing-automations")+" "+o),Object(r.createElement)("div",{className:"bwf-node-content-label"},Object(l.__)("Exit Automation","wp-marketing-automations"))),Object(r.createElement)("div",{className:"bwf-node-action"})),Object(r.createElement)("div",{className:"bwf-control-event-error"},Object(r.createElement)("div",{className:"bwf-control-error-msg bwf-cursor-pointer bwf-display-flex"},Object(r.createElement)(s.a,{icon:"king",size:16,color:"#E15334"}),Object(l.__)("Pro Feature","wp-marketing-automations")))):Object(r.createElement)("div",{className:"bwf-inner-wrapper "+(n?"bwf-selected-node":""),onClick:B},Object(r.createElement)("div",{className:"bwf-node-brick"},Object(r.createElement)("div",{className:"bwf-node-icon icon-exit"},Object(r.createElement)(s.a,{size:26,icon:"exit"})),Object(r.createElement)("div",{className:"bwf-node-inner-content"},Object(r.createElement)("div",{className:"bwf-node-content-type"},Object(l.__)("Step","wp-marketing-automations")+" "+o),Object(r.createElement)("div",{className:"bwf-node-content-label"},Object(l.__)("Exit Automation","wp-marketing-automations"))),Object(r.createElement)("div",{className:"bwf-node-action"},Object(r.createElement)(q.a,{label:Object(l.__)("Quick Actions","wp-marketing-automations"),classes:"bwf-event-action",isDisable:!(!L&&!C),renderContent:function(t){var n=t.onToggle;return Object(r.createElement)(r.Fragment,null,Object(r.createElement)(Y.a,{isClickable:!0,onInvoke:function(){var t,r;u({status:!0,onConfirm:(t=Fe().mark((function t(){return Fe().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,d(e).then((function(){return u({status:!1})}));case 2:case"end":return t.stop()}}),t)})),r=function(){var e=this,n=arguments;return new Promise((function(r,a){var o=t.apply(e,n);function i(e){Ge(o,r,a,i,c,"next",e)}function c(e){Ge(o,r,a,i,c,"throw",e)}i(void 0)}))},function(){return r.apply(this,arguments)})}),n()}},Object(r.createElement)(U.a,{justify:"flex-start"},Object(r.createElement)(U.c,null,Object(l.__)("Delete","wp-marketing-automations")))))}}))),Object(r.createElement)("div",{className:"bwf-node-status"},Object(r.createElement)("div",{className:"bwf-status-wrap"},Object(r.createElement)("span",{className:"bwf-node-status-label"},Object(l.__)("Completed","wp-marketing-automations")),Object(r.createElement)("span",{className:"bwf-node-status-count"},A?Object(r.createElement)("div",{className:"bwf-placeholder-temp bwf-w-20 bwf-h-10"}):Object(r.createElement)(r.Fragment,null,G.hasOwnProperty("completed")?Object(b.tc)(parseInt(G.completed)):0))))),M&&Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"bwf-node-plus-paste-wrap bwf-pos-top"},L||C?Object(r.createElement)("div",{className:"bwf-drag-area",onClick:function(){return O(e,"before","")}},Object(r.createElement)("div",{className:"bwf-drag-node is-copy-paste"},Object(r.createElement)("div",{className:"bwf-node-add"}))):Object(r.createElement)("div",{className:"bwf-node-add",onClick:function(t){v(e.id,{option:"",position:"before"}),w(!0),j(t.target)}})))),Object(r.createElement)(a.d,{type:"source",position:"bottom",isConnectable:!1,style:{opacity:0}}),Object(r.createElement)(h.a,{modalTitle:Object(l.__)("Delete Exit Step","wp-marketing-automations"),deleteEntityName:Object(l.__)("exit step","wp-marketing-automations"),confirmButtonText:Object(l.__)("Delete","wp-marketing-automations"),onConfirm:c.onConfirm,isLoading:!1,onRequestClose:function(){return u({status:!1})},isOpen:c.status,isDelete:!0}))};function qe(e){return(qe="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)}function Be(){Be=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof h?t:h,i=Object.create(o.prototype),c=new x(r||[]);return a(i,"_invoke",{value:k(e,n,c)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var m="suspendedStart",b="executing",p="completed",d={};function h(){}function y(){}function v(){}var O={};s(O,i,(function(){return this}));var w=Object.getPrototypeOf,j=w&&w(w(L([])));j&&j!==n&&r.call(j,i)&&(O=j);var g=v.prototype=h.prototype=Object.create(O);function E(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function _(e,t){function n(a,o,i,c){var l=f(e[a],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==qe(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,i,c)}),(function(e){n("throw",e,i,c)})):t.resolve(u).then((function(e){s.value=e,i(s)}),(function(e){return n("throw",e,i,c)}))}c(l.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function k(t,n,r){var a=m;return function(o,i){if(a===b)throw Error("Generator is already running");if(a===p){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===d)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=p,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=b;var s=f(t,n,r);if("normal"===s.type){if(a=r.done?p:"suspendedYield",s.arg===d)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(a=p,r.method="throw",r.arg=s.arg)}}}function N(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),d;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,d;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,d):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,d)}function S(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(S,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(qe(t)+" is not iterable")}return y.prototype=v,a(g,"constructor",{value:v,configurable:!0}),a(v,"constructor",{value:y,configurable:!0}),y.displayName=s(v,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===y||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,v):(e.__proto__=v,s(e,l,"GeneratorFunction")),e.prototype=Object.create(g),e},t.awrap=function(e){return{__await:e}},E(_.prototype),s(_.prototype,c,(function(){return this})),t.AsyncIterator=_,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new _(u(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},E(g),s(g,l,"Generator"),s(g,i,(function(){return this})),s(g,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=L,x.prototype={constructor:x,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function a(r,a){return c.type="throw",c.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],c=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var l=r.call(i,"catchLoc"),s=r.call(i,"finallyLoc");if(l&&s){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,d):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),d},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var a=r.arg;P(n)}return a}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),d}},t}function Re(e,t,n,r,a,o,i){try{var c=e[o](i),l=c.value}catch(e){return void n(e)}c.done?t(l):Promise.resolve(l).then(r,a)}function He(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){Re(o,r,a,i,c,"next",e)}function c(e){Re(o,r,a,i,c,"throw",e)}i(void 0)}))}}function Ve(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(s)throw a}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Je(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Je(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Je(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var $e=function(e){var t=e.data,n=void 0===t?{}:t,i=e.selected,c=void 0!==i&&i,u=e.id,p=Ve(Object(r.useState)({status:!1,loading:!0}),2),d=p[0],y=p[1],v=Object(f.a)(),O=v.deleteNode,w=v.setAutomationData,j=v.setNodeForAdd,g=v.copyNodeHere,E=v.setOpenStepModal,_=v.setModalAnchorNode,k=v.showSidebar,N=Object(m.a)(),S=N.getNodeDataByID,P=N.getEnableCopy,x=N.getEnableMove,L=N.getLastAddedNode,C=N.getStatLoading,A=N.getStatData,T=L(),I=P(),D=x(),M=C(),F=A();Object(r.useEffect)((function(){T==u&&w("lastAddedNode",0)}),[T]);var G=(!Object(o.isEmpty)(n)&&n.hasOwnProperty("sidebarValues")?n.sidebarValues:{}).jump_to,R=void 0===G?{}:G,H=R.name,V=void 0===H?"":H,J=R.step,$=void 0===J?"":J,W=S(e.id),Q=W.hasMultiParents,X=void 0!==Q&&Q,Z=W.stepId,K=F.hasOwnProperty(Z)?F[Z]:{},ee=z({onNodeClick:function(){Z&&Object(B.l)({stepid:Z},"/"),w("sidebarNodeData",e),k(!0)},onNodeStatClick:function(){Object(b.ac)()?(w("showContactModalId",Z),w("showContactModalType","completed")):(w("proModalContent","Jump Step"),w("showProModal",!0))}});return Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"bwf-node-wrapper","data-stepid":Z},Object(r.createElement)(a.d,{type:"target",position:"top",isConnectable:!1}),b.Yb?Object(r.createElement)("div",{className:"bwf-inner-wrapper "+(c?"bwf-selected-node":""),onClick:function(){w("proModalContent","Jump Step"),w("showProModal",!0)}},Object(r.createElement)("div",{className:"bwf-node-brick"},Object(r.createElement)("div",{className:"bwf-node-icon icon-exit"},Object(r.createElement)(s.a,{size:26,icon:"jump"})),Object(r.createElement)("div",{className:"bwf-node-inner-content"},Object(r.createElement)("div",{className:"bwf-node-content-type"},Object(l.__)("Step","wp-marketing-automations")+" "+u),Object(r.createElement)("div",{className:"bwf-node-content-label"},Object(l.__)("Jump","wp-marketing-automations"))),Object(r.createElement)("div",{className:"bwf-node-action"})),Object(r.createElement)("div",{className:"bwf-control-event-error"},Object(r.createElement)("div",{className:"bwf-control-error-msg bwf-cursor-pointer bwf-display-flex"},Object(r.createElement)(s.a,{icon:"king",size:16,color:"#E15334"}),Object(l.__)("Pro Feature","wp-marketing-automations")))):Object(r.createElement)("div",{className:"bwf-inner-wrapper "+(c?"bwf-selected-node":""),onClick:ee},Object(r.createElement)("div",{className:"bwf-node-brick"},Object(r.createElement)("div",{className:"bwf-node-icon icon-exit"},Object(r.createElement)(s.a,{size:26,icon:"jump"})),Object(r.createElement)("div",{className:"bwf-node-inner-content"},Object(r.createElement)("div",{className:"bwf-node-content-type"},Object(l.__)("Step","wp-marketing-automations")+" "+u),Object(r.createElement)("div",{className:"bwf-node-content-label"},Object(l.__)("Jump","wp-marketing-automations"))),Object(r.createElement)("div",{className:"bwf-node-action"},Object(r.createElement)(q.a,{label:Object(l.__)("Quick Actions","wp-marketing-automations"),classes:"bwf-event-action",isDisable:!(!I&&!D),renderContent:function(t){var n=t.onToggle;return Object(r.createElement)(r.Fragment,null,""!=$&&Object(r.createElement)(r.Fragment,null,Object(r.createElement)(Y.a,{isClickable:!0,onInvoke:function(){Object(b.ac)()?(w("enableCopy",!0),w("copyData",{type:"jump",data:e.data})):(w("proModalContent","Copy Step"),w("showProModal",!0)),n()}},Object(r.createElement)(U.a,{justify:"space-between"},Object(r.createElement)(U.c,null,Object(l.__)("Copy","wp-marketing-automations")),!Object(b.ac)()&&Object(r.createElement)(U.c,null,b.e))),Object(r.createElement)(Y.a,{isClickable:!0,onInvoke:He(Be().mark((function t(){return Be().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:Object(b.ac)()?(w("enableMove",!0),w("moveID",e.id),w("copyData",{type:"jump",data:e.data})):(w("proModalContent","Move Step"),w("showProModal",!0)),n();case 2:case"end":return t.stop()}}),t)})))},Object(r.createElement)(U.a,{justify:"space-between"},Object(r.createElement)(U.c,null,Object(l.__)("Move","wp-marketing-automations")),!Object(b.ac)()&&Object(r.createElement)(U.c,null,b.e)))),Object(r.createElement)(Y.a,{isClickable:!0,onInvoke:function(){var t;y({status:!0,onConfirm:(t=He(Be().mark((function t(){return Be().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,O(e).then((function(){return y({status:!1})}));case 2:case"end":return t.stop()}}),t)}))),function(){return t.apply(this,arguments)})}),n()}},Object(r.createElement)(U.a,{justify:"flex-start"},Object(r.createElement)(U.c,null,Object(l.__)("Delete","wp-marketing-automations")))))}}))),Object(o.isEmpty)(n)||Object(o.isEmpty)(R)||""==$?Object(r.createElement)("div",{className:"bwf-control-event-error no-padding"},Object(r.createElement)("div",{className:"bwf-control-error-msg bwf-cursor-pointer"},Object(l.__)("Not Configured","wp-marketing-automations"))):Object(r.createElement)("div",{className:"bwf-node-step-content"},Object(r.createElement)("div",{className:"bwf-step-content"},Object(r.createElement)("div",{className:"bwf-step-brick"},Object(r.createElement)("div",{className:"bwf-step-content-content"},Object(r.createElement)("div",{className:"bwf-node-content-type"},Object(l.__)("Jump to","wp-marketing-automations")),Object(r.createElement)("div",{className:"bwf-node-content-label bwf-two-line-ellipse-text"},""!==V?V:"step #"+$))))),Object(r.createElement)("div",{className:"bwf-node-status"},Object(r.createElement)("div",{className:"bwf-status-wrap"},Object(r.createElement)("span",{className:"bwf-node-status-label"},Object(l.__)("Completed","wp-marketing-automations")),Object(r.createElement)("span",{className:"bwf-node-status-count"},M?Object(r.createElement)("div",{className:"bwf-placeholder-temp bwf-w-20 bwf-h-10"}):Object(r.createElement)(r.Fragment,null,K.hasOwnProperty("completed")?Object(b.tc)(parseInt(K.completed)):0))))),X&&Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"bwf-node-plus-paste-wrap bwf-pos-top"},I||D?Object(r.createElement)("div",{className:"bwf-drag-area",onClick:function(){return g(e,"before","")}},Object(r.createElement)("div",{className:"bwf-drag-node is-copy-paste"},Object(r.createElement)("div",{className:"bwf-node-add"}))):Object(r.createElement)("div",{className:"bwf-node-add",onClick:function(t){j(e.id,{option:"",position:"before"}),E(!0),_(t.target)}})))),Object(r.createElement)(a.d,{type:"source",position:"bottom",isConnectable:!1,style:{opacity:0}}),Object(r.createElement)(h.a,{modalTitle:Object(l.__)("Delete Jump Step","wp-marketing-automations"),deleteEntityName:Object(l.__)("jump step","wp-marketing-automations"),confirmButtonText:Object(l.__)("Delete","wp-marketing-automations"),onConfirm:d.onConfirm,isLoading:!1,onRequestClose:function(){return y({status:!1})},isOpen:d.status,isDelete:!0}))};function We(e){return(We="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)}function Qe(){Qe=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof h?t:h,i=Object.create(o.prototype),c=new x(r||[]);return a(i,"_invoke",{value:k(e,n,c)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var m="suspendedStart",b="executing",p="completed",d={};function h(){}function y(){}function v(){}var O={};s(O,i,(function(){return this}));var w=Object.getPrototypeOf,j=w&&w(w(L([])));j&&j!==n&&r.call(j,i)&&(O=j);var g=v.prototype=h.prototype=Object.create(O);function E(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function _(e,t){function n(a,o,i,c){var l=f(e[a],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==We(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,i,c)}),(function(e){n("throw",e,i,c)})):t.resolve(u).then((function(e){s.value=e,i(s)}),(function(e){return n("throw",e,i,c)}))}c(l.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function k(t,n,r){var a=m;return function(o,i){if(a===b)throw Error("Generator is already running");if(a===p){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===d)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=p,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=b;var s=f(t,n,r);if("normal"===s.type){if(a=r.done?p:"suspendedYield",s.arg===d)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(a=p,r.method="throw",r.arg=s.arg)}}}function N(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),d;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,d;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,d):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,d)}function S(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(S,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(We(t)+" is not iterable")}return y.prototype=v,a(g,"constructor",{value:v,configurable:!0}),a(v,"constructor",{value:y,configurable:!0}),y.displayName=s(v,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===y||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,v):(e.__proto__=v,s(e,l,"GeneratorFunction")),e.prototype=Object.create(g),e},t.awrap=function(e){return{__await:e}},E(_.prototype),s(_.prototype,c,(function(){return this})),t.AsyncIterator=_,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new _(u(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},E(g),s(g,l,"Generator"),s(g,i,(function(){return this})),s(g,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=L,x.prototype={constructor:x,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function a(r,a){return c.type="throw",c.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],c=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var l=r.call(i,"catchLoc"),s=r.call(i,"finallyLoc");if(l&&s){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,d):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),d},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var a=r.arg;P(n)}return a}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),d}},t}function Xe(e,t,n,r,a,o,i){try{var c=e[o](i),l=c.value}catch(e){return void n(e)}c.done?t(l):Promise.resolve(l).then(r,a)}function Ze(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(s)throw a}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Ke(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ke(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ke(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var et=function(e){var t=e.selected,n=void 0!==t&&t,i=e.id,c=e.data,u=void 0===c?{}:c,p=Ze(Object(r.useState)({status:!1,loading:!0}),2),d=p[0],y=p[1],v=Object(f.a)(),O=v.deleteNode,w=v.setAutomationData,j=v.setNodeForAdd,g=v.copyNodeHere,E=v.setOpenStepModal,_=v.setModalAnchorNode,k=v.showSidebar,N=Object(m.a)(),S=N.getNodeDataByID,P=N.getEnableCopy,x=N.getEnableMove,L=N.getLastAddedNode,C=N.getStatLoading,A=N.getStatData,T=L(),I=P(),D=x(),M=C(),F=A();Object(r.useEffect)((function(){T==i&&w("lastAddedNode",0)}),[T]);var G=S(e.id),R=G.hasMultiParents,H=void 0!==R&&R,V=G.stepId,J=F.hasOwnProperty(V)?F[V]:{},$=!Object(o.isEmpty)(u)&&u.hasOwnProperty("sidebarValues")?u.sidebarValues:{},W=$.split_path,Q=void 0===W?"":W,X=$.title,Z=void 0===X?"":X,ee=$.desc,te=void 0===ee?"":ee,ne=z({onNodeClick:function(){V&&Object(B.l)({stepid:V},"/"),w("sidebarNodeData",e),k(!0)},onNodeStatClick:function(){Object(b.ac)()?(w("showContactModalId",V),w("showContactModalType","completed"),w("contactModalData",{split:!0,pathCount:Q})):(w("proModalContent","Split Path Step"),w("showProModal",!0))},onAnalyticsClick:function(){}});return Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"bwf-node-wrapper","data-stepid":V},Object(r.createElement)(a.d,{type:"target",position:"top",isConnectable:!1}),b.Yb?Object(r.createElement)("div",{className:"bwf-inner-wrapper "+(n?"bwf-selected-node":""),onClick:function(){w("proModalContent","Split Path Step"),w("showProModal",!0)}},Object(r.createElement)("div",{className:"bwf-node-brick"},Object(r.createElement)("div",{className:"bwf-node-icon icon-split-test"},Object(r.createElement)(s.a,{size:26,icon:"split-test"})),Object(r.createElement)("div",{className:"bwf-node-inner-content"},Object(r.createElement)("div",{className:"bwf-node-content-type"},Object(l.__)("Step","wp-marketing-automations")+" "+i),Object(r.createElement)("div",{className:"bwf-node-content-label"},Object(l.__)("Split Path","wp-marketing-automations"))),Object(r.createElement)("div",{className:"bwf-node-action"})),Object(r.createElement)("div",{className:"bwf-control-event-error"},Object(r.createElement)("div",{className:"bwf-control-error-msg bwf-cursor-pointer bwf-display-flex"},Object(r.createElement)(s.a,{icon:"king",size:16,color:"#E15334"}),Object(l.__)("Pro Feature","wp-marketing-automations")))):Object(r.createElement)("div",{className:"bwf-inner-wrapper "+(n?"bwf-selected-node":""),onClick:ne},Object(r.createElement)("div",{className:"bwf-node-brick"},Object(r.createElement)("div",{className:"bwf-node-icon icon-split-test"},Object(r.createElement)(s.a,{size:26,icon:"split-test"})),Object(r.createElement)("div",{className:"bwf-node-inner-content"},Object(r.createElement)("div",{className:"bwf-node-content-type"},Object(l.__)("Step","wp-marketing-automations")+" "+i),Object(r.createElement)("div",{className:"bwf-node-content-label"},Object(l.__)("Split Path","wp-marketing-automations"))),Object(r.createElement)("div",{className:"bwf-node-action"},Object(r.createElement)(K,{node:e}),Object(r.createElement)(q.a,{label:Object(l.__)("Quick Actions","wp-marketing-automations"),classes:"bwf-event-action",isDisable:!(!I&&!D),renderContent:function(t){var n=t.onToggle;return Object(r.createElement)(r.Fragment,null,Object(r.createElement)(Y.a,{isClickable:!0,onInvoke:function(){Object(b.ac)()?(w("enableMove",!0),w("moveID",e.id),w("copyData",{type:"split",data:e.data,id:e.id})):(w("proModalContent",Object(l.__)("Move Step","wp-marketing-automations")),w("showProModal",!0)),n()}},Object(r.createElement)(U.a,{justify:"space-between"},Object(r.createElement)(U.c,null,Object(l.__)("Move","wp-marketing-automations")),!Object(b.ac)()&&Object(r.createElement)(U.c,null,b.e))),Object(r.createElement)(Y.a,{isClickable:!0,onInvoke:function(){var t,r;y({status:!0,onConfirm:(t=Qe().mark((function t(){return Qe().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,O(e).then((function(){return y({status:!1})})).catch((function(e){y({status:!0,err:e.message})}));case 2:case"end":return t.stop()}}),t)})),r=function(){var e=this,n=arguments;return new Promise((function(r,a){var o=t.apply(e,n);function i(e){Xe(o,r,a,i,c,"next",e)}function c(e){Xe(o,r,a,i,c,"throw",e)}i(void 0)}))},function(){return r.apply(this,arguments)})}),n()}},Object(r.createElement)(U.a,{justify:"flex-start"},Object(r.createElement)(U.c,null,Object(l.__)("Delete","wp-marketing-automations")))))}}))),Object(o.isEmpty)(u)||Object(o.isEmpty)(Q)?Object(r.createElement)("div",{className:"bwf-control-event-error"},Object(r.createElement)("div",{className:"bwf-control-error-msg bwf-cursor-pointer"},Object(l.__)("Not Configured","wp-marketing-automations"))):Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"bwf-node-step-content"},Object(r.createElement)("div",{className:"bwf-step-content"},Object(r.createElement)("div",{className:"bwf-step-brick bwf-split-wrap"},Object(r.createElement)("div",{className:"bwf-step-content-content"},Object(r.createElement)("div",{className:"bwf-node-content-type"},""!==Z?Z:"-"),""!==te&&Object(r.createElement)("div",{className:"bwf-node-content-label bwf-node-desc bwf-two-line-ellipse-text"},te)),Object(r.createElement)("div",{className:"bwf-node-analytics bwf-split-path-analytics"},Object(r.createElement)("div",{className:"bwf-analytics-btn",onClick:function(){Object(b.ac)()?(w("declareWinner",{nodeId:i,stepID:V,title:Z}),w("showSplitWinner",!0)):(w("proModalContent",Object(l.__)("Split Step","wp-marketing-automations")),w("showProModal",!0))}},!Object(b.ac)()&&Object(r.createElement)(s.a,{icon:"king",size:14,color:"#fff"}),Object(l.__)("View Results","wp-marketing-automations")))))),Object(r.createElement)("div",{className:"bwf-node-status bwf-node-mt-10"},Object(r.createElement)("div",{className:"bwf-status-wrap"},Object(r.createElement)("span",{className:"bwf-node-status-label"},Object(l.__)("Completed","wp-marketing-automations")),Object(r.createElement)("span",{className:"bwf-node-status-count"},M?Object(r.createElement)("div",{className:"bwf-placeholder-temp bwf-w-20 bwf-h-10"}):Object(r.createElement)(r.Fragment,null,J.hasOwnProperty("completed")?Object(b.tc)(parseInt(J.completed)):0)))))),H&&Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"bwf-node-plus-paste-wrap bwf-pos-top"},I||D?Object(r.createElement)("div",{className:"bwf-drag-area",onClick:function(){return g(e,"before","")}},Object(r.createElement)("div",{className:"bwf-drag-node is-copy-paste"},Object(r.createElement)("div",{className:"bwf-node-add"}))):Object(r.createElement)("div",{className:"bwf-node-add",onClick:function(t){j(e.id,{option:"",position:"before"}),E(!0),_(t.target)}})))),Object(r.createElement)(a.d,{type:"source",position:"bottom",isConnectable:!1}),Object(r.createElement)(h.a,{modalTitle:Object(l.__)("Delete Split Step","wp-marketing-automations"),deleteEntityName:Object(l.__)("split step","wp-marketing-automations"),confirmButtonText:Object(l.__)("Delete","wp-marketing-automations"),onConfirm:d.onConfirm,isLoading:!1,onRequestClose:function(){return y({status:!1})},isOpen:d.status,isDelete:!0,showSupportLink:!0,errorMessage:null==d?void 0:d.err}))},tt=function(e){var t=e.data,n=void 0===t?{}:t,o=e.id,i=Object(m.a)().getNodeDataByID,c=Object(f.a)().deleteNode,s=i(o).stepId,u=Object(b.Pc)(),p=n.path,d=void 0===p?"1":p;return Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"bwf-splitpath-node-wrapper","data-stepid":s},Object(r.createElement)(a.d,{type:"target",position:"top",isConnectable:!1}),Object(r.createElement)("div",{className:"bwf-split-node split-path-"+d},Object(l.__)("Path","wp-marketing-automations")+" "+u[d],Object(r.createElement)("button",{style:{display:"none"},onClick:function(){return c(e)}},"del"))),Object(r.createElement)(a.d,{type:"source",position:"bottom",isConnectable:!1,style:{opacity:0}}))},nt=(n(1407),n(89)),rt=n(112),at=n(361),ot=n(23);n(1408);function it(e){return(it="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)}function ct(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 lt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ct(Object(n),!0).forEach((function(t){st(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ct(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function st(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=it(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=it(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==it(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ut(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(s)throw a}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ft(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ft(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ft(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var mt=function(e){var t=Object(r.useRef)(null),n=e.mergetag,a=e.copyTagToClipBoard,i=e.automationId,s=ut(Object(r.useState)({}),2),f=s[0],m=s[1],b=ut(Object(r.useState)({}),2),p=b[0],d=b[1],h=ut(Object(r.useState)({}),2),y=h[0],v=h[1],O=n.schema,w=void 0===O?[]:O,j=n.tag_name,g=void 0===j?"":j,E=n.default_val,_=void 0===E?[]:E;Object(r.useEffect)((function(){var e={},t={};w.map((function(n){e[n.id]=n.type,t[n.id]=n})),d(e),v(t)}),[w]);var k=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=!1,r=t.fields,a=t.relation,o=void 0===a?"OR":a;o=o.toUpperCase();try{var i=null;if("OR"===o){if(r&&Array.isArray(r))for(var c=0;c<r.length;c++){i=e[r[c].id];var l=void 0===r[c].value||r[c].value;if(""!=l&&i==l||""==l&&""!=i&&null!=i)return!0}}else"AND"==o&&r&&Array.isArray(r)&&(n=r.every((function(t){i=e[t.id];var n=void 0===t.value||t.value;return(""===n||i==n)&&(""!=n||""!=i&&null!=i)})))}catch(e){console.log(e)}return n},N=Object(r.useMemo)((function(){var e=["{{"+g];if(!Object(o.isEmpty)(f))if("cart_recovery_link"===g){var t=f.coupon_type,n=void 0===t?"static":t,r=f.dynamic_coupon,a=void 0===r?"":r,i=f.static_coupon,c=void 0===i?"":i;"static"===n&&""!==c?e.push("coupon='"+c+"'"):"dynamic"===n&&""!==a&&e.push("coupon='"+a+"'")}else Object.entries(f).map((function(t){var n=ut(t,2),r=n[0],a=n[1];if(!y[r].hasOwnProperty("toggler")||Object(o.isEmpty)(y[r].toggler)||k(f,y[r].toggler,y[r]))if("search"!=p[r]||Object(o.isEmpty)(a))""!==a&&e.push(r+"='"+a+"'");else{var i=[];a.map((function(e){i.push(e.id)})),e.push(r+"='"+i.join(",")+"'")}}));return e.join(" ")+"}}"}),[f]);return Object(r.createElement)("div",{className:"bwf-merge-tag-wrap bwf_w_full"},Object(r.createElement)(nt.a,{onChange:function(e){!function(e){var t=lt(lt({},_),f);t[e.name]=e.value,m(t)}(e)},initialValues:lt(lt({},_),f),validate:function(){return!1}},(function(e){var n=e.getInputProps,a=e.values;e.errors,e.handleSubmit;return Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"wr_content",ref:t},Object(r.createElement)("div",null,w.map((function(e,t){return Object(r.createElement)(r.Fragment,{key:t},(Object(o.isEmpty)(e.toggler)||k(a,e.toggler,e))&&e.wrap_before&&Object(r.createElement)("div",{dangerouslySetInnerHTML:{__html:e.wrap_before}}),e.type?Object(r.createElement)(r.Fragment,null,!1!==e.show&&(Object(o.isEmpty)(e.toggler)||k(a,e.toggler,e))&&Object(r.createElement)(rt.a,{input:e,formProps:n(e.id),values:a,automationId:i})):e.hint?Object(r.createElement)(r.Fragment,{dangerouslySetInnerHTML:{__html:e.hint},className:c()(e.class)}):null,(Object(o.isEmpty)(e.toggler)||k(a,e.toggler,e))&&e.wrap_after&&Object(r.createElement)("div",{dangerouslySetInnerHTML:{__html:e.wrap_after}}))})))))})),Object(r.createElement)("div",{className:"bwf-merge-tag-config-view"},Object(r.createElement)("span",{className:"bwf-merge-tag"},N),Object(r.createElement)("div",{className:"bwf-display-flex bwf-j-end"},Object(r.createElement)(u.Button,{isPrimary:!0,onClick:function(){a(N)},disabled:(w.map((function(e){if(e.hasOwnProperty("required")&&e.required&&(!f.hasOwnProperty(e.id)||""===f[e.id]))return!1})),!(""!==N))},Object(l.__)("Copy","wp-marketing-automations")))))},bt=n(165);function pt(e){return(pt="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)}function dt(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 ht(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?dt(Object(n),!0).forEach((function(t){yt(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):dt(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function yt(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=pt(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=pt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==pt(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function vt(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(s)throw a}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Ot(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ot(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ot(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var wt=function(e){var t=Object(r.useContext)(b.h),n=Object(r.useContext)(bt.a).setSelectedMergeTag,a=e.isOpen,i=e.onRequestClose,f=e.automationID,p=vt(Object(r.useState)(""),2),d=p[0],h=p[1],y=vt(Object(r.useState)(""),2),v=y[0],O=y[1],w=vt(Object(r.useState)({}),2),j=w[0],g=w[1],E=(0,Object(m.a)().getMergeTagList)();Object(r.useEffect)((function(){a||(g({}),h(""),Object(o.isEmpty)(E)||O(Object.keys(E)[0]))}),[a]);var _=function(){i&&i()},k=function(e){n(e);var r=document.createElement("textarea");r.value=e,document.body.appendChild(r),r.select(),document.execCommand("copy"),document.body.removeChild(r),t(Object(l.__)("Merge tag copied.","wp-marketing-automations")),Object(b.Lb)(t,3e3),_()},N=function(){var e,t=(e={},Object.entries(E).map((function(t){var n=vt(t,2),r=n[0],a=n[1];""!==v?v==r&&(e=a):""!==d?Object.entries(a).map((function(t){var n=vt(t,2),r=n[0],a=n[1];(r.includes(d)||a.hasOwnProperty("tag_name")&&a.tag_name.includes(d))&&(e[r]=a)})):e=ht(ht({},e),a)})),Object.values(e).sort((function(e,t){return e.priority-t.priority})));return Object(o.isEmpty)(t)?Object(r.createElement)("tr",null,Object(r.createElement)("td",{className:"bwf-no-merge-tag"},Object(l.__)("No Merge Tag Available","wp-marketing-automations"))):Object(r.createElement)(r.Fragment,null,Object.entries(t).map((function(e,t){var n=vt(e,2),a=(n[0],n[1]);return Object(r.createElement)("tr",{key:"row"+t},Object(r.createElement)("td",null,Object(r.createElement)("span",{className:"bwf-tag-label"},a.tag_description)),Object(r.createElement)("td",null,Object(r.createElement)("span",{className:"bwf-tag-slug"},"{{"+a.tag_name+"}}")),Object(r.createElement)("td",null,a.hasOwnProperty("schema")?Object(r.createElement)("div",{className:"bwf-cursor-pointer",onClick:function(){return g(a)},title:Object(l.__)("Configure","wp-marketing-automations")},Object(r.createElement)(s.a,{color:"#353030",icon:"settings"})):Object(r.createElement)("div",{className:"bwf-cursor-pointer",onClick:function(){return k("{{"+a.tag_name+"}}")},title:Object(l.__)("Copy","wp-marketing-automations")},Object(r.createElement)(s.a,{color:"#353030",icon:"duplicate"}))))})))};return a?Object(r.createElement)(u.Modal,{className:"bwf-admin-modal bwf-event-search-modal bwf-event-search-modal__merge-tag bwf-admin-modal-xl",shouldCloseOnClickOutside:!1,shouldCloseOnEsc:!1},Object(r.createElement)("div",{className:"bwf-modal-search-header"},Object(r.createElement)("div",{className:"bwf-modal-title"},Object(o.isEmpty)(j)?Object(l.__)("Merge Tags","wp-marketing-automations"):Object(r.createElement)("div",{className:"bwf-display-flex"},Object(r.createElement)("div",{className:"bwf-cursor-pointer",onClick:function(){g({})}},Object(r.createElement)(s.a,{icon:Object(l.isRTL)()?"arrow-right":"arrow-left"})),j.hasOwnProperty("tag_description")?j.tag_description:"")),Object(r.createElement)("div",{className:"bwf-modal-search-wrap"},Object(o.isEmpty)(j)&&Object(r.createElement)("div",{className:"bwf-component-search-control"},Object(r.createElement)(s.a,{icon:"search",size:15}),Object(r.createElement)(u.TextControl,{value:d,onChange:function(e){""===e?Object(o.isEmpty)(E)||O(Object.keys(E)[0]):O(""),h(e)},placeholder:Object(l.__)("Search by name","wp-marketing-automations")}))),Object(r.createElement)("div",{className:"bwf-modal-close bwf-cursor-pointer",onClick:_},Object(r.createElement)(s.a,{icon:"close",size:20}))),Object(r.createElement)("div",{className:"bwf-event-modal-main"},Object(r.createElement)("div",{className:"bwf-event-modal-body bwf-merge-modal-content"+(Object(o.isEmpty)(j)&&!Object(o.isEmpty)(E)?"":" gridfull")},Object(o.isEmpty)(j)?Object(o.isEmpty)(E)?Object(r.createElement)("div",{className:"bwf-modal-content-content"},Object(r.createElement)("div",{className:"bwf-modal-content-brick no-padding set-height"},Object(r.createElement)("div",{className:"modal-brick-wrap bwfan_pb20"},Object(r.createElement)("div",{className:"bwf-brick-content"},Object(r.createElement)("div",{className:"bwf-merge-tag-list"},Object(r.createElement)("div",{className:"bwf-no-merge-tag"},Object(l.__)("No Merge Tag Available","wp-marketing-automations"))))))):Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"bwf-modal-sidebar"},Object(r.createElement)("div",{className:"bwf-modal-filter-wrap"},Object.keys(E).map((function(e){return Object(r.createElement)("div",{key:e,className:c()("bwf-modal-filter",{active:v===e}),onClick:function(){h(""),O(e)}},e)})))),Object(r.createElement)("div",{className:"bwf-modal-content-content"},Object(r.createElement)("div",{className:"bwf-modal-content-brick no-padding set-height"},Object(r.createElement)("div",{className:"modal-brick-wrap bwfan_pb20"},Object(r.createElement)("div",{className:"bwf-brick-content"},Object(r.createElement)("div",{className:"bwf-merge-tag-list"},Object(r.createElement)("table",null,Object(r.createElement)("tbody",null,N())))))))):Object(r.createElement)(mt,{mergetag:j,copyTagToClipBoard:k,automationId:f})))):""};function jt(){jt=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof h?t:h,i=Object.create(o.prototype),c=new x(r||[]);return a(i,"_invoke",{value:k(e,n,c)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var m="suspendedStart",b="executing",p="completed",d={};function h(){}function y(){}function v(){}var O={};s(O,i,(function(){return this}));var w=Object.getPrototypeOf,j=w&&w(w(L([])));j&&j!==n&&r.call(j,i)&&(O=j);var g=v.prototype=h.prototype=Object.create(O);function E(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function _(e,t){function n(a,o,i,c){var l=f(e[a],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==St(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,i,c)}),(function(e){n("throw",e,i,c)})):t.resolve(u).then((function(e){s.value=e,i(s)}),(function(e){return n("throw",e,i,c)}))}c(l.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function k(t,n,r){var a=m;return function(o,i){if(a===b)throw Error("Generator is already running");if(a===p){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===d)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=p,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=b;var s=f(t,n,r);if("normal"===s.type){if(a=r.done?p:"suspendedYield",s.arg===d)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(a=p,r.method="throw",r.arg=s.arg)}}}function N(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),d;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,d;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,d):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,d)}function S(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(S,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(St(t)+" is not iterable")}return y.prototype=v,a(g,"constructor",{value:v,configurable:!0}),a(v,"constructor",{value:y,configurable:!0}),y.displayName=s(v,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===y||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,v):(e.__proto__=v,s(e,l,"GeneratorFunction")),e.prototype=Object.create(g),e},t.awrap=function(e){return{__await:e}},E(_.prototype),s(_.prototype,c,(function(){return this})),t.AsyncIterator=_,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new _(u(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},E(g),s(g,l,"Generator"),s(g,i,(function(){return this})),s(g,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=L,x.prototype={constructor:x,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function a(r,a){return c.type="throw",c.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],c=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var l=r.call(i,"catchLoc"),s=r.call(i,"finallyLoc");if(l&&s){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,d):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),d},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var a=r.arg;P(n)}return a}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),d}},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 Et(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?gt(Object(n),!0).forEach((function(t){_t(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):gt(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function _t(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=St(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=St(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==St(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function kt(e,t,n,r,a,o,i){try{var c=e[o](i),l=c.value}catch(e){return void n(e)}c.done?t(l):Promise.resolve(l).then(r,a)}function Nt(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){kt(o,r,a,i,c,"next",e)}function c(e){kt(o,r,a,i,c,"throw",e)}i(void 0)}))}}function St(e){return(St="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)}function Pt(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(s)throw a}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return xt(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?xt(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function xt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var Lt=function(){var e=Object(r.useContext)(b.h),t=Object(m.a)(),n=t.getSidebarNodeData,a=t.getSelectedSidebarData,i=t.getAutomationId,u=t.getNodeDataByID,p=t.getAutomationData,h=(0,t.getautomationMeta)(),v=Object(f.a)(),w=v.showSidebar,j=v.setNodeDatabyId,g=v.setAutomationData,E=p().event,_=void 0===E?"":E,k=i(),N=Object(r.useRef)(null),S=Pt(Object(r.useState)(!1),2),P=S[0],x=S[1],L=Pt(Object(r.useState)(""),2),C=L[0],A=L[1],T=Pt(Object(r.useState)(!1),2),I=T[0],D=T[1],M=Pt(Object(r.useState)(!1),2),F=M[0],G=M[1],z=Pt(Object(r.useState)([]),2),Y=z[0],U=z[1],q=Pt(Object(r.useState)(!1),2),B=q[0],R=q[1],H=Pt(Object(r.useState)(!1),2),V=H[0],J=H[1],$=n(),W=Pt(Object(r.useState)(!1),2),Q=W[0],X=W[1],Z=!Object(o.isEmpty)($)&&$.hasOwnProperty("data")?$.data:{},K=Object(o.isEmpty)($)?{}:a($),ee=K.side_header,te=void 0===ee?[]:ee,ne=!Object(o.isEmpty)(Z)&&Z.hasOwnProperty("sidebarValues")?Z.sidebarValues:{},re=Object(o.isEmpty)(K)?{}:K,ae=re.fields,oe=void 0===ae?[]:ae,ie=re.default_values,ce=void 0===ie?{}:ie,le=!Object(o.isEmpty)($)&&$.hasOwnProperty("id")?u($.id):{},se=le.stepId,ue=void 0===se?0:se,fe=le.data;(void 0===fe?{}:fe).sidebarValues;Object(r.useEffect)((function(){U([]),x(!1)}),[]);var me=function(e,t,n){var r=!1,a=t.fields,o=t.relation,i=void 0===o?"OR":o;i=i.toUpperCase();try{var c=null;if("OR"===i){if(a&&Array.isArray(a))for(var l=0;l<a.length;l++){c=e[a[l].id];var s=void 0===a[l].value||a[l].value;if(Array.isArray(s)&&s.includes(c))return!0;if(""!=s&&c==s||""==s&&""!=c&&null!=c)return!0}}else"AND"==i&&a&&Array.isArray(a)&&(r=a.every((function(t){c=e[t.id];var n=void 0===t.value||t.value;return!(!Array.isArray(n)||!n.includes(c))||(""===n||c==n)&&(""!=n||""!=c&&null!=c)})))}catch(e){console.log(e)}return r},be=[];Object(o.isEmpty)(oe)||oe.forEach((function(e){e.hasOwnProperty("required")&&e.required&&be.push(e)}));var pe=function(e){var t=!1;return Object(o.isObject)(e)?Object.keys(e).map((function(n){["",void 0,null].includes(e[n])&&(t=!0)})):["",void 0,null].includes(e)&&(t=!0),t},de=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=e.split(","),n=t.map((function(e){return!(!e.includes("{{")&&!e.includes("}}"))||Object(b.s)(e)}));return!n.includes(!1)},he=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n={};return be.map((function(r){if(r.hasOwnProperty("toggler")&&!Object(o.isEmpty)(r.toggler)&&!me(e,r.toggler))return!1;if((Array.isArray(e[r.id])&&0===e[r.id].length||""===e[r.id]||void 0===e[r.id])&&(n[r.id]=r.hasOwnProperty("errorMsg")?r.errorMsg:Object(l.__)("This is a required field.","wp-marketing-automations")),"custom_fields"===r.id&&e[r.id].map((function(e,t){!e.hasOwnProperty("field_value")||""===e.field_value||pe(e.field_value)?n["field_value_"+t]=r.hasOwnProperty("errorMsg")?r.errorMsg:Object(l.__)("This is a required field.","wp-marketing-automations"):n.hasOwnProperty(r.id)&&delete n[r.id]})),"bwfan_email_data"===r.id)if(e.hasOwnProperty("bwfan_email_to")&&!Object(o.isEmpty)(e.bwfan_email_to)&&(de(e.bwfan_email_to)||(n.bwfan_email_to=Object(l.__)("Please enter a valid email address.","wp-marketing-automations"))),e.hasOwnProperty("bwfan_email_data")){e.bwfan_email_data.hasOwnProperty("subject")&&""===e.bwfan_email_data.subject&&(n[r.id]="error");var a=Object(b.E)(),i=[],c=e.bwfan_email_data,s=!(!c.hasOwnProperty("data")||Object(o.isEmpty)(c.data)||!c.data.hasOwnProperty("isTransactional"))&&c.data.isTransactional,u="";c.hasOwnProperty("template")&&(u=c.template),u.includes("{{mail_footer}}")||(s||a.includes("unsubscribe_link")||u.includes("unsubscribe_link"))&&(s||a.includes("business_name")||u.includes("business_name"))&&(s||a.includes("business_address")||u.includes("business_address"))||(s||a.includes("unsubscribe_link")||u.includes("unsubscribe_link")||i.push("{{unsubscribe_link}}"),s||a.includes("business_name")||u.includes("business_name")||i.push("{{business_name}}"),s||a.includes("business_address")||u.includes("business_address")||i.push("{{business_address}}")),Object(o.isEmpty)(i)?A(""):(n[r.id]="error",t&&A(Object(l.__)("The required merge tags","wp-marketing-automations")+" "+i.join(", ")+(i.length>1?" are ":" is ")+" "+Object(l.__)("missing in the email body.","wp-marketing-automations")))}else n[r.id]="error";if("coupon_data"===r.id)if(e.hasOwnProperty(r.id)){var f=e[r.id],m=f.type,p=void 0===m?"new":m,d=f.coupon_id,h=void 0===d?{}:d,y=f.general,v=void 0===y?{}:y;("existing"===p&&(Object(o.isEmpty)(h)||!h.hasOwnProperty("key")||""===h.key)||"new"===p&&(Object(o.isEmpty)(v)||!v.hasOwnProperty("amount")||parseFloat(v.amount)<=0))&&(n[r.id]="error")}else n[r.id]="error";if("whatsapp_template_control"===r.type)if(e.hasOwnProperty(r.id)){var O=e[r.id].data,w=void 0===O?{}:O;!Object(o.isEmpty)(w)&&ye(w)&&(n[r.id]="error")}else n[r.id]=Object(l.__)("This is required field.","wp-marketing-automations")})),t&&U(n),n},ye=function(e){var t=!1;return Object.keys(e).forEach((function(n){""===e[n]||void 0===e[n]?t=!0:e[n]&&"object"===St(e[n])?t=t||ye(e[n]):Array.isArray(e[n])&&(t=t||e[n].some((function(e){return ye(e)})))})),t},ve=function(){var t=Nt(jt().mark((function t(n){var r,a,i,c,s=arguments;return jt().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=!(s.length>1&&void 0!==s[1])||s[1],a=[],a=r?he(n):[],!Object(o.isEmpty)(a)){t.next=21;break}return Z.sidebarValues=n,R(!0),t.prev=6,i={data:{data:{sidebarData:n}}},r||Object(o.isEmpty)(K)||!K.hasOwnProperty("slug")||"wp_sendemail"!==K.slug||(c=he(n,!1),Object(o.isEmpty)(c)||(i.updateStatus=2)),t.next=11,d()({path:Object(b.A)("/automation/".concat(k,"/step/").concat(ue)),method:"POST",data:{content:JSON.stringify(i)}}).then((function(t){if(200!==t.code)throw Error(Object(b.u)(null==t?void 0:t.message));var n="";t.hasOwnProperty("result")&&t.result.hasOwnProperty("desc_text")&&!Object(o.isEmpty)(t.result.desc_text)&&(n=t.result.desc_text),j($.id,Et(Et({},Z),{},{desc_text:n}),{step_status:i.hasOwnProperty("updateStatus")&&2===i.updateStatus?2:1}),t.hasOwnProperty("result")&&t.result.hasOwnProperty("meta")&&g("meta",Et(Et({},h),t.result.meta)),r&&(e(t.message),V||setTimeout((function(){w(!1)}),100)),R(!1),G(!1)})).catch((function(e){throw Error(Object(b.u)(null==e?void 0:e.message))}));case 11:t.next=18;break;case 13:t.prev=13,t.t0=t.catch(6),g("modalData",{status:!0,modalTitle:Object(l.__)("Update Action","wp-marketing-automations"),error:null===t.t0||void 0===t.t0?void 0:t.t0.message}),R(!1),G(!1);case 18:Object(b.Lb)(e,3e3),t.next=24;break;case 21:e(Object(l.__)("Validation failed. Please check the fields for error.","wp-marketing-automations")),Object(b.Lb)(e,3e3),G(!1);case 24:case"end":return t.stop()}}),t,null,[[6,13]])})));return function(e){return t.apply(this,arguments)}}();return Object(r.createElement)(b.f.Provider,{value:{errorList:Y,setErrorList:U,stepId:ue}},Object(r.createElement)(b.c.Provider,{value:{isOpenTags:P,setOpenTags:x,automationID:k}},Object(r.createElement)("div",{className:"wr_header"},Object(r.createElement)("div",{className:"bwf-node-icon icon-action"},Object(r.createElement)(s.a,{size:22,icon:"charge"})),Object(r.createElement)("div",{className:"wr_event_title"},K.hasOwnProperty("action_name")?K.action_name:""),Object(r.createElement)("div",{className:"wr_event_variant"},te.includes("link-trigger")&&Object(r.createElement)(at.a,{canCreate:!0,isLinkTriggerOpen:Q,setLinkTriggerOpen:X,hideButton:!1}),te.includes("merge-tag")&&Object(r.createElement)("span",{onClick:function(){x(!0)},className:"bwf-cursor-pointer bwf-modal-icon-link-trigger",key:"merge-tag"},Object(r.createElement)(ot.a,{icon:"merge-tag",iconSize:24,size:"auto",toolTipText:Object(r.createElement)("span",{className:"bwfan_tooltip_text bwf-w-120","data-position":"top"},Object(l.__)("Merge tags","wp-marketing-automations"))}))),Object(r.createElement)("div",{className:"wr_close bwf-cursor-pointer",onClick:function(){w(!1)}},Object(r.createElement)(s.a,{icon:"close"}))),Object(o.isEmpty)(oe)?Object(r.createElement)("div",{className:"wr_content"},Object(r.createElement)("div",{className:"bwf-single-automation-notice is-info"},Object(l.__)("No settings to configure.","wp-marketing-automations"))):Object(r.createElement)(nt.a,{onSubmit:function(){var e=Nt(jt().mark((function e(t){var n,r=arguments;return jt().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=!(r.length>1&&void 0!==r[1])||r[1],e.next=3,ve(t,n);case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),initialValues:Et(Et({},ce),ne),validate:function(){return!1}},(function(e){var t,n=e.getInputProps,a=e.values,i=e.errors,s=e.handleSubmit;return Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:(t="wr_content wr-action_wrapper",K.hasOwnProperty("slug")&&(t=t+" wr_action_"+K.slug),t),ref:N},Object(r.createElement)("div",{className:"wr-action_content"},!Object(o.isEmpty)(K)&&K.hasOwnProperty("slug")&&"wp_sendemail"===K.slug&&""!==C&&Object(r.createElement)(O.a,{className:"bwf-error-notice",status:"error"},C),oe.map((function(e,t){return Object(r.createElement)(r.Fragment,{key:t},(Object(o.isEmpty)(e.toggler)||me(a,e.toggler))&&e.wrap_before&&Object(r.createElement)("div",{className:"bwf-w-100p",dangerouslySetInnerHTML:{__html:e.wrap_before}}),e.type?Object(r.createElement)(r.Fragment,null,!1!==e.show&&(Object(o.isEmpty)(e.toggler)||me(a,e.toggler))&&Object(r.createElement)(rt.a,{input:e,formProps:n(e.id),values:a,isOpenTemplate:I,setOpenTemplate:function(){Object(b.ac)()?D(!I):g("showProModal",!0)},automationId:k,automationEvent:_,setMergeTagModal:x,saveNodeDataOnSubmit:s})):e.hint?Object(r.createElement)(r.Fragment,{dangerouslySetInnerHTML:{__html:e.hint},className:c()(e.class)}):null,(Object(o.isEmpty)(e.toggler)||me(a,e.toggler))&&e.wrap_after&&Object(r.createElement)("div",{className:"bwf-w-100p",dangerouslySetInnerHTML:{__html:e.wrap_after}}))})))),Object(r.createElement)("div",{className:"wr_footer"},Object(r.createElement)(y.a,{className:"bwf-cancel-btn",onClick:function(){return w(!1)}},Object(l.__)("Cancel","wp-marketing-automations")),!Object(o.isEmpty)(K)&&K.hasOwnProperty("slug")&&"wp_sendemail"===K.slug&&Object(r.createElement)(y.a,{isSecondary:!0,onClick:function(){J(!1),G(!0),setTimeout((function(){return s()}),100)},isBusy:F,disabled:Object.keys(i).length},Object(l.__)("Save & Close","wp-marketing-automations")),Object(r.createElement)(y.a,{isPrimary:!0,className:"bwf-no-ripple",onClick:function(){!Object(o.isEmpty)(K)&&K.hasOwnProperty("slug")&&"wp_sendemail"===K.slug&&J(!0),setTimeout((function(){return s()}),100)},isBusy:B&&!F},Object(l.__)("Save","wp-marketing-automations"))))})),Object(r.createElement)(wt,{isOpen:P,onRequestClose:x,automationID:k})))};n(1409);function Ct(e){return function(e){if(Array.isArray(e))return It(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Tt(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 At(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(s)throw a}}return c}}(e,t)||Tt(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Tt(e,t){if(e){if("string"==typeof e)return It(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?It(e,t):void 0}}function It(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var Dt=function(e){var t=e.options,n=e.selected,a=e.setSelected,i=e.selectedContent,c=void 0===i?"":i,l=e.liteDummyData,u=void 0===l?[]:l,f=At(Object(r.useState)([]),2),m=f[0],p=f[1];return Object(o.isEmpty)(t)?Object(r.createElement)(r.Fragment,null):Object(r.createElement)(r.Fragment,null,t.map((function(e,t){if(Object(o.isEmpty)(e)||!e.hasOwnProperty("value"))return!1;var i=e.value==n?"selected":"";return Object(r.createElement)("div",{className:"bwf-custom-radio-control",key:t},Object(r.createElement)("div",{className:"bwf-custom-radio-option",key:e.value,onClick:function(){return a(e.value)}},Object(r.createElement)("div",{className:"bwf-select-option-indicator "+i},e.hasOwnProperty("isProFeature")&&e.isProFeature&&!Object(b.ac)()?Object(r.createElement)(s.a,{icon:"king"}):Object(r.createElement)("div",{className:"bwf-option-mark-outer"},Object(r.createElement)("div",{className:"bwf-option-mark-inner"}))),Object(r.createElement)("div",{className:"bwf-select-option-info"},Object(r.createElement)("div",{className:"bwf-bold"},e.hasOwnProperty("label")?e.label:""),Object(r.createElement)("div",{className:"bwf-desc"},e.hasOwnProperty("desc")?e.desc:"")),e.hasOwnProperty("isProFeature")&&e.isProFeature&&!Object(b.ac)()&&Object(r.createElement)("a",{onClick:function(t){t.stopPropagation();var n=Ct(m);n.includes(e.value)?n.pop(e.value):n.push(e.value),p(n)},className:"bwf-no-underline bwf-cursor-pointer"},"Explore")),m.includes(e.value)&&u.hasOwnProperty(e.value)&&Object(r.createElement)(r.Fragment,null,u[e.value]),i&&Object(r.createElement)("div",{className:"bwf-option-content"},c))})))},Mt=n(367),Ft=n(124);n(1410);function Gt(e){return(Gt="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)}function zt(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;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?zt(Object(n),!0).forEach((function(t){Ut(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):zt(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Ut(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=Gt(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=Gt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==Gt(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function qt(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(s)throw a}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Bt(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Bt(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Bt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var Rt=function(e){var t=Object(r.useRef)(null),n=e.mergetag,a=e.copyTagToClipBoard,i=e.automationId,s=qt(Object(r.useState)({}),2),f=s[0],m=s[1],b=qt(Object(r.useState)({}),2),p=b[0],d=b[1],h=n.schema,y=void 0===h?[]:h,v=n.tag_name,O=void 0===v?"":v,w=n.default_val,j=void 0===w?[]:w;Object(r.useEffect)((function(){var e=[];y.map((function(t){e[t.id]=t.type})),d(e)}),[y]);var g,E=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=!1,r=t.fields,a=t.relation,o=void 0===a?"OR":a;o=o.toUpperCase();try{var i=null;if("OR"===o){if(r&&Array.isArray(r))for(var c=0;c<r.length;c++){i=e[r[c].id];var l=void 0===r[c].value||r[c].value;if(""!=l&&i==l||""==l&&""!=i&&null!=i)return!0}}else"AND"==o&&r&&Array.isArray(r)&&(n=r.every((function(t){i=e[t.id];var n=void 0===t.value||t.value;return(""===n||i==n)&&(""!=n||""!=i&&null!=i)})))}catch(e){console.log(e)}return n},_=function(){var e=["{{"+O];if(!Object(o.isEmpty)(f))if("cart_recovery_link"===O){var t=f.coupon_type,n=void 0===t?"":t,r=f.dynamic_coupon,a=void 0===r?"":r,i=f.static_coupon,c=void 0===i?"":i;"static"===n&&""!==c?e.push("coupon='"+c+"'"):"dynamic"===n&&""!==a&&e.push("coupon='"+a+"'")}else Object.entries(f).map((function(t){var n=qt(t,2),r=n[0],a=n[1];if("search"!=p[r]||Object(o.isEmpty)(a))""!==a&&e.push(r+"='"+a+"'");else{var i=[];a.map((function(e){i.push(e.id)})),e.push(r+"='"+i.join(",")+"'")}}));return e.join(" ")+"}}"},k=function(){var e=_();return y.map((function(t){!t.hasOwnProperty("required")||!t.required||f.hasOwnProperty(t.id)&&""!==f[t.id]||(e="")})),""!==e};return Object(r.createElement)("div",{className:"bwf-merge-tag-wrap bwf_w_full"},Object(r.createElement)(nt.a,{onChange:function(e){!function(e){var t=Yt({},f);t[e.name]=e.value,m(t)}(e)},initialValues:Yt(Yt({},j),f),validate:function(){return!1}},(function(e){var n=e.getInputProps,a=e.values;e.errors,e.handleSubmit;return Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"wr_content",ref:t},Object(r.createElement)("div",null,y.map((function(e,t){return Object(r.createElement)(r.Fragment,{key:t},(Object(o.isEmpty)(e.toggler)||E(a,e.toggler,e))&&e.wrap_before&&Object(r.createElement)("div",{dangerouslySetInnerHTML:{__html:e.wrap_before}}),e.type?Object(r.createElement)(r.Fragment,null,!1!==e.show&&(Object(o.isEmpty)(e.toggler)||E(a,e.toggler,e))&&Object(r.createElement)(rt.a,{input:e,formProps:n(e.id),values:a,automationId:i})):e.hint?Object(r.createElement)(r.Fragment,{dangerouslySetInnerHTML:{__html:e.hint},className:c()(e.class)}):null,(Object(o.isEmpty)(e.toggler)||E(a,e.toggler,e))&&e.wrap_after&&Object(r.createElement)("div",{dangerouslySetInnerHTML:{__html:e.wrap_after}}))})))))})),(g=_(),Object(r.createElement)("div",{className:"bwf-merge-tag-config-view"},Object(r.createElement)("span",{className:"bwf-merge-tag"},g),Object(r.createElement)("div",{className:"bwf-display-flex bwf-j-end"},Object(r.createElement)(u.Button,{isPrimary:!0,onClick:function(){a(g)},disabled:!k()},Object(l.__)("Select","wp-marketing-automations"))))))};function Ht(e){return(Ht="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)}function Vt(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 Jt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Vt(Object(n),!0).forEach((function(t){$t(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Vt(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function $t(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=Ht(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=Ht(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==Ht(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Wt(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(s)throw a}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Qt(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Qt(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Qt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var Xt=function(e){var t=Object(r.useContext)(bt.a).setSelectedMergeTag,n=e.isOpen,a=e.onRequestClose,i=e.automationID,f=e.onSelect,b=Wt(Object(r.useState)(""),2),p=b[0],d=b[1],h=Wt(Object(r.useState)(""),2),y=h[0],v=h[1],O=Wt(Object(r.useState)({}),2),w=O[0],j=O[1],g=(0,Object(m.a)().getDelayTagList)();Object(r.useEffect)((function(){n||(j({}),d(""),Object(o.isEmpty)(g)||v(Object.keys(g)[0]))}),[n]);var E=function(){a&&a()},_=function(e){t(e),f(e),E()},k=function(){var e,t=(e={},Object.entries(g).map((function(t){var n=Wt(t,2),r=n[0],a=n[1];""!==y?y==r&&(e=a):""!==p?Object.entries(a).map((function(t){var n=Wt(t,2),r=n[0],a=n[1];(r.includes(p)||a.hasOwnProperty("tag_name")&&a.tag_name.includes(p))&&(e[r]=a)})):e=Jt(Jt({},e),a)})),e);return Object(o.isEmpty)(t)?Object(r.createElement)("tr",null,Object(r.createElement)("td",{className:"bwf-no-merge-tag"},Object(l.__)("No Delay Tag Available","wp-marketing-automations"))):Object(r.createElement)(r.Fragment,null,Object.entries(t).map((function(e,t){var n=Wt(e,2),a=(n[0],n[1]);return Object(r.createElement)("tr",{key:"row"+t},Object(r.createElement)("td",null,Object(r.createElement)("span",{className:"bwf-tag-label"},a.tag_description)),Object(r.createElement)("td",null,Object(r.createElement)("span",{className:"bwf-tag-slug"},"{{"+a.tag_name+"}}")),Object(r.createElement)("td",null,a.hasOwnProperty("schema")?Object(r.createElement)("div",{className:"bwf-cursor-pointer",onClick:function(){return j(a)},title:Object(l.__)("Configure","wp-marketing-automations")},Object(r.createElement)(s.a,{color:"#353030",icon:"settings"})):Object(r.createElement)("div",{className:"bwf-cursor-pointer",onClick:function(){return _("{{"+a.tag_name+"}}")},title:Object(l.__)("Copy","wp-marketing-automations")},Object(r.createElement)(s.a,{color:"#353030",icon:"duplicate"}))))})))};return n?Object(r.createElement)(u.Modal,{className:"bwf-admin-modal bwf-event-search-modal bwf-event-search-delay-tag bwf-admin-modal-xl bwf-overflow-remove",shouldCloseOnClickOutside:!1,shouldCloseOnEsc:!1},Object(r.createElement)("div",{className:"bwf-modal-search-header"},Object(r.createElement)("div",{className:"bwf-modal-title"},Object(o.isEmpty)(w)?Object(l.__)("Delay Tags","wp-marketing-automations"):Object(r.createElement)("div",{className:"bwf-display-flex"},Object(r.createElement)("div",{className:"bwf-cursor-pointer",onClick:function(){j({})}},Object(r.createElement)(s.a,{icon:Object(l.isRTL)()?"arrow-right":"arrow-left"})),w.hasOwnProperty("tag_description")?w.tag_description:"")),Object(r.createElement)("div",{className:"bwf-modal-search-wrap"},Object(o.isEmpty)(w)&&Object(r.createElement)("div",{className:"bwf-component-search-control"},Object(r.createElement)(s.a,{icon:"search",size:15}),Object(r.createElement)(u.TextControl,{value:p,onChange:function(e){""===e?Object(o.isEmpty)(g)||v(Object.keys(g)[0]):v(""),d(e)},placeholder:Object(l.__)("Search by name","wp-marketing-automations")}))),Object(r.createElement)("div",{className:"bwf-modal-close bwf-cursor-pointer",onClick:E},Object(r.createElement)(s.a,{icon:"close",size:20}))),Object(r.createElement)("div",{className:"bwf-event-modal-main"},Object(r.createElement)("div",{className:"bwf-event-modal-body bwf-merge-modal-content"+(Object(o.isEmpty)(w)&&!Object(o.isEmpty)(g)?"":" gridfull")},Object(o.isEmpty)(w)?Object(o.isEmpty)(g)?Object(r.createElement)("div",{className:"bwf-modal-content-content"},Object(r.createElement)("div",{className:"bwf-modal-content-brick no-padding set-height"},Object(r.createElement)("div",{className:"modal-brick-wrap bwfan_pb20"},Object(r.createElement)("div",{className:"bwf-brick-content"},Object(r.createElement)("div",{className:"bwf-merge-tag-list"},Object(r.createElement)("div",{className:"bwf-no-merge-tag"},Object(l.__)("No Delay Tag Available","wp-marketing-automations"))))))):Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"bwf-modal-sidebar"},Object(r.createElement)("div",{className:"bwf-modal-filter-wrap"},Object.keys(g).map((function(e){return Object(r.createElement)("div",{key:e,className:c()("bwf-modal-filter",{active:y===e}),onClick:function(){d(""),v(e)}},e)})))),Object(r.createElement)("div",{className:"bwf-modal-content-content"},Object(r.createElement)("div",{className:"bwf-modal-content-brick no-padding set-height"},Object(r.createElement)("div",{className:"modal-brick-wrap bwfan_pb20"},Object(r.createElement)("div",{className:"bwf-brick-content"},Object(r.createElement)("div",{className:"bwf-merge-tag-list"},Object(r.createElement)("table",null,Object(r.createElement)("tbody",null,k())))))))):Object(r.createElement)(Rt,{mergetag:w,copyTagToClipBoard:_,automationId:i})))):""},Zt=n(44);function Kt(e){return(Kt="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)}function en(e){return function(e){if(Array.isArray(e))return un(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||sn(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 tn(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 nn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?tn(Object(n),!0).forEach((function(t){rn(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):tn(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function rn(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=Kt(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=Kt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==Kt(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function an(){an=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof h?t:h,i=Object.create(o.prototype),c=new x(r||[]);return a(i,"_invoke",{value:k(e,n,c)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var m="suspendedStart",b="executing",p="completed",d={};function h(){}function y(){}function v(){}var O={};s(O,i,(function(){return this}));var w=Object.getPrototypeOf,j=w&&w(w(L([])));j&&j!==n&&r.call(j,i)&&(O=j);var g=v.prototype=h.prototype=Object.create(O);function E(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function _(e,t){function n(a,o,i,c){var l=f(e[a],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==Kt(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,i,c)}),(function(e){n("throw",e,i,c)})):t.resolve(u).then((function(e){s.value=e,i(s)}),(function(e){return n("throw",e,i,c)}))}c(l.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function k(t,n,r){var a=m;return function(o,i){if(a===b)throw Error("Generator is already running");if(a===p){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===d)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=p,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=b;var s=f(t,n,r);if("normal"===s.type){if(a=r.done?p:"suspendedYield",s.arg===d)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(a=p,r.method="throw",r.arg=s.arg)}}}function N(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),d;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,d;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,d):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,d)}function S(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(S,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(Kt(t)+" is not iterable")}return y.prototype=v,a(g,"constructor",{value:v,configurable:!0}),a(v,"constructor",{value:y,configurable:!0}),y.displayName=s(v,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===y||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,v):(e.__proto__=v,s(e,l,"GeneratorFunction")),e.prototype=Object.create(g),e},t.awrap=function(e){return{__await:e}},E(_.prototype),s(_.prototype,c,(function(){return this})),t.AsyncIterator=_,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new _(u(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},E(g),s(g,l,"Generator"),s(g,i,(function(){return this})),s(g,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=L,x.prototype={constructor:x,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function a(r,a){return c.type="throw",c.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],c=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var l=r.call(i,"catchLoc"),s=r.call(i,"finallyLoc");if(l&&s){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,d):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),d},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var a=r.arg;P(n)}return a}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),d}},t}function on(e,t,n,r,a,o,i){try{var c=e[o](i),l=c.value}catch(e){return void n(e)}c.done?t(l):Promise.resolve(l).then(r,a)}function cn(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){on(o,r,a,i,c,"next",e)}function c(e){on(o,r,a,i,c,"throw",e)}i(void 0)}))}}function ln(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(s)throw a}}return c}}(e,t)||sn(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function sn(e,t){if(e){if("string"==typeof e)return un(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?un(e,t):void 0}}function un(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var fn=function(){var e=ln(Object(r.useState)({}),2),t=e[0],n=e[1],a=ln(Object(r.useState)({}),2),i=a[0],c=a[1],p=ln(Object(r.useState)(!0),2),h=p[0],v=p[1],O=ln(Object(r.useState)(!1),2),w=O[0],j=O[1],g=ln(Object(r.useState)(!1),2),E=g[0],_=g[1],k=Object(r.useContext)(b.h),N=Object(f.a)(),S=N.showSidebar,P=N.setNodeDatabyId,x=N.setAutomationData,L=N.fetchSplitPathNodes,C=ln(Object(r.useState)(!1),2),A=C[0],T=C[1],I=Object(m.a)(),D=I.getSidebarNodeData,M=I.getNodeDataByID,F=I.getAutomationId,G=I.getAutomationLinks,z=I.getAutomationSteps,Y=I.getCount,U=I.getActionsList,q=I.getGoals,B=I.getDelayTagList,R=I.getautomationMeta,H=D(),V=F(),J=B(),$=z(),W=G(),Q=Y(),X=U(),Z=q(),K=R(),ee=L(),te=!Object(o.isEmpty)(H)&&H.hasOwnProperty("id")?M(H.id):{},ne=te.stepId,re=void 0===ne?0:ne,ae=te.data,oe=(void 0===ae?{}:ae).sidebarValues,ie=function(){var e=cn(an().mark((function e(){return an().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,d()({path:Object(b.A)("/fields/?type=7,8&all=true"),method:"GET"}).then((function(e){200===e.code&&(Object(o.isEmpty)(e.result)||c(e.result),v(!1))}));case 3:e.next=7;break;case 5:e.prev=5,e.t0=e.catch(0);case 7:case"end":return e.stop()}}),e,null,[[0,5]])})));return function(){return e.apply(this,arguments)}}();Object(r.useEffect)((function(){Object(b.ac)()&&ie(),n({})}),[]);var ce=!Object(o.isEmpty)(H)&&H.hasOwnProperty("data")?H.data:{},le=!Object(o.isEmpty)(ce)&&ce.hasOwnProperty("sidebarValues")?ce.sidebarValues:{},se=ln(Object(r.useState)(1),2),ue=se[0],fe=se[1],me=ln(Object(r.useState)({day_delay:{unit:"min",text:"0"}}),2),be=me[0],pe=me[1];Object(r.useEffect)((function(){le.hasOwnProperty("type")&&[1,2,3,4].includes(parseInt(le.type))&&fe(parseInt(le.type)),le.hasOwnProperty("data")&&!Object(o.isEmpty)(le.data)&&pe(le.data)}),[le]),Object(r.useEffect)((function(){if(!h){var e=nn(nn({},le),{},{type:ue,data:be});Object(o.isEqual)(oe,e)||Object(o.isEmpty)(oe)?j(!1):j(!0)}}),[ue,be]);var de=function(e){var t=e.type,r=void 0===t?0:t,a=e.data,i=void 0===a?{}:a,c={};switch(parseInt(r)){case 1:var s=i.day_delay,u=void 0===s?{}:s,f=i.enable_time_delay,m=void 0!==f&&f,b=i.time_delay,p=void 0===b?{}:b,d=i.enable_week_delay,h=void 0!==d&&d,y=i.week_delay,v=void 0===y?[]:y;(Object(o.isEmpty)(u)||u.hasOwnProperty("text")&&""==u.text)&&(c.day_delay=Object(l.__)("Select a specific period.","wp-marketing-automations")),m?(Object(o.isEmpty)(p)||p.hasOwnProperty("time")&&Object(o.isEmpty)(p.time))&&(c.time_delay=Object(l.__)("Select a specific time of day.","wp-marketing-automations")):i.time_delay={},h?Object(o.isEmpty)(v)&&(c.week_delay=Object(l.__)("Select a specific day of the week.","wp-marketing-automations")):i.week_delay=[];break;case 2:var O=i.date,w=void 0===O?"":O,j=i.time_delay,g=void 0===j?{time:"10:00"}:j,E=i.enable_step_skip,_=void 0!==E&&E,k=i.skip_to_step,N=void 0===k?{}:k;Object(o.isEmpty)(w)&&(c.specific_date=Object(l.__)("Select a specific date.","wp-marketing-automations")),Object(o.isEmpty)(g.time)&&(c.specific_time=Object(l.__)("Select a specific time.","wp-marketing-automations")),!_||N.hasOwnProperty("step")&&""!=N.step||(c.specific_date_time_step=Object(l.__)("Please choose the target step if time passes.","wp-marketing-automations"));break;case 3:var S=i.custom_field,P=void 0===S?{}:S,x=i.enable_step_skip,L=void 0!==x&&x,C=i.skip_to_step,A=void 0===C?{}:C;if(!P.hasOwnProperty("field")||0==parseInt(P.field)||isNaN(parseInt(P.field))){c.custom_field=Object(l.__)("Please select custom field.","wp-marketing-automations");break}!L||A.hasOwnProperty("step")&&""!=A.step||(c.custom_field=Object(l.__)("Please choose the target step if time passes.","wp-marketing-automations"));break;case 4:var T=i.variable_field,I=void 0===T?{}:T,D=i.enable_step_skip,M=void 0!==D&&D,F=i.skip_to_step,G=void 0===F?{}:F;if(!I.hasOwnProperty("variable")||""==I.variable){c.variable=Object(l.__)("Please select a delay variable.","wp-marketing-automations");break}!M||G.hasOwnProperty("step")&&""!=G.step||(c.variable=Object(l.__)("Please choose the target step if time passes.","wp-marketing-automations"))}return!!Object(o.isEmpty)(c)||(n(c),!1)},he=function(){var e=cn(an().mark((function e(){var t,n,r;return an().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=!1,n=nn(nn({},le),{},{type:ue,data:be}),de(n)){e.next=4;break}return e.abrupt("return");case 4:if(!Object(o.isEqual)(oe,n)){e.next=7;break}return S(!1),e.abrupt("return");case 7:return Object(o.isEmpty)(oe)||(t=!0),T(!0),r={data:{data:{sidebarData:n}},steps:Object(o.cloneDeep)($).map((function(e){return e.hasOwnProperty("data")&&e.data.hasOwnProperty("sidebarValues")&&(e.data.sidebarValues={}),e})),links:W,count:Q,optionUpdated:t,actionType:1},e.prev=10,e.next=13,d()({path:Object(b.A)("/automation/".concat(V,"/step/").concat(re)),method:"POST",data:r}).then((function(e){if(200!==e.code)throw Error(Object(b.u)(null==e?void 0:e.message));k(e.message),P(H.id,nn(nn({},ce),{},{sidebarValues:n}),{step_status:1}),e.hasOwnProperty("result")&&e.result.hasOwnProperty("meta")&&x("meta",nn(nn({},K),e.result.meta)),setTimeout((function(){S(!1)}),100),T(!1)})).catch((function(e){throw Error(Object(b.u)(null==e?void 0:e.message))}));case 13:e.next=19;break;case 15:e.prev=15,e.t0=e.catch(10),x("modalData",{status:!0,modalTitle:Object(l.__)("Update Delay","wp-marketing-automations"),error:null===e.t0||void 0===e.t0?void 0:e.t0.message}),T(!1);case 19:Object(b.Lb)(k,3e3);case 20:case"end":return e.stop()}}),e,null,[[10,15]])})));return function(){return e.apply(this,arguments)}}(),ye=[{value:1,label:Object(l.__)("Delay for a specific period","wp-marketing-automations"),desc:Object(l.__)("Wait for a specified number of hours, days, or week before continuing","wp-marketing-automations"),isProFeature:!1},{value:2,label:Object(l.__)("Delay until a specific date and time","wp-marketing-automations"),desc:Object(l.__)("Set a specific date and time","wp-marketing-automations"),isProFeature:!0},{value:3,label:Object(l.__)("Delay until a custom field date","wp-marketing-automations"),desc:Object(l.__)("Choose from contacts custom field","wp-marketing-automations"),isProFeature:!0}];Object(o.isEmpty)(J)||ye.push({value:4,label:Object(l.__)("Delay with events variable","wp-marketing-automations"),desc:Object(l.__)("Choose from event field value","wp-marketing-automations"),isProFeature:!0});var ve=[{value:"1",label:Object(l.__)("S","wp-marketing-automations")},{value:"2",label:Object(l.__)("M","wp-marketing-automations")},{value:"3",label:Object(l.__)("T","wp-marketing-automations")},{value:"4",label:Object(l.__)("W","wp-marketing-automations")},{value:"5",label:Object(l.__)("TH","wp-marketing-automations")},{value:"6",label:Object(l.__)("F","wp-marketing-automations")},{value:"7",label:Object(l.__)("SA","wp-marketing-automations")}],Oe=function(e){return t.hasOwnProperty(e)},we={1:Object(l.__)("Sun","wp-marketing-automations"),2:Object(l.__)("Mon","wp-marketing-automations"),3:Object(l.__)("Tue","wp-marketing-automations"),4:Object(l.__)("Wed","wp-marketing-automations"),5:Object(l.__)("Thu","wp-marketing-automations"),6:Object(l.__)("Fri","wp-marketing-automations"),7:Object(l.__)("Sat","wp-marketing-automations")},je=function(){var e=be.day_delay,t=void 0===e?{}:e,n=be.enable_time_delay,r=void 0!==n&&n,a=be.enable_week_delay,i=void 0!==a&&a,c=be.time_delay,s=void 0===c?{time:"10:00"}:c,u=be.week_delay,f=void 0===u?[]:u;if(!Object(o.isEmpty)(t)&&t.hasOwnProperty("unit")&&t.hasOwnProperty("text")&&!Object(o.isEmpty)(t.unit)&&!Object(o.isEmpty)(t.text)){var m=t.text+" "+function(e,t){switch(e){case"min":return parseInt(t)>1?Object(l.__)("Minutes","wp-marketing-automations"):Object(l.__)("Minute","wp-marketing-automations");case"hours":return parseInt(t)>1?Object(l.__)("Hours","wp-marketing-automations"):Object(l.__)("Hour","wp-marketing-automations");case"days":return parseInt(t)>1?Object(l.__)("Days","wp-marketing-automations"):Object(l.__)("Day","wp-marketing-automations");case"weeks":return parseInt(t)>1?Object(l.__)("Weeks","wp-marketing-automations"):Object(l.__)("Week","wp-marketing-automations");case"months":return parseInt(t)>1?Object(l.__)("Months","wp-marketing-automations"):Object(l.__)("Month","wp-marketing-automations");default:return""}}(t.unit,t.text),b=[];i&&!Object(o.isEmpty)(f)&&f.map((function(e){we.hasOwnProperty(e)&&b.push(we[e])}));var p=Object(o.isEmpty)(b)?Object(l.__)("Skip to next day if time has passed","wp-marketing-automations"):Object(l.__)("Skip to next occurrence if time has passed","wp-marketing-automations");return r&&s.hasOwnProperty("time")&&!Object(o.isEmpty)(s.time)?(m+=" "+Object(l.__)("till","wp-marketing-automations")+" "+Object(_e.format)(bwfcrm_contacts_data.time_format,Ne()(s.time,"HH:mm:ss")),Object(o.isEmpty)(b)||(m+=" "+b.join("/")),s.hasOwnProperty("in_contact_timezone")&&s.in_contact_timezone&&(m+=" "+Object(l.__)("in Contact's Timezone","wp-marketing-automations")),m+=". "+p):Object(o.isEmpty)(b)||(m+=" "+b.join("/"),m+=". "+p),Object(l.__)("Delay of","wp-marketing-automations")+" "+m+"."}return""},ge=function(){var e=be.date,t=void 0===e?"":e,n=be.time_delay,r=void 0===n?{time:"10:00",in_contact_timezone:!1}:n,a=be.enable_step_skip,i=void 0!==a&&a,c=be.skip_to_step,s=void 0===c?{step:0,name:""}:c;if(!Object(o.isEmpty)(t)&&r.hasOwnProperty("time")&&!Object(o.isEmpty)(r.time)){var u=Object(l.__)("Delay till","wp-marketing-automations")+" ";if(u+=Object(b.hb)(t,!0,!1)+" ",r.hasOwnProperty("time")&&""!==r.time&&(u+="".concat(Object(l.__)("at","wp-marketing-automations")," ").concat(Object(_e.format)(bwfcrm_contacts_data.time_format,Ne()(r.time,"HH:mm:ss")))),r.hasOwnProperty("in_contact_timezone")&&r.in_contact_timezone?u+=" ".concat(Object(l.__)("in Contact's Timezone","wp-marketing-automations"),". "):u+=".",i&&!Object(o.isEmpty)(s)&&s.hasOwnProperty("step")&&""!=s.step&&s.hasOwnProperty("name")&&""!=s.name){var f=s.name.split(":");u+=" ".concat(Object(l.__)("Jumps to","wp-marketing-automations")," ").concat(f[0]," ").concat(Object(l.__)("if time has passed","wp-marketing-automations"),".")}return u}return""},Ee={action:Object(l.__)("Action","wp-marketing-automations"),wait:Object(l.__)("Delay","wp-marketing-automations"),conditional:Object(l.__)("Conditional","wp-marketing-automations"),exit:Object(l.__)("Exit","wp-marketing-automations"),benchmark:Object(l.__)("Goal","wp-marketing-automations")},ke=Object(r.useMemo)((function(){var e={stepsOptArr:[],stepsOptions:[{value:"",label:Object(l.__)("Select Step","wp-marketing-automations")}]};return Object(o.isEmpty)($)||($.map((function(t){var n=t.stepId,r=void 0===n?0:n,a=t.id,o=void 0===a?0:a;if(!["yesNoNode","end","jump","start","exit","split","splitpath"].includes(t.type)&&!e.stepsOptArr.hasOwnProperty(o)&&r!=re&&!ee.includes(o)){var i=[Object(l.__)("Step","wp-marketing-automations")];i.push(o),Ee.hasOwnProperty(t.type)&&i.push(" : "+Ee[t.type]),"action"==t.type&&t.hasOwnProperty("data")&&X.list.hasOwnProperty(t.data.selected)&&X.list[t.data.selected].hasOwnProperty("action_name")&&(X.list[t.data.selected].hasOwnProperty("integration_nicename")?i.push(" - "+X.list[t.data.selected].integration_nicename+" : "):i.push(" - "),i.push(X.list[t.data.selected].action_name)),"benchmark"==t.type&&t.hasOwnProperty("data")&&Z.list.hasOwnProperty(t.data.benchmark)&&Z.list[t.data.benchmark].hasOwnProperty("event_name")&&(Z.list[t.data.benchmark].hasOwnProperty("source_label")&&i.push(Z.list[t.data.benchmark].source_label+" : "),i.push(Z.list[t.data.benchmark].event_name)),e.stepsOptArr[r]=i.join(" "),e.stepsOptions.push({value:r,label:i.join(" ")})}})),e.stepsOptArr.end=Object(l.__)("End Automation","wp-marketing-automations"),e.stepsOptions.push({value:"end",label:Object(l.__)("End Automation","wp-marketing-automations")})),e}),[$]),Se=ln(Object(r.useState)(!1),2),Pe=Se[0],xe=Se[1],Le=ln(Object(r.useState)(!1),2),Ce=Le[0],Ae=Le[1],Te=function(){var e=be.day_delay,n=void 0===e?{unit:"min",text:"0"}:e,a=be.enable_time_delay,i=void 0!==a&&a,c=be.time_delay,f=void 0===c?{time:"10:00",in_contact_timezone:!1}:c,m=be.enable_week_delay,p=void 0!==m&&m,d=be.week_delay,h=void 0===d?["sunday"]:d;return Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"bwf-delay-field "+(Oe("day_delay")?"has-error":"")},Object(r.createElement)(Mt.a,{units:[{value:"min",label:Object(l.__)("Minutes","wp-marketing-automations")},{value:"hours",label:Object(l.__)("Hours","wp-marketing-automations")},{value:"days",label:Object(l.__)("Days","wp-marketing-automations")},{value:"weeks",label:Object(l.__)("Weeks","wp-marketing-automations")},{value:"months",label:Object(l.__)("Months","wp-marketing-automations")}],onChange:function(e){pe(nn(nn({},be),{},{day_delay:e}))},value:n}),Oe("day_delay")&&Object(r.createElement)("div",{className:"has-bwfan-error"},t.day_delay)),Object(r.createElement)("div",{className:"bwf_clear_24"}),Object(b.ac)()?Object(r.createElement)(r.Fragment,null,Object(r.createElement)(Zt.a,{checked:i,label:Object(l.__)("Delay until a specific time of day","wp-marketing-automations"),onChange:function(e){return pe(nn(nn({},be),{},{enable_time_delay:e}))}}),i&&Object(r.createElement)("div",{className:"bwf-delay-field "+(Oe("time_delay")?"has-error":"")},Object(r.createElement)("div",{className:"bwf_clear_24"}),Object(r.createElement)("div",{className:"bwf-p-20 bwf-pt-0 bwf-pb-0"},Object(r.createElement)("div",{className:"bwf-display-flex bwf-flex-start bwf_w_full"},Object(r.createElement)("input",{type:"time",value:f.time,className:"bwf-w-150 bwf-h-36",onChange:function(e){pe(nn(nn({},be),{},{time_delay:nn(nn({},be.time_delay),{},{time:e.target.value})}))}}),Object(r.createElement)("div",{className:"bwf_clear_24"}),Object(r.createElement)("div",{className:"bwf-display-flex "+(Object(b.ac)()?"":"bwf-delay-no-pro")},Object(b.ac)()?Object(r.createElement)(Zt.a,{checked:f.in_contact_timezone,label:Object(l.__)("In Contact Timezone","wp-marketing-automations"),onChange:function(e){pe(nn(nn({},be),{},{time_delay:nn(nn({},be.time_delay),{},{in_contact_timezone:e})}))}}):Object(r.createElement)("div",{className:"bwf-cursor-pointer no-color",onClick:function(){x("proModalContent",Object(l.__)("This","wp-marketing-automations")),x("showProModal",!0)}},Object(l.__)("In Contact Timezone","wp-marketing-automations")),!Object(b.ac)()&&Object(r.createElement)(s.a,{icon:"king",size:16})))),Oe("time_delay")&&Object(r.createElement)("div",{className:"has-bwfan-error"},t.time_delay))):Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"bwf-display-flex bwf-flex-start"},Object(r.createElement)(s.a,{icon:"king",size:16}),Object(l.__)("Delay until a specific time of day","wp-marketing-automations"),Object(r.createElement)("a",{onClick:function(){return xe(!Pe)},className:"bwf-no-underline bwf-cursor-pointer"},Object(l.__)("Explore","wp-marketing-automations"))),Pe&&Object(r.createElement)("div",{className:"bwf-p-15 bwf-mtb-10 bwf-lite-restrict-section"},Object(r.createElement)(Zt.a,{checked:!1,disabled:!0,label:Object(l.__)("Delay until a specific time of day","wp-marketing-automations")}),Object(r.createElement)("div",{className:"bwf-delay-field "},Object(r.createElement)("div",{className:"bwf_clear_10"}),Object(r.createElement)("div",{className:"bwf-p-20 bwf-pt-0 bwf-pb-0"},Object(r.createElement)("div",{className:"bwf-display-flex bwf-flex-start bwf_w_full"},Object(r.createElement)("input",{type:"time",value:"",disabled:!0,className:"bwf-w-150 bwf-h-36",onChange:function(){}}),Object(r.createElement)("div",{className:"bwf_clear_10"}),Object(r.createElement)("div",{className:"bwf-display-flex "},Object(r.createElement)(Zt.a,{checked:!1,disabled:!0,label:Object(l.__)("In Contact Timezone","wp-marketing-automations"),onChange:function(){}}))))),Object(r.createElement)("div",{className:"bwf_clear_24"}),Object(r.createElement)("div",{className:"bwf-single-automation-notice is-info no-icon"},Object(r.createElement)("b",null,Object(l.__)("This feature is only for licensed Pro users.","wp-marketing-automations"))," ",Object(r.createElement)("a",{target:"__blank",className:"bwf-a-no-underline",href:Object(b.fb)("upgrade",{utm_medium:"Get+PRO+Delay+Step"})},Object(l.__)("Learn More","wp-marketing-automations"))))),Object(r.createElement)("div",{className:"bwf_clear_24"}),Object(b.ac)()?Object(r.createElement)(r.Fragment,null,Object(r.createElement)(Zt.a,{checked:p,label:Object(l.__)("Delay until a specific day(s) of the week","wp-marketing-automations"),onChange:function(e){return pe(nn(nn({},be),{},{enable_week_delay:e}))}}),p&&Object(r.createElement)("div",{className:"bwf-delay-field "+(Oe("week_delay")?"has-error":"")},Object(r.createElement)("div",{className:"bwf_clear_24"}),Object(r.createElement)(u.ButtonGroup,null,ve.map((function(e,t){return Object(r.createElement)(u.Button,{key:t,isPrimary:h.includes(e.value),isSecondary:!h.includes(e.value),onClick:function(){var t=en(h);t.includes(e.value)?t=t.filter((function(t){return t!==e.value})):t.push(e.value),pe(nn(nn({},be),{},{week_delay:t}))}},e.label)}))),Oe("week_delay")&&Object(r.createElement)("div",{className:"has-bwfan-error"},t.week_delay))):Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"bwf-display-flex bwf-flex-start"},Object(r.createElement)(s.a,{icon:"king",size:16}),Object(l.__)("Delay until a specific day(s) of the week","wp-marketing-automations"),Object(r.createElement)("a",{onClick:function(){return Ae(!Ce)},className:"bwf-no-underline bwf-cursor-pointer"},Object(l.__)("Explore","wp-marketing-automations"))),Ce&&Object(r.createElement)("div",{className:"bwf-p-15 bwf-mtb-10 bwf-lite-restrict-section"},Object(r.createElement)(Zt.a,{checked:!1,disabled:!0,label:Object(l.__)("Delay until a specific day(s) of the week","wp-marketing-automations"),onChange:function(){}}),Object(r.createElement)("div",{className:"bwf-delay-field "},Object(r.createElement)("div",{className:"bwf_clear_24"}),Object(r.createElement)(u.ButtonGroup,null,ve.map((function(e,t){return Object(r.createElement)(u.Button,{key:t,isPrimary:!1,isSecondary:!0,onClick:function(){},disabled:!0},e.label)})))),Object(r.createElement)("div",{className:"bwf_clear_24"}),Object(r.createElement)("div",{className:"bwf-single-automation-notice is-info no-icon"},Object(r.createElement)("b",null,Object(l.__)("This feature is only for licensed Pro users.","wp-marketing-automations"))," ",Object(r.createElement)("a",{target:"__blank",className:"bwf-a-no-underline",href:Object(b.fb)("upgrade",{utm_medium:"Get+PRO+Delay+Step"})},Object(l.__)("Learn More","wp-marketing-automations"))))),!Object(o.isEmpty)(je())&&Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"bwf_clear_24"}),Object(r.createElement)("div",{className:"bwf-single-automation-notice is-info"},je())))},Ie=function(e){var t=Ne()().format("MM/DD/YYYY");return Ne()(t).isSameOrBefore(Ne()(e))},De=function(){var e=be.custom_field,t=void 0===e?{field:0,time:"10:00",in_contact_timezone:!1,custom_field_label:""}:e,n=be.enable_time_delay,a=void 0!==n&&n,c=be.time_delay,s=void 0===c?{duration:0,type:"days",timing:"after"}:c,f=be.occurrence,m=void 0===f?"daymonth":f,p=be.enable_step_skip,d=void 0!==p&&p,h=be.skip_to_step,y=void 0===h?{step:0,name:""}:h,v=ke.stepsOptArr,O=ke.stepsOptions;if(Object(o.isEmpty)(i))return Object(r.createElement)(r.Fragment,null,Object(l.__)("No Custom Field with type Date found","wp-marketing-automations"));var w=[{value:"",label:Object(l.__)("Select Type","wp-marketing-automations")}];Object.keys(i).map((function(e){w.push({label:i[e].hasOwnProperty("name")?i[e].name:"",value:e})}));var j,g,E=function(){var e=be.custom_field,t=void 0===e?{field:"",time:"10:00",in_contact_timezone:!1,custom_field_label:""}:e,n=be.enable_time_delay,r=void 0!==n&&n,a=be.time_delay,i=void 0===a?{duration:0,type:"days",timing:"after"}:a,c=be.enable_step_skip,s=void 0!==c&&c,u=be.skip_to_step,f=void 0===u?{step:0,name:""}:u,m=be.occurrence,b=void 0===m?"daymonth":m;if(t.hasOwnProperty("field")&&""!==t.field){var p=Object(l.__)("Delay","wp-marketing-automations")+" ";if(r?i.hasOwnProperty("duration")&&(p+="".concat(Object(l.__)("of","wp-marketing-automations")," ").concat(i.duration," ").concat(i.type," ").concat(i.timing," ")):p+=Object(l.__)("till","wp-marketing-automations")+" ",t.hasOwnProperty("custom_field_label")&&""!==t.custom_field_label?p+=" ".concat(Object(l.__)("Contact's","wp-marketing-automations")," '").concat(t.custom_field_label,"' "):p+="".concat(Object(l.__)("Custom Field","wp-marketing-automations")," ( ").concat(t.field," )"),"fulldatetime"!==b&&t.hasOwnProperty("time")&&""!==t.time&&(p+=" ".concat(Object(l.__)("till","wp-marketing-automations")," ").concat(Object(_e.format)(bwfcrm_contacts_data.time_format,Ne()(t.time,"HH:mm:ss")))),t.hasOwnProperty("in_contact_timezone")&&t.in_contact_timezone?p+=" ".concat(Object(l.__)("in Contact's Timezone","wp-marketing-automations"),". "):p+=".",s&&!Object(o.isEmpty)(f)&&f.hasOwnProperty("step")&&""!=f.step&&f.hasOwnProperty("name")&&""!=f.name){var d=f.name.split(":");p+=" ".concat(Object(l.__)("Jumps to","wp-marketing-automations")," ").concat(d[0]," ").concat(Object(l.__)("if time has passed","wp-marketing-automations"),".")}return p}return""}();return Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"bwf-delay-field bwf-delay-select-field-wrap"},Object(r.createElement)("div",{className:"bwf-pt-0 bwf-pb-0"},Object(r.createElement)("div",{className:"bwf-display-flex bwf-flex-start bwf_w_full align-start"},Object(r.createElement)("div",{className:"bwf-delay-field-select bwf-w-210 "+(Oe("custom_field")&&""==t.field?"has-error":"")},Object(r.createElement)(u.SelectControl,{value:t.field,className:"bwf_W_full",options:w,onChange:function(e){if(e&&i.hasOwnProperty(e)){var t=Object(o.cloneDeep)(be);t=nn(nn({},t),{},{custom_field:nn(nn({},t.custom_field),{},{field:e,custom_field_label:i[e].name})}),8==i[e].type?(t.occurrence="fulldatetime",t.time_delay=nn(nn({},t.time_delay),{},{type:"hours"})):(t.occurrence="daymonth",t.time_delay=nn(nn({},t.time_delay),{},{type:"days"})),pe(nn(nn({},be),t))}}}),Oe("custom_field")&&""==t.field&&Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"has-bwfan-error"},Object(l.__)("Please select a custom field.","wp-marketing-automations")))),Object(r.createElement)("div",{className:"bwf-delay-occurrence bwf-delay-field "+(Oe("custom_field")&&""==m?"has-error":"")},Object(r.createElement)(u.SelectControl,{value:m,className:"bwf_w_full",options:(j=(null==t?void 0:t.field)||0,g=[],i.hasOwnProperty(j)&&!Object(o.isEmpty)(i[j])&&i[j].hasOwnProperty("type")&&8===parseInt(i[j].type)&&(g=[{value:"fulldatetime",label:Object(l.__)("Use Full Date Time","wp-marketing-automations")}]),[].concat(en(g),[{value:"daymonth",label:Object(l.__)("Use Day & Month","wp-marketing-automations")},{value:"daymonthyear",label:Object(l.__)("Use Full Date","wp-marketing-automations")}])),onChange:function(e){return pe(nn(nn({},be),{},{occurrence:e}))}}))),Object(r.createElement)("div",{className:"bwf-sidebar-hint"},Object(l.__)("Note: Contact would not pass this step if the value of custom field is blank.","wp-marketing-automations"),"daymonth"===m&&Object(r.createElement)(r.Fragment,null,Object(r.createElement)("br",null),Object(l.__)("It will pick the day and month from the selected field value and if the time is older than the current time it will increase by one year.","wp-marketing-automations")),"fulldatetime"===m&&Object(r.createElement)(r.Fragment,null,Object(r.createElement)("br",null),Object(l.__)("It will pick the time, day and month from the selected field value and if the time is older than the current time it will increase by one year.","wp-marketing-automations"))),Object(r.createElement)("div",{className:"bwf_clear_24"}),Object(r.createElement)("div",{className:"bwf-display-flex bwf-flex-start bwf_w_full"},"fulldatetime"!==m&&Object(r.createElement)("div",{className:"bwf-delay-select-field-time bwf-w-210"},Object(r.createElement)("input",{type:"time",value:t.time,className:"bwf-w-210 bwf-h-36",onChange:function(e){pe(nn(nn({},be),{},{custom_field:nn(nn({},be.custom_field),{},{time:e.target.value})}))}})),Object(r.createElement)("div",{className:"bwf-delay-select-field-timezone bwf-w-210"},Object(r.createElement)(Zt.a,{checked:t.in_contact_timezone,label:Object(l.__)("In Contact Timezone","wp-marketing-automations"),onChange:function(e){pe(nn(nn({},be),{},{custom_field:nn(nn({},be.custom_field),{},{in_contact_timezone:e})}))}}))))),Object(r.createElement)("div",{className:"bwf_clear_24"}),Object(r.createElement)("div",{className:"bwf-delay-field bwf-delay-sidebar-custom-field"},Object(r.createElement)("div",{className:"bwf-delay-skip-step bwf-specific-date"},Object(r.createElement)("div",{className:"bwf-specific-date "+(Object(b.ac)()?"":"bwf-delay-no-pro")},Object(r.createElement)(Zt.a,{checked:a,label:Object(l.__)("Delay for certain occurrence from field value","wp-marketing-automations"),onChange:function(e){Object(b.ac)()?pe(nn(nn({},be),{},{enable_time_delay:e})):(x("proModalContent",Object(l.__)("This","wp-marketing-automations")),x("showProModal",!0))}}))),a&&Object(r.createElement)("div",{className:"bwf-pt-0 bwf-pb-0 bwf-delay-sidebar-custom-delay-wrap"},Object(r.createElement)("div",{className:"bwf_clear_24"}),Object(r.createElement)("div",{className:"bwf-display-flex bwf-flex-start bwf_w_full"},Object(r.createElement)("div",{className:"bwf-delay-duration bwf-w-210 "+(Oe("custom_field")&&parseInt(s.duration)<0?"has-error":"")},Object(r.createElement)(u.TextControl,{className:"bwf-h-36",type:"number",value:s.duration,onChange:function(e){return pe(nn(nn({},be),{},{time_delay:nn(nn({},be.time_delay),{},{duration:e})}))},min:1,placeholder:Object(l.__)("Enter","wp-marketing-automations")})),Object(r.createElement)("div",{className:"bwf-delay-type bwf-w-210"},Object(r.createElement)(u.SelectControl,{value:s.type,className:"bwf_w_full",options:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=[];return"fulldatetime"===e&&(t=[{value:"minutes",label:Object(l.__)("Minutes","wp-marketing-automations")},{value:"hours",label:Object(l.__)("Hours","wp-marketing-automations")}]),[].concat(en(t),[{value:"days",label:Object(l.__)("Days","wp-marketing-automations")},{value:"weeks",label:Object(l.__)("Weeks","wp-marketing-automations")}])}(m),onChange:function(e){return pe(nn(nn({},be),{},{time_delay:nn(nn({},be.time_delay),{},{type:e})}))}})),Object(r.createElement)("div",{className:"bwf-delay-timing bwf-w-170"},Object(r.createElement)(u.SelectControl,{value:s.timing,className:"bwf_w_full",options:[{value:"before",label:Object(l.__)("Before","wp-marketing-automations")},{value:"after",label:Object(l.__)("After","wp-marketing-automations")}],onChange:function(e){return pe(nn(nn({},be),{},{time_delay:nn(nn({},be.time_delay),{},{timing:e})}))}}))))),Object(r.createElement)("div",{className:"bwf_clear_20"}),Object(r.createElement)("div",{className:"bwf-delay-skip-step bwf-specific-date"},Object(r.createElement)("div",{className:"bwf-specific-date "+(Object(b.ac)()?"":"bwf-delay-no-pro")},Object(r.createElement)(Zt.a,{checked:d,label:Object(l.__)("Jump to step if time has passed","wp-marketing-automations"),onChange:function(e){Object(b.ac)()?pe(nn(nn({},be),{},{enable_step_skip:e})):(x("proModalContent",Object(l.__)("This","wp-marketing-automations")),x("showProModal",!0))}}))),d&&Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"bwf_clear_24"}),Object(r.createElement)("div",{className:"bwf-delay-skip-step-select bwf-specific-date "+(Oe("custom_field")&&""==y.step?"has-error":"")},Object(r.createElement)(u.SelectControl,{value:y.step,className:"bwf_w_full",options:O,onChange:function(e){return pe(nn(nn({},be),{},{skip_to_step:nn(nn({},be.skip_to_step),{},{step:e,name:v[e]})}))}}),Oe("custom_field")&&""==y.step&&Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"has-bwfan-error"},Object(l.__)("Please choose the target step if time passes.","wp-marketing-automations"))))),""!==E&&Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"bwf_clear_24"}),Object(r.createElement)("div",{className:"bwf-single-automation-notice is-info"},E)))},Me=function(){var e=be.variable_field,t=void 0===e?{variable:"",time:"10:00",in_contact_timezone:!1}:e,n=be.enable_time_delay,a=void 0!==n&&n,i=be.time_delay,c=void 0===i?{duration:0,type:"days",timing:"after"}:i,s=be.occurrence,f=void 0===s?"daymonthyear":s,m=be.enable_step_skip,p=void 0!==m&&m,d=be.skip_to_step,h=void 0===d?{step:0,name:""}:d,y=ke.stepsOptArr,v=ke.stepsOptions,O=function(){var e=be.variable_field,t=void 0===e?{variable:"",time:"10:00",in_contact_timezone:!1}:e,n=be.enable_time_delay,r=void 0!==n&&n,a=be.time_delay,i=void 0===a?{duration:0,type:"days",timing:"after"}:a,c=be.occurrence,s=void 0===c?"daymonthyear":c,u=be.enable_step_skip,f=void 0!==u&&u,m=be.skip_to_step,b=void 0===m?{step:0,name:""}:m;if(t.hasOwnProperty("variable")&&""!==t.variable){var p=Object(l.__)("Delay","wp-marketing-automations")+" ";if(r?i.hasOwnProperty("duration")&&(p+="".concat(Object(l.__)("of","wp-marketing-automations")," ").concat(i.duration," ").concat(i.type," ").concat(i.timing," ")):p+=Object(l.__)("till","wp-marketing-automations")+" ",p+=" ".concat(Object(l.__)("Orders meta key","wp-marketing-automations")," ").concat(t.variable," value"),"fulldatetime"!==s&&t.hasOwnProperty("time")&&""!==t.time&&(p+=" ".concat(Object(l.__)("till","wp-marketing-automations")," ").concat(Object(_e.format)(bwfcrm_contacts_data.time_format,Ne()(t.time,"HH:mm:ss")))),t.hasOwnProperty("in_contact_timezone")&&t.in_contact_timezone?p+=" ".concat(Object(l.__)("in Contact's Timezone","wp-marketing-automations"),". "):p+=".",f&&!Object(o.isEmpty)(b)&&b.hasOwnProperty("step")&&""!=b.step&&b.hasOwnProperty("name")&&""!=b.name){var d=b.name.split(":");p+=" ".concat(Object(l.__)("Jumps to","wp-marketing-automations")," ").concat(d[0]," ").concat(Object(l.__)("if time has passed","wp-marketing-automations"),".")}return p}return""}();return Object(r.createElement)(r.Fragment,null,Object(r.createElement)(Xt,{isOpen:E,onRequestClose:_,automationID:V,onSelect:function(e){pe(nn(nn({},be),{},{variable_field:nn(nn({},be.variable_field),{},{variable:e})}))}}),Object(r.createElement)("div",{className:"bwf-delay-field bwf-delay-select-field-wrap"},Object(r.createElement)("div",{className:"bwf-pt-0 bwf-pb-0"},Object(r.createElement)("div",{className:"bwf-display-flex bwf-flex-start bwf_w_full align-start"},Object(r.createElement)("div",{className:"bwf-delay-field-select bwf-w-300 "+(Oe("variable")&&""==t.variable?"has-error":""),onClick:function(){return _(!0)}},Object(r.createElement)(u.TextControl,{value:t.variable,disabled:!0}),Oe("variable")&&""==t.variable&&Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"has-bwfan-error"},Object(l.__)("Please select a variable.","wp-marketing-automations")))),Object(r.createElement)("div",{className:"bwf-delay-occurrence bwf-delay-field ",onClick:function(){return _(!0)}},Object(r.createElement)(u.Button,{isSecondary:!0},Object(l.__)("Select","wp-marketing-automations"))),Object(r.createElement)("div",{className:"bwf-delay-occurrence bwf-delay-field "},Object(r.createElement)("div",{className:"bwf-delay-occurrence bwf-delay-field "+(Oe("variable")&&""==f?"has-error":"")},Object(r.createElement)(u.SelectControl,{value:f,className:"bwf_w_full",options:[{value:"daymonth",label:Object(l.__)("Use Day & Month","wp-marketing-automations")},{value:"daymonthyear",label:Object(l.__)("Use Full Date","wp-marketing-automations")}],onChange:function(e){return pe(nn(nn({},be),{},{occurrence:e}))}})))),Object(r.createElement)("div",{className:"bwf-sidebar-hint"},Object(l.__)("Note: If key value is not present it will run immediately.","wp-marketing-automations"),"daymonth"===f&&Object(r.createElement)(r.Fragment,null,Object(r.createElement)("br",null),Object(l.__)("It will pick the day and month from the selected field value and if the time is older than the current time it will increase by one year.","wp-marketing-automations"))),Object(r.createElement)("div",{className:"bwf_clear_24"}),Object(r.createElement)("div",{className:"bwf-display-flex bwf-flex-start bwf_w_full"},Object(r.createElement)("div",{className:"bwf-delay-select-field-time bwf-w-210"},Object(r.createElement)("input",{type:"time",value:t.time,className:"bwf-w-210 bwf-h-36",onChange:function(e){pe(nn(nn({},be),{},{variable_field:nn(nn({},be.variable_field),{},{time:e.target.value})}))}})),Object(r.createElement)("div",{className:"bwf-delay-select-field-timezone bwf-w-210"},Object(r.createElement)(Zt.a,{checked:t.in_contact_timezone,label:Object(l.__)("In Contact Timezone","wp-marketing-automations"),onChange:function(e){pe(nn(nn({},be),{},{variable_field:nn(nn({},be.variable_field),{},{in_contact_timezone:e})}))}}))))),Object(r.createElement)("div",{className:"bwf_clear_24"}),Object(r.createElement)("div",{className:"bwf-delay-field bwf-delay-sidebar-custom-field"},Object(r.createElement)("div",{className:"bwf-delay-skip-step bwf-specific-date"},Object(r.createElement)("div",{className:"bwf-specific-date "+(Object(b.ac)()?"":"bwf-delay-no-pro")},Object(r.createElement)(Zt.a,{checked:a,label:Object(l.__)("Delay for certain days from field date","wp-marketing-automations"),onChange:function(e){Object(b.ac)()?pe(nn(nn({},be),{},{enable_time_delay:e})):(x("proModalContent",Object(l.__)("This","wp-marketing-automations")),x("showProModal",!0))}}))),a&&Object(r.createElement)("div",{className:"bwf-pt-0 bwf-pb-0 bwf-delay-sidebar-custom-delay-wrap"},Object(r.createElement)("div",{className:"bwf_clear_24"}),Object(r.createElement)("div",{className:"bwf-display-flex bwf-flex-start bwf_w_full"},Object(r.createElement)("div",{className:"bwf-delay-duration bwf-w-210 "+(Oe("custom_field")&&parseInt(c.duration)<0?"has-error":"")},Object(r.createElement)(u.TextControl,{className:"bwf-h-36",type:"number",value:c.duration,onChange:function(e){return pe(nn(nn({},be),{},{time_delay:nn(nn({},be.time_delay),{},{duration:e})}))},min:1,placeholder:Object(l.__)("Enter","wp-marketing-automations")})),Object(r.createElement)("div",{className:"bwf-delay-type bwf-w-210"},Object(r.createElement)(u.SelectControl,{value:c.type,className:"bwf_w_full",options:[{value:"days",label:Object(l.__)("Days","wp-marketing-automations")},{value:"weeks",label:Object(l.__)("Weeks","wp-marketing-automations")}],onChange:function(e){return pe(nn(nn({},be),{},{time_delay:nn(nn({},be.time_delay),{},{type:e})}))}})),Object(r.createElement)("div",{className:"bwf-delay-timing bwf-w-170"},Object(r.createElement)(u.SelectControl,{value:c.timing,className:"bwf_w_full",options:[{value:"before",label:Object(l.__)("Before","wp-marketing-automations")},{value:"after",label:Object(l.__)("After","wp-marketing-automations")}],onChange:function(e){return pe(nn(nn({},be),{},{time_delay:nn(nn({},be.time_delay),{},{timing:e})}))}}))))),Object(r.createElement)("div",{className:"bwf_clear_24"}),Object(r.createElement)("div",{className:"bwf-delay-skip-step bwf-specific-date"},Object(r.createElement)("div",{className:"bwf-specific-date "+(Object(b.ac)()?"":"bwf-delay-no-pro")},Object(r.createElement)(Zt.a,{checked:p,label:Object(l.__)("Jump to step if time has passed","wp-marketing-automations"),onChange:function(e){Object(b.ac)()?pe(nn(nn({},be),{},{enable_step_skip:e})):(x("proModalContent",Object(l.__)("This","wp-marketing-automations")),x("showProModal",!0))}}))),p&&Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"bwf_clear_24"}),Object(r.createElement)("div",{className:"bwf-delay-skip-step-select bwf-delay-field "+(Oe("variable")&&""==h.step?"has-error":"")},Object(r.createElement)(u.SelectControl,{value:h.step,className:"bwf_w_full",options:v,onChange:function(e){return pe(nn(nn({},be),{},{skip_to_step:nn(nn({},be.skip_to_step),{},{step:e,name:y[e]})}))}}),Oe("variable")&&""==h.step&&Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"has-bwfan-error"},Object(l.__)("Please choose the target step if time passes.","wp-marketing-automations"))))),""!==O&&Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"bwf_clear_24"}),Object(r.createElement)("div",{className:"bwf-single-automation-notice is-info"},O)))};return Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"wr_header"},Object(r.createElement)("div",{className:"bwf-node-icon icon-delay"},Object(r.createElement)(s.a,{size:28,icon:"time-left"})),Object(r.createElement)("div",{className:"wr_event_title"},Object(r.createElement)("span",null,Object(l.__)("Delay","wp-marketing-automations"))),Object(r.createElement)("div",{className:"wr_event_variant"}),Object(r.createElement)("div",{className:"wr_close bwf-cursor-pointer",onClick:function(){S(!1)}},Object(r.createElement)(s.a,{icon:"close"}))),Object(r.createElement)("div",{className:"wr_content"},Object(r.createElement)("div",{className:"bwf-delay-wrap"},Object(r.createElement)(Dt,{selected:ue,setSelected:function(e){if(!Object(b.ac)()&&[2,3].includes(parseInt(e)))return x("proModalContent",Object(l.__)("This Type","wp-marketing-automations")),void x("showProModal",!0);pe(function(e){switch(e){case 1:return{day_delay:{unit:"min",text:""},enable_time_delay:!1,time_delay:{time:"10:00",in_contact_timezone:!1},enable_week_delay:!1,week_delay:[]};case 2:return{date:"",time_delay:{time:"10:00",in_contact_timezone:!1},enable_step_skip:!1,skip_to_step:{step:0,name:""}};case 3:return{custom_field:{field:"",time:"10:00",in_contact_timezone:!1,custom_field_label:""},time_delay:{duration:0,type:"days",timing:"before"},occurrence:"daymonth",enable_step_skip:!1,skip_to_step:{step:0,name:""}};case 4:return{variable_field:{variable:"",time:"10:00",in_contact_timezone:!1},time_delay:{duration:0,type:"days",timing:"before"},occurrence:"daymonthyear",enable_step_skip:!1,skip_to_step:{step:0,name:""}};default:return{}}}(parseInt(e))),fe(e)},options:ye,selectedContent:function(){switch(parseInt(ue)){case 1:return Object(r.createElement)(r.Fragment,null,Te());case 2:return Object(r.createElement)(r.Fragment,null,Object(b.ac)()?(e=be.date,n=void 0===e?"":e,a=be.time_delay,i=void 0===a?{time:"10:00",in_contact_timezone:!1}:a,c=be.enable_step_skip,f=void 0!==c&&c,m=be.skip_to_step,p=void 0===m?{step:0,name:""}:m,d=ke.stepsOptArr,y=ke.stepsOptions,Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"bwf-specific-date-time-delay"},Object(r.createElement)("div",{className:"bwf-specific-date bwf_w_full"},Object(r.createElement)("div",{className:"bwf-delay-field "+(Oe("specific_date")?"has-error":"")},Object(r.createElement)(Ft.a,{date:Object(o.isEmpty)(n)?null:Ne()(n),dateFormat:"MM/DD/YYYY",isInvalidDate:function(e){return!Ie(e)},onUpdate:function(e){Ie(e.text)?pe(nn(nn({},be),{},{date:e.text})):(k(Object(l.__)("Invalid Date selected","wp-marketing-automations")),Object(b.Lb)(k,3e3))},text:n,iconRight:!0}),Oe("specific_date")&&Object(r.createElement)("div",{className:"has-bwfan-error"},t.specific_date))),Object(r.createElement)("div",{className:"bwf-specific-time bwf_w_full"},Object(r.createElement)("div",{className:"bwf-delay-field "+(Oe("specific_time")?"has-error":"")},Object(r.createElement)("input",{type:"time",value:i.time,onChange:function(e){pe(nn(nn({},be),{},{time_delay:nn(nn({},be.time_delay),{},{time:e.target.value})}))},className:"bwf-h-36"}),Oe("specific_time")&&Object(r.createElement)("div",{className:"has-bwfan-error"},t.specific_time))),Object(r.createElement)("div",{className:"bwf-specific-date bwf-w-210 "+(Object(b.ac)()?"":"bwf-delay-no-pro")},Object(b.ac)()?Object(r.createElement)(Zt.a,{checked:i.in_contact_timezone,label:Object(l.__)("In Contact Timezone","wp-marketing-automations"),onChange:function(e){pe(nn(nn({},be),{},{time_delay:nn(nn({},be.time_delay),{},{in_contact_timezone:e})}))}}):Object(r.createElement)("div",{className:"bwf-cursor-pointer",onClick:function(){x("proModalContent",Object(l.__)("This","wp-marketing-automations")),x("showProModal",!0)}},Object(l.__)("In Contact TimeZone","wp-marketing-automations")),!Object(b.ac)()&&Object(r.createElement)(s.a,{icon:"king",size:16}))),Object(r.createElement)("div",{className:"bwf-m-0 bwf-mt-16 bwf-single-automation-notice is-gray no-icon"},Object(r.createElement)("span",null,Object(l.__)("Current Store Time","wp-marketing-automations")+":"," "),Object(b.ib)(Ne()().tz("UTC"))),Object(r.createElement)("div",{className:"bwf_clear_16"}),Object(r.createElement)("div",{className:"bwf-specific-date"},Object(r.createElement)("div",{className:"bwf-specific-date "+(Object(b.ac)()?"":"bwf-delay-no-pro")},Object(r.createElement)(Zt.a,{checked:f,label:Object(l.__)("Jump to step if time has passed","wp-marketing-automations"),onChange:function(e){Object(b.ac)()?pe(nn(nn({},be),{},{enable_step_skip:e})):(x("proModalContent",Object(l.__)("This","wp-marketing-automations")),x("showProModal",!0))}}))),f&&Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"bwf_clear_24"}),Object(r.createElement)("div",{className:"bwf-specific-date "+(Oe("specific_date_time_step")?"has-error":"")},Object(r.createElement)(u.SelectControl,{value:p.step,className:"bwf_w_full",options:y,onChange:function(e){return pe(nn(nn({},be),{},{skip_to_step:nn(nn({},be.skip_to_step),{},{step:e,name:d[e]})}))}}),Oe("specific_date_time_step")&&Object(r.createElement)("div",{className:"has-bwfan-error"},t.specific_date_time_step))),!Object(o.isEmpty)(ge())&&Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"bwf_clear_24"}),Object(r.createElement)("div",{className:"bwf-single-automation-notice is-info"},ge())))):Object(r.createElement)(r.Fragment,null));case 3:return Object(r.createElement)(r.Fragment,null,Object(b.ac)()?Object(r.createElement)("div",{className:"bwf-custom-date-delay"},Object(r.createElement)("div",{className:"bwf-delay-field "},h?Object(r.createElement)("div",{className:"bwf-placeholder-temp bwf_w_full bwf-h-15"}):De())):Object(r.createElement)(r.Fragment,null));case 4:return Object(r.createElement)(r.Fragment,null,Object(b.ac)()?Me():Object(r.createElement)(r.Fragment,null));default:return Object(r.createElement)(r.Fragment,null)}var e,n,a,i,c,f,m,p,d,y}(),liteDummyData:{2:Object(r.createElement)("div",{className:"bwf-pl-30 bwf-lite-restrict-section"},Object(r.createElement)("div",{className:"bwf-specific-date-time-delay"},Object(r.createElement)("div",{className:"bwf-specific-date bwf_w_full"},Object(r.createElement)("div",{className:"bwf-delay-field ",style:{pointerEvents:"none"}},Object(r.createElement)(Ft.a,{date:null,dateFormat:"MM/DD/YYYY",onUpdate:function(){},text:"",iconRight:!0,disabled:!0}))),Object(r.createElement)("div",{className:"bwf-specific-time bwf_w_full"},Object(r.createElement)("div",{className:"bwf-delay-field "},Object(r.createElement)("input",{type:"time",value:"",disabled:!0,onChange:function(){},className:"bwf-h-36"}))),Object(r.createElement)("div",{className:"bwf-specific-date bwf-w-210 "},Object(r.createElement)(Zt.a,{checked:!1,disabled:!0,label:Object(l.__)("In Contact Timezone","wp-marketing-automations"),onChange:function(){}}))),Object(r.createElement)("div",{className:"bwf_clear_24"}),Object(r.createElement)("div",{className:"bwf-specific-date"},Object(r.createElement)("div",{className:"bwf-specific-date "},Object(r.createElement)(Zt.a,{checked:!1,disabled:!0,label:Object(l.__)("Jump to step if time has passed","wp-marketing-automations"),onChange:function(){}}))),Object(r.createElement)("div",{className:"bwf_clear_24"}),Object(r.createElement)("div",{className:"bwf-specific-date "},Object(r.createElement)(u.SelectControl,{value:"",disabled:!0,className:"bwf_w_full",options:[],onChange:function(){}})),Object(r.createElement)("div",{className:"bwf_clear_24"}),Object(r.createElement)("div",{className:"bwf-single-automation-notice is-info no-icon"},Object(r.createElement)("b",null,Object(l.__)("This feature is only for licensed Pro users.","wp-marketing-automations"))," ",Object(r.createElement)("a",{target:"__blank",className:"bwf-a-no-underline",href:Object(b.fb)("upgrade",{utm_medium:"Get+PRO+Delay+Step"})},Object(l.__)("Learn More","wp-marketing-automations")))),3:Object(r.createElement)("div",{className:"bwf-pl-30 bwf-lite-restrict-section"},Object(r.createElement)("div",{className:"bwf_clear_24"}),Object(r.createElement)("div",{className:"bwf-delay-field bwf-delay-select-field-wrap"},Object(r.createElement)("div",{className:"bwf-pt-0 bwf-pb-0"},Object(r.createElement)("div",{className:"bwf-display-flex bwf-flex-start bwf_w_full align-start"},Object(r.createElement)("div",{className:"bwf-delay-field-select bwf-w-210 "},Object(r.createElement)(u.SelectControl,{value:"",className:"bwf_W_full",options:[{label:Object(l.__)("Select","wp-marketing-automations"),value:""}],onChange:function(){},disabled:!0})),Object(r.createElement)("div",{className:"bwf-delay-occurrence bwf-delay-field bwf-w-210 "},Object(r.createElement)(u.SelectControl,{value:"",className:"bwf_w_full",options:[{label:Object(l.__)("Select","wp-marketing-automations"),value:""}],onChange:function(){},disabled:!0}))),Object(r.createElement)("div",{className:"bwf_clear_24"}),Object(r.createElement)("div",{className:"bwf-display-flex bwf-flex-start bwf_w_full"},Object(r.createElement)("div",{className:"bwf-delay-select-field-time bwf-w-210"},Object(r.createElement)("input",{type:"time",value:"",disabled:!0,className:"bwf-w-210 bwf-h-36",onChange:function(){}})),Object(r.createElement)("div",{className:"bwf-delay-select-field-timezone bwf-w-210"},Object(r.createElement)(Zt.a,{checked:!1,disabled:!0,label:Object(l.__)("In Contact Timezone","wp-marketing-automations"),onChange:function(){}}))))),Object(r.createElement)("div",{className:"bwf_clear_24"}),Object(r.createElement)("div",{className:"bwf-delay-field bwf-delay-sidebar-custom-field"},Object(r.createElement)("div",{className:"bwf-delay-skip-step bwf-specific-date"},Object(r.createElement)("div",{className:"bwf-specific-date "},Object(r.createElement)(Zt.a,{checked:!1,label:Object(l.__)("Delay for certain days from field date","wp-marketing-automations"),onChange:function(){},disabled:!0}))),Object(r.createElement)("div",{className:"bwf-pt-0 bwf-pb-0 bwf-delay-sidebar-custom-delay-wrap"},Object(r.createElement)("div",{className:"bwf_clear_24"}),Object(r.createElement)("div",{className:"bwf-display-flex bwf-flex-start bwf_w_full"},Object(r.createElement)("div",{className:"bwf-delay-duration bwf-w-210 "},Object(r.createElement)(u.TextControl,{className:"bwf-h-36",type:"number",disabled:!0,value:"",onChange:function(){},min:1,placeholder:Object(l.__)("Enter","wp-marketing-automations")})),Object(r.createElement)("div",{className:"bwf-delay-type bwf-w-210"},Object(r.createElement)(u.SelectControl,{value:"",className:"bwf_w_full",options:[{label:Object(l.__)("Select","wp-marketing-automations"),value:""}],onChange:function(){},disabled:!0})),Object(r.createElement)("div",{className:"bwf-delay-timing bwf-w-170"},Object(r.createElement)(u.SelectControl,{value:"",disabled:!0,className:"bwf_w_full",options:[],onChange:function(){}}))))),Object(r.createElement)("div",{className:"bwf_clear_24"}),Object(r.createElement)("div",{className:"bwf-delay-skip-step bwf-specific-date"},Object(r.createElement)("div",{className:"bwf-specific-date "},Object(r.createElement)(Zt.a,{checked:!1,label:Object(l.__)("Jump to step if time has passed","wp-marketing-automations"),disabled:!0,onChange:function(){}}))),Object(r.createElement)("div",{className:"bwf_clear_24"}),Object(r.createElement)("div",{className:"bwf-single-automation-notice is-info no-icon"},Object(r.createElement)("b",null,Object(l.__)("This feature is only for licensed Pro users.","wp-marketing-automations"))," ",Object(r.createElement)("a",{target:"__blank",className:"bwf-a-no-underline",href:Object(b.fb)("upgrade",{utm_medium:"Get+PRO+Delay+Step"})},Object(l.__)("Learn More","wp-marketing-automations"))))}}),w&&Object(r.createElement)("div",{className:"bwf-single-automation-notice"},Object(l.__)("There can be contacts queued at this step, new settings will apply to all of them.","wp-marketing-automations")),Object(r.createElement)("div",{className:"bwf_clear_24"}))),Object(r.createElement)("div",{className:"wr_footer"},Object(r.createElement)(y.a,{className:"bwf-cancel-btn",onClick:function(){return S(!1)}},Object(l.__)("Cancel","wp-marketing-automations")),Object(r.createElement)(y.a,{isPrimary:!0,onClick:he,isBusy:A,className:"bwf-no-ripple"},Object(l.__)("Save","wp-marketing-automations"))))},mn=n(527),bn=n(109);function pn(e){return(pn="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)}function dn(){dn=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof h?t:h,i=Object.create(o.prototype),c=new x(r||[]);return a(i,"_invoke",{value:k(e,n,c)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var m="suspendedStart",b="executing",p="completed",d={};function h(){}function y(){}function v(){}var O={};s(O,i,(function(){return this}));var w=Object.getPrototypeOf,j=w&&w(w(L([])));j&&j!==n&&r.call(j,i)&&(O=j);var g=v.prototype=h.prototype=Object.create(O);function E(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function _(e,t){function n(a,o,i,c){var l=f(e[a],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==pn(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,i,c)}),(function(e){n("throw",e,i,c)})):t.resolve(u).then((function(e){s.value=e,i(s)}),(function(e){return n("throw",e,i,c)}))}c(l.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function k(t,n,r){var a=m;return function(o,i){if(a===b)throw Error("Generator is already running");if(a===p){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===d)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=p,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=b;var s=f(t,n,r);if("normal"===s.type){if(a=r.done?p:"suspendedYield",s.arg===d)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(a=p,r.method="throw",r.arg=s.arg)}}}function N(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),d;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,d;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,d):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,d)}function S(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(S,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(pn(t)+" is not iterable")}return y.prototype=v,a(g,"constructor",{value:v,configurable:!0}),a(v,"constructor",{value:y,configurable:!0}),y.displayName=s(v,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===y||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,v):(e.__proto__=v,s(e,l,"GeneratorFunction")),e.prototype=Object.create(g),e},t.awrap=function(e){return{__await:e}},E(_.prototype),s(_.prototype,c,(function(){return this})),t.AsyncIterator=_,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new _(u(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},E(g),s(g,l,"Generator"),s(g,i,(function(){return this})),s(g,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=L,x.prototype={constructor:x,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function a(r,a){return c.type="throw",c.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],c=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var l=r.call(i,"catchLoc"),s=r.call(i,"finallyLoc");if(l&&s){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,d):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),d},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var a=r.arg;P(n)}return a}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),d}},t}function hn(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 yn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?hn(Object(n),!0).forEach((function(t){vn(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):hn(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function vn(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=pn(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=pn(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==pn(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function On(e,t,n,r,a,o,i){try{var c=e[o](i),l=c.value}catch(e){return void n(e)}c.done?t(l):Promise.resolve(l).then(r,a)}function wn(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){On(o,r,a,i,c,"next",e)}function c(e){On(o,r,a,i,c,"throw",e)}i(void 0)}))}}function jn(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(s)throw a}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return gn(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?gn(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function gn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var En=function(){var e=Object(r.useContext)(b.h),t=jn(Object(r.useState)(""),2),n=(t[0],t[1]),a=jn(Object(r.useState)(!1),2),i=a[0],c=a[1],u=jn(Object(r.useState)(!1),2),p=u[0],h=u[1],v=jn(Object(r.useState)(!1),2),O=v[0],w=v[1],j=jn(Object(r.useState)(""),2),g=j[0],E=j[1];Object(r.useEffect)((function(){c(!1)}),[]);var _,k,N=Object(f.a)(),S=N.showSidebar,P=N.setNodeDatabyId,x=N.setAutomationData,L=Object(m.a)(),C=L.getSidebarNodeData,A=L.getAutomationId,T=L.getNodeDataByID,I=L.getAutomationLinks,D=L.getAutomationSteps,M=L.getCount,F=L.getAutomationData,G=(0,L.getautomationMeta)(),z=D(),Y=I(),U=M(),q=C(),B=A(),R=F(),H=R&&R.event?R.event:"",V=Object(ee.a)(H,parseInt(B)),$=V.isLoading,W=(V.error,V.rules),Q=!Object(o.isEmpty)(q)&&q.hasOwnProperty("data")?q.data:{},X=!Object(o.isEmpty)(Q)&&Q.hasOwnProperty("sidebarValues")?(_=Q.sidebarValues,k=[],Object(o.isEmpty)(_)?[]:(Object.keys(_).map((function(e){var t=_[e],n=[];t.map((function(e){W.hasOwnProperty(e.filter)&&n.push(e)})),Object(o.isEmpty)(n)||k.push(n)})),k)):[],Z=!Object(o.isEmpty)(q)&&q.hasOwnProperty("id")?T(q.id):{},K=Z.stepId,te=void 0===K?0:K,ne=Z.data,re=(void 0===ne?{}:ne).sidebarValues,ae=function(){var t=wn(dn().mark((function t(){var n,r,a,i=arguments;return dn().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=i.length>0&&void 0!==i[0]?i[0]:{},r=!(i.length>1&&void 0!==i[1])||i[1],a={data:{data:{sidebarData:n}},steps:Object(o.cloneDeep)(z).map((function(e){return e.hasOwnProperty("data")&&e.data.hasOwnProperty("sidebarValues")&&(e.data.sidebarValues={}),e})),links:Y,count:U},r||(a.updateStatus=2),t.prev=4,t.next=7,d()({path:Object(b.A)("/automation/".concat(B,"/step/").concat(te)),method:"POST",data:a}).then((function(t){if(200!==t.code)throw Error(Object(b.u)(null==t?void 0:t.message));r&&e(t.message),r&&(Q.sidebarValues=n,P(q.id,Q,{step_status:1})),t.hasOwnProperty("result")&&t.result.hasOwnProperty("meta")&&x("meta",yn(yn({},G),t.result.meta)),setTimeout((function(){S(!1)}),100),h(!1)})).catch((function(e){throw Error(Object(b.u)(null==e?void 0:e.message))}));case 7:t.next=13;break;case 9:t.prev=9,t.t0=t.catch(4),r&&x("modalData",{status:!0,modalTitle:Object(l.__)("Update Condition","wp-marketing-automations"),error:null===t.t0||void 0===t.t0?void 0:t.t0.message}),h(!1);case 13:Object(b.Lb)(e,3e3);case 14:case"end":return t.stop()}}),t,null,[[4,9]])})));return function(){return t.apply(this,arguments)}}(),oe=function(){var e=wn(dn().mark((function e(){var t,r,a;return dn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Object(b.ac)()){e.next=4;break}return x("proModalContent",Object(l.__)("Conditional Step","wp-marketing-automations")),x("showProModal",!0),e.abrupt("return");case 4:if(t=Object(o.cloneDeep)(Q.sidebarValues),r=[],a=!1,Object(o.isEmpty)(t)||t.map((function(e){Object(o.isEmpty)(e)||(r.push(e),e.map((function(e){var t;(t=e).hasOwnProperty("rule")&&["is_blank","is_not_blank"].includes(t.rule)||!(!t.hasOwnProperty("data")||""==t.data||null==t.data||Array.isArray(t.data)&&Object(o.isEmpty)(t.data)||W&&W.hasOwnProperty(t.filter)&&"key-value"==W[t.filter].input.component&&(""==t.data[0]||null==t.data[0]||Array.isArray(t.data[1])&&Object(o.isEmpty)(t.data[1])||""==t.data[1]||null==t.data[1]||Array.isArray(t.data[1])&&Object(o.isEmpty)(t.data[1]))||W&&W.hasOwnProperty(t.filter)&&["Date","Days","datetime"].includes(W[t.filter].input.component)&&"between"===t.rule&&(!t.data.hasOwnProperty("to")||!t.data.hasOwnProperty("from")||Object(o.isEmpty)(t.data.to)||Object(o.isEmpty)(t.data.from)))||(c(!0),a=!0,n(Object(l.__)("Some condition(s) are empty please remove them or fill them.","wp-marketing-automations")))})))})),Object(o.isEmpty)(r)||a){e.next=18;break}if(!Object(o.isEqual)(re,r)){e.next=13;break}return S(!1),h(!1),e.abrupt("return");case 13:return h(!0),e.next=16,ae(r);case 16:e.next=19;break;case 18:!a&&n(Object(l.__)("Please select conditions to save.","wp-marketing-automations"));case 19:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),ie=Object(r.useCallback)((function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=Object.keys(X).length,n=Object(o.cloneDeep)(X);n[t]=[e];var r=yn(yn({},q),{},{data:yn(yn({},Q),{},{sidebarValues:n})});x("sidebarNodeData",r),setTimeout((function(){E(""),w(!1)}),1)}),[X]),ce=(Object(r.useCallback)((function(e){var t=yn({},X);delete t[e];var n=yn(yn({},q),{},{data:yn(yn({},Q),{},{sidebarValues:t})});x("sidebarNodeData",n)}),[X]),function(){return Object(r.createElement)("ul",{className:"bwf-popover-container bwf-group"},Object(r.createElement)("li",{className:"list-label"},Object(l.__)("Select Group","wp-marketing-automations")),function(){var e=[],t=[];Object.entries(W).map((function(n){var r=jn(n,2),a=(r[0],r[1]);e.includes(a.group)||(e.push(a.group),t.push({priority:a.priority?a.priority:0,key:a.group,label:a.groupLabel}))}));return t.sort((function(e,t){return e.priority-t.priority})),t}().map((function(e,t){return Object(r.createElement)("li",{className:"list-values has-pointer",onClick:function(){return E(e.key)},key:t},e.label,Object(r.createElement)("span",{className:"bwf-svgtailf-arrow"},Object(r.createElement)(s.a,{icon:"tailless-arrow-forward",size:14,color:"#353030"})))})))}),le=function(){return Object(r.createElement)("ul",{className:"bwf-popover-container bwf-filters"},Object(r.createElement)("li",{className:"list-label list-values has-pointer is-back-button",onClick:function(){return E("")}},Object(r.createElement)("span",{className:"bwf-svgtailb-arrow"},Object(r.createElement)(s.a,{icon:"tailless-arrow-forward",size:14,color:"#353030"})),Object(l.__)("Back","wp-marketing-automations")),(e=[],Object.entries(W).map((function(t){var n=jn(t,2),r=n[0],a=n[1];(Object(o.isEmpty)(g)||g===a.group)&&e.push({key:r,label:a.labels.add})})),e).map((function(e,t){return Object(r.createElement)("li",{className:"list-values has-pointer",onClick:function(){ie({filter:e.key,rule:"",data:""})},key:t},e.label)})));var e},se=function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=e?"bwf-sidebar-empty-placeholder ":"";return Object(r.createElement)("div",{className:t},e&&Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"bwf-main-icon"},Object(r.createElement)(s.a,{icon:"conditional-placeholder",size:90})),Object(r.createElement)("div",{className:"bwf-h2"},$?Object(r.createElement)("div",{className:"bwf-placeholder-temp bwf-h-30 bwf-w-150 bwf-mb-12"}):Object(l.__)("No Condition","wp-marketing-automations")),Object(r.createElement)("div",{className:"bwf-h4 bwf-h4-grey bwf-mb-0"},$?Object(r.createElement)("div",{className:"bwf-placeholder-temp bwf-h-15 bwf-w-300"}):Object(l.__)("Add a condition to segment and make contacts flow to different branches","wp-marketing-automations"))),e&&Object(r.createElement)("div",{className:"bwf_clear_24"}),!Object(o.isEmpty)(W)&&Object(r.createElement)(r.Fragment,null,Object(r.createElement)(y.a,{isPrimary:!0,className:"bwf-no-ripple "+(e?"":"bwf-conditional-btn conditional-or"),onClick:function(){return w(!0)},style:e?{}:{margin:"-38px 0px 0px 62px",position:"absolute"}},e?Object(l.__)("Add New Condition","wp-marketing-automations"):Object(l.__)("OR","wp-marketing-automations"),O&&Object(r.createElement)(J.a,{className:"bwf-conditioal-group-popup "+(e?"":"bwf-conditional-or"),focusOnMount:!0,onFocusOutside:function(){return w(!1)},onClose:function(){return w(!1)}},Object(o.isEmpty)(g)?ce():le())),e&&Object(r.createElement)("div",{className:"bwf_clear_48"})))};return Object(r.createElement)(b.f.Provider,{value:{errorList:i,setErrorList:c,stepId:te}},Object(r.createElement)("div",{className:"wr_header"},Object(r.createElement)("div",{className:"bwf-node-icon"},Object(r.createElement)(s.a,{size:26,icon:"condition"})),Object(r.createElement)("div",{className:"wr_event_title"},Object(l.__)("Condition","wp-marketing-automations"),!Object(b.ac)()&&Object(r.createElement)(bn.a,null)),Object(r.createElement)("div",{className:"wr_event_variant"}),Object(r.createElement)("div",{className:"wr_close bwf-cursor-pointer",onClick:wn(dn().mark((function e(){return dn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!Object(o.isEmpty)(X)){e.next=3;break}return e.next=3,ae([],!1);case 3:S(!1);case 4:case"end":return e.stop()}}),e)})))},Object(r.createElement)(s.a,{icon:"close"}))),Object(r.createElement)("div",{className:"wr_content wr-conditioal-sidebar"},Object(o.isEmpty)(X)||Object(o.isEmpty)(W)?Object(r.createElement)(r.Fragment,null,se()):Object(r.createElement)(r.Fragment,null,Object.keys(X).map((function(e,t){return Object(r.createElement)("div",{className:"bwf-conditional-wrap",key:t},Object(r.createElement)(mn.a,{key:e,filters:W,groupingEnabled:!0,value:X[e],setValue:function(t){var n=Object(o.cloneDeep)(X);n[e]=t,n=n.filter((function(e){return 0!==Object.keys(e).length}));var r=yn(yn({},q),{},{data:yn(yn({},Q),{},{sidebarValues:n})});x("sidebarNodeData",r)}}),t+1!==Object.keys(X).length&&Object(r.createElement)("div",{className:"bwf-conditional-rules-label-or"},Object(r.createElement)("span",{className:"bwf-line"}),Object(r.createElement)("span",{className:"bwf-rule-text"},Object(l.__)("OR","wp-marketing-automations"))))})),se(!1)),Object(r.createElement)("div",{className:"bwf_clear_24"})),Object(r.createElement)("div",{className:"wr_footer"},Object(r.createElement)(y.a,{className:"bwf-cancel-btn",onClick:wn(dn().mark((function e(){return dn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!Object(o.isEmpty)(X)){e.next=3;break}return e.next=3,ae([],!1);case 3:S(!1);case 4:case"end":return e.stop()}}),e)})))},Object(l.__)("Cancel","wp-marketing-automations")),Object(r.createElement)(y.a,{isPrimary:!0,className:"bwf-no-ripple",onClick:oe,isBusy:p,disabled:p||Object(o.isEmpty)(W)||Object(o.isEmpty)(X)},!Object(b.ac)()&&Object(r.createElement)(s.a,{icon:"king",size:16,color:"#fff"}),Object(l.__)("Save","wp-marketing-automations"))))};function _n(e){return(_n="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)}function kn(){kn=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof h?t:h,i=Object.create(o.prototype),c=new x(r||[]);return a(i,"_invoke",{value:k(e,n,c)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var m="suspendedStart",b="executing",p="completed",d={};function h(){}function y(){}function v(){}var O={};s(O,i,(function(){return this}));var w=Object.getPrototypeOf,j=w&&w(w(L([])));j&&j!==n&&r.call(j,i)&&(O=j);var g=v.prototype=h.prototype=Object.create(O);function E(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function _(e,t){function n(a,o,i,c){var l=f(e[a],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==_n(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,i,c)}),(function(e){n("throw",e,i,c)})):t.resolve(u).then((function(e){s.value=e,i(s)}),(function(e){return n("throw",e,i,c)}))}c(l.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function k(t,n,r){var a=m;return function(o,i){if(a===b)throw Error("Generator is already running");if(a===p){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===d)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=p,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=b;var s=f(t,n,r);if("normal"===s.type){if(a=r.done?p:"suspendedYield",s.arg===d)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(a=p,r.method="throw",r.arg=s.arg)}}}function N(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),d;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,d;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,d):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,d)}function S(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(S,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(_n(t)+" is not iterable")}return y.prototype=v,a(g,"constructor",{value:v,configurable:!0}),a(v,"constructor",{value:y,configurable:!0}),y.displayName=s(v,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===y||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,v):(e.__proto__=v,s(e,l,"GeneratorFunction")),e.prototype=Object.create(g),e},t.awrap=function(e){return{__await:e}},E(_.prototype),s(_.prototype,c,(function(){return this})),t.AsyncIterator=_,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new _(u(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},E(g),s(g,l,"Generator"),s(g,i,(function(){return this})),s(g,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=L,x.prototype={constructor:x,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function a(r,a){return c.type="throw",c.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],c=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var l=r.call(i,"catchLoc"),s=r.call(i,"finallyLoc");if(l&&s){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,d):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),d},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var a=r.arg;P(n)}return a}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),d}},t}function Nn(e,t,n,r,a,o,i){try{var c=e[o](i),l=c.value}catch(e){return void n(e)}c.done?t(l):Promise.resolve(l).then(r,a)}function Sn(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 Pn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Sn(Object(n),!0).forEach((function(t){xn(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Sn(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function xn(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=_n(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=_n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==_n(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ln(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(s)throw a}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Cn(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Cn(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Cn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var An=function(){var e=Object(r.useContext)(b.h),t=Ln(Object(r.useState)(!1),2),n=t[0],a=t[1],i=Ln(Object(r.useState)(!1),2),u=i[0],p=i[1],h=Ln(Object(r.useState)(!1),2),v=h[0],O=h[1],w=Object(m.a)(),j=w.getSidebarNodeData,g=w.getNodeDataByID,E=w.getAutomationSteps,_=w.getAutomationLinks,k=w.getCount,N=w.getAutomationId,S=w.getGoals,P=w.getautomationMeta,x=Object(f.a)(),L=x.showSidebar,C=x.setNodeDatabyId,A=x.setAutomationData,T=Object(r.useRef)(null),I=Ln(Object(r.useState)([]),2),D=I[0],M=I[1],F=j(),G=S().list,z=void 0===G?{}:G,Y=P(),U=F.data,q=F&&F.data&&F.data.benchmark&&z.hasOwnProperty(F.data.benchmark)?z[F.data.benchmark]:{},B=F&&F.data&&F.data.benchmark?F.data.benchmark:"",R=!Object(o.isEmpty)(F.data)&&F.data.hasOwnProperty("sidebarValues")?F.data.sidebarValues:{},H=q.fields,V=void 0===H?[]:H,J=q.default_values,$=void 0===J?{}:J,W=N(),Q=E(),X=_(),Z=k(),K=!Object(o.isEmpty)(F)&&F.hasOwnProperty("id")?g(F.id):{},ee=K.stepId,te=void 0===ee?0:ee,ne=K.data,re=(void 0===ne?{}:ne).sidebarValues;Object(r.useEffect)((function(){M([])}),[]);var ae=Pn(Pn({},$),R),oe=function(e,t,n){var r=!1,a=t.fields,o=t.relation,i=void 0===o?"OR":o;i=i.toUpperCase();try{var c=null;if("OR"===i){if(a&&Array.isArray(a))for(var l=0;l<a.length;l++){c=e[a[l].id];var s=void 0===a[l].value||a[l].value;if(Array.isArray(s)&&s.includes(c))return!0;if(""!=s&&c==s||""==s&&""!=c&&null!=c)return!0}}else"AND"==i&&a&&Array.isArray(a)&&(r=a.every((function(t){c=e[t.id];var n=void 0===t.value||t.value;return!(!Array.isArray(n)||!n.includes(c))||(""===n||c==n)&&(""!=n||""!=c&&null!=c)})))}catch(e){console.log(e)}return r},ie=function(){var t,n=(t=kn().mark((function t(n){var r;return kn().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(Object(b.ac)()){t.next=4;break}return A("proModalContent",Object(l.__)("Goal Step","wp-marketing-automations")),A("showProModal",!0),t.abrupt("return");case 4:if(!Object(o.isEmpty)(le(n))){t.next=21;break}if(!Object(o.isEqual)(re,n)){t.next=8;break}return L(!1),t.abrupt("return");case 8:return U.sidebarValues=n,a(!0),r={data:{data:{sidebarData:n}},steps:Object(o.cloneDeep)(Q).map((function(e){return e.hasOwnProperty("data")&&e.data.hasOwnProperty("sidebarValues")&&(e.data.sidebarValues={}),e})),links:X,count:Z,optionUpdated:u,actionType:3},t.prev=11,t.next=14,d()({path:Object(b.A)("/automation/".concat(W,"/step/").concat(te)),method:"POST",data:r}).then((function(t){if(200!==t.code)throw Error(Object(b.u)(null==t?void 0:t.message));e(t.message);var n="";t.hasOwnProperty("result")&&t.result.hasOwnProperty("desc_text")&&!Object(o.isEmpty)(t.result.desc_text)&&(n=t.result.desc_text),t.hasOwnProperty("result")&&t.result.hasOwnProperty("meta")&&A("meta",Pn(Pn({},Y),t.result.meta)),C(F.id,Pn(Pn({},U),{},{desc_text:n}),{step_status:1}),setTimeout((function(){L(!1)}),100),a(!1)})).catch((function(e){throw Error(Object(b.u)(null==e?void 0:e.message))}));case 14:t.next=20;break;case 16:t.prev=16,t.t0=t.catch(11),A("modalData",{status:!0,modalTitle:Object(l.__)("Update Goal","wp-marketing-automations"),error:null===t.t0||void 0===t.t0?void 0:t.t0.message}),a(!1);case 20:Object(b.Lb)(e,3e3);case 21:case"end":return t.stop()}}),t,null,[[11,16]])})),function(){var e=this,n=arguments;return new Promise((function(r,a){var o=t.apply(e,n);function i(e){Nn(o,r,a,i,c,"next",e)}function c(e){Nn(o,r,a,i,c,"throw",e)}i(void 0)}))});return function(e){return n.apply(this,arguments)}}(),ce=[];Object(o.isEmpty)(V)||V.forEach((function(e){e.hasOwnProperty("required")&&e.required&&ce.push(e)}));var le=function(e){var t={};return ce.map((function(n){(!n.hasOwnProperty("toggler")||Object(o.isEmpty)(n.toggler)||oe(e,n.toggler))&&(Array.isArray(e[n.id])&&0===e[n.id].length||""===e[n.id]||void 0===e[n.id])&&(t[n.id]=n.hasOwnProperty("errorMsg")?n.errorMsg:Object(l.__)("This is a required field.","wp-marketing-automations")),"bwfan_email_data"===n.id&&(!e.hasOwnProperty("bwfan_email_data")||e.bwfan_email_data.hasOwnProperty("subject")&&Object(o.isEmpty)(e.bwfan_email_data.subject))&&(t[n.id]="error")})),M(t),t};return Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"wr_header"},Object(r.createElement)("div",{className:"bwf-node-icon icon-goal"},Object(r.createElement)(s.a,{size:26,icon:"goal"})),Object(r.createElement)("div",{className:"wr_event_title"},q.event_name,!Object(b.ac)()&&Object(r.createElement)(bn.a,null)),Object(r.createElement)("div",{className:"wr_event_variant"},Object(b.ac)()&&!Object(o.isEmpty)(B)&&"crm_link_trigger"===B&&Object(r.createElement)(at.a,{canCreate:!0,isLinkTriggerOpen:v,setLinkTriggerOpen:O,hideButton:!1})),Object(r.createElement)("div",{className:"wr_close bwf-cursor-pointer",onClick:function(){return L(!1)}},Object(r.createElement)(s.a,{icon:"close"}))),Object(r.createElement)(b.f.Provider,{value:{errorList:D,setErrorList:M,stepId:te}},Object(r.createElement)(nt.a,{onSubmit:function(e){ie(e)},initialValues:ae,validate:function(e){return p(function(e){var t=U.sidebarValues,n=void 0===t?{}:t;if(Object(o.isEmpty)(n))return!1;var r=ae.bwfan_goal_run,a=void 0===r?"":r,i=e.bwfan_goal_run;return a!==(void 0===i?"":i)&&"wait"===a}(e)),!1}},(function(e){var t=e.getInputProps,a=e.values,i=e.errors,f=e.handleSubmit;return Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"wr_content",ref:T},Object(r.createElement)("div",null,V.map((function(e,n){return Object(r.createElement)(r.Fragment,{key:n},(Object(o.isEmpty)(e.toggler)||oe(a,e.toggler))&&e.wrap_before&&Object(r.createElement)("div",{dangerouslySetInnerHTML:{__html:e.wrap_before}}),e.type?Object(r.createElement)(r.Fragment,null,!1!==e.show&&(Object(o.isEmpty)(e.toggler)||oe(a,e.toggler))&&Object(r.createElement)(rt.a,{input:e,formProps:t(e.id),values:a})):e.hint?Object(r.createElement)(r.Fragment,{dangerouslySetInnerHTML:{__html:e.hint},className:c()(e.class)}):null,(Object(o.isEmpty)(e.toggler)||oe(a,e.toggler))&&e.wrap_after&&Object(r.createElement)("div",{dangerouslySetInnerHTML:{__html:e.wrap_after}}))}))),u&&Object(r.createElement)("div",{className:"bwf-single-automation-notice"},Object(l.__)("There can be contacts queued at this step, new settings will apply to all of them.","wp-marketing-automations"))),Object(r.createElement)("div",{className:"wr_footer"},Object(r.createElement)(y.a,{className:"bwf-cancel-btn",onClick:function(){return L(!1)}},Object(l.__)("Cancel","wp-marketing-automations")),Object(r.createElement)(y.a,{isPrimary:!0,onClick:function(){f()},className:"bwf-no-ripple",isBusy:n,disabled:Object.keys(i).length},!Object(b.ac)()&&Object(r.createElement)(s.a,{icon:"king",size:16,color:"#fff"}),Object(l.__)("Save","wp-marketing-automations"))))}))))},Tn=n(206);function In(e){return(In="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)}function Dn(){Dn=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof h?t:h,i=Object.create(o.prototype),c=new x(r||[]);return a(i,"_invoke",{value:k(e,n,c)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var m="suspendedStart",b="executing",p="completed",d={};function h(){}function y(){}function v(){}var O={};s(O,i,(function(){return this}));var w=Object.getPrototypeOf,j=w&&w(w(L([])));j&&j!==n&&r.call(j,i)&&(O=j);var g=v.prototype=h.prototype=Object.create(O);function E(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function _(e,t){function n(a,o,i,c){var l=f(e[a],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==In(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,i,c)}),(function(e){n("throw",e,i,c)})):t.resolve(u).then((function(e){s.value=e,i(s)}),(function(e){return n("throw",e,i,c)}))}c(l.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function k(t,n,r){var a=m;return function(o,i){if(a===b)throw Error("Generator is already running");if(a===p){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===d)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=p,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=b;var s=f(t,n,r);if("normal"===s.type){if(a=r.done?p:"suspendedYield",s.arg===d)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(a=p,r.method="throw",r.arg=s.arg)}}}function N(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),d;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,d;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,d):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,d)}function S(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(S,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(In(t)+" is not iterable")}return y.prototype=v,a(g,"constructor",{value:v,configurable:!0}),a(v,"constructor",{value:y,configurable:!0}),y.displayName=s(v,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===y||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,v):(e.__proto__=v,s(e,l,"GeneratorFunction")),e.prototype=Object.create(g),e},t.awrap=function(e){return{__await:e}},E(_.prototype),s(_.prototype,c,(function(){return this})),t.AsyncIterator=_,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new _(u(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},E(g),s(g,l,"Generator"),s(g,i,(function(){return this})),s(g,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=L,x.prototype={constructor:x,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function a(r,a){return c.type="throw",c.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],c=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var l=r.call(i,"catchLoc"),s=r.call(i,"finallyLoc");if(l&&s){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,d):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),d},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var a=r.arg;P(n)}return a}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),d}},t}function Mn(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 Fn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Mn(Object(n),!0).forEach((function(t){Gn(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Mn(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Gn(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=In(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=In(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==In(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function zn(e,t,n,r,a,o,i){try{var c=e[o](i),l=c.value}catch(e){return void n(e)}c.done?t(l):Promise.resolve(l).then(r,a)}function Yn(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(s)throw a}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Un(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Un(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Un(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var qn=function(){var e=Object(r.useContext)(b.h),t=Yn(Object(r.useState)(!1),2),n=t[0],a=t[1],i=Object(m.a)(),u=i.getSelectedEventData,p=i.getAutomationId,h=i.getautomationMeta,v=Object(f.a)(),O=v.showSidebar,w=v.setAutomationData,j=p(),g=Object(r.useRef)(null),E=Yn(Object(r.useState)(!1),2),_=E[0],k=E[1],N=Yn(Object(r.useState)([]),2),S=N[0],P=N[1],x=h(),L=u(),C=!Object(o.isEmpty)(x)&&x.hasOwnProperty("event_meta")?x.event_meta:{},A=Object(o.isEmpty)(L)?{}:L,T=A.fields,I=void 0===T?[]:T,D=A.default_values,M=void 0===D?{}:D,F=A.need_unique_key,G=void 0!==F&&F;Object(r.useEffect)((function(){P([]),k(!1)}),[]);var z=function(e,t,n){var r=!1,a=t.fields,o=t.relation,i=void 0===o?"OR":o;i=i.toUpperCase();try{var c=null;if("OR"===i){if(a&&Array.isArray(a))for(var l=0;l<a.length;l++){c=e[a[l].id];var s=void 0===a[l].value||a[l].value;if(Array.isArray(s)&&s.includes(c))return!0;if(""!=s&&c==s||""==s&&""!=c&&null!=c)return!0}}else"AND"==i&&a&&Array.isArray(a)&&(r=a.every((function(t){c=e[t.id];var n=void 0===t.value||t.value;return!(!Array.isArray(n)||!n.includes(c))||(""===n||c==n)&&(""!=n||""!=c&&null!=c)})))}catch(e){console.log(e)}return r},Y=function(){var t,n=(t=Dn().mark((function t(n){return Dn().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!Object(o.isEmpty)(q(n))){t.next=15;break}if(!Object(o.isEqual)(C,n)){t.next=4;break}return O(!1),t.abrupt("return");case 4:return a(!0),t.prev=5,t.next=8,d()({path:Object(b.A)("/automation/".concat(j,"/")),method:"POST",data:{data:{meta:{event_meta:n},isWebhook:G}}}).then((function(t){if(200!==t.code)throw Error(Object(b.u)(null==t?void 0:t.message));e(t.message);var r=Fn({},n);G&&C.hasOwnProperty("webhook_data")&&(r.webhook_data=C.webhook_data),w("meta",Fn(Fn({},x),{},{event_meta:r})),setTimeout((function(){O(!1)}),100),a(!1)})).catch((function(e){throw Error(Object(b.u)(null==e?void 0:e.message))}));case 8:t.next=14;break;case 10:t.prev=10,t.t0=t.catch(5),w("modalData",{status:!0,modalTitle:Object(l.__)("Update Event","wp-marketing-automations"),error:null===t.t0||void 0===t.t0?void 0:t.t0.message}),a(!1);case 14:Object(b.Lb)(e,3e3);case 15:case"end":return t.stop()}}),t,null,[[5,10]])})),function(){var e=this,n=arguments;return new Promise((function(r,a){var o=t.apply(e,n);function i(e){zn(o,r,a,i,c,"next",e)}function c(e){zn(o,r,a,i,c,"throw",e)}i(void 0)}))});return function(e){return n.apply(this,arguments)}}(),U=[];Object(o.isEmpty)(I)||I.forEach((function(e){e.hasOwnProperty("required")&&e.required&&U.push(e)}));var q=function(e){var t={};return U.map((function(n){(!n.hasOwnProperty("toggler")||Object(o.isEmpty)(n.toggler)||z(e,n.toggler))&&(Array.isArray(e[n.id])&&0===e[n.id].length||""===e[n.id]||void 0===e[n.id])&&(t[n.id]=n.hasOwnProperty("errorMsg")?n.errorMsg:Object(l.__)("This is a required field.","wp-marketing-automations")),"bwfan_email_data"===n.id&&(!e.hasOwnProperty("bwfan_email_data")||e.bwfan_email_data.hasOwnProperty("subject")&&Object(o.isEmpty)(e.bwfan_email_data.subject))&&(t[n.id]="error"),"bwf_form_submit"===n.type&&(e.hasOwnProperty("bwfan-form-field-map")&&e["bwfan-form-field-map"].hasOwnProperty("bwfan_email_field_map")&&""!==e["bwfan-form-field-map"].bwfan_email_field_map||(t["bwfan-form-email-field-map"]="error"))})),P(t),t};return Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"wr_header"},Object(r.createElement)("div",{className:"bwf-node-icon icon-start"},Object(r.createElement)(s.a,{size:22,icon:"rocket"})),Object(r.createElement)("div",{className:"wr_event_title"},L.hasOwnProperty("event_name")?L.event_name:""),Object(r.createElement)("div",{className:"wr_event_variant"}),Object(r.createElement)("div",{className:"wr_close bwf-cursor-pointer",onClick:function(){return O(!1)}},Object(r.createElement)(s.a,{icon:"close"}))),Object(r.createElement)(b.f.Provider,{value:{errorList:S,setErrorList:P}},Object(r.createElement)(nt.a,{onSubmit:function(e){Y(e)},initialValues:Fn(Fn({},M),C),validate:function(){return!1}},(function(e){var t=e.getInputProps,a=e.values,i=e.errors,s=e.handleSubmit;return Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"wr_content",ref:g},Object(r.createElement)("div",null,I.map((function(e,n){return Object(r.createElement)(r.Fragment,{key:n},(Object(o.isEmpty)(e.toggler)||z(a,e.toggler))&&e.wrap_before&&Object(r.createElement)("div",{dangerouslySetInnerHTML:{__html:e.wrap_before}}),e.type?Object(r.createElement)(r.Fragment,null,!1!==e.show&&(Object(o.isEmpty)(e.toggler)||z(a,e.toggler))&&Object(r.createElement)(rt.a,{input:e,formProps:t(e.id),values:a})):e.hint?Object(r.createElement)(r.Fragment,{dangerouslySetInnerHTML:{__html:e.hint},className:c()(e.class)}):null,(Object(o.isEmpty)(e.toggler)||z(a,e.toggler))&&e.wrap_after&&Object(r.createElement)("div",{dangerouslySetInnerHTML:{__html:e.wrap_after}}))})))),Object(r.createElement)("div",{className:"wr_footer"},Object(r.createElement)(y.a,{className:"bwf-cancel-btn",onClick:function(){return O(!1)}},Object(l.__)("Cancel","wp-marketing-automations")),Object(r.createElement)(y.a,{isPrimary:!0,onClick:function(){s()},className:"bwf-no-ripple",isBusy:n,disabled:Object.keys(i).length},Object(l.__)("Save","wp-marketing-automations"))))}))),Object(b.ac)()&&Object(r.createElement)(Tn.a,{isOpen:_,setOpenTags:k}))};function Bn(e){return(Bn="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)}function Rn(){Rn=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof h?t:h,i=Object.create(o.prototype),c=new x(r||[]);return a(i,"_invoke",{value:k(e,n,c)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var m="suspendedStart",b="executing",p="completed",d={};function h(){}function y(){}function v(){}var O={};s(O,i,(function(){return this}));var w=Object.getPrototypeOf,j=w&&w(w(L([])));j&&j!==n&&r.call(j,i)&&(O=j);var g=v.prototype=h.prototype=Object.create(O);function E(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function _(e,t){function n(a,o,i,c){var l=f(e[a],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==Bn(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,i,c)}),(function(e){n("throw",e,i,c)})):t.resolve(u).then((function(e){s.value=e,i(s)}),(function(e){return n("throw",e,i,c)}))}c(l.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function k(t,n,r){var a=m;return function(o,i){if(a===b)throw Error("Generator is already running");if(a===p){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===d)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=p,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=b;var s=f(t,n,r);if("normal"===s.type){if(a=r.done?p:"suspendedYield",s.arg===d)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(a=p,r.method="throw",r.arg=s.arg)}}}function N(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),d;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,d;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,d):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,d)}function S(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(S,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(Bn(t)+" is not iterable")}return y.prototype=v,a(g,"constructor",{value:v,configurable:!0}),a(v,"constructor",{value:y,configurable:!0}),y.displayName=s(v,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===y||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,v):(e.__proto__=v,s(e,l,"GeneratorFunction")),e.prototype=Object.create(g),e},t.awrap=function(e){return{__await:e}},E(_.prototype),s(_.prototype,c,(function(){return this})),t.AsyncIterator=_,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new _(u(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},E(g),s(g,l,"Generator"),s(g,i,(function(){return this})),s(g,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=L,x.prototype={constructor:x,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function a(r,a){return c.type="throw",c.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],c=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var l=r.call(i,"catchLoc"),s=r.call(i,"finallyLoc");if(l&&s){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,d):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),d},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var a=r.arg;P(n)}return a}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),d}},t}function Hn(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 Vn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Hn(Object(n),!0).forEach((function(t){Jn(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Hn(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Jn(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=Bn(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=Bn(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==Bn(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function $n(e,t,n,r,a,o,i){try{var c=e[o](i),l=c.value}catch(e){return void n(e)}c.done?t(l):Promise.resolve(l).then(r,a)}function Wn(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(s)throw a}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Qn(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Qn(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Qn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var Xn=function(){var e=Wn(Object(r.useState)(!1),2),t=e[0],n=e[1],a=Wn(Object(r.useState)(!1),2),i=a[0],c=a[1],p=Wn(Object(r.useState)({step:"",name:""}),2),h=p[0],v=p[1],O=Object(r.useContext)(b.h),w=Object(f.a)(),j=w.showSidebar,g=w.setNodeDatabyId,E=w.fetchSplitPathNodes,_=w.setAutomationData,k=Object(m.a)(),N=k.getSidebarNodeData,S=k.getNodeDataByID,P=k.getAutomationId,x=k.getAutomationLinks,L=k.getAutomationSteps,C=k.getCount,A=k.getActionsList,T=k.getGoals,I=k.getautomationMeta,D=N(),M=P(),F=L(),G=x(),z=C(),Y=A(),U=T(),q=I(),B=E(),R=!Object(o.isEmpty)(D)&&D.hasOwnProperty("id")?S(D.id):{},H=(R.id,R.stepId),V=void 0===H?0:H,J=R.data,$=(void 0===J?{}:J).sidebarValues;Object(r.useEffect)((function(){n({}),n(!1)}),[]);var W=!Object(o.isEmpty)(D)&&D.hasOwnProperty("data")?D.data:{},Q=!Object(o.isEmpty)(W)&&W.hasOwnProperty("sidebarValues")?W.sidebarValues:{};Object(r.useEffect)((function(){Q.hasOwnProperty("jump_to")&&!Object(o.isEmpty)(Q.jump_to)&&v(Q.jump_to)}),[Q]);var X={action:Object(l.__)("Action","wp-marketing-automations"),wait:Object(l.__)("Delay","wp-marketing-automations"),conditional:Object(l.__)("Conditional","wp-marketing-automations"),exit:Object(l.__)("Exit","wp-marketing-automations"),benchmark:Object(l.__)("Goal","wp-marketing-automations")},Z=Object(r.useMemo)((function(){var e={stepsOptArr:[],stepsOptions:[{value:"",label:Object(l.__)("Select Step","wp-marketing-automations")}]};return Object(o.isEmpty)(F)||(F.map((function(t){var n=t.stepId,r=void 0===n?0:n,a=t.id,o=void 0===a?0:a;if(!["yesNoNode","start","end","exit","jump","split","splitpath"].includes(t.type)&&!e.stepsOptArr.hasOwnProperty(o)&&!B.includes(o)){var i=[Object(l.__)("Step","wp-marketing-automations")];i.push(o),X.hasOwnProperty(t.type)&&i.push(" : "+X[t.type]),"action"==t.type&&t.hasOwnProperty("data")&&Y.list.hasOwnProperty(t.data.selected)&&Y.list[t.data.selected].hasOwnProperty("action_name")&&(Y.list[t.data.selected].hasOwnProperty("integration_nicename")?i.push(" - "+Y.list[t.data.selected].integration_nicename+" : "):i.push(" - "),i.push(Y.list[t.data.selected].action_name)),"benchmark"==t.type&&t.hasOwnProperty("data")&&U.list.hasOwnProperty(t.data.benchmark)&&U.list[t.data.benchmark].hasOwnProperty("event_name")&&(U.list[t.data.benchmark].hasOwnProperty("source_label")&&i.push(U.list[t.data.benchmark].source_label+" : "),i.push(U.list[t.data.benchmark].event_name)),e.stepsOptArr[r]=i.join(" "),e.stepsOptions.push({value:r,label:i.join(" ")})}})),e.stepsOptArr.end=Object(l.__)("End Automation","wp-marketing-automations"),e.stepsOptions.push({value:"end",label:Object(l.__)("End Automation","wp-marketing-automations")})),e}),[F]),K=Z.stepsOptArr,ee=Z.stepsOptions,te=function(){var e,t=(e=Rn().mark((function e(){var t,r;return Rn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Object(b.ac)()){e.next=4;break}return _("proModalContent",Object(l.__)("Jump Step","wp-marketing-automations")),_("showProModal",!0),e.abrupt("return");case 4:if(h.hasOwnProperty("step")&&""!=h.step&&h.hasOwnProperty("name")&&""!=h.name){e.next=7;break}return n(!0),e.abrupt("return");case 7:if(n(!1),t=Vn(Vn({},Q),{},{jump_to:h}),!Object(o.isEqual)($,t)){e.next=12;break}return j(!1),e.abrupt("return");case 12:return e.prev=12,c(!0),r={data:{data:{sidebarData:t}},steps:Object(o.cloneDeep)(F).map((function(e){return e.hasOwnProperty("data")&&e.data.hasOwnProperty("sidebarValues")&&(e.data.sidebarValues={}),e})),links:G,count:z},e.next=17,d()({path:Object(b.A)("/automation/".concat(M,"/step/").concat(V)),method:"POST",data:r}).then((function(e){if(200!==e.code)throw Error(Object(b.u)(null==e?void 0:e.message));O(e.message),g(D.id,Vn(Vn({},W),{},{sidebarValues:t}),{step_status:1}),e.hasOwnProperty("result")&&e.result.hasOwnProperty("meta")&&_("meta",Vn(Vn({},q),e.result.meta)),setTimeout((function(){j(!1)}),100),c(!1)})).catch((function(e){throw Error(Object(b.u)(null==e?void 0:e.message))}));case 17:e.next=23;break;case 19:e.prev=19,e.t0=e.catch(12),_("modalData",{status:!0,modalTitle:Object(l.__)("Update Jump","wp-marketing-automations"),error:null===e.t0||void 0===e.t0?void 0:e.t0.message}),c(!1);case 23:Object(b.Lb)(O,3e3);case 24:case"end":return e.stop()}}),e,null,[[12,19]])})),function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){$n(o,r,a,i,c,"next",e)}function c(e){$n(o,r,a,i,c,"throw",e)}i(void 0)}))});return function(){return t.apply(this,arguments)}}();return Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"wr_header"},Object(r.createElement)("div",{className:"bwf-node-icon icon-jump"},Object(r.createElement)(s.a,{size:28,icon:"jump"})),Object(r.createElement)("div",{className:"wr_event_title"},Object(r.createElement)("span",null,Object(l.__)("Jump","wp-marketing-automations")),!Object(b.ac)()&&Object(r.createElement)(bn.a,null)),Object(r.createElement)("div",{className:"wr_event_variant"}),Object(r.createElement)("div",{className:"wr_close bwf-cursor-pointer",onClick:function(){j(!1)}},Object(r.createElement)(s.a,{icon:"close"}))),Object(r.createElement)("div",{className:"wr_content"},Object(r.createElement)("div",{className:"bwf-jump-wrap"},Object(r.createElement)("div",{className:"bwf-jump-skip-step-select "+(t?"has-error":"")},Object(r.createElement)("div",{className:"bwf-w-120 bwf_bold bwf-mb-8"},Object(l.__)("Jump To","wp-marketing-automations")),Object(r.createElement)(u.SelectControl,{value:h.step,className:"bwf_w_full",options:ee,onChange:function(e){v({step:e,name:e?K[e]:""})}}),t&&Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"has-bwfan-error"},Object(l.__)("This is a required field.","wp-marketing-automations"))))),Object(r.createElement)("div",{className:"bwf_clear_24"})),Object(r.createElement)("div",{className:"wr_footer"},Object(r.createElement)(y.a,{className:"bwf-cancel-btn",onClick:function(){return j(!1)}},Object(l.__)("Cancel","wp-marketing-automations")),Object(r.createElement)(y.a,{isPrimary:!0,onClick:te,isBusy:i,className:"bwf-no-ripple"},!Object(b.ac)()&&Object(r.createElement)(s.a,{icon:"king",size:16,color:"#fff"}),Object(l.__)("Save","wp-marketing-automations"))))},Zn=n(68);function Kn(e){return(Kn="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)}function er(){er=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof h?t:h,i=Object.create(o.prototype),c=new x(r||[]);return a(i,"_invoke",{value:k(e,n,c)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var m="suspendedStart",b="executing",p="completed",d={};function h(){}function y(){}function v(){}var O={};s(O,i,(function(){return this}));var w=Object.getPrototypeOf,j=w&&w(w(L([])));j&&j!==n&&r.call(j,i)&&(O=j);var g=v.prototype=h.prototype=Object.create(O);function E(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function _(e,t){function n(a,o,i,c){var l=f(e[a],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==Kn(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,i,c)}),(function(e){n("throw",e,i,c)})):t.resolve(u).then((function(e){s.value=e,i(s)}),(function(e){return n("throw",e,i,c)}))}c(l.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function k(t,n,r){var a=m;return function(o,i){if(a===b)throw Error("Generator is already running");if(a===p){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===d)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=p,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=b;var s=f(t,n,r);if("normal"===s.type){if(a=r.done?p:"suspendedYield",s.arg===d)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(a=p,r.method="throw",r.arg=s.arg)}}}function N(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),d;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,d;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,d):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,d)}function S(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(S,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(Kn(t)+" is not iterable")}return y.prototype=v,a(g,"constructor",{value:v,configurable:!0}),a(v,"constructor",{value:y,configurable:!0}),y.displayName=s(v,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===y||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,v):(e.__proto__=v,s(e,l,"GeneratorFunction")),e.prototype=Object.create(g),e},t.awrap=function(e){return{__await:e}},E(_.prototype),s(_.prototype,c,(function(){return this})),t.AsyncIterator=_,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new _(u(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},E(g),s(g,l,"Generator"),s(g,i,(function(){return this})),s(g,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=L,x.prototype={constructor:x,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function a(r,a){return c.type="throw",c.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],c=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var l=r.call(i,"catchLoc"),s=r.call(i,"finallyLoc");if(l&&s){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,d):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),d},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var a=r.arg;P(n)}return a}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),d}},t}function tr(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 nr(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?tr(Object(n),!0).forEach((function(t){rr(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):tr(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function rr(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=Kn(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=Kn(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==Kn(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ar(e,t,n,r,a,o,i){try{var c=e[o](i),l=c.value}catch(e){return void n(e)}c.done?t(l):Promise.resolve(l).then(r,a)}function or(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(s)throw a}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ir(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ir(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ir(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var cr=function(){var e=or(Object(r.useState)(!1),2),t=e[0],n=e[1],a=or(Object(r.useState)(!1),2),i=a[0],c=a[1],p=or(Object(r.useState)(""),2),h=p[0],v=p[1],O=or(Object(r.useState)(""),2),w=O[0],j=O[1],g=or(Object(r.useState)(""),2),E=g[0],_=g[1],k=Object(r.useContext)(b.h),N=Object(f.a)(),S=N.showSidebar,P=N.setNodeDatabyId,x=N.setAutomationData,L=N.setSplitNodePath,C=N.fetchAutomationStat,A=Object(r.useRef)(new AbortController),T=Object(m.a)(),I=T.getSidebarNodeData,D=T.getNodeDataByID,M=T.getAutomationId,F=(0,T.getautomationMeta)(),G=I(),z=M(),Y=!Object(o.isEmpty)(G)&&G.hasOwnProperty("id")?D(G.id):{},U=Y.id,q=void 0===U?0:U,B=Y.stepId,R=void 0===B?0:B,H=[{key:"",label:Object(l.__)("Select","wp-marketing-automations")},{key:"2",label:"2"},{key:"3",label:"3"}];Object(r.useEffect)((function(){return n({}),n(!1),function(){A.current.abort()}}),[]);var V=!Object(o.isEmpty)(G)&&G.hasOwnProperty("data")?G.data:{},J=!Object(o.isEmpty)(V)&&V.hasOwnProperty("sidebarValues")?V.sidebarValues:{};Object(r.useEffect)((function(){J.hasOwnProperty("split_path")&&!Object(o.isEmpty)(J.split_path)&&v(J.split_path),J.hasOwnProperty("title")&&!Object(o.isEmpty)(J.title)&&j(J.title),J.hasOwnProperty("desc")&&!Object(o.isEmpty)(J.desc)&&_(J.desc)}),[J]);var $=function(){var e,t=(e=er().mark((function e(){var t,r,a,o,i,s,u;return er().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Object(b.ac)()){e.next=4;break}return x("proModalContent",Object(l.__)("Split Path Step","wp-marketing-automations")),x("showProModal",!0),e.abrupt("return");case 4:if(""!=h&&""!=w){e.next=7;break}return n(!0),e.abrupt("return");case 7:return c(!0),n(!1),t=nr(nr({},J),{},{split_path:h,title:w,desc:E}),r={data:{data:{sidebarData:t}}},a=[],J.hasOwnProperty("split_path")&&""!=J.split_path||(o=L(q,h),i=o.newStep,s=o.newLink,u=o.newCount,r=nr(nr({},r),{},{steps:i,links:s,count:u}),a=i,x("statLoading",!0)),e.prev=13,e.next=16,d()({path:Object(b.A)("/automation/".concat(z,"/step/").concat(R)),method:"POST",data:r}).then((function(e){if(200!==e.code)throw Error(Object(b.u)(null==e?void 0:e.message));k(e.message),J.hasOwnProperty("split_path")&&""!=J.split_path?P(G.id,nr(nr({},V),{},{sidebarValues:t}),{step_status:1}):P(G.id,nr(nr({},V),{},{sidebarValues:t}),{step_status:1},a),C(),e.hasOwnProperty("result")&&e.result.hasOwnProperty("meta")&&x("meta",nr(nr({},F),e.result.meta)),setTimeout((function(){S(!1)}),100),c(!1)})).catch((function(e){throw Error(Object(b.u)(null==e?void 0:e.message))}));case 16:e.next=22;break;case 18:e.prev=18,e.t0=e.catch(13),x("modalData",{status:!0,modalTitle:Object(l.__)("Update Split","wp-marketing-automations"),error:null===e.t0||void 0===e.t0?void 0:e.t0.message}),c(!1);case 22:Object(b.Lb)(k,3e3);case 23:case"end":return e.stop()}}),e,null,[[13,18]])})),function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){ar(o,r,a,i,c,"next",e)}function c(e){ar(o,r,a,i,c,"throw",e)}i(void 0)}))});return function(){return t.apply(this,arguments)}}();return Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"wr_header"},Object(r.createElement)("div",{className:"bwf-node-icon icon-split-test"},Object(r.createElement)(s.a,{size:28,icon:"split-test"})),Object(r.createElement)("div",{className:"wr_event_title"},Object(r.createElement)("span",null,Object(l.__)("Split Path","wp-marketing-automations")),!Object(b.ac)()&&Object(r.createElement)(bn.a,null)),Object(r.createElement)("div",{className:"wr_event_variant"}),Object(r.createElement)("div",{className:"wr_close bwf-cursor-pointer",onClick:function(){S(!1)}},Object(r.createElement)(s.a,{icon:"close"}))),Object(r.createElement)("div",{className:"wr_content "+(J.hasOwnProperty("split_path")&&""!=J.split_path?"":"split-full")},Object(r.createElement)("div",{className:"bwf-split-wrap"},Object(r.createElement)("div",{className:"bwf-split-title-text "+(t&&""===w?"has-error":"")},Object(r.createElement)("div",{className:"bwf-w-120 bwf_bold bwf-mb-8"},Object(l.__)("Name","wp-marketing-automations")),Object(r.createElement)(u.TextControl,{className:"bwf-h-36",value:w,onChange:function(e){return j(e)},placeholder:Object(l.__)("Enter Name","wp-marketing-automations")}),t&&""===w&&Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"has-bwfan-error"},Object(l.__)("This is a required field.","wp-marketing-automations")))),(!J.hasOwnProperty("split_path")||""==J.split_path)&&Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"bwf_clear_24"}),Object(r.createElement)("div",{className:"bwf-split-path-select "+(t&&""===h?"has-error":"")},Object(r.createElement)("div",{className:"bwf-w-120 bwf_bold bwf-mb-8"},Object(l.__)("No of Paths","wp-marketing-automations")),Object(r.createElement)(Zn.b,{selected:h,className:"bwf_w_full",options:H,onChange:function(e){v(e)}}),t&&""===h&&Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"has-bwfan-error"},Object(l.__)("This is a required field.","wp-marketing-automations"))))),Object(r.createElement)("div",{className:"bwf_clear_24"}),Object(r.createElement)("div",{className:"bwf-split-title-desc "},Object(r.createElement)("div",{className:"bwf-w-120 bwf_bold bwf-mb-8"},Object(l.__)("Description","wp-marketing-automations")),Object(r.createElement)(u.TextareaControl,{placeholder:Object(l.__)("Type here …","wp-marketing-automations"),value:E,onChange:function(e){return _(e)},rows:4})),Object(r.createElement)("div",{className:"bwf_clear_24"}))),Object(r.createElement)("div",{className:"wr_footer"},Object(r.createElement)(y.a,{className:"bwf-cancel-btn",onClick:function(){return S(!1)},disabled:i},Object(l.__)("Cancel","wp-marketing-automations")),Object(r.createElement)(y.a,{isPrimary:!0,className:"bwf-no-ripple",onClick:$,isBusy:i,disabled:i},!Object(b.ac)()&&Object(r.createElement)(s.a,{icon:"king",size:16,color:"#fff"}),J.hasOwnProperty("split_path")&&""!=J.split_path?Object(l.__)("Save","wp-marketing-automations"):Object(l.__)("Add","wp-marketing-automations"))))},lr=function(){var e=Object(m.a)(),t=Object(f.a)(),n=t.setAutomationData,a=t.showSidebar,i=e.openSidebar,c=e.getSidebarNodeData,s=e.getNodeDataByStepID,u=e.getNodeDataByID,b=i(),p=c(),d=p.type,h=void 0===d?"":d,y=p.data,v=void 0===y?{}:y,O=Object(B.i)().stepid,w=void 0===O?"":O,j=v.selected,g=void 0===j?"":j;Object(r.useEffect)((function(){if(""!==w){var e="start"===w?u("start"):s(w);Object(o.isEmpty)(e)?Object(B.k)(["stepid","editor"]):(n("sidebarNodeData",e),a(!0))}}),[]),Object(r.useEffect)((function(){if(b&&""===w&&!Object(o.isEmpty)(p)){var e=p.id,t=void 0===e?"":e;if(""!==t){var n=u(t),r=n.hasOwnProperty("stepId")?n.stepId:"";""!==(r=""===r&&"start"===t?"start":r)&&Object(B.l)({stepid:r},"/")}}}),[b]);return b?Object(r.createElement)("div",{className:"bwf-wl-wrap"},Object(r.createElement)("div",{className:"wl-sidebar-overlay step-"+h+"-wrap ",onClick:function(e){return e.preventDefault()}}),Object(r.createElement)("div",{className:"wr wr-expanded step-"+h+"-wrap-content "+("wp_sendemail"==g?"bwf-mail-action":"")},function(){switch(h){case"start":return Object(r.createElement)(qn,null);case"action":return Object(r.createElement)(Lt,null);case"conditional":return Object(r.createElement)(En,null);case"wait":return Object(r.createElement)(fn,null);case"benchmark":return Object(r.createElement)(An,null);case"jump":return Object(r.createElement)(Xn,null);case"split":return Object(r.createElement)(cr,null);default:return Object(r.createElement)(r.Fragment,null,Object(l.__)("Node Type not registered","wp-marketing-automations"))}}())):Object(r.createElement)(r.Fragment,null)},sr=n(76),ur=n(108),fr=n(1069),mr=n(1136);n(1127),n(1411);function br(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(s)throw a}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return pr(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?pr(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function pr(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var dr=function(e){var t=e.id,n=e.sourceX,o=e.sourceY,i=e.targetX,c=e.targetY,s=e.sourcePosition,u=e.targetPosition,b=e.style,p=void 0===b?{}:b,d=(e.data,e.arrowHeadType),h=e.markerEndId,y=e.source,v=e.sourceHandleId,O=Object(a.g)({sourceX:n,sourceY:o,sourcePosition:s,targetX:i,targetY:c,targetPosition:u}),w=Object(a.i)(d,h),j=br(Object(a.h)({sourceX:n,sourceY:o,targetX:i,targetY:c}),2),g=j[0],E=j[1],_=Object(f.a)(),k=_.setNodeForAdd,N=_.copyNodeHere,S=_.setOpenStepModal,P=_.setModalAnchorNode,x=Object(m.a)(),L=x.getEnableCopy,C=x.getEnableMove,A=x.getNodeDataByID,T=L(),I=C(),D=A(y);return Object(r.createElement)(r.Fragment,null,Object(r.createElement)("path",{id:t,style:p,className:"react-flow__edge-path",d:O,markerEnd:w}),Object(r.createElement)("foreignObject",{width:23,height:23,x:g-11.5,y:E-11.5,className:"edgebutton-foreignobject",requiredExtensions:"http://www.w3.org/1999/xhtml"},Object(r.createElement)("div",{className:"bwf-edge-body"},T||I?Object(r.createElement)("div",{className:"bwf-drag-area",onClick:function(){return N(D,"after",v||"")}},Object(r.createElement)("div",{className:"bwf-drag-node is-edge"},Object(r.createElement)("div",{className:"bwf-node-add"})),Object(r.createElement)("div",{className:"bwf-paste-label"},Object(l.__)("Paste Here","wp-marketing-automations"))):Object(r.createElement)("div",{className:"bwf-node-add",onClick:function(e){k(y,{option:v}),S(!0),P(e.target)}}))))},hr=n(146),yr=n(17),vr=(n(1412),n(33));function Or(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(s)throw a}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return wr(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?wr(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function wr(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var jr=function(){var e=Object(m.a)(),t=e.getShowContactModalId,n=e.getAutomationData,a=e.getShowContactModalType,i=e.getContactModalExtraData,p=t(),h=a(),y=n().ID,O=i(),w=Object(o.isEmpty)(O)||Object(o.isNull)(O)?{}:O,j=w.split,g=void 0!==j&&j,E=w.path,_=void 0===E?"":E,k=w.pathCount,N=void 0===k?2:k,S=Object(f.a)().setAutomationData,P=Or(Object(r.useState)(!0),2),x=P[0],L=P[1],C=Or(Object(r.useState)({}),2),A=C[0],T=C[1],I=Or(Object(r.useState)(10),2),D=I[0],M=I[1],F=Or(Object(r.useState)(0),2),G=F[0],z=F[1],Y=Or(Object(r.useState)(!1),2),U=Y[0],q=Y[1],B=Or(Object(r.useState)(_),2),R=B[0],H=B[1],V=Object(r.useRef)(new AbortController);Object(r.useEffect)((function(){return function(){S("contactModalData",{}),V.current.abort()}}),[]),Object(r.useEffect)((function(){L(!0),T({}),function(){try{var e={limit:D,offset:G,type:h};""!==R&&(e.path=R);var t=Object(yr.stringify)(e),n="string"!=typeof p?parseInt(p):0;d()({path:Object(b.A)("/automation/".concat(y,"/step/").concat(n,"/contacts?").concat(t)),method:"GET",signal:V.current.signal}).then((function(e){200===e.code&&(Object(o.isEmpty)(e.result)||T(e.result)),L(!1)}))}catch(e){L(!1)}}()}),[p,G,D,R]);var J=c()("bwfcrm-contacts-list",{"has-search":!1}),$=[{key:"name",label:Object(l.__)("Name","wp-marketing-automations"),isLeftAligned:!0,required:!0,cellClassName:"bwf-w-210 bwf-word-break"},{key:"email",label:Object(l.__)("Email","wp-marketing-automations"),isLeftAligned:!0,cellClassName:"bwf-word-break bwf-w-150"},{key:"date",label:function(){if(g)return Object(l.__)("Date","wp-marketing-automations");switch(h){case"completed":return Object(l.__)("Completed On","wp-marketing-automations");case"queued":return Object(l.__)("Queued On","wp-marketing-automations");case"failed":return Object(l.__)("Failed On","wp-marketing-automations");case"active":return Object(l.__)("Started On","wp-marketing-automations");case"skipped":return Object(l.__)("Skipped On","wp-marketing-automations");default:return Object(l.__)("Date","wp-marketing-automations")}}(),isLeftAligned:!0,cellClassName:"bwf-w-150 bwf-word-break"}];!g||""!=_&&"all"!=_||$.push({key:"path",label:Object(l.__)("Path","wp-marketing-automations"),isLeftAligned:!1,cellClassName:"bwf-w-90"}),$.push({key:"traillink",label:"",isLeftAligned:!0,cellClassName:"bwf-w-100"});var W,Q,X,Z,K,ee,te=function(e){return Object(r.createElement)(vr.a,{href:"admin.php?page=autonami&path=/contact/"+e.id,type:"bwf-crm",className:"bwf-cursor-pointer bwf-a-no-underline",style:{color:"#0073aa"},key:e.id},e.hasOwnProperty("name")&&""!==e.name?e.name:"-")},ne=function(e){var t=[];return Object(o.isEmpty)(e)||e.map((function(e){var n=[{display:te(e),value:""},{display:e.email,value:""},{display:e.hasOwnProperty("time")&&""!==e.time?Object(b.hb)(Ne.a.unix(e.time).format("MM/DD/YYYY HH:mm:ss")):"-",value:""}];!g||""!=_&&"all"!=_||n.push({display:e.hasOwnProperty("path")&&le.hasOwnProperty(e.path)?Object(r.createElement)("div",{className:"bwf-splitpath bwfpathid-".concat(e.path)},Object(l.sprintf)(Object(l.__)("Path %s","wp-marketing-automations"),le[e.path])):"-",value:""}),n.push({display:e.hasOwnProperty("trail")&&""!==e.trail?Object(r.createElement)("div",{onClick:function(){Object(b.ac)()?(S("customerSelected",e),S("showContactModalId",0),S("showContactModalType","")):q(!0)},className:"bwf-cursor-pointer bwf-display-flex bwf-flex-start gap-8",style:{color:"#0073aa"}},!Object(b.ac)()&&Object(r.createElement)(s.a,{icon:"king",size:16}),Object(l.__)("View Journey","wp-marketing-automations")):"-",value:""}),t.push(n)})),t},re=function(e){z((e-1)*D)},ae=function(e){return"per_page"!==e?function(){}:oe},oe=function(e){e!==D&&M(e)},ie=Object(r.createElement)("div",{className:"bwf-contact-zero-state"},Object(r.createElement)(s.a,{icon:"contact-zero"}),Object(r.createElement)("div",{className:"bwf-heading"},Object(l.__)("No Contacts","wp-marketing-automations")),Object(r.createElement)("div",{className:"bwf-desc"},Object(l.__)("Once your customer start purchase or interact with the product. The contacts will appear here","wp-marketing-automations"))),ce=function(){var e=A.total,t=void 0===e?0:e,n=A.path_total,r=void 0===n?0:n;return""==R?parseInt(t):parseInt(r)},le=Object(b.Pc)();return Object(r.createElement)(u.Modal,{className:"bwf-admin-modal bwf-admin-modal-large bwf-single-automation-contact-modal bwf-h--core-header",shouldCloseOnClickOutside:!1,shouldCloseOnEsc:!1},Object(r.createElement)("div",{className:"bwf-modal-header"},Object(r.createElement)("div",{className:"bwf-modal-heading"},function(){var e="",t=ce();if(g)e=""==_||"all"==_?Object(l.__)("Split Path Contacts","wp-marketing-automations"):Object(l.sprintf)(Object(l.__)("Path %s Contacts","wp-marketing-automations"),le[_]);else switch(h){case"completed":e=Object(l.__)("Completed Contacts","wp-marketing-automations");break;case"queued":e=Object(l.__)("Queued Contacts","wp-marketing-automations");break;case"failed":e=Object(l.__)("Failed Contacts","wp-marketing-automations");break;case"skipped":e=Object(l.__)("Skipped Contacts","wp-marketing-automations");break;case"active":e=Object(l.__)("Active Contacts","wp-marketing-automations");break;default:e=Object(l.__)("Contacts","wp-marketing-automations")}return e+" "+(t>0?"("+t+")":"")}()),Object(r.createElement)("span",{onClick:function(){S("showContactModalId",0),S("showContactModalType","")},className:"bwf-modal-close"},Object(r.createElement)(s.a,{icon:"close",color:"#353030"}))),(Q=A.data,X=void 0===Q?[]:Q,Z=A.total,K=void 0===Z?0:Z,A.path_total,ee=parseInt(G)/parseInt(D)+1,x||0!==parseInt(K)?Object(r.createElement)(r.Fragment,null,g&&(""===_||"all"===_)&&Object(r.createElement)("div",{className:"bwf-path-selector"},Object(r.createElement)(u.SelectControl,{value:R,className:"bwf_w_full",options:(W=[{label:Object(l.__)("Path: All","wp-marketing-automations"),value:""},{label:Object(l.__)("Path A","wp-marketing-automations"),value:"1"},{label:Object(l.__)("Path B","wp-marketing-automations"),value:"2"}],3===parseInt(N)&&W.push({label:Object(l.__)("Path C","wp-marketing-automations"),value:"3"}),W),onChange:function(e){H(e)}})),Object(r.createElement)(hr.a,{className:J,title:"",rows:x?[]:ne(X),headers:$,query:{paged:ee},rowsPerPage:D,totalRows:ce(),isLoading:x,onPageChange:re,onQueryChange:ae,showMenu:!1,emptyMessage:Object(l.__)("No contacts found","wp-marketing-automations")}),!Object(b.ac)()&&Object(r.createElement)(v.b,{isOpen:U,onRequestClose:function(){return q(!1)},modalContent:{isFeature:!0,featureTitle:Object(l.__)("Contact Journey","wp-marketing-automations"),proLink:Object(b.fb)("upgrade",{utm_medium:"Automation+Step+Contact+Journey+Upgrade+Modal"})}})):Object(r.createElement)(r.Fragment,null,ie)))},gr=n(48);function Er(e){return(Er="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)}function _r(){_r=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof h?t:h,i=Object.create(o.prototype),c=new x(r||[]);return a(i,"_invoke",{value:k(e,n,c)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var m="suspendedStart",b="executing",p="completed",d={};function h(){}function y(){}function v(){}var O={};s(O,i,(function(){return this}));var w=Object.getPrototypeOf,j=w&&w(w(L([])));j&&j!==n&&r.call(j,i)&&(O=j);var g=v.prototype=h.prototype=Object.create(O);function E(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function _(e,t){function n(a,o,i,c){var l=f(e[a],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==Er(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,i,c)}),(function(e){n("throw",e,i,c)})):t.resolve(u).then((function(e){s.value=e,i(s)}),(function(e){return n("throw",e,i,c)}))}c(l.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function k(t,n,r){var a=m;return function(o,i){if(a===b)throw Error("Generator is already running");if(a===p){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===d)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=p,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=b;var s=f(t,n,r);if("normal"===s.type){if(a=r.done?p:"suspendedYield",s.arg===d)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(a=p,r.method="throw",r.arg=s.arg)}}}function N(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),d;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,d;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,d):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,d)}function S(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(S,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(Er(t)+" is not iterable")}return y.prototype=v,a(g,"constructor",{value:v,configurable:!0}),a(v,"constructor",{value:y,configurable:!0}),y.displayName=s(v,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===y||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,v):(e.__proto__=v,s(e,l,"GeneratorFunction")),e.prototype=Object.create(g),e},t.awrap=function(e){return{__await:e}},E(_.prototype),s(_.prototype,c,(function(){return this})),t.AsyncIterator=_,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new _(u(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},E(g),s(g,l,"Generator"),s(g,i,(function(){return this})),s(g,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=L,x.prototype={constructor:x,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function a(r,a){return c.type="throw",c.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],c=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var l=r.call(i,"catchLoc"),s=r.call(i,"finallyLoc");if(l&&s){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,d):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),d},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var a=r.arg;P(n)}return a}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),d}},t}function kr(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 Nr(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?kr(Object(n),!0).forEach((function(t){Sr(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):kr(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Sr(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=Er(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=Er(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==Er(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Pr(e,t,n,r,a,o,i){try{var c=e[o](i),l=c.value}catch(e){return void n(e)}c.done?t(l):Promise.resolve(l).then(r,a)}function xr(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(s)throw a}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Lr(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Lr(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Lr(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var Cr=function(e){var t=e.isProActive,n=void 0!==t&&t,a=Object(r.useContext)(b.h),i=xr(Object(r.useState)(!1),2),c=i[0],p=i[1],d=xr(Object(r.useState)(!1),2),h=d[0],y=d[1],v=xr(Object(r.useState)(!1),2),O=v[0],w=v[1],j=Object(f.a)(),g=j.addNewStep,E=j.unsetCurrentNode,_=j.setOpenStepModal,k=j.setAutomationData,N=j.fetchSplitPathNodes,S=j.showSidebar,P=j.isInsideConditional,x=Object(m.a)(),L=x.getCurrentNode,C=x.getCurrentNodeAction,A=x.getOpenStepModal,T=x.getModalAnchorNode,I=A(),D=L(),M=C(),F=T();Object(r.useEffect)((function(){if(!Object(o.isEmpty)(D)&&D.hasOwnProperty("id")){var e=P(D.id);w(e),N().includes(D.id)?y(!0):y(!1)}}),[D]);var G=function(){var e,t=(e=_r().mark((function e(){var t,n,r,o,i=arguments;return _r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=i.length>0&&void 0!==i[0]?i[0]:"action",p(!0),n=M.data&&M.data.option?M.data.option:"",r=M.data&&M.data.position?M.data.position:"after",o=Nr(Nr({},D),{},{xPos:D.position.x,yPos:D.position.y}),e.next=7,g(t,o,n,r,{}).then((function(e){Object(b.Lb)(a,3e3),E(),p(!1),_(!1),"split"==t&&(k("sidebarNodeData",e),S(!0))}));case 7:case"end":return e.stop()}}),e)})),function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){Pr(o,r,a,i,c,"next",e)}function c(e){Pr(o,r,a,i,c,"throw",e)}i(void 0)}))});return function(){return t.apply(this,arguments)}}();return I&&Object(r.createElement)(J.a,{onFocusOutside:function(){E(),_(!1)},position:"center",className:"bwf-type-select-modal",onClick:function(e){return e.stopPropagation()},anchorRef:F},!c&&Object(r.createElement)("div",{className:"bwf-title-wrap"},Object(r.createElement)("div",{className:"bwf-title bwf_w_full"},Object(l.__)("Add Step","wp-marketing-automations")),Object(r.createElement)("div",{className:"bwf-cross bwf-cursor-pointer",onClick:function(){return _(!1)}},Object(r.createElement)(s.a,{icon:"cross",size:20})," ")),Object(r.createElement)("div",{className:"bwf-type-select-wrapper "+(c?"is-loading":"")},c?Object(r.createElement)("div",{className:"bwf-display-flex-column set-center is-loading"},Object(r.createElement)(gr.a,{spaceClass:"bwf_clear_10"}),Object(r.createElement)("div",{className:"bwf-h3"},Object(l.__)("Please Wait…","wp-marketing-automations")),Object(r.createElement)("div",{className:"bwf_clear_10"}),Object(r.createElement)("div",{className:"bwf-p"},Object(l.__)("We are adding step in the flow","wp-marketing-automations"))):Object(r.createElement)(r.Fragment,null,Object(r.createElement)(u.Button,{isSecondary:!0,onClick:function(){G("action")}},Object(r.createElement)("span",{className:"bwf-type-select-icons"},Object(r.createElement)(s.a,{icon:"charge"})),Object(l.__)("Action","wp-marketing-automations")),Object(r.createElement)(u.Button,{isSecondary:!0,onClick:function(){G("wait")}},Object(r.createElement)("span",{className:"bwf-type-select-icons"},Object(r.createElement)(s.a,{icon:"time-left"})),Object(l.__)("Delay","wp-marketing-automations")),Object(r.createElement)(u.Button,{isSecondary:!0,onClick:function(){n?G("conditional"):(k("proModalContent",{featureTitle:Object(l.__)("Conditional Step","wp-marketing-automations"),proLink:Object(b.fb)("upgrade",{utm_medium:"Automation+Add+Step+Condition+Upgrade+Modal"}),image:Object(b.sb)("conditional-step.png"),benefit:Object(l.__)("Use hundreds of conditions and advanced branching to create a highly tailored contact journey. Unlock this and other awesome features.","wp-marketing-automations")}),k("showProModal",!0))},style:{width:"100%"}},Object(r.createElement)("span",{className:"bwf-type-select-icons"},Object(r.createElement)(s.a,{icon:"condition"})),Object(l.__)("Condition","wp-marketing-automations"),!n&&Object(r.createElement)("span",{className:"bwf-flex",style:{marginLeft:"auto"}},Object(r.createElement)(s.a,{icon:"king",size:16}))),!h&&Object(r.createElement)(r.Fragment,null,!O&&Object(r.createElement)(u.Button,{isSecondary:!0,onClick:function(){n?G("split"):(k("proModalContent",{featureTitle:Object(l.__)("Split Path","wp-marketing-automations"),proLink:Object(b.fb)("upgrade",{utm_medium:"Automation+Add+Step+Split+Path+Upgrade+Modal"}),image:Object(b.sb)("split-path.png"),benefit:Object(l.__)("Test the subject lines, frequency or different automation paths to uncover hidden profits.Unlock this and other awesome features.","wp-marketing-automations")}),k("showProModal",!0))},style:{width:"100%"}},Object(r.createElement)("span",{className:"bwf-type-select-icons"},Object(r.createElement)(s.a,{icon:"split-test"})),Object(l.__)("Split Path","wp-marketing-automations"),!n&&Object(r.createElement)("span",{className:"bwf-flex",style:{marginLeft:"auto"}},Object(r.createElement)(s.a,{icon:"king",size:16}))),Object(r.createElement)(u.Button,{isSecondary:!0,style:{width:"100%"},onClick:function(){n?G("benchmark"):(k("proModalContent",{featureTitle:Object(l.__)("Goal Step","wp-marketing-automations"),proLink:Object(b.fb)("upgrade",{utm_medium:"Automation+Add+Step+Goal+Upgrade+Modal"}),image:Object(b.sb)("goal-step.png"),benefit:Object(l.__)("Never send unnecessary messages to users. Pull users to a specific step when a goal is achieved. Unlock this and other awesome features.","wp-marketing-automations")}),k("showProModal",!0))}},Object(r.createElement)("span",{className:"bwf-type-select-icons"},Object(r.createElement)(s.a,{icon:"goal"})),Object(l.__)("Goal","wp-marketing-automations"),!n&&Object(r.createElement)("span",{className:"bwf-flex",style:{marginLeft:"auto"}},Object(r.createElement)(s.a,{icon:"king",size:16}))),Object(r.createElement)(u.Button,{isSecondary:!0,style:{width:"100%"},onClick:function(){n?G("jump"):(k("proModalContent",{featureTitle:Object(l.__)("Jump Step","wp-marketing-automations"),proLink:Object(b.fb)("upgrade",{utm_medium:"Automation+Add+Step+Jump+Upgrade+Modal"}),image:Object(b.sb)("jump-step.png"),benefit:Object(l.__)("Create advanced automations by letting contacts jump to any step in the journey.Unlock this and other awesome features.","wp-marketing-automations")}),k("showProModal",!0))}},Object(r.createElement)("span",{className:"bwf-type-select-icons"},Object(r.createElement)(s.a,{icon:"jump"})),Object(l.__)("Jump","wp-marketing-automations"),!n&&Object(r.createElement)("span",{className:"bwf-flex",style:{marginLeft:"auto"}},Object(r.createElement)(s.a,{icon:"king",size:16}))),Object(r.createElement)(u.Button,{isSecondary:!0,style:{width:"100%"},onClick:function(){n?G("exit"):(k("proModalContent",{featureTitle:Object(l.__)("Exit Automation","wp-marketing-automations"),proLink:Object(b.fb)("upgrade",{utm_medium:"Automation+Add+Step+Exit+Upgrade+Modal"}),image:Object(b.sb)("exit-step.png"),benefit:Object(l.__)("Use this to make strategic decisions to end automation based on certain conditions.Unlock this and other awesome features.","wp-marketing-automations")}),k("showProModal",!0))}},Object(r.createElement)("span",{className:"bwf-type-select-icons"},Object(r.createElement)(s.a,{icon:"exit"})),Object(l.__)("Exit","wp-marketing-automations"),!n&&Object(r.createElement)("span",{className:"bwf-flex",style:{marginLeft:"auto"}},Object(r.createElement)(s.a,{icon:"king",size:16})))))))},Ar=n(70),Tr=(n(1162),n(27)),Ir=n(35),Dr=n.n(Ir),Mr=n(63),Fr=n.n(Mr),Gr=n(46);function zr(e){return(zr="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)}function Yr(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(s)throw a}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Ur(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ur(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ur(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function qr(){qr=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof h?t:h,i=Object.create(o.prototype),c=new x(r||[]);return a(i,"_invoke",{value:k(e,n,c)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var m="suspendedStart",b="executing",p="completed",d={};function h(){}function y(){}function v(){}var O={};s(O,i,(function(){return this}));var w=Object.getPrototypeOf,j=w&&w(w(L([])));j&&j!==n&&r.call(j,i)&&(O=j);var g=v.prototype=h.prototype=Object.create(O);function E(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function _(e,t){function n(a,o,i,c){var l=f(e[a],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==zr(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,i,c)}),(function(e){n("throw",e,i,c)})):t.resolve(u).then((function(e){s.value=e,i(s)}),(function(e){return n("throw",e,i,c)}))}c(l.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function k(t,n,r){var a=m;return function(o,i){if(a===b)throw Error("Generator is already running");if(a===p){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===d)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=p,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=b;var s=f(t,n,r);if("normal"===s.type){if(a=r.done?p:"suspendedYield",s.arg===d)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(a=p,r.method="throw",r.arg=s.arg)}}}function N(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),d;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,d;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,d):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,d)}function S(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(S,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(zr(t)+" is not iterable")}return y.prototype=v,a(g,"constructor",{value:v,configurable:!0}),a(v,"constructor",{value:y,configurable:!0}),y.displayName=s(v,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===y||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,v):(e.__proto__=v,s(e,l,"GeneratorFunction")),e.prototype=Object.create(g),e},t.awrap=function(e){return{__await:e}},E(_.prototype),s(_.prototype,c,(function(){return this})),t.AsyncIterator=_,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new _(u(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},E(g),s(g,l,"Generator"),s(g,i,(function(){return this})),s(g,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=L,x.prototype={constructor:x,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function a(r,a){return c.type="throw",c.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],c=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var l=r.call(i,"catchLoc"),s=r.call(i,"finallyLoc");if(l&&s){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,d):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),d},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var a=r.arg;P(n)}return a}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),d}},t}function Br(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 Rr(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Br(Object(n),!0).forEach((function(t){Hr(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Br(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Hr(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=zr(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=zr(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==zr(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Vr(e,t,n,r,a,o,i){try{var c=e[o](i),l=c.value}catch(e){return void n(e)}c.done?t(l):Promise.resolve(l).then(r,a)}var Jr=function(e){return{name:"contact-journey",className:"bwf-search-bwf-tags-result",options:function(t){return(n=qr().mark((function t(n){var r,a,o;return qr().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r={search:n,limit:10,offset:0},t.next=3,d()({path:Object(b.A)("/automation/".concat(e,"/contacts/journey?")+Object(yr.stringify)(r)),method:"GET"});case 3:return a=t.sent,o=[],Dr()(a,"result")&&!Fr()(a.result)&&(o=a.result.map((function(e){return Rr(Rr({},e),{},{key:String(e.trail),label:Fr()(e.f_name)&&Fr()(e.l_name)?e.email:e.f_name+" "+e.l_name})}))),t.abrupt("return",o);case 7:case"end":return t.stop()}}),t)})),r=function(){var e=this,t=arguments;return new Promise((function(r,a){var o=n.apply(e,t);function i(e){Vr(o,r,a,i,c,"next",e)}function c(e){Vr(o,r,a,i,c,"throw",e)}i(void 0)}))},function(e){return r.apply(this,arguments)})(t);var n,r},isDebounced:!0,getOptionIdentifier:function(e){return e.key},getOptionKeywords:function(e){return[e.label]},getOptionLabel:function(e,t){return Object(r.createElement)("span",{key:"name",className:"bwf-customer-journey-search-result-name","aria-label":e.label},Object(r.createElement)("div",{className:"bwf-search-wrap"},Object(r.createElement)("div",{className:"bwf-search-label"},e.label),Object(r.createElement)("div",{className:"bwf-search-date"},"On:"," ",e.hasOwnProperty("c_date")?Object(b.hb)(e.c_date):"")))},getOptionCompletion:function(e){return e}}},$r=function(e){var t=Yr(Object(r.useState)(!1),2),n=t[0],a=t[1],i=e.automationId,c=Object(r.useRef)(),u=Object(f.a)().setAutomationData,p=Object(m.a)().getCustomerSelected;Object(b.Qc)(c,(function(){return a(!1)}));var d=p(),h=function(e){if(Object(o.isArray)(e)&&!Fr()(e)){if(!Fr()(e)){var t=e[e.length-1];(e=[])[0]=t}var n=e.find((function(e){return Dr()(e,"key")}));u("customerSelected",n),a(!1)}else u("customerSelected",{})};return Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{dangerouslySetInnerHTML:{__html:"<style>body{overflow-y: hidden !important;}</style>"}}),Object(r.createElement)("div",{className:"bwf-automation-customer-journey-wrap"},Object(r.createElement)("div",{className:"bwf-automation-customer-journey"},Object(r.createElement)("div",{className:"bwf-customer-journey-header"},Object(r.createElement)("div",{className:"bwf-section-header",onClick:function(){Object(b.ac)()?!n&&Fr()(d)&&a(!0):(u("proModalContent",{featureTitle:Object(l.__)("Contact Journey","wp-marketing-automations"),proLink:Object(b.fb)("upgrade",{utm_medium:"Automation+Workflow+Contact+Journey+Upgrade+Modal"})}),u("showProModal",!0))}},Object(r.createElement)(s.a,{icon:Object(b.ac)()?"split-path":"king",width:16,height:18}),Object(r.createElement)("span",null,Object(l.__)("View Contact Journey","wp-marketing-automations")))),Object(b.ac)()&&Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"bwf-customer-journey-popover-wrap"},n&&Object(r.createElement)(J.a,{ref:c,onFocusOutside:function(e){c.current.contains(e.relatedTarget)||n&&a(!1)},className:"bwf-customer-journey-popover",focusOnMount:!0,placement:"bottom"},Object(r.createElement)("div",{className:"bwf-customer-journey-popover-content"},Object(r.createElement)(Tr.a,{autocompleter:Jr(i),className:"bwf-customer-journey-search",placeholder:Object(l.__)("Search by Name, Email and Phone","wp-marketing-automations"),multiple:!1,inlineTags:!1,selected:[],onChange:h,bwfEnableEmptySearch:!0})))))),!Fr()(d)&&Object(r.createElement)("div",{className:"bwf-customer-selected"},Object(r.createElement)(Gr.a,{id:d.trail,label:d.hasOwnProperty("label")&&!Fr()(d.label.trim())?d.label:d.email,remove:function(){return u("customerSelected",{})}}))))},Wr=n(1117);function Qr(e){return(Qr="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)}function Xr(){Xr=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof h?t:h,i=Object.create(o.prototype),c=new x(r||[]);return a(i,"_invoke",{value:k(e,n,c)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var m="suspendedStart",b="executing",p="completed",d={};function h(){}function y(){}function v(){}var O={};s(O,i,(function(){return this}));var w=Object.getPrototypeOf,j=w&&w(w(L([])));j&&j!==n&&r.call(j,i)&&(O=j);var g=v.prototype=h.prototype=Object.create(O);function E(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function _(e,t){function n(a,o,i,c){var l=f(e[a],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==Qr(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,i,c)}),(function(e){n("throw",e,i,c)})):t.resolve(u).then((function(e){s.value=e,i(s)}),(function(e){return n("throw",e,i,c)}))}c(l.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function k(t,n,r){var a=m;return function(o,i){if(a===b)throw Error("Generator is already running");if(a===p){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===d)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=p,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=b;var s=f(t,n,r);if("normal"===s.type){if(a=r.done?p:"suspendedYield",s.arg===d)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(a=p,r.method="throw",r.arg=s.arg)}}}function N(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),d;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,d;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,d):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,d)}function S(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(S,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(Qr(t)+" is not iterable")}return y.prototype=v,a(g,"constructor",{value:v,configurable:!0}),a(v,"constructor",{value:y,configurable:!0}),y.displayName=s(v,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===y||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,v):(e.__proto__=v,s(e,l,"GeneratorFunction")),e.prototype=Object.create(g),e},t.awrap=function(e){return{__await:e}},E(_.prototype),s(_.prototype,c,(function(){return this})),t.AsyncIterator=_,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new _(u(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},E(g),s(g,l,"Generator"),s(g,i,(function(){return this})),s(g,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=L,x.prototype={constructor:x,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function a(r,a){return c.type="throw",c.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],c=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var l=r.call(i,"catchLoc"),s=r.call(i,"finallyLoc");if(l&&s){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,d):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),d},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var a=r.arg;P(n)}return a}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),d}},t}function Zr(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 Kr(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Zr(Object(n),!0).forEach((function(t){ea(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Zr(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ea(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=Qr(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=Qr(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==Qr(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ta(e,t,n,r,a,o,i){try{var c=e[o](i),l=c.value}catch(e){return void n(e)}c.done?t(l):Promise.resolve(l).then(r,a)}function na(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){ta(o,r,a,i,c,"next",e)}function c(e){ta(o,r,a,i,c,"throw",e)}i(void 0)}))}}function ra(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(s)throw a}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return aa(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?aa(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function aa(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var oa=function(){var e=Object(f.a)(),t=e.setAutomationData,n=e.declareWinnerPath,a=Object(m.a)(),i=a.selectedWinner,c=a.getAutomationId,p=a.getautomationMeta,h=ra(Object(r.useState)(!1),2),v=h[0],O=h[1],w=ra(Object(r.useState)(!1),2),j=w[0],g=w[1],E=ra(Object(r.useState)(!1),2),_=E[0],k=E[1],N=ra(Object(r.useState)(!0),2),S=N[0],P=N[1],x=ra(Object(r.useState)(!0),2),L=x[0],C=x[1],A=ra(Object(r.useState)(""),2),T=A[0],I=A[1],D=ra(Object(r.useState)(!1),2),M=D[0],F=D[1],G=Object(b.Pc)(),z=i(),Y=z.nodeId,U=void 0===Y?"":Y,q=z.stepID,B=void 0===q?"":q,R=z.title,H=void 0===R?"":R,V=Object(r.useRef)(new AbortController),J=p(),$=c(),W=function(){t("declareWinner",{}),t("showSplitWinner",!1)};Object(r.useEffect)((function(){!function(){try{P(!0),d()({path:Object(b.A)("/automation/".concat($,"/analytics/").concat(B,"?mode=split")),method:"GET"}).then((function(e){200===e.code&&e.result.hasOwnProperty("data")&&!Object(o.isEmpty)(e.result.data)&&C(e.result.data),P(!1)}))}catch(e){P(!1)}}()}),[]);var Q=function(){var e=na(Xr().mark((function e(r,a,o){return Xr().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return O(!0),e.prev=1,e.next=4,d()({path:Object(b.A)("/automation/".concat($,"/step/").concat(a,"/declare-winner")),method:"POST",signal:V.current.signal,data:{node_id:r,path_num:o}}).then(function(){var e=na(Xr().mark((function e(i){return Xr().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!i.result){e.next=4;break}return F(!0),e.next=4,n(r,o).then((function(e){if(e){k(!0);var n=e.targetElemt,r=e.newStep,o=e.newLink,i=e.newCount;try{d()({path:Object(b.A)("/automation/".concat($,"/step/").concat(a,"/")),method:"POST",signal:V.current.signal,data:{steps:r,links:o,count:i}}).then((function(e){200===e.code&&(e.hasOwnProperty("result")&&e.result.hasOwnProperty("meta")&&t("meta",Kr(Kr({},J),e.result.meta)),t("targetNode",n),t("flowCenter",!0)),k(!1)}))}catch(e){k(!1)}}else k(!1)}));case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}());case 4:e.next=9;break;case 6:e.prev=6,e.t0=e.catch(1),O(!1);case 9:case"end":return e.stop()}}),e,null,[[1,6]])})));return function(t,n,r){return e.apply(this,arguments)}}(),X=function(){var e,t,n=(e=L.paths,t=[],(void 0===e?[]:e).map((function(e){var n=e.path,r=void 0===n?"":n,a=e.stats,o=void 0===a?[]:a;parseInt(r)===parseInt(T)&&(t=o)})),t);return Object(r.createElement)("div",{className:"bwf-declare-winner-confirm-wrap"},Object(r.createElement)(s.a,{icon:"declare-winner"}),Object(r.createElement)("div",{className:"bwf-declare-winner-confirm-content"},Object(r.createElement)("div",{className:"bwf-declare-winner-confirm-header"},Object(l.sprintf)(Object(l.__)("Congratulations! You have declared Path %s as winner","wp-marketing-automations"),G[T])),Object(r.createElement)("div",{className:"bwf-declare-winner-confirm-stat-wrap"},n.map((function(e,t){return Object(r.createElement)("div",{className:"bwf-declare-winner-confirm-stat",key:t},Object(r.createElement)("div",{className:"bwf-split-node-value"},e.v),Object(r.createElement)("div",{className:"bwf-split-node-label"},e.l))}))),Object(r.createElement)("div",{className:"bwf-declare-winner-confirm-footer"},Object(r.createElement)(y.a,{isPrimary:!0,isBusy:_,disabled:_,onClick:W},_?Object(l.__)("Updating Automation","wp-marketing-automations"):Object(l.__)("Close","wp-marketing-automations")))))};return Object(r.createElement)(u.Modal,{className:"bwf-admin-modal bwf-admin-modal-no-header bwf-declare-winner-modal "+(!j||M?"bwf-admin-modal-1024":"bwf-admin-modal-480"),shouldCloseOnClickOutside:!1,shouldCloseOnEsc:!1},Object(r.createElement)("div",{className:"bwf-declare-winner-header-wrap"},Object(r.createElement)("div",{className:"bwf-declare-winner-header"},function(){if(S)return Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"bwf-placeholder-temp bwf-w-210 bwf-h-20"}),Object(r.createElement)("div",{className:"bwf_clear_5"}),Object(r.createElement)("div",{className:"bwf-placeholder-temp bwf-w-150 bwf-h-15"}));var e=L.started_at,t=void 0===e?"":e;return j?Object(r.createElement)(r.Fragment,null,M?"":Object(l.sprintf)(Object(l.__)("Declare Path %s as Winner","wp-marketing-automations"),G[T])):Object(r.createElement)("div",{className:"bwf-declarewinner-step-title"},Object(r.createElement)("div",{className:"bwf-title-wrap"},Object(r.createElement)("div",{className:"bwf-split-title"},Object(l.sprintf)(Object(l.__)("Result of %s","wp-marketing-automations"),H))),Object(r.createElement)("div",{className:"bwf-split-date"},Object(r.createElement)("span",null,Object(l.__)("Started On ","wp-marketing-automations")+" : "),Object(b.ib)(t)))}()),Object(r.createElement)("div",{className:"bwf-close-modal",onClick:W},Object(r.createElement)(s.a,{icon:"close",size:20}))),Object(r.createElement)("div",{className:"bwf-declare-winner-content"},function(){if(S)return Object(r.createElement)("div",{className:"bwf-declare-winner-analytics-wrap"},[1,2].map((function(e){return Object(r.createElement)("div",{className:"bwf-declare-winner-analytics-row",key:e},Object(r.createElement)("div",{className:"bwf-declare-winner-analytics-col"},Object(r.createElement)("div",{className:"bwf-placeholder-temp bwf-h-15 bwf-w-60"})),[1,2,3,4,5,6,7,8].map((function(e){return Object(r.createElement)("div",{className:"bwf-declare-winner-analytics-col",key:e},Object(r.createElement)("div",{className:"bwf-placeholder-temp bwf-h-15 bwf-w-30"}),Object(r.createElement)("div",{className:"bwf-placeholder-temp bwf-h-15 bwf-w-70"}))})),Object(r.createElement)("div",{className:"bwf-declare-winner-analytics-col"},Object(r.createElement)("div",{className:"bwf-placeholder-temp bwf-h-30 bwf-w-120"})))})));var e=L.paths,t=void 0===e?[]:e;return j?Object(r.createElement)(r.Fragment,null,M?X():Object(l.sprintf)(Object(l.__)("You are about to declare Path %s as winner. All other paths will be removed from the automation. This action cannot be undone.","wp-marketing-automations"),G[T])):Object(r.createElement)("div",{className:"bwf-declare-winner-analytics-wrap"},t.map((function(e,t){var n=e.path,a=void 0===n?1:n,o=e.stats,i=void 0===o?[]:o;return Object(r.createElement)("div",{className:"bwf-declare-winner-analytics-row",key:t},Object(r.createElement)("div",{className:"bwf-declare-winner-analytics-col"},Object(r.createElement)("span",{className:"bwf-split-path-title splitpath-".concat(a)},Object(l.__)("Path","wp-marketing-automations")+" "+G[a])),i.map((function(e,t){return Object(r.createElement)("div",{className:"bwf-declare-winner-analytics-col",key:t},Object(r.createElement)("span",{className:"bwf-split-test-value"},e.v),Object(r.createElement)("span",{className:"bwf-split-test-label"},e.l))})),Object(r.createElement)("div",{className:"bwf-declare-winner-analytics-col"},Object(r.createElement)("div",{className:"bwf-declare-winner-btn",onClick:function(){g(!0),I(a)}},Object(l.__)("Declare Winner","wp-marketing-automations"))))})))}()),j&&!M&&Object(r.createElement)("div",{className:"bwf-declare-winner-footer",key:"footer"},Object(r.createElement)(y.a,{className:"bwf-cancel-btn",onClick:W,disabled:!1},Object(l.__)("Cancel","wp-marketing-automations")),Object(r.createElement)(y.a,{isPrimary:!0,onClick:function(){Q(U,B,T)},isBusy:v,disabled:v},Object(l.__)("Declare Winner","wp-marketing-automations"))))};function ia(e){return(ia="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)}function ca(){ca=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof h?t:h,i=Object.create(o.prototype),c=new x(r||[]);return a(i,"_invoke",{value:k(e,n,c)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var m="suspendedStart",b="executing",p="completed",d={};function h(){}function y(){}function v(){}var O={};s(O,i,(function(){return this}));var w=Object.getPrototypeOf,j=w&&w(w(L([])));j&&j!==n&&r.call(j,i)&&(O=j);var g=v.prototype=h.prototype=Object.create(O);function E(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function _(e,t){function n(a,o,i,c){var l=f(e[a],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==ia(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,i,c)}),(function(e){n("throw",e,i,c)})):t.resolve(u).then((function(e){s.value=e,i(s)}),(function(e){return n("throw",e,i,c)}))}c(l.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function k(t,n,r){var a=m;return function(o,i){if(a===b)throw Error("Generator is already running");if(a===p){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===d)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=p,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=b;var s=f(t,n,r);if("normal"===s.type){if(a=r.done?p:"suspendedYield",s.arg===d)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(a=p,r.method="throw",r.arg=s.arg)}}}function N(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),d;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,d;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,d):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,d)}function S(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(S,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(ia(t)+" is not iterable")}return y.prototype=v,a(g,"constructor",{value:v,configurable:!0}),a(v,"constructor",{value:y,configurable:!0}),y.displayName=s(v,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===y||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,v):(e.__proto__=v,s(e,l,"GeneratorFunction")),e.prototype=Object.create(g),e},t.awrap=function(e){return{__await:e}},E(_.prototype),s(_.prototype,c,(function(){return this})),t.AsyncIterator=_,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new _(u(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},E(g),s(g,l,"Generator"),s(g,i,(function(){return this})),s(g,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=L,x.prototype={constructor:x,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function a(r,a){return c.type="throw",c.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],c=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var l=r.call(i,"catchLoc"),s=r.call(i,"finallyLoc");if(l&&s){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,d):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),d},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var a=r.arg;P(n)}return a}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),d}},t}function la(e,t,n,r,a,o,i){try{var c=e[o](i),l=c.value}catch(e){return void n(e)}c.done?t(l):Promise.resolve(l).then(r,a)}function sa(e){return function(e){if(Array.isArray(e))return ma(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||fa(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 ua(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(s)throw a}}return c}}(e,t)||fa(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function fa(e,t){if(e){if("string"==typeof e)return ma(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ma(e,t):void 0}}function ma(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function ba(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<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ba(Object(n),!0).forEach((function(t){da(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ba(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function da(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=ia(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=ia(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==ia(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var ha=function(e){var t=e.id,n=Object(sr.a)(),i=n.setL2Title,p=n.setPageCountData,y=Object(ur.a)().getPageCountData,O=Object(r.useContext)(b.h),w=Object(a.n)().setCenter,j=Object(a.l)(),g=Object(a.m)((function(e){return e.setSelectedElements})),E=Object(bt.b)(),_=E.mergeTag,k=E.setMergeTag,N=E.reset,S=E.identifier,P=E.setIdentifier,x=Object(m.a)(),L=y(),C=x.getLoading,A=x.getAutomationSteps,T=x.getAutomationLinks,I=x.getEnableCopy,D=x.getEnableMove,M=x.getAutomationData,F=x.getError,G=x.getShowContactModalId,z=x.getOpenStartSidebar,Y=x.getCustomerSelected,U=x.isProModal,q=x.getautomationMeta,B=x.getModalData,R=x.getFlowCenter,H=x.getTargetNode,J=x.showSplitWinnerModal,$=x.getProModalContent,W=x.getSingleAutomationFailedCount,Q=B(),X=Object(f.a)(),Z=X.setAutomationData,K=X.fetchAutomationStat,ee=T(),te=A(),ne=I(),re=D(),ae=C(),oe=F(),ie=M(),le=G(),se=ie.title,ue=void 0===se?"":se,fe=z(),me=Y(),be=U(),pe=$(),de=q(),ve=de.tips,Oe=void 0===ve?[]:ve,we=R(),je=H(),ge=J(),_e=W();Object(r.useEffect)((function(){ae||p(pa(pa({},L),{},{single_a_contacts:_e}))}),[_e]),Object(fr.a)("workflow",ue,"admin.php?page=autonami&path=/automations",!1,null,t,!1,!0,!1),Object(r.useEffect)((function(){Z("isNewAutomation",0)}),[ie]);var ke=Object(r.useRef)();Object(r.useEffect)((function(){return window.addEventListener("keyup",(function(e){"Escape"!==e.key&&"27"!==e.keyCode||null!==document.querySelector(".bwf-escape-note")&&(Z("enableCopy",!1),Z("enableMove",!1),Z("isProcessingCopyPaste",!1),Z("copyData",{}),Z("moveID",0),Object(b.Lb)(O,100))})),Z("enableCopy",!1),Z("enableMove",!1),Z("copyData",{}),function(){document.body.style.overflow="",i(""),Z("statLoading",!0),Z("statData",[]),Z("isLoading",!0)}}),[]),Object(r.useEffect)((function(){Object(o.isNull)(document.querySelector("#bwf-single-automation-wrap"))||(ke.current=document.querySelector("#bwf-single-automation-wrap").getBoundingClientRect()),ae||K()}),[ae]);var Ne={start:V,action:he,conditional:ce,end:ye,benchmark:Ee,wait:Ie,yesNoNode:De,exit:Ue,jump:$e,split:et,splitpath:tt},Se={"bwf-default":dr},Pe=ee.map((function(e){return e.id&&(e.id.includes("yesedge")||e.id.includes("noedge")||e.hasOwnProperty("sourceHandle")&&"split-edge"===e.sourceHandle)?e:pa(pa({},e),{},{type:"bwf-default"})})),xe=ua(Object(r.useState)([]),2),Le=xe[0],Ce=xe[1],Ae=ua(Object(r.useState)(!1),2),Te=Ae[0],Me=Ae[1],Fe=ua(Object(r.useState)("bwf-automation-wrap"),2),Ge=Fe[0],ze=Fe[1],Ye=ua(Object(r.useState)(!1),2),qe=Ye[0],Be=Ye[1],Re=ua(Object(r.useState)(!0),2),He=Re[0],Ve=Re[1];if(Object(r.useEffect)((function(){if(!Te||we){var e=0,t=0,n=j.getState(),r=n.nodes,a=n.selectedElements;if(Object(o.isEmpty)(a)||fe||we)if(Z("openStartSidebar",!1),we&&!Object(o.isEmpty)(a)){var i=r.filter((function(e){return e.id===je}));(Object(o.isEmpty)(i)||Object(o.isNull)(i)||""===i||Object(o.isUndefined)(i))&&(i=a[0]),i.hasOwnProperty("__rf")?(e=i.__rf.position.x,t=i.__rf.position.y):(e=i.position.x,t=i.position.y),t=parseFloat(t)+parseFloat(ke.current.height)*(qe?.5:.4),Me(!0),w(e,t,1),Z("flowCenter",!1)}else if(r.length&&ke.current){var c=r[0];c.hasOwnProperty("__rf")?(e=c.__rf.position.x+140,t=c.__rf.position.y):(e=c.position.x+140,t=c.position.y),t=parseFloat(t)+parseFloat(ke.current.height)*(qe?.5:.4),Me(!0),w(e,t,1),Z("flowCenter",!1)}}}),[Le,Te,we]),Object(r.useEffect)((function(){Me(!1),te.length>1?Ce(Object(mr.a)([].concat(sa(te),sa(Pe)),!0,ne||re?20:0)):Ce(te)}),[te,ae,qe,me]),Object(r.useEffect)((function(){g([])}),[me]),ae)return Object(r.createElement)(gr.a,null);var Je=function(){var e,n=(e=ca().mark((function e(){return ca().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,d()({path:Object(b.A)("/automation/".concat(t,"/delete_meta")),method:"DELETE",data:{meta_key:"tips"}}).then((function(e){200===e.code&&Z("meta",pa(pa({},de),{},{tips:[]}))}));case 3:e.next=8;break;case 5:e.prev=5,e.t0=e.catch(0),console.log(e.t0);case 8:case"end":return e.stop()}}),e,null,[[0,5]])})),function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){la(o,r,a,i,c,"next",e)}function c(e){la(o,r,a,i,c,"throw",e)}i(void 0)}))});return function(){return n.apply(this,arguments)}}();return Object(r.createElement)(bt.a.Provider,{value:{selectedMergeTag:_,setSelectedMergeTag:k,resetSelection:N,selectedIdentifier:S,setSelectedIdentifier:P}},Object(o.isEmpty)(oe)?Object(r.createElement)(r.Fragment,null,Object(r.createElement)(Ar.a,null),Object(r.createElement)("div",{className:c()(Ge,{"full-screen":qe}),id:"bwf-single-automation-wrap"},Object(r.createElement)("div",{className:"automation-title"}," ",ue," "),Object(r.createElement)($r,{automationId:t}),(ne||re)&&Object(r.createElement)("div",{className:"bwf-escape-note"},Object(l.__)("Press ESC to skip paste step","wp-marketing-automations")),Object(o.isEmpty)(me)?Object(r.createElement)(a.f,{defaultZoom:1,minZoom:.5,maxZoom:4,nodeTypes:Ne,nodesConnectable:!1,nodesDraggable:!1,zoomOnScroll:!1,zoomOnDoubleClick:!1,paneMoveable:!0,panOnScroll:!0,elements:Le,edgeTypes:Se,onSelectionChange:function(e){if(!Object(o.isNull)(e)&&e.length>0){var t=e[0];if(Object(a.k)(t))return void ze("bwf-automation-wrap bwf-node-selected");if(Object(a.j)(t))return void ze("bwf-automation-wrap bwf-edge-selected");ze("bwf-automation-wrap")}}},Object(r.createElement)(Cr,{isProActive:Object(b.ac)()}),Object(r.createElement)(a.c,{showInteractive:!1},Object(r.createElement)(a.b,{onClick:function(){Be(!qe),document.body.style.overflow=qe?"":"hidden",g([])}},qe?Object(r.createElement)("span",{className:"dashicons dashicons-fullscreen-exit-alt custom-control-icon"}):Object(r.createElement)("span",{className:"dashicons dashicons-fullscreen-alt custom-control-icon"}))),Object(r.createElement)(a.a,null)):Object(r.createElement)(Wr.a,{inAutomation:!0,setFullScreen:Be,fullScreen:qe}),!Object(o.isEmpty)(Oe)&&Object(r.createElement)("div",{className:"bwfan-automation-tips"},Object(r.createElement)("span",{className:"bwf-close-tip",onClick:Je},Object(r.createElement)(s.a,{icon:"close",size:12})),Oe.map((function(e,t){return Object(r.createElement)("div",{className:"bwfan-automation-tip",key:t},Object(r.createElement)("div",null,Object(r.createElement)(s.a,{icon:"tip"}),Object(r.createElement)("strong",null,"Tip")),Object(r.createElement)("div",null,e))})))),Object(r.createElement)(lr,null),""!==le&&0!==le&&Object(r.createElement)(jr,null)):Object(r.createElement)(r.Fragment,null,Object(r.createElement)(r.Fragment,null,He&&Object(r.createElement)(u.Modal,{title:Object(l.__)("Failed","wp-marketing-automations"),onRequestClose:function(){return Ve(!1)},className:"bwf-admin-modal bwf-admin-modal-small bwf-single-automation-error-modal",shouldCloseOnEsc:!1,shouldCloseOnClickOutside:!1},Object(r.createElement)("div",{className:"bwf-error-content"},Object(r.createElement)(r.Fragment,null,Object(r.createElement)("p",null,Object(l.__)("There has been a critical error on this website.","wp-marketing-automations")),Object(r.createElement)("p",null,Object(l.__)("For quick help, contact FunnelKit","wp-marketing-automations")," ",Object(r.createElement)("a",{href:"https://funnelkit.com/support/?utm_source=WordPress&utm_medium=Automation+Error&utm_campaign=FKA+Lite+Plugin",target:"_blank",rel:"noopener noreferrer"},Object(l.__)("support ","wp-marketing-automations"))))),Object(r.createElement)("div",{className:"bwf-footer"},Object(r.createElement)(u.Button,{isPrimary:!0,onClick:function(){return Ve(!1)}},Object(l.__)("Close","wp-marketing-automations")))))),!Object(b.ac)()&&Object(r.createElement)(v.b,{isOpen:be,onRequestClose:function(){return Z("showProModal",!1)},modalContent:pa({isFeature:!0,proLink:Object(b.fb)("upgrade")},pe)}),Object(r.createElement)(h.a,{modalTitle:Q.modalTitle,deleteEntityName:Q.deleteEntityName,confirmText:Q.confirmText,confirmButtonText:Q.buttonConfirm,cancelButtonText:Q.buttonCancel,onConfirm:Q.onConfirm,isLoading:Q.loading,successMessage:Q.success,errorMessage:Q.error,content:Q.content,onRequestClose:function(){Z("modalData",{loading:!1,status:!1})},confirmDescription:Q.hasOwnProperty("confirmDescription")?Q.confirmDescription:"",isOpen:Q.status,isDelete:Q.isDelete}),ge&&Object(r.createElement)(oa,null))};t.default=function(e){var t=e.match.params.id;Object(b.m)("Automation #"+t);var n=Object(f.a)(),o=n.fetchAutomation,i=n.setAutomationData,c=n.clearAutomationError;return Object(r.useEffect)((function(){i("statLoading",!0),i("statData",[]),i("isLoading",!0),c(),o(t)}),[t]),Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"bwf-single-automation-body-header",style:{paddingBottom:"8px"}},Object(r.createElement)("div",{className:"bwf-content-header-left"},Object(r.createElement)("div",{className:"bwf-content-header-title2"},Object(l.__)("Workflow","wp-marketing-automations")))),Object(r.createElement)(a.e,null,Object(r.createElement)(ha,{id:t})))}}}]);