PageSourceSearch

https://app.courier.com/_next/static/chunks/pages/automations/[id]/design-5b24e5d3c450786f.js

js courier.com collected 2026-09-24 09:01:54 UTC 596,369 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1101,3745,2737],{50355:function(e,n,t){"use strict";t.r(n),t.d(n,{tippy:function(){return r.default},useSingleton:function(){return y}});var r=t(55079),o=t(2784),i=t(28316);function a(e,n){if(null==e)return{};var t,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)t=i[r],n.indexOf(t)>=0||(o[t]=e[t]);return o}var l="undefined"!==typeof window&&"undefined"!==typeof document;function s(e,n){e&&("function"===typeof e&&e(n),{}.hasOwnProperty.call(e,"current")&&(e.current=n))}function u(){return l&&document.createElement("div")}function c(e,n){if(e===n)return!0;if("object"===typeof e&&null!=e&&"object"===typeof n&&null!=n){if(Object.keys(e).length!==Object.keys(n).length)return!1;for(var t in e){if(!n.hasOwnProperty(t))return!1;if(!c(e[t],n[t]))return!1}return!0}return!1}function d(e){var n=[];return e.forEach((function(e){n.find((function(n){return c(e,n)}))||n.push(e)})),n}function f(e,n){var t,r;return Object.assign({},n,{popperOptions:Object.assign({},e.popperOptions,n.popperOptions,{modifiers:d([].concat((null==(t=e.popperOptions)?void 0:t.modifiers)||[],(null==(r=n.popperOptions)?void 0:r.modifiers)||[]))})})}var p=l?o.useLayoutEffect:o.useEffect;function h(e){var n=(0,o.useRef)();return n.current||(n.current="function"===typeof e?e():e),n.current}function v(e,n,t){t.split(/\s+/).forEach((function(t){t&&e.classList[n](t)}))}var m={name:"className",defaultValue:"",fn:function(e){var n=e.popper.firstElementChild,t=function(){var n;return!!(null==(n=e.props.render)?void 0:n.$$tippy)};function r(){e.props.className&&!t()||v(n,"add",e.props.className)}return{onCreate:r,onBeforeUpdate:function(){t()&&v(n,"remove",e.props.className)},onAfterUpdate:r}}};function g(e){return function(n){var t=n.children,r=n.content,l=n.visible,c=n.singleton,d=n.render,v=n.reference,g=n.disabled,x=void 0!==g&&g,b=n.ignoreAttributes,y=void 0===b||b,C=(n.__source,n.__self,a(n,["children","content","visible","singleton","render","reference","disabled","ignoreAttributes","__source","__self"])),j=void 0!==l,w=void 0!==c,N=(0,o.useState)(!1),S=N[0],k=N[1],_=(0,o.useState)({}),Z=_[0],E=_[1],I=(0,o.useState)(),O=I[0],T=I[1],A=h((function(){return{container:u(),renders:1}})),D=Object.assign({ignoreAttributes:y},C,{content:A.container});j&&(D.trigger="manual",D.hideOnClick=!1),w&&(x=!0);var L=D,M=D.plugins||[];d&&(L=Object.assign({},D,{plugins:w&&null!=c.data?[].concat(M,[{fn:function(){return{onTrigger:function(e,n){var t=c.data.children.find((function(e){return e.instance.reference===n.currentTarget}));e.state.$$activeSingletonInstance=t.instance,T(t.content)}}}}]):M,render:function(){return{popper:A.container}}}));var P=[v].concat(t?[t.type]:[]);return p((function(){var n=v;v&&v.hasOwnProperty("current")&&(n=v.current);var t=e(n||A.ref||u(),Object.assign({},L,{plugins:[m].concat(D.plugins||[])}));return A.instance=t,x&&t.disable(),l&&t.show(),w&&c.hook({instance:t,content:r,props:L,setSingletonContent:T}),k(!0),function(){t.destroy(),null==c||c.cleanup(t)}}),P),p((function(){var e;if(1!==A.renders){var n=A.instance;n.setProps(f(n.props,L)),null==(e=n.popperInstance)||e.forceUpdate(),x?n.disable():n.enable(),j&&(l?n.show():n.hide()),w&&c.hook({instance:n,content:r,props:L,setSingletonContent:T})}else A.renders++})),p((function(){var e;if(d){var n=A.instance;n.setProps({popperOptions:Object.assign({},n.props.popperOptions,{modifiers:[].concat(((null==(e=n.props.popperOptions)?void 0:e.modifiers)||[]).filter((function(e){return"$$tippyReact"!==e.name})),[{name:"$$tippyReact",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(e){var n,t=e.state,r=null==(n=t.modifiersData)?void 0:n.hide;Z.placement===t.placement&&Z.referenceHidden===(null==r?void 0:r.isReferenceHidden)&&Z.escaped===(null==r?void 0:r.hasPopperEscaped)||E({placement:t.placement,referenceHidden:null==r?void 0:r.isReferenceHidden,escaped:null==r?void 0:r.hasPopperEscaped}),t.attributes.popper={}}}])})})}}),[Z.placement,Z.referenceHidden,Z.escaped].concat(P)),o.createElement(o.Fragment,null,t?(0,o.cloneElement)(t,{ref:function(e){A.ref=e,s(t.ref,e)}}):null,S&&(0,i.createPortal)(d?d(function(e){var n={"data-placement":e.placement};return e.referenceHidden&&(n["data-reference-hidden"]=""),e.escaped&&(n["data-escaped"]=""),n}(Z),O,A.instance):r,A.container))}}function x(e){return function(n){var t=void 0===n?{}:n,r=t.disabled,i=void 0!==r&&r,l=t.overrides,s=void 0===l?[]:l,u=(0,o.useState)(!1),c=u[0],d=u[1],v=h({children:[],renders:1});return p((function(){if(c){var n=v.children,t=v.sourceData;if(t){var r=e(n.map((function(e){return e.instance})),Object.assign({},t.props,{popperOptions:t.instance.props.popperOptions,overrides:s,plugins:[m].concat(t.props.plugins||[])}));return v.instance=r,i&&r.disable(),function(){r.destroy(),v.children=n.filter((function(e){return!e.instance.state.isDestroyed}))}}}else d(!0)}),[c]),p((function(){if(c)if(1!==v.renders){var e=v.children,n=v.instance,t=v.sourceData;if(n&&t){var r=t.props,o=(r.content,a(r,["content"]));n.setProps(f(n.props,Object.assign({},o,{overrides:s}))),n.setInstances(e.map((function(e){return e.instance}))),i?n.disable():n.enable()}}else v.renders++})),(0,o.useMemo)((function(){return[{data:v,hook:function(e){v.sourceData=e,v.setSingletonContent=e.setSingletonContent},cleanup:function(){v.sourceData=null}},{hook:function(e){var n,t;v.children=v.children.filter((function(n){var t=n.instance;return e.instance!==t})),v.children.push(e),(null==(n=v.instance)?void 0:n.state.isMounted)&&(null==(t=v.instance)?void 0:t.state.$$activeSingletonInstance)===e.instance&&(null==v.setSingletonContent||v.setSingletonContent(e.content)),v.instance&&!v.instance.state.isDestroyed&&v.instance.setInstances(v.children.map((function(e){return e.instance})))},cleanup:function(e){v.children=v.children.filter((function(n){return n.instance!==e})),v.instance&&!v.instance.state.isDestroyed&&v.instance.setInstances(v.children.map((function(e){return e.instance})))}}]}),[])}}var b=function(e,n){return(0,o.forwardRef)((function(t,r){var i=t.children,l=a(t,["children"]);return o.createElement(e,Object.assign({},n,l),i?(0,o.cloneElement)(i,{ref:function(e){s(r,e),s(i.ref,e)}}):null)}))},y=x(r.createSingleton),C=b(g(r.default));n.default=C},89429:function(e,n,t){"use strict";var r=t(4090),o=t(67286),i=t(47669),a=t(5408),l=o("%Function.prototype.apply%"),s=o("%Function.prototype.call%"),u=o("%Reflect.apply%",!0)||r.call(s,l),c=t(70999),d=o("%M
1ath.max%");e.exports=function(e){if("function"!==typeof e)throw new a("a function is required");var n=u(r,s,arguments);return i(n,1+d(0,e.length-(arguments.length-1)),!0)};var f=function(){return u(r,l,arguments)};c?c(e.exports,"apply",{value:f}):e.exports.apply=f},74167:function(e,n,t){"use strict";var r=t(7895);function o(e,n){var t={zone:n};if(e?e instanceof o?this._date=e._date:e instanceof Date?this._date=r.DateTime.fromJSDate(e,t):"number"===typeof e?this._date=r.DateTime.fromMillis(e,t):"string"===typeof e&&(this._date=r.DateTime.fromISO(e,t),this._date.isValid||(this._date=r.DateTime.fromRFC2822(e,t)),this._date.isValid||(this._date=r.DateTime.fromSQL(e,t)),this._date.isValid||(this._date=r.DateTime.fromFormat(e,"EEE, d MMM yyyy HH:mm:ss",t))):this._date=r.DateTime.local(),!this._date||!this._date.isValid)throw new Error("CronDate: unhandled timestamp: "+JSON.stringify(e));n&&n!==this._date.zoneName&&(this._date=this._date.setZone(n))}o.prototype.addYear=function(){this._date=this._date.plus({years:1})},o.prototype.addMonth=function(){this._date=this._date.plus({months:1}).startOf("month")},o.prototype.addDay=function(){this._date=this._date.plus({days:1}).startOf("day")},o.prototype.addHour=function(){var e=this._date;this._date=this._date.plus({hours:1}).startOf("hour"),this._date<=e&&(this._date=this._date.plus({hours:1}))},o.prototype.addMinute=function(){var e=this._date;this._date=this._date.plus({minutes:1}).startOf("minute"),this._date<e&&(this._date=this._date.plus({hours:1}))},o.prototype.addSecond=function(){var e=this._date;this._date=this._date.plus({seconds:1}).startOf("second"),this._date<e&&(this._date=this._date.plus({hours:1}))},o.prototype.subtractYear=function(){this._date=this._date.minus({years:1})},o.prototype.subtractMonth=function(){this._date=this._date.minus({months:1}).endOf("month").startOf("second")},o.prototype.subtractDay=function(){this._date=this._date.minus({days:1}).endOf("day").startOf("second")},o.prototype.subtractHour=function(){var e=this._date;this._date=this._date.minus({hours:1}).endOf("hour").startOf("second"),this._date>=e&&(this._date=this._date.minus({hours:1}))},o.prototype.subtractMinute=function(){var e=this._date;this._date=this._date.minus({minutes:1}).endOf("minute").startOf("second"),this._date>e&&(this._date=this._date.minus({hours:1}))},o.prototype.subtractSecond=function(){var e=this._date;this._date=this._date.minus({seconds:1}).startOf("second"),this._date>e&&(this._date=this._date.minus({hours:1}))},o.prototype.getDate=function(){return this._date.day},o.prototype.getFullYear=function(){return this._date.year},o.prototype.getDay=function(){var e=this._date.weekday;return 7==e?0:e},o.prototype.getMonth=function(){return this._date.month-1},o.prototype.getHours=function(){return this._date.hour},o.prototype.getMinutes=function(){return this._date.minute},o.prototype.getSeconds=function(){return this._date.second},o.prototype.getMilliseconds=function(){return this._date.millisecond},o.prototype.getTime=function(){return this._date.valueOf()},o.prototype.getUTCDate=function(){return this._getUTC().day},o.prototype.getUTCFullYear=function(){return this._getUTC().year},o.prototype.getUTCDay=function(){var e=this._getUTC().weekday;return 7==e?0:e},o.prototype.getUTCMonth=function(){return this._getUTC().month-1},o.prototype.getUTCHours=function(){return this._getUTC().hour},o.prototype.getUTCMinutes=function(){return this._getUTC().minute},o.prototype.getUTCSeconds=function(){return this._getUTC().second},o.prototype.toISOString=function(){return this._date.toUTC().toISO()},o.prototype.toJSON=function(){return this._date.toJSON()},o.prototype.setDate=function(e){this._date=this._date.set({day:e})},o.prototype.setFullYear=function(e){this._date=this._date.set({year:e})},o.prototype.setDay=function(e){this._date=this._date.set({weekday:e})},o.prototype.setMonth=function(e){this._date=this._date.set({month:e+1})},o.prototype.setHours=function(e){this._date=this._date.set({hour:e})},o.prototype.setMinutes=function(e){this._date=this._date.set({minute:e})},o.prototype.setSeconds=function(e){this._date=this._date.set({second:e})},o.prototype.setMilliseconds=function(e){this._date=this._date.set({millisecond:e})},o.prototype._getUTC=function(){return this._date.toUTC()},o.prototype.toString=function(){return this.toDate().toString()},o.prototype.toDate=function(){return this._date.toJSDate()},o.prototype.isLastDayOfMonth=function(){var e=this._date.plus({days:1}).startOf("day");return this._date.month!==e.month},e.exports=o},72249:function(e,n,t){"use strict";var r=t(74167),o=t(74782),i=t(69661);function a(e,n){this._options=n,this._utc=n.utc||!1,this._tz=this._utc?"UTC":n.tz,this._currentDate=new r(n.currentDate,this._tz),this._startDate=n.startDate?new r(n.startDate,this._tz):null,this._endDate=n.endDate?new r(n.endDate,this._tz):null,this._isIterator=n.iterator||!1,this._hasIterated=!1,this._nthDayOfWeek=n.nthDayOfWeek||0,this.fields=a._freezeFields(e)}a.map=["second","minute","hour","dayOfMonth","month","dayOfWeek"],a.predefined={"@yearly":"0 0 1 1 *","@monthly":"0 0 1 * *","@weekly":"0 0 * * 0","@daily":"0 0 * * *","@hourly":"0 * * * *"},a.constraints=[{min:0,max:59,chars:[]},{min:0,max:59,chars:[]},{min:0,max:23,chars:[]},{min:1,max:31,chars:["L"]},{min:1,max:12,chars:[]},{min:0,max:7,chars:[]}],a.daysInMonth=[31,29,31,30,31,30,31,31,30,31,30,31],a.aliases={month:{jan:1,feb:2,mar:3,apr:4,may:5,jun:6,jul:7,aug
1:8,sep:9,oct:10,nov:11,dec:12},dayOfWeek:{sun:0,mon:1,tue:2,wed:3,thu:4,fri:5,sat:6}},a.parseDefaults=["0","*","*","*","*","*"],a.standardValidCharacters=/^[\d|/|*|\-|,]+$/,a.dayOfWeekValidCharacters=/^[\d|/|*|\-|,|\?]+$/,a.dayOfMonthValidCharacters=/^[\d|L|/|*|\-|,|\?]+$/,a.validCharacters={second:a.standardValidCharacters,minute:a.standardValidCharacters,hour:a.standardValidCharacters,dayOfMonth:a.dayOfMonthValidCharacters,month:a.standardValidCharacters,dayOfWeek:a.dayOfWeekValidCharacters},a._parseField=function(e,n,t){switch(e){case"month":case"dayOfWeek":var r=a.aliases[e];n=n.replace(/[a-z]{1,3}/gi,(function(e){if(e=e.toLowerCase(),"undefined"!==typeof r[e])return r[e];throw new Error('Validation error, cannot resolve alias "'+e+'"')}))}if(!a.validCharacters[e].test(n))throw new Error("Invalid characters, got value: "+n);function i(e){var n=e.split("/");return n.length>1?(n[0]==+n[0]&&(n=[n[0]+"-"+t.max,n[1]]),l(n[0],n[n.length-1])):l(e,1)}function l(e,n){var r=[],i=e.split("-");if(i.length>1){if(i.length<2)return+e;if(!i[0].length){if(!i[1].length)throw new Error("Invalid range: "+e);return+e}var a=+i[0],l=+i[1];if(o(a)||o(l)||a<t.min||l>t.max)throw new Error("Constraint error, got range "+a+"-"+l+" expected range "+t.min+"-"+t.max);if(a>=l)throw new Error("Invalid range: "+e);var s=+n;if(o(s)||s<=0)throw new Error("Constraint error, cannot repeat at every "+s+" time.");for(var u=a,c=l;u<=c;u++)s>0&&s%n===0?(s=1,r.push(u)):s++;return r}return o(+e)?e:+e}return-1!==n.indexOf("*")?n=n.replace(/\*/g,t.min+"-"+t.max):-1!==n.indexOf("?")&&(n=n.replace(/\?/g,t.min+"-"+t.max)),function(n){var r=[];function l(n){if(n instanceof Array)for(var i=0,a=n.length;i<a;i++){var l=n[i];if("string"===typeof l&&t.chars.indexOf(l)>-1)r.push(l);else{if("number"!==typeof l||o(l)||l<t.min||l>t.max)throw new Error("Constraint error, got value "+l+" expected range "+t.min+"-"+t.max);r.push(l)}}else{if("string"===typeof n&&t.chars.indexOf(n)>-1)return void r.push(n);var s=+n;if(o(s)||s<t.min||s>t.max)throw new Error("Constraint error, got value "+n+" expected range "+t.min+"-"+t.max);"dayOfWeek"===e&&(s%=7),r.push(s)}}var s=n.split(",");if(!s.every((function(e){return e.length>0})))throw new Error("Invalid list value format");if(s.length>1)for(var u=0,c=s.length;u<c;u++)l(i(s[u]));else l(i(n));return r.sort(a._sortCompareFn),r}(n)},a._sortCompareFn=function(e,n){var t="number"===typeof e,r="number"===typeof n;return t&&r?e-n:!t&&r?1:t&&!r?-1:e.localeCompare(n)},a._handleMaxDaysInMonth=function(e){if(1===e.month.length){var n=a.daysInMonth[e.month[0]-1];if(e.dayOfMonth[0]>n)throw new Error("Invalid explicit day of month definition");return e.dayOfMonth.filter((function(e){return"L"===e||e<=n})).sort(a._sortCompareFn)}},a._freezeFields=function(e){for(var n=0,t=a.map.length;n<t;++n){var r=a.map[n],o=e[r];e[r]=Object.freeze(o)}return Object.freeze(e)},a.prototype._applyTimezoneShift=function(e,n,t){if("Month"===t||"Day"===t){var r=e.getTime();e[n+t](),r===e.getTime()&&(0===e.getMinutes()&&0===e.getSeconds()?e.addHour():59===e.getMinutes()&&59===e.getSeconds()&&e.subtractHour())}else{var o=e.getHours();e[n+t]();var i=e.getHours(),a=i-o;2===a?24!==this.fields.hour.length&&(this._dstStart=i):0===a&&0===e.getMinutes()&&0===e.getSeconds()&&24!==this.fields.hour.length&&(this._dstEnd=i)}},a.prototype._findSchedule=function(e){function n(e,n){for(var t=0,r=n.length;t<r;t++)if(n[t]>=e)return n[t]===e;return n[0]===e}function t(e,n){if(n<6){if(e.getDate()<8&&1===n)return!0;var t=e.getDate()%7?1:0,r=e.getDate()-e.getDate()%7;return Math.floor(r/7)+t===n}return!1}for(var o,i=(e=e||!1)?"subtract":"add",l=new r(this._currentDate,this._tz),s=this._startDate,u=this._endDate,c=l.getTime(),d=0;d<1e4;){if(d++,e){if(s&&l.getTime()-s.getTime()<0)throw new Error("Out of the timespan range")}else if(u&&u.getTime()-l.getTime()<0)throw new Error("Out of the timespan range");var f=n(l.getDate(),this.fields.dayOfMonth);(o=this.fields.dayOfMonth).length>0&&o.indexOf("L")>=0&&(f=f||l.isLastDayOfMonth());var p=n(l.getDay(),this.fields.dayOfWeek),h=this.fields.dayOfMonth.length>=a.daysInMonth[l.getMonth()],v=this.fields.dayOfWeek.length===a.constraints[5].max-a.c
1onstraints[5].min+1,m=l.getHours();if(f||p)if(h||!v||f)if(!h||v||p)if(this._nthDayOfWeek>0&&!t(l,this._nthDayOfWeek))this._applyTimezoneShift(l,i,"Day");else if(n(l.getMonth()+1,this.fields.month)){if(n(m,this.fields.hour)){if(this._dstEnd===m&&!e){this._dstEnd=null,this._applyTimezoneShift(l,"add","Hour");continue}}else{if(this._dstStart!==m){this._dstStart=null,this._applyTimezoneShift(l,i,"Hour");continue}if(!n(m-1,this.fields.hour)){l[i+"Hour"]();continue}}if(n(l.getMinutes(),this.fields.minute))if(n(l.getSeconds(),this.fields.second)){if(c!==l.getTime())break;"add"===i||0===l.getMilliseconds()?this._applyTimezoneShift(l,i,"Second"):l.setMilliseconds(0)}else this._applyTimezoneShift(l,i,"Second");else this._applyTimezoneShift(l,i,"Minute")}else this._applyTimezoneShift(l,i,"Month");else this._applyTimezoneShift(l,i,"Day");else this._applyTimezoneShift(l,i,"Day");else this._applyTimezoneShift(l,i,"Day")}if(d>=1e4)throw new Error("Invalid expression, loop limit exceeded");return this._currentDate=new r(l,this._tz),this._hasIterated=!0,l},a.prototype.next=function(){var e=this._findSchedule();return this._isIterator?{value:e,done:!this.hasNext()}:e},a.prototype.prev=function(){var e=this._findSchedule(!0);return this._isIterator?{value:e,done:!this.hasPrev()}:e},a.prototype.hasNext=function(){var e=this._currentDate,n=this._hasIterated;try{return this._findSchedule(),!0}catch(t){return!1}finally{this._currentDate=e,this._hasIterated=n}},a.prototype.hasPrev=function(){var e=this._currentDate,n=this._hasIterated;try{return this._findSchedule(!0),!0}catch(t){return!1}finally{this._currentDate=e,this._hasIterated=n}},a.prototype.iterate=function(e,n){var t=[];if(e>=0)for(var r=0,o=e;r<o;r++)try{var i=this.next();t.push(i),n&&n(i,r)}catch(a){break}else for(r=0,o=e;r>o;r--)try{i=this.prev();t.push(i),n&&n(i,r)}catch(a){break}return t},a.prototype.reset=function(e){this._currentDate=new r(e||this._options.currentDate)},a.prototype.stringify=function(e){for(var n=[],t=e?0:1,r=a.map.length;t<r;++t){var o=a.map[t],l=this.fields[o],s=a.constraints[t];n.push(i(l,s.min,s.max))}return n.join(" ")},a.parse=function(e,n){var t=this;function i(e,n){n||(n={}),"undefined"===typeof n.currentDate&&(n.currentDate=new r(void 0,t._tz)),a.predefined[e]&&(e=a.predefined[e]);var i=[],l=(e+"").trim().split(/\s+/);if(l.length>6)throw new Error("Invalid cron expression");for(var s=a.map.length-l.length,u=0,c=a.map.length;u<c;++u){var d=a.map[u],f=l[l.length>c?u:u-s];if(u<s||!f)i.push(a._parseField(d,a.parseDefaults[u],a.constraints[u]));else{var p="dayOfWeek"===d?m(f):f;i.push(a._parseField(d,p,a.constraints[u]))}}var h={};for(u=0,c=a.map.length;u<c;u++){h[a.map[u]]=i[u]}var v=a._handleMaxDaysInMonth(h);return h.dayOfMonth=v||h.dayOfMonth,new a(h,n);function m(e){var t=e.split("#");if(t.length>1){var r=+t[t.length-1];if(/,/.test(e))throw new Error("Constraint error, invalid dayOfWeek `#` and `,` special characters are incompatible");if(/\//.test(e))throw new Error("Constraint error, invalid dayOfWeek `#` and `/` special characters are incompatible");if(/-/.test(e))throw new Error("Constraint error, invalid dayOfWeek `#` and `-` special characters are incompatible");if(t.length>2||o(r)||r<1||r>5)throw new Error("Constraint error, invalid dayOfWeek occurrence number (#)");return n.nthDayOfWeek=r,t[0]}return e}}return"function"===typeof n&&(n={}),i(e,n)},a.fieldsToExpression=function(e,n){function t(e,n,t){if(!n)throw new Error("Validation error, Field "+e+" is missing");if(0===n.length)throw new Error("Validation error, Field "+e+" contains no values");for(var r=0,i=n.length;r<i;r++){var a=n[r];if(!("string"===typeof a&&t.chars.indexOf(a)>-1)&&("number"!==typeof a||o(a)||a<t.min||a>t.max))throw new Error("Constraint error, got value "+a+" expected range "+t.min+"-"+t.max)}}for(var r={},i=0,l=a.map.length;i<l;++i){var s=a.map[i],u=e[s];t(s,u,a.constraints[i]);for(var c=[],d=-1;++d<u.length;)c[d]=u[d];if((u=c.sort(a._sortCompareFn).filter((function(e,n,t){return!n||e!==t[n-1]}))).length!==c.length)throw new Error("Validation error, Field "+s+" contains duplicate values");r[s]=u}var f=a._handleMaxDaysInMonth(r);return r.dayOfMonth=f||r.dayOfMonth,new a(r,n||{})},e.exports=a},7156:function(e){"use strict";function n(e){return{start:e,count:1}}function t(e,n){e.end=n,e.step=n-e.start,e.count=2}function r(e,t,r){t&&(2===t.count?(e.push(n(t.start)),e.push(n(t.end))):e.push(t)),r&&e.push(r)}e.exports=function(e){for(var o=[],i=void 0,a=0;a<e.length;a++){var l=e[a];"number"!==typeof l?(r(o,i,n(l)),i=void 0):i?1===i.count?t(i,l):i.step===l-i.end?(i.count++,i.end=l):2===i.count?(o.push(n(i.start)),t(i=n(i.end),l)):(r(o,i),i=n(l)):i=n(l)}return r(o,i),o}},69661:function(e,n,t){"use strict";var r=t(7156);e.exports=function(e,n,t){var o=r(e);
1if(1===o.length){var i=o[0];if(1===(u=i.step)&&i.start===n&&i.end===t)return"*";if(1!==u&&i.start===n&&i.end===t-u+1)return"*/"+u}for(var a=[],l=0,s=o.length;l<s;++l){var u,c=o[l];if(1===c.count)a.push(c.start);else 1===(u=c.step)?a.push(c.start+"-"+c.end):c.end===t-u+1?a.push(c.start+"/"+u):a.push(c.start+"-"+c.end+"/"+u)}return a.join(",")}},63601:function(e,n,t){"use strict";var r=t(72249);function o(){}o._parseEntry=function(e){var n=e.split(" ");if(6===n.length)return{interval:r.parse(e)};if(n.length>6)return{interval:r.parse(n.slice(0,6).join(" ")),command:n.slice(6,n.length)};throw new Error("Invalid entry: "+e)},o.parseExpression=function(e,n){return r.parse(e,n)},o.fieldsToExpression=function(e,n){return r.fieldsToExpression(e,n)},o.parseString=function(e){for(var n=e.split("\n"),t={variables:{},expressions:[],errors:{}},r=0,i=n.length;r<i;r++){var a=null,l=n[r].trim();if(l.length>0){if(l.match(/^#/))continue;if(a=l.match(/^(.*)=(.*)$/))t.variables[a[1]]=a[2];else{var s=null;try{s=o._parseEntry("0 "+l),t.expressions.push(s.interval)}catch(u){t.errors[l]=u}}}}return t},o.parseFile=function(e,n){t(16831).readFile(e,(function(e,t){if(!e)return n(null,o.parseString(t.toString()));n(e)}))},e.exports=o},14926:function(e,n,t){"use strict";var r=t(33464),o="function"===typeof Symbol&&"symbol"===typeof Symbol("foo"),i=Object.prototype.toString,a=Array.prototype.concat,l=t(75195),s=t(81181)(),u=function(e,n,t,r){if(n in e)if(!0===r){if(e[n]===t)return}else if("function"!==typeof(o=r)||"[object Function]"!==i.call(o)||!r())return;var o;s?l(e,n,t,!0):l(e,n,t)},c=function(e,n){var t=arguments.length>2?arguments[2]:{},i=r(n);o&&(i=a.call(i,Object.getOwnPropertySymbols(n)));for(var l=0;l<i.length;l+=1)u(e,i[l],n[i[l]],t[i[l]])};c.supportsDescriptors=!!s,e.exports=c},43556:function(e,n){"use strict";var t,r;n.ux=n.YO=n.Mi=void 0,function(e){e.INSERT="insert",e.DELETE="delete",e.CONTEXT="context"}(t||(t={})),n.Mi={LINE_BY_LINE:"line-by-line",SIDE_BY_SIDE:"side-by-side"},n.YO={LINES:"lines",WORDS:"words",NONE:"none"},function(e){e.AUTO="auto",e.DARK="dark",e.LIGHT="light"}(r||(n.ux=r={}))},2148:function(e,n){!function(e){var n=/\S/,t=/\"/g,r=/\n/g,o=/\r/g,i=/\\/g,a=/\u2028/,l=/\u2029/;function s(e){"}"===e.n.substr(e.n.length-1)&&(e.n=e.n.substring(0,e.n.length-1))}function u(e){return e.trim?e.trim():e.replace(/^\s*|\s*$/g,"")}function c(e,n,t){if(n.charAt(t)!=e.charAt(0))return!1;for(var r=1,o=e.length;r<o;r++)if(n.charAt(t+r)!=e.charAt(r))return!1;return!0}e.tags={"#":1,"^":2,"<":3,$:4,"/":5,"!":6,">":7,"=":8,_v:9,"{":10,"&":11,_t:12},e.scan=function(t,r){var o=t.length,i=0,a=null,l=null,d="",f=[],p=!1,h=0,v=0,m="{{",g="}}";function x(){d.length>0&&(f.push({tag:"_t",text:new String(d)}),d="")}function b(t,r){if(x(),t&&function(){for(var t=!0,r=v;r<f.length;r++)if(!(t=e.tags[f[r].tag]<e.tags._v||"_t"==f[r].tag&&null===f[r].text.match(n)))return!1;return t}())for(var o,i=v;i<f.length;i++)f[i].text&&((o=f[i+1])&&">"==o.tag&&(o.indent=f[i].text.toString()),f.splice(i,1));else r||f.push({tag:"\n"});p=!1,v=f.length}function y(e,n){var t="="+g,r=e.indexOf(t,n),o=u(e.substring(e.indexOf("=",n)+1,r)).split(" ");return m=o[0],g=o[o.length-1],r+t.length-1}for(r&&(r=r.split(" "),m=r[0],g=r[1]),h=0;h<o;h++)0==i?c(m,t,h)?(--h,x(),i=1):"\n"==t.charAt(h)?b(p):d+=t.charAt(h):1==i?(h+=m.length-1,"="==(a=(l=e.tags[t.charAt(h+1)])?t.charAt(h+1):"_v")?(h=y(t,h),i=0):(l&&h++,i=2),p=h):c(g,t,h)?(f.push({tag:a,n:u(d),otag:m,ctag:g,i:"/"==a?p-m.length:h+g.length}),d="",h+=g.length-1,i=0,"{"==a&&("}}"==g?h++:s(f[f.length-1]))):d+=t.charAt(h);return b(p,!0),f};var d={_t:!0,"\n":!0,$:!0,"/":!0};function f(n,t,r,o){var i,a=[],l=null,s=null;for(i=r[r.length-1];n.length>0;){if(s=n.shift(),i&&"<"==i.tag&&!(s.tag in d))throw new Error("Illegal content in < super tag.");if(e.tags[s.tag]<=e.tags.$||p(s,o))r.push(s),s.nodes=f(n,s.tag,r,o);else{if("/"==s.tag){if(0===r.length)throw new Error("Closing tag without opener: /"+s.n);if(l=r.pop(),s.n!=l.n&&!h(s.n,l.n,o))throw new Error("Nesting error: "+l.n+" vs. "+s.n);return l.end=s.i,a}"\n"==s.tag&&(s.last=0==n.length||"\n"==n[0].tag)}a.push(s)}if(r.length>0)throw new Error("missing closing tag: "+r.pop().n);return a}function p(e,n){for(var t=0,r=n.length;t<r;t++)if(n[t].o==e.n)return e.tag="#",!0}function h(e,n,t){for(var r=0,o=t.length;r<o;r++)if(t[r].c==e&&t[r].o==n)return!0}function v(e){var n=[];for(var t in e.partials)n.push('"'+g(t)+'":{name:"'+g(e.partials[t].name)+'", '+v(e.partials[t])+"}");return"partials: {"+n.join(",")+"}, subs: "+function(e){var n=[];for(var t in e)n.push('"'+g(t)+'": function(c,p,t,i) {'+e[t]+"}");return"{ "+n.join(",")+" }"}(e.subs)}e.stringify=function(n,t,r){return"{code: function (c,p,i) { "+e.wrapMain(n.code)+" },"+v(n)+"}"};var m=0;function g(e){return e.replace(i,"\\\\").replace(t,'\\"').replace(r,"\\n").replace(o,"\\r").replace(a,"\\u2028").replace(l,"\\u2029")}function x(e){return~e.indexOf(".")?"d":"f"}function b(e,n){var t="<"+(n.prefix||"")+e.n+m++;return n.partials[t]={name:e.n,partials:{}},n.code+='t.b(t.rp("'+g(t)+'",c,p,"'+(e.indent||"")+'"));',t}function y(e,n){n.code+="t.b(t.t(t."+x(e.n)+'("'+g(e.n)+'",c,p,0)));'}function C(e){return"t.b("+e+");"}e.generate=function(n,t,r){m=0;var o={code:"",subs:{},partials:{}};return e.walk(n,o),r.asString?this.stringify(o,t,r):this.makeTemplate(o,t,r)},e.wrapMain=function(e){return'var t=this;t.b(i=i||"");'+e+"return t.fl();"},e.template=e.Template,e.makeTemplate=function(e,n,t){var r=this.makePartials(e);return r.code=new Function("c","p","i",this.wrapMain(e.code)),new this.template(r,n,this,t)},e.makePartials=function(e){var n,t={subs:{},partials:e.partials,name:e.name};for(n in t.partials)t.partials[n]=this.makePartials(t.partials[n]);for(n in e.subs)t.subs[n]=new Function("c","p","t","i",e.subs[n]);return t},e.codegen={"#":function(n,t){t.code+="if(t.s(t."+x(n.n)+'("'+g(n.n)+'",c,p,1),c,p,0,'+n.i+","+n.end+',"'+n.otag+" "+n.ctag+'")){t.rs(c,p,function(c,p,t){',e.walk(n.nodes,t),t.code+="});c.pop();}"},"^":function(n,t){t.code+="if(!t.s(t."+x(n.n)+'("'+g(n.n)+'",c,p,1),c,p,1,0,0,"")){',e.walk(n.nodes,t),t.code+="};"},">":b,"<":function(n,t){var r={partials:{}
1,code:"",subs:{},inPartial:!0};e.walk(n.nodes,r);var o=t.partials[b(n,t)];o.subs=r.subs,o.partials=r.partials},$:function(n,t){var r={subs:{},code:"",partials:t.partials,prefix:n.n};e.walk(n.nodes,r),t.subs[n.n]=r.code,t.inPartial||(t.code+='t.sub("'+g(n.n)+'",c,p,i);')},"\n":function(e,n){n.code+=C('"\\n"'+(e.last?"":" + i"))},_v:function(e,n){n.code+="t.b(t.v(t."+x(e.n)+'("'+g(e.n)+'",c,p,0)));'},_t:function(e,n){n.code+=C('"'+g(e.text)+'"')},"{":y,"&":y},e.walk=function(n,t){for(var r,o=0,i=n.length;o<i;o++)(r=e.codegen[n[o].tag])&&r(n[o],t);return t},e.parse=function(e,n,t){return f(e,0,[],(t=t||{}).sectionTags||[])},e.cache={},e.cacheKey=function(e,n){return[e,!!n.asString,!!n.disableLambda,n.delimiters,!!n.modelGet].join("||")},e.compile=function(n,t){t=t||{};var r=e.cacheKey(n,t),o=this.cache[r];if(o){var i=o.partials;for(var a in i)delete i[a].instance;return o}return o=this.generate(this.parse(this.scan(n,t.delimiters),n,t),n,t),this.cache[r]=o}}(n)},50112:function(e,n,t){var r=t(2148);r.Template=t(5253).Template,r.template=r.Template,e.exports=r},5253:function(e,n){!function(e){function n(e,n,t){var r;return n&&"object"==typeof n&&(void 0!==n[e]?r=n[e]:t&&n.get&&"function"==typeof n.get&&(r=n.get(e))),r}e.Template=function(e,n,t,r){e=e||{},this.r=e.code||this.r,this.c=t,this.options=r||{},this.text=n||"",this.partials=e.partials||{},this.subs=e.subs||{},this.buf=""},e.Template.prototype={r:function(e,n,t){return""},v:function(e){return e=s(e),l.test(e)?e.replace(t,"&amp;").replace(r,"&lt;").replace(o,"&gt;").replace(i,"&#39;").replace(a,"&quot;"):e},t:s,render:function(e,n,t){return this.ri([e],n||{},t)},ri:function(e,n,t){return this.r(e,n,t)},ep:function(e,n){var t=this.partials[e],r=n[t.name];if(t.instance&&t.base==r)return t.instance;if("string"==typeof r){if(!this.c)throw new Error("No compiler available.");r=this.c.compile(r,this.options)}if(!r)return null;if(this.partials[e].base=r,t.subs){for(key in n.stackText||(n.stackText={}),t.subs)n.stackText[key]||(n.stackText[key]=void 0!==this.activeSub&&n.stackText[this.activeSub]?n.stackText[this.activeSub]:this.text);r=function(e,n,t,r,o,i){function a(){}function l(){}var s;a.prototype=e,l.prototype=e.subs;var u=new a;for(s in u.subs=new l,u.subsText={},u.buf="",r=r||{},u.stackSubs=r,u.subsText=i,n)r[s]||(r[s]=n[s]);for(s in r)u.subs[s]=r[s];for(s in o=o||{},u.stackPartials=o,t)o[s]||(o[s]=t[s]);for(s in o)u.partials[s]=o[s];return u}(r,t.subs,t.partials,this.stackSubs,this.stackPartials,n.stackText)}return this.partials[e].instance=r,r},rp:function(e,n,t,r){var o=this.ep(e,t);return o?o.ri(n,t,r):""},rs:function(e,n,t){var r=e[e.length-1];if(u(r))for(var o=0;o<r.length;o++)e.push(r[o]),t(e,n,this),e.pop();else t(e,n,this)},s:function(e,n,t,r,o,i,a){var l;return(!u(e)||0!==e.length)&&("function"==typeof e&&(e=this.ms(e,n,t,r,o,i,a)),l=!!e,!r&&l&&n&&n.push("object"==typeof e?e:n[n.length-1]),l)},d:function(e,t,r,o){var i,a=e.split("."),l=this.f(a[0],t,r,o),s=this.options.modelGet,c=null;if("."===e&&u(t[t.length-2]))l=t[t.length-1];else for(var d=1;d<a.length;d++)void 0!==(i=n(a[d],l,s))?(c=l,l=i):l="";return!(o&&!l)&&(o||"function"!=typeof l||(t.push(c),l=this.mv(l,t,r),t.pop()),l)},f:function(e,t,r,o){for(var i=!1,a=!1,l=this.options.modelGet,s=t.length-1;s>=0;s--)if(void 0!==(i=n(e,t[s],l))){a=!0;break}return a?(o||"function"!=typeof i||(i=this.mv(i,t,r)),i):!o&&""},ls:function(e,n,t,r,o){var i=this.options.delimiters;return this.options.delimiters=o,this.b(this.ct(s(e.call(n,r)),n,t)),this.options.delimiters=i,!1},ct:function(e,n,t){if(this.options.disableLambda)throw new Error("Lambda features disabled.");return this.c.compile(e,this.options).render(n,t)},b:function(e){this.buf+=e},fl:function(){var e=this.buf;return this.buf="",e},ms:function(e,n,t,r,o,i,a){var l,s=n[n.length-1],u=e.call(s);return"function"==typeof u?!!r||(l=this.activeSub&&this.subsText&&this.subsText[this.activeSub]?this.subsText[this.activeSub]:this.text,this.ls(u,s,t,l.substring(o,i),a)):u},mv:function(e,n,t){var r=n[n.length-1],o=e.call(r);return"function"==typeof o?this.ct(s(o.call(r)),r,t):o},sub:function(e,n,t,r){var o=this.subs[e];o&&(this.activeSub=e,o(n,t,this,r),this.activeSub=!1)}};var t=/&/g,r=/</g,o=/>/g,i=/\'/g,a=/\"/g,l=/[&<>\"\']/;function s(e){return String(null===e||void 0===e?"":e)}var u=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}}(n)},37053:function(e){"use strict";e.exports=function(e){return e!==e}},74782:function(e,n,t){"use strict";var r=t(89429),o=t(14926),i=t(37053),a=t(40755),l=t(55346),s=r(a(),Number);o(s,{getPolyfill:a,implementation:i,shim:l}),e.exports=s},40755:function(e,n,t){"use strict";var r=t(37053);e.exports=function(){return Number.isNaN&&Number.isNaN(NaN)&&!Number.isNaN("a")?Number.isNaN:r}},55346:function(e,n,t){"use strict";var r=t(14926),o=t(40755);e.exports=function(){var e=o();return r(Number,{isNaN:e},{isNaN:function(){return Number.isNaN!==e}}),e}},63141:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/automations/[id]/design",function(){return t(6714)}])},37498:function(e,n,t){"use strict";var r=t(52322),o=(t(2784),t(82737));n.Z=function(e){var n=e.showWorkspaceSelect,t=e.tenantOptions,i=e.selectedTenantOption,a=e.onSelectTenant,l=e.destinationEnvOptions,s=e.selectedDestinationEnv,u=e.onSelectDestinationEnv,c=e.loadingEnvironments,d=e.migrationRunning,f=void 0!==d&&d,p=(0,r.jsx)(o.Z,{label:"Destination environment",labelForOptions:"label",onCh
1ange:u,options:l,value:s,valueForOptions:"value",clearable:!1,placeholder:"Select environment",disabled:f||c||0===l.length,listboxPortal:!0,openDropdownOnFocus:!1}),h="w-[min(230px,35%)] shrink-0";return(0,r.jsxs)("div",{className:"mt-2 flex w-full min-w-0 flex-col gap-4",children:[(0,r.jsxs)("div",{className:"flex w-full min-w-0 flex-row flex-wrap items-end justify-start gap-x-6 gap-y-4",children:[n&&(0,r.jsx)("div",{className:h,children:(0,r.jsx)(o.Z,{label:"Destination workspace",labelForOptions:"label",onChange:a,options:t,value:i,valueForOptions:"value",clearable:!0,placeholder:"Select workspace",disabled:f,listboxPortal:!0,openDropdownOnFocus:!1})}),(0,r.jsx)("div",{className:h,children:p})]}),(0,r.jsx)("div",{className:"h-[1px] w-full bg-neutral-200 dark:bg-neutral-700"})]})}},63227:function(e,n,t){"use strict";t.d(n,{eO:function(){return s},iu:function(){return l}});var r=t(50930),o=t(52322),i=t(19557),a="An unexpected error occurred. Please try again.";function l(e){return function(e){var n;if(!e||"object"!==typeof e)return!1;var t,o,i=e;return(0,r.Z)(null!==(t=i.graphQLErrors)&&void 0!==t?t:[]).concat((0,r.Z)(null!==(o=null===(n=i.response)||void 0===n?void 0:n.errors)&&void 0!==o?o:[])).some((function(e){var n;return"FORBIDDEN"===(null===e||void 0===e||null===(n=e.extensions)||void 0===n?void 0:n.code)}))}(e)?"You don't have permission to publish in the destination workspace or environment. Pick another destination, or ask an administrator for publish access there.":a}function s(e){var n=e.show,t=e.message,r=void 0===t?a:t;return(0,o.jsx)("div",{className:"flex min-h-6 w-full shrink-0 items-center justify-end",children:n?(0,o.jsx)(i.default,{variant:"regular-sm",className:"max-w-full text-right font-medium text-button-red",children:r}):null})}},85745:function(e,n,t){"use strict";t.d(n,{X:function(){return o},p:function(){return i}});var r=t(52322),o=(t(2784),"!w-[min(720px,calc(100vw-1.5rem))] !max-w-[720px]");function i(e){var n=e.size,t=void 0===n?"wide":n,o=e.children,i=e.footer,a="compact"===t?"w-full min-w-0 max-w-[720px]":"w-[min(1190px,calc(100vw-1.5rem))] max-w-[1190px] min-w-0";return(0,r.jsxs)("div",{className:"flex max-h-[min(90vh,calc(100vh-2rem))] flex-col overflow-hidden bg-background-panels text-start ".concat(a),children:[(0,r.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto px-6 pt-4",children:o}),(0,r.jsx)("div",{className:"shrink-0 border-t border-neutral-200/90 bg-background-panels px-6 py-4 dark:border-neutral-700",children:i})]})}},81321:function(e,n,t){"use strict";t.d(n,{D:function(){return C}});var r=t(52322),o=t(37498),i=t(63227),a=t(85745),l=t(22063),s=t(19557),u=t(98788),c=t(22970),d=t(64685),f=t(13242),p=t(2784),h=t(6965),v=t(14310),m=t(62208),g=t(11611),x=t(1654),b=t(55401),y=t(85390);var C=function(e){var n=e.templateId,t=e.templateName,C=e.close,j=function(e){var n=e.templateId,t=e.close,r=(0,y.t)(),o=(0,f.mu)(n),a=(0,x.Z)((function(e){return e.automationTemplates.canPublishItem(n)})),l=(0,d.nt)(),s=l.selectedEnvironmentId,C=l.environments,j=(0,v.S)(),w=j.tenants,N=j.tenant,S=(0,p.useState)(null===N||void 0===N?void 0:N.id),k=S[0],_=S[1];(0,p.useEffect)((function(){(null===N||void 0===N?void 0:N.id)&&_((function(e){return null!==e&&void 0!==e?e:N.id}))}),[null===N||void 0===N?void 0:N.id]);var Z=(0,g.o)({destinationWorkspaceId:null!==k&&void 0!==k?k:null===N||void 0===N?void 0:N.id,currentWorkspaceId:null===N||void 0===N?void 0:N.id,currentWorkspaceEnvironments:C}),E=Z.environments,I=Z.loadingRemoteEnvironments,O=Z.remoteEnvironmentsError,T=Boolean(k&&(null===N||void 0===N?void 0:N.id)&&k===N.id),A=(0,m.Kb)(s,E,{sameWorkspaceAsSource:T}),D=(0,m.Xh)(A),L=(0,p.useState)((function(){return(0,m.ho)(s,C,{sameWorkspaceAsSource:!0})})),M=L[0],P=L[1];(0,p.useEffect)((function(){if(!I){var e=(0,m.ho)(s,E,{sameWorkspaceAsSource:T});e?null!==M&&(0,m.tP)(s,M,E,{sameWorkspaceAsSource:T})||P(e):P(null)}}),[s,M,E,I,T]);var R=(0,p.useState)(!1),F=R[0],z=R[1],B=(0,p.useState)(!1),H=B[0],V=B[1],$=(0,p.useState)(void 0),U=$[0],W=$[1],q=(0,p.useMemo)((function(){return w.map((function(e){return{label:(null===N||void 0===N?void 0:N.id)===e.tenantId?"".concat(e.name," (current)"):e.name,value:e.tenantId}}))}),[w,null===N||void 0===N?void 0:N.id]),K=q.find((function(e){return e.value===k})),G=D.find((function(e){return e.value===M})),J=a&&Boolean(M&&k)&&!I&&!O&&A.length>0,X=function(){var e=(0,u.Z)((function(){var e,a;return(0,c.__generator)(this,(function(l){switch(l.label){case 0:if(!J||!k||!M)return[2];e=(0,h.R5)(k,M),V(!1),z(!0),l.label=1;case 1:return l.trys.push([1,3,4,5]),[4,o(e)];case 2:return l.sent(),t(),r.assetMigrationSucceeded({type:"automation",destinationPath:(0,b.vs)(k,M,n)}),[3,5];case 3:return a=l.sent(),console.error(a),W((0,i.iu)(a)),V(!0),[3,5];case 4:return z(!1),[7];case 5:return[2]}}
1))}));return function(){return e.apply(this,arguments)}}();return{copyInProgress:F,copyActionFailed:H,copyErrorMessage:U,migrationReady:J,remoteEnvironmentsError:O,loadingRemoteEnvironments:I,destinationEnvCandidates:A,tenantOptions:q,selectedTenantOption:K,destinationEnvOptions:D,selectedDestinationEnvOption:G,destinationEnv:M,setDestinationEnv:P,currentTenant:N,selectedWorkspaceId:k,handleCopy:X,handleSelectTenant:function(e){_(e?e.value:null===N||void 0===N?void 0:N.id)},tenantsLength:w.length}}({templateId:n,close:C}),w=j.copyInProgress,N=j.copyActionFailed,S=j.copyErrorMessage,k=j.migrationReady,_=j.remoteEnvironmentsError,Z=j.loadingRemoteEnvironments,E=j.destinationEnvCandidates,I=j.tenantOptions,O=j.selectedTenantOption,T=j.destinationEnvOptions,A=j.selectedDestinationEnvOption,D=j.setDestinationEnv,L=j.selectedWorkspaceId,M=j.handleCopy,P=j.handleSelectTenant,R=j.tenantsLength,F=(0,r.jsxs)("div",{className:"flex w-full flex-col gap-2",children:[(0,r.jsx)(i.eO,{show:N,message:S}),(0,r.jsxs)("div",{className:"flex w-full flex-wrap items-center justify-between gap-4",children:[(0,r.jsx)(l.default,{variant:"default",disabled:w,onClick:C,children:"Close"}),(0,r.jsx)("div",{className:"flex flex-wrap items-center justify-end gap-2",children:(0,r.jsx)(l.default,{variant:"brand",disabled:!k||w,loading:w,onClick:M,children:"Copy and publish"})})]})]}),z=(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(o.Z,{showWorkspaceSelect:R>1,tenantOptions:I,selectedTenantOption:O,onSelectTenant:P,destinationEnvOptions:T,selectedDestinationEnv:A,onSelectDestinationEnv:function(e){e&&D(e.value)},loadingEnvironments:Z,migrationRunning:w}),_&&(0,r.jsx)(s.default,{variant:"regular-sm",className:"archived",children:_.message}),!_&&!Z&&Boolean(L)&&0===E.length&&(0,r.jsx)(s.default,{variant:"regular-sm",className:"text-subtext",children:"No other environment is available in the selected workspace."})]});return(0,r.jsx)(a.p,{size:"compact",footer:F,children:(0,r.jsx)("div",{className:"flex min-h-0 flex-1 flex-col gap-5",children:(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,r.jsxs)(s.default,{variant:"semibold-lg",className:"text-foreground-default",children:["Migrate template: ",t]}),z,(0,r.jsx)(s.default,{variant:"regular-sm",className:"max-w-3xl text-subtext",children:"Copy the latest published version of this automation into the workspace and environment you choose above. An existing published version in the destination is overwritten."})]})})})}},50406:function(e,n,t){"use strict";t.d(n,{z:function(){return r}});var r=t(98767).default},40366:function(e,n,t){"use strict";t.d(n,{m:function(){return T}});var r=t(47842),o=t(42838),i=t(70865),a=t(96670),l=t(87394),s=t(52322),u=t(2784),c=t(59901),d=t(1899),f=function(e){if(null===e)return"null";switch("undefined"===typeof e?"undefined":(0,d.Z)(e)){case"number":case"bigint":case"boolean":return e.toString();case"object":return(0,o.Z)(e,Array)?"[]":"{}";case"string":return e;default:return""}},p=function(e){if(null===e)return"null";switch("undefined"===typeof e?"undefined":(0,d.Z)(e)){case"string":default:return"string";case"number":case"bigint":return"number";case"object":return Array.isArray(e)?"array":"object";case"boolean":return"boolean";case"undefined":return"null"}},h=function(e,n,t){var r={};for(var o in e)o===n?r[t]=e[o]:r[o]=e[o];return r},v={string:"",number:0,object:{},array:[],boolean:!1,null:null},m=[{value:"string",label:"String"},{value:"number",label:"Number"},{value:"object",label:"Object"},{value:"array",label:"Array"},{value:"boolean",label:"Boolean"},{value:"null",label:"Null"}],g=[{value:"string",label:"String"},{value:"number",label:"Number"},{value:"boolean",label:"Boolean"},{value:"null",label:"Null"}],x=t(38617),b=t(19557),y=t(18005),C=function(e){var n=e.json,t=e.onChange,r=e.canExpand,o=(0,u.useState)(JSON.stringify(n,null,2)),i=o[0],a=o[1],l=(0,u.useState)(!0),c=l[0],d=l[1];(0,u.useEffect)((function(){return a(JSON.stringify(n,null,2))}),[n]);var f=(0,x.F)().resolvedTheme;return(0,s.jsxs)("div",{className:"flex flex-col gap-xl",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(b.default,{variant:"regular-md",className:"block text-header",children:"JSON Editor"}),!c&&(0,s.jsx)(b.default,{variant:"regular-xs",className:"block text-red",children:"JSON is invali
1d. Will not save until valid."})]}),(0,s.jsx)("div",{className:"rounded-md border border-solid border-structure-border",children:(0,s.jsx)(y.SyntaxHighlighter,{canExpand:null!==r&&void 0!==r&&r,themeType:f,value:i,onChange:function(e){a(e);try{t(JSON.parse(e)),d(!0)}catch(n){d(!1)}},options:{readOnly:!1}})})]})},j=t(56982),w=t(10929),N=function(e){var n=e.innerKey,t=e.handleNestedFieldRowClick,r=e.json,o=e.jsonKey,i=e.handleDeleteNestedField,a=e.type,l=e.isSelected;return(0,s.jsx)(s.Fragment,{children:(0,s.jsxs)("div",{onClick:function(){return t(o,n)},className:(0,w.cx)("flex h-[44px] items-center border-0 border-b border-solid border-structure-default first:rounded-t-md last:rounded-b-md last:border-b-0",l?"bg-background-active-link":"odd:bg-table-row-odd even:bg-table-row-even"),children:[(0,s.jsx)(b.default,{variant:"regular-sm",className:"w-[119.5px] truncate border-0 border-r border-solid border-structure-default py-md pl-8 pr-lg text-content",children:"object"===a&&(""===n?"-":n)}),(0,s.jsx)(b.default,{variant:"regular-sm",className:"flex w-[119.5px] truncate border-0 border-r border-solid border-structure-default py-md pl-8 pr-lg text-content",children:""===f(r[o][n])?"-":f(r[o][n])}),(0,s.jsx)("div",{className:"flex h-[44px] min-w-[53px] max-w-[53px] items-center justify-center",children:(0,s.jsx)(j.X,{className:"h-6 w-6 cursor-pointer text-icon-default",onClick:function(e){e.stopPropagation(),i(o,n)}})})]})})},S=function(e){var n=e.json,t=e.jsonKey,r=e.handleDeleteField,o=e.handleFieldRowClick,i=e.handleNestedFieldRowClick,a=e.handleDeleteNestedField,u=e.isSelected,c=e.selectedNestedField;if(void 0!==n[t]){var d=p(n[t]);return(0,s.jsxs)(s.Fragment,{children:["object"!==d&&"array"!==d&&(0,s.jsx)(_,{isSelected:u,json:n,jsonKey:t,handleFieldRowClick:o,handleDeleteField:r}),("object"===d||"array"===d)&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(_,{isSelected:u,json:n,jsonKey:t,handleFieldRowClick:o,handleDeleteField:r}),Object.entries(n[t]).map((function(e,r){var o=(0,l.Z)(e,1)[0];return(0,s.jsx)(N,{json:n,jsonKey:t,innerKey:o,handleNestedFieldRowClick:i,handleDeleteNestedField:a,type:d,isSelected:c===o},r)}))]})]})}},k=function(e){var n=e.json,t=e.jsonKey,r=e.handleDeleteField;return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(b.default,{variant:"regular-sm",className:"w-[119.5px] truncate border-0 border-r border-solid border-structure-default px-lg py-md text-content",children:""===t?"-":t}),(0,s.jsx)(b.default,{variant:"regular-sm",className:"w-[119.5px] truncate border-0 border-r border-solid border-structure-default px-lg py-md text-content",children:""===f(n[t])?"-":f(n[t])}),(0,s.jsx)("div",{className:"flex h-[44px] min-w-[53px] max-w-[53px] items-center justify-center",children:(0,s.jsx)(j.X,{className:"h-6 w-6 cursor-pointer text-icon-default",onClick:function(e){e.stopPropagation(),r(t)}})})]})},_=function(e){var n=e.json,t=e.jsonKey,r=e.handleFieldRowClick,o=e.handleDeleteField,i=e.isSelected;return(0,s.jsx)("div",{className:(0,w.cx)("group flex h-[44px] items-center border-0 border-b border-solid border-structure-default first:rounded-t-md last:rounded-b-md",i?"bg-background-active-link":"odd:bg-table-row-odd even:bg-table-row-even"),onClick:function(){return r(t)},children:(0,s.jsx)(k,{json:n,jsonKey:t,handleDeleteField:o})})},Z=t(22063),E=t(43827),I=t(81797),O=function(e){var n=e.name,t=e.outerType,r=e.type,o=e.typeOptions,i=e.value,a=e.onValueChange,l=e.onNameChange;return(0,s.jsxs)("div",{className:"flex flex-col gap-xl bg-background-panels",children:[(0,s.jsx)(b.default,{variant:"regular-md",className:"text-header",children:"Edit field"}),(0,s.jsx)(E.Z,{label:"Type",labelForOptions:"label",valueForOptions:"value",options:o,value:r,onChange:function(e){var n=e.value;return a(v[n])}}),"array"!==t&&(0,s.jsx)(I.default,{label:"Name",placeholder:"-",value:n,onChange:function(e){return l(e.target.value)}}),"boolean"===r?(0,s.jsx)(E.Z,{label:"Value",labelForOptions:"label",valueForOptions:"value",options:[{value:!0,label:"true"},{value:!1,label:"false"}],value:!!i,onChange:function(e){var n=e.value;return a(n)}}):"null"!==r&&"object"!==r&&"array"!==r&&(0,s.jsx)(I.default,{label:"Value",placeholder:"-",value:f(i),onChange:function(e){return a(function(n,t){switch(t){case"string":return n.toString?n.toString():null;case"number":return isNaN(parseInt(n))?null:parseInt(n);case"object":case"array":try{return JSON.parse(n)}catch(e){return null}case"boolean":return"true"===n;case"null":return null;default:return n}}(e.target.value,r))}})]})},T=function(e){var n=e.value,t=e.onChange,d=(0,c.BN)(t,500),f=(0,u.useState)({json:n}),x=f[0],y=f[1],j=(0,u.useState)(void 0),w=j[0],N=j[1],k=(0,u.useState)(void 0),_=k[0],E=k[1],I=x.json;(0,u.useEffect)((function(){y((function(e){return(0,a.Z)((0,i.Z)({},e),{json:n})}))}),[n]);var T=function(e){y((function(n){return(0,a.Z)((0,i.Z)({},n),{json:e})})),d(e)},A=function(e){y((function(n){return(0,i.Z)({},n,e)})),e.json&&d(e.json)},D=function(e){N(e),E(void 0)},L=function(e,n){N(e),E(n)},M=function(e){var n=(0,i.Z)({},I);delete n[e],A({json:n}),N(void 0),E(void 0)},P=function(e,n){var t=(0,i.Z)({},I);(0,o.Z)(t[e],Array)?t[e].splice(parseInt(n,10),1):delete t[e][n],A({json:t}),E(void 0)},R=function(){var e=v.string,n=(0,i.Z)({},I);n[""]=e,A({json:n}),N(""),E(void 0)},F="array"===p(I[w])||"object"===p(I[w]),z=_||F,B=!_&&!(_||F);return(0,s.jsxs)("div",{className:"flex flex-col gap-xl",children:[(0,s.jsxs)("div",{className:"flex flex-col gap-xl border-0 border-b border-solid border-structure-border px-md py-xl",children:[(0,s.jsx)(b.default,{variant:"regular-md",className:"text-header",children:"Custom fields"}),Object.entries(null!==I&&void 0!==I?I:{}).length>0&&(0,s.jsx)("div",{className:"flex flex-col gap-0 rounded-md border border-solid border-structure-border shadow-automations-json-editor",children:Object.entries(null!==I&&void 0!==I?I:{}).map((function(e,n){var t=(0,l.Z)(e,1)[0];return(0,s.jsx)(S,{json:I,jsonKey:t,handleDeleteField:M,handleFieldRowClick:D,handleNestedFieldRowClick:L,handleDeleteNestedField:P,isSelected:void 0===_&&w===t,selectedNestedField:_},n)}))}),void 0!==w&&void 0===_&&(0,s.jsx)(O,{name:w,type:p(I[w]),value:I[w],typeOptions:m,onNameChange:function(e){return A({json:h(I,w,n=e)}),N(n),void E(void 0);var n},onValueChange:function(e){return T((0,a.Z)((0,i.Z)({},I),(0,r.Z)({},w,e)))}}),void 0!==w&&void 0!==_&&(0,s.jsx)(O,{name:_,type:p(I[w][_]),value:I[w][_],typeOptions:g,outerType:p(I[w]),onNameChange:function(e){return function(e,n,t){var o=I[e];if(o){var l=(0,a.Z)((0,i.Z)({},I),(0,r.Z)({},e,h(o,n,t)));A({json:l}),E(t)}}(w,_,e)},onValueChange:function(e){if("array"===p(I[w])){var n=(0,i.Z)({},I);return n[w][_]=e,void T(n)}T((0,a.Z)((0,i.Z)({},I),(0,r.Z)({},w,(0,a.Z)((0,i.Z)({},I[w]),(0,r.Z)({},_,e)))))}}),z&&(0,s.jsx)(Z.default,{variant:"confirm",onClick:function(){return function(e){var n=v.string,t=(0,i.Z)({},I),l=t[e],s="";if((0,o.Z)(l,Array))l.push(n),s=(l.length-1).toString();else{var u=(0,a.Z)((0,i.Z)({},l),(0,r.Z)({},"",n));s="",t[e]=u}A({json:t}),N(e),E(s)}(w)},fullWidth:!0,children:"Add nested field"}),B&&(0,s.jsx)(Z.default,{variant:"confirm",onClick:R,fullWidth:!0,children:"Add field"})]}),!_&&!B&&(0,s.jsx)("div",{className:"px-md",children:(0,s.jsx)(Z.default,{variant:"secondary-confirm",onClick:R,fullWidth:!0,children:"Add field"})}),(0,s.jsx)("div",{className:"px-md pb-xl",children:(0,s.jsx)(C,{json:I,onChange:function(e){return function(e){T(e),N(void 0),E(void 0)}(e)}})})]})}},53261:function(e,n,t){"use strict";t.d(n,{D:function(){return i}});var r=t(70865),o=t(87394),i=function(e){var n=(0,r.Z)({},e);delete n[""];var t=!0,a=!1,l=void 0;try{for(var s,u=Object.entries(n)[Symbol.iterator]();!(t=(s=u.next()).done);t=!0){var c=(0,o.Z)(s.value,2),d=c[0],f=c[1];"object"!==typeof f||null===f||Array.isArray(f)||(n[d]=i(f))}}catch(p){a=!0,l=p}finally{try{t||null==u.return||u.return()}finally{if(a)throw l}}return n}},25253:function(e,n,t){"use strict";t.d(n,{p:function(){return r}});var r=function(e){var n=e.updated,t=e.published;return!n||!t||(new Date(n).getTime()-new Date(t).getTime())/1e3>2}},56653:function(e,n,t){"use strict";var r=t(52322);t(2784);n.Z=function(){return(0,r.jsx)("svg",{width:"22",height:"37",viewBox:"0 0 22 37",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"squiggleArrow",children:(0,r.jsx)("path",{d:"M3 12.1395L2.50115 11.2728L0.328169 12.5236L2.76545 13.1116L3 12.1395ZM19 16L19.4903 16.8716L21.7073 15.6245L19.2345 15.0279L19 16ZM11 7.53488L11.4988 8.40157L12 8.11312V7.53488H11ZM11 20.5L10.5097 19.6284L10 19.9152V20.5H11ZM10.2929 36.7071C10.6834 37.0976 11.3166 37.0976 11.7071 36.7071L18.0711 30.3431C18.4616 29.9526 18.4616 29.3195 18.0711 28.9289C1
17.6805 28.5384 17.0474 28.5384 16.6569 28.9289L11 34.5858L5.34315 28.9289C4.95262 28.5384 4.31946 28.5384 3.92893 28.9289C3.53841 29.3195 3.53841 29.9526 3.92893 30.3431L10.2929 36.7071ZM2.76545 13.1116L18.7655 16.9721L19.2345 15.0279L3.23455 11.1674L2.76545 13.1116ZM10 0V7.53488H12V0L10 0ZM10.5012 6.6682L2.50115 11.2728L3.49885 13.0062L11.4988 8.40157L10.5012 6.6682ZM18.5097 15.1284L10.5097 19.6284L11.4903 21.3716L19.4903 16.8716L18.5097 15.1284ZM10 20.5L10 25.9535H12V20.5H10ZM10 25.9535V36H12V25.9535H10Z",fill:"#E7E2E9"})})}},44303:function(e,n,t){"use strict";t.d(n,{$i:function(){return V},AU:function(){return R},AZ:function(){return B},Be:function(){return G},Bx:function(){return X},DZ:function(){return Y},Fq:function(){return P},G5:function(){return F},II:function(){return W},Qr:function(){return Q},U8:function(){return K},Yb:function(){return O},bJ:function(){return J},cX:function(){return H},dH:function(){return L},gH:function(){return ee},h:function(){return ne},i$:function(){return M},k2:function(){return q},lb:function(){return U},nx:function(){return D},pd:function(){return $},ph:function(){return A},rJ:function(){return z},uN:function(){return T}});var r=t(92228),o=t(98767),i=t(75259);function a(){var e=(0,r.Z)(["\n  width: 532px;\n  min-height: 501px;\n  overflow-y: auto;\n  overflow-x: hidden;\n  display: flex;\n  flex-direction: column;\n  align-items: center;\n\n  background: #ffffff;\n  border: 1px solid #e7e2e9;\n  box-sizing: border-box;\n  border-radius: 6px;\n\n  padding-left: 23px;\n  padding-right: 23px;\n\n  .horizontalDivider {\n    min-height: 1px;\n  }\n\n  .form {\n    display: flex;\n    flex-direction: column;\n    align-self: flex-start;\n  }\n"]);return a=function(){return e},e}function l(){var e=(0,r.Z)(["\n  display: flex;\n  align-items: center;\n  justify-content: space-between;\n\n  width: 100%;\n"]);return l=function(){return e},e}function s(){var e=(0,r.Z)(["\n  font-family: Inter;\n  font-style: normal;\n  font-weight: 700;\n  font-size: 20px;\n  line-height: 27px;\n  text-transform: capitalize;\n  color: #e7e2e9;\n\n  padding-top: 20px;\n  padding-bottom: 8px;\n"]);return s=function(){return e},e}function u(){var e=(0,r.Z)(["\n  padding-top: 20px;\n  padding-bottom: 8px;\n\n  &:hover {\n    cursor: pointer;\n  }\n"]);return u=function(){return e},e}function c(){var e=(0,r.Z)(["\n  font-family: Inter;\n  font-style: normal;\n  font-weight: 600;\n  font-size: 14px;\n  line-height: 19px;\n\n  color: #9121c2;\n  margin-left: 10px;\n"]);return c=function(){return e},e}function d(){var e=(0,r.Z)(["\n  margin: 8px;\n\n  .errorBorder {\n    border: 1px solid #ff5e5e;\n  }\n\n  .errorBorderSelect {\n    border: 1px solid #ff5e5e;\n    border-radius: 9px;\n  }\n\n  .errorText {\n    color: #ff5e5e;\n  }\n"]);return d=function(){return e},e}function f(){var e=(0,r.Z)(["\n  display: flex;\n  align-items: center;\n\n  .remove {\n    margin-top: 40px;\n    margin-left: 10px;\n  }\n"]);return f=function(){return e},e}function p(){var e=(0,r.Z)(["\n  height: 19px;\n  left: 692px;\n  top: 338px;\n\n  font-family: Inter;\n  font-style: normal;\n  font-weight: bold;\n  font-size: 14px;\n  line-height: 19px;\n\n  color: #334563;\n"]);return p=function(){return e},e}function h(){var e=(0,r.Z)(["\n  font-size: 14px;\n  float: right;\n\n  .text {\n  }\n\n  svg {\n    width: 15px;\n    fill: #9121c2;\n    margin: 0px 0 -2px 5px;\n  }\n"]);return h=function(){return e},e}function v(){var e=(0,r.Z)(["\n  display: flex;\n  flex-direction: row;\n  align-items: flex-start;\n"]);return v=function(){return e},e}function m(){var e=(0,r.Z)(["\n  position: relative;\n  width: auto;\n  height: 16px;\n  left: 8px;\n  top: 8px;\n\n  font-family: Inter;\n  font-style: normal;\n  font-weight: 300;\n  font-size: 12px;\n  line-height: 16px;\n  display: flex;\n  align-items: center;\n  color: #79849a;\n  background: #ffffff;\n  border-radius: 4px;\n\n  margin: 0px 10px;\n  padding: 0px 4px;\n"]);return m=function(){return e},e}function g(){var e=(0,r.Z)(["\n  display: flex;\n  margin-left: 20px;\n  margin-top: 3px;\n"]);return g=function(){return e},e}function x(){var e=(0,r.Z)(["\n  display: flex;\n  flex-direction: row;\n  align-items: flex-start;\n"]);return x=function(){return e},e}function b(){var e=(0,r.Z)(["\n  width: auto;\n  height: 16px;\n\n  font-family: Inter;\n  font-style: normal;\n  font-weight: 300;\n  font-size: 12px;\n  line-height: 16px;\n  display: flex;\n  align-items: center;
1\n  color: #ff5e5e;\n\n  margin-left: 20px;\n"]);return b=function(){return e},e}function y(){var e=(0,r.Z)(["\n  width: auto;\n  height: 16px;\n  font-family: Inter;\n  font-style: normal;\n  font-weight: 300;\n  font-size: 14px;\n  line-height: 19px;\n  display: flex;\n  align-items: center;\n  letter-spacing: -0.01em;\n  color: #73819b;\n\n  margin-left: 7px;\n"]);return y=function(){return e},e}function C(){var e=(0,r.Z)(["\n  width: 332px;\n  height: 43px;\n\n  background: #ffffff;\n  border: 1px solid #e7e2e9;\n  box-sizing: border-box;\n  border-radius: 6px;\n\n  padding-left: 20px;\n"]);return C=function(){return e},e}function j(){var e=(0,r.Z)(["\n  display: flex;\n  flex-wrap: wrap;\n"]);return j=function(){return e},e}function w(){var e=(0,r.Z)(["\n  width: 206px;\n  height: 19px;\n\n  font-family: Inter;\n  font-style: normal;\n  font-weight: 600;\n  font-size: 14px;\n  line-height: 19px;\n  color: #e7e2e9;\n\n  margin-top: 40px;\n  margin-bottom: 15px;\n  margin-left: 8px;\n"]);return w=function(){return e},e}function N(){var e=(0,r.Z)(["\n  display: flex;\n  flex-direction: row;\n  justify-content: center;\n  align-items: center;\n\n  min-width: auto;\n  height: 32px;\n\n  background: #f3ebf8;\n  color: #24324b;\n\n  font-family: Inter;\n  font-style: normal;\n  font-weight: normal;\n  font-size: 12px;\n  line-height: 16px;\n\n  border: none;\n  border-radius: 20px;\n\n  padding: 8px 20px;\n  margin-left: 5px;\n  margin-right: 5px;\n  margin-bottom: 10px;\n"]);return N=function(){return e},e}function S(){var e=(0,r.Z)(["\n  text-align: right;\n  display: flex;\n  margin-top: 12px;\n"]);return S=function(){return e},e}function k(){var e=(0,r.Z)(["\n  width: 53px;\n  height: 43px;\n\n  background: #ffffff;\n  border: 1px solid #e7e2e9;\n  box-sizing: border-box;\n  border-radius: 6px;\n  text-align: right;\n\n  padding-right: 10px;\n  margin-right: 13px;\n"]);return k=function(){return e},e}function _(){var e=(0,r.Z)(["\n  margin-top: 10px;\n  display: flex;\n  .select {\n    width: 236px;\n  }\n"]);return _=function(){return e},e}function Z(){var e=(0,r.Z)(["\n  text-transform: capitalize;\n"]);return Z=function(){return e},e}function E(){var e=(0,r.Z)(["\n  margin-left: 15px;\n"]);return E=function(){return e},e}function I(){var e=(0,r.Z)(["\n  width: 438px;\n  height: 99px;\n  margin-bottom: 21px;\n"]);return I=function(){return e},e}var O=o.default.div(a()),T=o.default.div(l()),A=o.default.div(s()),D=o.default.div(u()),L=o.default.span(c()),M=o.default.div(d()),P=o.default.div(f()),R=o.default.span(p()),F=o.default.span(h()),z=o.default.div(v()),B=o.default.div(m()),H=o.default.div(g()),V=o.default.div(x()),$=o.default.div(b()),U=o.default.div(y()),W=o.default.input(C()),q=o.default.div(j()),K=o.default.div(w()),G=o.default.div(N()),J=o.default.div(S()),X=o.default.input(k()),Y=o.default.div(_()),Q=(0,o.default)(i.Wx)(Z()),ee=o.default.span(E()),ne=(0,o.default)(M)(I())},96095:function(e,n,t){"use strict";t.d(n,{ER:function(){return C},Rj:function(){return j},VY:function(){return y},Vo:function(){return b},W2:function(){return m},W5:function(){return S},Zd:function(){return g},h8:function(){return w},vr:function(){return N},y0:function(){return x}});var r=t(92228),o=t(98767),i=t(6281);function a(){var e=(0,r.Z)(["\n  display: flex;\n  width: 100%;\n"]);return a=function(){return e},e}function l(){var e=(0,r.Z)(["\n  width: 300px;\n  min-width: 300px;\n  height: 100vh;\n  min-height: 500px;\n  border-top: 1px solid #ededed;\n  padding: 0 32px 0 32px;\n  background-color: white;\n\n  .header {\n    font-family: Inter;\n    font-style: normal;\n    font-weight: 800;\n    font-size: 18px;\n    line-height: 25px;\n    color: #334563;\n    margin: 20px 20px 40px 0px;\n    .hero {\n      font-weight: normal;\n      font-size: 14px;\n      line-height: 19px;\n      color: #73819b;\n    }\n\n    .title {\n      font-size: 18px;\n      font-weight: 600;\n      padding: 0;\n      margin-bottom: 10px;\n    }\n  }\n"]);return l=function(){return e},e}function s(){var e=(0,r.Z)(["\n  width: 100%;\n  padding: 0 32px 0 32px;\n\n  .codemirror-editor {\n    flex: 1;\n    height: 80vh;\n\n    .clipboard-copy {\n      margin-right: -18px;\n    }\n  }\n\n  .content {\n    display: flex;\n    flex-basis: 75%;\n\n    .step-editor {\n      width: 100%;\n      display: flex;\n      max-height: 80vh;\n\n      .visual-step-editor {\n        display: flex;\n        flex-direction: column;\n        flex-basis: 25%;\n        margin: 0 25px;\n\n        .squiggleArrow {\n          min-height: 37px;\n        }\n\n        align-items: center;\n        overflow: auto;\n\n        .new-step-block {\n          width: 193px;\n          height: 30px;\n          min-height: 30px;\n          color: #9121c2;\n          text-align: center;\n\n          background: #ffffff;\n          border: 1px solid #e7e2e9;
1\n          box-sizing: border-box;\n          border-radius: 6px;\n        }\n\n        .new-step-block:hover,\n        .activeStepMenu {\n          background: #f7eff7;\n          border: 1px solid #9121c2;\n          box-sizing: border-box;\n          box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);\n          border-radius: 6px;\n        }\n      }\n\n      .json-step-editor {\n        width: 100%;\n\n        flex-basis: 75%;\n      }\n    }\n\n    .template-editor {\n      width: 100%;\n    }\n  }\n"]);return s=function(){return e},e}function u(){var e=(0,r.Z)(["\n  width: 68px;\n  height: 36px;\n  min-height: 36px;\n  display: flex;\n  align-items: center;\n  justify-content: center;\n\n  background: #f9fafb;\n  border: 1px solid #e7e2e9;\n  box-sizing: border-box;\n  border-radius: 6px;\n"]);return u=function(){return e},e}function c(){var e=(0,r.Z)(["\n  display: flex;\n  flex: 1;\n  flex-direction: column;\n  min-height: 400px;\n"]);return c=function(){return e},e}function d(){var e=(0,r.Z)(["\n  svg {\n    float: right;\n    height: 24px;\n    width: 24px;\n    margin-top: -2px;\n    margin-right: 44px;\n  }\n\n  .jsonnetOptInIcon {\n    float: right;\n    margin-right: 5px;\n    &:hover {\n      cursor: pointer;\n    }\n  }\n\n  span {\n    float: right;\n    margin-right: 15px;\n    font-family: Inter;\n    font-style: normal;\n    font-weight: 600;\n    font-size: 14px;\n    line-height: 16px;\n    text-align: right;\n    letter-spacing: -0.02em;\n    color: #ffffff;\n  }\n\n  .jsonnetOptInText {\n    text-decoration-line: underline;\n\n    &:hover {\n      cursor: pointer;\n      color: rgb(213, 213, 213);\n    }\n  }\n\n  svg.check-mark {\n    height: 12px;\n    width: 12px;\n    margin-right: 6px;\n    float: unset;\n  }\n\n  svg.error {\n    margin-top: -3px;\n    margin-bottom: -6px;\n    margin-right: 6px;\n    height: 24px;\n    width: 24px;\n    float: unset;\n  }\n"]);return d=function(){return e},e}function f(){var e=(0,r.Z)(["\n  width: 100%;\n  margin-bottom: 30px;\n"]);return f=function(){return e},e}function p(){var e=(0,r.Z)(["\n  width: 100%;\n  margin-bottom: 30px;\n\n  &.error {\n    background-color: rgba(255, 99, 71, 0.7) !important;\n  }\n"]);return p=function(){return e},e}function h(){var e=(0,r.Z)(["\n  width: 100%;\n  margin-bottom: 30px;\n"]);return h=function(){return e},e}function v(){var e=(0,r.Z)(["\n  width: 100%;\n  margin-bottom: 30px;\n"]);return v=function(){return e},e}var m=o.default.div(a()),g=o.default.div(l()),x=o.default.div(s()),b=o.default.div(u()),y=o.default.div(c()),C=o.default.div(d()),j=(0,o.default)(i.ZP)(f()),w=(0,o.default)(i.ZP)(p()),N=(0,o.default)(i.ZP)(h()),S=(0,o.default)(i.ZP)(v())},55944:function(e,n,t){"use strict";t.d(n,{V6:function(){return p},_7:function(){return u},lp:function(){return s},ob:function(){return d},u7:function(){return f}});var r=t(47842),o=t(70865),i=t(96670),a=t(87394),l=t(77149),s=function(e){return e&&"object"===typeof e&&!Array.isArray(e)},u=function(e){return e&&e.$ref&&"string"===typeof e.$ref},c=function(e,n){return(0,l.Z)(e.split(".")).slice(1).reduce((function(e,n){return e&&e[n]?e[n]:null}),n)},d=function(e,n,t){var l={},f=!0,p=!1,h=void 0;try{for(var v,m=Object.entries(e)[Symbol.iterator]();!(f=(v=m.next()).done);f=!0){var g=(0,a.Z)(v.value,2),x=g[0],b=g[1];if(s(b))if(u(b)){var y=(0,a.Z)(b.$ref.split("."),1)[0];l=(0,i.Z)((0,o.Z)({},l),(0,r.Z)({},x,c(b.$ref,n[y])))}else l=(0,i.Z)((0,o.Z)({},l),(0,r.Z)({},x,d(b,n,t)));else l=(0,i.Z)((0,o.Z)({},l),(0,r.Z)({},x,b))}}catch(C){p=!0,h=C}finally{try{f||null==m.return||m.return()}finally{if(p)throw h}}return l},f=function(e){if(null===e)return null;var n=(0,l.Z)(e.split(".")),t=n[0],r=n.slice(1);return"refs"===t?{$ref:r.join(".")}:e},p=function(e){return"string"===typeof e?e:s(e)&&u(e)?"refs.".concat(e.$ref):null}},12388:function(e,n,t){"use strict";var r=t(52322),o=t(56982),i=t(56110),a=t(12524),l=t.n(a),s=t(19557);n.Z=function(e){var n=e.label,t=e.selected,a=e.isHovering,u=e.onClick,c=e.Icon,d=e.subtext,f=e.descriptionText,p=e.tooltipSide,h=Boolean(f);return(0,r.jsxs)(i.u,{children:[(0,r.jsx)(i.aJ,{asChild:!0,children:(0,r.jsxs)("span",{onClick:u,className:l()("flex w-full cursor-pointer gap-2 px-4 py-2 font-medium-sm text-medium-sm",h?"items-start":"items-center",{"bg-status-active text-white":a,"bg-background-default text-default":!a}),children:[c&&(0,r.jsx)("div",{className:"mr-0 flex h-5 w-5 shrink-0 items-center",children:(0,r.jsx)(c,{className:l()(a?"text-icon-white":"text-icon-default")})}),(0,r.jsx)("div",{className:"min-w-0 flex-1",children:h?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-baseline gap-x-2 gap-y-0.5",children:[(0,r.jsx)("span",{className:"min-w-0 truncate",children:n}),d&&(0,r.jsx)("span",{className:l()("shrink-0 font-regular-sm text-regular-sm",a?"text-icon-white":"text-subtext"),children:d})]}),f&&(0,r.jsx)(s.default,{variant:"medium-xs",className:l()("mt-0.5 truncate",{"text-icon-white":a,"text-button":!a}),children:f})]}):(0,r.jsxs)("div",{className:"flex min-w-0 items-baseline gap-2",children:[(0,r.jsx)("span",{className:"min-w-0 flex-1 truncate",children:n}),d&&(0,r.jsx)("span",{className:l()("shrink-0 font-regular-sm text-regular-sm",a?"text-icon-white":"text-subtext"),children:d})]})}),t&&(0,r.jsx)(o.MCw,{className:l()("h-6 w-6 shrink-0",h?"mt-0.5 self-start":"self-center",{"text-white":a,"text-status-active":!a}),"aria-hidden":"true"})]})}),(null===n||void 0===n?void 0:n.length)>
120&&(0,r.jsx)(i.NM,{children:(0,r.jsx)(i._v,{side:p,children:n})})]})}},43827:function(e,n,t){"use strict";var r=t(70865),o=t(96670),i=t(87394),a=t(52322),l=t(2784),s=t(5545),u=t(55577),c=t(49442),d=t(56982),f=t(20324),p=t(12388),h=t(19557),v=t(92155),m=t(95002),g=t(56110);n.Z=function(e){var n,t=e.options,x=e.value,b=e.valueForOptions,y=e.labelForOptions,C=e.onChange,j=e.className,w=e.disabled,N=e.error,S=e.iconForOptions,k=e.label,_=e.subtextForOptions,Z=e.tooltipForOptionsSide,E=e.disableTooltip,I=(0,i.Z)((0,v.D)({placement:"bottom-start",strategy:"fixed",modifiers:[{name:"offset",options:{offset:[0,4]}},{name:"sameWidth",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(e){var n=e.state;n.styles.popper.width="".concat(n.rects.reference.width,"px")},effect:function(e){var n=e.state;n.elements.popper.style.width="".concat(n.elements.reference.offsetWidth,"px")}}]}),2),O=I[0],T=I[1],A=x;return b&&(A=t.find((function(e){return e[b]===x}))),(0,a.jsx)(m.Z,{className:j,label:k,disabled:w,error:N,children:(0,a.jsx)(s.R,{value:A,onChange:C,disabled:w,children:(0,a.jsxs)("div",{className:(0,f.m6)("relative w-full"),children:[(0,a.jsxs)(g.u,(0,o.Z)((0,r.Z)({},E?{open:!1}:{}),{children:[(0,a.jsx)(g.aJ,{asChild:!0,children:(0,a.jsxs)(s.R.Button,{id:null===k||void 0===k?void 0:k.toLowerCase(),ref:O,className:(0,f.m6)("relative flex h-full w-full items-center gap-2 border-none bg-transparent py-2 pl-3 pr-3 text-left font-medium-sm text-medium-sm text-default transition-[border-color] duration-100 sm:font-medium-xs sm:text-medium-xs",j,!w&&"cursor-pointer"),children:[(null===A||void 0===A?void 0:A.icon)&&(0,a.jsx)("span",{className:"flex h-5 w-5 min-w-[1.25rem] items-center",children:(0,a.jsx)(A.icon,{})}),(0,a.jsx)(h.default,{variant:"medium-sm",className:"truncate",children:A&&A[y]}),(0,a.jsx)("span",{className:"pointer-events-none ml-auto flex items-center",children:(0,a.jsx)(d.RAe,{className:"h-6 w-6 text-status-active","aria-hidden":"true"})})]})}),(null===A||void 0===A||null===(n=A[y])||void 0===n?void 0:n.length)>20&&(0,a.jsx)(g.NM,{children:(0,a.jsx)(g._v,{children:A[y]})})]})),(0,a.jsx)(u.h,{children:(0,a.jsx)(c.u,{as:l.Fragment,leave:"transition ease-in duration-100",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,a.jsx)(s.R.Options,{className:"z-[10000] max-h-60 list-none overflow-auto rounded-md border-xs border-solid border-default bg-background-default pl-0 shadow-heron-dropdown focus:outline-none",ref:T,children:t.map((function(e,n){return(0,a.jsx)(s.R.Option,{value:e,children:function(n){var t=n.active,r=n.selected;return(0,a.jsx)(p.Z,{label:e[y],isHovering:t,selected:r,Icon:S&&e[S],subtext:_&&e[_],tooltipSide:Z})}},"".concat(e[y],"-").concat(n))}))})})})]})})})}},82737:function(e,n,t){"use strict";t.d(n,{Z:function(){return y}});var r=t(47842),o=t(87394),i=t(50930),a=t(52322),l=t(95002),s=t(10929),u=t(80061),c=t(49442),d=t(55577),f=t(2784),p=t(92155),h=t(56982),v=t(12388);function m(e,n,t,r){var o=r?e[r]:e.value;return void 0!==o&&null!==o&&""!==o?String(o):"".concat(String(e[t]),"-").concat(n)}function g(e){var n=e.grouped,t=e.filteredGroupedOptions,r=e.filteredOptions,o=e.clearable,i=e.clearableOption,l=e.labelForOptions,c=e.iconForOptions,d=e.subtextForOptions,f=e.tooltipForOptionsSide,p=e.valueForOptions,g=e.setQueryAndCallOnInputChange;
1return n&&t?0===t.length?(0,a.jsx)("div",{className:"relative cursor-default select-none px-4 py-2 font-medium-sm text-medium-sm text-default",children:"No options."}):(0,a.jsxs)(a.Fragment,{children:[o&&i&&(0,a.jsx)(u.h.Option,{value:i,children:function(e){var n=e.active,t=e.selected;return(0,a.jsxs)("div",{className:(0,s.cx)("flex cursor-pointer items-center border-b border-default px-4 py-2 font-medium-sm text-medium-sm",n?"bg-background-hover text-text-default":"bg-background-default text-text-subtext"),onClick:function(){return g("")},children:[(0,a.jsx)("span",{className:"italic",children:i[l]}),t&&(0,a.jsx)(h.MCw,{className:(0,s.cx)("ml-auto h-6 w-6",n?"text-white":"text-status-active"),"aria-hidden":"true"})]})}},"clearable"),t.map((function(e){var n=e.groupName,t=e.options;return(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"sticky top-0 bg-background-frame px-3 py-2 text-xs font-semibold uppercase tracking-wide text-text-subtext",children:n}),t.map((function(e,n){return(0,a.jsx)(u.h.Option,{value:e,children:function(n){var t=n.active,r=n.selected;return(0,a.jsx)(v.Z,{label:e[l],isHovering:t,onClick:function(){return g("")},selected:r,Icon:c&&e[c],subtext:d&&e[d],tooltipSide:f})}},m(e,n,l,p))}))]},n)}))]}):0===r.length?(0,a.jsx)("div",{className:"relative cursor-default select-none px-4 py-2 font-medium-sm text-medium-sm text-default",children:"No options."}):(0,a.jsx)(a.Fragment,{children:r.map((function(e,n){var t=i&&e[l]===i[l];return(0,a.jsx)(u.h.Option,{value:e,children:function(n){var r=n.active,o=n.selected;return t?(0,a.jsxs)("div",{className:(0,s.cx)("flex cursor-pointer items-center border-b border-default px-4 py-2 font-medium-sm text-medium-sm",r?"bg-background-hover text-text-default":"bg-background-default text-text-subtext"),onClick:function(){return g("")},children:[(0,a.jsx)("span",{className:"italic",children:e[l]}),o&&(0,a.jsx)(h.MCw,{className:(0,s.cx)("ml-auto h-6 w-6",r?"text-white":"text-status-active"),"aria-hidden":"true"})]}):(0,a.jsx)(v.Z,{label:e[l],isHovering:r,onClick:function(){return g("")},selected:o,Icon:c&&e[c],subtext:d&&e[d],tooltipSide:f})}},m(e,n,l,p))}))})}var x=t(59901),b=t(56110),y=function(e){var n=e.disabled,t=e.errorValidator,v=e.iconForOptions,m=e.label,y=e.labelForOptions,C=void 0===y?"label":y,j=e.valueForOptions,w=e.onCh
1ange,N=e.onInputChange,S=e.options,k=void 0===S?[]:S,_=e.placeholder,Z=e.subtextForOptions,E=e.turnOffDebounce,I=void 0!==E&&E,O=e.value,T=void 0===O?null:O,A=e.clearable,D=e.creatable,L=e.tooltipForOptionsSide,M=e.description,P=e.grouped,R=void 0!==P&&P,F=e.listboxPortal,z=void 0!==F&&F,B=e.openDropdownOnFocus,H=void 0===B||B,V=e.showSubtextWhenClosed,$=void 0!==V&&V,U=e.loading,W=void 0!==U&&U,q=n||W,K=(0,f.useState)(""),G=K[0],J=K[1],X=(0,f.useState)(!1),Y=X[0],Q=X[1],ee=(0,f.useRef)(null),ne=(0,f.useRef)(null),te=(0,f.useRef)(null),re=(0,f.useRef)(!1),oe=(0,f.useRef)(!1),ie=function(e){N&&N(e),J(e)},ae=(0,f.useMemo)((function(){return A?(0,r.Z)({},C,"----"):null}),[A,C]),le=(0,f.useMemo)((function(){if(!R)return null;var e=new Map;return k.forEach((function(n){var t=n.group||"Other";e.has(t)||e.set(t,[]),e.get(t).push(n)})),Array.from(e.entries()).map((function(e){var n=(0,o.Z)(e,2);return{groupName:n[0],options:n[1]}}))}),[R,k]),se=(0,f.useCallback)((function(e){var n=G.toLowerCase().replace(/\s+/g,""),t=e[C].toLowerCase().replace(/\s+/g,"").includes(n),r=Z&&e[Z]?String(e[Z]).toLowerCase().replace(/\s+/g,""):"",o=r&&r.includes(n.replace(/[$,]/g,""));return Boolean(t||o)}),[C,G,Z]),ue=(0,f.useMemo)((function(){var e=A&&!R?[ae].concat((0,i.Z)(k)):k,n=(""===G?e:e.filter(se)).slice(0,250),t=j||C,r=T&&n.some((function(e){return e[t]===T[t]}));return!T||r?n:[T].concat((0,i.Z)(n))}),[C,j,se,k,G,T,A,ae,R]),ce=(0,f.useMemo)((function(){return R&&le?le.map((function(e){return{groupName:e.groupName,options:e.options.filter((function(e){return""===G||se(e)}))}})).filter((function(e){return e.options.length>0})):null}),[R,le,se,G]),de=t&&T?t(T):null,fe=(0,x.ZP)(ie,I),pe=(0,f.useMemo)((function(){return{placement:"bottom-start",strategy:"fixed",modifiers:[{name:"offset",options:{offset:[0,4]}},{name:"sameWidth",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(e){var n=e.state;n.styles.popper.width="".concat(n.rects.reference.width,"px")},effect:function(e){var n=e.state;n.elements.popper.style.width="".concat(n.elements.reference.offsetWidth,"px")}}]}}),[]),he=(0,o.Z)((0,p.D)(pe),2),ve=he[0],me=he[1],ge=(0,f.useCallback)((function(e){ee.current=e,z&&ve(e)}),[z,ve]);(0,f.useEffect)((function(){if(!z&&ee.current){var e=function(){var e,n=null===(e=ee.current)||void 0===e?void 0:e.getBoundingClientRect();if(n){var t=window.innerHeight-n.bottom;Q(t<240)}};return e(),window.addEventListener("resize",e),window.addEventListener("scroll",e,!0),function(){window.removeEventListener("resize",e),window.removeEventListener("scroll",e,!0)}}}),[z]);var xe=(0,a.jsx)(g,{grouped:R,filteredGroupedOptions:ce,filteredOptions:ue,clearable:A,clearableOption:ae,labelForOptions:C,iconForOptions:v,subtextForOptions:Z,tooltipForOptionsSide:L,valueForOptions:j,setQueryAndCallOnInputChange:ie});return(0,a.jsx)(l.Z,{label:m,disabled:q,error:de,description:M,children:(0,a.jsx)(u.h,{value:T,onChange:function(e){oe.current=!0,setTimeout((function(){oe.current=!1}),100),w(e)},disabled:q,nullable:A,children:(0,a.jsxs)(b.u,{children:[(0,a.jsx)(b.aJ,{asChild:!0,children:(0,a.jsxs)("div",{ref:ge,className:"relative w-full rounded-md",children:[(0,a.jsxs)("div",{className:(0,s.cx)("relative box-border flex h-full w-full cursor-default flex-wrap items-center gap-sm overflow-hidden rounded-md border-0 py-sm pl-md pr-11 text-left",q?"bg-background-frame":"bg-inherit"),onClick:function(e){var n,t=e.target;t.closest("button")||(null===(n=te.current)||void 0===n?void 0:n.contains(t))||t===te.current?e.stopPropagation():!q&&ne.current&&ne.current.focus()},children:[v&&(null===T||void 0===T?void 0:T[v])&&(0,a.jsx)("div",{className:"mr-2 flex h-6 w-6 shrink-0 items-center justify-center rounded border border-solid border-structure-border",children:function(){var e=T[v];return e?(0,a.jsx)(e,{className:"h-5 w-5 text-icon-default"}):null}()}),(0,a.jsx)(u.h.Input,{ref:ne,className:(0,s.cx)("grow border-none bg-transparent p-0 font-medium-sm text-medium-sm outline-none placeholder:text-placeholder",q?"text-placeholder":"text-default"),displayValue:function(e){if(!e)return"";var n=e[C];
1return n?$&&Z&&e[Z]?"".concat(n,"  ").concat(String(e[Z])):n:""},onChange:function(e){return fe(e.target.value)},onFocus:function(){re.current?re.current=!1:oe.current?oe.current=!1:(""!==G&&J(""),H&&setTimeout((function(){te.current&&!q&&te.current.click()}),0))},autoComplete:"off",placeholder:W?"Loading\u2026":_}),(0,a.jsx)(u.h.Button,{ref:te,className:"absolute inset-y-0 right-0 flex items-center border-none bg-transparent pr-3",onClick:function(e){re.current=!0,e.stopPropagation(),setTimeout((function(){re.current=!1}),100)},children:W?(0,a.jsx)("div",{role:"status","aria-label":"Loading options",className:"h-4 w-4 animate-spin rounded-full border-2 border-solid border-neutral-300 border-t-neutral-500"}):(0,a.jsx)(h.RAe,{className:(0,s.cx)("h-6 w-6",de?"text-button-red":"",q?"text-placeholder":"",q||de?"":"cursor-pointer text-neutral-500"),"aria-hidden":"true"})})]}),(0,a.jsx)(c.u,{as:"div",leave:"transition ease-in duration-100",leaveFrom:"opacity-100",leaveTo:"opacity-0",afterLeave:function(){var e;D||(null===(e=fe.clear)||void 0===e||e.call(fe),ie(""))},children:z?(0,a.jsx)(d.h,{children:(0,a.jsx)(u.h.Options,{ref:me,className:"z-[10000] max-h-60 list-none overflow-auto rounded-md border-xs border-solid border-default bg-background-default pl-0 shadow-heron-dropdown focus:outline-none",children:xe})}):(0,a.jsx)(u.h.Options,{className:(0,s.cx)("absolute z-30 w-full list-none overflow-auto rounded-md border-xs border-solid border-default bg-background-default pl-0 shadow-heron-dropdown focus:outline-none",Y?"bottom-full mb-1 max-h-60":"mt-1 max-h-60"),children:xe})})]})}),function(){var e=T;if(!e)return null;var n=e[C];if(!n)return null;var t=$&&Z&&e[Z]?"".concat(n,"  ").concat(String(e[Z])):n;return t.length>36?(0,a.jsx)(b.NM,{children:(0,a.jsx)(b._v,{children:t})}):null}()]})})})}},87670:function(e,n,t){"use strict";var r=t(50930),o=t(52322),i=t(24492),a=t(98964),l=t(12524),s=t.n(l);n.Z=function(e){var n,t=e.disabled,l=e.Icon,u=e.iconColor,c=e.labelForOptions,d=e.onChange,f=e.options,p=e.value,h=void 0===p?[]:p,v=e.valueForOptions,m=e.capitalizeOptions,g=void 0!==m&&m,x=e.className,b=e.itemsClassName,y=e.labelClassName,C=function(e){var n=e.target,t=n.checked,o=n.id,i=f.find((function(e){return e[v]===o}));return d(t?(0,r.Z)(h).concat([i]):h.filter((function(e){return e[v]!==o})))};return(0,o.jsx)(i.Z,{className:x,children:f.map((function(e){return(0,o.jsx)(a.Z,{checked:h.some((function(n){return n[v]===e[v]})),disabled:t,Icon:null!==(n=e.Icon)&&void 0!==n?n:l,iconColor:u,id:e[v],labelForOptions:c,onChange:C,option:e,type:"checkbox",itemClassName:s()(g&&"capitalize",b),labelClassName:y},e[v])}))})}},98964:function(e,n,t){"use strict";var r=t(47842),o=t(52322),i=t(2784),a=t(12524),l=t.n(a),s=function(e,n){var t=e.checked,a=e.className,s=e.disabled,u=e.Icon,c=e.iconColor,d=e.id,f=e.labelForOptions,p=e.name,h=e.onChange,v=e.option,m=e.type,g=e.itemClassName,x=e.labelClassName;return(0,o.jsxs)("div",{className:l()("group/input-group-item flex items-center py-sm",g),children:[(0,o.jsx)("input",{ref:n,checked:t,className:l()("cursor-pointer focus:ring-0 focus:ring-offset-0",a,{"!form-checkbox m-0 h-6 w-6 rounded-sm border border-solid border-default bg-background-default text-status-active checked:border-0 disabled:bg-background-field-disabled disabled:checked:border disabled:checked:bg-status-disabled":"checkbox"===m,"!form-radio m-0 h-6 w-6 border border-solid border-default bg-background-default text-status-active checked:border-0 disabled:bg-background-field-disabled disabled:checked:border disabled:checked:bg-status-disabled":"radio"===m}),disabled:s,id:null!==d&&void 0!==d?d:null===v||void 0===v?void 0:v[f],name:p,onChange:h,type:m}),u&&(0,o.jsx)(o.Fragment,{children:i.isValidElement(u)?(0,o.jsx)("span",{className:"ml-lg",children:u}):(0,o.jsx)(u,{className:l()("ml-lg h-6 w-6 cursor-pointer",(0,r.Z)({"text-button":Boolean(s||!c)},"text-".concat(c),Boolean(!s&&c))),"aria-hidden":"true"})}),(0,o.jsx)("label",{htmlFor:null!==d&&void 0!==d?d:null===v||void 0===v?void 0:v[f],className:l()("ml-lg flex flex-grow cursor-pointer items-center font-core-input text-core-input text-button",x),children:null===v||void 0===v?void 0:v[f]})]})};n.Z=(0,i.forwardRef)(s)},24492:function(e,n,t){"use strict";var r=t(52322);n.Z=function(e){var n=e.children,t=e.className;return(0,r.jsx)("fieldset",{className:"m-0 border-0 p-0",children:(0,r.jsx)("div",{className:t,children:n})})}},37399:function(e,n,t){"use strict";t.d(n,{Cl:function(){return m},Dv:function(){return p},Lb:function(){return v},bF:function(){return f},sN:function(){return h},v2:function(){return d}});var r=t(70865),o=t(96670),i=t(26297),a=t(52322),l=t(2784),s=t(663),u=t(12524),c=t.n(u),d=s.fC,f=s.xz,p=(s.ZA,s.Uv,l.forwardRef((function(e,n){var t=e.className,o=e.sideOffset,l=void 0===o?4:o,u=(0,i.Z)(e,["className","sideOffset"]);return(0,a.jsx)(s.Uv,{children:(0,a.jsx)(s.VY,(0,r.Z)({ref:n,sideOffset:l,className:c()("z-50 flex min-w-[101px] flex-col overflow-hidden rounded-md border border-solid border-structure-default bg-background-default shadow-heron-dropdown transition duration-100 ease-in","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-100",t)},u))})})));p.displayName=s.VY.displayName;var h=l.forwardRef((function(e,n){var t=e.className,l=e.inset,u=e.align,d=e.children,f=(0,i.Z)(e,["className","inset","align","children"]);return(0,a.jsx)(s.ck,(0,o.Z)((0,r.Z)({ref:n,className:c()("group/menu-item relative flex h-[40px] cursor-default select-none items-center px-4 py-2 outline-none transition-colors hover:bg-status-active data-[disabled]:pointer-events-none data-[disabled]:opacity-50",l&&"pl-8","end"===u&&"justify-end",t)},f),{children:d}))}));h.displayName=s.ck.displayName;var v=l.forwardRef((function(e,n){var t=e.className,o=e.inset,l=(0,i.Z)(e,["className","inset"]);return(0,a.jsx)(s.__,(0,r.Z)({ref:n,className:c()("px-2 py-1.5 text-sm font-semibold",o&&"pl-8",t)},l))}));v.displayName=s.__.displayName;var m=l.forwardRef((function(e,n){var t=e.className,o=(0,i.Z)(e,["className"]);return(0,a.jsx)(s.Z0,(0,r.Z)({ref:n,className:c()("-mx-1 my-1 h-px bg-structure-divider",t)},o))}));m.displayName=s.Z0.displayName},1417:function(e,n,t){"use strict";var r=t(47842),o=t(50930),i=t(52322),a=t(2784),l=t(80061),s=t(49442),u=t
1(56982),c=t(19557),d=t(12388),f=t(10929),p=t(59901);n.Z=function(e){var n=e.descriptionForOption,t=e.disabled,h=e.labelForOptions,v=e.noBorder,m=void 0!==v&&v,g=e.noFilter,x=void 0!==g&&g,b=e.onChange,y=e.onInputChange,C=e.options,j=void 0===C?[]:C,w=e.placeholder,N=e.showOpenButton,S=e.subtextForOptions,k=e.turnOffDebounce,_=void 0!==k&&k,Z=e.validateSelection,E=e.value,I=(0,a.useState)(""),O=I[0],T=I[1],A=(0,a.useRef)(null),D=function(e){y&&y(e),T(e)},L=""===O||x?j:j.filter((function(e){return e[h].toLowerCase().replace(/\s+/g,"").includes(O.toLowerCase().replace(/\s+/g,""))&&!E.find((function(n){return n[h]===e[h]}))})),M=(0,p.ZP)(D,_),P=function(){D(""),A.current.value=""},R=function(){var e=A.current.value,n=e.replace(/\s+/g,"");if(""===e||E.find((function(e){return e[h]===n})))T("");else{if(Z)return void T("");var t=n.split(","),i=(0,o.Z)(E);t.forEach((function(e){i.push((0,r.Z)({},h,e))})),b(i),P()}},F=function(e){var n;return"option"===(null===e||void 0===e||null===(n=e.relatedTarget)||void 0===n?void 0:n.role)?e.preventDefault():R()};return(0,i.jsx)(l.h,{value:E,onChange:b,multiple:!0,disabled:t,children:function(e){var r=e.open,p=e.activeOption;return(0,i.jsxs)("div",{className:"relative w-full",children:[(0,i.jsxs)("div",{className:(0,f.cx)("relative box-border flex min-h-[46px] w-full cursor-default flex-wrap items-center gap-sm overflow-hidden border-0 border-solid border-default bg-background-default px-sm py-sm text-left transition-[border-color] duration-100 focus-within:border-status-active focus:outline-none sm:text-sm",m?"":"rounded-md border-xs"),children:[null===E||void 0===E?void 0:E.map((function(e){return(0,i.jsxs)(c.default,{variant:"semibold-sm",className:"box-border flex h-7 whitespace-nowrap rounded-xl bg-tag-default py-xs pl-md text-default",children:[e[h],(0,i.jsx)("div",{className:(0,f.cx)(t&&"cursor-not-allowed"),children:(0,i.jsx)(u.X,{className:(0,f.cx)("ml-sm box-content h-5 w-5 pr-md text-icon-active",t?"pointer-events-none":"cursor-pointer"),onClick:function(){return function(e){b(E.filter((function(n){return n[h]!==e[h]})))}(e)}})})]},e[h])})),(0,i.jsx)(l.h.Input,{className:(0,f.cx)("grow border-none bg-background-default font-medium-sm text-medium-sm font-semibold text-default outline-none",N&&"pr-8"),displayValue:function(){return""},onChange:function(e){return M(e.target.value)},ref:A,placeholder:w,onKeyDown:function(e){return function(e,n){"Backspace"===e.key&&""===O&&b(E.slice(0,E.length-1)),"Enter"===e.key&&null===n&&R(),"Enter"===e.key&&null!==n&&P(),"Tab"===e.key&&(null!==n?(b((0,o.Z)(E).concat([n])),P(),A.current.focus(),e.preventDefault()):R())}(e,p)},autoComplete:"off",onBlur:F}),N&&(0,i.jsx)(l.h.Button,{className:"absolute inset-y-0 right-0 flex w-fit items-center border-none bg-transparent pr-3",children:(0,i.jsx)(u.RAe,{className:(0,f.cx)("h-6 w-6",t?"text-placeholder":"cursor-pointer text-icon-active"),"aria-hidden":"true"})})]}),r&&!(0===L.length)&&(0,i.jsx)(s.u,{as:a.Fragment,leave:"transition ease-in duration-100",leaveFrom:"opacity-100",leaveTo:"opacity-0",afterLeave:function(){return D("")},children:(0,i.jsx)(l.h.Options,{className:"absolute z-10 mt-1 max-h-60 min-w-[200px] max-w-full list-none overflow-auto rounded-md border-xs border-solid border-default bg-background-default pl-0 shadow-heron-dropdown focus:outline-none",children:L.map((function(e){return(0,i.jsx)(l.h.Option,{value:e,children:function(t){var r=t.active;return(0,i.jsx)(d.Z,{label:e[h],isHovering:r,onClick:P,subtext:e[S],descriptionText:e[n]})}},e[h])}))})})]})}})}},62117:function(e,n,t){"use strict";var r=t(98788),o=t(22970),i=t(34273),a=t.n(i),l=t(2784);n.Z=function(e){var n=(0,l.useState)(!1),t=n[0],i=n[1],s=t?"Copied to Clipboard":"Copy to clipboard",u=function(){var n=(0,r.Z)((function(n){return(0,o.__generator)(this,(function(t){switch(t.label){case 0:return n.preventDefault(),[4,a()(e)];case 1:return t.sent(),i(!0),setTimeout((function(){i(!1)}),2500),[2]}}))}));return function(e){return n.apply(this,arguments)}}();return[s,u]}},62208:function(e,n,t){"use strict";function r(e,n,t){var r=t.sameWorkspaceAsSource;return n.filter((function(n){return"active"===n.state&&(!r||n.environmentId!==e)}))}function o(e){return e.map((function(e){return{label:e.name,value:e.environmentId}}))}function i(e,n,t){var o,i;return null!==(i=null===(o=r(e,n,t)[0])||void 0===o?void 0:o.environmentId)&&void 0!==i?i:null}function a(e,n,t,o){return r(e,t,o).some((function(e){return e.environmentId===n}))}t.d(n,{Kb:function(){return r},Xh:function(){return o},ho:function(){return i},tP:function(){return a}})},55401:function(e,n,t){"use strict";t.d(n,{GP:function(){return i},Y8:function(){return o},vs:function(){return a}});t(5632);var r=t(91773);function o(e,n,t){return"/".concat(e,"/").concat(n,"/content/templates/").concat((0,r.n)(t),"/design")}function i(e,n,t){return"/".concat(e,"/").concat(n,"/new-designer/").concat((0,r.n)(t),"/design")}function a(e,n,t){return"/".concat(e,"/").concat(n,"/orchestration/automations/").concat(t,"/design")}},58764:function(e,n,t){"use strict";t.d(n,{O:function(){return p},X:function(){return f}});
1var r=t(70865),o=t(87394),i=t(92228),a=t(50930),l=t(10081),s=t(33379),u=t(17742),c=t(13100);function d(){var e=(0,i.Z)(["\n  mutation saveAutomationTemplate($template: IAutomationTemplateDataInput!) {\n    saveAutomationTemplate(template: $template) {\n      id\n      templateId\n      template\n      json\n      updatedAt\n    }\n  }\n"]);return d=function(){return e},e}var f=(0,l.Ps)(d()),p=function(e){var n=(0,o.Z)((0,s.D)(f,{update:function(n,t){var o,i=t.data;try{o=n.readQuery({query:c.x})}catch(d){return}if(o&&i.saveAutomationTemplate){var l=o.automationTemplates.nodes.findIndex((function(e){return e.templateId===i.saveAutomationTemplate.templateId})),s=(0,a.Z)(o.automationTemplates.nodes);s[l]=(0,r.Z)({},i.saveAutomationTemplate),n.writeQuery({query:c.x,data:{automationTemplates:{nodes:s}}}),n.writeQuery({query:u.p,variables:{templateId:e},data:{automationTemplate:(0,r.Z)({},s[l])}})}}}),1)[0];return function(e){n({variables:{template:{json:null===e||void 0===e?void 0:e.json,name:e.name,template:null===e||void 0===e?void 0:e.template,templateId:e.templateId}}})}}},45411:function(e,n,t){"use strict";t.d(n,{H:function(){return p},M:function(){return h}});var r=t(70865),o=t(96670),i=t(87394),a=t(92228),l=t(50930),s=t(10081),u=t(33379),c=t(13100),d=t(17742);function f(){var e=(0,a.Z)(["\n  mutation updateCancelationToken($token: JSON, $templateId: String!) {\n    updateCancelationToken(token: $token, templateId: $templateId) {\n      token\n      templateId\n      updatedAt\n    }\n  }\n"]);return f=function(){return e},e}var p=(0,s.Ps)(f()),h=function(e){var n=(0,i.Z)((0,u.D)(p,{update:function(n,t){var i,a=t.data;try{i=n.readQuery({query:c.x})}catch(f){return}if(i&&a.updateCancelationToken){var s=i.automationTemplates.nodes.findIndex((function(e){return e.templateId===a.updateCancelationToken.templateId})),u=(0,l.Z)(i.automationTemplates.nodes);u[s]=(0,o.Z)((0,r.Z)({},u[s]),{cancelationToken:a.updateCancelationToken.token,updatedAt:a.updateCancelationToken.updatedAt}),n.writeQuery({query:c.x,data:{automationTemplates:{nodes:u}}}),n.writeQuery({query:d.p,variables:{templateId:e},data:{automationTemplate:(0,r.Z)({},u[s])}})}}}),1)[0];return function(t){n({variables:{token:t,templateId:e}})}}},22388:function(e,n,t){"use strict";var r=t(70865),o=t(87394),i=t(92228),a=t(50930),l=t(10081),s=t(24432),u=t(33379),c=t(16842);function d(){var e=(0,i.Z)(["\n  query ($templateId: String!) {\n    automationSchedule(templateId: $templateId) {\n      nodes {\n        enabled\n        id\n        itemId\n        templateId\n        value\n      }\n    }\n  }\n"]);return d=function(){return e},e}function f(){var e=(0,i.Z)(["\n  mutation saveAutomationScheduleItem($item: ScheduleItemInput!) {\n    saveAutomationScheduleItem(item: $item) {\n      enabled\n      itemId\n      templateId\n      value\n    }\n  }\n"]);return f=function(){return e},e}function p(){var e=(0,i.Z)(["\n  mutation deleteAutomationScheduleItem(\n    $templateId: String!\n    $itemId: String!\n  ) {\n    deleteAutomationScheduleItem(templateId: $templateId, itemId: $itemId)\n  }\n"]);return p=function(){return e},e}var h=(0,l.Ps)(d()),v=(0,l.Ps)(f()),m=(0,l.Ps)(p());n.ZP=function(e){var n=(0,s.aM)(h,{variables:{templateId:e}}),t=(0,o.Z)((0,u.D)(v,{update:function(n,t){var o=t.data,i=n.readQuery({query:h,variables:{templateId:e}});if(i&&(null===o||void 0===o?void 0:o.saveAutomationScheduleItem)){var l=(0,a.Z)(i.automationSchedule.nodes),s=i.automationSchedule.nodes.findIndex((function(e){return e.itemId===o.saveAutomationScheduleItem.itemId}));s>=0?l[s]=(0,r.Z)({},l[s],o.saveAutomationScheduleItem):l.push((0,r.Z)({},o.saveAutomationScheduleItem)),n.writeQuery({query:h,data:{automationSchedule:{nodes:l}},variables:{templateId:e}})}}}),1)[0],i=(0,o.Z)((0,u.D)(m,{update:function(n,t){var r=t.data,o=n.readQuery({query:h,variables:{templateId:e}});if(o&&(null===r||void 0===r?void 0:r.deleteAutomationScheduleItem)){var i=o.automationSchedule.nodes.findIndex((function(e){return e.itemId===r.deleteAutomationScheduleItem})),a=n.identify({id:o.automationSchedule.nodes[i].id,__typename:"ScheduleItem"});n.evict({id:a}),n.gc()}}}),1)[0];return(0,c.Z)((function(){n.refetch({templateId:e})}),[e]),[n,{saveAutomationScheduleItem:function(e){t({variables:{item:e}})},deleteAutomationScheduleItem:function(e,n){i({variables:{templateId:e,itemId:n}})}}]}},44980:function(e,n,t){"use strict";t.d(n,{jV:function(){return v}});
1var r=t(70865),o=t(87394),i=t(92228),a=t(50930),l=t(10081),s=t(24432),u=t(33379),c=t(16842);function d(){var e=(0,i.Z)(["\n  query ($templateId: String!) {\n    automationSources(templateId: $templateId) {\n      nodes {\n        source\n        id\n        createdAt\n        type\n      }\n    }\n  }\n"]);return d=function(){return e},e}function f(){var e=(0,i.Z)(["\n  mutation saveAutomationSource(\n    $templateId: String!\n    $newSource: String!\n    $oldSource: String\n  ) {\n    saveAutomationSource(\n      templateId: $templateId\n      newSource: $newSource\n      oldSource: $oldSource\n    ) {\n      source\n      createdAt\n      type\n    }\n  }\n"]);return f=function(){return e},e}function p(){var e=(0,i.Z)(["\n  mutation deleteAutomationSource($templateId: String!, $source: String!) {\n    deleteAutomationSource(templateId: $templateId, source: $source)\n  }\n"]);return p=function(){return e},e}var h=(0,l.Ps)(d()),v=(0,l.Ps)(f()),m=(0,l.Ps)(p());n.ZP=function(e){var n=(0,s.aM)(h,{variables:{templateId:e}}),t=(0,o.Z)((0,u.D)(v,{update:function(n,t){var o=t.data,i=n.readQuery({query:h,variables:{templateId:e}});if(i&&(null===o||void 0===o?void 0:o.saveAutomationSource)){var l=(0,a.Z)(i.automationSources.nodes),s=i.automationSources.nodes.findIndex((function(e){return e.source===o.saveAutomationSource.source}));s>=0?l[s]=(0,r.Z)({},l[s],o.saveAutomationSource):l.push((0,r.Z)({},o.saveAutomationSource)),n.writeQuery({query:h,data:{automationSources:{nodes:l}},variables:{templateId:e}})}}}),1)[0],i=(0,o.Z)((0,u.D)(m,{update:function(n,t){var r=t.data,o=n.readQuery({query:h,variables:{templateId:e}});if(o&&(null===r||void 0===r?void 0:r.deleteAutomationSource)){var i=o.automationSources.nodes.findIndex((function(e){return e.source===r.deleteAutomationSource}));console.log({cache:n,existingQuery:o});var a=n.identify({id:o.automationSources.nodes[i].id,__typename:"AutomationSource"});n.evict({id:a}),n.gc()}}}),1)[0];return(0,c.Z)((function(){n.refetch({templateId:e})}),[e]),[n,{saveAutomationSource:function(e,n,r){t({variables:{templateId:e,newSource:n,oldSource:r}})},deleteAutomationSource:function(e,n){i({variables:{templateId:e,source:n}})}}]}},59901:function(e,n,t){"use strict";t.d(n,{BN:function(){return s},RR:function(){return l},ZP:function(){return a}});var r=t(36386),o=t.n(r),i=t(2784);function a(e,n){var t=(0,i.useRef)(e);t.current=e;var r=(0,i.useMemo)((function(){return o()((function(e){var n;return null===(n=t.current)||void 0===n?void 0:n.call(t,e)}),200)}),[]);return(0,i.useEffect)((function(){return function(){r.clear()}}),[r]),n?e:r}function l(e,n){return(0,i.useCallback)(o()(e,n),[])}var s=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:200,t=(0,i.useRef)();(0,i.useEffect)((function(){t.current=e}),[e]);var r=(0,i.useMemo)((function(){if(t.current)return o()(t.current,n)}),[n]);return null!==r&&void 0!==r?r:e}},92155:function(e,n,t){"use strict";t.d(n,{D:function(){return i}});var r=t(2784),o=t(10423);function i(e){var n=(0,r.useRef)(null),t=(0,r.useRef)(null),i=(0,r.useRef)((function(){})),a=(0,r.useCallback)((function(){n.current&&t.current&&(i.current&&i.current(),i.current=(0,o.fi)(n.current,t.current,e).destroy)}),[n,t,i,e]);return(0,r.useMemo)((function(){return[function(e){n.current=e,a()},function(e){t.current=e,a()}]}),[n,t,a])}},11611:function(e,n,t){"use strict";t.d(n,{o:function(){return i}});var r=t(2784),o=t(55896);function i(e){var n=e.destinationWorkspaceId,t=e.currentWorkspaceId,i=e.currentWorkspaceEnvironments,a=null!==n&&void 0!==n?n:t,l=Boolean(a&&t&&a===t),s=l?void 0:a,u=(0,o.C)(s),c=u.getEnvironments,d=u.data,f=u.loading,p=u.error;return(0,r.useEffect)((function(){s&&c()}),[s,c]),{environments:(0,r.useMemo)((function(){return l?i:d}),[l,i,d]),loadingRemoteEnvironments:Boolean(s&&f),remoteEnvironmentsError:p}}},91773:function(e,n,t){"use strict";t.d(n,{W:function(){return i},n:function(){return a}});var r=t(42838),o=t(12433),i=function(e,n){var t=new URLSearchParams(window.location.search.slice(1)).toString();return e?"string"===typeof e?n?"?".concat(t,"&").concat(e):"?".concat(e):(0,r.Z)(e,URLSearchParams)?n?"?".concat(t,"&").concat(e.toString()):"?".concat(e.toString()):n?"?".concat(t,"&").concat(new 
1URLSearchParams(e).toString()):"?".concat(new URLSearchParams(e).toString()):n?"?".concat(t):""},a=function(e){return(0,o.Q)(e)}},6714:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return TS}});var r=t(87394),o=t(92228),i=t(52322),a=t(5632),l=t(2784),s=t.t(l,2),u=t(98767),c=t(32974),d=t(36128),f=t(40076),p=t(1654),h=t(98788),v=t(47842),m=t(70865),g=t(96670),x=t(22970),b=t(12524),y=t.n(b),C=t(40023),j=t(85390),w=t(58764),N=t(50930),S=t(10081),k=t(33379),_=t(13100),Z=t(17742);function E(){var e=(0,o.Z)(["\n  mutation updateAlias($alias: String!, $templateId: String!) {\n    updateAlias(alias: $alias, templateId: $templateId) {\n      alias\n      templateId\n      updatedAt\n    }\n  }\n"]);return E=function(){return e},e}var I=(0,S.Ps)(E()),O=function(e){var n=(0,r.Z)((0,k.D)(I,{update:function(n,t){var r,o=t.data;try{r=n.readQuery({query:_.x})}catch(l){return}if(r&&o.updateAlias){var i=r.automationTemplates.nodes.findIndex((function(e){return e.templateId===o.updateAlias.templateId})),a=(0,N.Z)(r.automationTemplates.nodes);a[i]=(0,g.Z)((0,m.Z)({},a[i]),{alias:o.updateAlias.alias,updatedAt:o.updateAlias.updatedAt}),n.writeQuery({query:_.x,data:{automationTemplates:{nodes:a}}}),n.writeQuery({query:Z.p,variables:{templateId:e},data:{automationTemplate:(0,m.Z)({},a[i])}})}}}),1)[0];return function(){var t=(0,h.Z)((function(t){return(0,x.__generator)(this,(function(r){switch(r.label){case 0:return[4,n({variables:{alias:t,templateId:e}})];case 1:return[2,{data:r.sent().data}]}}))}));return function(e){return t.apply(this,arguments)}}()},T=t(33593),A=t(45411),D=t(18005),L=t(3938),M=t(24637),P=t(96095),R=function(e){var n=e.onClick;return(0,i.jsxs)("svg",{width:"20",height:"18",viewBox:"0 0 20 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"jsonnetOptInIcon",onClick:n,children:[(0,i.jsx)("path",{d:"M10.7075 3.81703C10.9687 3.55587 10.9687 3.134 10.7075 2.87284L8.53788 0.703195C8.27672 0.442034 7.85484 0.442034 7.59368 0.703195C7.33252 0.964355 7.33252 1.38623 7.59368 1.64739L8.63832 2.69203H5.6852C4.03788 2.69203 2.69189 4.03802 2.69189 5.68534V9.36168C2.69189 9.72328 2.99323 10.0246 3.35484 10.0246C3.71645 10.0246 4.01779 9.72328 4.01779 9.36168V5.66525C4.01779 4.76123 4.76109 4.01793 5.66511 4.01793H8.61823L7.57359 5.06257C7.31243 5.32373 7.31243 5.7456 7.57359 6.00677C7.69413 6.1273 7.87493 6.20766 8.03564 6.20766C8.21645 6.20766 8.37716 6.14739 8.4977 6.00677L10.7075 3.81703Z",fill:"white"}),(0,i.jsx)("path",{d:"M15.7299 7.97559C15.3683 7.97559 15.067 8.27693 15.067 8.63853V12.3149C15.067 13.2189 14.3237 13.9622 13.4197 13.9622H10.4465L11.4911 12.9175C11.7523 12.6564 11.7523 12.2345 11.4911 11.9734C11.2299 11.7122 10.8081 11.7122 10.5469 11.9734L8.37727 14.1631C8.11611 14.4242 8.11611 14.8461 8.37727 15.1073L10.5469 17.297C10.6674 17.4175 10.8482 17.4979 11.009 17.4979C11.1898 17.4979 11.3505 17.4376 11.471 17.297C11.7322 17.0359 11.7322 16.614 11.471 16.3528L10.4264 15.3082H13.3795C15.0268 15.3082 16.3728 13.9622 16.3728 12.3149V8.63853C16.3929 8.27693 16.0916 7.97559 15.7299 7.97559Z",fill:"white"}),(0,i.jsx)("path",{d:"M15.73 0C13.8617 0 12.355 1.5067 12.355 3.35491C12.355 5.20312 13.8617 6.70982 15.7099 6.70982C17.5581 6.70982 19.0648 5.20312 19.0648 3.35491C19.0849 1.5067 17.5782 0 15.73 0ZM15.73 5.38393C14.605 5.38393 13.701 4.47991 13.701 3.35491C13.701 2.22991 14.605 1.32589 15.73 1.32589C16.855 1.32589 17.759 2.22991 17.759 3.35491C17.759 4.47991 16.8349 5.38393 15.73 5.38393Z",fill:"white"}),(0,i.jsx)("path",{d:"M3.35491 11.29C1.5067 11.29 0 12.7967 0 14.6449C0 16.4932 1.5067 17.9999 3.35491 17.9999C5.20312 17.9999 6.72991 16.4932 6.72991 14.6449C6.72991 12.7967 5.22321 11.29 3.35491 11.29ZM3.35491 16.674C2.22991 16.674 1.32589 15.7699 1.32589 14.6449C1.32589 13.5199 2.22991 12.6159 3.35491 12.6159C4.47991 12.6159 5.38393 13.5199 5.38393 14.6449C5.38393 15.7699 4.47991 16.674 3.35491 16.674Z",fill:"white"})]})},F=function(e){var n=e.automationTemplate,t=e.setEditorType,r=(0,w.O)(n.templateId),o=(0,l.useState)(!1),a=o[0],s=o[1],u=function(){var e=(0,h.Z)((function(){return(0,x.__generator)(this,(function(e){return r((0,g.Z)((0,m.Z)({},n),{json:null,template:'{\n  "cancelation_token": "",\n  "steps": [],\n}'})),s(!1),[2]}))}
1));return function(){return e.apply(this,arguments)}}();return(0,l.useEffect)((function(){n.template&&t("JSONNET")}),[n]),(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("button",{className:"jsonnetOptInText",onClick:function(){return s(!0)},children:"Switch to JSONNET"}),(0,i.jsx)(R,{onClick:function(){return s(!0)}}),(0,i.jsx)(L.Z,{header:"Are you sure you want to switch to JSONNET?",isOpen:a,onClose:function(){return s(!1)},onConfirm:u,subtext:"Your current template will be deleted and will be replaced by a new, empty JSONNET template. This action cannot be undone.",variant:"confirm"})]})},z=t(65310),B=function(e,n,t,r,o,a){var l=(0,z.ye)("automations-jsonnet");return(0,i.jsxs)(P.ER,{children:["JSON"===r&&(n?(0,i.jsx)(M.default.GreenCheckMark,{className:"check-mark"}):(0,i.jsx)(M.default.statusIcons.Error,{className:"error"})),"JSON"===r&&(n?"Valid Template":"".concat(e)),"JSONNET"===r&&"JSONNET",(0,i.jsx)("a",{target:"_blank",rel:"noopener noreferrer",href:"https://www.notion.so/trycourier/Automations-d620bc65b6694f7db2dc602f9fbe2233",children:(0,i.jsx)(M.default.Info,{className:"info"})}),"JSON"===r&&l&&a&&(0,i.jsx)(F,{automationTemplate:t,setEditorType:o})]})},H=t(98001),V=function(){return(0,i.jsx)("svg",{width:"26",height:"15",viewBox:"0 0 26 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,i.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M16.1806 1.4581C16.384 0.891758 16.0898 0.26778 15.5234 0.0644085C14.9571 -0.138963 14.3331 0.155286 14.1297 0.721631L9.79804 12.7844C9.59467 13.3508 9.88892 13.9748 10.4553 14.1781C11.0216 14.3815 11.6456 14.0872 11.849 13.5209L16.1806 1.4581ZM8.70523 3.65441C8.97674 4.19142 8.7615 4.84687 8.22448 5.11837L3.14062 7.68869L8.21607 10.2C8.75541 10.4668 8.9763 11.1204 8.70944 11.6597C8.44257 12.1991 7.78901 12.42 7.24967 12.1531L0.779622 8.95179C-0.254876 8.43992 -0.261232 6.96679 0.768807 6.44602L7.24126 3.17365C7.77828 2.90215 8.43372 3.11739 8.70523 3.65441ZM17.2736 3.65441C17.0021 4.19142 17.2173 4.84687 17.7544 5.11837L22.8382 7.68869L17.7628 10.2C17.2234 10.4668 17.0025 11.1204 17.2694 11.6597C17.5363 12.1991 18.1898 12.42 18.7292 12.1531L25.1992 8.95179C26.2337 8.43992 26.2401 6.96679 25.21 6.44602L18.7376 3.17365C18.2006 2.90215 17.5451 3.11739 17.2736 3.65441Z",fill:"#9121C2"})})},$=function(){return(0,i.jsx)("svg",{width:"26",height:"15",viewBox:"0 0 26 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,i.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M16.1806 1.4581C16.384 0.891758 16.0898 0.26778 15.5234 0.0644085C14.9571 -0.138963 14.3331 0.155286 14.1297 0.721631L9.79804 12.7844C9.59467 13.3508 9.88892 13.9748 10.4553 14.1781C11.0216 14.3815 11.6456 14.0872 11.849 13.5209L16.1806 1.4581ZM8.70523 3.65441C8.97674 4.19142 8.7615 4.84687 8.22448 5.11837L3.14062 7.68869L8.21607 10.2C8.75541 10.4668 8.9763 11.1204 8.70944 11.6597C8.44257 12.1991 7.78901 12.42 7.24967 12.1531L0.779622 8.95179C-0.254876 8.43992 -0.261232 6.96679 0.768807 6.44602L7.24126 3.17365C7.77828 2.90215 8.43372 3.11739 8.70523 3.65441ZM17.2736 3.65441C17.0021 4.19142 17.2173 4.84687 17.7544 5.11837L22.8382 7.68869L17.7628 10.2C17.2234 10.4668 17.0025 11.1204 17.2694 11.6597C17.5363 12.1991 18.1898 12.42 18.7292 12.1531L25.1992 8.95179C26.2337 8.43992 26.2401 6.96679 25.21 6.44602L18.7376 3.17365C18.2006 2.90215 17.5451 3.11739 17.2736 3.65441Z",fill:"#73819B"})})},U=function(){return(0,i.jsxs)("svg",{width:"23",height:"22",viewBox:"0 0 23 22",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,i.jsx)("path",{d:"M13.7186 21.326C12.5461 21.2846 11.3792 21.1437 10.2306 20.905C5.29556 19.921 2.03056 17.013 0.700559 13.387C-0.629441 9.761 -0.103441 5.216 2.60256 3.048C5.30856 0.88 10.1456 0.637 14.0396 3.048C14.5086 3.339 14.9396 3.637 15.3486 3.936L13.8796 5.25C13.5336 4.995 13.1556 4.739 12.7536 4.486C9.71456 2.575 5.94156 2.808 3.82656 4.523C1.71156 6.238 1.49056 9.915 2.52656 12.786C3.56256 15.657 6.17956 17.686 9.96556 18.74C10.9803 19.0326 12.0279 19.1959 13.0836 19.226C13.8054 19.2509 14.5253 19.1362 15.2036 18.888C16.1806 18.52 15.7686 17.246 15.5036 16.506C14.6566 14.17 14.2836 12.481 15.9206 11.624C16.7436 11.193 17.2816 11.016 17.6326 10.383C17.9836 9.75 17.5326 9.028 17.4086 8.647C17.4086 8.647 17.2576 8.429 16.9516 8.063C17.5296 7.444 18.0006 6.933 18.2786 6.632C18.8448 7.2641 19.3441 7.9531 19.7686 8.688C19.9216 9.04122 20.0005 9.42206 20.0005 9.807C20.0005 10.1919 19.9216 10.5728 19.7686 10.926C19.3176 11.726 18.9156 11.903 17.8626 12.447C15.7626 13.531 16.7756 15.138 17.8626 18.086C17.9883 18.3331 18.0633 18.6029 18.0834 18.8795C18.1034 19.156 18.068 19.4338 17.9792 19.6965C17.8905 19.9591 17.7501 20.2014 17.5664 20.4091C17.3827 20.6169 17.1594 20.7858 16.9096 20.906C15.9947 21.2128 15.0331 21.3566 14.0686 21.331C13.9506 21.331 13.8339 21.3293 13.7186 21.326ZM12.4576 7.647C13.4896 6.837 17.3126 3.664 17.3126 3.664L21.6496 0C21.868 0.00702863 22.0784 0.0841641 22.2496 0.22C22.399 0.413178 22.4877 0.646353 22.5046 0.89L18.7846 4.733C18.7846 4.733 14.9516 8.553 14.2206 9.542C13.0623 10.6602 11.5911 11.3993 10.0026 11.661C10.4962 10.1497 11.337 8.77495 12.4576 7.647
1Z",fill:"#9121C2"}),(0,i.jsx)("path",{d:"M5.50293 8.33C6.33136 8.33 7.00293 7.65843 7.00293 6.83C7.00293 6.00157 6.33136 5.33 5.50293 5.33C4.6745 5.33 4.00293 6.00157 4.00293 6.83C4.00293 7.65843 4.6745 8.33 5.50293 8.33Z",fill:"#9121C2"}),(0,i.jsx)("path",{d:"M4.50293 12.33C5.33136 12.33 6.00293 11.6584 6.00293 10.83C6.00293 10.0016 5.33136 9.33 4.50293 9.33C3.6745 9.33 3.00293 10.0016 3.00293 10.83C3.00293 11.6584 3.6745 12.33 4.50293 12.33Z",fill:"#9121C2"}),(0,i.jsx)("path",{d:"M12.0029 18.33C13.1075 18.33 14.0029 17.4346 14.0029 16.33C14.0029 15.2254 13.1075 14.33 12.0029 14.33C10.8984 14.33 10.0029 15.2254 10.0029 16.33C10.0029 17.4346 10.8984 18.33 12.0029 18.33Z",fill:"#9121C2"}),(0,i.jsx)("path",{d:"M9.50293 7.33C10.3314 7.33 11.0029 6.65843 11.0029 5.83C11.0029 5.00157 10.3314 4.33 9.50293 4.33C8.6745 4.33 8.00293 5.00157 8.00293 5.83C8.00293 6.65843 8.6745 7.33 9.50293 7.33Z",fill:"#9121C2"})]})},W=function(){return(0,i.jsxs)("svg",{width:"23",height:"22",viewBox:"0 0 23 22",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,i.jsx)("path",{d:"M13.7186 21.326C12.5461 21.2846 11.3792 21.1437 10.2306 20.905C5.29556 19.921 2.03056 17.013 0.700559 13.387C-0.629441 9.761 -0.103441 5.216 2.60256 3.048C5.30856 0.88 10.1456 0.637 14.0396 3.048C14.5086 3.339 14.9396 3.637 15.3486 3.936L13.8796 5.25C13.5336 4.995 13.1556 4.739 12.7536 4.486C9.71456 2.575 5.94156 2.808 3.82656 4.523C1.71156 6.238 1.49056 9.915 2.52656 12.786C3.56256 15.657 6.17956 17.686 9.96556 18.74C10.9803 19.0326 12.0279 19.1959 13.0836 19.226C13.8054 19.2509 14.5253 19.1362 15.2036 18.888C16.1806 18.52 15.7686 17.246 15.5036 16.506C14.6566 14.17 14.2836 12.481 15.9206 11.624C16.7436 11.193 17.2816 11.016 17.6326 10.383C17.9836 9.75 17.5326 9.028 17.4086 8.647C17.4086 8.647 17.2576 8.429 16.9516 8.063C17.5296 7.444 18.0006 6.933 18.2786 6.632C18.8448 7.2641 19.3441 7.9531 19.7686 8.688C19.9216 9.04122 20.0005 9.42206 20.0005 9.807C20.0005 10.1919 19.9216 10.5728 19.7686 10.926C19.3176 11.726 18.9156 11.903 17.8626 12.447C15.7626 13.531 16.7756 15.138 17.8626 18.086C17.9883 18.3331 18.0633 18.6029 18.0834 18.8795C18.1034 19.156 18.068 19.4338 17.9792 19.6965C17.8905 19.9591 17.7501 20.2014 17.5664 20.4091C17.3827 20.6169 17.1594 20.7858 16.9096 20.906C15.9947 21.2128 15.0331 21.3566 14.0686 21.331C13.9506 21.331 13.8339 21.3293 13.7186 21.326ZM12.4576 7.647C13.4896 6.837 17.3126 3.664 17.3126 3.664L21.6496 0C21.868 0.00702863 22.0784 0.0841641 22.2496 0.22C22.399 0.413178 22.4877 0.646353 22.5046 0.89L18.7846 4.733C18.7846 4.733 14.9516 8.553 14.2206 9.542C13.0623 10.6602 11.5911 11.3993 10.0026 11.661C10.4962 10.1497 11.337 8.77495 12.4576 7.647Z",fill:"#73819B"}),(0,i.jsx)("path",{d:"M5.50195 8.33C6.33038 8.33 7.00195 7.65843 7.00195 6.83C7.00195 6.00157 6.33038 5.33 5.50195 5.33C4.67353 5.33 4.00195 6.00157 4.00195 6.83C4.00195 7.65843 4.67353 8.33 5.50195 8.33Z",fill:"#73819B"}),(0,i.jsx)("path",{d:"M4.50195 12.33C5.33038 12.33 6.00195 11.6584 6.00195 10.83C6.00195 10.0016 5.33038 9.33 4.50195 9.33C3.67353 9.33 3.00195 10.0016 3.00195 10.83C3.00195 11.6584 3.67353 12.33 4.50195 12.33Z",fill:"#73819B"}),(0,i.jsx)("path",{d:"M12.002 18.33C13.1065 18.33 14.002 17.4346 14.002 16.33C14.002 15.2254 13.1065 14.33 12.002 14.33C10.8974 14.33 10.002 15.2254 10.002 16.33C10.002 17.4346 10.8974 18.33 12.002 18.33Z",fill:"#73819B"}),(0,i.jsx)("path",{d:"M9.50195 7.33C10.3304 7.33 11.002 6.65843 11.002 5.83C11.002 5.00157 10.3304 4.33 9.50195 4.33C8.67353 4.33 8.00195 5.00157 8.00195 5.83C8.00195 6.65843 8.67353 7.33 9.50195 7.33Z",fill:"#73819B"})]})};function q(){var e=(0,o.Z)(["\n  width: 100%;\n  justify-content: flex-end;\n  display: flex;\n  padding-right: 26px;\n\n  .toggle-switch-container {\n    display: flex;\n    align-items: center;\n    padding-bottom: 12px;
1\n\n    .toggle-switch {\n      margin-right: 12px;\n      margin-left: 12px;\n    }\n  }\n"]);return q=function(){return e},e}var K=u.default.div(q()),G=function(e){var n=e.active,t=e.disabled,r=void 0!==t&&t,o=e.onChange;return(0,i.jsx)(K,{children:(0,i.jsxs)("div",{className:"toggle-switch-container",children:[n?(0,i.jsx)(W,{}):(0,i.jsx)(U,{}),(0,i.jsx)(H.default,{className:"toggle-switch",onChange:o,checked:n,disabled:r,onColor:"#9121c2",offColor:"#9121c2",checkedIcon:!1,uncheckedIcon:!1,height:16,width:34,handleDiameter:13}),n?(0,i.jsx)(V,{}):(0,i.jsx)($,{})]})})},J=t(56982),X=t(58013),Y=function(e){var n=(0,X.Z)({},e);return(0,i.jsxs)("svg",(0,g.Z)((0,m.Z)({},n),{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,i.jsx)("path",{d:"M9 1L1 8.99983",stroke:"#9121C2",strokeWidth:"2"}),(0,i.jsx)("path",{d:"M9 9L1 1.00017",stroke:"#9121C2",strokeWidth:"2"})]}))},Q=t(55944);function ee(){var e=(0,o.Z)(["\n  width: 193px;\n  height: 53px;\n  margin-bottom: 7px;\n  padding-left: 8px;\n  padding-right: 8px;\n\n  display: flex;\n  align-items: center;\n\n  background: #ffffff;\n  border: 1px solid #e7e2e9;\n  box-sizing: border-box;\n  border-radius: 6px;\n\n  &.active {\n    background: #f7eff7;\n    border: 1px solid #9121c2;\n    box-sizing: border-box;\n    box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);\n    border-radius: 6px;\n  }\n\n  &:hover {\n    background: #f7eff7;\n    border: 1px solid #9121c2;\n    box-sizing: border-box;\n    box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);\n    border-radius: 6px;\n  }\n"]);return ee=function(){return e},e}function ne(){var e=(0,o.Z)(["\n  display: flex;\n  align-items: center;\n  justify-content: space-between;\n\n  .close-icon {\n    margin-top: -5px;\n    &:hover {\n      border-radius: 50%;\n      width: 20px;\n      height: 20px;\n      text-align: center;\n      line-height: 20px;\n      background: #d8b1e7;\n      margin-right: -5px;\n      cursor: pointer;\n    }\n  }\n"]);return ne=function(){return e},e}function te(){var e=(0,o.Z)(["\n  padding-left: 8px;\n\n  width: 100%;\n  display: flex;\n  flex-direction: column;\n\n  .primary-text {\n    font-family: Inter;\n    font-style: normal;\n    font-weight: bold;\n    font-size: 14px;\n    line-height: 19px;\n    text-transform: capitalize;\n    color: #334563;\n  }\n\n  .secondary-text {\n    font-family: Inter;\n    font-style: italic;\n    font-weight: normal;\n    font-size: 10px;\n    line-height: 14px;\n    color: #888888;\n    text-overflow: ellipsis;\n    white-space: nowrap;\n    overflow: hidden;\n  }\n"]);return te=function(){return e},e}var re=u.default.div(ee()),oe=u.default.div(ne()),ie=u.default.div(te()),ae=function(e){var n,t,r;if(!e.action)return"";var o=function(e){if("string"===typeof e)return e;if((0,Q.lp)(e)&&(0,Q._7)(e)){var n=e.$ref;return"{ $ref: ".concat(n," }")}return"Invalid field definition."},i={send:{label:e.recipient?"Recipient:":"",value:(null===e||void 0===e?void 0:e.message)?JSON.stringify(null===e||void 0===e||null===(n=e.message)||void 0===n?void 0:n.to):"".concat(o(e.recipient))},"send-list":{label:e.list?"List:":"",value:"".concat(o(e.list))},delay:{label:e.duration?"Duration:":e.until?"Until:":"",value:e.duration?"".concat(o(e.duration)):e.until?"".concat(o(e.until)):""},invoke:{label:e.template?"Template:":"",value:"".concat(o(e.template))},cancel:{label:e.cancelation_token?"Token:":"",value:"".concat(o(e.cancelation_token))},"fetch-data":{label:(null===e||void 0===e||null===(t=e.webhook)||void 0===t?void 0:t.url)?"Webhook:":"",value:"".concat(o(null===e||void 0===e||null===(r=e.webhook)||void 0===r?void 0:r.url))},"update-profile":{label:e.recipient_id?"Recipient:":"",value:"".concat(o(e.recipient_id))},subscribe:{label:(null===e||void 0===e?void 0:e.recipient_id)?"Recipient:":"",value:"".concat(o(null===e||void 0===e?void 0:e.recipient_id))}};if(!i[e.action])return"";var a,l=i[e.action].label,s=null!==(a=i[e.action].value)&&void 0!==a?a:"";return"".concat(l," ").concat(s)},le=function(e){var n=e.activeStepIndex,t=e.showStepForm,o=e.handleStepOnClick,a=e.handleStepOnDelete,s=e.stepMap,u=e.writePermission,c=(0,r.Z)(l.useState({}),2),d=c[0],f=c[1];return(0,i.jsx)(i.Fragment,{children:Object.entries(s).map((function(e,s){var c=(0,r.Z)(e,2),p=c[0],h=c[1];return(0,i.jsx)(C.Draggable,{draggableId:p,index:s,isDragDisabled:!u,children:function(e){return(0,l.createElement)(re,(0,g.Z)((0,m.Z)({onMouseEnter:function(){f((0,v.Z)({},s,!0))},onMouseLeave:function(){f((0,v.Z)({},s,!1))},className:y()({active:n===s&&t}),ref:e.innerRef},e.draggableProps,e.dragHandleProps),{key:p,onClick:function(){return o(Number(p),h)},children:[u&&(0,i.jsx)(J.GgY,{className:"h-3.5 w-3.5 shrink-0 text-[#334563]"}),(0,i.jsxs)(ie,{children:[(0,i.jsxs)(oe,{children:[(0,i.jsx)("span",{className:"primary-text",children:h.action}),(n===s&&t||d[s])&&u&&(0,i.jsx)("div",{className:"close-icon",onClick:function(e){return a(e,s)},children:(0,i.jsx)(Y,{})})]}),(0,i.jsx)("span",{className:"secondary-text",children:ae(h)})]})]}))}},p)}))})},se=t(56653),ue=function(e){return e?"object"===typeof e?JSON.stringify(e,null,2):"string"===typeof e?e:void 0:null},ce=function(){return(0,i.jsx)("svg",{width:"31",height:"30",viewBox:"0 0 31 30",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,i.jsx)("path",{d:"M29.6301 26.1039C29.7473 26.2201 29.8404 26.3584 29.9038 26.5108C29.9673 26.6632 30 26.8266 30 26.9917C30 27.1568 29.9673 27.3202 29.9038 27.4726C29.8404 27.625 29.7473 27.7633 29.6301 27.8795L27.8795 29.6301C27.7633 29.7473 27.625 29.8404 27.4726 29.9038C27.3202 29.9673 27.1568 30 26.9917 3
10C26.8266 30 26.6632 29.9673 26.5108 29.9038C26.3584 29.8404 26.2201 29.7473 26.1039 29.6301L15.005 18.5262L3.90111 29.6301C3.78487 29.7473 3.64657 29.8404 3.49419 29.9038C3.34181 29.9673 3.17838 30 3.0133 30C2.84823 30 2.68479 29.9673 2.53241 29.9038C2.38004 29.8404 2.24174 29.7473 2.12549 29.6301L0.374879 27.8795C0.257678 27.7633 0.164652 27.625 0.101169 27.4726C0.037686 27.3202 0.00500175 27.1568 0.00500175 26.9917C0.00500175 26.8266 0.037686 26.6632 0.101169 26.5108C0.164652 26.3584 0.257678 26.2201 0.374879 26.1039L11.4738 15.005L0.369877 3.89611C0.252676 3.77987 0.15965 3.64157 0.0961673 3.48919C0.0326842 3.33681 0 3.17337 0 3.0083C0 2.84323 0.0326842 2.67979 0.0961673 2.52741C0.15965 2.37503 0.252676 2.23673 0.369877 2.12049L2.12049 0.369877C2.23673 0.252676 2.37503 0.15965 2.52741 0.0961673C2.67979 0.0326842 2.84323 0 3.0083 0C3.17337 0 3.33681 0.0326842 3.48919 0.0961673C3.64157 0.15965 3.77987 0.252676 3.89611 0.369877L15.005 11.4738L26.1089 0.369877C26.2251 0.252676 26.3634 0.15965 26.5158 0.0961673C26.6682 0.0326842 26.8316 0 26.9967 0C27.1618 0 27.3252 0.0326842 27.4776 0.0961673C27.63 0.15965 27.7683 0.252676 27.8845 0.369877L29.6351 2.12049C29.7523 2.23673 29.8454 2.37503 29.9088 2.52741C29.9723 2.67979 30.005 2.84323 30.005 3.0083C30.005 3.17337 29.9723 3.33681 29.9088 3.48919C29.8454 3.64157 29.7523 3.77987 29.6351 3.89611L18.5262 15.005L29.6301 26.1039Z",fill:"#344563"})})},de=function(){return(0,i.jsx)("svg",{width:"30",height:"30",viewBox:"0 0 30 30",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,i.jsx)("path",{d:"M6.66449 27.4707C3.67435 25.4721 1.50187 22.4656 0.542963 18.9992C-0.41594 15.5328 -0.097421 11.8373 1.44047 8.58605C2.97836 5.33484 5.63324 2.74443 8.92126 1.28692C12.2093 -0.170601 15.9116 -0.398193 19.3533 0.645619C22.7951 1.68943 25.7473 3.93515 27.6718 6.97351C29.5964 10.0119 30.3651 13.6406 29.838 17.1983C29.3109 20.7561 27.5231 24.006 24.8002 26.3559C22.0774 28.7057 18.6009 29.999 15.0043 30C12.0354 30.0002 9.13313 29.12 6.66449 27.4707ZM8.33366 5.00451C5.94244 6.60313 4.20521 9.0077 3.43856 11.78C2.6719 14.5523 2.92686 17.5078 4.15697 20.1079C5.38708 22.7079 7.51044 24.7795 10.1401 25.945C12.7698 27.1104 15.7307 27.2923 18.4832 26.4574C21.2357 25.6224 23.5966 23.8263 25.1357 21.3964C26.6747 18.9664 27.2894 16.0643 26.8678 13.219C26.4462 10.3737 25.0162 7.77461 22.8386 5.89538C20.661 4.01615 17.8807 2.98189 15.0043 2.98109C12.6296 2.98115 10.3082 3.6853 8.33366 5.00451ZM19.9128 21.7592L13.9086 15.755C13.7711 15.6138 13.6909 15.4266 13.6834 15.2297V6.73372C13.6834 6.53467 13.7625 6.34377 13.9032 6.20302C14.044 6.06227 14.2349 5.98319 14.4339 5.98319H15.5747C15.7738 5.98319 15.9647 6.06227 16.1054 6.20302C16.2462 6.34377 16.3253 6.53467 16.3253 6.73372V14.4491L21.7741 19.8994C21.9136 20.0417 21.9918 20.233 21.9918 20.4323C21.9918 20.6316 21.9136 20.8229 21.7741 20.9652L20.9785 21.7592C20.9084 21.8288 20.8252 21.8838 20.7338 21.9212C20.6423 21.9585 20.5444 21.9775 20.4456 21.9769C20.2465 21.9763 20.0554 21.8982 19.9128 21.7592Z",fill:"#344563"})})},fe=function(){return(0,i.jsxs)("svg",{width:"26",height:"30",viewBox:"0 0 26 30",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,i.jsx)("path",{d:"M25.8063 4.06258C25.8063 4.0698 25.8063 4.07656 25.806 4.08375C25.77 6.31774 20.0069 8.12516 12.9032 8.12516C5.79936 8.12516 0.0362899 6.31774 0.000335835 4.08371C-1.84574e-07 4.07652 0 4.06977 0 4.06254C0 1.81884 5.77685 0 12.9032 0C20.0295 0 25.8063 1.81884 25.8063 4.06258Z",fill:"#344563"}),(0,i.jsx)("path",{d:"M25.8479 25.9375C25.8479 25.9447 25.8479 25.9514 25.8476 25.9586C25.8116 28.1926 20.0485 30 12.9448 30C5.84097 30 0.0778936 28.1926 0.0419395 25.9586C0.0416034 25.9514 0.0416036 25.9446 0.0416036 25.9374L0.0332031 20.2139C0.0332031 20.2211 0.0332029 20.2279 0.033539 20.2351C0.0694595 22.469 5.83257 24.2764 12.9364 24.2764C20.0401 24.2764 25.8032 22.469 25.8392 20.2351C25.8395 20.2279 25.8395 20.2211 25.8395 20.2139L25.8479 25.9375Z",fill:"#344563"}),(0,i.jsx)("path",{d:"M25.8196 18.6794C25.8196 18.6867 25.8196 18.6934 25.8193 18.7006C25.7833 20.9346 20.0203 22.742 12.9164 22.742C5.81265 22.742 0.0495735 20.9346 0.0136194 18.7006C0.0132834 18.6934 0.0132833 18.6867 0.0132833 18.6794L0.00488281 12.9559C0.00488281 12.9631 0.00488288 12.9699 0.0052189 12.9771C0.0411394 15.211 5.80425 17.0185 12.908 17.0185C20.0119 17.0185 25.7749 15.211 25.8109 12.9771C25.8112 12.9699 25.8112 12.9631 25.8112 12.9559L25.8196 18.6794Z",fill:"#344563"}),(0,i.jsx)("path",{d:"M25.8215 11.3542C25.8215 11.3614 25.8215 11.3682 25.8212 11.3754C25.7853 13.6093 20.0222 15.4167 12.9184 15.4167C5.8146 15.4167 0.051493 13.6093 0.0155725 11.3754C0.0152365 11.3682 0.0152364 11.3614 0.0152364 11.3542L0.00683594 5.63068C0.00683594 5.6379 0.00683601 5.64465 0.00717203 5.65185C0.0430925 7.8858 5.8062 9.69322 12.91 9.69322C20.0138 9.69322 25.7769 7.8858 25.8128 5.65185C25.8131 5.64465 25.8131 5.6379 25.8131 5.63068L25.8215 11.3542Z",fill:"#344563"})]})},pe=function(){return(0,i.jsx)("svg",{width:"490",height:"1",viewBox:"0 0 490 1",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"horizontalDivider",children:(0,i.jsx)("rect",{width:"490",height:"1",fill:"#E7E2E9"})})},he=function(){return(0,i.jsx)("svg",{width:"30",height:"30",viewBox:"0 0 30 30",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,i.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11.1849 5.29449L11.4328 2.53876C11.4698 2.12915 11.7693 1.79125 12.1719 1.70595C14.0348 1.30993 15.96 1.30993 17.823 1.70595C18.2256 1.79125 18.525 2.12915 18.5621 2.53876L18.81 5.29449C19.7778 5.67458 20.6837 6.19713 21.4963 6.84529L24.007 5.68254C24.38 5.50961 24.8224 5.60006 25.0975 5.90563C26.3723 7.32098 27.3349 8.98848 27.9236 10.8003C28.0506 11.1912 27.9076 11.6195 27.5716 11.8562L25.3089 13.4492C25.4636 14.4774 25.4636 15.523 25.3089 16.5508L27.5716 18.1438C27.9076 18.3805 28.0506 18.8088 27.9236 19.1997C27.3349 21.0115 26.3723 22.679 25.0975 24.0944C24.8224 24.3999 24.38 24.4904 24.007 24.3175L21.4963 23.1547C20.6832 23.8029 19.7778 24.3254 18.81 24.7055L18.5621 27.4612C18.525 27.8709 18.2256 28.2088 17.823 28.2941C15.96 28.6901 14.0348 28.6901 12.1719 28.2941C11.7693 28.2088 11.4698 27.8709 11.4328 27.4612L11.1849 24.7055C10.2171 24.3254 9.31115 23.8029 8.49849 23.1547L5.98787 24.3175C5.61481 24.4904 5.1724 24.3999 4.89729 24.0944C3.62253 22.679 2.6599 21.0115 2.07126 19.1997C1.94425 18.8088 2.0872 18.3805 2.42323 18.1438L4.68592 16.5508C4.53127 15.5226 4.53127 14.477 4.68592 13.4492L2.42323 11.8562C2.0872 11.6195 1.94425 11.1912 2.07126 10.8003C2.6599 8.98848 3.62253 7.32098 4.89729 5.9
10563C5.1724 5.60006 5.61481 5.50961 5.98787 5.68254L8.49849 6.84529C9.31161 6.19713 10.2171 5.67458 11.1849 5.29449ZM14.9974 10.3134C12.4109 10.3134 10.3108 12.4135 10.3108 15C10.3108 17.5865 12.4109 19.6866 14.9974 19.6866C17.584 19.6866 19.684 17.5865 19.684 15C19.684 12.4135 17.584 10.3134 14.9974 10.3134Z",stroke:"#344563",strokeWidth:"1.6"})})},ve=function(){return(0,i.jsx)("svg",{width:"46",height:"30",viewBox:"0 0 46 30",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,i.jsx)("path",{d:"M44.2919 0.000275994C44.2619 0.00104199 44.234 0.00311437 44.204 0.00762927C44.1845 0.0106482 44.1649 0.00752336 44.1454 0.012045L0.599369 9.01162C0.289531 9.07614 0.0516669 9.32663 0.0074043 9.64022C-0.0368583 9.95381 0.120264 10.2617 0.400094 10.4095L12.8768 16.9914L15.0659 29.134C15.0644 29.143 15.0666 29.1529 15.0659 29.1619C15.0584 29.2219 15.0569 29.2814 15.0644 29.3406C15.0681 29.3706 15.073 29.3993 15.0805 29.4286C15.0978 29.4998 15.125 29.5663 15.1626 29.6293C15.1701 29.6413 15.1704 29.6554 15.1787 29.6674C15.1809 29.6711 15.1844 29.6747 15.1875 29.6776C15.1972 29.6919 15.2099 29.703 15.2212 29.7172C15.2564 29.7607 15.2934 29.8007 15.3355 29.8344C15.3422 29.8397 15.347 29.8468 15.3545 29.852C15.3658 29.8603 15.3784 29.8636 15.3897 29.8711C15.4354 29.9011 15.483 29.9248 15.5333 29.9443C15.5535 29.9518 15.5723 29.9618 15.5933 29.9678C15.6609 29.9873 15.7309 30 15.8014 30H15.8029C15.8059 30 15.8087 29.9985 15.8117 29.9985C15.8244 29.9993 15.8385 30 15.8512 30C16.059 30 16.2458 29.9074 16.3846 29.7641L24.697 24.2225L33.3992 29.8798C33.5222 29.9594 33.6647 30 33.808 30C33.8868 30 33.9666 29.9874 34.0439 29.9619C34.26 29.8899 34.4325 29.7237 34.5113 29.5091L45.0114 1.00984C45.0211 0.984329 45.0295 0.95772 45.0363 0.930714C45.0393 0.919463 45.0399 0.907517 45.0421 0.897014C45.0444 0.888764 45.0465 0.87964 45.048 0.870637C45.051 0.852632 45.0553 0.834432 45.0568 0.816426C45.062 0.76091 45.0562 0.705653 45.0494 0.649387C45.0479 0.635135 45.0502 0.621148 45.0479 0.606896C45.0344 0.532625 45.01 0.459807 44.9732 0.390038C44.9672 0.378035 44.9595 0.366878 44.9527 0.35487C44.9512 0.353383 44.9505 0.351265 44.9498 0.349017C44.949 0.34753 44.9461 0.346854 44.9454 0.344601C44.9401 0.336346 44.936 0.327195 44.9307 0.319692C44.8842 0.251423 44.8282 0.194805 44.7651 0.146791C44.7509 0.136288 44.7347 0.130165 44.7197 0.120414C44.6642 0.0836549 44.6054 0.0542228 44.5424 0.0339639C44.5147 0.0249611 44.4874 0.0201666 44.4589 0.0149172C44.4041 0.00366153 44.3489 -0.0012365 44.2919 0.000263962L44.2919 0.000275994ZM39.0448 2.59818L13.5567 15.6522L2.94965 10.0578L39.0448 2.59818ZM42.7432 2.82676L33.4285 28.1098L21.872 20.5989L20.121 19.4604L42.7432 2.82676ZM36.359 5.65911L18.3583 18.8948C18.3291 18.9166 18.3062 18.9426 18.2807 18.9681C18.2709 18.9771 18.2611 18.9847 18.2528 18.9944C18.2371 19.0117 18.2231 19.0299 18.2089 19.0487C18.1954 19.0667 18.1842 19.0841 18.1722 19.1029C18.1445 19.1479 18.1214 19.1955 18.1034 19.245C18.0996 19.2548 18.0932 19.2616 18.0902 19.2714C18.0894 19.2744 18.0865 19.2758 18.0858 19.2787L16.0227 25.9838L14.3889 16.9123L36.359 5.65911ZM19.2316 20.6722L22.4156 22.7426L23.3255 23.3345L20.2324 25.3962L17.1861 27.427L19.2316 20.6722Z",fill:"#344563"})})},me=function(){return(0,i.jsxs)("svg",{width:"31",height:"32",viewBox:"0 0 31 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,i.jsxs)("mask",{id:"path-1-outside-1",maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"31",height:"32",fill:"black",children:[(0,i.jsx)("rect",{fill:"white",width:"31",height:"32"}
1),(0,i.jsx)("path",{d:"M8.74465 30.8352C8.74465 30.631 8.8223 30.0281 8.88513 29.7445C9.1849 28.3909 9.86466 27.1725 10.8523 26.2186C11.9208 25.1867 13.1865 24.5608 14.6829 24.3244C15.1572 24.2494 16.2483 24.2494 16.7226 24.3244C18.219 24.5608 19.4847 25.1867 20.5531 26.2186C21.5408 27.1725 22.2206 28.3909 22.5204 29.7445C22.5832 30.0281 22.6608 30.631 22.6608 30.8352V31H22.2095H21.758L21.7378 30.7958C21.6992 30.4066 21.63 29.9852 21.5577 29.6991C21.0539 27.7058 19.5669 26.0973 17.6299 25.4501C16.9376 25.2189 16.4081 25.1322 15.6876 25.1322C14.9671 25.1322 14.4376 25.2189 13.7454 25.4501C11.8083 26.0973 10.3214 27.7058 9.81757 29.6991C9.74528 29.9852 9.67605 30.4066 9.63743 30.7958L9.61719 31H9.18094H8.74465V30.8352ZM15.2641 23.2212C14.5559 23.1328 13.8321 22.7746 13.3136 22.2562C11.9954 20.938 11.9954 18.7961 13.3136 17.4779C14.3215 16.47 15.8507 16.2041 17.1465 16.8113C18.6337 17.5083 19.4091 19.2196 18.952 20.7968C18.4855 22.4068 16.9301 23.4293 15.2641 23.2212ZM16.3683 22.2882C17.0546 22.0921 17.6073 21.6357 17.9265 21.0015C18.1219 20.6134 18.1886 20.3286 18.1886 19.8822C18.1886 19.4358 18.1219 19.151 17.9265 18.7629C17.6046 18.1234 17.0553 17.6725 16.3532 17.4715C16.1546 17.4147 16.0378 17.4022 15.7027 17.4022C15.238 17.4022 14.9725 17.4607 14.5985 17.6453C13.9575 17.9618 13.4602 18.577 13.2794 19.2771C13.1924 19.6139 13.1927 20.1518 13.2799 20.4872C13.5232 21.4236 14.2468 22.1155 15.2074 22.3304C15.4985 22.3955 16.0649 22.3749 16.3684 22.2882H16.3683ZM1 15.3459C1 15.1417 1.07766 14.5389 1.14049 14.2552C1.44025 12.9016 2.12002 11.6832 3.1077 10.7293C4.17612 9.69743 5.44183 9.07153 6.93824 8.83506C7.41253 8.76012 8.50368 8.76012 8.97797 8.83506C10.4744 9.07153 11.7401 9.69743 12.8085 10.7293C13.7962 11.6832 14.476 12.9016 14.7757 14.2552C14.8385 14.5389 14.9162 15.1417 14.9162 15.3459V15.5107H14.4648H14.0134L13.9932 15.3065C13.9545 14.9173 13.8853 14.4959 13.813 14.2098C13.3092 12.2165 11.8223 10.608 9.88521 9.96086C9.19299 9.72959 8.66345 9.6429 7.94295 9.6429C7.22246 9.6429 6.69297 9.72959 6.00074 9.96086C4.06366 10.608 2.57674 12.2165 2.07292 14.2098C2.00063 14.4959 1.93141 14.9173 1.89278 15.3065L1.87255 15.5107H1.4363H1V15.3459ZM16.4893 15.3459C16.4893 15.1417 16.5669 14.5389 16.6298 14.2552C16.9295 12.9016 17.6093 11.6832 18.597 10.7293C19.6654 9.69743 20.9311 9.07153 22.4275 8.83506C22.9018 8.76012 23.993 8.76012 24.4673 8.83506C25.9637 9.07153 27.2294 9.69743 28.2978 10.7293C29.2855 11.6832 29.9652 12.9016 30.265 14.2552C30.3278 14.5389 30.4054 15.1417 30.4054 15.3459V15.5107H29.9541H29.5027L29.4825 15.3065C29.4438 14.9173 29.3746 14.4959 29.3023 14.2098C28.7985 12.2165 27.3116 10.608 25.3745 9.96086C24.6823 9.72959 24.1527 9.6429 23.4322 9.6429C22.7117 9.6429 22.1823 9.72959 21.49 9.96086C19.5529 10.608 18.066 12.2165 17.5622 14.2098C17.4899 14.4959 17.4207 14.9173 17.3821 15.3065L17.3618 15.5107H16.9256H16.4893V15.3459ZM7.51942 7.73196C6.81127 7.6435 6.08741 7.28533 5.56898 6.7669C4.25077 5.44871 4.25077 3.30684 5.56898 1.98865C6.88717 0.670451 9.02904 0.670451 10.3472 1.98865C11.213 2.85446 11.546 4.13906 11.2074 5.30748C10.7408 6.91754 9.18541 7.94006 7.51942 7.73196ZM8.62363 6.79892C9.30993 6.60279 9.86268 6.14639 10.1819 5.51225C10.3773 5.12407 10.4439 4.83928 10.4439 4.39291C10.4439 3.94653 10.3773 3.66175 10.1819 3.27356C9.85999 2.63407 9.31066 2.18321 8.60851 1.98222C8.40998 1.92539 8.29311 1.91293 7.95808 1.91293C7.4934 1.91293 7.22783 1.97141 6.85386 2.15605C6.21287 2.47254 5.71557 3.08772 5.53476 3.78786C5.44778 4.12457 5.44801 4.66249 5.53528 4.99796C5.7786 5.93433 6.50214 6.6262 7.46279 6.84113C7.75387 6.90625 8.32023 6.88566 8.62378 6.79892H8.62363ZM23.0087 7.73196C22.3006 7.6435 21.5767 7.28533 21.0583 6.7669C19.7401 5.44871 19.7401 3.30684 21.0583 1.98865C22.3765 0.670451 24.5183 0.670451 25.8365 1.98865C26.7023 2.85446 27.0353 4.13906 26.6967 5.30748C26.2301 6.91754 24.6747 7.94006 23.0087 7.73196ZM24.1129 6.79892C24.7992 6.60279 25.352 6.14639 25.6712 5.51225C25.8665 5.12407 25.9332 4.83928 25.9332 4.39291C25.9332 3.94653 25.8665 3.66175 25.6712 3.27356C25.3493 2.63407 24.7999 2.18321 24.0978 1.98222C23.8993 1.92539 23.7824 1.91293 23.4474 1.91293C22.9827 1.91293 22.7171 1.97141 22.3432 2.15605C21.7022 2.47254 21.2049 3.08772 21.024 3.78786C20.9371 4.12457 20.9373 4.66249 21.0246 4.99796C21.2679 5.93433 21.9914 6.6262 22.9521 6.84113C23.2432 6.90625 23.8095 6.88566 24.1131 6.79892H24.1129Z"})]}
1),(0,i.jsx)("path",{d:"M8.74465 30.8352C8.74465 30.631 8.8223 30.0281 8.88513 29.7445C9.1849 28.3909 9.86466 27.1725 10.8523 26.2186C11.9208 25.1867 13.1865 24.5608 14.6829 24.3244C15.1572 24.2494 16.2483 24.2494 16.7226 24.3244C18.219 24.5608 19.4847 25.1867 20.5531 26.2186C21.5408 27.1725 22.2206 28.3909 22.5204 29.7445C22.5832 30.0281 22.6608 30.631 22.6608 30.8352V31H22.2095H21.758L21.7378 30.7958C21.6992 30.4066 21.63 29.9852 21.5577 29.6991C21.0539 27.7058 19.5669 26.0973 17.6299 25.4501C16.9376 25.2189 16.4081 25.1322 15.6876 25.1322C14.9671 25.1322 14.4376 25.2189 13.7454 25.4501C11.8083 26.0973 10.3214 27.7058 9.81757 29.6991C9.74528 29.9852 9.67605 30.4066 9.63743 30.7958L9.61719 31H9.18094H8.74465V30.8352ZM15.2641 23.2212C14.5559 23.1328 13.8321 22.7746 13.3136 22.2562C11.9954 20.938 11.9954 18.7961 13.3136 17.4779C14.3215 16.47 15.8507 16.2041 17.1465 16.8113C18.6337 17.5083 19.4091 19.2196 18.952 20.7968C18.4855 22.4068 16.9301 23.4293 15.2641 23.2212ZM16.3683 22.2882C17.0546 22.0921 17.6073 21.6357 17.9265 21.0015C18.1219 20.6134 18.1886 20.3286 18.1886 19.8822C18.1886 19.4358 18.1219 19.151 17.9265 18.7629C17.6046 18.1234 17.0553 17.6725 16.3532 17.4715C16.1546 17.4147 16.0378 17.4022 15.7027 17.4022C15.238 17.4022 14.9725 17.4607 14.5985 17.6453C13.9575 17.9618 13.4602 18.577 13.2794 19.2771C13.1924 19.6139 13.1927 20.1518 13.2799 20.4872C13.5232 21.4236 14.2468 22.1155 15.2074 22.3304C15.4985 22.3955 16.0649 22.3749 16.3684 22.2882H16.3683ZM1 15.3459C1 15.1417 1.07766 14.5389 1.14049 14.2552C1.44025 12.9016 2.12002 11.6832 3.1077 10.7293C4.17612 9.69743 5.44183 9.07153 6.93824 8.83506C7.41253 8.76012 8.50368 8.76012 8.97797 8.83506C10.4744 9.07153 11.7401 9.69743 12.8085 10.7293C13.7962 11.6832 14.476 12.9016 14.7757 14.2552C14.8385 14.5389 14.9162 15.1417 14.9162 15.3459V15.5107H14.4648H14.0134L13.9932 15.3065C13.9545 14.9173 13.8853 14.4959 13.813 14.2098C13.3092 12.2165 11.8223 10.608 9.88521 9.96086C9.19299 9.72959 8.66345 9.6429 7.94295 9.6429C7.22246 9.6429 6.69297 9.72959 6.00074 9.96086C4.06366 10.608 2.57674 12.2165 2.07292 14.2098C2.00063 14.4959 1.93141 14.9173 1.89278 15.3065L1.87255 15.5107H1.4363H1V15.3459ZM16.4893 15.3459C16.4893 15.1417 16.5669 14.5389 16.6298 14.2552C16.9295 12.9016 17.6093 11.6832 18.597 10.7293C19.6654 9.69743 20.9311 9.07153 22.4275 8.83506C22.9018 8.76012 23.993 8.76012 24.4673 8.83506C25.9637 9.07153 27.2294 9.69743 28.2978 10.7293C29.2855 11.6832 29.9652 12.9016 30.265 14.2552C30.3278 14.5389 30.4054 15.1417 30.4054 15.3459V15.5107H29.9541H29.5027L29.4825 15.3065C29.4438 14.9173 29.3746 14.4959 29.3023 14.2098C28.7985 12.2165 27.3116 10.608 25.3745 9.96086C24.6823 9.72959 24.1527 9.6429 23.4322 9.6429C22.7117 9.6429 22.1823 9.72959 21.49 9.96086C19.5529 10.608 18.066 12.2165 17.5622 14.2098C17.4899 14.4959 17.4207 14.9173 17.3821 15.3065L17.3618 15.5107H16.9256H16.4893V15.3459ZM7.51942 7.73196C6.81127 7.6435 6.08741 7.28533 5.56898 6.7669C4.25077 5.44871 4.25077 3.30684 5.56898 1.98865C6.88717 0.670451 9.02904 0.670451 10.3472 1.98865C11.213 2.85446 11.546 4.13906 11.2074 5.30748C10.7408 6.91754 9.18541 7.94006 7.51942 7.73196ZM8.62363 6.79892C9.30993 6.60279 9.86268 6.14639 10.1819 5.51225C10.3773 5.12407 10.4439 4.83928 10.4439 4.39291C10.4439 3.94653 10.3773 3.66175 10.1819 3.27356C9.85999 2.63407 9.31066 2.18321 8.60851 1.98222C8.40998 1.92539 8.29311 1.91293 7.95808 1.91293C7.4934 1.91293 7.22783 1.97141 6.85386 2.15605C6.21287 2.47254 5.71557 3.08772 5.53476 3.78786C5.44778 4.12457 5.44801 4.66249 5.53528 4.99796C5.7786 5.93433 6.50214 6.6262 7.46279 6.84113C7.75387 6.90625 8.32023 6.88566 8.62378 6.79892H8.62363ZM23.0087 7.73196C22.3006 7.6435 21.5767 7.28533 21.0583 6.7669C19.7401 5.44871 19.7401 3.30684 21.0583 1.98865C22.3765 0.670451 24.5183 0.670451 25.8365 1.98865C26.7023 2.85446 27.0353 4.13906 26.6967 5.30748C26.2301 6.91754 24.6747 7.94006 23.0087 7.73196ZM24.1129 6.79892C24.7992 6.60279 25.352 6.14639 25.6712 5.51225C25.8665 5.12407 25.9332 4.83928 25.9332 4.39291C25.9332 3.94653 25.8665 3.66175 25.6712 3.27356C25.3493 2.63407 24.7999 2.18321 24.0978 1.98222C23.8993 1.92539 23.7824 1.91293 23.4474 1.91293C22.9827 1.91293 22.7171 1.97141 22.3432 2.15605C21.7022 2.47254 21.2049 3.08772 21.024 3.78786C20.9371 4.12457 20.9373 4.66249 21.0246 4.99796C21.2679 5.93433 21.9914 6.6262 22.9521 6.84113C23.2432 6.90625 23.8095 6.88566 24.1131 6.79892H24.1129Z",fill:"#344563"}
1),(0,i.jsx)("path",{d:"M8.74465 30.8352C8.74465 30.631 8.8223 30.0281 8.88513 29.7445C9.1849 28.3909 9.86466 27.1725 10.8523 26.2186C11.9208 25.1867 13.1865 24.5608 14.6829 24.3244C15.1572 24.2494 16.2483 24.2494 16.7226 24.3244C18.219 24.5608 19.4847 25.1867 20.5531 26.2186C21.5408 27.1725 22.2206 28.3909 22.5204 29.7445C22.5832 30.0281 22.6608 30.631 22.6608 30.8352V31H22.2095H21.758L21.7378 30.7958C21.6992 30.4066 21.63 29.9852 21.5577 29.6991C21.0539 27.7058 19.5669 26.0973 17.6299 25.4501C16.9376 25.2189 16.4081 25.1322 15.6876 25.1322C14.9671 25.1322 14.4376 25.2189 13.7454 25.4501C11.8083 26.0973 10.3214 27.7058 9.81757 29.6991C9.74528 29.9852 9.67605 30.4066 9.63743 30.7958L9.61719 31H9.18094H8.74465V30.8352ZM15.2641 23.2212C14.5559 23.1328 13.8321 22.7746 13.3136 22.2562C11.9954 20.938 11.9954 18.7961 13.3136 17.4779C14.3215 16.47 15.8507 16.2041 17.1465 16.8113C18.6337 17.5083 19.4091 19.2196 18.952 20.7968C18.4855 22.4068 16.9301 23.4293 15.2641 23.2212ZM16.3683 22.2882C17.0546 22.0921 17.6073 21.6357 17.9265 21.0015C18.1219 20.6134 18.1886 20.3286 18.1886 19.8822C18.1886 19.4358 18.1219 19.151 17.9265 18.7629C17.6046 18.1234 17.0553 17.6725 16.3532 17.4715C16.1546 17.4147 16.0378 17.4022 15.7027 17.4022C15.238 17.4022 14.9725 17.4607 14.5985 17.6453C13.9575 17.9618 13.4602 18.577 13.2794 19.2771C13.1924 19.6139 13.1927 20.1518 13.2799 20.4872C13.5232 21.4236 14.2468 22.1155 15.2074 22.3304C15.4985 22.3955 16.0649 22.3749 16.3684 22.2882H16.3683ZM1 15.3459C1 15.1417 1.07766 14.5389 1.14049 14.2552C1.44025 12.9016 2.12002 11.6832 3.1077 10.7293C4.17612 9.69743 5.44183 9.07153 6.93824 8.83506C7.41253 8.76012 8.50368 8.76012 8.97797 8.83506C10.4744 9.07153 11.7401 9.69743 12.8085 10.7293C13.7962 11.6832 14.476 12.9016 14.7757 14.2552C14.8385 14.5389 14.9162 15.1417 14.9162 15.3459V15.5107H14.4648H14.0134L13.9932 15.3065C13.9545 14.9173 13.8853 14.4959 13.813 14.2098C13.3092 12.2165 11.8223 10.608 9.88521 9.96086C9.19299 9.72959 8.66345 9.6429 7.94295 9.6429C7.22246 9.6429 6.69297 9.72959 6.00074 9.96086C4.06366 10.608 2.57674 12.2165 2.07292 14.2098C2.00063 14.4959 1.93141 14.9173 1.89278 15.3065L1.87255 15.5107H1.4363H1V15.3459ZM16.4893 15.3459C16.4893 15.1417 16.5669 14.5389 16.6298 14.2552C16.9295 12.9016 17.6093 11.6832 18.597 10.7293C19.6654 9.69743 20.9311 9.07153 22.4275 8.83506C22.9018 8.76012 23.993 8.76012 24.4673 8.83506C25.9637 9.07153 27.2294 9.69743 28.2978 10.7293C29.2855 11.6832 29.9652 12.9016 30.265 14.2552C30.3278 14.5389 30.4054 15.1417 30.4054 15.3459V15.5107H29.9541H29.5027L29.4825 15.3065C29.4438 14.9173 29.3746 14.4959 29.3023 14.2098C28.7985 12.2165 27.3116 10.608 25.3745 9.96086C24.6823 9.72959 24.1527 9.6429 23.4322 9.6429C22.7117 9.6429 22.1823 9.72959 21.49 9.96086C19.5529 10.608 18.066 12.2165 17.5622 14.2098C17.4899 14.4959 17.4207 14.9173 17.3821 15.3065L17.3618 15.5107H16.9256H16.4893V15.3459ZM7.51942 7.73196C6.81127 7.6435 6.08741 7.28533 5.56898 6.7669C4.25077 5.44871 4.25077 3.30684 5.56898 1.98865C6.88717 0.670451 9.02904 0.670451 10.3472 1.98865C11.213 2.85446 11.546 4.13906 11.2074 5.30748C10.7408 6.91754 9.18541 7.94006 7.51942 7.73196ZM8.62363 6.79892C9.30993 6.60279 9.86268 6.14639 10.1819 5.51225C10.3773 5.12407 10.4439 4.83928 10.4439 4.39291C10.4439 3.94653 10.3773 3.66175 10.1819 3.27356C9.85999 2.63407 9.31066 2.18321 8.60851 1.98222C8.40998 1.92539 8.29311 1.91293 7.95808 1.91293C7.4934 1.91293 7.22783 1.97141 6.85386 2.15605C6.21287 2.47254 5.71557 3.08772 5.53476 3.78786C5.44778 4.12457 5.44801 4.66249 5.53528 4.99796C5.7786 5.93433 6.50214 6.6262 7.46279 6.84113C7.75387 6.90625 8.32023 6.88566 8.62378 6.79892H8.62363ZM23.0087 7.73196C22.3006 7.6435 21.5767 7.28533 21.0583 6.7669C19.7401 5.44871 19.7401 3.30684 21.0583 1.98865C22.3765 0.670451 24.5183 0.670451 25.8365 1.98865C26.7023 2.85446 27.0353 4.13906 26.6967 5.30748C26.2301 6.91754 24.6747 7.94006 23.0087 7.73196ZM24.1129 6.79892C24.7992 6.60279 25.352 6.14639 25.6712 5.51225C25.8665 5.12407 25.9332 4.83928 25.9332 4.39291C25.9332 3.94653 25.8665 3.66175 25.6712 3.27356C25.3493 2.63407 24.7999 2.18321 24.0978 1.98222C23.8993 1.92539 23.7824 1.91293 23.4474 1.91293C22.9827 1.91293 22.7171 1.97141 22.3432 2.15605C21.7022 2.47254 21.2049 3.08772 21.024 3.78786C20.9371 4.12457 20.9373 4.66249 21.0246 4.99796C21.2679 5.93433 21.9914 6.6262 22.9521 6.84113C23.2432 6.90625 23.8095 6.88566 24.1131 6.79892H24.1129Z",stroke:"#344563",strokeWidth:"0.6",mask:"url(#path-1-outside-1)"})]})},ge=function(){return(0,i.jsxs)("svg",{width:"32",height:"26",viewBox:"0 0 32 26",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,i.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3.07411 6.14822C4.77201 6.14822 6.14822 4.77201 6.14822 3.07411C6.14822 1.37621 4.77201 0 3.07411 0C1.37641 0 0 1.37621 0 3.07411C0 4.77201 1.37641 6.14822 3.07411 6.14822ZM3.07411 15.0741C4.77201 15.0741 6.14822 13.6979 6.14822 12C6.14822 10.3021 4.77201 8.92589 3.07411 8.92589C1.37641 8.92589 0 10.3021 0 12C0 13.6979 1.37641 15.0741 3.07411 15.0741ZM6.14822 20.9259C6.14822 22.6238 4.77201 24 3.07411 24C1.37641 24 0 22.6238 0 20.9259C0 19.228 1.37641 17.8518 3.07411 17.8518C4.77201 17.8518 6.14822 19.228 6.14822 20.9259ZM9.15029 2.15043C9.13332 2.21709 9.12441 2.28664 9.12441 2.35868V3.78995C9.12441 4.25821 9.50407 4.63787 9.97233 4.63787L26.31 4.63787C26.7783 4.63787 27.1579 4.25821 27.1579 3.78995V2.35868C27.1579 1.89042 26.7783 1.51076 26.31 1.51076L9.97233 1.51076C9.78768 1.51076 9.61689 1.56997 9.47778 1.67016C9.39643 1.72854 9.32584 1.80099 9.26974 1.88421C9.2155 1.96412 9.17472 2.05396 9.15029 2.15043ZM9.12441 11.2846C9.12441 10.8163 9.50407 10.4367 9.97233 10.4367L26.31 10.4367C26.7783 10.4367 27.1579 10.8163 27.1579 11.2846V12.7158C27.1579 13.1841 26.7783 13.5638 26.31 13.5638L9.97233 13.5638C9.50407 13.5638 9.12441 13.1841 9.12441 12.7158V11.2846Z",fill:"#2E3C57"}),(0,i.jsx)("path",{d:"M9.12441 20.2105C9.12441 19.7422 9.50407 19.3625 9.97233 19.3625L20 19.3625C19.4169 20.5838 19.439 21.2684 20 22.4896L9.97233 22.4896C9.50407 22.4896 9.12441 22.11 9.12441 21.6417V20.2105Z",fill:"#2E3C57"}),(0,i.jsx)("path",{d:"M23.5714 22.0714H25.9286V24.4286C25.9286 24.7128 26.0415 24.9853 26.2424 25.1862C26.4433 25.3871 26.7158 25.5 27 25.5C27.2842 25.5 27.5567 25.3871 27.7576 25.1862C27.9585 24.9853 28.0714 24.7128 28.0714 24.4286V22.0714H30.4286C30.7128 22.0714 30.9853 21.9585 31.1862 21.7576C31.3871 21.5567 31.5 21.2842 31.5 21C31.5 20.7158 31.3871 20.4433 31.1862 20.2424C30.9853 20.0415 30.7128 19.9286 30.4286 19.9286H28.0714V17.5714C28.0714 17.2872 27.9585 17.0147 27.7576 16.8138C27.5567 16.6129 27.2842 16.5 27 16.5C26.7158 16.5 26.4433 16.6129 26.2424 16.8138C26.0415 17.0147 25.9286 17.2872 25.9286 17.5714V19.9286H23.5714C23.2872 19.9286 23.0147 20.0415 22.8138 20.2424C22.6129 20.4433 22.5 20.7158 22.5 21C22.5 21.2842 22.6129 21.5567 22.8138 21.7576C23.0147 21.9585 23.2872 22.0714 23.5714 22.0714Z",fill:"#2E3C57",stroke:"#2E3C57"})]})},xe=function(){return(0,i.jsxs)("svg",{width:"31",height:"30",viewBox:"0 0 31 30",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,i.jsx)("path",{d:"M5.58224 26.6783C8.2523 28.8261 11.5756 29.9979 15.0023 29.9999C18.4285 30.0133 21.7539 28.8413 24.4146 26.6826C25.0164 26.1973 25.5803 25.6668 26.1014 25.0957C28.1231 22.8725 29.4306 20.0935 29.8545 17.1186C30.2784 14.1437 29.7991 11.1101 28.4789 8.41072C27.1586 5.71136 25.0581 3.47069 22.4495 1.979C19.841 0.487308 16.8446 -0.186651 13.8485 0.0444363C10.8525 0.275523 7.99489 1.40101 5.64594 3.27507C3.29699 5.14914 1.56495 7.68541 0.674231 10.5553C-0.216491 13.4252 -0.22485 16.4965 0.650237 19.3712C1.52532 22.2459 3.24353 24.7915 5.58224 26.6783ZM15.0023 1.97444C17.443 1.97367 19.8347 2.6596 21.904 3.95384C23.9733 5.24807 25.6367 7.09839 26.7041 9.29331C27.7715 11.4882 28.1999 13.9392 27.9402 16.366C27.6806 18.7929 26.7434 21.0977 25.2357 23.0171C24.436 19.7095 20.1584 17.1816 15.0023 17.1816C9.84274 17.1816 5.56735 19.7099 4.76855 23.0178C3.26099 21.0983 2.32385 18.7934 2.06424 16.3665C1.80463 13.9396 2.23302 11.4887 3.30045 9.29374C4.36788 7.0988 6.03129 5.24845 8.10057 3.95414C10.1699 2.65984 12.5615 1.9738 15.0023 1.97444Z",fill:"#344563"}
1),(0,i.jsx)("path",{d:"M16.1227 14.8558C18.7447 14.2368 20.3685 11.6095 19.7495 8.98756C19.1305 6.3656 16.5032 4.74184 13.8813 5.3608C11.2593 5.97976 9.63556 8.60705 10.2545 11.229C10.8735 13.851 13.5008 15.4747 16.1227 14.8558Z",fill:"#344563"})]})},be=t(26297),ye=function(e){return function(e){return!!e&&"object"===typeof e}(e)&&!function(e){var n=Object.prototype.toString.call(e);return"[object RegExp]"===n||"[object Date]"===n||function(e){return e.$$typeof===Ce}(e)}(e)};var Ce="function"===typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function je(e,n){return!1!==n.clone&&n.isMergeableObject(e)?Ne((t=e,Array.isArray(t)?[]:{}),e,n):e;var t}function we(e,n,t){return e.concat(n).map((function(e){return je(e,t)}))}function Ne(e,n,t){(t=t||{}).arrayMerge=t.arrayMerge||we,t.isMergeableObject=t.isMergeableObject||ye;var r=Array.isArray(n);return r===Array.isArray(e)?r?t.arrayMerge(e,n,t):function(e,n,t){var r={};return t.isMergeableObject(e)&&Object.keys(e).forEach((function(n){r[n]=je(e[n],t)})),Object.keys(n).forEach((function(o){t.isMergeableObject(n[o])&&e[o]?r[o]=Ne(e[o],n[o],t):r[o]=je(n[o],t)})),r}(e,n,t):je(n,t)}Ne.all=function(e,n){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce((function(e,t){return Ne(e,t,n)}),{})};var Se=Ne,ke="object"==typeof global&&global&&global.Object===Object&&global,_e="object"==typeof self&&self&&self.Object===Object&&self,Ze=ke||_e||Function("return this")(),Ee=Ze.Symbol,Ie=Object.prototype,Oe=Ie.hasOwnProperty,Te=Ie.toString,Ae=Ee?Ee.toStringTag:void 0;var De=function(e){var n=Oe.call(e,Ae),t=e[Ae];try{e[Ae]=void 0;var r=!0}catch(i){}var o=Te.call(e);return r&&(n?e[Ae]=t:delete e[Ae]),o},Le=Object.prototype.toString;var Me=function(e){return Le.call(e)},Pe=Ee?Ee.toStringTag:void 0;var Re=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Pe&&Pe in Object(e)?De(e):Me(e)};var Fe=function(e,n){return function(t){return e(n(t))}},ze=Fe(Object.getPrototypeOf,Object);var Be=function(e){return null!=e&&"object"==typeof e},He=Function.prototype,Ve=Object.prototype,$e=He.toString,Ue=Ve.hasOwnProperty,We=$e.call(Object);var qe=function(e){if(!Be(e)||"[object Object]"!=Re(e))return!1;var n=ze(e);if(null===n)return!0;var t=Ue.call(n,"constructor")&&n.constructor;return"function"==typeof t&&t instanceof t&&$e.call(t)==We};var Ke=function(){this.__data__=[],this.size=0};var Ge=function(e,n){return e===n||e!==e&&n!==n};var Je=function(e,n){for(var t=e.length;t--;)if(Ge(e[t][0],n))return t;return-1},Xe=Array.prototype.splice;var Ye=function(e){var n=this.__data__,t=Je(n,e);return!(t<0)&&(t==n.length-1?n.pop():Xe.call(n,t,1),--this.size,!0)};var Qe=function(e){var n=this.__data__,t=Je(n,e);return t<0?void 0:n[t][1]};var en=function(e){return Je(this.__data__,e)>-1};var nn=function(e,n){var t=this.__data__,r=Je(t,e);return r<0?(++this.size,t.push([e,n])):t[r][1]=n,this};function tn(e){var n=-1,t=null==e?0:e.length;for(this.clear();++n<t;){var r=e[n];this.set(r[0],r[1])}}tn.prototype.clear=Ke,tn.prototype.delete=Ye,tn.prototype.get=Qe,tn.prototype.has=en,tn.prototype.set=nn;var rn=tn;var on=function(){this.__data__=new rn,this.size=0};var an=function(e){var n=this.__data__,t=n.delete(e);return this.size=n.size,t};var ln=function(e){return this.__data__.get(e)};var sn=function(e){return this.__data__.has(e)};var un=function(e){var n=typeof e;return null!=e&&("object"==n||"function"==n)};var cn=function(e){if(!un(e))return!1;var n=Re(e);return"[object Function]"==n||"[object GeneratorFunction]"==n||"[object AsyncFunction]"==n||"[object Proxy]"==n},dn=Ze["__core-js_shared__"],fn=function(){var e=/[^.]+$/.exec(dn&&dn.keys&&dn.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();var pn=function(e){return!!fn&&fn in e},hn=Function.prototype.toString;var vn=function(e){if(null!=e){try{return hn.call(e)}catch(n){}try{return e+""}catch(n){}}return""},mn=/^\[object .+?Constructor\]$/,gn=Function.prototype,xn=Object.prototype,bn=gn.toString,yn=xn.hasOwnProperty,Cn=RegExp("^"+bn.call(yn).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var jn=function(e){return!(!un(e)||pn(e))&&(cn(e)?Cn:mn).test(vn(e))};var wn=function(e,n){return null==e?void 0:e[n]};var Nn=function(e,n){var t=wn(e,n);return jn(t)?t:void 0},Sn=Nn(Ze,"Map"),kn=Nn(Object,"create");var _n=function(){this.__data__=kn?kn(null):{},this.size=0};var Zn=function(e){var n=this.has(e)&&delete this.__data__[e];return this.size-=n?1:0,n},En=Object.prototype.hasOwnProperty;var In=function(e){var n=this.__data__;if(kn){var t=n[e];return"__lodash_hash_undefined__"===t?void 0:t}return En.call(n,e)?n[e]:void 0},On=Object.prototype.hasOwnProperty;var Tn=function(e){var n=this.__data__;return kn?void 0!==n[e]:On.call(n,e)};var An=function(e,n){var t=this.__data__;return this.size+=this.has(e)?0:1,t[e]=kn&&void 0===n?"__lodash_hash_undefined__":n,this};function Dn(e){var n=-1,t=null==e?0:e.length;for(this.clear();++n<t;){var r=e[n];this.set(r[0],r[1])}}Dn.prototype.clear=_n,Dn.prototype.delete=Zn,Dn.prototype.get=In,Dn.prototype.has=Tn,Dn.prototype.set=An;var Ln=Dn;var Mn=function(){this.size=0,this.__data__={hash:new Ln,map:new(Sn||rn),string:new Ln}};var Pn=function(e){var n=typeof e;return"string"==n||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==e:null===e};var Rn=function(e,n){var t=e.__data__;return Pn(n)?t["string"==typeof n?"string":"hash"]:t.map};var Fn=function(e){var n=Rn(this,e).delete(e);return this.size-=n?1:0,n};var zn=function(e){return Rn(this,e).get(e)};var Bn=function(e){return Rn(this,e).has(e)};var Hn=function(e,n){var t=Rn(this,e),r=t.size;return t.set(e,n),this.size+=t.size==r?0:1,this};function Vn(e){var n=-1,t=null==e?0:e.length;for(this.clear();++n<t;){var r=e[n];this.set(r[0],r[1])}}Vn.prototype.clear=Mn,Vn.prototype.delete=Fn,Vn.prototype.get=zn,Vn.prototype.has=Bn,Vn.prototype.set=Hn;var $n=Vn;var Un=function(e,n){var t=this.__data__;if(t instanceof rn){var r=t.__data__;if(!Sn||r.length<199)return r.push([e,n]),this.size=++t.size,this;t=this.__data__=new $n(r)}return t.set(e,n),this.size=t.size,this};function Wn(e){var n=this.__data__=new rn(e);this.size=n.size}Wn.prototype.clear=on,Wn.prototype.delete=an,Wn.prototype.get=ln,Wn.prototype.has=sn,Wn.prototype.set=Un;var qn=Wn;var Kn=function(e,n){for(var t=-1,r=null==e?0:e.length;++t<r&&!1!==n(e[t],t,e););return e},Gn=function(){try{var e=Nn(Object,"defineProperty");return e({},"",{}),e}catch(n){}}();var Jn=function(e,n,t){"__proto__"==n&&Gn?Gn(e,n,{configurable:!0,enumerable:!0,value:t,writable:!0}):e[n]=t},Xn=Object.prototype.hasOwnProperty;var Yn=function(e,n,t){var r=e[n];Xn.call(e,n)&&Ge(r,t)&&(void 0!==t||n in e)||Jn(e,n,t)};var Qn=function(e,n,t,r){var o=!t;t||(t={});for(var i=-1,a=n.length;++i<a;){var l=n[i],s=r?r(t[l],e[l],l,t,e):void 0;void 0===s&&(s=e[l]),o?Jn(t,l,s):Yn(t,l,s)}return t};var et=function(e,n){for(var t=-1,r=Array(e);++t<e;)r[t]=n(t);return r};var nt=function(e){return Be(e)&&"[object Arguments]"==Re(e)},tt=Object.prototype,rt=tt.hasOwnProperty,ot=tt.propertyIsEnumerable,it=nt(function(){return arguments}())?nt:function(e){return Be(e)&&rt.call(e,"callee")&&!ot.call(e,"callee")},at=it,lt=Array.isArray;var st=function(){return!1},ut="object"==typeof exports&&exports&&!exports.nodeType&&exports,ct=ut&&"object"==typeof module&&module&&!module.nodeType&&module,dt=ct&&ct.exports===ut?Ze.Buffer:void 0,ft=(dt?dt.isBuffer:void 0)||st,pt=/^(?:0|[1-9]\d*)$/;var ht=function(e,n){var t=typeof e;return!!(n=null==n?9007199254740991:n)&&("number"==t||"symbol"!=t&&pt.test(e))&&e>-1&&e%1==0&&e<n};var vt=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991},mt={};
1mt["[object Float32Array]"]=mt["[object Float64Array]"]=mt["[object Int8Array]"]=mt["[object Int16Array]"]=mt["[object Int32Array]"]=mt["[object Uint8Array]"]=mt["[object Uint8ClampedArray]"]=mt["[object Uint16Array]"]=mt["[object Uint32Array]"]=!0,mt["[object Arguments]"]=mt["[object Array]"]=mt["[object ArrayBuffer]"]=mt["[object Boolean]"]=mt["[object DataView]"]=mt["[object Date]"]=mt["[object Error]"]=mt["[object Function]"]=mt["[object Map]"]=mt["[object Number]"]=mt["[object Object]"]=mt["[object RegExp]"]=mt["[object Set]"]=mt["[object String]"]=mt["[object WeakMap]"]=!1;var gt=function(e){return Be(e)&&vt(e.length)&&!!mt[Re(e)]};var xt=function(e){return function(n){return e(n)}},bt="object"==typeof exports&&exports&&!exports.nodeType&&exports,yt=bt&&"object"==typeof module&&module&&!module.nodeType&&module,Ct=yt&&yt.exports===bt&&ke.process,jt=function(){try{var e=yt&&yt.require&&yt.require("util").types;return e||Ct&&Ct.binding&&Ct.binding("util")}catch(n){}}(),wt=jt,Nt=wt&&wt.isTypedArray,St=Nt?xt(Nt):gt,kt=Object.prototype.hasOwnProperty;var _t=function(e,n){var t=lt(e),r=!t&&at(e),o=!t&&!r&&ft(e),i=!t&&!r&&!o&&St(e),a=t||r||o||i,l=a?et(e.length,String):[],s=l.length;for(var u in e)!n&&!kt.call(e,u)||a&&("length"==u||o&&("offset"==u||"parent"==u)||i&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||ht(u,s))||l.push(u);return l},Zt=Object.prototype;var Et=function(e){var n=e&&e.constructor;return e===("function"==typeof n&&n.prototype||Zt)},It=Fe(Object.keys,Object),Ot=Object.prototype.hasOwnProperty;var Tt=function(e){if(!Et(e))return It(e);var n=[];for(var t in Object(e))Ot.call(e,t)&&"constructor"!=t&&n.push(t);return n};var At=function(e){return null!=e&&vt(e.length)&&!cn(e)};var Dt=function(e){return At(e)?_t(e):Tt(e)};var Lt=function(e,n){return e&&Qn(n,Dt(n),e)};var Mt=function(e){var n=[];if(null!=e)for(var t in Object(e))n.push(t);return n},Pt=Object.prototype.hasOwnProperty;var Rt=function(e){if(!un(e))return Mt(e);var n=Et(e),t=[];for(var r in e)("constructor"!=r||!n&&Pt.call(e,r))&&t.push(r);return t};var Ft=function(e){return At(e)?_t(e,!0):Rt(e)};var zt=function(e,n){return e&&Qn(n,Ft(n),e)},Bt="object"==typeof exports&&exports&&!exports.nodeType&&exports,Ht=Bt&&"object"==typeof module&&module&&!module.nodeType&&module,Vt=Ht&&Ht.exports===Bt?Ze.Buffer:void 0,$t=Vt?Vt.allocUnsafe:void 0;var Ut=function(e,n){if(n)return e.slice();var t=e.length,r=$t?$t(t):new e.constructor(t);return e.copy(r),r};var Wt=function(e,n){var t=-1,r=e.length;for(n||(n=Array(r));++t<r;)n[t]=e[t];return n};var qt=function(e,n){for(var t=-1,r=null==e?0:e.length,o=0,i=[];++t<r;){var a=e[t];n(a,t,e)&&(i[o++]=a)}return i};var Kt=function(){return[]},Gt=Object.prototype.propertyIsEnumerable,Jt=Object.getOwnPropertySymbols,Xt=Jt?function(e){return null==e?[]:(e=Object(e),qt(Jt(e),(function(n){return Gt.call(e,n)})))}:Kt;var Yt=function(e,n){return Qn(e,Xt(e),n)};var Qt=function(e,n){for(var t=-1,r=n.length,o=e.length;++t<r;)e[o+t]=n[t];return e},er=Object.getOwnPropertySymbols?function(e){for(var n=[];e;)Qt(n,Xt(e)),e=ze(e);return n}:Kt;var nr=function(e,n){return Qn(e,er(e),n)};var tr=function(e,n,t){var r=n(e);return lt(e)?r:Qt(r,t(e))};var rr=function(e){return tr(e,Dt,Xt)};var or=function(e){return tr(e,Ft,er)},ir=Nn(Ze,"DataView"),ar=Nn(Ze,"Promise"),lr=Nn(Ze,"Set"),sr=Nn(Ze,"WeakMap"),ur="[object Map]",cr="[object Promise]",dr="[object Set]",fr="[object WeakMap]",pr="[object DataView]",hr=vn(ir),vr=vn(Sn),mr=vn(ar),gr=vn(lr),xr=vn(sr),br=Re;
1(ir&&br(new ir(new ArrayBuffer(1)))!=pr||Sn&&br(new Sn)!=ur||ar&&br(ar.resolve())!=cr||lr&&br(new lr)!=dr||sr&&br(new sr)!=fr)&&(br=function(e){var n=Re(e),t="[object Object]"==n?e.constructor:void 0,r=t?vn(t):"";if(r)switch(r){case hr:return pr;case vr:return ur;case mr:return cr;case gr:return dr;case xr:return fr}return n});var yr=br,Cr=Object.prototype.hasOwnProperty;var jr=function(e){var n=e.length,t=new e.constructor(n);return n&&"string"==typeof e[0]&&Cr.call(e,"index")&&(t.index=e.index,t.input=e.input),t},wr=Ze.Uint8Array;var Nr=function(e){var n=new e.constructor(e.byteLength);return new wr(n).set(new wr(e)),n};var Sr=function(e,n){var t=n?Nr(e.buffer):e.buffer;return new e.constructor(t,e.byteOffset,e.byteLength)},kr=/\w*$/;var _r=function(e){var n=new e.constructor(e.source,kr.exec(e));return n.lastIndex=e.lastIndex,n},Zr=Ee?Ee.prototype:void 0,Er=Zr?Zr.valueOf:void 0;var Ir=function(e){return Er?Object(Er.call(e)):{}};var Or=function(e,n){var t=n?Nr(e.buffer):e.buffer;return new e.constructor(t,e.byteOffset,e.length)};var Tr=function(e,n,t){var r=e.constructor;switch(n){case"[object ArrayBuffer]":return Nr(e);case"[object Boolean]":case"[object Date]":return new r(+e);case"[object DataView]":return Sr(e,t);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return Or(e,t);case"[object Map]":case"[object Set]":return new r;case"[object Number]":case"[object String]":return new r(e);case"[object RegExp]":return _r(e);case"[object Symbol]":return Ir(e)}},Ar=Object.create,Dr=function(){function e(){}return function(n){if(!un(n))return{};if(Ar)return Ar(n);e.prototype=n;var t=new e;return e.prototype=void 0,t}}();var Lr=function(e){return"function"!=typeof e.constructor||Et(e)?{}:Dr(ze(e))};var Mr=function(e){return Be(e)&&"[object Map]"==yr(e)},Pr=wt&&wt.isMap,Rr=Pr?xt(Pr):Mr;var Fr=function(e){return Be(e)&&"[object Set]"==yr(e)},zr=wt&&wt.isSet,Br=zr?xt(zr):Fr,Hr="[object Arguments]",Vr="[object Function]",$r="[object Object]",Ur={};Ur[Hr]=Ur["[object Array]"]=Ur["[object ArrayBuffer]"]=Ur["[object DataView]"]=Ur["[object Boolean]"]=Ur["[object Date]"]=Ur["[object Float32Array]"]=Ur["[object Float64Array]"]=Ur["[object Int8Array]"]=Ur["[object Int16Array]"]=Ur["[object Int32Array]"]=Ur["[object Map]"]=Ur["[object Number]"]=Ur["[object Object]"]=Ur["[object RegExp]"]=Ur["[object Set]"]=Ur["[object String]"]=Ur["[object Symbol]"]=Ur["[object Uint8Array]"]=Ur["[object Uint8ClampedArray]"]=Ur["[object Uint16Array]"]=Ur["[object Uint32Array]"]=!0,Ur["[object Error]"]=Ur[Vr]=Ur["[object WeakMap]"]=!1;var Wr=function e(n,t,r,o,i,a){var l,s=1&t,u=2&t,c=4&t;if(r&&(l=i?r(n,o,i,a):r(n)),void 0!==l)return l;if(!un(n))return n;var d=lt(n);if(d){if(l=jr(n),!s)return Wt(n,l)}else{var f=yr(n),p=f==Vr||"[object GeneratorFunction]"==f;if(ft(n))return Ut(n,s);if(f==$r||f==Hr||p&&!i){if(l=u||p?{}:Lr(n),!s)return u?nr(n,zt(l,n)):Yt(n,Lt(l,n))}else{if(!Ur[f])return i?n:{};l=Tr(n,f,s)}}a||(a=new qn);var h=a.get(n);if(h)return h;a.set(n,l),Br(n)?n.forEach((function(o){l.add(e(o,t,r,o,n,a))})):Rr(n)&&n.forEach((function(o,i){l.set(i,e(o,t,r,i,n,a))}));var v=d?void 0:(c?u?or:rr:u?Ft:Dt)(n);return Kn(v||n,(function(o,i){v&&(o=n[i=o]),Yn(l,i,e(o,t,r,i,n,a))})),l};var qr=function(e){return Wr(e,5)},Kr=t(78435),Gr=t.n(Kr);var Jr=function(e,n){};var Xr=function(e){return Wr(e,4)};var Yr=function(e,n){for(var t=-1,r=null==e?0:e.length,o=Array(r);++t<r;)o[t]=n(e[t],t,e);return o};var Qr=function(e){return"symbol"==typeof e||Be(e)&&"[object Symbol]"==Re(e)};function eo(e,n){if("function"!=typeof e||null!=n&&"function"!=typeof n)throw new TypeError("Expected a function");var t=function(){var r=arguments,o=n?n.apply(this,r):r[0],i=t.cache;if(i.has(o))return i.get(o);var a=e.apply(this,r);return t.cache=i.set(o,a)||i,a};return t.cache=new(eo.Cache||$n),t}eo.Cache=$n;var no=eo;var to=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ro=/\\(\\)?/g,oo=function(e){var n=no(e,(function(e){return 500===t.size&&t.clear(),e})),t=n.cache;return n}((function(e){var n=[];return 46===e.charCodeAt(0)&&n.push(""),e.replace(to,(function(e,t,r,o){n.push(r?o.replace(ro,"$1"):t||e)})),n}));var io=function(e){if("string"==typeof e||Qr(e))return e;var n=e+"";return"0"==n&&1/e==-Infinity?"-0":n},ao=Ee?Ee.prototype:void 0,lo=ao?ao.toString:void 0;var so=function e(n){if("string"==typeof n)return n;if(lt(n))return Yr(n,e)+"";if(Qr(n))return lo?lo.call(n):"";var t=n+"";return"0"==t&&1/n==-Infinity?"-0":t};var uo=function(e){return null==e?"":so(e)};var co=function(e){return lt(e)?Yr(e,io):Qr(e)?[e]:Wt(oo(uo(e)))},fo=t(73463),po=t.n(fo);function ho(){return ho=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},ho.apply(this,arguments)}function vo(e,n){e.prototype=Object.create(n.prototype),e.prototype.constructor=e,e.__proto__=n}function mo(e,n){if(null==e)return{};var t,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)t=i[r],n.indexOf(t)>=0||(o[t]=e[t]);return o}function go(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var xo=(0,l.createContext)(void 0);xo.displayName="FormikContext";var bo=xo.Provider,yo=xo.Consumer;
1function Co(){var e=(0,l.useContext)(xo);return e||Jr(!1),e}var jo=function(e){return Array.isArray(e)&&0===e.length},wo=function(e){return"function"===typeof e},No=function(e){return null!==e&&"object"===typeof e},So=function(e){return String(Math.floor(Number(e)))===e},ko=function(e){return"[object String]"===Object.prototype.toString.call(e)},_o=function(e){return 0===l.Children.count(e)},Zo=function(e){return No(e)&&wo(e.then)};function Eo(e,n,t,r){void 0===r&&(r=0);for(var o=co(n);e&&r<o.length;)e=e[o[r++]];return r===o.length||e?void 0===e?t:e:t}function Io(e,n,t){for(var r=Xr(e),o=r,i=0,a=co(n);i<a.length-1;i++){var l=a[i],s=Eo(e,a.slice(0,i+1));if(s&&(No(s)||Array.isArray(s)))o=o[l]=Xr(s);else{var u=a[i+1];o=o[l]=So(u)&&Number(u)>=0?[]:{}}}return(0===i?e:o)[a[i]]===t?e:(void 0===t?delete o[a[i]]:o[a[i]]=t,0===i&&void 0===t&&delete r[a[i]],r)}function Oo(e,n,t,r){void 0===t&&(t=new WeakMap),void 0===r&&(r={});for(var o=0,i=Object.keys(e);o<i.length;o++){var a=i[o],l=e[a];No(l)?t.get(l)||(t.set(l,!0),r[a]=Array.isArray(l)?[]:{},Oo(l,n,t,r[a])):r[a]=n}return r}var To={},Ao={};function Do(e){var n=e.validateOnChange,t=void 0===n||n,r=e.validateOnBlur,o=void 0===r||r,i=e.validateOnMount,a=void 0!==i&&i,s=e.isInitialValid,u=e.enableReinitialize,c=void 0!==u&&u,d=e.onSubmit,f=mo(e,["validateOnChange","validateOnBlur","validateOnMount","isInitialValid","enableReinitialize","onSubmit"]),p=ho({validateOnChange:t,validateOnBlur:o,validateOnMount:a,onSubmit:d},f),h=(0,l.useRef)(p.initialValues),v=(0,l.useRef)(p.initialErrors||To),m=(0,l.useRef)(p.initialTouched||Ao),g=(0,l.useRef)(p.initialStatus),x=(0,l.useRef)(!1),b=(0,l.useRef)({});(0,l.useEffect)((function(){return x.current=!0,function(){x.current=!1}}),[]);var y=(0,l.useState)(0)[1],C=(0,l.useRef)({values:qr(p.initialValues),errors:qr(p.initialErrors)||To,touched:qr(p.initialTouched)||Ao,status:qr(p.initialStatus),isSubmitting:!1,isValidating:!1,submitCount:0}),j=C.current,w=(0,l.useCallback)((function(e){var n=C.current;C.current=function(e,n){switch(n.type){case"SET_VALUES":return ho({},e,{values:n.payload});case"SET_TOUCHED":return ho({},e,{touched:n.payload});case"SET_ERRORS":return Gr()(e.errors,n.payload)?e:ho({},e,{errors:n.payload});case"SET_STATUS":return ho({},e,{status:n.payload});case"SET_ISSUBMITTING":return ho({},e,{isSubmitting:n.payload});case"SET_ISVALIDATING":return ho({},e,{isValidating:n.payload});case"SET_FIELD_VALUE":return ho({},e,{values:Io(e.values,n.payload.field,n.payload.value)});case"SET_FIELD_TOUCHED":return ho({},e,{touched:Io(e.touched,n.payload.field,n.payload.value)});case"SET_FIELD_ERROR":return ho({},e,{errors:Io(e.errors,n.payload.field,n.payload.value)});case"RESET_FORM":return ho({},e,n.payload);case"SET_FORMIK_STATE":return n.payload(e);case"SUBMIT_ATTEMPT":return ho({},e,{touched:Oo(e.values,!0),isSubmitting:!0,submitCount:e.submitCount+1});case"SUBMIT_FAILURE":case"SUBMIT_SUCCESS":return ho({},e,{isSubmitting:!1});default:return e}}(n,e),n!==C.current&&y((function(e){return e+1}))}),[]),N=(0,l.useCallback)((function(e,n){return new Promise((function(t,r){var o=p.validate(e,n);null==o?t(To):Zo(o)?o.then((function(e){t(e||To)}),(function(e){r(e)})):t(o)}))}),[p.validate]),S=(0,l.useCallback)((function(e,n){var t=p.validationSchema,r=wo(t)?t(n):t,o=n&&r.validateAt?r.validateAt(n,e):function(e,n,t,r){void 0===t&&(t=!1);var o=Mo(e);return n[t?"validateSync":"validate"](o,{abortEarly:!1,context:r||o})}(e,r);return new Promise((function(e,n){o.then((function(){e(To)}),(function(t){"ValidationError"===t.name?e(function(e){var n={};if(e.inner){if(0===e.inner.length)return Io(n,e.path,e.message);var t=e.inner,r=Array.isArray(t),o=0;for(t=r?t:t[Symbol.iterator]();;){var i;if(r){if(o>=t.length)break;i=t[o++]}else{if((o=t.next()).done)break;i=o.value}var a=i;Eo(n,a.path)||(n=Io(n,a.path,a.message))}}return n}(t)):n(t)}))}))}),[p.validationSchema]),k=(0,l.useCallback)((function(e,n){return new Promise((function(t){return t(b.current[e].validate(n))}))}),[]),_=(0,l.useCallback)((function(e){var n=Object.keys(b.current).filter((function(e){return wo(b.current[e].validate)})),t=n.length>0?n.map((function(n){return k(n,Eo(e,n))})):[Promise.resolve("DO_NOT_DELETE_YOU_WILL_BE_FIRED")];return Promise.all(t).then((function(e){return e.reduce((function(e,t,r){return"DO_NOT_DELETE_YOU_WILL_BE_FIRED"===t||t&&(e=Io(e,n[r],t)),e}),{})}))}),[k]),Z=(0,l.useCallback)((function(e){return Promise.all([_(e),p.validationSchema?S(e):{},p.validate?N(e):{}]).then((function(e){var n=e[0],t=e[1],r=e[2];return Se.all([n,t,r],{arrayMerge:Po})}))}),[p.validate,p.validationSchema,_,N,S]),E=Fo((function(e){return void 0===e&&(e=j.values),w({type:"SET_ISVALIDATING",payload:!0}),Z(e).then((function(e){return x.current&&(w({type:"SET_ISVALIDATING",payload:!1}),w({type:"SET_ERRORS",payload:e})),e}))}));(0,l.useEffect)((function(){a&&!0===x.current&&Gr()(h.current,p.initialValues)&&E(h.current)}),[a,E]);var I=(0,l.useCallback)((function(e){var n=e&&e.values?e.values:h.current,t=e&&e.errors?e.errors:v.current?v.current:p.initialErrors||{},r=e&&e.touched?e.touched:m.current?m.current:p.initialTouched||{},o=e&&e.status?e.status:g.current?g.current:p.initialStatus;h.current=n,v.current=t,m.current=r,g.current=o;var i=function(){w({type:"RESET_FORM",payload:{isSubmitting:!!e&&!!e.isSubmitting,errors:t,touched:r,status:o,values:n,isValidating:!!e&&!!e.isValidating,submitCount:e&&e.submitCount&&"number"===typeof e.submitCount?e.submitCount:0}})};if(p.onReset){var a=p.onReset(j.values,G);Zo(a)?a.then(i):i()}else i()}),[p.initialErrors,p.initialStatus,p.initialTouched,p.onReset]);(0,l.useEffect)((function(){!0!==x.current||Gr()(h.current,p.initialValues)||c&&
1(h.current=p.initialValues,I(),a&&E(h.current))}),[c,p.initialValues,I,a,E]),(0,l.useEffect)((function(){c&&!0===x.current&&!Gr()(v.current,p.initialErrors)&&(v.current=p.initialErrors||To,w({type:"SET_ERRORS",payload:p.initialErrors||To}))}),[c,p.initialErrors]),(0,l.useEffect)((function(){c&&!0===x.current&&!Gr()(m.current,p.initialTouched)&&(m.current=p.initialTouched||Ao,w({type:"SET_TOUCHED",payload:p.initialTouched||Ao}))}),[c,p.initialTouched]),(0,l.useEffect)((function(){c&&!0===x.current&&!Gr()(g.current,p.initialStatus)&&(g.current=p.initialStatus,w({type:"SET_STATUS",payload:p.initialStatus}))}),[c,p.initialStatus,p.initialTouched]);var O=Fo((function(e){if(b.current[e]&&wo(b.current[e].validate)){var n=Eo(j.values,e),t=b.current[e].validate(n);return Zo(t)?(w({type:"SET_ISVALIDATING",payload:!0}),t.then((function(e){return e})).then((function(n){w({type:"SET_FIELD_ERROR",payload:{field:e,value:n}}),w({type:"SET_ISVALIDATING",payload:!1})}))):(w({type:"SET_FIELD_ERROR",payload:{field:e,value:t}}),Promise.resolve(t))}return p.validationSchema?(w({type:"SET_ISVALIDATING",payload:!0}),S(j.values,e).then((function(e){return e})).then((function(n){w({type:"SET_FIELD_ERROR",payload:{field:e,value:Eo(n,e)}}),w({type:"SET_ISVALIDATING",payload:!1})}))):Promise.resolve()})),T=(0,l.useCallback)((function(e,n){var t=n.validate;b.current[e]={validate:t}}),[]),A=(0,l.useCallback)((function(e){delete b.current[e]}),[]),D=Fo((function(e,n){return w({type:"SET_TOUCHED",payload:e}),(void 0===n?o:n)?E(j.values):Promise.resolve()})),L=(0,l.useCallback)((function(e){w({type:"SET_ERRORS",payload:e})}),[]),M=Fo((function(e,n){var r=wo(e)?e(j.values):e;return w({type:"SET_VALUES",payload:r}),(void 0===n?t:n)?E(r):Promise.resolve()})),P=(0,l.useCallback)((function(e,n){w({type:"SET_FIELD_ERROR",payload:{field:e,value:n}})}),[]),R=Fo((function(e,n,r){return w({type:"SET_FIELD_VALUE",payload:{field:e,value:n}}),(void 0===r?t:r)?E(Io(j.values,e,n)):Promise.resolve()})),F=(0,l.useCallback)((function(e,n){var t,r=n,o=e;if(!ko(e)){e.persist&&e.persist();var i=e.target?e.target:e.currentTarget,a=i.type,l=i.name,s=i.id,u=i.value,c=i.checked,d=(i.outerHTML,i.options),f=i.multiple;r=n||(l||s),o=/number|range/.test(a)?(t=parseFloat(u),isNaN(t)?"":t):/checkbox/.test(a)?function(e,n,t){if("boolean"===typeof e)return Boolean(n);var r=[],o=!1,i=-1;if(Array.isArray(e))r=e,o=(i=e.indexOf(t))>=0;else if(!t||"true"==t||"false"==t)return Boolean(n);if(n&&t&&!o)return r.concat(t);if(!o)return r;return r.slice(0,i).concat(r.slice(i+1))}(Eo(j.values,r),c,u):d&&f?function(e){return Array.from(e).filter((function(e){return e.selected})).map((function(e){return e.value}))}(d):u}r&&R(r,o)}),[R,j.values]),z=Fo((function(e){if(ko(e))return function(n){return F(n,e)};F(e)})),B=Fo((function(e,n,t){return void 0===n&&(n=!0),w({type:"SET_FIELD_TOUCHED",payload:{field:e,value:n}}),(void 0===t?o:t)?E(j.values):Promise.resolve()})),H=(0,l.useCallback)((function(e,n){e.persist&&e.persist();var t=e.target,r=t.name,o=t.id,i=(t.outerHTML,n||(r||o));B(i,!0)}),[B]),V=Fo((function(e){if(ko(e))return function(n){return H(n,e)};H(e)})),$=(0,l.useCallback)((function(e){wo(e)?w({type:"SET_FORMIK_STATE",payload:e}):w({type:"SET_FORMIK_STATE",payload:function(){return e}})}),[]),U=(0,l.useCallback)((function(e){w({type:"SET_STATUS",payload:e})}),[]),W=(0,l.useCallback)((function(e){w({type:"SET_ISSUBMITTING",payload:e})}),[]),q=Fo((function(){return w({type:"SUBMIT_ATTEMPT"}),E().then((function(e){var n=e instanceof Error;if(!n&&0===Object.keys(e).length){var t;try{if(void 0===(t=J()))return}catch(r){throw r}return Promise.resolve(t).then((function(e){return x.current&&w({type:"SUBMIT_SUCCESS"}),e})).catch((function(e){if(x.current)throw w({type:"SUBMIT_FAILURE"}),e}))}if(x.current&&(w({type:"SUBMIT_FAILURE"}),n))throw e}))})),K=Fo((function(e){e&&e.preventDefault&&wo(e.preventDefault)&&e.preventDefault(),e&&e.stopPropagation&&wo(e.stopPropagation)&&e.stopPropagation(),q().catch((function(e){console.warn("Warning: An unhandled error was caught from submitForm()",e)}))}
1)),G={resetForm:I,validateForm:E,validateField:O,setErrors:L,setFieldError:P,setFieldTouched:B,setFieldValue:R,setStatus:U,setSubmitting:W,setTouched:D,setValues:M,setFormikState:$,submitForm:q},J=Fo((function(){return d(j.values,G)})),X=Fo((function(e){e&&e.preventDefault&&wo(e.preventDefault)&&e.preventDefault(),e&&e.stopPropagation&&wo(e.stopPropagation)&&e.stopPropagation(),I()})),Y=(0,l.useCallback)((function(e){return{value:Eo(j.values,e),error:Eo(j.errors,e),touched:!!Eo(j.touched,e),initialValue:Eo(h.current,e),initialTouched:!!Eo(m.current,e),initialError:Eo(v.current,e)}}),[j.errors,j.touched,j.values]),Q=(0,l.useCallback)((function(e){return{setValue:function(n,t){return R(e,n,t)},setTouched:function(n,t){return B(e,n,t)},setError:function(n){return P(e,n)}}}),[R,B,P]),ee=(0,l.useCallback)((function(e){var n=No(e),t=n?e.name:e,r=Eo(j.values,t),o={name:t,value:r,onChange:z,onBlur:V};if(n){var i=e.type,a=e.value,l=e.as,s=e.multiple;"checkbox"===i?void 0===a?o.checked=!!r:(o.checked=!(!Array.isArray(r)||!~r.indexOf(a)),o.value=a):"radio"===i?(o.checked=r===a,o.value=a):"select"===l&&s&&(o.value=o.value||[],o.multiple=!0)}return o}),[V,z,j.values]),ne=(0,l.useMemo)((function(){return!Gr()(h.current,j.values)}),[h.current,j.values]),te=(0,l.useMemo)((function(){return"undefined"!==typeof s?ne?j.errors&&0===Object.keys(j.errors).length:!1!==s&&wo(s)?s(p):s:j.errors&&0===Object.keys(j.errors).length}),[s,ne,j.errors,p]);return ho({},j,{initialValues:h.current,initialErrors:v.current,initialTouched:m.current,initialStatus:g.current,handleBlur:V,handleChange:z,handleReset:X,handleSubmit:K,resetForm:I,setErrors:L,setFormikState:$,setFieldTouched:B,setFieldValue:R,setFieldError:P,setStatus:U,setSubmitting:W,setTouched:D,setValues:M,submitForm:q,validateForm:E,validateField:O,isValid:te,dirty:ne,unregisterField:A,registerField:T,getFieldProps:ee,getFieldMeta:Y,getFieldHelpers:Q,validateOnBlur:o,validateOnChange:t,validateOnMount:a})}function Lo(e){var n=Do(e),t=e.component,r=e.children,o=e.render,i=e.innerRef;return(0,l.useImperativeHandle)(i,(function(){return n})),(0,l.createElement)(bo,{value:n},t?(0,l.createElement)(t,n):o?o(n):r?wo(r)?r(n):_o(r)?null:l.Children.only(r):null)}function Mo(e){var n=Array.isArray(e)?[]:{};for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)){var r=String(t);!0===Array.isArray(e[r])?n[r]=e[r].map((function(e){return!0===Array.isArray(e)||qe(e)?Mo(e):""!==e?e:void 0})):qe(e[r])?n[r]=Mo(e[r]):n[r]=""!==e[r]?e[r]:void 0}return n}function Po(e,n,t){var r=e.slice();return n.forEach((function(n,o){if("undefined"===typeof r[o]){var i=!1!==t.clone&&t.isMergeableObject(n);r[o]=i?Se(Array.isArray(n)?[]:{},n,t):n}else t.isMergeableObject(n)?r[o]=Se(e[o],n,t):-1===e.indexOf(n)&&r.push(n)})),r}var Ro="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement?l.useLayoutEffect:l.useEffect;function Fo(e){var n=(0,l.useRef)(e);return Ro((function(){n.current=e})),(0,l.useCallback)((function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return n.current.apply(void 0,t)}),[])}function zo(e){var n=e.validate,t=e.name,r=e.render,o=e.children,i=e.as,a=e.component,s=e.className,u=mo(e,["validate","name","render","children","as","component","className"]),c=mo(Co(),["validate","validationSchema"]);var d=c.registerField,f=c.unregisterField;(0,l.useEffect)((function(){return d(t,{validate:n}),function(){f(t)}}),[d,f,t,n]);var p=c.getFieldProps(ho({name:t},u)),h=c.getFieldMeta(t),v={field:p,form:c};if(r)return r(ho({},v,{meta:h}));if(wo(o))return o(ho({},v,{meta:h}));if(a){if("string"===typeof a){var m=u.innerRef,g=mo(u,["innerRef"]);return(0,l.createElement)(a,ho({ref:m},p,g,{className:s}),o)}return(0,l.createElement)(a,ho({field:p,form:c},u,{className:s}),o)}var x=i||"input";if("string"===typeof x){var b=u.innerRef,y=mo(u,["innerRef"]);return(0,l.createElement)(x,ho({ref:b},p,y,{className:s}),o)}return(0,l.createElement)(x,ho({},p,u,{className:s}),o)}var Bo=(0,l.forwardRef)((function(e,n){var t=e.action,r=mo(e,["action"]),o=null!=t?t:"#",i=Co(),a=i.handleReset,s=i.handleSubmit;return(0,l.createElement)("form",ho({onSubmit:s,ref:n,onReset:a,action:o},r))}));function Ho(e){var n=function(n){return(0,l.createElement)(yo,null,(function(t){return t||Jr(!1),(0,l.createElement)(e,ho({},n,{formik:t}))}))}
1,t=e.displayName||e.name||e.constructor&&e.constructor.name||"Component";return n.WrappedComponent=e,n.displayName="FormikConnect("+t+")",po()(n,e)}Bo.displayName="Form";var Vo=function(e,n,t){var r=$o(e);return r.splice(n,0,t),r},$o=function(e){if(e){if(Array.isArray(e))return[].concat(e);var n=Object.keys(e).map((function(e){return parseInt(e)})).reduce((function(e,n){return n>e?n:e}),0);return Array.from(ho({},e,{length:n+1}))}return[]},Uo=function(e,n){var t="function"===typeof e?e:n;return function(e){if(Array.isArray(e)||No(e)){var n=$o(e);return t(n)}return e}},Wo=function(e){function n(n){var t;return(t=e.call(this,n)||this).updateArrayField=function(e,n,r){var o=t.props,i=o.name;(0,o.formik.setFormikState)((function(t){var o=Uo(r,e),a=Uo(n,e),l=Io(t.values,i,e(Eo(t.values,i))),s=r?o(Eo(t.errors,i)):void 0,u=n?a(Eo(t.touched,i)):void 0;return jo(s)&&(s=void 0),jo(u)&&(u=void 0),ho({},t,{values:l,errors:r?Io(t.errors,i,s):t.errors,touched:n?Io(t.touched,i,u):t.touched})}))},t.push=function(e){return t.updateArrayField((function(n){return[].concat($o(n),[qr(e)])}),!1,!1)},t.handlePush=function(e){return function(){return t.push(e)}},t.swap=function(e,n){return t.updateArrayField((function(t){return function(e,n,t){var r=$o(e),o=r[n];return r[n]=r[t],r[t]=o,r}(t,e,n)}),!0,!0)},t.handleSwap=function(e,n){return function(){return t.swap(e,n)}},t.move=function(e,n){return t.updateArrayField((function(t){return function(e,n,t){var r=$o(e),o=r[n];return r.splice(n,1),r.splice(t,0,o),r}(t,e,n)}),!0,!0)},t.handleMove=function(e,n){return function(){return t.move(e,n)}},t.insert=function(e,n){return t.updateArrayField((function(t){return Vo(t,e,n)}),(function(n){return Vo(n,e,null)}),(function(n){return Vo(n,e,null)}))},t.handleInsert=function(e,n){return function(){return t.insert(e,n)}},t.replace=function(e,n){return t.updateArrayField((function(t){return function(e,n,t){var r=$o(e);return r[n]=t,r}(t,e,n)}),!1,!1)},t.handleReplace=function(e,n){return function(){return t.replace(e,n)}},t.unshift=function(e){var n=-1;return t.updateArrayField((function(t){var r=t?[e].concat(t):[e];return n=r.length,r}),(function(e){return e?[null].concat(e):[null]}),(function(e){return e?[null].concat(e):[null]})),n},t.handleUnshift=function(e){return function(){return t.unshift(e)}},t.handleRemove=function(e){return function(){return t.remove(e)}},t.handlePop=function(){return function(){return t.pop()}},t.remove=t.remove.bind(go(t)),t.pop=t.pop.bind(go(t)),t}vo(n,e);var t=n.prototype;return t.componentDidUpdate=function(e){this.props.validateOnChange&&this.props.formik.validateOnChange&&!Gr()(Eo(e.formik.values,e.name),Eo(this.props.formik.values,this.props.name))&&this.props.formik.validateForm(this.props.formik.values)},t.remove=function(e){var n;return this.updateArrayField((function(t){var r=t?$o(t):[];return n||(n=r[e]),wo(r.splice)&&r.splice(e,1),wo(r.every)&&r.every((function(e){return void 0===e}))?[]:r}),!0,!0),n},t.pop=function(){var e;return this.updateArrayField((function(n){var t=n.slice();return e||(e=t&&t.pop&&t.pop()),t}),!0,!0),e},t.render=function(){var e={push:this.push,pop:this.pop,swap:this.swap,move:this.move,insert:this.insert,replace:this.replace,unshift:this.unshift,remove:this.remove,handlePush:this.handlePush,handlePop:this.handlePop,handleSwap:this.handleSwap,handleMove:this.handleMove,handleInsert:this.handleInsert,handleReplace:this.handleReplace,handleUnshift:this.handleUnshift,handleRemove:this.handleRemove},n=this.props,t=n.component,r=n.render,o=n.children,i=n.name,a=ho({},e,{form:mo(n.formik,["validate","validationSchema"]),name:i});return t?(0,l.createElement)(t,a):r?r(a):o?"function"===typeof o?o(a):_o(o)?null:l.Children.only(o):null},n}(l.Component);Wo.defaultProps={validateOnChange:!0};var qo=function(e){function n(){return e.apply(this,arguments)||this}vo(n,e);var t=n.prototype;return t.shouldComponentUpdate=function(e){return Eo(this.props.formik.errors,this.props.name)!==Eo(e.formik.errors,this.props.name)||Eo(this.props.formik.touched,this.props.name)!==Eo(e.formik.touched,this.props.name)||Object.keys(this.props).length!==Object.keys(e).length},t.render=function(){var e=this.props,n=e.component,t=e.formik,r=e.render,o=e.children,i=e.name,a=mo(e,["component","formik","render","children","name"]),s=Eo(t.touched,i),u=Eo(t.errors,i);return s&&u?r?wo(r)?r(u):null:o?wo(o)?o(u):null:n?(0,l.createElement)(n,a,u):u:null},n}(l.Component),Ko=Ho(qo),Go=(l.Component,t(77149)),Jo=t(44303),Xo=function(e){var n=e.activeStepIndex,t=e.field,r=e.header,o=e.docLink,a=e.label,s=e.required,u=e.writePermission,c=e.patchActiveStep,d=e.saveAndPatchActiveStep,f=(0,be.Z)(e,["activeStepIndex","field","header","docLink","label","required","writePermission","patchActiveStep","saveAndPatchActiveStep"]),p=(0,l.useState)(""),b=p[0],y=p[1],C=(0,l.useState)(""),j=C[0],w=C[1],N=(0,l.useState)(""),S=N[0],k=N[1],_=(0,l.useState)(!1),Z=_[0],E=_[1];(0,l.useEffect)((function(){if("string"===typeof f.value)y(f.value),k("");else if((0,Q.lp)(f.value)&&(0,Q._7)(f.value)){var e=f.value.$ref;y("refs.".concat(e)),k("")}else y(""),k("Invalid field definition.");return function(){return y("")}}),[f.value,n]),(0,l.useEffect)((function(){return t.name&&w(t.name),function(){return w("")}}),[t.name]);var I=function(e){k(!e&&s?"Required field":"")},O=function(){var e=(0,h.Z)((function(){var e,n,t,r,o,i;return(0,x.__generator)(this,(function(a){return u?Z?(e=(0,Go.Z)(b.split(".")),n=e[0],t=e.slice(1),"refs"===n?(r={$ref:t.join(".")},o=(0,v.Z)({},j,r),[2,d(o)]):(i=(0,v.Z)({},j,b),[2,d(i)])):(I(b),E(!1),[2]):[2]}))}));return function(){return e.apply(this,arguments)}}(),T=function(){var e=(0,h.Z)((function(e){var n;return(0,x.__generator)(this,(function(t){return e.persist(),I(e.target.value),y(e.target.value),E(!0),n=(0,v.Z)({},j,e.target.value),c(n),[2]}))}
1));return function(n){return e.apply(this,arguments)}}(),A=(t.onChange,t.onBlur,(0,be.Z)(t,["onChange","onBlur"]));return(0,i.jsxs)(Jo.i$,{children:[(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(Jo.AU,{children:r}),(0,i.jsx)(Jo.G5,{children:o&&(0,i.jsxs)("a",{href:o.url,target:"_blank",rel:"noopener noreferrer",children:[(0,i.jsx)("span",{className:"text",children:o.text}),o.icon]})})]}),(0,i.jsx)(Jo.rJ,{children:a&&(0,i.jsx)(Jo.AZ,{className:S&&"errorText",children:a})}),(0,i.jsx)(Jo.II,(0,g.Z)((0,m.Z)({readOnly:!u,className:S&&"errorBorder"},A,f),{onBlur:O,onChange:T,value:b})),S&&(0,i.jsxs)(Jo.pd,{children:[" ",S," "]})]})},Yo=t(75259),Qo=function(){return(0,i.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,i.jsx)("circle",{cx:"7",cy:"7",r:"7",fill:"#F26F6F"}),(0,i.jsx)("path",{d:"M6.43519 8.60912H7.61134L7.84398 2.625H6.18962L6.43519 8.60912ZM6.125 10.4832C6.125 10.9614 6.52566 11.375 7.0168 11.375C7.50794 11.375 7.92153 10.9614 7.92153 10.4832C7.92153 9.99206 7.50794 9.57847 7.0168 9.57847C6.52566 9.57847 6.125 9.99206 6.125 10.4832Z",fill:"white"})]})},ei=function(e){var n=e.activeStepIndex,t=e.field,r=e.header,o=e.writePermission,a=e.patchActiveStep,s=e.saveAndPatchActiveStep,u=(0,be.Z)(e,["activeStepIndex","field","header","writePermission","patchActiveStep","saveAndPatchActiveStep"]),c=(0,l.useState)(""),d=c[0],f=c[1],p=(0,l.useState)(""),b=p[0],y=p[1],C=(0,l.useState)([]),j=C[0],w=C[1],N=(0,l.useState)(""),S=N[0],k=N[1],_=(0,l.useState)(""),Z=_[0],E=_[1],I=(0,l.useState)(!1),O=I[0],T=I[1],A=(0,l.useState)(!1),D=A[0],L=A[1];(0,l.useEffect)((function(){return u.options&&w(u.options),t.name&&k(t.name),function(){w([]),k("")}}),[u.options,t.name]),(0,l.useEffect)((function(){if("string"===typeof u.value){T(!1);var e=u.value.lastIndexOf(" ");f(u.value.substring(0,e)),y(u.value.substring(e+1)),E("")}else if((0,Q.lp)(u.value)&&(0,Q._7)(u.value)){T(!0);var n=u.value.$ref;f("refs.".concat(n)),E("")}else f(""),E("Invalid field definition.");return function(){f(""),y("")}}),[u.value,n]);var M=function(e){2==e.split(" ").length&&e.split(" ")[0]?E(""):E("Invalid entry")},P=function(){var e=(0,h.Z)((function(){var e;return(0,x.__generator)(this,(function(n){switch(n.label){case 0:return o?D?(e=(0,v.Z)({},S,"".concat(d," ").concat(b)),[4,s(e)]):[3,2]:[2];case 1:n.sent(),n.label=2;case 2:return M("".concat(d," ").concat(b)),L(!1),[2]}}))}));return function(){return e.apply(this,arguments)}}(),R=function(){var e=(0,h.Z)((function(e){var n;return(0,x.__generator)(this,(function(t){return e.persist(),f(e.target.value),L(!0),M("".concat(e.target.value," ").concat(b)),n=(0,v.Z)({},S,"".concat(e.target.value," ").concat(b)),a(n),[2]}))}
1));return function(n){return e.apply(this,arguments)}}(),F=function(){var e=(0,h.Z)((function(e){var n;return(0,x.__generator)(this,(function(t){switch(t.label){case 0:return y(e.value),L(!0),M("".concat(d," ").concat(e.value)),n=(0,v.Z)({},S,"".concat(d," ").concat(e.value)),[4,s(n)];case 1:return t.sent(),[2]}}))}));return function(n){return e.apply(this,arguments)}}(),z=(t.onChange,t.onBlur,(0,be.Z)(t,["onChange","onBlur"]));return(0,i.jsx)(Jo.i$,{children:O?(0,i.jsx)(Xo,{field:t,header:r,label:null,value:d,required:!0,writePermission:o,patchActiveStep:a}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(Jo.$i,{children:[(0,i.jsx)(Jo.AU,{children:r}),Z&&(0,i.jsxs)(Jo.cX,{children:[(0,i.jsx)(Qo,{}),(0,i.jsxs)(Jo.lb,{children:[" ",Z," "]})]})]}),(0,i.jsxs)(Jo.bJ,{children:[(0,i.jsx)(Jo.Bx,(0,g.Z)((0,m.Z)({className:Z&&"errorBorder"},z,u),{readOnly:!o,onBlur:P,onChange:R,value:d})),(0,i.jsx)(Ko,(0,g.Z)((0,m.Z)({},t,u),{component:"div"})),(0,i.jsx)(Yo.ZP,{isDisabled:!o,className:Z&&"errorBorderSelect",onChange:F,value:{value:b,label:b},children:j.map((function(e,n){return(0,i.jsx)(Jo.Qr,{value:e,children:e},n)}))})]})]})})},ni=function(e){var n=e.field,t=e.label,r=e.required,o=e.writePermission,a=e.patchActiveStep,s=e.saveAndPatchActiveStep,u=(0,be.Z)(e,["field","label","required","writePermission","patchActiveStep","saveAndPatchActiveStep"]),c=(0,l.useState)(""),d=c[0],f=c[1],p=(0,l.useState)([]),m=p[0],g=p[1],b=(0,l.useState)(""),y=b[0],C=b[1],j=(0,l.useState)(!1),w=j[0],N=j[1],S=(0,l.useState)(""),k=S[0],_=S[1];(0,l.useEffect)((function(){if(u.options&&g(u.options),n.name&&C(n.name),"string"===typeof u.value)N(!1),f(u.value);else if((0,Q.lp)(u.value)&&(0,Q._7)(u.value)){N(!0);var e=u.value.$ref;f("refs.".concat(e))}else f(""),_("Invalid field definition.");return function(){g([]),C(""),f("")}}),[u.options,n.name,u.value]);var Z=function(){var e=(0,h.Z)((function(e){var n;return(0,x.__generator)(this,(function(t){switch(t.label){case 0:return o=e.value,_(!o&&r?"Required field":""),f(e.value),n=(0,v.Z)({},y,e.value),[4,s(n)];case 1:return t.sent(),[2]}var o}))}));return function(n){return e.apply(this,arguments)}}();return(0,i.jsx)(Jo.i$,{children:w?(0,i.jsx)(Xo,{field:n,header:null,label:t,value:d,required:!0,writePermission:o,patchActiveStep:a}):(0,i.jsx)(Jo.DZ,{children:(0,i.jsx)(Yo.ZP,{isDisabled:!o,className:k&&"errorBorderSelect",onChange:Z,label:t,value:{value:d,label:d},isSearchable:!1,children:m.map((function(e,n){return(0,i.jsx)(Jo.Qr,{value:e,children:e},n)}))})})})},ti=t(49362),ri=t(12433);function oi(){var e=(0,o.Z)(["\n  width: 350px;\n"]);return oi=function(){return e},e}function ii(){var e=(0,o.Z)(["\n  width: 350px;\n  margin: 3px 0 0 15px;\n  font-size: 11px;\n  white-space: nowrap;\n  color: gray;\n  font-style: italic;\n"]);return ii=function(){return e},e}var ai=(0,u.default)(Yo.ZP)(oi()),li=u.default.div(ii()),si=function(e){var n=e.field,t=e.label,r=e.required,o=e.writePermission,a=e.saveAndPatchActiveStep,s=(0,be.Z)(e,["field","label","required","writePermission","saveAndPatchActiveStep"]),u=(0,l.useState)(""),c=u[0],d=u[1],f=(0,l.useState)([]),p=f[0],m=f[1],g=(0,l.useState)(""),b=g[0],y=g[1],C=(0,l.useState)(""),j=C[0],w=C[1],S=mi({action:"send"}),k=(0,ti.Kw)((function(e){return e.notifications.notifications}))||[];(0,l.useEffect)((function(){if(s.options)m(s.options);else if(t===S.template.label){var e=(0,N.Z)(k.map((function(e){var n=e.id;return{label:e.title,value:(0,ri.Q)(n)}})).sort((0,D.sortBy)("label")));m(e)}return n.name&&y(n.name),"string"===typeof s.value?d(s.value):(d(""),w("Invalid field definition.")),function(){m([]),y(""),d("")}}),[s.options,n.name,s.value,k.length]);var _=function(){var e=(0,h.Z)((function(e){var n;return(0,x.__generator)(this,(function(t){switch(t.label){case 0:return o=null===e||void 0===e?void 0:e.value,w(!o&&r?"Required field":""),d(null===e||void 0===e?void 0:e.value),n=(0,v.Z)({},b,null===e||void 0===e?void 0:e.value),[4,a(n)];case 1:return t.sent(),[2]}var o}))}));return function(n){return e.apply(this,arguments)}}();return(0,i.jsxs)(Jo.i$,{children:[(0,i.jsx)(Jo.DZ,{children:(0,i.jsx)(ai,{isDisabled:!o,className:j&&"errorBorderSelect",onChange:_,label:t,value:{value:c,label:c},isSearchable:!0,isClearable:!0,children:p.map((function(e,n){return(0,i.jsx)(Jo.Qr,{label:e.label,value:e.value,children:e.label},n)}))})}),t===S.template.label&&c&&(0,i.jsx)(li,{children:"ID: ".concat(c)})]})},ui=t(87105),ci=function(e){try{return JSON.parse(e)}catch(n){return null}},di=function(e){var n=e.field,t=e.header,r=e.writePermission,o=e.patchActiveStep,a=e.saveAndPatchActiveStep,s=(0,be.Z)(e,["field","header","writePermission","patchActiveStep","saveAndPatchActiveStep"]),u=(0,l.useState)(""),c=u[0],d=u[1],f=(0,l.useState)(""),p=f[0],b=f[1],y=(0,l.useState)(""),C=y[0],j=y[1],w=(0,l.useState)(!1),N=w[0],S=w[1];(0,l.useEffect)((function(){if(s.value){var e=JSON.stringify(s.value,
1null,2);e!==JSON.stringify(ci(c),null,2)&&(_(e),d(e))}}),[s.value]),(0,l.useEffect)((function(){return n.name&&b(n.name),function(){return b("")}}),[n.name]);var k=function(){var e=(0,h.Z)((function(){var e,n;return(0,x.__generator)(this,(function(t){switch(t.label){case 0:return(e=ci(c))&&N?(n=(0,v.Z)({},p,e),[4,a(n)]):[2];case 1:return t.sent(),S(!1),[2]}}))}));return function(){return e.apply(this,arguments)}}(),_=function(e){var n=ci(e);j(n?"":"Invalid field definition.")},Z=(n.onChange,n.onBlur,(0,be.Z)(n,["onChange","onBlur"]));return(0,i.jsxs)(Jo.h,(0,g.Z)((0,m.Z)({},Z,s),{onBlur:k,children:[(0,i.jsx)(Jo.AU,{className:C&&"errorText",children:C?(0,i.jsx)("span",{children:C}):t}),(0,i.jsx)(ui.default,{value:c,onChange:function(e){_(e),d(e);var n=ci(e);if(n){var t=(0,v.Z)({},p,n);o(t)}S(!0)},options:{mode:"application/json",readOnly:!r}})]}))};function fi(){var e=(0,o.Z)(["\n  width: 438px;\n  height: 299px;\n  margin-bottom: 21px;\n"]);return fi=function(){return e},e}var pi=function(e){try{return JSON.parse(e)}catch(n){return null}},hi=(0,u.default)(Jo.i$)(fi()),vi=function(e){var n=e.field,t=e.header,r=e.writePermission,o=e.patchActiveStep,a=e.saveAndPatchActiveStep,s=(0,be.Z)(e,["field","header","writePermission","patchActiveStep","saveAndPatchActiveStep"]),u=(0,l.useState)(""),c=u[0],d=u[1],f=(0,l.useState)(""),p=f[0],b=f[1],y=(0,l.useState)(""),C=y[0],j=y[1],w=(0,l.useState)(!1),N=w[0],S=w[1];(0,l.useEffect)((function(){if(s.value){var e=JSON.stringify(s.value,null,2);e!==JSON.stringify(pi(c),null,2)&&(_(e),d(e))}}),[s.value]),(0,l.useEffect)((function(){return n.name&&b(n.name),function(){return b("")}}),[n.name]);var k=function(){var e=(0,h.Z)((function(){var e,n;return(0,x.__generator)(this,(function(t){switch(t.label){case 0:return(e=pi(c))&&N?(n=(0,v.Z)({},p,e),[4,a(n)]):[2];case 1:return t.sent(),S(!1),[2]}}))}));return function(){return e.apply(this,arguments)}}(),_=function(e){var n=pi(e);j(n?"":"Invalid field definition.")},Z=(n.onChange,n.onBlur,(0,be.Z)(n,["onChange","onBlur"]));return(0,i.jsxs)(hi,(0,g.Z)((0,m.Z)({},Z,s),{onBlur:k,children:[(0,i.jsx)(Jo.AU,{className:C&&"errorText",children:C?(0,i.jsx)("span",{children:C}):t}),(0,i.jsx)(ui.default,{value:c,onChange:function(e){_(e),d(e);var n=pi(e);if(n){var t=(0,v.Z)({},p,n);o(t)}S(!0)},options:{mode:"application/json",readOnly:!r}})]}))},mi=function(e){switch(null===e||void 0===e?void 0:e.action){case"cancel":return{cancelation_token:{component:Xo,header:"Use this cancelation token",label:"Cancelation token",value:"",orderIndex:0,required:!0},if:{component:Xo,header:"If the following conditional is true",label:"Condition",value:""},ref:{component:Xo,header:"Reference",label:"Reference",value:""}};case"delay":return{duration:{component:ei,header:"How long?",label:"Duration",options:["minute","minutes","hour","hours","day","days","week","weeks","month","months","year","years"],value:"5 minutes",orderIndex:0,required:!0},until:{component:Xo,header:"Until When?",label:"Until",value:"",orderIndex:0,required:!0},if:{component:Xo,header:"If the following conditional is true",label:"Condition",value:""},ref:{component:Xo,header:"Reference",label:"Reference",value:""}};case"fetch-data":return{webhook:{component:di,header:"Webhook",label:"Webhook",value:{url:"WEBHOOK_URL",method:"GET",body:{},headers:{},params:{}},orderIndex:0,required:!0},merge_strategy:{component:ni,header:null,label:"Merge Strategy",options:["replace","overwrite","soft-merge","none"],value:"replace",orderIndex:1,required:!0},idempotency_expiry:{component:Xo,header:"Idempotency Expiry",label:"Idempotency Expiry",value:""},idempotency_key:{component:Xo,header:"Idempotency Key",label:"Idempotency Key",value:""},if:{component:Xo,header:"If the following conditional is true",label:"Condition",value:""},ref:{component:Xo,header:"Reference",label:"Reference",value:""}};case"invoke":return{context:{component:di,header:"Data",label:"Data",value:{brand:"",data:{},profile:{},template:"",recipient:""}},template:{component:Xo,header:"Invoke this automation",label:"Template",value:"",orderIndex:0,required:!0},if:{component:Xo,header:"If the following conditional is true",label:"Condition",value:""},ref:{component:Xo,header:"Reference",label:"Reference",value:""}};case"send":return(null===e||void 0===e?void 0:e.message)?{message:{component:vi,header:"Send this message",label:"Message",value:{to:{},template:""},required:!0},idempotency_expiry:{component:Xo,header:"Idempotency Expiry",label:"Idempotency Expiry",value:""},idempotency_key:{component:Xo,header:"Idempotency Key",label:"Idempotency Key",value:""},if:{component:Xo,header:"If the following conditional is true",label:"Condition",value:""}}:{brand:{component:Xo,header:"Use this brand",label:"Brand ID",value:""},data:{component:di,header:"Data",label:"Data",value:{}},idempotency_expiry:{component:Xo,header:"Idempotency Expiry",label:"Idempotency Expiry",value:""},idempotency_key:{component:Xo,header:"Idempotency Key",label:"Idempotency Key",value:""},override:{component:di,header:"Override",label:"Override",value:{}},profile:{component:di,header:"Profile",label:"Profile",value:{}},template:{component:si,header:"Send this message",label:"Notification",options:void 0,orderIndex:0,value:void 0,required:!0},recipient:{component:Xo,header:"To this recipient",label:"Recipient ID",docLink:{text:"Learn More",icon:(0,i.jsx)(M.default.ExternalLink,{}),url:"https://help.courier.com/en/articles/5437032-using-the-automation-visual-designer#h_2821a9a56e"},orderIndex:1,value:"",required:!0},if:{component:Xo,header:"If the following conditional is true",label:"Condition",value:""},ref:{component:Xo,header:"Reference",label:"Reference",value:""}};case"send-list":return{brand:{component:Xo,header:"Use this brand",label:"Brand ID",value:""},data:{component:di,header:"Data",label:"Data",value:{}},idempotency_expiry:{component:Xo,header:"Idempotency Expiry",label:"Idempotency Expiry",value:""},idempotency_key:{component:Xo,header:"Idempotency Key",label:"Idempotency Key",value:""},override:{component:di,header:"Override",label:"Override",value:{}},data_source:{component:di,header:"Data Source",label:"Data Source",value:{webhook:{url:"WEBHOOK_URL",method:"GET",headers:{}},merge_strategy:"replace"}},template:{component:Xo,header:"Send this message",label:"Notification ID",orderIndex:0,value:"",required:!0},list:{component:Xo,header:"To this list",label:"List ID",docLink:{text:"Learn More",icon:(0,i.jsx)(M.default.ExternalLink,{}),url:"https://help.courier.com/en/articles/5437032-using-the-automation-visual-designer#h_2821a9a56e"},orderIndex:1,value:"",required:!0},if:{component:Xo,header:"If the following conditional is true",label:"Condition",value:""},ref:{component:Xo,header:"Reference",label:"Reference",value:""},skip_condition:{component:Xo,header:"Skip recipient if the following is true",label:"Skip Condition",value:void 0}};case"update-profile":return{profile:{component:di,header:"New Profile",label:"New Profile",value:{},orderIndex:0,required:!0},recipient_id:{component:Xo,header:"To this recipient",label:"Recipient ID",orderIndex:1,value:"",required:!0},merge:{component:ni,header:null,label:"Merge Strategy",options:["replace","overwrite","soft-merge","none"],value:"replace",orderIndex:2,required:!0},if:{component:Xo,header:"If the following conditional is true",label:"Condition",value:""},ref:{component:Xo,header:"Reference",label:"Reference",value:""}};case"subscribe":return{recipient_id:{component:Xo,header:"Subscribe this recipient",label:"Recipient ID",orderIndex:0,value:"",required:!0},list_id:{component:Xo,header:"To this list",label:"List ID",orderIndex:1,value:"",required:!0},subscription:{component:di,header:"Subscription",label:"Subscription",value:{preferences:{notification:{},categories:{}}}},if:{component:Xo,header:"If the following conditional is true",label:"Condition",value:""},ref:{component:Xo,header:"Reference",label:"Reference",value:""}};default:return e}};function gi(){var e=(0,o.Z)(["\n  width: 532px;\n  height: 497px;\n  padding-left: 25px;\n  padding-right: 25px;\n\n  background: #ffffff;\n  border: 1px solid #e7e2e9;
1\n  box-sizing: border-box;\n  border-radius: 6px;\n\n  .header {\n    display: flex;\n    flex-direction: column;\n    align-items: center;\n    margin-top: 20px;\n    margin-bottom: 20px;\n  }\n\n  .header-text {\n    align-self: flex-start;\n    padding-bottom: 10px;\n\n    font-family: Inter;\n    font-style: normal;\n    font-weight: bold;\n    font-size: 20px;\n    line-height: 27px;\n    letter-spacing: -0.02em;\n\n    color: #e7e2e9;\n  }\n\n  .steps-container {\n    display: flex;\n    align-items: center;\n    justify-content: space-between;\n    flex-wrap: wrap;\n  }\n"]);return gi=function(){return e},e}function xi(){var e=(0,o.Z)(["\n  display: flex;\n  flex-direction: column;\n  align-items: center;\n  justify-content: center;\n  margin-bottom: 15px;\n\n  width: 228px;\n  height: 72px;\n\n  background: #ffffff;\n  border: 1px solid #e5e5e5;\n  box-sizing: border-box;\n  border-radius: 10px;\n\n  font-family: Inter;\n  font-style: normal;\n  font-weight: normal;\n  font-size: 14px;\n  line-height: 19px;\n  text-align: center;\n\n  color: #73819b;\n\n  &:hover {\n    background: #f7eff7;\n    border: 1px solid #9121c2;\n    box-sizing: border-box;\n    box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);\n    border-radius: 6px;\n  }\n"]);return xi=function(){return e},e}var bi=u.default.div(gi()),yi=u.default.div(xi()),Ci=function(e){var n=e.setShowStepMenu,t=e.appendStep,r=e.setActiveStep,o=e.setActiveStepString,a=function(e){var i=mi({action:e,message:{}}),a=Object.keys(i).reduce((function(e,n){return i[n].required&&"until"!==n&&(e[n]=i[n].value),e}),{action:e});o(JSON.stringify(a,null,2)),r(a),t(a),n(!1)};return(0,i.jsxs)(bi,{children:[(0,i.jsxs)("div",{className:"header",children:[(0,i.jsx)("span",{className:"header-text",children:"New Step"}),(0,i.jsx)(pe,{})]}),(0,i.jsxs)("div",{className:"steps-container",children:[(0,i.jsxs)(yi,{onClick:function(){return a("send")},children:[(0,i.jsx)(ve,{}),(0,i.jsx)("span",{children:"Send"})]}),(0,i.jsxs)(yi,{onClick:function(){return a("send-list")},children:[(0,i.jsx)(me,{}),(0,i.jsx)("span",{children:"Send to a list of recipients"})]}),(0,i.jsxs)(yi,{onClick:function(){return a("fetch-data")},children:[(0,i.jsx)(fe,{}),(0,i.jsx)("span",{children:"Fetch Data"})]}),(0,i.jsxs)(yi,{onClick:function(){return a("update-profile")},children:[(0,i.jsx)(xe,{}),(0,i.jsx)("span",{children:"Update Profile"})]}),(0,i.jsxs)(yi,{onClick:function(){return a("delay")},children:[(0,i.jsx)(de,{}),(0,i.jsx)("span",{children:"Delay"})]}),(0,i.jsxs)(yi,{onClick:function(){return a("cancel")},children:[(0,i.jsx)(ce,{}),(0,i.jsx)("span",{children:"Cancel Automation"})]}),(0,i.jsxs)(yi,{onClick:function(){return a("invoke")},children:[(0,i.jsx)(he,{}),(0,i.jsx)("span",{children:"Invoke Another Automation"})]}),(0,i.jsxs)(yi,{onClick:function(){return a("subscribe")},children:[(0,i.jsx)(ge,{}),(0,i.jsx)("span",{children:"Subscribe to a List"})]})]})]})},ji=t(23945),wi=function(){return(0,i.jsx)("svg",{width:"15",height:"16",viewBox:"0 0 15 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,i.jsx)("path",{d:"M7.43312 0.5C-2.47653 0.813768 -2.47888 15.1847 7.43312 15.5C17.3426 15.1862 17.345 0.815268 7.43312 0.5ZM7.43312 14.4286C-1.06074 14.1596 -1.06272 1.84159 7.43312 1.57143C15.927 1.84036 15.929 14.1584 7.43312 14.4286ZM11.1831 8.53571H7.96883V11.75C7.96883 11.8921 7.91239 12.0283 7.81192 12.1288C7.71146 12.2293 7.5752 12.2857 7.43312 12.2857C7.29104 12.2857 7.15477 12.2293 7.05431 12.1288C6.95384 12.0283 6.8974 11.8921 6.8974 11.75V8.53571H3.68312C3.54104 8.53571 3.40477 8.47927 3.30431 8.37881C3.20384 8.27834 3.1474 8.14208 3.1474 8C3.1474 7.85792 3.20384 7.72166 3.30431 7.62119C3.40477 7.52073 3.54104 7.46429 3.68312 7.46429H6.8974V4.25C6.8974 4.10792 6.95384 3.97166 7.05431 3.87119C7.15477 3.77073 7.29104 3.71429 7.43312 3.71429C7.5752 3.71429 7.71146 3.77073 7.81192 3.87119C7.91239 3.97166 7.96883 4.10792 7.96883 4.25V7.46429H11.1831C11.3252 7.46429 11.4615 7.52073 11.5619 7.62119C11.6624 7.72166 11.7188 7.85792 11.7188 8C11.7188 8.14208 11.6624 8.27834 11.5619 8.37881C11.4615 8.47927 11.3252 8.53571 11.1831 8.53571Z",fill:"#24324B"})})},Ni=function(e){var n=e.appendField,t=e.component,r=e.header,o=e.label,a=e.name,l=e.value;return(0,i.jsxs)(Jo.Be,{onClick:function(){n({component:t,header:r,label:o,name:a,value:l})},children:[(0,i.jsx)(wi,{}),(0,i.jsx)(Jo.gH,{children:o})]})},Si=function(){return(0,i.jsx)("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,i.jsx)("path",{d:"M7.433 15C-2.47884 14.6847 -2.47649 0.313768 7.433 0C17.3448 0.315268 17.3425 14.6862 7.433 15ZM7.433 1.07143C-1.06284 1.34164 -1.06081 13.6596 7.433 13.9286C15.9288 13.6584 15.9268 1.34036 7.433 1.07143ZM11.183 6.96429H3.683C3.54092 6.96429 3.40465 7.02073 3.30419 7.12119C3.20372 7.22166 3.14728 7.35792 3.14728 7.5C3.14728 7.64208 3.20372 7.77834 3.30419 7.87881C3.40465 7.97927 3.54092 8.03571 3.683 8.03571H11.183C11.3251 8.03571 11.4613 7.97927 11.5618 7.87881C11.6623 7.77834 11.7187 7.64208 11.7187 7.5C11.7187 7.35792 11.6623 7.22166 11.5618 7.12119C11.4613 7.02073 11.3251 6.96429 11.183 6.96429Z",fill:"#9121C2"})})}
1,ki=t(22063),_i=function(e){var n=e.activeStep,t=e.activeStepIndex,r=e.handleStepOnDelete,o=e.saveJSONTemplate,a=e.patchActiveStep,s=e.saveAndPatchActiveStep,u=e.setActiveStep,c=e.setActiveStepString,d=e.writePermission,f=(0,l.useState)(),p=f[0],h=f[1],x=(0,l.useState)(),b=x[0],y=x[1];(0,l.useEffect)((function(){if(n){var e=function(e){var n=mi(e);return Object.keys(e).filter((function(e){return"action"!==e})).map((function(t){var r,o=n[t];return(0,g.Z)((0,m.Z)({},o),{name:t,type:zo,value:null!==(r=e[t])&&void 0!==r?r:o.value})})).sort((function(e,n){return(null===e||void 0===e?void 0:e.orderIndex)-(null===n||void 0===n?void 0:n.orderIndex)}))}(n),t=function(e){var n=mi(e);return Object.keys(n).filter((function(n){return"action"!==n&&!Object.keys(e).includes(n)})).map((function(t){var r,o=n[t];return(0,g.Z)((0,m.Z)({},o),{name:t,type:Ni,value:null!==(r=e[t])&&void 0!==r?r:o.value})}))}(n),r=mi({action:n.action}),o=Object.keys(r).filter((function(e){return r[e].required}));h({defined:e,optional:t}),y(o)}}),[n]);var C=function(e){d&&("until"===e.name?j("duration",e):"duration"===e.name?j("until",e):(u((0,g.Z)((0,m.Z)({},n),(0,v.Z)({},e.name,e.value))),c(JSON.stringify((0,g.Z)((0,m.Z)({},n),(0,v.Z)({},e.name,e.value)),null,2)),o((0,g.Z)((0,m.Z)({},n),(0,v.Z)({},e.name,e.value)))))},j=function(e,t){n[e];var r=(0,be.Z)(n,[e].map(ji.Z));u((0,m.Z)((0,v.Z)({},t.name,t.value),r)),c(JSON.stringify((0,m.Z)((0,v.Z)({},t.name,t.value),r),null,2)),o((0,m.Z)((0,v.Z)({},t.name,t.value),r))};return n?(0,i.jsx)(i.Fragment,{children:p&&(0,i.jsxs)(Jo.Yb,{children:[(0,i.jsxs)(Jo.uN,{children:[(0,i.jsx)(Jo.ph,{className:"header",children:n.action}),d&&(0,i.jsxs)(Jo.nx,{onClick:function(e){return function(e){r(e,t)}(e)},children:[(0,i.jsx)(Y,{}),(0,i.jsx)(Jo.dH,{children:"Remove step"})]})]}),(0,i.jsx)(pe,{}),(0,i.jsx)(Lo,{initialValues:{},onSubmit:function(e,n){var t=n.setSubmitting;setTimeout((function(){alert(JSON.stringify(e,null,2)),t(!1)}),400)},children:function(){return(0,i.jsxs)(Bo,{translate:"yes",className:"form",children:[p.defined.map((function(e,r){return(0,i.jsxs)(Jo.Fq,{children:[(0,i.jsx)(e.type,{activeStepIndex:t,component:e.component,header:e.header,docLink:e.docLink,label:e.label,name:e.name,value:e.value,options:e.options,required:e.required,writePermission:d,patchActiveStep:a,saveAndPatchActiveStep:s}),!b.includes(e.name)&&d&&(0,i.jsx)(ki.default,{className:"remove",variant:"link",onClick:function(){return function(e){var t=e.name,r=(n[t],(0,be.Z)(n,[t].map(ji.Z)));u(r),c(JSON.stringify(r,null,2)),o(r)}(e)},children:(0,i.jsx)(Si,{})})]},r)})),(0,i.jsx)(Jo.U8,{children:(0,i.jsx)("span",{children:"Unused optional fields"})}),(0,i.jsx)(Jo.k2,{children:p.optional.map((function(e,n){return(0,i.jsx)(e.type,{appendField:C,component:e.component,header:e.header,label:e.label,name:e.name,value:e.value},n)}))})]})}})]})}):null};function Zi(){var e=(0,o.Z)(["\n  width: 193px;\n  min-height: 66px;\n  padding: 8px;\n\n  display: flex;\n  align-items: center;\n  justify-content: center;\n\n  background: #ffffff;\n  border: 1px solid #e7e2e9;\n  box-sizing: border-box;\n  border-radius: 6px;\n\n  &:hover {\n    background: #f7eff7;\n    border: 1px solid #9121c2;\n    box-sizing: border-box;\n    box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);\n    border-radius: 6px;\n  }\n\n  &.activeTriggerMenu {\n    background: #f7eff7;\n    border: 1px solid #9121c2;\n    box-sizing: border-box;\n    box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);\n    border-radius: 6px;\n  }\n"]);return Zi=function(){return e},e}function Ei(){var e=(0,o.Z)(["\n  padding-left: 8px;\n\n  width: 100%;\n  display: flex;\n  flex-direction: column;\n\n  .primary-text {\n    font-family: Inter;\n    font-style: normal;\n    font-weight: bold;\n    font-size: 14px;\n    line-height: 19px;\n    text-transform: capitalize;\n    color: #334563;\n  }\n\n  .secondary-text {\n    font-family: Inter;\n    font-weight: normal;\n    font-size: 10px;\n    line-height: 14px;\n    color: #888888;\n  }\n"]);return Ei=function(){return e},e}var Ii=u.default.div(Zi()),Oi=u.default.div(Ei()),Ti=function(e){var n=e.handleOnClick,t=e.schedule,r=e.sources,o=e.className,a=null===t||void 0===t?void 0:t.filter((function(e){return e.enabled})),l=null===r||void 0===r?void 0:r.filter((function(e){return e.source}));return(0,i.jsx)(Ii,{onClick:n,className:o,children:(0,i.jsxs)(Oi,{children:[(0,i.jsx)("span",{className:"primary-text",children:"Start"}),(null===a||void 0===a?void 0:a.length)||(null===l||void 0===l?void 0:l.length)?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("span",{className:"secondary-text",children:"Trigger configured"}),a.map((function(e,n){return(0,i.jsxs)("span",{className:"secondary-text",children:["Schedule: ",e.value]},n)})),l.map((function(e,n){return(0,i.jsxs)("span",{className:"secondary-text",children:["Segment Event: ",e.source]},n)}))]}):(0,i.jsx)("span",{className:"secondary-text",children:"No trigger configured"})]})})},Ai=t(63601),Di=t.n(Ai),Li=t(31292),Mi=t(81885),Pi=t(6281),Ri=t(22388),Fi=t(98022),zi=t.n(Fi),Bi=t(75646);function Hi(){var e=(0,o.Z)(["\n  display: flex;\n  flex-direction: column;\n\n  h3 {\n    svg,\n    .infoIcon {\n      display: inline-flex;\n      height: 24px;\n      width: 24px;\n      fill: #9121c2;\n      top: 5px;\n      position: relative;\n    }\n\n    .tooltip {\n      width: 200px;\n      color: #ebecef;\n\n      .innerButtonContainer {\n        display: block;\n        height: 25px;\n        margin-top: 5px;\n        background-color: #5e6a82;\n        color: #ebecef;\n        width: fit-content;\n        padding: 3px 7px;\n        cursor: pointer;\n\n        span {\n          color: #ebecef;\n        }\n\n        svg,\n        .externalLinkIcon {\n          width: 15px;\n          fill: silver;\n          margin: -13px 0 0 5px;\n          vertical-align: middle;\n        }\n      }\n    }\n  }\n"]);return Hi=function(){return e},e}function Vi(){var e=(0,o.Z)(["\n  margin-right: 20px;\n"]);return Vi=function(){return e},e}function $i(){var e=(0,o.Z)(["\n  align-items: center;\n  padding: 10px;\n  width: 300px;\n\n  .remove {\n    margin-left: 10px;\n  }\n"]);return $i=function(){return e},e}var Ui,Wi=u.default.div(Hi()),qi=(0,u.default)(Pi.ZP)(Vi()),Ki=(0,u.default)(Li.Flex)($i()),Gi=function(e){var n=e.templateId,t=e.loading,o=e.schedule,a=e.setSchedule,l=e.writePermission,s=function(e){if(!e)return!1;try{return Di().parseExpression(e),!0}catch(n){return/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(\.\d+)?(([+-]\d\d:\d\d)|Z)?$/i.test(e)&&e>(new Date).toISOString()}},u=function(e){var n=o.findIndex((function(n){return n.itemId===e.target.id}));c(n,e.target.name,e.target.value)},c=function(e,n,t){var r=(0,N.Z)(o);r[e]=(0,g.Z)((0,m.Z)({},o[e]),(0,v.Z)({},n,t)),a(r)},d=(0,r.Z)((0,Ri.ZP)(n),2)[1],f=(0,j.t)();function p(e){return b.apply(this,arguments)}function b(){return b=(0,h.Z)((function(e){var t,r,i,a;return(0,x.__generator)(this,(function(u){switch(u.label){case 0:return l?(t=o.findIndex((function(n){return n.itemId===e.target.id})),r=o[t],i=r.value,a=r.itemId,s(i)?[4,d.saveAutomationScheduleItem({enabled:!0,itemId:a,templateId:n,value:i})]:[3,2]):[2];case 1:return u.sent(),f.scheduleItemSaved(),[3,3];case 2:f.scheduleItemInvalid(),u.label=3;case 3:return[2]}}
1))})),b.apply(this,arguments)}function y(){return(y=(0,h.Z)((function(){var e,t;return(0,x.__generator)(this,(function(r){switch(r.label){case 0:return e={enabled:!0,itemId:zi().v4(),templateId:n,value:"* * * * *"},(t=(0,N.Z)(o)).push(e),a(t),[4,d.saveAutomationScheduleItem(e)];case 1:return r.sent(),[2]}}))}))).apply(this,arguments)}function C(){return C=(0,h.Z)((function(e){var t,r;return(0,x.__generator)(this,(function(i){switch(i.label){case 0:return t=o.findIndex((function(n){return n.itemId===e})),r=(0,N.Z)(o.slice(0,t)).concat((0,N.Z)(o.slice(t+1))),a(r),[4,d.deleteAutomationScheduleItem(n,e)];case 1:return i.sent(),[2]}}))})),C.apply(this,arguments)}return(0,i.jsxs)(Wi,{children:[(0,i.jsxs)(D.Header,{type:"h3",children:["Add a Cron Job Schedule to Trigger this Automation","     ",(0,i.jsx)(Bi.default,{className:"tooltip",content:(0,i.jsxs)(i.Fragment,{children:["A schedule is described using unix-cron string format indicating when the job should be executed.",(0,i.jsx)("div",{className:"innerButtonContainer",children:(0,i.jsxs)("a",{href:"https://www.npmjs.com/package/cron-parser",target:"_blank",rel:"noopener noreferrer",children:[(0,i.jsx)("span",{children:"Learn More"}),(0,i.jsx)(M.default.ExternalLink,{className:"externalLinkIcon"})]})})]}),interactive:!0,placement:"bottom",children:(0,i.jsx)("span",{children:(0,i.jsx)(M.default.Info,{className:"infoIcon"})})})]}),t?(0,i.jsx)(i.Fragment,{children:"Loading..."}):(0,i.jsxs)(i.Fragment,{children:[null===o||void 0===o?void 0:o.map((function(e){return(0,i.jsxs)(Ki,{flexDirection:"row",children:[(0,i.jsx)(qi,{readOnly:!l,id:e.itemId,label:"Cron Value",name:"value",onChange:u,onBlur:p,placeholder:"cron or ISO Date string",value:e.value}),(0,i.jsx)(D.Button,{buttonType:"link",onClick:function(){return function(e){return C.apply(this,arguments)}(e.itemId)},tooltip:"Remove",children:(0,i.jsx)(Si,{})})]},e.itemId)})),(0,i.jsxs)(Mi.iT,{disabled:!l,onClick:function(){return y.apply(this,arguments)},children:[(0,i.jsx)(wi,{}),(0,i.jsx)(Jo.gH,{children:"Scheduled Trigger"})]})]})]})};!function(e){e.IDENTIFY="identify",e.GROUP="group",e.TRACK="track"}(Ui||(Ui={}));var Ji=t(44980),Xi=t(95797),Yi=t(64685);function Qi(){var e=(0,o.Z)(["\n  display: flex;\n  flex-direction: column;\n  max-height: 380px;\n  overflow: hidden;\n\n  h3 {\n    svg,\n    .infoIcon {\n      display: inline-flex;\n      height: 24px;\n      width: 24px;\n      fill: #9121c2;\n      top: 5px;\n      position: relative;\n    }\n\n    .tooltip {\n      width: 200px;\n      color: #ebecef;\n\n      .innerButtonContainer {\n        display: block;\n        height: 25px;\n        margin-top: 5px;\n        background-color: #5e6a82;\n        color: #ebecef;\n        width: fit-content;\n        padding: 3px 7px;\n        cursor: pointer;\n\n        span {\n          color: #ebecef;\n        }\n\n        svg,\n        .externalLinkIcon {\n          width: 15px;\n          fill: silver;\n          margin: -13px 0 0 5px;\n          vertical-align: middle;\n        }\n      }\n    }\n  }\n"]);return Qi=function(){return e},e}function ea(){var e=(0,o.Z)(["\n  display: flex;\n"]);return ea=function(){return e},e}function na(){var e=(0,o.Z)(["\n  overflow: auto;\n  white-space: break-spaces;\n"]);return na=function(){return e},e}function ta(){var e=(0,o.Z)(["\n  border: none;\n  z-index: 1;\n  width: 37px;\n  left: 30px;\n  color: gray;\n  padding: 0;\n  position: absolute;\n"]);return ta=function(){return e},e}function ra(){var e=(0,o.Z)(["\n  margin-right: 20px;\n"]);return ra=function(){return e},e}function oa(){var e=(0,o.Z)(["\n  align-items: center;\n  padding: 10px;\n  width: 300px;\n  position: relative;\n\n  .remove {\n    margin-left: 10px;\n  }\n\n  .trackPrefixIncluded input {\n    padding-left: 50px;\n  }\n"]);return oa=function(){return e},e}var ia=u.default.div(Qi()),aa=u.default.div(ea()),la=u.default.div(na()),sa=(0,u.default)(Pi.ZP)(ta()),ua=(0,u.default)(Pi.ZP)(ra()),ca=(0,u.default)(Li.Flex)(oa()),da="track/",fa=function(e){var n,t,o,a=e.templateId,s=e.loading,u=e.sources,c=e.setSources,d=e.writePermission,f=function(e){return e&&1===u.filter((function(n){return n.source===e})).length},p=function(e){var n=parseInt(e.target.id);null===k&&(_(u[n].source),I(n)),b(n,"source",e.target.value)},b=function(e,n,t){var r=(0,N.Z)(u),o=t?da+t:t;r[e]=(0,g.Z)((0,m.Z)({},u[e]),(0,v.Z)({},n,o)),c(r)},y=function(e){return![Ui.IDENTIFY,Ui.GROUP].includes(e)},C=(0,r.Z)((0,Ji.ZP)(a),2)[1],w=(0,Yi.nt)().selectedEnvironmentId,S=(0,l.useState)(null),k=S[0],_=S[1],Z=(0,l.useState)(-1),E=Z[0],I=Z[1],O=(0,l.useState)(!1),T=O[0],A=O[1],L=(0,l.useState)(!1),P=L[0],R=L[1],F=(0,Xi.sm)(),z=null===F||void 0===F?void 0:F.loading,B=null===F||void 0===F||null===(n=F.data)||void 0===n||null===(t=n.segment)||void 0===t||null===(o=t.nodes)||void 0===o?void 0:o.map((function(e){return e.eventId.replace(da,"")}));(0,l.useEffect)((function(){F.refetch()}),[w]),(0,l.useEffect)((function(){A(0!==u.filter((function(e){return e.source===Ui.IDENTIFY})).length),R(0!==u.filter((function(e){return e.source===Ui.GROUP})).length)}),[u]);var H=(0,j.t)();function V(e){return $.apply(this,arguments)}function $(){return $=(0,h.Z)((function(e){var n,t,r;return(0,x.__generator)(this,(function(o){switch(o.label){case 0:return d?(n=parseInt(e.target.id),t=u[n].source,null!==k&&t!==k&&f(t)?[4,C.saveAutomationSource(a,t,k)]:[3,2]):[2];case 1:return o.sent(),[3,3];case 2:null!==k&&t!==k&&(H.segmentEventInvalid(),r=k.replace(new RegExp("\\b^track/\\b"),""),b(n,"source",r)),o.label=3;case 3:return _(null),I(-1),[2]}}))})),$.apply(this,arguments)}function U(){return(U=(0,h.Z)((function(){var e,n;return(0,x.__generator)(this,(function(t){switch(t.label){case 0:return e={source:Ui.IDENTIFY,type:"automation-source"},n=(0,N.Z)(u).concat([e]),c(n),[4,C.saveAutomationSource(a,Ui.IDENTIFY,k)];case 1:return t.sent(),[2]}}))}))).apply(this,arguments)}function W(){return(W=(0,h.Z)((function(){var e,n;return(0,x.__generator)(this,(function(t){switch(t.label){case 0:return e={source:Ui.GROUP,type:"automation-source"},n=(0,N.Z)(u).concat([e]),c(n),[4,C.saveAutomationSource(a,Ui.GROUP,k)];case 1:return t.sent(),[2]}}))}))).apply(this,arguments)}function q(){return(q=(0,h.Z)((function(){var e,n;return(0,x.__generator)(this,(function(t){return e={source:"",type:"automation-source"},(n=(0,N.Z)(u)).push(e),c(n),[2]}))}
1))).apply(this,arguments)}function K(){return(K=(0,h.Z)((function(e){var n;return(0,x.__generator)(this,(function(t){switch(t.label){case 0:return E===e&&f(k)?[4,C.deleteAutomationSource(a,k)]:[3,2];case 1:return t.sent(),[3,4];case 2:return E!==e&&f(u[e].source)?[4,C.deleteAutomationSource(a,u[e].source)]:[3,4];case 3:t.sent(),t.label=4;case 4:return n=(0,N.Z)(u.slice(0,e)).concat((0,N.Z)(u.slice(e+1))),c(n),[2]}}))}))).apply(this,arguments)}return z?null:(0,i.jsxs)(ia,{children:[(0,i.jsxs)(D.Header,{type:"h3",children:["Add a Segment Event to Trigger this Automation ","     ",(0,i.jsx)(D.Tooltip,{className:"tooltip",content:(0,i.jsxs)(i.Fragment,{children:["Integrating with Segment provides a no-code way to send through Courier.",(0,i.jsx)("div",{className:"innerButtonContainer",children:(0,i.jsxs)("a",{href:"https://www.courier.com/docs/guides/tutorials/how-to-send-notifications-with-segment",target:"_blank",rel:"noopener noreferrer",children:[(0,i.jsx)("span",{children:"Get Started"}),(0,i.jsx)(M.default.ExternalLink,{className:"externalLinkIcon"})]})})]}),interactive:!0,placement:"bottom",children:(0,i.jsx)("span",{children:(0,i.jsx)(M.default.Info,{className:"infoIcon"})})})]}),s?(0,i.jsx)(i.Fragment,{children:"Loading..."}):(0,i.jsx)(la,{children:null===u||void 0===u?void 0:u.filter((function(e){return!e.source.startsWith("audiences")})).map((function(e,n){var t,r=y(e.source);return(0,i.jsxs)(ca,{flexDirection:"row",children:[r?(0,i.jsx)(sa,{readOnly:!0,id:n.toString()+"_trackEventPrefix",value:da,style:{color:"gray",padding:"0"}}):"",(0,i.jsx)(ua,{autoComplete:"on",list:"automation-source-list",completions:B,disabled:!r,readOnly:!d,id:n.toString(),label:"Segment Event",name:"value",onChange:p,onBlur:V,placeholder:"Segment Event",value:(t=e.source,y(t)?t.replace(new RegExp("\\b^track/\\b"),""):t),className:r?"trackPrefixIncluded":""}),(0,i.jsx)(D.Button,{buttonType:"link",onClick:function(){return function(e){return K.apply(this,arguments)}(n)},tooltip:"Remove",children:(0,i.jsx)(Si,{})})]},n)}))}),(0,i.jsxs)(aa,{children:[(0,i.jsxs)(Mi.iT,{disabled:!d||T,onClick:function(){return U.apply(this,arguments)},children:[(0,i.jsx)(wi,{}),(0,i.jsx)(Jo.gH,{children:(0,D.capitalize)(Ui.IDENTIFY)})]}),(0,i.jsxs)(Mi.iT,{disabled:!d||P,onClick:function(){return W.apply(this,arguments)},children:[(0,i.jsx)(wi,{}),(0,i.jsx)(Jo.gH,{children:(0,D.capitalize)(Ui.GROUP)})]}),(0,i.jsxs)(Mi.iT,{disabled:!d,onClick:function(){return q.apply(this,arguments)},children:[(0,i.jsx)(wi,{}),(0,i.jsx)(Jo.gH,{children:(0,D.capitalize)(Ui.TRACK)})]})]})]})};function pa(){var e=(0,o.Z)(["\n  display: flex;\n  flex-direction: column;\n  max-height: 380px;\n  overflow: hidden;\n\n  h3 {\n    svg,\n    .infoIcon {\n      display: inline-flex;\n      height: 24px;\n      width: 24px;\n      fill: #9121c2;\n      top: 5px;\n      position: relative;\n    }\n\n    .tooltip {\n      width: 200px;\n      color: #ebecef;\n\n      .innerButtonContainer {\n        display: block;\n        height: 25px;\n        margin-top: 5px;\n        background-color: #5e6a82;\n        color: #ebecef;\n        width: fit-content;\n        padding: 3px 7px;\n        cursor: pointer;\n\n        span {\n          color: #ebecef;\n        }\n\n        svg,\n        .externalLinkIcon {\n          width: 15px;\n          fill: silver;\n          margin: -13px 0 0 5px;\n          vertical-align: middle;\n        }\n      }\n    }\n  }\n"]);return pa=function(){return e},e}function ha(){var e=(0,o.Z)(["\n  display: flex;\n"]);return ha=function(){return e},e}function va(){var e=(0,o.Z)(["\n  border: none;\n  z-index: 1;\n  left: 30px;\n  color: gray;\n  padding: 0;\n  position: absolute;\n"]);return va=function(){return e},e}function ma(){var e=(0,o.Z)(["\n  align-items: center;\n  padding: 10px;\n  width: 300px;\n  position: relative;\n\n  .remove {\n    margin-left: 10px;\n  }\n\n  .trackPrefixIncluded input {\n    padding-left: 124px;\n  }\n"]);return ma=function(){return e},e}var ga="audiences:user:matched",xa="audiences:user:unmatched",ba=u.default.div(pa()),ya=u.default.div(ha()),Ca=(0,u.default)(Pi.ZP)(va()),ja=(0,u.default)(Li.Flex)(ma()),wa=function(e){var n=e.loading,t=e.setSources,o=e.sources,a=e.templateId,s=e.writePermission,u=(0,r.Z)((0,Ji.ZP)(a),2)[1],c=(0,l.useState)(null)[0],d=(0,l.useState)(!1),f=d[0],p=d[1],v=(0,l.useState)(!1),m=v[0],g=v[1];function b(e){return y.apply(this,arguments)}function y(){return(y=(0,h.Z)((function(e){var n,r;return(0,x.__generator)(this,(function(i){return n={source:e,type:"automation-source"},r=(0,N.Z)(o).concat([n]),t(r),[2]}))}
1))).apply(this,arguments)}function C(){return C=(0,h.Z)((function(e){var n,r,i,a,l=arguments;return(0,x.__generator)(this,(function(s){return n=l.length>1&&void 0!==l[1]?l[1]:"*",r=l.length>2?l[2]:void 0,i={source:"".concat(e,"/").concat(n),type:"automation-source"},a=(0,N.Z)(o.slice(0,r)).concat([i],(0,N.Z)(o.slice(r+1))),t(a),[2]}))})),C.apply(this,arguments)}function j(){return(j=(0,h.Z)((function(e){var n;return(0,x.__generator)(this,(function(r){switch(r.label){case 0:return[4,u.deleteAutomationSource(a,o[e].source)];case 1:return r.sent(),n=(0,N.Z)(o.slice(0,e)).concat((0,N.Z)(o.slice(e+1))),t(n),[2]}}))}))).apply(this,arguments)}return(0,l.useEffect)((function(){p(0!==o.filter((function(e){return e.source===ga})).length),g(0!==o.filter((function(e){return e.source===xa})).length)}),[o]),(0,i.jsxs)(ba,{children:[(0,i.jsxs)(D.Header,{type:"h3",children:["Audience Events to Trigger this Automation","     ",(0,i.jsx)(D.Tooltip,{className:"tooltip",content:(0,i.jsxs)(i.Fragment,{children:["No code way to trigger automation when a users are matched or unmatched from an audience.",(0,i.jsx)("div",{className:"innerButtonContainer",children:(0,i.jsxs)("a",{href:"https://www.courier.com/docs/reference/audiences/",target:"_blank",rel:"noopener noreferrer",children:[(0,i.jsx)("span",{children:"Get Started"}),(0,i.jsx)(D.svgs.ExternalLink,{className:"externalLinkIcon"})]})})]}),interactive:!0,placement:"bottom",children:(0,i.jsx)("span",{children:(0,i.jsx)(D.svgs.Info,{className:"infoIcon"})})})]}),n?(0,i.jsx)(i.Fragment,{children:"Loading..."}):(0,i.jsx)(la,{children:null===o||void 0===o?void 0:o.filter((function(e){return e.source.startsWith("audiences")})).map((function(e,n){var t=(0,r.Z)(e.source.split("/"),2),l=t[0],d=t[1],f=void 0===d?"*":d;return(0,i.jsxs)(ja,{flexDirection:"row",children:[(0,i.jsx)(Ca,{style:{color:"gray",padding:"0",maxWidth:"audiences:user:matched"===l?"98px":"114px"},readOnly:!0,id:n.toString()+"_trackEventPrefix",value:"".concat(l.replace("audiences:",""),"/")}),(0,i.jsx)(ua,{list:"automation-source-list",disabled:!s,readOnly:!s,id:n.toString(),onChange:function(e){var t=e.target.value;!function(e){C.apply(this,arguments)}(l,t,n)},onBlur:(0,h.Z)((function(){var e,t;return(0,x.__generator)(this,(function(i){switch(i.label){case 0:return e=(0,r.Z)(o[n].source.split("/"),2),(t=e[1])||"*"===t?[4,u.saveAutomationSource(a,o[n].source,c)]:[3,2];case 1:i.sent(),i.label=2;case 2:return[2]}}
1))})),label:"<audienceTrigger>/<audienceId>",placeholder:"user:matched/<audienceId>",name:"value",value:f,style:{paddingLeft:"audiences:user:matched"===l?"110px":"124px"}}),(0,i.jsx)(D.Button,{buttonType:"link",onClick:function(){return function(e){return j.apply(this,arguments)}(n)},tooltip:"Remove",children:(0,i.jsx)(Si,{})})]},n)}))}),(0,i.jsxs)(ya,{children:[(0,i.jsxs)(Mi.iT,{disabled:!s||f,onClick:function(){return b(ga)},children:[(0,i.jsx)(wi,{}),(0,i.jsx)(Jo.gH,{children:(0,D.capitalize)("match")})]}),(0,i.jsxs)(Mi.iT,{disabled:!s||m,onClick:function(){return b(xa)},children:[(0,i.jsx)(wi,{}),(0,i.jsx)(Jo.gH,{children:(0,D.capitalize)("unmatch")})]})]})]})};function Na(){var e=(0,o.Z)(["\n  width: 532px;\n  height: 497px;\n  max-height: 497px;\n  padding-left: 25px;\n  padding-right: 25px;\n  overflow: auto;\n  white-space: break-spaces;\n\n  background: #ffffff;\n  border: 1px solid #e7e2e9;\n  box-sizing: border-box;\n  border-radius: 6px;\n\n  .header {\n    display: flex;\n    flex-direction: column;\n    align-items: center;\n    margin-top: 20px;\n    margin-bottom: 20px;\n  }\n\n  .header-text {\n    align-self: flex-start;\n    padding-bottom: 10px;\n\n    font-family: Inter;\n    font-style: normal;\n    font-weight: bold;\n    font-size: 20px;\n    line-height: 27px;\n    letter-spacing: -0.02em;\n\n    color: #e7e2e9;\n  }\n\n  .steps-container {\n    display: flex;\n    align-items: center;\n    justify-content: space-between;\n    flex-wrap: wrap;\n  }\n"]);return Na=function(){return e},e}var Sa=u.default.div(Na()),ka=function(e){var n=e.templateId,t=e.loading,r=e.schedule,o=e.setSchedule,a=e.sources,l=e.setSources,s=e.writePermission,u=(0,z.ye)("audience-subscription-automation-trigger");return(0,i.jsxs)(Sa,{children:[(0,i.jsxs)("div",{className:"header",children:[(0,i.jsx)("span",{className:"header-text",children:"Start"}),(0,i.jsx)(pe,{})]}),(0,i.jsx)("div",{className:"steps-container",children:(0,i.jsxs)(P.VY,{children:[(0,i.jsx)(Gi,{templateId:n,loading:t,schedule:r,setSchedule:o,writePermission:s}),(0,i.jsx)(fa,{templateId:n,loading:t,sources:a,setSources:l,writePermission:s}),u&&(0,i.jsx)(wa,{templateId:n,loading:t,sources:a,setSources:l,writePermission:s})]})})]})},_a=t(84778),Za=new(t.n(_a)()),Ea=function(e){var n=e.additionalProperties,t=e.strict?1:0,r={type:"object",properties:{$ref:{type:"string"}},additionalProperties:n,required:["$ref"]},o=function(e){return{anyOf:[e,r]}},i={type:"object",properties:{body:{type:"object"},headers:{type:"object"},params:{type:"object"},method:o({enum:["GET","get","POST","post"]}),url:o({type:"string",minLength:t})},additionalProperties:n,required:["url"]},a={type:"object",properties:{action:{enum:["send"]},template:o({type:"string",minLength:t}),recipient:o({type:"string",minLength:t}),profile:{type:"object"},message:{type:"object",properties:{to:{type:"object"},content:{type:"object"},template:{type:"string"}},required:["to"],oneOf:[{required:["template"]},{required:["content"]}]},brand:o({type:"string"}),idempotency_expiry:o({type:"string"}),idempotency_key:o({type:"string"}),data:{type:"object"},override:{type:"object"},if:o({type:"string"}),ref:o({type:"string"})},additionalProperties:n,required:["action"]},l={type:"object",properties:{action:{enum:["send-list"]},template:o({type:"string",minLength:t}),list:o({type:"string",minLength:t}),brand:o({type:"string"}),idempotency_expiry:o({type:"string"}),idempotency_key:o({type:"string"}),data:{type:"object"},override:{type:"object"},if:o({type:"string"}),ref:o({type:"string"}),skip_condition:o({type:"string"}),data_source:o({type:"object",properties:{webhook:o(i),merge_strategy:o({enum:["replace","overwrite","soft-merge","none"]})},additionalProperties:n,required:["webhook","merge_strategy"]})},additionalProperties:n,required:["action","template","list"]},s={anyOf:["duration","until","delayFor","delayUntil"].map((function(e){var r;return{type:"object",properties:(r={action:{enum:["delay"]}},(0,v.Z)(r,e,o({type:"string",minLength:t})),(0,v.Z)(r,"if",o({type:"string"})),(0,v.Z)(r,"ref",o({type:"string"})),r),additionalProperties:n,required:["action",e]}}))},u={type:"object",properties:{action:{enum:["invoke"]},context:o({type:"object",properties:{brand:o({type:"string"}),data:{type:"object"},profile:{type:"object"},template:o({type:"string"}),recipient:o({type:"string"})},additionalProperties:n}),if:o({type:"string"}),ref:o({type:"string"}),template:o({type:"string",minLength:t})},additionalProperties:n,required:["action","template"]},c={anyOf:["cancelation_token","cancelationToken"].map((function(e){var r;return{type:"object",additionalProperties:n,properties:(r={action:{enum:["cancel"]}},(0,v.Z)(r,e,o({type:"string",minLength:t})),(0,v.Z)(r,"if",o({type:"string"})),(0,v.Z)(r,"ref",o({type:"string"})),r),required:["action",e]}}))},d={type:"object",properties:{action:{enum:["fetch-data"]},webhook:o(i),merge_strategy:o({enum:["replace","overwrite","soft-merge","none"]}),idempotency_expiry:o({type:"string"}),idempotency_key:o({type:"string"}),if:o({type:"string"}),ref:o({type:"string"})},additionalProperties:n,required:["action","webhook","merge_strategy"]},f={type:"object",properties:{action:{enum:["update-profile"]},merge:o({enum:["replace","overwrite","soft-merge","none"]}),recipient_id:o({type:"string"}),profile:{type:"object"},if:o({type:"string"}),ref:o({type:"string"})},additionalProperties:n,required:["action","merge","recipient_id","profile"]},p={type:"object",properties:{notification:{type:"object"},categories:{type:"object"}},additionalProperties:n,required:["notification"]},h={type:"object",properties:{action:{enum:["subscribe"]},list_id:o({type:"string",minLength:1}),recipient_id:o({type:"string",minLength:1}),subscription:o({type:"object",properties:{preferences:o(p)},additionalProperties:n,required:["preferences"]}),if:o({type:"string"}),ref:o({type:"string"})},additionalProperties:n,required:["action","list_id","recipient_id"]},m={type:"array",minItems:0,additionalProperties:n,items:{anyOf:[a,l,s,u,c,d,f,h]}};return{send:Za.compile(a),"send-list":Za.compile(l),delay:Za.compile(s),invoke:Za.compile(u),cancel:Za.compile(c),"fetch-data":Za.compile(d),"update-profile":Za.compile(f),subscribe:Za.compile(h),validateAllSteps:Za.compile(m)}},Ia=function(e){var n=e.automationTemplate,t=e.name,o=e.setName,a=e.setEditorType,s=e.templateSources,u=e.writePermission,c=(0,w.O)(n.templateId),d=(0,j.t)(),f=O(n.templateId),p=(0,T.s)(n.templateId),b=(0,A.M)(n.templateId),N=(0,l.useState)(!1),S=N[0],k=N[1],_=(0,l.useState)(0),Z=_[0],E=_[1],I=(0,l.useState)(),M=I[0],R=I[1],F=(0,l.useState)(),z=F[0],H=F[1],V=(0,l.useState)({}),$=V[0],U=V[1],W=(0,l.useState)(""),q=W[0],K=W[1],J=(0,l.useState)(!1),X=J[0],Y=J[1],ee=(0,l.useState)(!0),ne=ee[0],te=ee[1],re=(0,r.Z)((0,Ri.ZP)(n.templateId),1)[0],oe=re.loading,ie=re.data,ae=(0,l.useState)([]),ce=ae[0],de=ae[1],fe=(0,l.useState)([]),pe=fe[0],he=fe[1],ve=(0,l.useState)(!1),me=ve[0],ge=ve[1],xe=(0,l.useState)(!1),be=xe[0],ye=xe[1],Ce=(0,l.useState)(n.alias),je=Ce[0],we=Ce[1],Ne=(0,l.useState)(!1),Se=Ne[0],ke=Ne[1],_e=(0,l.useState)((0,Q.V6)(n.cancelationToken)),Ze=_e[0],Ee=_e[1],Ie=(0,l.useState)(0),Oe=Ie[0],Te=Ie[1],Ae=(0,l.useState)(!1),De=Ae[0],Le=Ae[1],Me=function(){var e=(0,h.Z)((function(){return(0,x.__generator)(this,(function(e){switch(e.label){case 0:return[4,Ke(Oe)];case 1:return e.sent(),Le(!1),[2]}}))}));return function(){return e.apply(this,arguments)}}();(0,l.useEffect)((function(){var e,t,r;Pe((0,m.Z)({cancelation_token:Ze},n.json));var o=(null===n||void 0===n||null===(e=n.json)||void 0===e?void 0:e.steps.length)?null===n||void 0===n||null===(t=n.json)||void 0===t?void 0:t.steps[0]:null;o||ye(!0),H(o),R(ue(o)),U((0,m.Z)({},null===n||void 0===n||null===(r=n.json)||void 0===r?void 0:r.steps)),s&&he(s)}),[]),(0,l.useEffect)((function(){var e,n;oe||de(null!==(n=null===ie||void 0===ie||null===(e=ie.automationSchedule)||void 0===e?void 0:e.nodes)&&void 0!==n?n:[])}),[oe]);var Pe=function(e){var n=e.cancelation_token,t=e.steps;if(null===n)K(JSON.stringify({steps:t},null,2));else{var r={cancelation_token:(0,Q.u7)(n),steps:t};K(JSON.stringify(r,null,2))}},Re=function(){var e=(0,h.Z)((function(){var e,t,o;return(0,x.__generator)(this,(function(i){switch(i.label){case 0:return ne?X?[3,2]:(e=JSON.parse(M),t=(0,g.Z)((0,m.Z)({},$),(0,v.Z)({},Z,e)),U(t),o=Object.entries(t).map((function(e){return(0,r.Z)(e,2)[1]})),Pe({cancelation_token:Ze,steps:o}),[4,c((0,g.Z)((0,m.Z)({},n),{json:{steps:o}}))]):(d.invalidStepDefinition(),[2]);case 1:i.sent(),i.label=2;case 2:return X?[4,c((0,g.Z)((0,m.Z)({},n),{json:{steps:JSON.parse(q).steps}}))]:[3,5];case 3:return i.sent(),[4,b((0,Q.u7)(Ze))];case 4:i.sent(),i.label=5;case 5:return[2]}}
1))}));return function(){return e.apply(this,arguments)}}(),Fe=function(){var e=(0,h.Z)((function(e){var t,o;return(0,x.__generator)(this,(function(i){switch(i.label){case 0:return k(!1),t=(0,g.Z)((0,m.Z)({},$),(0,v.Z)({},Z,e)),o=Object.entries(t).map((function(e){return(0,r.Z)(e,2)[1]})),Pe({cancelation_token:Ze,steps:o}),U(t),[4,c((0,g.Z)((0,m.Z)({},n),{json:{steps:o}}))];case 1:return i.sent(),[2]}}))}));return function(n){return e.apply(this,arguments)}}(),ze=function(e){k(!1),H((0,m.Z)({},z,e)),R(JSON.stringify((0,m.Z)({},z,e)));var n=(0,g.Z)((0,m.Z)({},$),(0,v.Z)({},Z,(0,m.Z)({},z,e)));U(n);var t=Object.entries(n).map((function(e){return(0,r.Z)(e,2)[1]}));Pe({cancelation_token:Ze,steps:t})},Be=function(){var e=(0,h.Z)((function(e){var t,o;return(0,x.__generator)(this,(function(i){switch(i.label){case 0:return k(!1),ze(e),t=(0,g.Z)((0,m.Z)({},$),(0,v.Z)({},Z,(0,m.Z)({},z,e))),o=Object.entries(t).map((function(e){return(0,r.Z)(e,2)[1]})),[4,c((0,g.Z)((0,m.Z)({},n),{json:{steps:o}}))];case 1:return i.sent(),[2]}}))}));return function(n){return e.apply(this,arguments)}}(),He=function(){var e=(0,h.Z)((function(e,n){var t;return(0,x.__generator)(this,(function(r){ye(!1),ge(!1),E(e),H(n);try{t=e===Z?M:ue(n),R(t),te(!0)}catch(Se){te(!1)}return[2]}))}));return function(n,t){return e.apply(this,arguments)}}(),Ve=function(e){var n=function(e){if(!e)return!1;try{return JSON.parse(e),!0}catch(Se){return!1}}(e);if(!n)return!1;var t=JSON.parse(e);return!!Ea({additionalProperties:!1,strict:!1}).validateAllSteps(t.steps)},$e=function(){var e=(0,h.Z)((function(){return(0,x.__generator)(this,(function(e){switch(e.label){case 0:if(!u||n.alias===je)return[2];e.label=1;case 1:return e.trys.push([1,3,,4]),[4,f(je)];case 2:return e.sent(),[3,4];case 3:return e.sent(),[2,ke(!0)];case 4:return[2]}}
1))}));return function(){return e.apply(this,arguments)}}(),Ue=function(){var e=(0,h.Z)((function(){return(0,x.__generator)(this,(function(e){return u?[2,b((0,Q.u7)(Ze))]:[2]}))}));return function(){return e.apply(this,arguments)}}(),We=function(){var e=(0,h.Z)((function(){return(0,x.__generator)(this,(function(e){switch(e.label){case 0:return u?[4,p(t)]:[3,2];case 1:e.sent(),e.label=2;case 2:return[2]}}))}));return function(){return e.apply(this,arguments)}}(),qe=function(e,n){e.stopPropagation(),Te(n),Le(!0)},Ke=function(){var e=(0,h.Z)((function(e){var t,o,i,a,l,s;return(0,x.__generator)(this,(function(u){switch(u.label){case 0:return t=Object.entries($).filter((function(n){return(0,r.Z)(n,1)[0]!=e})).reduce((function(e,n,t){var o=(0,r.Z)(n,2)[1];return(0,m.Z)((0,v.Z)({},t,o),e)}),{}),U(t),o=Object.entries(t).map((function(e){return(0,r.Z)(e,2)[1]})),o.length||me||ye(!0),Pe({cancelation_token:Ze,steps:o}),i=Object.keys($).length-1,E(a=Z>e||Z===i?Z-1:Z),l=t[a],H(l),s=JSON.stringify(l,null,2),R(s),k(!1),[4,c((0,g.Z)((0,m.Z)({},n),{json:{steps:o}}))];case 1:return u.sent(),[2]}}))}));return function(n){return e.apply(this,arguments)}}(),Ge=function(){var e=(0,h.Z)((function(e){var t,o;return(0,x.__generator)(this,(function(i){switch(i.label){case 0:return t=(0,g.Z)((0,m.Z)({},$),(0,v.Z)({},Object.entries($).length,e)),U(t),o=Object.entries(t).map((function(e){return(0,r.Z)(e,2)[1]})),Pe({cancelation_token:Ze,steps:o}),E(Object.entries($).length),k(!1),[4,c((0,g.Z)((0,m.Z)({},n),{json:{steps:o}}))];case 1:return i.sent(),[2]}}))}));return function(n){return e.apply(this,arguments)}}(),Je=function(){var e=(0,h.Z)((function(e){var t,o,i,a,l;return(0,x.__generator)(this,(function(s){switch(s.label){case 0:return e.destination?(t=Object.entries($).map((function(e){return(0,r.Z)(e,2)[1]})),o=function(e,n,t){var o=Array.from(e),i=(0,r.Z)(o.splice(n,1),1)[0];return o.splice(t,0,i),o}(t,e.source.index,e.destination.index),i=(0,m.Z)({},o),U(i),E(e.destination.index),a=i[e.destination.index],H(a),l=JSON.stringify(a,null,2),R(l),Pe({cancelation_token:Ze,steps:o}),[4,c((0,g.Z)((0,m.Z)({},n),{json:{steps:o}}))]):[2];case 1:return s.sent(),[2]}}))}));return function(n){return e.apply(this,arguments)}}();return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(P.Zd,{children:[(0,i.jsxs)("div",{className:"header",children:[(0,i.jsx)("div",{className:"title",children:"Details"}),(0,i.jsxs)("span",{className:"hero",children:["You can define a list of automation steps by configuring the template below. To learn more about how automations work in Courier and see examples,"," ",(0,i.jsx)("a",{target:"_blank",rel:"noopener noreferrer",href:"https://help.courier.com/en/collections/2899240-automations",children:"click here"}),"."]})]}),(0,i.jsx)(P.vr,{readOnly:!0,label:"Template ID",value:n.templateId}),(0,i.jsx)(P.Rj,{readOnly:!u,label:"Template Name",placeholder:"Untitled Automation",onChange:function(e){o(e.target.value)},onBlur:We,value:t}),(0,i.jsx)(P.h8,{readOnly:!u,label:"Alias",placeholder:"Untitled Automation",onChange:function(e){ke(!1),we(e.target.value)},onBlur:$e,value:je,className:y()({error:Se})}),(0,i.jsx)(P.W5,{readOnly:!u,label:"Cancelation Token",placeholder:"Optional",onChange:function(e){if(Ee(e.target.value),ne){var n=JSON.parse(q);Pe({cancelation_token:e.target.value,steps:n.steps})}},onBlur:Ue,value:null!==Ze&&void 0!==Ze?Ze:""})]}),(0,i.jsxs)(P.y0,{children:[(0,i.jsx)(G,{active:X,disabled:S,onChange:function(){if(X)try{var e=JSON.parse(q);if(U((0,m.Z)({},e.steps)),e.steps.length)if(e.steps.length<=Z){E(e.steps.length-1);var n=e.steps[e.steps.length-1];H(n),R(JSON.stringify(n,null,2))}else{var t=e.steps[Z];H(t),R(JSON.stringify(t,null,2))}else ye(!0),ge(!1),E(void 0),H(void 0),R(void 0)}catch(Se){te(!1)}Y(!X)}}),(0,i.jsxs)("div",{className:"content",children:[X&&(0,i.jsx)("div",{className:"template-editor",onBlur:Re,children:(0,i.jsx)(D.SyntaxHighlighter,{className:"codemirror-editor",renderHeader:function(){return B("Invalid Step Definition",ne,n,"JSON",a,u)},value:q,onChange:function(e){return function(e){var n=Ve(e);if(n){k(!1);var t=JSON.parse(e);Ee((0,Q.V6)(t.cancelation_token))}else k(!0);K(e),te(n)}(e)},options:{mode:"application/json",readOnly:!u}})}),!X&&(0,i.jsxs)("div",{className:"step-editor",children:[(0,i.jsxs)("div",{className:"visual-step-editor",children:[(0,i.jsx)(Ti,{handleOnClick:function(){ge(!0),ye(!1)},className:y()({activeTriggerMenu:me}),schedule:ce,sources:pe}),(0,i.jsx)(se.Z,{}),(0,i.jsx)(C.DragDropContext,{onDragEnd:Je,children:(0,i.jsx)(C.Droppable,{droppableId:"droppable",children:function(e){return(0,i.jsxs)("div",(0,g.Z)((0,m.Z)({},e.droppableProps),{ref:e.innerRef,children:[(0,i.jsx)(le,{activeStepIndex:Z,showStepForm:!me&&!be,handleStepOnClick:He,handleStepOnDelete:qe,stepMap:$,writePermission:u}),e.placeholder]}))}})}),(0,i.jsx)("button",{className:y()("new-step-block",{activeStepMenu:be}),disabled:!u,onClick:function(){return ye(!0),void ge(!1)},children:(0,i.jsx)("span",{children:"New Step"})}),(0,i.jsx)(se.Z,{}),(0,i.jsx)(P.Vo,{children:(0,i.jsx)("span",{children:"End"})})]}),me&&(0,i.jsx)(ka,{templateId:n.templateId,loading:oe,schedule:ce,setSchedule:de,sources:pe,setSources:he,writePermission:u}),be&&(0,i.jsx)(Ci,{setActiveStep:H,setActiveStepString:R,setShowStepMenu:ye,appendStep:Ge}),!be&&!me&&(0,i.jsx)(_i,{activeStep:z,activeStepIndex:Z,setActiveStep:H,setActiveStepString:R,handleStepOnDelete:qe,saveJSONTemplate:Fe,patchActiveStep:ze,saveAndPatchActiveStep:Be,writePermission:u})]})]})]}),(0,i.jsx)(L.Z,{isOpen:De,onConfirm:Me,onClose:function(){return Le(!1)},header:"Are you sure you want to delete this step?"})]})},Oa=function(e){if(!e)return!1;var n=e.toLowerCase().match(/("?)steps("?):\s?\[[^]*?\]/g);return Boolean(n)},Ta=function(e){var n=e.automationTemplate,t=e.name,r=e.setName,o=e.writePermission,a=(0,w.O)(n.templateId),s=(0,j.t)(),u=O(n.templateId),c=(0,T.s)(n.templateId),d=(0,l.useState)(n.alias),f=d[0],p=d[1],v=(0,l.useState)(!1),b=v[0],C=v[1],N=(0,l.useState)(""),S=N[0],k=N[1],_=(0,l.useState)(!1),Z=_[0],E=_[1];(0,l.useEffect)((function(){var e=Oa(n.template),t=n.template;E(e),k(t)}),[]);var I=function(){var e=(0,h.Z)((function(){return(0,x.__generator)(this,(function(e){switch(e.label){case 0:if(n.alias===f)return[2];e.label=1;case 1:return e.trys.push([1,3,,4]),[4,u(f)];case 2:return e.sent(),[3,4];case 3:return e.sent(),[2,C(!0)];case 4:return[2]}}
1))}));return function(){return e.apply(this,arguments)}}(),A=function(){var e=(0,h.Z)((function(){return(0,x.__generator)(this,(function(e){switch(e.label){case 0:return Z?[4,a((0,g.Z)((0,m.Z)({},n),{template:S}))]:[3,2];case 1:return e.sent(),[3,3];case 2:s.templateMustIncludeSteps(),e.label=3;case 3:return[2]}}))}));return function(){return e.apply(this,arguments)}}();return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(P.Zd,{children:[(0,i.jsxs)("div",{className:"header",children:[(0,i.jsx)("div",{className:"title",children:"Details"}),(0,i.jsxs)("span",{className:"hero",children:["You can define a list of automation steps by configuring the template below. To learn more about how automations work in Courier and see examples,"," ",(0,i.jsx)("a",{target:"_blank",rel:"noopener noreferrer",href:"https://www.notion.so/trycourier/Automations-d620bc65b6694f7db2dc602f9fbe2233",children:"click here"}),"."]})]}),(0,i.jsx)(P.vr,{readOnly:!0,label:"Template ID",value:n.templateId}),(0,i.jsx)(P.Rj,{readOnly:!o,label:"Template Name",placeholder:"Untitled Automation",onChange:function(e){r(e.target.value)},onBlur:(0,h.Z)((function(){return(0,x.__generator)(this,(function(e){switch(e.label){case 0:return[4,c(t)];case 1:return[2,e.sent()]}}))})),value:t}),(0,i.jsx)(P.h8,{readOnly:!o,label:"Alias",placeholder:"Untitled Automation",onChange:function(e){C(!1),p(e.target.value)},onBlur:I,value:f,className:y()({error:b})})]}),(0,i.jsx)(P.y0,{onBlur:A,children:(0,i.jsx)(ui.default,{className:"codemirror-editor",renderHeader:function(){return B(null,null,n,"JSONNET",null,o)},value:S,onChange:function(e){return function(e){k(e),E(Oa(e))}(e)},options:{mode:{name:"jsonnet"},readOnly:!o}})})]})},Aa=function(e){var n,t=e.automationTemplate,r=e.name,o=e.setName,a=e.sources,s=(0,l.useState)(null),u=s[0],c=s[1],d=(0,p.Z)((function(e){return e.automationTemplates.canWriteItem(t.templateId)}));return(0,l.useEffect)((function(){return t.json?c("JSON"):c("JSONNET")}),[]),u?(0,i.jsxs)(P.W2,{children:["JSONNET"===u&&(0,i.jsx)(Ta,{automationTemplate:t,name:r,setName:o,writePermission:d}),"JSON"===u&&(0,i.jsx)(Ia,{automationTemplate:t,name:r,setName:o,setEditorType:c,templateSources:null===a||void 0===a||null===(n=a.automationSources)||void 0===n?void 0:n.nodes,writePermission:d})]}):null},Da=t(52226),La=t(8887),Ma=t(85716),Pa=(t(95853),t(68901)),Ra=t(50406),Fa=function(e){var n=e.isConnectable,t=e.position,r=e.className,o=e.id;return(0,i.jsx)(Ma.HH,{className:r,type:"source",position:t,isConnectable:n,id:o})},za=(0,l.memo)(Fa),Ba=function(e){var n=e.isConnectable,t=e.className;return(0,i.jsx)(Ga,{className:t,position:Ma.Ly.Bottom,isConnectable:n})},Ha=function(e){var n=e.isConnectable,t=e.position,r=e.className;return(0,i.jsx)(Ma.HH,{type:"target",position:t,isConnectable:n,className:r})},Va=(0,l.memo)(Ha),$a=function(e){var n=e.isConnectable,t=e.className;return(0,i.jsx)(Va,{className:t,position:Ma.Ly.Top,isConnectable:n})};function Ua(){var e=(0,o.Z)(["\n  height: 12px;\n  width: 12px;\n  border: none !important;\n  background: ",";\n  left: ",";\n"]);return Ua=function(){return e},e}function Wa(){var e=(0,o.Z)(["\n  background: ",";\n  bottom: -5px;\n"]);return Wa=function(){return e},e}function qa(){var e=(0,o.Z)(["\n  background: none;\n  height: none;\n  width: none;\n  border: none;\n  box-shadow: none;\n"]);return qa=function(){return e},e}function Ka(){var e=(0,o.Z)(["\n  background: ",";\n  height: 12px;\n  width: 12px;\n  border: none !important;\n  background: ",";\n"]);return Ka=function(){return e},e}var Ga=(0,Ra.z)(za)(Ua(),(function(e){return e.theme.colors.triggerHandle}),(function(e){var n=e.left;return null!==n&&void 0!==n?n:"50%"})),Ja=(0,Ra.z)(Ba)(Wa(),(function(e){return e.theme.colors.triggerHandle})),Xa=(0,Ra.z)($a)(qa()),Ya=(0,Ra.z)(Va)(Ka(),(function(e){return e.theme.colors.targetHandle}),(function(e){return e.theme.colors.triggerHandle}));function Qa(){var e=(0,o.Z)(["\n  padding: 8px;\n  gap: 8px;\n  text-align: center;\n  background: var(--background-panels);\n  border: 1px dashed rgba(142, 158, 180, 0.5);\n  border-radius: 8px;\n\n  ","\n"]);return Qa=function(){return e},e}function el(){var e=(0,o.Z)(["\n  width: 576px;\n  height: 72px;\n  line-height: 72px;\n"]);return el=function(){return e},e}function nl(){var e=(0,o.Z)(["\n  width: 464px;\n  height: 48px;\n  line-height: 48px;\n"]);return nl=function(){return e},e}var tl=Ra.z.div(Qa(),(function(e){return e.isDropzoneActive&&"\n      background-color: rgba(255, 255, 255, 0.1);\n    "})),rl=(0,Ra.z)(tl)(el()),ol=(0,Ra.z)(tl)(nl()),il=function(){return(0,i.jsxs)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-icon-default",children:[(0,i.jsxs)("g",{clipPath:"url(#clip0_416_172)",children:[(0,i.jsx)("path",{d:"M13.92 9.19L13.1 1C13.04 0.44 12.57 0 12 0C11.43 0 10.96 0.43 10.9 1L10.08 9.19C10.03 9.66 9.66 10.04 9.18 10.09L1 10.9C0.44 10.96 0 11.43 0 12C0 12.57 0.43 13.04 1 13.1L9.19 13.92C9.66 13.97 10.04 14.34 10.09 14.82L10.91 23.01C10.97 23.57 11.44 24.01 12.01 24.01C12.58 24.01 13.05 23.58 13.11 23.01L13.93 14.82C13.98 14.35 14.35 13.97 14.83 13.92L23.02 13.1C23.58 13.04 24.02 12.57 24.02 12C24.02 11.43 23.59 10.96 23.02 10.9L14.83 10.08C14.36 10.03 13.98 9.66 13.93 9.18L13.92 9.19Z",fill:"currentColor"}),(0,i.jsx)("path",{d:"M16.7801 8.27C17.1801 8.31 17.5701 8.14 17.8201 7.83C19.2501 6.02 20.4701 4.48 20.4701 4.48C20.9601 3.87 20.1401 3.05 19.5301 3.54L16.1701 6.19C15.8601 6.44 15.6901 6.83 15.7301 7.23C15.7901 7.79 16.2301 8.23 16.7801 8.28V8.27Z",fill:"currentColor"}),(0,i.jsx)("path",{d:"M7.22012 8.26999C7.78012 8.20999 8.22012 7.76999 8.27012 7.21999C8.31012 6.81999 8.14012 6.42999 7.83012 6.17999C6.02012 4.74999 4.48012 3.52999 4.48012 3.52999C3.87012 3.03999 3.05012 3.85999 3.54012 4.46999L6.19012 7.82999C6.44012 8.13999 6.83012 8.30999 7.23012 8.26999H7.22012Z",fill:"currentColor"}),(0,i.jsx)("path",{d:"M7.22011 15.73C6.82011 15.69 6.43011 15.86 6.18011 16.17C4.78011 17.95 3.53011 19.53 3.53011 19.53C3.04011 20.14 3.86011 20.96 4.47011 20.47L7.83011 17.82C8.14011 17.57 8.31011 17.18 8.27011 16.78C8.21011 16.22 7.77011 15.78 7.22011 15.73Z",fill:"currentColor"}),(0,i.jsx)("path",{d:"M16.7801 15.73C16.2201 15.79 15.7801 16.23 15.7301 16.78C15.6901 17.18 15.8601 17.57 16.1701 17.82C17.9801 19.25 19.5201 20.47 19.5201 20.47C20.1301 20.96 20.9501 20.14 20.4601 19.53L17.8101 16.17C17.5601 15.86 17.1701 15.69 16.7701 15.73H16.7801Z",fill:"currentColor"})]}),(0,i.jsx)("defs",{children:(0,i.jsx)("clipPath",{id:"clip0_416_172",children:(0,i.jsx)("rect",{width:"24",height:"24",fill:"
1currentColor"})})})]})},al=t(65058),ll=(0,al.cn)(!1),sl=(0,al.cn)({json:null,setter:null}),ul=(0,al.cn)({show:!1,id:null,title:null}),cl=(0,al.cn)(!1),dl=(0,al.cn)(!1),fl=(0,al.cn)(!1),pl=(0,al.cn)(!0),hl=(0,al.cn)(!1),vl=function(e){var n=e.isConnectable,t=(0,Pa.Dv)(dl),r=(0,Pa.Dv)(fl);return(0,i.jsxs)(rl,{className:"nodrag",isDropzoneActive:t&&r,children:[(0,i.jsx)(il,{}),(0,i.jsx)(Ja,{isConnectable:n})]})},ml=(0,l.memo)(vl),gl=t(39128),xl={fonts:{title:"Inter",text:"Anonymous Pro"},colors:{border:"var(--structure-default)",canvas:"var(--background-dotgrid)",inputBackground:"var(--background-field-input)",nodeBackground:"var(--background-panels)",sourceHandle:"var(--text-link)",targetHandle:"var(--text-link)",text:"var(--text-subtext)",triggerHandle:"var(--text-link)"},text:{xs:"12px",sm:"14px",base:"16px",lg:"18px",xl:"20px","2xl":"24px","3xl":"30px"}};function bl(){var e=(0,o.Z)(["\n  cursor: grab;\n\n  /** Layout */\n  display: flex;\n  flex-direction: row;\n  justify-content: space-between;\n\n  /** Sizing */\n  min-width: 464px;\n  width: 100%;\n  height: 56px;\n  padding: 16px 8px;\n"]);return bl=function(){return e},e}function yl(){var e=(0,o.Z)(["\n  cursor: grab;\n\n  /** Layout */\n  flex: 1;\n  margin: auto 8px;\n\n  font-family: ",";\n  font-style: normal;\n  font-weight: 600;\n  font-size: 18px;\n  line-height: 18px;\n  color: var(--text-default);\n"]);return yl=function(){return e},e}function Cl(){var e=(0,o.Z)(["\n  width: 100%;\n  padding: 16px;\n  gap: 16px;\n  cursor: auto;\n"]);return Cl=function(){return e},e}function jl(){var e=(0,o.Z)(["\n  box-sizing: border-box;\n  height: 40px;\n  padding: 8px 16px;\n  padding-left: 2px;\n  flex-grow: 1;\n\n  /** Decoration */\n  font-family: ",";\n  font-style: normal;\n  font-weight: 700;\n  font-size: 16px;\n  line-height: 16px;\n  align-items: center;\n  color: ",";\n  background: ",";\n  border-top: 1px solid ",";\n  border-bottom: 1px solid ",";\n  border-left: none;\n  border-right: none;\n"]);return jl=function(){return e},e}function wl(){var e=(0,o.Z)(["\n  box-sizing: border-box;\n  height: 40px;\n  width: 100%;\n  display: flex;\n  padding: 8px 16px;\n  border-radius: 6px;\n  justify-content: flex-start;\n\n  /** Decoration */\n  font-family: ",";\n  font-style: normal;\n  font-weight: 700;\n  font-size: 16px;\n  line-height: 16px;\n  align-items: center;\n  color: ",";\n  background: ",";\n  border: 1px solid ",";\n"]);return wl=function(){return e},e}function Nl(){var e=(0,o.Z)(["\n  padding-right: 8px;\n  white-space: nowrap;\n"]);return Nl=function(){return e},e}function Sl(){var e=(0,o.Z)(["\n  background: transparent;\n  border: none;\n  flex-grow: 1;\n\n  /** Decoration */\n  font-family: ",";\n  font-style: normal;\n  font-weight: 700;\n  font-size: 16px;\n  line-height: 16px;\n  align-items: center;\n  color: var(--text-default);\n"]);return Sl=function(){return e},e}function kl(){var e=(0,o.Z)(["\n  font-family: ",";\n  font-style: normal;\n  font-weight: 700;\n  font-size: 16px;\n  line-height: 16px;\n  display: flex;\n  align-items: center;\n  padding: 6px 8px;\n\n  color: ",";\n"]);return kl=function(){return e},e}function _l(){var e=(0,o.Z)(["\n  text-align: right;\n"]);return _l=function(){return e},e}function Zl(){var e=(0,o.Z)(["\n  color: var(--text-default);\n"]);return Zl=function(){return e},e}function El(){var e=(0,o.Z)(["\n  padding-top: 16px;\n"]);return El=function(){return e},e}function Il(){var e=(0,o.Z)(["\n  border: none;\n  background: transparent;\n  display: flex;\n  margin-left: auto;\n  align-items: center;\n  padding: 0;\n  cursor: pointer;\n"]);return Il=function(){return e},e}function Ol(){var e=(0,o.Z)(["\n  width: 100%;\n  height: 396px;\n  overflow-y: auto;\n\n  & > * {\n    border-top: 1px solid ",";\n  }\n\n  --bgRGB: 21, 24, 27;\n  --bg: rgb(var(--bgRGB));\n  --bgTrans: rgba(var(--bgRGB), 0);\n\n  background:\n    /* Shadow Cover TOP */ linear-gradient(\n        var(--bg) 30%,\n        var(--bgTrans)\n      )\n      center top,\n    /* Shadow Cover BOTTOM */ linear-gradient(var(--bgTrans), var(--bg) 70%)\n      center bottom,\n    /* Shadow TOP */\n      radial-gradient(farthest-side at 50% 0, var(--shadow), rgba(0, 0, 0, 0))\n      center top,\n    /* Shadow BOTTOM */\n      radial-gradient(\n        farthest-side at 50% 100%,\n        var(--shadow),\n        rgba(0, 0, 0, 0)\n      )\n      center bottom;\n\n  background-repeat: no-repeat;\n  background-size: 100% 40px, 100% 40px, 100% 15px, 100% 15px;\n  background-attachment: local, local, scroll, scroll;\n"]);return Ol=function(){return e},e}var Tl=Ra.z.section(bl()),Al=Ra.z.label(yl(),(function(e){return e.theme.fonts.title})),Dl=Ra.z.section.attrs((function(e){return(0,m.Z)({className:"nodrag"},e)}
1))(Cl()),Ll=(xl.colors.border,xl.colors.inputBackground,Ra.z.select(jl(),(function(e){return e.theme.fonts.text}),(function(e){return e.theme.colors.text}),(function(e){return e.theme.colors.inputBackground}),(function(e){return e.theme.colors.border}),(function(e){return e.theme.colors.border})),Ra.z.div(wl(),(function(e){return e.theme.fonts.text}),(function(e){return e.theme.colors.text}),(function(e){return e.theme.colors.inputBackground}),(function(e){return e.theme.colors.border}))),Ml=Ra.z.label(Nl()),Pl=Ra.z.input(Sl(),(function(e){return e.theme.fonts.text})),Rl=Ra.z.label(kl(),(function(e){return e.theme.fonts.text}),(function(e){return e.theme.colors.text})),Fl=(0,Ra.z)(Rl)(_l()),zl=(0,Ra.z)(Rl)(Zl()),Bl=Ra.z.div(El()),Hl=Ra.z.button(Il()),Vl=Ra.z.div(Ol(),(function(e){return e.theme.colors.border})),$l=function(e){var n=e.className,t=e.onClick,r=e.tabIndex;return(0,i.jsx)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:y()("text-icon-default",n),onClick:t,tabIndex:r,children:(0,i.jsx)("path",{d:"M15.7103 8.29006C15.3203 7.90006 14.6903 7.90006 14.3003 8.29006L12.3603 10.2301C12.1603 10.4301 11.8503 10.4301 11.6503 10.2301L9.71031 8.29006C9.32031 7.90006 8.69031 7.90006 8.30031 8.29006C7.91031 8.68006 7.91031 9.31006 8.30031 9.70006L10.2403 11.6401C10.4403 11.8401 10.4403 12.1501 10.2403 12.3501L8.30031 14.2901C7.91031 14.6801 7.91031 15.3101 8.30031 15.7001C8.69031 16.0901 9.32031 16.0901 9.71031 15.7001L11.6503 13.7601C11.8503 13.5601 12.1603 13.5601 12.3603 13.7601L14.3003 15.7001C14.6903 16.0901 15.3203 16.0901 15.7103 15.7001C16.1003 15.3101 16.1003 14.6801 15.7103 14.2901L13.7703 12.3501C13.5703 12.1501 13.5703 11.8401 13.7703 11.6401L15.7103 9.70006C16.1003 9.31006 16.1003 8.68006 15.7103 8.29006Z",fill:"currentColor"})})};function Ul(){var e=(0,o.Z)(["\n  display: flex;\n  align-items: center;\n  padding: 8px 10px 8px 13px;\n  border: 1px solid;\n  border-color: ",";\n  border-radius: 8px;\n  background-color: ",";\n"]);return Ul=function(){return e},e}function Wl(){var e=(0,o.Z)(["\n  color: var(--text-default);\n  background: transparent;\n  border: none;\n  font-family: ",";\n  font-size: ",";\n  cursor: text;\n  line-height: 1.2;\n  margin: 0;\n\n  ::-webkit-datetime-edit {\n    color: var(--text-default);\n    padding-left: 3px;\n  }\n  ::-webkit-calendar-picker-indicator {\n    background-color: var(--background-panels);\n    border-radius: 4px;\n  }\n"]);return Wl=function(){return e},e}var ql=u.default.div(Ul(),(function(e){return e.theme.colors.border}),(function(e){return e.theme.colors.inputBackground})),Kl=u.default.input(Wl(),(function(e){return e.theme.fonts.text}),(function(e){return e.theme.text.base})),Gl=function(e){var n=e.onChange,t=e.value,r=e.label,o=(0,l.useState)(null!==t&&void 0!==t?t:""),a=o[0],s=o[1],u=(new Date).toISOString().slice(0,16);return(0,i.jsxs)(ql,{children:[r&&(0,i.jsxs)(Ml,{children:[r,":"]}),(0,i.jsx)(Kl,{type:"datetime-local",onChange:function(e){var t=e.target.value;s(t),n(t)},value:a,min:u}),(0,i.jsx)($l,{className:"ml-auto block cursor-pointer",onClick:function(){s(""),n()}})]})},Jl=t(70347),Xl=t(96577),Yl=t.n(Xl);function Ql(){var e=(0,o.Z)(["\n  display: flex;\n  align-items: center;\n  border: 1px solid;\n  border-color: ",";\n  border-radius: 6px;\n  background-color: ",";\n  padding-left: 16px;\n  padding-right: 4px;\n  height: 40px;\n"]);return Ql=function(){return e},e}var es=u.default.div(Ql(),(function(e){return e.theme.colors.border}),(function(e){return e.theme.colors.inputBackground})),ns=function(e){var n,t=e.className,r=e.clearable,o=void 0!==r&&r,a=e.creatable,s=void 0!==a&&a,c=e.createValidator,d=e.icon,f=e.label,p=e.loading,h=void 0!==p&&p,v=e.name,x=e.onChange,b=e.onInputChange,y=e.openMenuOnFocus,C=void 0===y||y,j=e.options,w=e.placeholder,N=e.searchable,S=void 0!==N&&N,k=e.value,_=(0,u.useTheme)(),Z=(0,l.useMemo)((function(){if(k){var e=j.find((function(e){return e.value===k}));return e||{label:k,value:k}}}),[j,k]);return(0,i.jsxs)(es,{className:"nodrag nowheel ".concat(t),children:[(0,i.jsxs)("div",{className:"flex font-anonymous text-subtext",children:[d&&(0,i.jsx)("div",{className:"flex items-center pr-2",children:(0,i.jsx)(Yl(),{width:24,height:24,src:d,alt:"label icon"})}),f&&(0,i.jsxs)("label",{className:"flex items-center pr-2",children:[f,":"]})]}),(0,i.jsx)("div",{className:"flex-1",children:(0,i.jsx)(Jl.ZP,{formatCreateLabel:function(e){return"Use ".concat(e)},noOptionsMessage:function(){return h?"loading...":"No options"},isClearable:o,isSearchable:S,isValidNewOption:function(e){return!!s&&(!c||c(e))}
1,name:v,onChange:function(e){return x(null===e||void 0===e?void 0:e.value)},onInputChange:b,openMenuOnClick:!0,openMenuOnFocus:C,options:j,placeholder:w,value:Z,styles:{control:function(e){return(0,g.Z)((0,m.Z)({},e),{border:"none",background:"transparent",boxShadow:"none","&:hover":{boxShadow:"none"},cursor:"pointer",minHeight:"0px"})},dropdownIndicator:function(e){return(0,g.Z)((0,m.Z)({},e),{color:"var(--text-default)","&:hover":{color:"var(--text-default)"}})},indicatorSeparator:function(e){return(0,g.Z)((0,m.Z)({},e),{backgroundColor:null})},input:function(e){return(0,g.Z)((0,m.Z)({},e),{caretColor:"var(--text-default)",color:"var(--text-default)","& input":{fontFamily:"Anonymous Pro"}})},menu:function(e){return(0,g.Z)((0,m.Z)({},e),{backgroundColor:null!==(n=_.colors.inputBackground)&&void 0!==n?n:"var(--background-field-input)",boxShadow:"0px 0px 0px 0px rgba(0, 0, 0, 0.03), 0px 1px 2px 0px rgba(0, 0, 0, 0.03), 0px 3px 3px 0px rgba(0, 0, 0, 0.02), 0px 8px 5px 0px rgba(0, 0, 0, 0.01)"})},menuList:function(e){return(0,g.Z)((0,m.Z)({},e),{backgroundColor:_.colors.inputBackground,fontFamily:"Anonymous Pro"})},option:function(e,n){var t=n.isSelected;return(0,g.Z)((0,m.Z)({},e),{color:"var(--text-default)",backgroundColor:t?"var(--background-field-input)":"","&:hover":{cursor:"pointer",backgroundColor:"var(--text-link)",color:"var(--background-field-input)"}})},placeholder:function(e){return(0,g.Z)((0,m.Z)({},e),{fontFamily:"Anonymous Pro",fontStyle:"normal",fontWeight:700,fontSize:"16px",lineHeight:"16px",display:"flex",alignItems:"center",color:"var(--text-placeholder)"})},singleValue:function(e){return(0,g.Z)((0,m.Z)({},e),{color:"var(--text-default)",fontFamily:"Anonymous Pro"})},valueContainer:function(e){return(0,g.Z)((0,m.Z)({},e),{paddingLeft:0,paddingRight:0})}}})})]})},ts=function(e){var n=e.label,t=e.value,r=e.disabled,o=e.onChange,a=e.className,l=e.placeholder,s=e.readOnly,u=(0,be.Z)(e,["label","value","disabled","onChange","className","placeholder","readOnly"]);return(0,i.jsxs)(Ll,(0,g.Z)((0,m.Z)({className:a},u),{children:[n&&(0,i.jsxs)(Ml,{children:[n,":"]}),(0,i.jsx)(Pl,{className:"nodrag placeholder-text-placeholder",value:t,onChange:o,disabled:r,placeholder:l,readOnly:s})]}))},rs=t(20324),os=function(e){var n=e.className,t=e.children;return(0,i.jsx)("span",{className:(0,rs.m6)("isolate inline-flex h-8 gap-4",n),children:t})},is=function(e){var n=e.onClick,t=e.text,r=e.selected;return(0,i.jsx)("button",{onClick:n,className:y()("relative inline-flex cursor-pointer items-center gap-2 rounded-[6px] border-0 px-3 py-3 font-anonymous text-base font-bold",r?"bg-background-active-link text-text-active":"bg-transparent text-button hover:bg-background-active-link"),children:t})},as=function(e){return(0,i.jsx)("button",{onClick:e.onClick,className:y()("relative inline-flex cursor-pointer items-center gap-2 rounded-full border-0 px-3 py-3 font-anonymous text-base font-bold",e.selected?"bg-white text-text-default":"bg-white/[.16] bg-transparent text-text-default"),children:e.text})},ls=function(e){var n=e.children,t=e.parentRef,r=e.className;return(0,i.jsx)("div",{className:(0,rs.m6)("flex flex-col items-start rounded-md border border-solid border-default shadow-md",r),ref:t,children:n})},ss=function(e){var n=e.isConnectable,t=e.children,r=e.parentRef;return(0,i.jsxs)(ls,{className:"w-[576px] gap-2 bg-table-row-odd p-4",parentRef:r,children:[t,(0,i.jsx)(Ja,{isConnectable:n})]})},us=function(e){var n=e.id,t=e.label,r=e.children,o=e.icon,a=(0,Ma._K)().deleteElements;return(0,i.jsxs)("div",{className:"flex h-10 w-full flex-row gap-4",children:[(0,i.jsxs)("div",{className:"flex gap-3",children:[o&&o,(0,i.jsx)("span",{className:"flex h-10 w-26 items-center font-inter text-xl font-semibold text-text-default",children:t})]}),r,(0,i.jsx)($l,{className:"my-2 ml-auto cursor-pointer",onClick:function(){return a({nodes:[{id:n}]})}})]})},cs=function(e){var n=e.children,t=e.className,r=(0,rs.m6)("w-full font-anonymous text-subtext",t);return(0,i.jsx)("div",{className:r,children:n})},ds=[{label:"Date",value:"date"},{label:"Recurrence",value:"recurrence"},{label:"Cron",value:"cron"}],fs=function(e){var n,t,r=e.id,o=e.isConnectable,a=e.data,s=(0,l.useRef)(),u=a.node,c=a.onChange,d=null!==(t=null===u||void 0===u||null===(n=u.schedule)||void 0===n?void 0:n.type)&&void 0!==t?t:"recurrence";(0,l.useEffect)((function(){s.current&&(0,gl.ZP)(s.current)}),[s]);var f,p="date"===d?hs:"recurrence"===d?vs:ps;return(0,i.jsxs)(ss,{isConnectable:o,parentRef:s,children:[(0,i.jsx)(us,{id:r,label:"Schedule"}),(0,i.jsx)(cs,{children:(0,i.jsx)(ns,{className:"w-full",label:"Type",value:d,options:ds,onChange:function(e){return c((0,g.Z)((0,m.Z)({},u),{schedule:xs(e)}))}})}),(0,i.jsx)(p,{value:null!==(f=null===u||void 0===u?void 0:u.schedule)&&void 0!==f?f:xs(d),onChange:function(e){return c((0,g.Z)((0,m.Z)({},u),{schedule:e}))}})]})},ps=function(e){var n=e.value,t=e.onChange;return"cron"!==n.type?null:(0,i.jsx)(cs,{children:(0,i.jsx)(ts,{label:"Cron String",value:n.value,onChange:function(e){return t((0,g.Z)((0,m.Z)({},n),{value:e.target.value}))}})})},hs=function(e){var n=e.value,t=e.onChange;return"date"!==n.type?null:(0,i.jsx)(cs,{children:(0,i.jsx)(Gl,{label:"Date",value:n.value,onChange:function(e){return t((0,g.Z)((0,m.Z)({},n),{value:e}))}})})},vs=function(e){var n=e.value,t=e.onChange;if("recurrence"!==n.type)return null;var r=function(e){var r=(0,m.Z)({},n,e);"year"===r.repeatUnit&&(r.frequency=1),t(r)};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(cs,{children:(0,i.jsx)(ns,{label:"Frequency",value:n.repeatUnit,options:gs,onChange:function(e){return r({repeatUnit:e})}})}),(0,i.jsx)(ms,{repeatUnit:n.repeatUnit,value:n.repeatOn,onChange:function(e){return r({repeatOn:e})}}),(0,i.jsx)(cs,{children:(0,i.jsx)(Gl,{label:"Start Date",value:n.startDate,onChange:function(e){return r({startDate:e})}})}),(0,i.jsx)(cs,{children:(0,i.jsx)(Gl,{label:"End Date",value:n.endDate,onChange:function(e){return r({endDate:e})}})})]})},ms=function(e){var n=e.value,t=e.onChange;if("week"!==e.repeatUnit)return null;if(!n)return t({sunday:!1,monday:!1,tuesday:!1,wednesday:!1,thursday:!1,friday:!1,saturday:!1}),null;var r=function(e){var r=e.day;return(0,i.jsx)(as,{onClick:function(){return t((0,g.Z)((0,m.Z)({},n),(0,v.Z)({},r,!n[r])))},selected:n[r],text:r[0].toLocaleUpperCase()})};return(0,i.jsx)(cs,{className:"flex justify-center",children:(0,i.jsxs)(os,{className:"my-1",children:[(0,i.jsx)(r,{day:"sunday"}),(0,i.jsx)(r,{day:"monday"}),(0,i.jsx)(r,{day:"tuesday"}),(0,i.jsx)(r,{day:"wednesday"}),(0,i.jsx)(r,{day:"thursday"}),(0,i.jsx)(r,{day:"friday"}),(0,i.jsx)(r,{day:"saturday"})]})})},gs=[{label:"Every Day",value:"day"},{label:"Every Week",value:"week"},{label:"Every Month",value:"month"},{label:"Every Year",value:"year"}],xs=function(e){return"recurrence"===e?{type:e,startDate:(new Date).toISOString(),frequency:1,repeatUnit:"day"}:{type:e,value:""}},bs=(0,l.memo)(fs),ys=function(e){var n=e.iconUrl,t=e.iconAlt,r=e.iconWidth,o=void 0===r?24:r,a=e.iconHeight,l=void 0===a?24:a,s=e.placeholder,u=e.value,c=e.leadingText,d=e.onChange;return(0,i.jsx)("div",{className:"relative h-10 w-[544px]",children:(0,i.jsxs)("div",{className:"absolute inset-y-0 left-0 right-0 flex items-center rounded-[6px] bg-background-field-input pl-4",children:[n&&(0,i.jsx)("img",{"aria-hidden":"true",src:n,alt:t,width:o,height:l}),c&&(0,i.jsx)("span",{className:"pl-4 indent-1 font-anonymous text-base font-bold text-text-default",children:c}),(0,i.jsx)("input",{className:y()("nodrag block h-full w-full rounded-[6px] border border-solid border-default bg-background-field-input font-anonymous text-base font-bold text-text-default placeholder-text-placeholder",{"pl-2 indent-1":!c}),placeholder:s,value:u,onChange:d})]})})},Cs=function(e){var n=e.className;return(0,i.jsxs)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:y()(n,"text-icon-default"),children:[(0,i.jsx)("path",{d:"M18.51 9.20001H11.09C10.8194 9.20001 10.6 9.41939 10.6 9.69001V10.58C10.6 10.8506 10.8194 11.07 11.09 11.07H18.51C18.7806 11.07 19 10.8506 19 10.58V9.69001C19 9.41939 18.7806 9.20001 18.51 9.20001Z",fill:"currentColor"}),(0,i.jsx)("path",{d:"M12.91 12.93H5.49C5.21938 12.93 5 13.1494 5 13.42V14.31C5 14.5806 5.21938 14.8 5.49 14.8H12.91C13.1806 14.8 13.4 14.5806 13.4 14.31V13.42C13.4 13.1494 13.1806 12.93 12.91 12.93Z",fill:"currentColor"}),(0,i.jsx)("path",{d:"M7.8 18.06C8.31362 18.06 8.72999 17.6436 8.72999 17.13C8.72999 16.6164 8.31362 16.2 7.8 16.2C7.28637 16.2 6.87 16.6164 6.87 17.13C6.87 17.6436 7.28637 18.06 7.8 18.06Z",fill:"currentColor"}
1),(0,i.jsx)("path",{d:"M16.2 7.8C16.7136 7.8 17.13 7.38363 17.13 6.87C17.13 6.35638 16.7136 5.94 16.2 5.94C15.6864 5.94 15.27 6.35638 15.27 6.87C15.27 7.38363 15.6864 7.8 16.2 7.8Z",fill:"currentColor"}),(0,i.jsx)("path",{d:"M12 17.6C11.48 17.6 10.97 17.52 10.49 17.39C10.26 17.32 10.02 17.46 9.93995 17.68L9.61995 18.56C9.52995 18.82 9.66995 19.09 9.92995 19.17C10.59 19.36 11.28 19.47 12 19.47C15.05 19.47 17.66 17.64 18.82 15.03C18.93 14.78 18.82 14.49 18.56 14.39L17.68 14.07C17.46 13.99 17.2 14.09 17.1 14.31C16.22 16.25 14.27 17.61 12 17.61V17.6Z",fill:"currentColor"}),(0,i.jsx)("path",{d:"M12 6.4C12.52 6.4 13.03 6.48 13.51 6.61C13.74 6.68 13.98 6.54 14.06 6.32L14.38 5.44C14.47 5.18 14.33 4.91 14.07 4.83C13.41 4.64 12.72 4.53 12 4.53C8.94999 4.53 6.33999 6.36 5.17999 8.97C5.06999 9.22 5.17999 9.51 5.43999 9.61L6.31999 9.93C6.53999 10.01 6.79999 9.91 6.89999 9.69C7.77999 7.75 9.72999 6.39 12 6.39V6.4Z",fill:"currentColor"})]})},js="identify",ws="group",Ns="track",Ss="page",ks=[Ns,Ss],_s=function(e){var n=e.isConnectable,t=e.id,r=e.data,o=r.node,a=(0,l.useRef)(),s=(0,Xi.hE)();(0,l.useEffect)((function(){a.current&&(0,gl.ZP)(a.current)}),[a]);var u=r.onChange,c=function(e){u({request_type:e,event_id:""})};return(0,i.jsxs)(ss,{isConnectable:n,parentRef:a,children:[(0,i.jsx)(us,{id:t,label:"Segment",icon:(0,i.jsx)(Cs,{className:"my-2"}),children:(0,i.jsxs)(os,{className:"ml-[38px] mt-1",children:[(0,i.jsx)(is,{onClick:function(){return c(Ns)},selected:o.request_type===Ns,text:"Track"}),(0,i.jsx)(is,{onClick:function(){return c(Ss)},selected:o.request_type===Ss,text:"Page"}),(0,i.jsx)(is,{onClick:function(){return c(js)},selected:o.request_type===js,text:"Identify"}),(0,i.jsx)(is,{onClick:function(){return c(ws)},selected:o.request_type===ws,text:"Group"})]})}),ks.includes(null===o||void 0===o?void 0:o.request_type)&&(0,i.jsx)("div",{className:"w-full font-anonymous text-subtext ",children:(0,i.jsx)(ns,{className:"w-full",options:o.request_type===Ss?s.page:s.track,label:"Event",value:o.event_id,name:"brands",searchable:!0,clearable:!0,creatable:!0,onChange:function(e){return u({event_id:e})}})}),o.request_type&&o.request_type===ws&&(0,i.jsx)(ys,{value:o.event_id,onChange:function(e){return u({event_id:e.target.value})},placeholder:"Enter group ID..."})]})},Zs=(0,l.memo)(_s),Es=t(4019),Is="audiences:user:matched",Os="audiences:user:unmatched",Ts=function(e){var n=e.isConnectable,t=e.id,r=e.data,o=r.node,a=(0,Es.kY)(),l=a.loading,s=a.setSearch,u=a.options,c=r.onChange;return(0,i.jsxs)(ss,{isConnectable:n,children:[(0,i.jsx)(us,{id:t,label:"Audience",children:(0,i.jsxs)(os,{className:"ml-[38px] mt-1",children:[(0,i.jsx)(is,{onClick:function(){return c({event_type:Is})},selected:o.event_type===Is,text:"Match"}),(0,i.jsx)(is,{onClick:function(){return c({event_type:Os})},selected:o.event_type===Os,text:"Unmatch"})]})}),(0,i.jsx)(ns,{className:"w-full",searchable:!0,clearable:!0,placeholder:"Enter audience...",options:u,value:null===o||void 0===o?void 0:o.audience_id,onChange:function(e){return c({audience_id:e})},onInputChange:s,loading:l})]})},As=(0,l.memo)(Ts),Ds=t(4353),Ls=function(e){var n=e.className;return(0,i.jsxs)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:y()(n,"text-icon-default"),children:[(0,i.jsx)("path",{d:"M17.5 12.26V8.48999H13.83C13.83 10.57 15.47 12.26 17.5 12.26Z",fill:"currentColor"}),(0,i.jsx)("path",{d:"M6.5 19.28H11.93C15.01 19.28 17.5 16.71 17.5 13.55H6.5V19.28Z",fill:"currentColor"}),(0,i.jsx)("path",{d:"M13.83 4.72C13.83 6.8 15.47 8.49 17.5 8.49V4.72H13.83Z",fill:"currentColor"}),(0,i.jsx)("path",{d:"M10.17 4.72C10.17 6.8 11.81 8.49 13.84 8.49H10.17C10.17 10.57 11.81 12.26 13.84 12.26V4.72H10.17Z",fill:"currentColor"}),(0,i.jsx)("path",{d:"M10.17 12.26V8.48999H6.5C6.5 10.57 8.14 12.26 10.17 12.26Z",fill:"currentColor"})]})},Ms="user",Ps="track",Rs="group",Fs=function(e){var n,t,r,o,a,s=e.isConnectable,u=e.id,c=e.data,d=c.node,f=(0,l.useRef)(),p=(0,Ds.sm)("rudderstack"),h=null!==(a=null===(o=null===p||void 0===p||null===(n=p.data)||void 0===n||null===(t=n.listInboundEvents)||void 0===t||null===(r=t.nodes)||void 0===r?void 0:r.filter((function(e){return"rudderstack/user"!==e.eventId})))||void 0===o?void 0:o.map((function(e){var n,t;return{label:null===(n=e.eventId)||void 0===n?void 0:n.replace("rudderstack/track/",""),value:null===(t=e.eventId)||void 0===t?void 0:t.replace("rudderstack/track/","")}})))&&void 0!==a?a:[];(0,l.useEffect)((function(){f.current&&(0,gl.ZP)(f.current)}),[f]);var v=c.onChange,m=function(e){v({event_type:e,event_id:""})};return(0,i.jsxs)(ss,{isConnectable:s,parentRef:f,children:[(0,i.jsx)(us,{id:u,label:"Rudderstack",icon:(0,i.jsx)(Ls,{className:"my-2"}),children:(0,i.jsxs)(os,{className:"ml-[38px] mt-1",children:[(0,i.jsx)(is,{onClick:function(){return m(Ms)},selected:d.event_type===Ms,text:"Identify"}),(0,i.jsx)(is,{onClick:function(){return m(Ps)},selected:d.event_type===Ps,text:"Track"}),(0,i.jsx)(is,{onClick:function(){return m(Rs)},selected:d.event_type===Rs,text:"Group"})]})}),(null===d||void 0===d?void 0:d.event_type)===Ps&&(0,i.jsx)("div",{className:"w-full font-anonymous text-subtext ",children:(0,i.jsx)(ns,{className:"w-full",options:h,label:"Event",value:d.event_id,name:"brands",searchable:!0,clearable:!0,creatable:!0,onChange:function(e){return v({event_id:e})}})}),d.event_type&&d.event_type===Rs&&(0,i.jsx)(ys,{value:d.event_id,onChange:function(e){return v({event_id:e.target.value})},placeholder:"Enter group ID..."})]})},zs=(0,l.memo)(Fs),Bs=t(61071),Hs="track",Vs=function(e){var n,t,r,o,a,s=e.isConnectable,u=e.id,c=e.data,d=c.node,f=(0,l.useRef)(),p=(0,Bs.ZP)({after:"",config:"inbound"}),h=(0,l.useMemo)((function(){var e,n,t,r;return null!==(r=null===p||void 0===p||null===(e=p.data)||void 0===e||null===(n=e.webhooks)||void 0===n||null===(t=n.nodes)||void 0===t?void 0:t.map((function(e){return{label:e.name,value:e.name}})))&&void 0!==r?r:[]}),[null===p||void 0===p?void 0:p.data]),v=d.event_source,m=(0,Ds.sm)("webhook/"+v),g=null!==(a=null===(o=null===m||void 0===m||null===(n=m.data)||void 0===n||null===(t=n.listInboundEvents)||void 0===t||null===(r=t.nodes)||void 0===r?void 0:r.filter((function(e){return e.eventId!=="webhook/"+v+"/user"})))||void 0===o?void 0:o.map((function(e){var n,t;return{label:null===(n=e.eventId)||void 0===n?void 0:n.replace("webhook/"+v+"/track/",""),value:null===(t=e.eventId)||void 0===t?void 0:t.replace("webhook/"+v+"/track/","")}})))&&void 0!==a?a:[];(0,l.useEffect)((function(){f.current&&(0,gl.ZP)(f.current)}),[f]);var x=c.onChange;return(0,i.jsxs)(ss,{isConnectable:s,parentRef:f,children:[(0,i.jsx)(us,{id:u,label:"Webhook",children:(0,i.jsx)(os,{className:"ml-[38px] mt-1",children:(0,i.jsx)(is,{onClick:function(){x({event_type:Hs,event_source:"",event_id:""})},selected:d.event_type===Hs,text:"Track"})})}),(null===d||void 0===d?void 0:d.event_type)===Hs&&(0,i.jsx)("div",{className:"w-full font-anonymous text-subtext ",children:(0,i.jsx)(ns,{className:"w-full",options:h,label:"Source",loading:!!(null===p||void 0===p?void 0:p.loading),value:null===d||void 0===d?void 0:d.event_source,name:"sources",searchable:!0,clearable:!0,onChange:function(e){return x({event_source:e})}})}),(null===d||void 0===d?void 0:d.event_type)===Hs&&(0,i.jsx)("div",{className:"w-full font-anonymous text-subtext ",children:(0,i.jsx)(ns,{className:"w-full",options:g,label:"Event",value:d.event_id,name:"events",searchable:!0,clearable:!0,onChange:function(e){return x({event_id:e})}})})]})},$s=(0,l.memo)(Vs),Us=function(e){var n=e.isConnectable,t=e.id,r=e.data,o=r.node,a=(0,Es.vF)(),l=r.onChange;return(0,i.jsx)(ss,{isConnectable:n,children:(0,i.jsx)(us,{id:t,label:"Digest",children:(0,i.jsx)(ns,{className:"w-full",label:"Subscription topic",options:a,value:null===o||void 0===o?void 0:o.subscription_topic_id,onChange:function(e){return l({subscription_topic_id:e})}})})})},Ws=(0,l.memo)(Us),qs="track",Ks=function(e){var n,t,r,o,a=e.isConnectable,s=e.id,u=e.data,c=u.node,d=(0,l.useRef)(),f=(0,Ds.sm)("courier"),p=null!==(o=null===f||void 0===f||null===(n=f.data)||void 0===n||null===(t=n.listInboundEvents)||void 0===t||null===(r=t.nodes)||void 0===r?void 0:r.map((function(e){var n,t;return{label:null===(n=e.eventId)||void 0===n?void 0:n.replace("courier/track/",""),value:null===(t=e.eventId)||void 0===t?void 0:t.replace("courier/track/","")}})))&&void 0!==o?o:[];(0,l.useEffect)((function(){d.current&&(0,gl.ZP)(d.current)}),[d]);
1var h=u.onChange;return(0,i.jsxs)(ss,{isConnectable:a,parentRef:d,children:[(0,i.jsx)(us,{id:s,label:"Courier",children:(0,i.jsx)(os,{className:"ml-[38px] mt-1",children:(0,i.jsx)(is,{onClick:function(){h({event_type:qs,event_id:""})},selected:c.event_type===qs,text:"Track"})})}),(null===c||void 0===c?void 0:c.event_type)===qs&&(0,i.jsx)("div",{className:"w-full font-anonymous text-subtext ",children:(0,i.jsx)(ns,{className:"w-full",options:p,label:"Event",value:c.event_id,name:"brands",searchable:!0,clearable:!0,creatable:!0,onChange:function(e){return h({event_id:e})}})})]})},Gs=(0,l.memo)(Ks),Js=function(e){var n=e.data,t=n.node,r=n.onChange,o=n.onSet;return"segment"===t.trigger_type?(0,i.jsx)(Zs,(0,g.Z)((0,m.Z)({},e),{data:{node:t,onChange:r,onSet:o}})):"schedule"===t.trigger_type?(0,i.jsx)(bs,(0,g.Z)((0,m.Z)({},e),{data:{node:t,onChange:r,onSet:o}})):"audience"===t.trigger_type?(0,i.jsx)(As,(0,g.Z)((0,m.Z)({},e),{data:{node:t,onChange:r,onSet:o}})):"inbound-event"===t.trigger_type&&"rudderstack"===t.event_source?(0,i.jsx)(zs,(0,g.Z)((0,m.Z)({},e),{data:{node:t,onChange:r,onSet:o}})):"inbound-event"===t.trigger_type&&"courier"===t.event_source?(0,i.jsx)(Gs,(0,g.Z)((0,m.Z)({},e),{data:{node:t,onChange:r,onSet:o}})):"webhook"===t.trigger_type?(0,i.jsx)($s,(0,g.Z)((0,m.Z)({},e),{data:{node:t,onChange:r,onSet:o}})):"digest"===t.trigger_type?(0,i.jsx)(Ws,(0,g.Z)((0,m.Z)({},e),{data:{node:t,onChange:r,onSet:o}})):(0,i.jsx)(ml,(0,g.Z)((0,m.Z)({},e),{data:{node:t,onChange:r,onSet:o}}))},Xs=function(){return(0,i.jsx)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-icon-default",children:(0,i.jsx)("path",{d:"M18.3499 11.65L12.2699 9.44003C11.5999 9.20003 11.3899 8.35003 11.8799 7.82003L17.8199 1.39003C18.2199 0.980032 17.6699 0.310032 17.1899 0.620032L4.9199 8.07003C3.1199 9.15003 3.6199 11.88 5.6499 12.35L11.7299 14.56C12.3999 14.8 12.6099 15.65 12.1199 16.18L6.1799 22.61C6.0299 22.77 5.9999 23.02 6.1199 23.21C6.2599 23.45 6.5799 23.52 6.8099 23.38L19.0799 15.93C20.8799 14.85 20.3799 12.12 18.3499 11.65Z",fill:"currentColor"})})},Ys=function(e){var n=e.isConnectable,t=(0,Pa.Dv)(cl),r=(0,Pa.Dv)(fl);return(0,i.jsxs)(ol,{className:"nodrag",isDropzoneActive:t&&r,children:[(0,i.jsx)(Xs,{}),(0,i.jsx)(Xa,{isConnectable:n})]})},Qs=(0,l.memo)(Ys),eu=t(42838),nu=function(e){var n=e.isConnectable,t=e.targetPosition,r=void 0===t?Ma.Ly.Top:t,o=e.sourcePosition,a=void 0===o?Ma.Ly.Bottom:o,l=e.children,s=e.parentRef;return(0,i.jsxs)(ls,{className:"w-[464px] bg-background-panels",parentRef:s,children:[l,(0,i.jsx)(Ya,{position:r,isConnectable:n}),(0,i.jsx)(Ga,{position:a,isConnectable:n})]})},tu=function(e){var n=e.children,t=e.className,r=e.onClick;return(0,i.jsx)("div",{onClick:r,className:(0,rs.m6)("flex h-16 w-full flex-row items-start gap-4 border-0 border-t border-solid border-default p-4",t),children:n})},ru=function(e){var n=e.children,t=e.className;return(0,i.jsx)("div",{className:(0,rs.m6)("flex h-8 items-center py-2 font-anonymous text-base font-bold text-subtext",t),children:n})},ou=function(){return(0,i.jsxs)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-icon-default",children:[(0,i.jsxs)("g",{clipPath:"url(#clip0_2068_150)",children:[(0,i.jsx)("path",{d:"M16.5 2L16.5 22M18 2L6 2C3.79086 2 2 3.79086 2 6L2 18C2 20.2091 3.79086 22 6 22L18 22C20.2091 22 22 20.2091 22 18L22 6C22 3.79086 20.2091 2 18 2Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),(0,i.jsx)("path",{d:"M8 8L11.1667 11.9583L8 15.9167",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),(0,i.jsx)("defs",{children:(0,i.jsx)("clipPath",{id:"clip0_2068_150",children:(0,i.jsx)("rect",{width:"22",height:"22",fill:"transparent",transform:"translate(1 1)"})})})]})},iu=function(e){var n=e.toggleEditor,t=e.nodeId,r=(0,Pa.Dv)(ul),o=(0,i.jsx)(ou,{}),a=t===r.id||!r.show,l=r.show?"Close":"Edit";return(0,i.jsx)(i.Fragment,{children:a&&(0,i.jsxs)(Hl,{onClick:n,children:[(0,i.jsx)(Fl,{className:"cursor-pointer",children:l}),o]})})},au=function(e){var n=e.title,t=e.id,r=(0,Ma._K)().deleteElements;return(0,i.jsxs)(Tl,{children:[(0,i.jsx)(J.GgY,{className:"h-6 w-6 text-icon-default"}),(0,i.jsx)(Al,{children:n}),(0,i.jsx)($l,{tabIndex:-1,onClick:function(){return function(e){return r({nodes:[{id:e}]})}(t)}})]})},lu=function(e){return e.startsWith("refs")},su=function(e){var n=e.json,t=e.title,o=e.onChangedValue,a=e.nodeId,s=(0,r.Z)((0,Pa.KO)(ll),2),u=s[0],c=s[1],d=(0,Pa.b9)(sl),f=(0,Pa.b9)(ul);(0,l.useEffect)((function(){u&&d({json:n,setter:o})}),[u,n,o,d]);var p=(0,i.jsx)(ou,{}
1),h=u?"Close":"Edit";return(0,i.jsxs)(Hl,{onClick:function(){var e=!u;d({json:n,setter:o}),c(e),f({show:e,id:e?a:null,title:e?t:null})},children:[(0,i.jsx)(Fl,{className:"cursor-pointer",children:h}),p]})},uu=function(e){var n,t=e.title,r=e.json,o=e.setJson,a=e.nodeId,l=(0,Pa.Dv)(ll),s=(0,Pa.Dv)(ul),u=(null===s||void 0===s?void 0:s.title)===t||!l;return(0,i.jsxs)("div",{className:"flex",children:[(0,i.jsx)(Rl,{children:t}),(0,i.jsx)(zl,{children:(n=JSON.stringify(r),n.length>20?"".concat(n.substring(0,20),"...}"):n)}),u&&(0,i.jsx)(su,{title:t,json:r,onChangedValue:o,nodeId:a})]})},cu=function(e){var n=e.children,t=e.title;return(0,i.jsxs)("div",{className:"p-4 first:pt-0",children:[(0,i.jsx)("p",{className:"mt-0",children:t}),(0,i.jsx)("div",{className:"space-y-4",children:n})]})},du=function(e,n){var t=null===e||void 0===e?void 0:e[n];return"string"===typeof t?t:""},fu=function(e){var n,t,r,o,a,l,s,u,c,d,f=e.node,p=e.onChange,h=e.onSet,v=f.id,x=f.message,b=(0,eu.Z)(null===x||void 0===x?void 0:x.to,Array)?{}:null===x||void 0===x?void 0:x.to,y=function(e){return du(b,e)},C=(0,Es.kY)(),j=C.options,w=C.loading,N=C.setSearch,S=function(e){return function(e){return p({message:e})}({to:e})},k=function(e){return h((0,g.Z)((0,m.Z)({},f),{message:(0,m.Z)({},x,e)}))};return(0,i.jsxs)("main",{className:"divide-x-0 divide-y divide-solid divide-structure-default font-inter text-text-default",children:[(0,i.jsxs)(cu,{title:"Configure",children:[(0,i.jsx)(ts,{label:"User Id",value:y("user_id"),onChange:function(e){return k({to:(0,g.Z)((0,m.Z)({},null===x||void 0===x?void 0:x.to),{user_id:e.target.value})})}}),(0,i.jsx)(ts,{label:"Email",value:y("email"),onChange:function(e){return S({email:e.target.value})}}),(0,i.jsx)(ts,{label:"Phone Number",value:y("phone_number"),onChange:function(e){return S({phone_number:e.target.value})}}),(0,i.jsx)(ns,{className:"w-full",searchable:!0,clearable:!0,creatable:!0,createValidator:lu,name:"audience_id",label:"Audience",options:j,value:y("audience_id"),onChange:function(e){return S({audience_id:e})},onInputChange:N,loading:w}),(0,i.jsx)(ts,{label:"List Id",value:y("list_id"),onChange:function(e){return S({list_id:e.target.value})}}),(0,i.jsx)(ts,{label:"List Pattern",value:y("list_pattern"),onChange:function(e){return S({list_pattern:e.target.value})}}),(0,i.jsx)(uu,{title:"Data",json:null!==(n=null===x||void 0===x?void 0:x.data)&&void 0!==n?n:{},nodeId:v,setJson:function(e){return k({data:e})}}),(0,i.jsx)(uu,{title:"Preferences",json:null!==(t=null===b||void 0===b?void 0:b.preferences)&&void 0!==t?t:{},nodeId:v,setJson:function(e){return k({to:(0,g.Z)((0,m.Z)({},null===x||void 0===x?void 0:x.to),{preferences:e})})}})]}),(0,i.jsxs)(cu,{title:"Advanced",children:[(0,i.jsx)(ts,{label:"Brand ID",value:null===x||void 0===x?void 0:x.brand_id,onChange:function(e){return k({brand_id:e.target.value})}}),(0,i.jsx)(uu,{title:"Routing",json:null!==(r=null===x||void 0===x?void 0:x.routing)&&void 0!==r?r:{},nodeId:v,setJson:function(e){return k({routing:e})}}),(0,i.jsx)(uu,{title:"Channels",json:null!==(o=null===x||void 0===x?void 0:x.channels)&&void 0!==o?o:{},nodeId:v,setJson:function(e){return k({channels:e})}}),(0,i.jsx)(uu,{title:"Providers",json:null!==(a=null===x||void 0===x?void 0:x.providers)&&void 0!==a?a:{},nodeId:v,setJson:function(e){return k({providers:e})}}),(0,i.jsx)(uu,{title:"Metadata",json:null!==(l=null===x||void 0===x?void 0:x.metadata)&&void 0!==l?l:{},nodeId:v,setJson:function(e){return k({metadata:e})}}),(0,i.jsx)(uu,{title:"Timeout",json:null!==(s=null===x||void 0===x?void 0:x.timeout)&&void 0!==s?s:{},nodeId:v,setJson:function(e){return k({timeout:e})}}),(0,i.jsx)(uu,{title:"Delay",json:null!==(u=null===x||void 0===x?void 0:x.delay)&&void 0!==u?u:{},nodeId:v,setJson:function(e){return k({delay:e})}}),(0,i.jsx)(uu,{title:"Expiry",json:null!==(c=null===x||void 0===x?void 0:x.expiry)&&void 0!==c?c:{},nodeId:v,setJson:function(e){return k({expiry:e})}}),(0,i.jsx)(ts,{label:"Ref",value:null!==(d=f.ref)&&void 0!==d?d:"",onChange:function(e){return p({ref:e.target.value})}})]}),(0,i.jsx)(cu,{title:"Developer",children:(0,i.jsx)(uu,{title:"JSON",json:x,nodeId:v,setJson:function(e){return h((0,g.Z)((0,m.Z)({},f),{message:e}))}})})]})},pu=t(28316),hu=t(1899),vu=function(e){var n=e.className;
1return(0,i.jsx)("svg",{width:"8",height:"8",viewBox:"0 0 8 8",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:y()(n,"text-text-default"),children:(0,i.jsx)("path",{d:"M4.0025 6.9925C3.7425 6.9925 3.4925 6.8925 3.2925 6.7025L0.2925 3.7025C-0.0974998 3.3125 -0.0974999 2.6825 0.2925 2.2925C0.6825 1.9025 1.3125 1.9025 1.7025 2.2925L3.6425 4.2325C3.8425 4.4325 4.1525 4.4325 4.3525 4.2325L6.2925 2.2925C6.6825 1.9025 7.3125 1.9025 7.7025 2.2925C8.0925 2.6825 8.0925 3.3125 7.7025 3.7025L4.7025 6.7025C4.5025 6.9025 4.2525 6.9925 3.9925 6.9925L4.0025 6.9925Z",fill:"currentColor"})})},mu=function(e){var n=e.className;return(0,i.jsx)("svg",{width:"8",height:"8",viewBox:"0 0 8 8",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:y()("text-text-default",n),children:(0,i.jsx)("path",{d:"M4.0025 2.00018C3.7425 2.00018 3.4925 2.10018 3.2925 2.29018L0.2925 5.29018C-0.0974998 5.68018 -0.0974999 6.31018 0.2925 6.70018C0.6825 7.09018 1.3125 7.09018 1.7025 6.70018L3.6425 4.76018C3.8425 4.56018 4.1525 4.56018 4.3525 4.76018L6.2925 6.70018C6.6825 7.09018 7.3125 7.09018 7.7025 6.70018C8.0925 6.31018 8.0925 5.68018 7.7025 5.29018L4.7025 2.29018C4.5025 2.09018 4.2525 2.00018 3.9925 2.00018L4.0025 2.00018Z",fill:"currentColor"})})};function gu(){var e=(0,o.Z)(["\n  display: flex;\n  flex-direction: row;\n  align-items: center;\n  cursor: pointer;\n"]);return gu=function(){return e},e}var xu=u.default.div(gu()),bu=function(e){var n=e.className,t=e.title,r=e.children,o=e.caretClassName,a=e.isOpen,s=e.onExpandClick,u=(0,l.useRef)(),c=(0,l.useState)(!1),d=c[0],f=c[1],p=void 0!==a?a:d,h=s||function(){return f(!p)};(0,l.useEffect)((function(){u.current&&(0,gl.ZP)(u.current)}),[u]);var v=p?(0,i.jsx)(mu,{className:"ml-auto ".concat(o)}):(0,i.jsx)(vu,{className:"ml-auto ".concat(o)});return(0,i.jsxs)("div",{ref:u,className:n,children:[(0,i.jsxs)(xu,{onClick:h,children:[t,v]}),p&&r]})};function yu(){var e=(0,o.Z)(["\n  overflow-y: auto;\n  min-width: 432px;\n  max-width: 432px;\n\n  background: ",";\n  border-width: 0px 1px;\n  border-style: solid;\n  border-color: ",";\n"]);return yu=function(){return e},e}function Cu(){var e=(0,o.Z)(["\n  display: flex;\n  height: 72px;\n"]);return Cu=function(){return e},e}function ju(){var e=(0,o.Z)(["\n  display: flex;\n  align-items: center;\n  background-color: transparent;\n  border: none;\n  margin: auto 16px auto auto;\n  cursor: pointer;\n"]);return ju=function(){return e},e}function wu(){var e=(0,o.Z)(["\n  height: 40px;\n  display: flex;\n  background: ",";\n  padding-left: 24px;\n"]);return wu=function(){return e},e}function Nu(){var e=(0,o.Z)(["\n  width: 192px;\n  height: 40px;\n\n  font-family: ",";\n  font-style: normal;\n  font-weight: 400;\n  font-size: 12px;\n  line-height: 18px;\n  display: flex;\n  align-items: center;\n  letter-spacing: 0.2em;\n  text-transform: uppercase;\n\n  color: ",";\n"]);return Nu=function(){return e},e}function Su(){var e=(0,o.Z)(["\n  height: 447px;\n"]);return Su=function(){return e},e}function ku(){var e=(0,o.Z)(["\n  width: 384px;\n  height: 24px;\n\n  margin-top: 40px;\n  margin-left: 24px;\n\n  font-family: ",";\n  font-style: normal;\n  font-weight: 600;\n  font-size: 16px;\n  line-height: 24px;\n\n  display: flex;\n  align-items: center;\n"]);return ku=function(){return e},e}function _u(){var e=(0,o.Z)(["\n  height: 231px;\n  width: 367px;\n  margin-left: 24px;\n  margin-top: 16px;\n"]);return _u=function(){return e},e}function Zu(){var e=(0,o.Z)(["\n  padding: 16px;\n  font-family: ",";\n  color: ",";\n  display: flex;\n  flex-direction: column;\n  gap: 16px;\n  border-width: 1px 0px 0px;\n  border-style: solid;\n  border-color: ",";\n"]);return Zu=function(){return e},e}function Eu(){var e=(0,o.Z)(["\n  height: 40px;\n  padding: 8px 16px;\n  border-radius: 6px;\n  font-family: ",";\n  font-weight: 700;\n  font-size: 16px;\n  align-items: center;\n  color: ",";\n"]);return Eu=function(){return e},e}function Iu(){var e=(0,o.Z)(["\n  height: 48px;\n  border-width: 1px 0px 0px;\n  border-style: solid;\n  border-color: ",";\n  cursor: pointer;\n\n  font-family: ",";\n  font-weight: 600;\n  font-size: 16px;\n  display: flex;\n  align-items: center;\n"]);return Iu=function(){return e},e}function Ou(){var e=(0,o.Z)([""]);return Ou=function(){return e},e}function Tu(){var e=(0,o.Z)(["\n  border-width: 1px 0px 0px;\n  border-style: solid;\n  border-color: ",";\n"]);return Tu=function(){return e},e}function Au(){var e=(0,o.Z)(["\n  background: none;\n  border: none;\n  border-width: none;\n"]);return Au=function(){return e},e}function Du(){var e=(0,o.Z)(["\n  width: 192px;\n  height: 40px;\n\n  font-family: ",";\n  font-style: normal;\n  font-weight: 700;\n  font-size: 16px;\n  line-height: 16px;\n  display: flex;\n  align-items: center;\n"]);return Du=function(){return e},e}function Lu(){var e=(0,o.Z)(["\n  width: 150px;\n"]);return Lu=function(){return e},e}function Mu(){var e=(0,o.Z)(["\n  width: 176px;\n  font-size: 14px;\n  line-height: 16px;\n  font-family: ",";\n  font-weight: 700;\n"]);return Mu=function(){return e},e}function Pu(){var e=(0,o.Z)(["\n  width: 144px;\n"]);return Pu=function(){return e},e}function Ru(){var e=(0,o.Z)(["\n  padding-left: 40px;\n  font-size: 12px;\n  background: ",";\n"]);return Ru=function(){return e},e}function Fu(){var e=(0,o.Z)([""]);return Fu=function(){return e},e}function zu(){var e=(0,o.Z)(["\n  font-size: 14px;\n  line-height: 16px;\n  background: ",";\n  font-family: ",";\n  font-weight: 700;\n"]);return zu=function(){return e},e}
1Ra.z.div(yu(),(function(e){return e.theme.colors.nodeBackground}),(function(e){return e.theme.colors.border})),Ra.z.div(Cu()),Ra.z.button(ju());var Bu=Ra.z.div(wu(),(function(e){return e.theme.colors.nodeBackground})),Hu=Ra.z.div(Nu(),(function(e){return e.theme.fonts.title}),(function(e){return e.theme.colors.text})),Vu=Ra.z.div(Su()),$u=Ra.z.div(ku(),(function(e){return e.theme.fonts.title})),Uu=(0,Ra.z)(ui.default)(_u()),Wu=Ra.z.div(Zu(),(function(e){return e.theme.fonts.text}),(function(e){return e.theme.colors.text}),(function(e){return e.theme.colors.border})),qu=Ra.z.input(Eu(),(function(e){return e.theme.fonts.text}),(function(e){return e.theme.colors.text})),Ku=Ra.z.div(Iu(),(function(e){return e.theme.colors.border}),(function(e){return e.theme.fonts.title})),Gu=(0,Ra.z)(Ku)(Ou()),Ju=(0,Ra.z)(bu)(Tu(),(function(e){return e.theme.colors.border})),Xu=(0,Ra.z)(Ku)(Au()),Yu=Ra.z.div(Du(),(function(e){return e.theme.fonts.text})),Qu=(0,Ra.z)(Yu)(Lu()),ec=(0,Ra.z)(Yu)(Mu(),(function(e){return e.theme.fonts.text})),nc=(0,Ra.z)(ec)(Pu()),tc=(0,Ra.z)(Ku)(Ru(),(function(e){return e.theme.colors.nodeBackground})),rc=(0,Ra.z)(tc)(Fu()),oc=(0,Ra.z)(tc)(zu(),(function(e){return e.theme.colors.nodeBackground}),(function(e){return e.theme.fonts.text})),ic=t(38617),ac=t(59901),lc=function(e){var n=e.value,t=e.onChange,o=(0,ac.BN)(t,500),a=(0,l.useState)({json:n,selectedField:void 0,selectedNestedField:void 0}),s=a[0],u=a[1],c=s.json,d=s.selectedField,f=s.selectedNestedField;(0,l.useEffect)((function(){u((function(e){return(0,g.Z)((0,m.Z)({},e),{json:n})}))}),[n]);var p=function(e){u((function(n){return(0,g.Z)((0,m.Z)({},n),{json:e})})),o(e)},h=function(e){u((function(n){return(0,m.Z)({},n,e)})),e.json&&o(e.json)},x=function(e){h({selectedField:e,selectedNestedField:void 0})},b=Object.entries(null!==c&&void 0!==c?c:{}).map((function(e,n){var t=(0,r.Z)(e,2),o=t[0],a=t[1];if(void 0!==c[o]){var s=pc(c[o]),u=(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(Yu,{className:"pl-6 text-text-default",children:o}),(0,i.jsx)(Qu,{className:"pl-6 text-text-default",children:dc(c[o])}),(0,i.jsx)($l,{className:"ml-auto mr-4 hidden group-hover:block",onClick:function(){return function(e){var n=(0,m.Z)({},c);delete n[e],h({json:n,selectedField:void 0,selectedNestedField:void 0})}(o)}})]}),b=(0,i.jsx)(Ku,{className:"group bg-background-panels text-text-default",onClick:function(){return x(o)},children:u}),y=(0,i.jsx)(Xu,{className:"group text-text-default",onClick:function(){return x(o)},children:u});return(0,i.jsxs)(l.Fragment,{children:["object"!==s&&"array"!==s&&b,("object"===s||"array"===s)&&(0,i.jsx)(Ju,{caretClassName:"mr-6",title:y,children:(0,i.jsxs)(i.Fragment,{children:[Object.entries(c[o]).map((function(e,n){var t=(0,r.Z)(e,2),a=t[0],u=t[1],d=pc(u);return(0,i.jsxs)(l.Fragment,{children:[(0,i.jsxs)(oc,{className:"group text-text-subtext",onClick:function(){return function(e){h({selectedNestedField:e,selectedField:void 0})}(a)},children:[(0,i.jsx)(ec,{className:"text-text-subtext",children:"object"===s&&a}),(0,i.jsx)(nc,{className:"text-text-subtext",children:dc(c[o][a])}),(0,i.jsx)($l,{className:"mr-4 hidden group-hover:block",onClick:function(){return function(e,n){var t=(0,m.Z)({},c);(0,eu.Z)(t[e],Array)?t[e].splice(parseInt(n,10),1):delete t[e][n],h({json:t,selectedNestedField:void 0})}(o,a)}})]}),a===f&&(0,i.jsx)(cc,{name:a,type:d,value:u,typeOptions:gc,outerType:s,onNameChange:function(e){return function(e,n,t){var r=c[e];if(r){var o=(0,g.Z)((0,m.Z)({},c),(0,v.Z)({},e,hc(r,n,t)));h({selectedNestedField:t,json:o})}}(o,a,e)},onValueChange:function(e){if("array"===s){var n=(0,m.Z)({},c);return n[o][a]=e,void p(n)}p((0,g.Z)((0,m.Z)({},c),(0,v.Z)({},o,(0,g.Z)((0,m.Z)({},c[o]),(0,v.Z)({},a,e)))))}})]},n)})),(0,i.jsx)(rc,{className:"bg-table-row-even text-text-link",onClick:function(){return function(e){var n=vc.string,t=(0,m.Z)({},c),r=t[e],o="";if((0,eu.Z)(r,Array))r.push(n),o=(r.length-1).toString();else{var i=(0,g.Z)((0,m.Z)({},r),(0,v.Z)({},"",n));o="",t[e]=i}h({json:t,selectedNestedField:o,selectedField:void 0})}(o)},children:"+ Add nested field"})]})}),o===d&&(0,i.jsx)(cc,{name:o,type:s,value:a,typeOptions:mc,onNameChange:function(e){var n;h({json:hc(c,o,n=e),selectedField:n})},onValueChange:function(e){return p((0,g.Z)((0,m.Z)({},c),(0,v.Z)({},o,e)))}})]},n)}}));return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(Bu,{className:"border-0 border-t border-solid border-default",children:[(0,i.jsx)(Hu,{children:"FIELD NAME"}),(0,i.jsx)(Hu,{children:"VALUE"})]}),b,(0,i.jsx)(Gu,{className:"bg-table-row-even pl-6 text-text-link",onClick:function(){var e=vc.string,n=(0,m.Z)({},c);n[""]=e,h({json:n,selectedField:"",selectedNestedField:void 0})},children:"+ Add field"}),(0,i.jsx)(uc,{json:c,onChange:p})]})},sc=function(){var e=(0,Pa.Dv)(sl),n=e.json,t=e.setter;return(0,i.jsx)(lc,{value:n,onChange:t})},uc=function(e){var n=e.json,t=e.onChange,r=(0,l.useState)(JSON.stringify(n,null,2)),o=r[0],a=r[1];(0,l.useEffect)((function(){return a(JSON.stringify(n,null,2))}),[n]);var s=(0,ic.F)().resolvedTheme;return(0,i.jsxs)(Vu,{className:"border-0 border-t border-solid border-default",children:[(0,i.jsx)($u,{className:"text-text-default",children:"JSON Editor"}),(0,i.jsx)(Uu,{themeType:s,value:o,onChange:function(e){a(e);try{t(JSON.parse(e))}catch(n){}},options:{readOnly:!1}})]})},cc=function(e){var n=e.name,t=e.outerType,r=e.type,o=e.typeOptions,a=e.value,l=e.onValueChange,s=e.onNameChange;return(0,i.jsxs)(Wu,{className:"bg-background-panels",children:[(0,i.jsx)(ns,{placeholder:"Type",options:o,value:r,onChange:function(e){return l(vc[e])}}),"array"!==t&&(0,i.jsx)(qu,{className:"border border-solid border-default bg-background-field-input",placeholder:"Field Name",value:n,onChange:function(e){return s(e.target.value)}}),"null"!==r&&"object"!==r&&"array"!==r&&(0,i.jsx)(qu,{className:"border border-solid border-default bg-background-field-input",placeholder:"Value",value:dc(a),onChange:function(e){return l(fc(e.target.value,r))}})]})},dc=function(e){if(null===e)return"null";switch("undefined"===typeof e?"undefined":(0,hu.Z)(e)){case"number":case"bigint":case"boolean":return e.toString();case"object":return(0,eu.Z)(e,Array)?"[]":"{}";case"string":return e;default:return""}},fc=function(e,n){switch(n){case"string":return e.toString?e.toString():null;case"number":return isNaN(parseInt(e))?null:parseInt(e);case"object":case"array":try{return JSON.parse(e)}catch(t){return null}case"boolean":return"true"===e;case"null":return null;default:return e}},pc=function(e){if(null===e)return"null";switch("undefined"===typeof e?"undefined":(0,hu.Z)(e)){case"string":default:return"string";case"number":case"bigint":return"number";case"object":return Array.isArray(e)?"array":"object";case"boolean":return"boolean";case"undefined":return"null"}},hc=function(e,n,t){var r={};for(var o in e)o===n?r[t]=e[o]:r[o]=e[o];return r},vc={string:"",number:0,object:{},array:[],boolean:!1,null:null}
1,mc=[{value:"string",label:"String"},{value:"number",label:"Number"},{value:"object",label:"Object"},{value:"array",label:"Array"},{value:"boolean",label:"Boolean"},{value:"null",label:"Null"}],gc=[{value:"string",label:"String"},{value:"number",label:"Number"},{value:"boolean",label:"Boolean"},{value:"null",label:"Null"}],xc=function(e){var n=e.className;return(0,i.jsxs)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:y()(n,"text-icon-default"),children:[(0,i.jsx)("rect",{width:"24",height:"24",rx:"6",fill:"transparent"}),(0,i.jsx)("path",{d:"M17.7025 6.2925C17.3125 5.9025 16.6825 5.9025 16.2925 6.2925L12.3525 10.2325C12.1525 10.4325 11.8425 10.4325 11.6425 10.2325L7.7025 6.2925C7.3125 5.9025 6.6825 5.9025 6.2925 6.2925C5.9025 6.6825 5.9025 7.3125 6.2925 7.7025L10.2325 11.6425C10.4325 11.8425 10.4325 12.1525 10.2325 12.3525L6.2925 16.2925C5.9025 16.6825 5.9025 17.3125 6.2925 17.7025C6.6825 18.0925 7.3125 18.0925 7.7025 17.7025L11.6425 13.7625C11.8425 13.5625 12.1525 13.5625 12.3525 13.7625L16.2925 17.7025C16.6825 18.0925 17.3125 18.0925 17.7025 17.7025C18.0925 17.3125 18.0925 16.6825 17.7025 16.2925L13.7625 12.3525C13.5625 12.1525 13.5625 11.8425 13.7625 11.6425L17.7025 7.7025C18.0925 7.3125 18.0925 6.6825 17.7025 6.2925Z",fill:"currentColor"})]})},bc=function(e){var n=e.className;return(0,i.jsx)("svg",{width:"8",height:"12",viewBox:"0 0 8 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:y()("text-icon-default",n),children:(0,i.jsx)("path",{d:"M6.00031 12.0003C6.26031 12.0003 6.51031 11.9003 6.71031 11.7103C7.10031 11.3203 7.10031 10.6903 6.71031 10.3003L2.77031 6.36031C2.57031 6.16031 2.57031 5.85031 2.77031 5.65031L6.71031 1.71031C7.10031 1.32031 7.10031 0.690313 6.71031 0.300312C6.32031 -0.0896875 5.69031 -0.0896875 5.30031 0.300312L0.300312 5.30031C-0.0896875 5.69031 -0.0896875 6.32031 0.300312 6.71031L5.30031 11.7103C5.50031 11.9103 5.75031 12.0003 6.01031 12.0003H6.00031Z",fill:"currentColor"})})};function yc(){var e=(0,o.Z)(["\n  min-width: 432px;\n  max-width: 432px;\n  margin-right: -432px;\n\n  transition: 200ms;\n  transition-property: margin, visibility;\n  transition-timing-function: ease-in;\n\n  &.show {\n    margin-right: 0;\n    visibility: visible;\n    transition-duration: 250ms;\n    transition-timing-function: ease-out;\n  }\n"]);return yc=function(){return e},e}function Cc(){var e=(0,o.Z)(["\n  visibility: visible;\n  margin-left: 0;\n  transition: 200ms;\n  width: 100%;\n\n  &.hide {\n    margin-left: -432px;\n    visibility: hidden;\n  }\n"]);return Cc=function(){return e},e}function jc(){var e=(0,o.Z)(["\n  visibility: visible;\n  margin-right: 0px;\n  transition: 200ms;\n  width: 100%;\n\n  &.hide {\n    margin-right: -432px;\n    visibility: hidden;\n  }\n"]);return jc=function(){return e},e}var wc=u.default.div(yc()),Nc=u.default.div(Cc()),Sc=u.default.div(jc()),kc=function(e){var n=e.children,t=(0,Pa.Dv)(ul);return(0,i.jsx)(wc,{id:"automations-v2-sidebar",className:y()("z-10 overflow-y-auto overflow-x-hidden border-0 border-l border-solid border-default bg-background-panels text-text-default",t.show&&"show"),children:n})},_c=function(e){var n=e.title,t=e.back,r=(0,Pa.b9)(ul),o=(0,Pa.b9)(ll);return(0,i.jsxs)("header",{className:"flex items-center justify-between p-4 pr-2",children:[(0,i.jsx)("div",{children:(0,i.jsxs)("div",{className:"flex items-center",children:[t&&(0,i.jsx)("button",{className:"flex cursor-pointer items-center border-0 bg-transparent p-0",onClick:function(){return o(!1)},children:(0,i.jsx)(bc,{className:"mr-2"})}),(0,i.jsx)("h3",{className:"m-0 font-inter text-lg font-semibold",children:n})]})}),(0,i.jsx)("button",{className:"flex cursor-pointer items-center border-0 bg-transparent",onClick:function(){return r({show:!1,id:null}),void o(!1)},children:(0,i.jsx)(xc,{className:"hover:rounded-[6px]"})})]})},Zc=function(e){var n=e.title,t=e.children,r=e.back,o=document.getElementById("automations-v2-sidebar");return pu.createPortal((0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(_c,{title:n,back:r}),t]}),o)},Ec=function(e){var n,t=e.children,r=e.nodeId,o=e.toggle,a=(0,Pa.Dv)(ll),l=(0,Pa.Dv)(ul);return l.id!==r?null:(0,i.jsx)(Zc,{title:null!==(n=null===l||void 0===l?void 0:l.title)&&void 0!==n?n:"JSON",back:o&&!!a,children:(0,i.jsxs)("div",{className:"flex",children:[t&&(0,i.jsx)(Nc,{className:a&&"hide",children:t}),(0,i.jsx)(Sc,{className:!a&&"hide",children:a&&(0,i.jsx)(sc,{})})]})})},Ic="user",Oc="list",Tc="json",Ac=function(e){var n,t=e.isConnectable,o=e.id,a=e.data,s=(0,l.useRef)(),u=a.node,c=u.message,d=null!==(n=null===c||void 0===c?void 0:c.to)&&void 0!==n?n:{},f=(0,Es.ew)(),p=(0,r.Z)((0,Pa.KO)(ul),2),h=p[0],x=p[1];(0,l.useEffect)((function(){s.current&&(0,gl.ZP)(s.current)}),[s]);var b,y=function(){var e=!h.show;x({show:e,id:e?null===u||void 0===u?void 0:u.id:null,title:e?"Send":null})};return(0,i.jsxs)(nu,{isConnectable:t,parentRef:s,children:[(0,i.jsx)(au,{title:"Send",id:o}),((0,eu.Z)(d,Array)||Object.keys(d).length>0)&&(0,i.jsx)(Lc,{nodeId:null===u||void 0===u?void 0:u.id,onRecipientChange:function(e){c&&a.onSet((0,g.Z)((0,m.Z)({},u),{message:(0,g.Z)((0,m.Z)({},c),{to:e})}))},recipient:d}),(0,i.jsx)(tu,{className:"h-[72px]",children:(0,i.jsx)(ns,{className:"w-full",placeholder:"Select a template...",options:f,value:"object"===typeof(null===c||void 0===c?void 0:c.template)?"See advanced JSON":null!==(b=null===c||void 0===c?void 0:c.template)&&void 0!==b?b:"",name:"template",searchable:!0,clearable:!0,creatable:!0,createValidator:lu,onChange:function(e){!function(e,n){c&&a.onChange({message:(0,v.Z)({},e,n)})}("template",e)}})}),(0,i.jsxs)(tu,{className:"h-14 cursor-pointer items-center",onClick:y,children:[(0,i.jsx)("span",{className:"font-inter text-sm font-semibold text-text-default",children:"Advanced"}),(0,i.jsx)(iu,{nodeId:null===u||void 0===u?void 0:u.id,toggleEditor:y})]}),(0,i.jsx)(Ec,{nodeId:null===u||void 0===u?void 0:u.id,toggle:!0,children:(0,i.jsx)(fu,{node:u,onCh
1ange:a.onChange,onSet:a.onSet})})]})};Ac.displayName="SendNode";var Dc=(0,l.memo)(Ac),Lc=function(e){var n,t,r=e.nodeId,o=e.onRecipientChange,a=e.recipient,s=(0,l.useState)(Mc(a)),u=s[0],c=s[1],d=function(e){c(e)};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(tu,{children:[(0,i.jsx)(ru,{children:"To:"}),(0,i.jsxs)(os,{children:[(0,i.jsx)(is,{onClick:function(){return d(Ic)},text:"User",selected:u===Ic}),(0,i.jsx)(is,{onClick:function(){return d(Oc)},text:"List",selected:u===Oc}),(0,i.jsx)(is,{onClick:function(){return d(Tc)},text:"JSON",selected:u===Tc})]})]}),(0,i.jsxs)(tu,{className:"h-14 border-0 pt-0",children:[u===Ic&&(0,i.jsx)(ts,{placeholder:"Enter ID...",value:null!==(n=null===a||void 0===a?void 0:a.user_id)&&void 0!==n?n:"",onChange:function(e){var n=(0,eu.Z)(a,Array)?{}:a;o((0,g.Z)((0,m.Z)({},n),{user_id:e.target.value}))}}),u===Oc&&(0,i.jsx)(ts,{placeholder:"Enter ID...",value:null!==(t=null===a||void 0===a?void 0:a.list_id)&&void 0!==t?t:"",onChange:function(e){var n=(0,eu.Z)(a,Array)?{}:a;o((0,g.Z)((0,m.Z)({},n),{list_id:e.target.value}))}}),u===Tc&&(0,i.jsx)("div",{className:"w-full",children:(0,i.jsx)(uu,{title:"Recipient",nodeId:r,json:null!==a&&void 0!==a?a:{},setJson:o})})]})]})},Mc=function(e){return(0,eu.Z)(e,Array)||Object.keys(e).length>0?Tc:"list_id"in e?Oc:"user_id"in e?Ic:Tc};function Pc(){var e=(0,o.Z)(["\n  display: flex;\n  flex-direction: column;\n  align-items: flex-start;\n  padding: 0px;\n  box-sizing: border-box;\n\n  /* Decoration */\n  background: ",";\n  border: 1px solid ",";\n  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);\n  border-radius: 8px;\n  font-family: ",";\n  color: ",";\n\n  & > * {\n    border-top: 1px solid ",";\n  }\n\n  & > *:first-child {\n    border-top: none;\n  }\n"]);return Pc=function(){return e},e}var Rc=Ra.z.div(Pc(),(function(e){return e.theme.colors.nodeBackground}),(function(e){return e.theme.colors.border}),(function(e){return e.theme.fonts.text}),(function(e){return e.theme.colors.text}),(function(e){return e.theme.colors.border})),Fc=[{label:"Min(s)",value:"minutes"},{label:"Hour(s)",value:"hours"},{label:"Day(s)",value:"days"},{label:"Week(s)",value:"weeks"},{label:"Month(s)",value:"months"},{label:"Year(s)",value:"years"}];function zc(){var e=(0,o.Z)(["\n  display: flex;\n  gap: 8px;\n"]);return zc=function(){return e},e}var Bc=function(e){var n=e.isConnectable,t=e.targetPosition,r=void 0===t?Ma.Ly.Top:t,o=e.sourcePosition,a=void 0===o?Ma.Ly.Bottom:o,s=e.id,u=e.data,c=u.node,d=(0,l.useState)(Vc(c)),f=d[0],p=d[1],h=function(e){return u.onChange((0,m.Z)({until:void 0,duration:void 0},e))};return(0,i.jsxs)(Rc,{children:[(0,i.jsx)(au,{title:"Delay",id:s}),(0,i.jsxs)(Dl,{className:"flex flex-row",children:[(0,i.jsx)(ns,{className:"w-48",label:"Type",value:f,options:qc,onChange:function(e){p(e),h("duration"===e?{duration:"1 days"}:{duration:"",until:""})}}),"until"===f&&(0,i.jsx)("div",{className:"w-72",children:(0,i.jsx)(Gl,{value:c.until,onChange:function(e){return h({until:e})}})}),"dynamic-until"===f&&(0,i.jsx)("div",{className:"w-72",children:(0,i.jsx)(ts,{label:"",placeholder:"refs.data.until",value:c.until,onChange:function(e){return h({until:e.target.value})}})}),"duration"===f&&(0,i.jsx)(Hc,{duration:c.duration,onChange:function(e){return h({duration:e})}}),"dynamic-duration"===f&&(0,i.jsx)("div",{className:"w-72",children:(0,i.jsx)(ts,{label:"",placeholder:"refs.data.duration",value:c.duration,onChange:function(e){return h({duration:e.target.value})}})})]}),(0,i.jsx)(Ya,{position:r,isConnectable:n}),(0,i.jsx)(Ga,{position:a,isConnectable:n})]})},Hc=function(e){var n=e.duration,t=e.onChange,o=(0,l.useState)("1"),a=o[0],s=o[1],u=(0,l.useState)("days"),c=u[0],d=u[1];(0,l.useEffect)((function(){var e=(0,r.Z)(Uc(n),2),t=e[0],o=e[1];s(t),d(o)}),[n]);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("div",{className:"w-16",children:(0,i.jsx)(ts,{label:"",value:a,onChange:function(e){return function(e){if(s(e),e.length){var n="".concat(e," ").concat(c);t(n)}}(e.target.value)}})}),(0,i.jsx)(ns,{className:"w-36",value:c,label:"",options:Fc,onChange:function(e){d(e);var n="".concat(a," ").concat(e);t(n)}})]})},Vc=(u.default.div(zc()),function(e){return"string"!==typeof(n=e.until)||isNaN(Date.parse(n))?"string"===typeof e.until&&e.until.length?"dynamic-until":$c(e.duration)?"duration":"dynamic-duration":"until";var n}),$c=function(e){return"string"===typeof e&&Wc.test(e)},Uc=function(e){var n,t=(0,r.Z)(null!==(n=null===e||void 0===e?void 0:e.match(Wc))&&void 0!==n?n:[],3);return[t[1],t[2]]},Wc=new RegExp(/(\d*\.?\d+)\s+(days?|hours?|minutes?|months?|weeks?|years?)/),qc=[{label:"Duration",value:"duration"},{label:"Until",value:"until"},{label:"Dynamic Duration",value:"dynamic-duration"},{label:"Dynamic Until",value:"dynamic-until"}],Kc=(0,l.memo)(Bc),Gc=function(e){var n,t=e.isConnectable,r=e.targetPosition,o=void 0===r?Ma.Ly.Top:r,a=e.s
1ourcePosition,l=void 0===a?Ma.Ly.Bottom:a,s=e.id,u=e.data,c=u.node,d=u.onChange,f=null!==(n=c.condition)&&void 0!==n?n:ed(),p="simple"===f.condition_type?f.source:"js",h=function(e){if("simple"!==f.condition_type)return d({condition:(0,m.Z)({},ed(),e)});d({condition:(0,m.Z)({},f,e)})},v=function(e){if("js"!==f.condition_type)return d({condition:(0,m.Z)({condition_type:"js",expression:""},e)});d({condition:(0,m.Z)({},f,e)})};return(0,i.jsxs)(Rc,{children:[(0,i.jsx)(au,{title:"If",id:s}),(0,i.jsxs)(Dl,{className:"flex flex-col",children:[(0,i.jsx)(ns,{className:"w-full",options:nd,value:p,name:"source",label:"Source",onChange:function(e){return function(e){if("js"===e)return v({condition_type:"js"});h({source:e})}(e)}}),"simple"===f.condition_type&&(0,i.jsx)(Yc,{condition:f,onChange:h}),"js"===f.condition_type&&(0,i.jsx)(Xc,{condition:f,onChange:v})]}),(0,i.jsx)(Ya,{position:o,isConnectable:t}),(0,i.jsx)(Qc,{}),(0,i.jsx)(Ga,{position:l,isConnectable:t,left:"25%",id:"false"}),(0,i.jsx)(Ga,{position:l,isConnectable:t,left:"75%",id:"true"})]})},Jc=(0,l.memo)(Gc),Xc=function(e){var n=e.condition,t=e.onChange;return(0,i.jsx)(ts,{label:"Expression",value:n.expression,onChange:function(e){return t({expression:e.target.value})}})},Yc=function(e){var n=e.condition,t=e.onChange;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(ts,{label:"ref"===n.source?"Ref":"Field",value:n.field,onChange:function(e){return t({field:e.target.value})}}),(0,i.jsx)(ns,{className:"w-full",options:td,value:n.operator,name:"comparison",label:"Comparison",onChange:function(e){return t({operator:e})}}),(0,i.jsx)(ts,{label:"Value",value:n.value,onChange:function(e){return t({value:e.target.value})}})]})},Qc=function(){return(0,i.jsxs)("div",{className:"flex w-full justify-between",children:[(0,i.jsx)("div",{className:"flex basis-1/2 justify-center py-5",children:(0,i.jsx)("span",{children:"False"})}),(0,i.jsx)("div",{className:"flex basis-1/2 justify-center py-5",children:(0,i.jsx)("span",{children:"True"})})]})},ed=function(){return{condition_type:"simple",source:"data",operator:"eq",field:"",value:""}},nd=[{label:"Data",value:"data"},{label:"Profile",value:"profile"},{label:"Step Ref",value:"ref"},{label:"JS Condition",value:"js"}],td=[{label:"is",value:"eq"},{label:"is not",value:"neq"},{label:"is greater than",value:"gt"},{label:"is greater than or equal to",value:"gte"},{label:"is less than",value:"lt"},{label:"is less than or equal to",value:"lte"},{label:"is one of",value:"one_of"},{label:"contains",value:"contains"},{label:"does not contain",value:"not_contains"}],rd=function(e,n){var t=e.checked,r=e.disabled,o=e.label,a=e.name,l=e.onChange;return(0,i.jsxs)("div",{className:"flex items-center py-sm",children:[(0,i.jsx)("input",{ref:n,checked:t,className:y()("cursor-pointer","!form-checkbox m-0 h-6 w-6 rounded-sm border border-solid border-default bg-background-default text-status-active checked:border-0 focus:ring-status-active disabled:bg-background-field-disabled disabled:checked:border disabled:checked:bg-status-disabled"),disabled:r,id:o,name:a,onChange:l,type:"checkbox"}),(0,i.jsx)("label",{htmlFor:o,className:"ml-lg flex cursor-pointer items-center text-button",children:o})]})},od=(0,l.forwardRef)(rd),id=function(e){var n=e.isConnectable,t=e.targetPosition,r=void 0===t?Ma.Ly.Top:t,o=e.sourcePosition,a=void 0===o?Ma.Ly.Bottom:o,l=e.id,s=e.data,u=s.node;return(0,i.jsxs)(Rc,{children:[(0,i.jsx)(au,{title:"Invoke Automation",id:l}),(0,i.jsxs)(Dl,{children:[(0,i.jsx)(ts,{label:"Automation ID",value:u.template_id,onChange:function(e){s.onChange({template_id:e.target.value})}}),(0,i.jsx)("div",{className:"mt-1",children:(0,i.jsx)(od,{checked:u.passContext,name:"passContext",onChange:function(e){s.onChange({passContext:e.target.checked})},label:"Pass run context"})})]}),(0,i.jsx)(Ya,{position:r,isConnectable:n}),(0,i.jsx)(Ga,{position:a,isConnectable:n})]})};id.displayName="InvokeAutomationNode";var ad=(0,l.memo)(id),ld=function(e){var n=e.isConnectable,t=e.targetPosition,r=void 0===t?Ma.Ly.Top:t,o=e.sourcePosition,a=void 0===o?Ma.Ly.Bottom:o,l=e.id,s=e.data,u=s.node,c=s.onChange,d=u.cancelation_token,f=u.ref;return(0,i.jsxs)(Rc,{children:[(0,i.jsx)(au,{title:"Cancel Automation",id:l}),(0,i.jsxs)(Dl,{className:"flex flex-col",children:[(0,i.jsx)(ts,{label:"Token",value:d,onChange:function(e){return c({cancelation_token:e.target.value})}}),u.ref&&(0,i.jsx)(ts,{label:"Reference",value:f,onChange:function(e){return c({ref:e.target.value})}})]}),(0,i.jsx)(Ya,{position:r,isConnectable:n}),(0,i.jsx)(Ga,{position:a,isConnectable:n})]})};
1ld.displayName="CancelAutomationNode";var sd=(0,l.memo)(ld);function ud(){var e=(0,o.Z)(["\n  font-size: 18px;\n"]);return ud=function(){return e},e}function cd(){var e=(0,o.Z)(["\n  display: flex;\n  align-items: center;\n  gap: 12px;\n"]);return cd=function(){return e},e}var dd=[{label:"GET",value:"get"},{label:"POST",value:"post"}],fd=[{label:"Replace",value:"replace"},{label:"Overwrite",value:"overwrite"},{label:"Soft Merge",value:"soft-merge"},{label:"None",value:"none"}],pd=function(e){var n,t,r,o,a,l,s,u,c=e.isConnectable,d=e.targetPosition,f=void 0===d?Ma.Ly.Top:d,p=e.sourcePosition,h=void 0===p?Ma.Ly.Bottom:p,v=e.id,x=e.data,b=x.node,y=x.onSet,C=b.method,j=b.merge_strategy,w=b.idempotency_expiry,N=b.idempotency_key,S=null!==(t=null===(n=b.payload)||void 0===n?void 0:n.value)&&void 0!==t?t:{},k=x.onChange;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(Rc,{children:[(0,i.jsx)(au,{title:"Fetch Data",id:v}),(0,i.jsxs)(Vl,{className:"nowheel",children:[(0,i.jsxs)(Dl,{className:"flex flex-col",children:[(0,i.jsx)(hd,{className:"font-inter text-sm font-semibold text-text-default",children:"API"}),(0,i.jsxs)(vd,{children:[(0,i.jsx)(ns,{className:"w-48",options:dd,value:C,onChange:function(e){return k({method:e})},placeholder:"Method"}),(0,i.jsx)(ts,{label:"URL",value:b.url,onChange:function(e){return k({url:e.target.value})}})]}),(0,i.jsx)(uu,{title:"Query Params",json:null!==(o=null!==(r=b.query_params)&&void 0!==r?r:S.params)&&void 0!==o?o:{},nodeId:null===b||void 0===b?void 0:b.id,setJson:function(e){return y((0,g.Z)((0,m.Z)({},b),{query_params:e}))}}),(0,i.jsx)(uu,{title:"Headers",json:null!==(l=null!==(a=b.headers)&&void 0!==a?a:S.headers)&&void 0!==l?l:{},nodeId:null===b||void 0===b?void 0:b.id,setJson:function(e){return y((0,g.Z)((0,m.Z)({},b),{headers:e}))}}),"post"===C&&(0,i.jsx)(uu,{title:"Body",json:null!==(u=null!==(s=b.body)&&void 0!==s?s:S.body)&&void 0!==u?u:{},nodeId:null===b||void 0===b?void 0:b.id,setJson:function(e){return y((0,g.Z)((0,m.Z)({},b),{body:e}))}}),(0,i.jsx)(ns,{className:"w-full",options:fd,value:j,onChange:function(e){return k({merge_strategy:e})},label:"Merge Strategy"})]}),(0,i.jsxs)(Dl,{className:"flex flex-col",children:[(0,i.jsx)(hd,{className:"font-inter text-sm font-semibold text-text-default",children:"Idempotency"}),(0,i.jsx)(ts,{label:"Key",value:N,onChange:function(e){return k({idempotency_key:e.target.value})}}),(0,i.jsx)(Gl,{label:"Expiry",value:w,onChange:function(e){return k({idempotency_expiry:e})}})]}),(0,i.jsx)(Ya,{position:f,isConnectable:c}),(0,i.jsx)(Ga,{position:h,isConnectable:c})]})]}),(0,i.jsx)(Ec,{nodeId:null===b||void 0===b?void 0:b.id})]})},hd=u.default.label(ud()),vd=u.default.div(cd());pd.displayName="FetchDataNode";var md=(0,l.memo)(pd),gd=function(e){var n,t,r,o=e.isConnectable,a=e.targetPosition,l=void 0===a?Ma.Ly.Top:a,s=e.sourcePosition,u=void 0===s?Ma.Ly.Bottom:s,c=e.id,d=e.data,f=(0,Es.ew)(),p=d.node,h=null!==(n=p.data)&&void 0!==n?n:{},v=d.onChange;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(Rc,{children:[(0,i.jsx)(au,{title:"Send to List",id:c}),(0,i.jsxs)(Dl,{className:"flex flex-col",children:[(0,i.jsx)(ns,{className:"w-full",options:f,label:"Notification",value:null!==(r=null!==(t=p.template_id)&&void 0!==t?t:p.template)&&void 0!==r?r:"",name:"notifications",searchable:!0,clearable:!0,creatable:!0,createValidator:lu,onChange:function(e){return v({template_id:e})}}),(0,i.jsx)(ts,{label:"List ID",value:p.list_id,onChange:function(e){return v({list_id:e.target.value})}})]}),(0,i.jsx)(Dl,{children:(0,i.jsx)(uu,{title:"Data",json:null!==h&&void 0!==h?h:{},nodeId:null===p||void 0===p?void 0:p.id,setJson:function(e){d.onSet((0,g.Z)((0,m.Z)({},p),{data:e}))}})}),(0,i.jsx)(xd,{node:p,handleChange:v,handleOverrideChange:function(e){d.onSet((0,g.Z)((0,m.Z)({},p),{override:e}))}}),(0,i.jsx)(Ya,{position:l,isConnectable:o}),(0,i.jsx)(Ga,{position:u,isConnectable:o})]}),(0,i.jsx)(Ec,{nodeId:null===p||void 0===p?void 0:p.id})]})},xd=function(e){var n=e.handleChange,t=e.handleOverrideChange,r=e.node,o=(0,Es.HG)(),a=r.override;return(0,i.jsx)(Dl,{children:(0,i.jsx)(bu,{title:(0,i.jsx)("span",{className:"pl-2 font-inter text-sm font-semibold text-text-default",children:"Advanced"}),children:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(Bl,{className:"flex",children:(0,i.jsx)(ns,{className:"w-full",options:o,label:"Brand ID",value:r.brand_id,name:"brands",searchable:!0,clearable:!0,creatable:!0,createValidator:lu,onChange:function(e){return n({brand_id:e})}})}),(0,i.jsx)(Bl,{className:"flex",children:(0,i.jsx)(ts,{label:"Idempotency Key",value:r.
1idempotency_key,onChange:function(e){return n({idempotency_key:e.target.value})}})}),(0,i.jsx)(Bl,{className:"flex",children:(0,i.jsx)(ts,{label:"Idempotency Expiry",value:r.idempotency_expiry,onChange:function(e){return n({idempotency_expiry:e.target.value})}})}),(0,i.jsx)(Bl,{className:"flex",children:(0,i.jsx)(ts,{label:"Filter",value:r.filter,onChange:function(e){return n({filter:e.target.value})}})}),(0,i.jsx)(Bl,{children:(0,i.jsx)(uu,{title:"Override",json:null!==a&&void 0!==a?a:{},nodeId:null===r||void 0===r?void 0:r.id,setJson:t})})]})})})};gd.displayName="SendToListNode";var bd=(0,l.memo)(gd),yd=function(e){var n,t=e.isConnectable,r=e.targetPosition,o=void 0===r?Ma.Ly.Top:r,a=e.sourcePosition,l=void 0===a?Ma.Ly.Bottom:a,s=e.id,u=e.data,c=u.node,d=u.onSet,f=c.list_id,p=c.recipient_id,h=u.onChange;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(Rc,{children:[(0,i.jsx)(au,{title:"Subscribe to List",id:s}),(0,i.jsxs)(Dl,{className:"flex flex-col",children:[(0,i.jsx)(ts,{label:"Recipient ID",value:p,onChange:function(e){return h({recipient_id:e.target.value})}}),(0,i.jsx)(ts,{label:"List ID",value:f,onChange:function(e){return h({list_id:e.target.value})}})]}),(0,i.jsx)(Dl,{children:(0,i.jsx)(uu,{title:"Preferences",json:null!==(n=c.preferences)&&void 0!==n?n:{},nodeId:null===c||void 0===c?void 0:c.id,setJson:function(e){return d((0,g.Z)((0,m.Z)({},c),{preferences:e}))}})}),(0,i.jsx)(Ya,{position:o,isConnectable:t}),(0,i.jsx)(Ga,{position:l,isConnectable:t})]}),(0,i.jsx)(Ec,{nodeId:null===c||void 0===c?void 0:c.id})]})};yd.displayName="SubscribeToListNode";var Cd=(0,l.memo)(yd),jd=function(e){var n,t,r=e.isConnectable,o=e.targetPosition,a=void 0===o?Ma.Ly.Top:o,l=e.sourcePosition,s=void 0===l?Ma.Ly.Bottom:l,u=e.id,c=e.data,d=c.node,f=c.onSet,p=c.onChange;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(Rc,{children:[(0,i.jsx)(au,{title:"Update Profile",id:u}),(0,i.jsx)(Dl,{children:(0,i.jsx)(uu,{title:"Profile",json:null!==(n=d.profile)&&void 0!==n?n:{},nodeId:null===d||void 0===d?void 0:d.id,setJson:function(e){return f((0,g.Z)((0,m.Z)({},d),{profile:e}))}})}),(0,i.jsxs)(Dl,{className:"flex flex-col",children:[(0,i.jsx)(ts,{label:"Recipient ID",value:null!==(t=d.user_id)&&void 0!==t?t:d.recipient_id,onChange:function(e){return p({user_id:e.target.value})}}),(0,i.jsx)(ns,{label:"Merge Strategy",options:[{value:"replace",label:"Replace"},{value:"soft-merge",label:"Soft Merge"},{value:"overwrite",label:"Overwrite"},{value:"none",label:"None"}],value:d.merge_strategy,onChange:function(e){return p({merge_strategy:e})}})]}),(0,i.jsx)(Ya,{position:a,isConnectable:r}),(0,i.jsx)(Ga,{position:s,isConnectable:r})]}),(0,i.jsx)(Ec,{nodeId:null===d||void 0===d?void 0:d.id})]})};jd.displayName="UpdateProfileNode";var wd=(0,l.memo)(jd),Nd=function(e){var n=e.isConnectable,t=e.targetPosition,r=void 0===t?Ma.Ly.Top:t,o=e.sourcePosition,a=void 0===o?Ma.Ly.Bottom:o,l=e.id,s=e.data,u=s.node,c=(0,Es.vF)();return(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)(Rc,{children:[(0,i.jsx)(au,{title:"Add to Digest",id:l}),(0,i.jsx)(Dl,{children:(0,i.jsx)(ns,{label:"Subscription topic",options:c,value:null===u||void 0===u?void 0:u.subscription_topic_id,onChange:function(e){s.onChange({subscription_topic_id:e})}})}),(0,i.jsx)(Ya,{position:r,isConnectable:n}),(0,i.jsx)(Ga,{position:a,isConnectable:n})]})})};Nd.displayName="AddToDigest";var Sd=(0,l.memo)(Nd),kd=t(43675),_d=function(e){var n=e.label,t=e.value,r=e.onChange,o=e.className,a=e.min,s=e.max,u=(0,l.useState)(String(t)),c=u[0],d=u[1];(0,l.useEffect)((function(){d(String(t))}),[t]);var f=(0,ac.RR)((function(e){var n=Number(e);return Number.isNaN(n)?r(t):"undefined"!==typeof a&&n<a?r(a):"undefined"!==typeof s&&n>s?r(s):void r(n)}),1e3);return(0,i.jsx)(ts,{className:o,label:n,value:c,onChange:function(e){var n=e.target.value;d(n),f(n)}})},Zd=function(e){var n=e.label,t=e.value,r=e.onChange,o=e.options,a=void 0===o?Od:o,l=Ed(t),s=l.unit,u=l.count;return(0,i.jsxs)("div",{className:"flex",children:[(0,i.jsx)("div",{className:"mr-2 w-3/5",children:(0,i.jsx)(_d,{value:Number(u),onChange:function(e){var n=(0,v.Z)({},s,e);r((0,kd.Jv)(n))},label:n,className:"overflow-hidden"})}),(0,i.jsx)(ns,{value:s,label:"",options:a,className:"w-2/5",onChange:function(e){var n=(0,v.Z)({},e,u);r((0,kd.Jv)(n))}})]})},Ed=function(e){var n=(0,kd.RA)(e);if(n&&"P"!==e){var t=(0,r.Z)(Id(n),2),o=t[0],i=t[1];return{unit:o,count:String(i)}}return{unit:"minutes",count:"1"}},Id=function(e){var n;return null!==(n=Object.entries(e).find(Boolean))&&void 0!==n?n:["minutes",1]},Od=[{label:"Min(s)",value:"minutes"},{label:"Hour(s)",value:"hours"},{label:"Day(s)",value:"days"},{label:"Month(s)",value:"months"}],Td=function(e){var n=e.rows,t=e.onClick;return(0,i.jsx)("div",{className:"w-full",onClick:t,children:n.map((function(e,n){return(0,i.jsx)(Ad,{row:e,index:n},n)}))})},Ad=function(e){var n=e.row,t=e.index,r=(0,rs.m6)("flex even:bg-table-row-odd odd:bg-table-row-even","border-0 border-b border-solid border-default last:border-0");return(0,i.jsx)("div",{className:r,children:n.map((function(e,n){return(0,i.jsx)(Dd,{cell:e,index:n},n)}))},t)},Dd=function(e){var n=e.cell,t=e.index,r=(0,rs.m6)("flex-1 p-4","border-0 border-r border-solid border-default last:border-0");return(0,i.jsx)("div",{className:r,children:n},t)},Ld=function(e){var n=e.isConnectable,t=e.targetPosition,o=void 0===t?Ma.Ly.Top:t,a=e.sourcePosition,l=void 0===a?Ma.Ly.Bottom:a,s=e.id,u=e.data,c=u.node,d=u.onCh
1ange,f=(0,r.Z)((0,Pa.KO)(ul),2),p=f[0],h=f[1],v=function(e){var n,t,r,o=null!==(t=(0,kd.Il)(e.wait_period))&&void 0!==t?t:"1 minute",a=null!==(r=(0,kd.Il)(e.max_wait_period))&&void 0!==r?r:"1 hour",l="".concat(o," \u2192 ").concat(a),s=[[(0,i.jsx)(Rd,{label:"WAIT PERIOD"}),(0,i.jsx)(Fd,{value:l})],[(0,i.jsx)(Rd,{label:"RETAIN ITEMS"}),(0,i.jsx)(Fd,{value:e.retain?"".concat(e.retain.type.charAt(0).toLocaleUpperCase()+e.retain.type.slice(1)," ").concat(e.retain.count):"First 10"})]];"undefined"!==typeof(null===(n=e.retain)||void 0===n?void 0:n.sort_key)&&["highest","lowest"].includes(e.retain.type)&&s.push([(0,i.jsx)(Rd,{label:"SORT KEY"}),(0,i.jsx)(Fd,{value:e.retain.sort_key})]);"undefined"!==typeof e.max_items&&s.push([(0,i.jsx)(Rd,{label:"MAX ITEMS"}),(0,i.jsx)(Fd,{value:String(e.max_items)})]);e.category_key&&s.push([(0,i.jsx)(Rd,{label:"CATEGORY KEY"}),(0,i.jsx)(Fd,{value:String(e.category_key)})]);return s}(c);return(0,i.jsxs)(Rc,{className:"overflow-hidden",children:[(0,i.jsx)(au,{title:"Batch",id:s}),(0,i.jsx)(Pd,{node:c,onPartialChange:d}),(0,i.jsx)(Td,{rows:v,onClick:function(){var e=!p.show;h({show:e,id:e?s:null,title:e?"Batch settings":null})}}),(0,i.jsx)(Ya,{position:o,isConnectable:n}),(0,i.jsx)(Ga,{position:l,isConnectable:n})]})};Ld.displayName="AddToDigest";var Md=(0,l.memo)(Ld),Pd=function(e){var n,t,r,o,a=e.node,l=e.onPartialChange;return(0,i.jsx)(Ec,{nodeId:null===a||void 0===a?void 0:a.id,toggle:!0,children:(0,i.jsxs)(Vd,{children:[(0,i.jsx)(Zd,{label:"Wait Period",value:a.wait_period,onChange:function(e){return l({wait_period:e})}}),(0,i.jsx)(Zd,{label:"Max Wait",value:a.max_wait_period,onChange:function(e){return l({max_wait_period:e})}}),(0,i.jsx)(zd,{retain:a.retain,onChange:function(e){return l({retain:e})}}),("highest"===(null===(n=a.retain)||void 0===n?void 0:n.type)||"lowest"===(null===(t=a.retain)||void 0===t?void 0:t.type))&&(0,i.jsx)(ts,{label:"Sort Key",value:null===(r=a.retain)||void 0===r?void 0:r.sort_key,onChange:function(e){return l({retain:(0,g.Z)((0,m.Z)({},a.retain),{sort_key:e.target.value})})}}),(0,i.jsx)(_d,{label:"Max Items",value:a.max_items,onChange:function(e){return l({max_items:e})}}),(0,i.jsx)(ns,{label:"Scope",options:Hd,value:null!==(o=a.scope)&&void 0!==o?o:"global",onChange:function(e){"dynamic"!==e&&l({scope:e,batch_key:void 0}),l({scope:e})}}),"dynamic"===a.scope&&(0,i.jsx)(ts,{label:"Batch Key",value:a.batch_key,onChange:function(e){return l({batch_key:e.target.value})}}),(0,i.jsx)(ts,{label:"Category Key",value:a.category_key,onChange:function(e){return l({category_key:e.target.value})}})]})})};var Rd=function(e){var n=e.label;return(0,i.jsx)("div",{className:"align-middle font-inter text-base",children:n})},Fd=function(e){var n=e.value;return(0,i.jsx)("div",{className:"flex h-full items-center text-text-default",children:n})},zd=function(e){var n=e.retain,t=e.onChange;return(0,z.ye)("batch-retention-100")?(0,i.jsxs)("div",{className:"flex",children:[(0,i.jsx)(ns,{label:"Retain Items",options:Bd,value:null===n||void 0===n?void 0:n.type,className:"mr-2 w-2/3",onChange:function(e){return t((0,g.Z)((0,m.Z)({},n),{type:e}))}}),(0,i.jsx)(_d,{className:"w-1/3 flex-grow",value:null===n||void 0===n?void 0:n.count,min:2,max:10,onChange:function(e){return t((0,g.Z)((0,m.Z)({},n),{count:e}))}})]}):(0,i.jsxs)("div",{className:"flex h-fit w-full justify-between",children:[(0,i.jsx)(ns,{label:"Retain Items",options:Bd,value:null===n||void 0===n?void 0:n.type,className:"w-2/3",onChange:function(e){return t((0,g.Z)((0,m.Z)({},n),{type:e}))}}),(0,i.jsx)("div",{className:"flex h-[40px] flex-grow items-center justify-center align-middle",children:(0,i.jsx)("p",{className:"font-inter text-base",children:n.count})})]})},Bd=[{label:"First",value:"first"},{label:"Last",value:"last"},{label:"Highest",value:"highest"},{label:"Lowest",value:"lowest"}],Hd=[{label:"Global",value:"global"},{label:"User",value:"user"},{label:"Dynamic",value:"dynamic"}],Vd=function(e){var n=e.children;return(0,i.jsx)("div",{className:"p-4 first:pt-0",children:(0,i.jsx)("div",{className:"space-y-4",children:n})})},$d="dynamic",Ud=[{label:"User",value:"user"},{label:"GLOBAL",value:"global"},{label:"Dynamic (pulled from refs.*)",value:$d}],Wd=new Intl.NumberFormat("en-US",{style:"decimal",minimumFractionDigits:0,maximumFractionDigits:0}),qd=function(e){var n=e.isConnectable,t=e.targetPosition,r=void 0===t?Ma.Ly.Top:t,o=e.sourcePosition,a=void 0===o?Ma.Ly.Bottom:o,s=e.id,u=e.data,c=u.node,d=u.onCh
1ange;return(0,l.useEffect)((function(){c.scope!==$d&&c.throttle_key&&d({throttle_key:void 0})}),[c.scope,c.throttle_key,d]),(0,i.jsxs)(Rc,{className:"w-[464px]",children:[(0,i.jsx)(au,{title:"Throttle",id:s}),(0,i.jsxs)(Dl,{className:"flex flex-col",children:[(0,i.jsx)(ts,{label:"Maximum Allowed",placeholder:"refs.data.max_allowed",value:Wd.format(c.max_allowed),onChange:function(e){var n=e.target.value||"0";d({max_allowed:Number.parseFloat(n.replace(/,/g,""))})}}),(0,i.jsx)(Zd,{label:"Period",value:c.period,onChange:function(e){d({period:e})}}),(0,i.jsx)(ns,{value:c.scope,label:"Scope",options:Ud,onChange:function(e){d({scope:e})}}),c.scope===$d?(0,i.jsx)(Bl,{className:"flex",children:(0,i.jsx)(ts,{label:"Throttle Key",value:c.throttle_key||"refs.",onChange:function(e){d({throttle_key:e.target.value})}})}):null]}),(0,i.jsx)(Ya,{position:r,isConnectable:n}),(0,i.jsx)(Kd,{}),(0,i.jsx)(Ga,{position:a,isConnectable:n,left:"25%",id:"on-throttle"}),(0,i.jsx)(Ga,{position:a,isConnectable:n,left:"75%",id:"nominal"})]})},Kd=function(){return(0,i.jsxs)("div",{className:"flex w-full justify-between",children:[(0,i.jsx)("div",{className:"flex basis-1/2 justify-center py-5",children:(0,i.jsx)("span",{children:"Throttled"})}),(0,i.jsx)("div",{className:"flex basis-1/2 justify-center py-5",children:(0,i.jsx)("span",{children:"Unthrottled"})})]})};qd.displayName="ThrottleAutomationNode";var Gd={placeholder:Qs,trigger:Js,"add-to-digest":Sd,"send-to-list":bd,"subscribe-to-list":Cd,"update-profile":wd,batch:Md,cancel:sd,delay:Kc,fetch:md,if:Jc,invoke:ad,send:Dc,throttle:(0,l.memo)(qd)},Jd=t(10929),Xd=function(e){var n=e.bg,t=void 0===n?"bg-[#61C677]":n,r=e.selected;return(0,i.jsx)("div",{className:(0,Jd.cx)("flex h-[33px] w-[33px] items-center justify-center rounded-full",r?"bg-status-active":t),children:(0,i.jsx)(J.shV,{className:"h-6 w-6 text-primary-white"})})},Yd=function(e){var n=e.trigger_type;
1switch(n){case"audience":case"segment":case"webhook":case"schedule":case"digest":case"api-invoke":return n}if("inbound-event"===n)switch(e.event_source){case"rudderstack":return"rudderstack";case"courier":return"courier"}return null},Qd=new Map([["api-invoke","API"],["audience","Audience"],["digest","Digest"],["schedule","Schedule"],["segment","Segment"],["rudderstack","Rudderstack"],["courier","Courier"],["webhook","Webhook"]]),ef=(0,al.cn)(!1),nf=(0,al.cn)("design"),tf=(0,al.cn)(null),rf=function(e){var n=e.isConnectable,t=e.type,r=e.position,o=e.status,a=e.className,l=e.id,s=(0,Pa.Dv)(nf),u="run"===s&&o.debugError,c="design"===s&&o.error,d=u||c?"bg-structure-red":(null===o||void 0===o?void 0:o.selected)?"bg-primary-blue":"bg-[#8FC9FF]";return(0,i.jsx)(Ma.HH,{className:(0,Jd.cx)("-mx-[4px] h-[16px] w-[16px]",d,a),type:t,position:r,isConnectable:n,id:l})},of=function(e){var n=e.isConnectable,t=e.className,r=e.id,o=e.status;return(0,i.jsx)(rf,{className:t,type:"source",position:Ma.Ly.Right,isConnectable:n,id:r,status:o})},af=function(e,n){var t=e.selected,r=e.error,o=e.debugError,i=e.prevOfSelected,a="run"===n,l=a&&o,s=!a&&r,u=lf({selected:t,prevOfSelected:i,debugMode:a,hasDesignError:s,hasDebugError:l}),c=sf({hasDesignError:s,hasDebugError:l,debugMode:a,selected:t,prevOfSelected:i}),d=uf({hasDesignError:s,hasDebugError:l,selected:t}),f=t?"shadow-automations-node-selected":"shadow-automations-node-default";return(0,Jd.cx)("outline",u,c,d,f)},lf=function(e){var n=e.hasDesignError,t=e.hasDebugError,r=e.selected,o=e.prevOfSelected,i=e.debugMode;return r||i&&o||t||n?"outline-4":"outline-1"},sf=function(e){var n=e.hasDesignError,t=e.hasDebugError,r=e.debugMode,o=e.selected,i=e.prevOfSelected;return n||t?"outline-structure-red":o||r&&i?"outline-primary-blue":"outline-structure-border"},uf=function(e){var n=e.hasDesignError,t=e.hasDebugError,r=e.selected;return(n||t)&&r?"bg-status-node-error":r?"bg-status-node-selected":"bg-background-panels"},cf=t(19557),df=function(){var e=(0,Ma.SM)(),n=(0,Ma.oR)((function(e){return e.userSelectionActive}));return(0,l.useMemo)((function(){if(!n){var t=e.filter((function(e){return e.selected}));return 1===t.length?t[0].data.node:void 0}}),[e,n])},ff=function(){var e=df(),n=(0,Ma._K)(),t=n.getEdges,r=n.getNodes;return(0,l.useMemo)((function(){if(!e)return null;var n=t().filter((function(n){return n.target===e.id})).map((function(e){return e.source})),o=r().filter((function(e){return n.includes(e.id)}
1));return 1===o.length?o[0].data.node:null}),[t,r,e])},pf=function(e){var n=e.isConnectable,t=e.className,r=e.id,o=e.status;return(0,i.jsx)(rf,{className:t,type:"target",position:Ma.Ly.Left,isConnectable:n,id:r,status:o})},hf=function(e){var n=e.selected;return(0,i.jsx)(xf,{bg:n?"bg-primary-red":"bg-[#ff33631a]",children:(0,i.jsx)(J.lHk,{className:(0,Jd.cx)("h-6 w-6",n?"text-icon-white":"text-icon-red")})})},vf=function(e){var n=e.className,t=e.children,r=e.status,o=e.icon,a=e.actionDescription,l=e.actionName,s=e.configured,u=(0,Pa.Dv)(nf),c="run"===u&&r.debugError,d="design"===u&&r.error;return(0,i.jsxs)(mf,{status:r,className:n,children:[(0,i.jsx)(gf,{icon:o,actionDescription:a,actionName:l,configured:s,selected:r.selected,error:c||d,children:t}),(0,i.jsx)(pf,{status:r}),(0,i.jsx)(of,{status:r})]})},mf=function(e){var n=e.className,t=e.children,r=e.status,o=(0,Pa.Dv)(nf),a=af(r,o);return(0,i.jsx)("div",{className:(0,Jd.cx)("h-[74px] w-[360px] overflow-hidden rounded-lg p-4 font-text",n,a),children:t})},gf=function(e){var n=e.children,t=e.icon,r=e.actionDescription,o=e.actionName,a=e.firstSourceLabel,l=e.secondSourceLabel,s=e.configured,u=e.selected,c=e.error,d=void 0!==c&&c;return(0,i.jsxs)("div",{className:"flex h-full w-full items-center justify-start space-x-4 overflow-hidden",children:[d?(0,i.jsx)(hf,{selected:u}):t,(0,i.jsxs)("div",{className:"flex w-[276px] items-center justify-between",children:[(0,i.jsxs)("div",{className:"flex w-full flex-col",children:[(0,i.jsx)(cf.default,{variant:"regular-sm",className:(0,Jd.cx)(u?"text-content":"text-label"),children:o}),r&&(0,i.jsx)(cf.default,{variant:"regular-sm",className:(0,Jd.cx)(u||s?"text-content":"text-subtext","truncate"),children:r}),n]}),a&&l&&(0,i.jsxs)("div",{className:"flex flex-col items-end gap-2",children:[(0,i.jsx)(cf.default,{variant:"regular-sm",className:(0,Jd.cx)(u?"text-content":"text-label"),children:a}),(0,i.jsx)(cf.default,{variant:"regular-sm",className:(0,Jd.cx)(u?"text-content":"text-label"),children:l})]})]})]})},xf=function(e){var n=e.children,t=e.bg,r=void 0===t?"bg-[#B8B8B81A]":t;return(0,i.jsx)("div",{className:(0,Jd.cx)("flex items-center justify-center rounded-sm p-[6px] text-icon-default",r),children:n})},bf=t(40489),yf=t(4168),Cf=function(e){var n,t,r,o,i=ff();return{selected:null===(n=e.temp_props)||void 0===n?void 0:n.selected,error:null===(t=e.temp_props)||void 0===t?void 0:t.hasError,edited:null===(r=e.properties)||void 0===r?void 0:r.edited,debugError:null===(o=e.temp_props)||void 0===o?void 0:o.hasDebugError,prevOfSelected:(null===i||void 0===i?void 0:i.id)===(null===e||void 0===e?void 0:e.id)}},jf=function(e){var n=e.configured,t=e.selected;return(0,i.jsx)(xf,{bg:t?"bg-status-active":n?"bg-[#FF828F1A]":"bg-[#B8B8B81A]",children:(0,i.jsx)(J.hvN,{className:(0,bf.Z)("h-6 w-6",t?"text-icon-white":n?"text-[#FF828F]":"text-icon-default")})})},wf=function(e){var n=e.retainType,t=e.count;return(0,i.jsxs)("span",{children:["Batch and retain the ",n," ",(0,i.jsxs)("span",{className:"text-header",children:[t," events"]})]})},Nf=function(e){var n=e.waitPeriod,t=e.maxWaitPeriod;if(!n||!t)return"Select time period";var r=(0,yf.f)(n),o=r.unit,i=r.count,a=(0,yf.f)(t),l=a.unit,s=a.count;return"Wait between ".concat(i," ").concat(o," to ").concat(s," ").concat(l)},Sf=function(e){var n=e.status,t=e.id;return(0,i.jsx)(of,{status:n,className:"static ml-[2px] flex-none translate-x-1/4",id:t})},kf=function(e){var n=e.condition;return"js"===n.condition_type?(0,i.jsx)(cf.default,{variant:"regular-md",children:n.expression}):"simple"===n.condition_type?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(cf.default,{variant:"regular-sm",children:[n.source,".",n.field," "]}),(0,i.jsxs)(cf.default,{variant:"semibold-sm",children:[_f(n.operator)," "]}),(0,i.jsx)(cf.default,{variant:"regular-sm",children:JSON.stringify(n.value)})]}):(0,i.jsx)(cf.default,{variant:"regular-sm",children:"---"})},_f=function(e){var n;return null!==(n={eq:"is equal to",neq:"is not equal to",gt:"is greater than",lt:"is less than",gte:"is greater than or equal to",lte:"is less than or equal to",contains:"contains",not_contains:"does not contain",one_of:"is one of"}[e])&&void 0!==n?n:"---"},Zf=function(e){var n=e.configured,t=e.selected;return(0,i.jsx)(xf,{bg:t?"bg-status-active":n?"bg-[#8000FF1A]":"bg-[#B8B8B81A]",children:(0,i.jsx)(J.rT6,{className:(0,bf.Z)("h-6 w-6",t?"text-icon-white":n?"text-[#8000FF]":"text-icon-default")})})},Ef=new RegExp(/^P(?:(\d+)M)?(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?)?$/),If=function(e){return"string"!==typeof(t=e.until)||isNaN(Date.parse(t))?"string"===typeof e.until&&e.until.length?"dynamic-until":"string"===typeof(n=e.duration)&&Ef.test(n)?"duration":"dynamic-duration":"until";var n,t},Of=function(e){var n=e.configured,t=e.selected;return(0,i.jsx)(xf,{bg:t?"bg-status-active":n?"bg-[#5C97901A]":"bg-[#B8B8B81A]",children:(0,i.jsx)(J.FOB,{className:(0,bf.Z)("h-6 w-6",t?"text-icon-white":n?"text-[#5C9790]":"text-icon-default")})})},Tf=function(e){var n,t=If(e),r=null===e||void 0===e?void 0:e.duration,o=null===e||void 0===e?void 0:e.until;switch(t){case"duration":var i=(0,yf.f)(r),a=i.unit,l=i.count;n="".concat(l," ").concat(a);break;
1case"until":n=new Date(o).toLocaleString();break;case"dynamic-duration":n=r;break;case"dynamic-until":n=o}return n},Af=function(e){var n=e.configured,t=e.selected;return(0,i.jsx)(xf,{bg:t?"bg-status-active":n?"bg-[#FF919C1A]":"bg-[#B8B8B81A]",children:(0,i.jsx)(J.qYy,{className:(0,bf.Z)("h-6 w-6",t?"text-icon-white":n?"text-[#FF919C]":"text-icon-default")})})},Df=function(e){var n=e.configured,t=e.selected;return(0,i.jsx)(xf,{bg:t?"bg-status-active":n?"bg-[#CC60DB1A]":"bg-[#B8B8B81A]",children:(0,i.jsx)(J.enk,{className:(0,bf.Z)("h-6 w-6",t?"text-icon-white":n?"text-[#CC60DB]":"text-icon-default")})})},Lf=function(e){var n=e.configured,t=e.selected;return(0,i.jsx)(xf,{bg:t?"bg-status-active":n?"bg-[#AD71A31A]":"bg-[#B8B8B81A]",children:(0,i.jsx)(J.HbQ,{className:(0,bf.Z)("h-6 w-6",t?"text-icon-white":n?"text-[#AD71A3]":"text-icon-default")})})},Mf=function(e){var n=e.passContext;return(0,i.jsxs)(i.Fragment,{children:["Invoke automation",n&&(0,i.jsx)("span",{className:"text-header",children:" with current context"})]})},Pf=function(e){var n=e.configured,t=e.selected;return(0,i.jsx)(xf,{bg:t?"bg-status-active":n?"bg-[#AB66E21A]":"bg-[#B8B8B81A]",children:(0,i.jsx)(J.n5m,{className:(0,bf.Z)("h-6 w-6",t?"text-icon-white":n?"text-[#AB66E2]":"text-icon-default")})})},Rf=function(e){var n=e.configured,t=e.selected;return(0,i.jsx)(xf,{bg:t?"bg-status-active":n?"bg-[#79B0E41A]":"bg-[#B8B8B81A]",children:(0,i.jsx)(J.Qrr,{className:(0,bf.Z)("h-6 w-6",t?"text-icon-white":n?"text-[#499DE8]":"text-icon-default")})})},Ff=function(e){var n=e.configured,t=e.selected;return(0,i.jsx)(xf,{bg:t?"bg-status-active":n?"bg-[#79B0E41A]":"bg-[#B8B8B81A]",children:(0,i.jsx)(J.PIZ,{className:(0,bf.Z)("h-6 w-6",t?"text-icon-white":n?"text-[#499DE8]":"text-icon-default")})})},zf=function(e){var n=e.className,t=e.status,r=e.firstSourceId,o=e.secondSourceId;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(of,{className:(0,Jd.cx)(n,"top-1/3"),status:t,id:r}),(0,i.jsx)(of,{className:(0,Jd.cx)(n,"top-2/3"),status:t,id:o})]})},Bf=function(e){var n=e.className,t=e.children,r=e.status,o=e.icon,a=e.actionDescription,l=e.actionName,s=e.firstSourceLabel,u=e.secondSourceLabel,c=e.firstSourceId,d=e.secondSourceId,f=e.configured,p=(0,Pa.Dv)(nf),h="run"===p&&r.debugError,v="design"===p&&r.error;return(0,i.jsxs)(mf,{status:r,className:n,children:[(0,i.jsx)(gf,{icon:o,actionDescription:a,actionName:l,firstSourceLabel:s,secondSourceLabel:u,configured:f,selected:r.selected,error:h||v,children:t}),(0,i.jsx)(pf,{status:r}),(0,i.jsx)(zf,{status:r,firstSourceId:c,secondSourceId:d})]})},Hf=function(e){var n=e.configured,t=e.selected;return(0,i.jsx)(xf,{bg:t?"bg-status-active":n?"bg-[#37B1D81A]":"bg-[#B8B8B81A]",children:(0,i.jsx)(J.MqB,{className:(0,bf.Z)("h-6 w-6",t?"text-icon-white":n?"text-[#37B1D8]":"text-icon-default")})})},Vf=function(e){var n=e.maxAllowed;return(0,i.jsx)(i.Fragment,{children:n?(0,i.jsxs)("span",{children:["Throttle after"," ",(0,i.jsxs)("span",{className:"text-header",children:[n," events"]})]}):"Throttle"})},$f=function(e){if(!e)return"Select parameters";var n=(0,yf.f)(e),t=n.unit,r=n.count;return"Wait a period of ".concat(r," ").concat(t)},Uf=function(e){var n=e.configured,t=e.selected;return(0,i.jsx)(xf,{bg:t?"bg-status-active":n?"bg-[#0085FF1A]":"bg-[#B8B8B81A]",children:(0,i.jsx)(J.If,{className:(0,bf.Z)("h-6 w-6",t?"text-icon-white":n?"text-icon-active":"text-icon-default")})})},Wf=function(e){var n=e.configured,t=e.selected;return(0,i.jsx)(xf,{bg:t?"bg-status-active":n?"bg-[#6CBC6E1A]":"bg-[#B8B8B81A]",children:(0,i.jsx)(J.vw7,{className:(0,bf.Z)("h-6 w-6",t?"text-icon-white":n?"text-[#6CBC6E]":"text-icon-default")})})},qf=function(e){var n=e.recipient,t=n?Object.values(n).filter(Boolean).length:0,r=1!==t?"custom recipient":n.user_id?"user":n.audience_id?"audience":n.list_id||n.list_pattern?"list":"custom recipient";return(0,i.jsx)(i.Fragment,{children:t>0?(0,i.jsxs)("span",{children:["Send message to ",(0,i.jsx)("span",{className:"text-header",children:r})]}):"Send Message"})},Kf=function(e){var n=e.configured,t=e.selected;return(0,i.jsx)(xf,{bg:t?"bg-status-active":n?"bg-[#9265311A]":"bg-[#B8B8B81A]",children:(0,i.jsx)(J.eym,{className:(0,bf.Z)("h-6 w-6",t?"text-icon-white":n?"text-[#926531]":"text-icon-default")})})},Gf=function(e){var n=e.method,t=e.url;return(0,i.jsx)(i.Fragment,{children:n&&t?(0,i.jsxs)("span",{children:["Fetch with ",(0,i.jsx)("span",{className:"text-header",children:n})]}):"Fetch"})},Jf=function(e){var n=e.configured,t=e.selected;return(0,i.jsx)(xf,{bg:t?"bg-status-active":n?"bg-[#AB66E21A]":"bg-[#B8B8B81A]",children:(0,i.jsx)(J.n5m,{className:(0,bf.Z)("h-6 w-6",t?"text-icon-white":n?"text-[#AB66E2]":"text-icon-default")})})};function Xf(e){return(0,g.Z)((0,m.Z)({action:e.type},e,function(e){if("fetch"===e.type)return function(e){var n,t,r,o,i,a,l,s,u,c=null!==(t=null===(n=e.payload)||void 0===n?void 0:n.value)&&void 0!==t?t:{};return{action:"fetch-data",webhook:{url:e.url,method:null!==(r=e.method.toUpperCase())&&void 0!==r?r:c.method,headers:null!==(i=null!==(o=e.headers)&&void 0!==o?o:c.headers)&&void 0!==i?i:{},body:null!==(l=null!==(a=e.body)&&void 0!==a?a:c.body)&&void 0!==l?l:{},params:null!==(u=null!==(s=e.query_params)&&void 0!==s?s:c.params)&&void 0!==u?u:{}}}}(e);if("invoke"===e.type)return function(e){return{action:"invoke",template:e.template_id,context:e.data?{data:e.data}:void 0}}(e);if("update-profile"===e.type)return function(e){return{action:"update-profile",profile:e.profile,merge:e.merge_strategy,recipient_id:e.user_id}}(e);if("subscribe-to-list"===e.type)return function(e){return{action:"subscribe",list_id:e.list_id,recipient_id:e.user_id,preferences:void 0,subscription:{preferences:e.preferences}}}(e);if("send-to-list"===e.type)return function(e){return{action:"send-list",list:e.list_id,brand:e.brand_id,data:e.data,template:e.template_id,skip_condition:"!(".concat(e.filter,")")}}(e);return}(e)),{id:void 0,tenant_id:void 0,tenantId:void 0,version:void 0,created:void 0,updated:void 0,next_step:void 0,properties:void 0,type:void 0,temp_props:void 0,automation_template_id:void 0})}var Yf=function(e,n,t){return e?e.map((function(e){return function(e){var n,t=e.node,r=e.onChange,o=t.properties.position,i=t.id,a=t.type,l=t.zIndex,s=null!==(n=t.temp_props)&&void 0!==n?n:{},u=s.selected,c=s.zIndex,d=s.width,f=s.height;return{id:i,position:o,width:d,height:f,type:a,zIndex:"trigger"===a?1002:null!==c&&void 0!==c?c:l,selected:u,data:{onCh
1ange:function(e){return r((0,m.Z)({id:i},e))},onSet:e.onSet,node:t}}}({node:e,onChange:null!==n&&void 0!==n?n:function(){},onSet:null!==t&&void 0!==t?t:function(){}})})):[]},Qf=function(e){return e?e.flatMap((function(e){return"if"===e.type?ep(e):"throttle"===e.type?np(e):"switch"===e.type?tp(e):e.next_step?rp({source:e.id,target:e.next_step.$node_id}):void 0})).filter(Boolean):[]},ep=function(e){var n=[];return e.if_true&&n.push(rp({source:e.id,target:e.if_true.$node_id,handle:"true"})),e.if_false&&n.push(rp({source:e.id,target:e.if_false.$node_id,handle:"false"})),n},np=function(e){var n=[];return e.on_throttle&&n.push(rp({source:e.id,target:e.on_throttle.$node_id,handle:"on-throttle"})),e.next_step&&n.push(rp({source:e.id,target:e.next_step.$node_id,handle:"nominal"})),n},tp=function(e){var n=[];return e.default&&n.push(rp({source:e.id,target:e.default.$node_id,handle:"handle-default"})),e.cases.forEach((function(t,r){t.edge&&n.push(rp({source:e.id,target:t.edge.$node_id,handle:"handle-".concat(r)}))})),n},rp=function(e){var n=e.source,t=e.target,r=e.handle,o=e.animated;return{id:zi()(),animated:o,source:n,sourceHandle:r,target:t}},op=function(e){var n,t=function(e){return e.find((function(e){return"trigger"===e.type}))}(e);return n={automation:{steps:ip(null===t||void 0===t?void 0:t.id,e).filter((function(e){return!ap.has(e.type)})).map(Xf)}},JSON.stringify(n,null,2)};function ip(e,n){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(!e)return[];var r=n.find((function(n){return n.id===e}));if(!r)return[];var o="trigger"===r.type?t:t.concat(r);return"if"===r.type?r.if_true?ip(r.if_true.$node_id,r.if_false?ip(r.if_false.$node_id,o):o):o:r.next_step?ip(r.next_step.$node_id,n,o):o}var ap=new Set(["trigger","placeholder","switch"]);function lp(e){var n=e.edges,t=e.nodes,r=e.onNodeChange;return(0,l.useCallback)((function(e){var o=!0,i=!1,a=void 0;try{for(var l,s=function(){var e=l.value;if("remove"!==e.type)return"continue";var o=n.find((function(n){return n.id===e.id}));if(!o)return"continue";var i=t.find((function(e){return e.id===o.source}));return i?"if"===i.type&&"false"===o.sourceHandle?(r({id:i.id,if_false:void 0}),"continue"):"if"===i.type&&"true"===o.sourceHandle?(r({id:i.id,if_true:void 0}),"continue"):"switch"===i.type?(r(sp(i,o)),"continue"):"throttle"===i.type&&"nominal"===o.sourceHandle?(r({id:i.id,next_step:void 0}),"continue"):"throttle"===i.type&&"on-throttle"===o.sourceHandle?(r({id:i.id,on_throttle:void 0}),"continue"):void r({id:i.id,next_step:void 0}):"continue"},u=e[Symbol.iterator]();!(o=(l=u.next()).done);o=!0)s()}catch(c){i=!0,a=c}finally{try{o||null==u.return||u.return()}finally{if(i)throw a}}}),[n,t,r])}var sp=function(e,n){if("handle-default"===n.sourceHandle)return{id:e.id,default:void 0};var t=parseInt(n.sourceHandle.replace("handle-",""));if(isNaN(t))return{id:e.id};var r=(0,N.Z)(e.cases);return r[t]=(0,g.Z)((0,m.Z)({},r[t]),{edge:void 0}),{id:e.id,cases:r}};
1function up(e){return function(n){!function(e){e.changes.forEach((function(n){var t,r;"dimensions"===n.type&&e.onNodeChange({id:n.id,temp_props:{width:null===(t=n.dimensions)||void 0===t?void 0:t.width,height:null===(r=n.dimensions)||void 0===r?void 0:r.height}});"select"!==n.type?"position"===n.type&&n.position?function(e){var n=e.change,t=e.onNodeChange;if(!n.position)return;t({id:n.id,properties:{position:n.position}})}((0,m.Z)({change:n},e)):"remove"!==n.type||e.onRemoveNode(n.id):e.onNodeChange({id:n.id,temp_props:{zIndex:n.selected?1:0,selected:n.selected}})}))}((0,g.Z)((0,m.Z)({},e),{changes:n}))}}function cp(e,n){return(0,l.useCallback)((function(t){var r=e.find((function(e){return e.id===t.source})),o=e.find((function(e){return e.id===t.target}));if(r&&o)return"if"===r.type?n(dp(r,o,t)):"throttle"===r.type?n(pp(r,o,t)):"switch"===r.type?n(fp(r,o,t)):void n((0,g.Z)((0,m.Z)({},r),{next_step:{$node_id:o.id}}))}),[e,n])}var dp=function(e,n,t){return(0,m.Z)({id:e.id},"true"===t.sourceHandle?{if_true:{$node_id:n.id}}:{},"false"===t.sourceHandle?{if_false:{$node_id:n.id}}:{})},fp=function(e,n,t){if("handle-default"===t.sourceHandle)return{id:e.id,default:{$node_id:n.id}};var r=parseInt(t.sourceHandle.replace("handle-",""));if(isNaN(r))return{id:e.id};var o=(0,N.Z)(e.cases);return o[r]=(0,g.Z)((0,m.Z)({},o[r]),{edge:{$node_id:n.id}}),{id:e.id,cases:o}},pp=function(e,n,t){return(0,m.Z)({id:e.id},"on-throttle"===t.sourceHandle?{on_throttle:{$node_id:n.id}}:{},"nominal"===t.sourceHandle?{next_step:{$node_id:n.id}}:{})};function hp(e,n,{checkForDefaultPrevented:t=!0}={}){return function(r){if(e?.(r),!1===t||!r.defaultPrevented)return n?.(r)}}function vp(e,n=[]){let t=[];const r=()=>{const n=t.map((e=>l.createContext(e)));return function(t){const r=t?.[e]||n;return l.useMemo((()=>({[`__scope${e}`]:{...t,[e]:r}})),[t,r])}};return r.scopeName=e,[function(n,r){const o=l.createContext(r),a=t.length;t=[...t,r];const s=n=>{const{scope:t,children:r,...s}=n,u=t?.[e]?.[a]||o,c=l.useMemo((()=>s),Object.values(s));return(0,i.jsx)(u.Provider,{value:c,children:r})};return s.displayName=n+"Provider",[s,function(t,i){const s=i?.[e]?.[a]||o,u=l.useContext(s);if(u)return u;if(void 0!==r)return r;throw new Error(`\`${t}\` must be used within \`${n}\``)}]},mp(r,...n)]}function mp(...e){const n=e[0];if(1===e.length)return n;const t=()=>{const t=e.map((e=>({useScope:e(),scopeName:e.scopeName})));return function(e){const r=t.reduce(((n,{useScope:t,scopeName:r})=>({...n,...t(e)[`__scope${r}`]})),{});return l.useMemo((()=>({[`__scope${n.scopeName}`]:r})),[r])}};return t.scopeName=n.scopeName,t}function gp(...e){return n=>e.forEach((e=>function(e,n){"function"===typeof e?e(n):null!==e&&void 0!==e&&(e.current=n)}(e,n)))}function xp(...e){return l.useCallback(gp(...e),e)}var bp=l.forwardRef(((e,n)=>{const{children:t,...r}=e,o=l.Children.toArray(t),a=o.find(jp);if(a){const e=a.props.children,t=o.map((n=>n===a?l.Children.count(e)>1?l.Children.only(null):l.isValidElement(e)?e.props.children:null:n));return(0,i.jsx)(yp,{...r,ref:n,children:l.isValidElement(e)?l.cloneElement(e,void 0,t):null})}return(0,i.jsx)(yp,{...r,ref:n,children:t})}));bp.displayName="Slot";var yp=l.forwardRef(((e,n)=>{const{children:t,...r}=e;if(l.isValidElement(t)){const e=function(e){let n=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,t=n&&"isReactWarning"in n&&n.isReactWarning;if(t)return e.ref;if(n=Object.getOwnPropertyDescriptor(e,"ref")?.get,t=n&&"isReactWarning"in n&&n.isReactWarning,t)return e.props.ref;return e.props.ref||e.ref}(t);return l.cloneElement(t,{...wp(r,t.props),ref:n?gp(n,e):e})}return l.Children.count(t)>1?l.Children.only(null):null}));yp.displayName="SlotClone";var Cp=({children:e})=>(0,i.jsx)(i.Fragment,{children:e});function jp(e){return l.isValidElement(e)&&e.type===Cp}function wp(e,n){const t={...n};for(const r in n){const o=e[r],i=n[r];/^on[A-Z]/.test(r)?o&&i?t[r]=(...e)=>{i(...e),o(...e)}:o&&(t[r]=o):"style"===r?t[r]={...o,...i}:"className"===r&&(t[r]=[o,i].filter(Boolean).join(" "))}return{...e,...t}}var Np=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"].reduce(((e,n)=>{const t=l.forwardRef(((e,t)=>{const{asChild:r,...o}=e,a=r?bp:n;return"undefined"!==typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,i.jsx)(a,{...o,ref:t})}));return t.displayName=`Primitive.${n}`,{...e,[n]:t}}),{});function Sp(e,n){e&&pu.flushSync((()=>
vendor: 10,583 bytes, line 1
1e.dispatchEvent(n)))}function kp(...e){const n=e[0];if(1===e.length)return n;const t=()=>{const t=e.map((e=>({useScope:e(),scopeName:e.scopeName})));return function(e){const r=t.reduce(((n,{useScope:t,scopeName:r})=>({...n,...t(e)[`__scope${r}`]})),{});return l.useMemo((()=>({[`__scope${n.scopeName}`]:r})),[r])}};return t.scopeName=n.scopeName,t}function _p(e){const n=e+"CollectionProvider",[t,r]=function(e,n=[]){let t=[];const r=()=>{const n=t.map((e=>l.createContext(e)));return function(t){const r=t?.[e]||n;return l.useMemo((()=>({[`__scope${e}`]:{...t,[e]:r}})),[t,r])}};return r.scopeName=e,[function(n,r){const o=l.createContext(r),a=t.length;function s(n){const{scope:t,children:r,...s}=n,u=t?.[e][a]||o,c=l.useMemo((()=>s),Object.values(s));return(0,i.jsx)(u.Provider,{value:c,children:r})}return t=[...t,r],s.displayName=n+"Provider",[s,function(t,i){const s=i?.[e][a]||o,u=l.useContext(s);if(u)return u;if(void 0!==r)return r;throw new Error(`\`${t}\` must be used within \`${n}\``)}]},kp(r,...n)]}(n),[o,a]=t(n,{collectionRef:{current:null},itemMap:new Map}),s=e=>{const{scope:n,children:t}=e,r=l.useRef(null),a=l.useRef(new Map).current;return(0,i.jsx)(o,{scope:n,itemMap:a,collectionRef:r,children:t})};s.displayName=n;const u=e+"CollectionSlot",c=l.forwardRef(((e,n)=>{const{scope:t,children:r}=e,o=xp(n,a(u,t).collectionRef);return(0,i.jsx)(bp,{ref:o,children:r})}));c.displayName=u;const d=e+"CollectionItemSlot",f="data-radix-collection-item",p=l.forwardRef(((e,n)=>{const{scope:t,children:r,...o}=e,s=l.useRef(null),u=xp(n,s),c=a(d,t);return l.useEffect((()=>(c.itemMap.set(s,{ref:s,...o}),()=>{c.itemMap.delete(s)}))),(0,i.jsx)(bp,{[f]:"",ref:u,children:r})}));return p.displayName=d,[{Provider:s,Slot:c,ItemSlot:p},function(n){const t=a(e+"CollectionConsumer",n);return l.useCallback((()=>{const e=t.collectionRef.current;if(!e)return[];const n=Array.from(e.querySelectorAll(`[${f}]`));return Array.from(t.itemMap.values()).sort(((e,t)=>n.indexOf(e.ref.current)-n.indexOf(t.ref.current)))}),[t.collectionRef,t.itemMap])},r]}var Zp=l.createContext(void 0);function Ep(e){const n=l.useContext(Zp);return e||n||"ltr"}function Ip(e){const n=l.useRef(e);return l.useEffect((()=>{n.current=e})),l.useMemo((()=>(...e)=>n.current?.(...e)),[])}var Op,Tp="dismissableLayer.update",Ap="dismissableLayer.pointerDownOutside",Dp="dismissableLayer.focusOutside",Lp=l.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Mp=l.forwardRef(((e,n)=>{const{disableOutsidePointerEvents:t=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:a,onInteractOutside:s,onDismiss:u,...c}=e,d=l.useContext(Lp),[f,p]=l.useState(null),h=f?.ownerDocument??globalThis?.document,[,v]=l.useState({}),m=xp(n,(e=>p(e))),g=Array.from(d.layers),[x]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),b=g.indexOf(x),y=f?g.indexOf(f):-1,C=d.layersWithOutsidePointerEventsDisabled.size>0,j=y>=b,w=function(e,n=globalThis?.document){const t=Ip(e),r=l.useRef(!1),o=l.useRef((()=>{}));return l.useEffect((()=>{const e=e=>{if(e.target&&!r.current){let r=function(){Fp(Ap,t,i,{discrete:!0})};const i={originalEvent:e};"touch"===e.pointerType?(n.removeEventListener("click",o.current),o.current=r,n.addEventListener("click",o.current,{once:!0})):r()}else n.removeEventListener("click",o.current);r.current=!1},i=window.setTimeout((()=>{n.addEventListener("pointerdown",e)}),0);return()=>{window.clearTimeout(i),n.removeEventListener("pointerdown",e),n.removeEventListener("click",o.current)}}),[n,t]),{onPointerDownCapture:()=>r.current=!0}}((e=>{const n=e.target,t=[...d.branches].some((e=>e.contains(n)));j&&!t&&(o?.(e),s?.(e),e.defaultPrevented||u?.())}),h),N=function(e,n=globalThis?.document){const t=Ip(e),r=l.useRef(!1);return l.useEffect((()=>{const e=e=>{if(e.target&&!r.current){Fp(Dp,t,{originalEvent:e},{discrete:!1})}};return n.addEventListener("focusin",e),()=>n.removeEventListener("focusin",e)}),[n,t]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}((e=>{const n=e.target;[...d.branches].some((e=>e.contains(n)))||(a?.(e),s?.(e),e.defaultPrevented||u?.())}),h);return function(e,n=globalThis?.document){const t=Ip(e);l.useEffect((()=>{const e=e=>{"Escape"===e.key&&t(e)};return n.addEventListener("keydown",e,{capture:!0}),()=>n.removeEventListener("keydown",e,{capture:!0})}),[t,n])}((e=>{y===d.layers.size-1&&(r?.(e),!e.defaultPrevented&&u&&(e.preventDefault(),u()))}),h),l.useEffect((()=>{if(f)return t&&(0===d.layersWithOutsidePointerEventsDisabled.size&&(Op=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(f)),d.layers.add(f),Rp(),()=>{t&&1===d.layersWithOutsidePointerEventsDisabled.size&&(h.body.style.pointerEvents=Op)}}),[f,h,t,d]),l.useEffect((()=>()=>{f&&(d.layers.delete(f),d.layersWithOutsidePointerEventsDisabled.delete(f),Rp())}),[f,d]),l.useEffect((()=>{const e=()=>v({});return document.addEventListener(Tp,e),()=>document.removeEventListener(Tp,e)}),[]),(0,i.jsx)(Np.div,{...c,ref:m,style:{pointerEvents:C?j?"auto":"none":void 0,...e.style},onFocusCapture:hp(e.onFocusCapture,N.onFocusCapture),onBlurCapture:hp(e.onBlurCapture,N.onBlurCapture),onPointerDownCapture:hp(e.onPointerDownCapture,w.onPointerDownCapture)})}));Mp.displayName="DismissableLayer";var Pp=l.forwardRef(((e,n)=>{const t=l.useContext(Lp),r=l.useRef(null),o=xp(n,r);return l.useEffect((()=>{const e=r.current;if(e)return t.branches.add(e),()=>{t.branches.delete(e)}}),[t.branches]),(0,i.jsx)(Np.div,{...e,ref:o})}));function Rp(){const e=new CustomEvent(Tp);document.dispatchEvent(e)}function Fp(e,n,t,{discrete:r}){const o=t.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:t});n&&o.addEventListener(e,n,{once:!0}),r?Sp(o,i):o.dispatchEvent(i)}Pp.displayName="DismissableLayerBranch";var zp=0;function Bp(){l.useEffect((()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Hp()),document.body.insertAdjacentElement("beforeend",e[1]??Hp()),zp++,()=>{1===zp&&document.querySelectorAll("[data-radix-focus-guard]").forEach((e=>e.remove())),zp--}}),[])}function Hp(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Vp="focusScope.autoFocusOnMount",$p="focusScope.autoFocusOnUnmount",Up={bubbles:!1,cancelable:!0},Wp=l.forwardRef(((e,n)=>{const{loop:t=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:a,...s}=e,[u,c]=l.useState(null),d=Ip(o),f=Ip(a),p=l.useRef(null),h=xp(n,(e=>c(e))),v=l.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;l.useEffect((()=>{if(r){let e=function(e){if(v.paused||!u)return;const n=e.target;u.contains(n)?p.current=n:Jp(p.current,{select:!0})},n=function(e){if(v.paused||!u)return;const n=e.relatedTarget;null!==n&&(u.contains(n)||Jp(p.current,{select:!0}))},t=function(e){if(document.activeElement===document.body)for(const n of e)n.removedNodes.length>0&&Jp(u)};document.addEventListener("focusin",e),document.addEventListener("focusout",n);const r=new MutationObserver(t);return u&&r.observe(u,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",e),document.removeEventListener("focusout",n),r.disconnect()}}}),[r,u,v.paused]),l.useEffect((()=>{if(u){Xp.add(v);const n=document.activeElement;if(!u.contains(n)){const t=new CustomEvent(Vp,Up);u.addEventListener(Vp,d),u.dispatchEvent(t),t.defaultPrevented||(!function(e,{select:n=!1}={}){const t=document.activeElement;for(const r of e)if(Jp(r,{select:n}),document.activeElement!==t)return}((e=qp(u),e.filter((e=>"A"!==e.tagName))),{select:!0}),document.activeElement===n&&Jp(u))}return()=>{u.removeEventListener(Vp,d),setTimeout((()=>{const e=new CustomEvent($p,Up);u.addEventListener($p,f),u.dispatchEvent(e),e.defaultPrevented||Jp(n??document.body,{select:!0}),u.removeEventListener($p,f),Xp.remove(v)}),0)}}var e}),[u,d,f,v]);const m=l.useCallback((e=>{if(!t&&!r)return;if(v.paused)return;const n="Tab"===e.key&&!e.altKey&&!e.ctrlKey&&!e.metaKey,o=document.activeElement;if(n&&o){const n=e.currentTarget,[r,i]=function(e){const n=qp(e),t=Kp(n,e),r=Kp(n.reverse(),e);return[t,r]}(n);r&&i?e.shiftKey||o!==i?e.shiftKey&&o===r&&(e.preventDefault(),t&&Jp(i,{select:!0})):(e.preventDefault(),t&&Jp(r,{select:!0})):o===n&&e.preventDefault()}}),[t,r,v.paused]);return(0,i.jsx)(Np.div,{tabIndex:-1,...s,ref:h,onKeyDown:m})}));function qp(e){const n=[],t=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{const n="INPUT"===e.tagName&&"hidden"===e.type;return e.disabled||e.hidden||n?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;t.nextNode();)n.push(t.currentNode);return n}function Kp(e,n){for(const t of e)if(!Gp(t,{upTo:n}))return t}function Gp(e,{upTo:n}){if("hidden"===getComputedStyle(e).visibility)return!0;for(;e;){if(void 0!==n&&e===n)return!1;if("none"===getComputedStyle(e).display)return!0;e=e.parentElement}return!1}function Jp(e,{select:n=!1}={}){if(e&&e.focus){const t=document.activeElement;e.focus({preventScroll:!0}),e!==t&&function(e){return e instanceof HTMLInputElement&&"select"in e}(e)&&n&&e.select()}}Wp.displayName="FocusScope";var Xp=function(){let e=[];return{add(n){const t=e[0];n!==t&&t?.pause(),e=Yp(e,n),e.unshift(n)},remove(n){e=Yp(e,n),e[0]?.resume()}}}();function Yp(e,n){const t=[...e],r=t.indexOf(n);return-1!==r&&t.splice(r,1),t}var Qp=Boolean(globalThis?.document)?l.useLayoutEffect:()=>{},eh=s["useId".toString()]||(()=>{}),nh=0;function th(e){const[n,t]=l.useState(eh());return Qp((()=>{e||t((e=>e??String(nh++)))}),[e]),e||(n?`radix-${n}`:"")}var rh=t(4029);function oh(e,n,t){let{reference:r,floating:o}=e;const i=(0,rh.Qq)(n),a=(0,rh.Wh)(n),l=(0,rh.I4)(a),s=(0,rh.k3)(n),u="y"===i,c=r.x+r.width/2-o.width/2,d=r.y+r.height/2-o.height/2,f=r[l]/2-o[l]/2;let p;switch(s){case"top":p={x:c,y:r.y-o.height};break;case"bottom":p={x:c,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:d};break;case"left":p={x:r.x-o.width,y:d};break;default:p={x:r.x,y:r.y}}switch((0,rh.hp)(n)){case"start":p[a]-=f*(t&&u?-1:1);break;case"end":p[a]+=f*(t&&u?-1:1)}return p}async function ih(e,n){var t;void 0===n&&(n={});const{x:r,y:o,platform:i,rects:a,elements:l,strategy:s}=e,{boundary:u="clippingAncestors",rootBoundary:c="viewport",elementContext:d="floating",altBoundary:f=!1,padding:p=0}=(0,rh.ku)(n,e),h=(0,rh.yd)(p),v=l[f?"floating"===d?"reference":"floating":d],m=(0,rh.JB)(await i.getClippingRect
1({element:null==(t=await(null==i.isElement?void 0:i.isElement(v)))||t?v:v.contextElement||await(null==i.getDocumentElement?void 0:i.getDocumentElement(l.floating)),boundary:u,rootBoundary:c,strategy:s})),g="floating"===d?{x:r,y:o,width:a.floating.width,height:a.floating.height}:a.reference,x=await(null==i.getOffsetParent?void 0:i.getOffsetParent(l.floating)),b=await(null==i.isElement?void 0:i.isElement(x))&&await(null==i.getScale?void 0:i.getScale(x))||{x:1,y:1},y=(0,rh.JB)(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:g,offsetParent:x,strategy:s}):g);return{top:(m.top-y.top+h.top)/b.y,bottom:(y.bottom-m.bottom+h.bottom)/b.y,left:(m.left-y.left+h.left)/b.x,right:(y.right-m.right+h.right)/b.x}}function ah(e,n){return{top:e.top-n.height,right:e.right-n.width,bottom:e.bottom-n.height,left:e.left-n.width}}function lh(e){return rh.mA.some((n=>e[n]>=0))}var sh=t(10712);function uh(e){const n=(0,sh.Dx)(e);let t=parseFloat(n.width)||0,r=parseFloat(n.height)||0;const o=(0,sh.Re)(e),i=o?e.offsetWidth:t,a=o?e.offsetHeight:r,l=(0,rh.NM)(t)!==i||(0,rh.NM)(r)!==a;return l&&(t=i,r=a),{width:t,height:r,$:l}}function ch(e){return(0,sh.kK)(e)?e:e.contextElement}function dh(e){const n=ch(e);if(!(0,sh.Re)(n))return(0,rh.ze)(1);const t=n.getBoundingClientRect(),{width:r,height:o,$:i}=uh(n);let a=(i?(0,rh.NM)(t.width):t.width)/r,l=(i?(0,rh.NM)(t.height):t.height)/o;return a&&Number.isFinite(a)||(a=1),l&&Number.isFinite(l)||(l=1),{x:a,y:l}}const fh=(0,rh.ze)(0);function ph(e){const n=(0,sh.Jj)(e);return(0,sh.Pf)()&&n.visualViewport?{x:n.visualViewport.offsetLeft,y:n.visualViewport.offsetTop}:fh}function hh(e,n,t,r){void 0===n&&(n=!1),void 0===t&&(t=!1);const o=e.getBoundingClientRect(),i=ch(e);let a=(0,rh.ze)(1);n&&(r?(0,sh.kK)(r)&&(a=dh(r)):a=dh(e));const l=function(e,n,t){return void 0===n&&(n=!1),!(!t||n&&t!==(0,sh.Jj)(e))&&n}(i,t,r)?ph(i):(0,rh.ze)(0);let s=(o.left+l.x)/a.x,u=(o.top+l.y)/a.y,c=o.width/a.x,d=o.height/a.y;if(i){const e=(0,sh.Jj)(i),n=r&&(0,sh.kK)(r)?(0,sh.Jj)(r):r;let t=e,o=(0,sh.wK)(t);for(;o&&r&&n!==t;){const e=dh(o),n=o.getBoundingClientRect(),r=(0,sh.Dx)(o),i=n.left+(o.clientLeft+parseFloat(r.paddingLeft))*e.x,a=n.top+(o.clientTop+parseFloat(r.paddingTop))*e.y;s*=e.x,u*=e.y,c*=e.x,d*=e.y,s+=i,u+=a,t=(0,sh.Jj)(o),o=(0,sh.wK)(t)}}return(0,rh.JB)({width:c,height:d,x:s,y:u})}function vh(e,n){const t=(0,sh.Lw)(e).scrollLeft;return n?n.left+t:hh((0,sh.tF)(e)).left+t}function mh(e,n,t){void 0===t&&(t=!1);const r=e.getBoundingClientRect();return{x:r.left+n.scrollLeft-(t?0:vh(e,r)),y:r.top+n.scrollTop}}function gh(e,n,t){let r;if("viewport"===n)r=function(e,n){const t=(0,sh.Jj)(e),r=(0,sh.tF)(e),o=t.visualViewport;let i=r.clientWidth,a=r.clientHeight,l=0,s=0;if(o){i=o.width,a=o.height;const e=(0,sh.Pf)();(!e||e&&"fixed"===n)&&(l=o.offsetLeft,s=o.offsetTop)}return{width:i,height:a,x:l,y:s}}(e,t);else if("document"===n)r=function(e){const n=(0,sh.tF)(e),t=(0,sh.Lw)(e),r=e.ownerDocument.body,o=(0,rh.Fp)(n.scrollWidth,n.clientWidth,r.scrollWidth,r.clientWidth),i=(0,rh.Fp)(n.scrollHeight,n.clientHeight,r.scrollHeight,r.clientHeight);let a=-t.scrollLeft+vh(e);const l=-t.scrollTop;return"rtl"===(0,sh.Dx)(r).direction&&(a+=(0,rh.Fp)(n.clientWidth,r.clientWidth)-o),{width:o,height:i,x:a,y:l}}((0,sh.tF)(e));else if((0,sh.kK)(n))r=function(e,n){const t=hh(e,!0,"fixed"===n),r=t.top+e.clientTop,o=t.left+e.clientLeft,i=(0,sh.Re)(e)?dh(e):(0,rh.ze)(1);return{width:e.clientWidth*i.x,height:e.clientHeight*i.y,x:o*i.x,y:r*i.y}}(n,t);else{const t=ph(e);r={x:n.x-t.x,y:n.y-t.y,width:n.width,height:n.height}}return(0,rh.JB)(r)}function xh(e,n){const t=(0,sh.Ow)(e);return!(t===n||!(0,sh.kK)(t)||(0,sh.Py)(t))&&("fixed"===(0,sh.Dx)(t).position||xh(t,n))}function bh(e,n,t){const r=(0,sh.Re)(n),o=(0,sh.tF)(n),i="fixed"===t,a=hh(e,!0,i,n);let l={scrollLeft:0,scrollTop:0};const s=(0,rh.ze)(0);if(r||!r&&!i)if(("body"!==(0,sh.wk)(n)||(0,sh.ao)(o))&&(l=(0,sh.Lw)(n)),r){const e=hh(n,!0,i,n);s.x=e.x+n.clientLeft,s.y=e.y+n.clientTop}else o&&(s.x=vh(o));const u=!o||r||i?(0,rh.ze)(0):mh(o,l);
1return{x:a.left+l.scrollLeft-s.x-u.x,y:a.top+l.scrollTop-s.y-u.y,width:a.width,height:a.height}}function yh(e){return"static"===(0,sh.Dx)(e).position}function Ch(e,n){if(!(0,sh.Re)(e)||"fixed"===(0,sh.Dx)(e).position)return null;if(n)return n(e);let t=e.offsetParent;return(0,sh.tF)(e)===t&&(t=t.ownerDocument.body),t}function jh(e,n){const t=(0,sh.Jj)(e);if((0,sh.tR)(e))return t;if(!(0,sh.Re)(e)){let n=(0,sh.Ow)(e);for(;n&&!(0,sh.Py)(n);){if((0,sh.kK)(n)&&!yh(n))return n;n=(0,sh.Ow)(n)}return t}let r=Ch(e,n);for(;r&&(0,sh.Ze)(r)&&yh(r);)r=Ch(r,n);return r&&(0,sh.Py)(r)&&yh(r)&&!(0,sh.hT)(r)?t:r||(0,sh.gQ)(e)||t}const wh={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:n,rect:t,offsetParent:r,strategy:o}=e;const i="fixed"===o,a=(0,sh.tF)(r),l=!!n&&(0,sh.tR)(n.floating);if(r===a||l&&i)return t;let s={scrollLeft:0,scrollTop:0},u=(0,rh.ze)(1);const c=(0,rh.ze)(0),d=(0,sh.Re)(r);if((d||!d&&!i)&&(("body"!==(0,sh.wk)(r)||(0,sh.ao)(a))&&(s=(0,sh.Lw)(r)),(0,sh.Re)(r))){const e=hh(r);u=dh(r),c.x=e.x+r.clientLeft,c.y=e.y+r.clientTop}const f=!a||d||i?(0,rh.ze)(0):mh(a,s,!0);return{width:t.width*u.x,height:t.height*u.y,x:t.x*u.x-s.scrollLeft*u.x+c.x+f.x,y:t.y*u.y-s.scrollTop*u.y+c.y+f.y}},getDocumentElement:sh.tF,getClippingRect:function(e){let{element:n,boundary:t,rootBoundary:r,strategy:o}=e;const i="clippingAncestors"===t?(0,sh.tR)(n)?[]:function(e,n){const t=n.get(e);if(t)return t;let r=(0,sh.Kx)(e,[],!1).filter((e=>(0,sh.kK)(e)&&"body"!==(0,sh.wk)(e))),o=null;const i="fixed"===(0,sh.Dx)(e).position;let a=i?(0,sh.Ow)(e):e;for(;(0,sh.kK)(a)&&!(0,sh.Py)(a);){const n=(0,sh.Dx)(a),t=(0,sh.hT)(a);t||"fixed"!==n.position||(o=null),(i?!t&&!o:!t&&"static"===n.position&&o&&["absolute","fixed"].includes(o.position)||(0,sh.ao)(a)&&!t&&xh(e,a))?r=r.filter((e=>e!==a)):o=n,a=(0,sh.Ow)(a)}return n.set(e,r),r}(n,this._c):[].concat(t),a=[...i,r],l=a[0],s=a.reduce(((e,t)=>{const r=gh(n,t,o);return e.top=(0,rh.Fp)(r.top,e.top),e.right=(0,rh.VV)(r.right,e.right),e.bottom=(0,rh.VV)(r.bottom,e.bottom),e.left=(0,rh.Fp)(r.left,e.left),e}),gh(n,l,o));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}},getOffsetParent:jh,getElementRects:async function(e){const n=this.getOffsetParent||jh,t=this.getDimensions,r=await t(e.floating);return{reference:bh(e.reference,await n(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:n,height:t}=uh(e);return{width:n,height:t}},getScale:dh,isElement:sh.kK,isRTL:function(e){return"rtl"===(0,sh.Dx)(e).direction}};function Nh(e,n,t,r){void 0===r&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:a="function"===typeof ResizeObserver,layoutShift:l="function"===typeof IntersectionObserver,animationFrame:s=!1}=r,u=ch(e),c=o||i?[...u?(0,sh.Kx)(u):[],...(0,sh.Kx)(n)]:[];c.forEach((e=>{o&&e.addEventListener("scroll",t,{passive:!0}),i&&e.addEventListener("resize",t)}));const d=u&&l?function(e,n){let t,r=null;const o=(0,sh.tF)(e);function i(){var e;clearTimeout(t),null==(e=r)||e.disconnect(),r=null}return function a(l,s){void 0===l&&(l=!1),void 0===s&&(s=1),i();const{left:u,top:c,width:d,height:f}=e.getBoundingClientRect();if(l||n(),!d||!f)return;const p={rootMargin:-(0,rh.GW)(c)+"px "+-(0,rh.GW)(o.clientWidth-(u+d))+"px "+-(0,rh.GW)(o.clientHeight-(c+f))+"px "+-(0,rh.GW)(u)+"px",threshold:(0,rh.Fp)(0,(0,rh.VV)(1,s))||1};let h=!0;function v(e){const n=e[0].intersectionRatio;if(n!==s){if(!h)return a();n?a(!1,n):t=setTimeout((()=>{a(!1,1e-7)}),1e3)}h=!1}try{r=new IntersectionObserver(v,{...p,root:o.ownerDocument})}catch(m){r=new IntersectionObserver(v,p)}r.observe(e)}(!0),i}(u,t):null;let f,p=-1,h=null;a&&(h=new ResizeObserver((e=>{let[r]=e;r&&r.target===u&&h&&(h.unobserve(n),cancelAnimationFrame(p),p=requestAnimationFrame((()=>{var e;null==(e=h)||e.observe(n)}))),t()})),u&&!s&&h.observe(u),h.observe(n));let v=s?hh(e):null;return s&&function n(){const r=hh(e);!v||r.x===v.x&&r.y===v.y&&r.width===v.width&&r.height===v.height||t();v=r,f=requestAnimationFrame(n)}(),t(),()=>{var e;
1c.forEach((e=>{o&&e.removeEventListener("scroll",t),i&&e.removeEventListener("resize",t)})),null==d||d(),null==(e=h)||e.disconnect(),h=null,s&&cancelAnimationFrame(f)}}const Sh=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(n){var t,r;const{x:o,y:i,placement:a,middlewareData:l}=n,s=await async function(e,n){const{placement:t,platform:r,elements:o}=e,i=await(null==r.isRTL?void 0:r.isRTL(o.floating)),a=(0,rh.k3)(t),l=(0,rh.hp)(t),s="y"===(0,rh.Qq)(t),u=["left","top"].includes(a)?-1:1,c=i&&s?-1:1,d=(0,rh.ku)(n,e);let{mainAxis:f,crossAxis:p,alignmentAxis:h}="number"===typeof d?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return l&&"number"===typeof h&&(p="end"===l?-1*h:h),s?{x:p*c,y:f*u}:{x:f*u,y:p*c}}(n,e);return a===(null==(t=l.offset)?void 0:t.placement)&&null!=(r=l.arrow)&&r.alignmentOffset?{}:{x:o+s.x,y:i+s.y,data:{...s,placement:a}}}}},kh=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(n){const{x:t,y:r,placement:o}=n,{mainAxis:i=!0,crossAxis:a=!1,limiter:l={fn:e=>{let{x:n,y:t}=e;return{x:n,y:t}}},...s}=(0,rh.ku)(e,n),u={x:t,y:r},c=await ih(n,s),d=(0,rh.Qq)((0,rh.k3)(o)),f=(0,rh.Rn)(d);let p=u[f],h=u[d];if(i){const e="y"===f?"bottom":"right",n=p+c["y"===f?"top":"left"],t=p-c[e];p=(0,rh.uZ)(n,p,t)}if(a){const e="y"===d?"bottom":"right",n=h+c["y"===d?"top":"left"],t=h-c[e];h=(0,rh.uZ)(n,h,t)}const v=l.fn({...n,[f]:p,[d]:h});return{...v,data:{x:v.x-t,y:v.y-r,enabled:{[f]:i,[d]:a}}}}}},_h=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(n){var t,r;const{placement:o,middlewareData:i,rects:a,initialPlacement:l,platform:s,elements:u}=n,{mainAxis:c=!0,crossAxis:d=!0,fallbackPlacements:f,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:v=!0,...m}=(0,rh.ku)(e,n);if(null!=(t=i.arrow)&&t.alignmentOffset)return{};const g=(0,rh.k3)(o),x=(0,rh.Qq)(l),b=(0,rh.k3)(l)===l,y=await(null==s.isRTL?void 0:s.isRTL(u.floating)),C=f||(b||!v?[(0,rh.pw)(l)]:(0,rh.gy)(l)),j="none"!==h;!f&&j&&C.push(...(0,rh.KX)(l,v,h,y));const w=[l,...C],N=await ih(n,m),S=[];let k=(null==(r=i.flip)?void 0:r.overflows)||[];if(c&&S.push(N[g]),d){const e=(0,rh.i8)(o,a,y);S.push(N[e[0]],N[e[1]])}if(k=[...k,{placement:o,overflows:S}],!S.every((e=>e<=0))){var _,Z;const e=((null==(_=i.flip)?void 0:_.index)||0)+1,n=w[e];if(n)return{data:{index:e,overflows:k},reset:{placement:n}};let t=null==(Z=k.filter((e=>e.overflows[0]<=0)).sort(((e,n)=>e.overflows[1]-n.overflows[1]))[0])?void 0:Z.placement;if(!t)switch(p){case"bestFit":{var E;const e=null==(E=k.filter((e=>{if(j){const n=(0,rh.Qq)(e.placement);return n===x||"y"===n}return!0})).map((e=>[e.placement,e.overflows.filter((e=>e>0)).reduce(((e,n)=>e+n),0)])).sort(((e,n)=>e[1]-n[1]))[0])?void 0:E[0];e&&(t=e);break}case"initialPlacement":t=l}if(o!==t)return{reset:{placement:t}}}return{}}}},Zh=function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(n){var t,r;const{placement:o,rects:i,platform:a,elements:l}=n,{apply:s=(()=>{}),...u}=(0,rh.ku)(e,n),c=await ih(n,u),d=(0,rh.k3)(o),f=(0,rh.hp)(o),p="y"===(0,rh.Qq)(o),{width:h,height:v}=i.floating;let m,g;"top"===d||"bottom"===d?(m=d,g=f===(await(null==a.isRTL?void 0:a.isRTL(l.floating))?"start":"end")?"left":"right"):(g=d,m="end"===f?"top":"bottom");const x=v-c.top-c.bottom,b=h-c.left-c.right,y=(0,rh.VV)(v-c[m],x),C=(0,rh.VV)(h-c[g],b),j=!n.middlewareData.shift;let w=y,N=C;if(null!=(t=n.middlewareData.shift)&&t.enabled.x&&(N=b),null!=(r=n.middlewareData.shift)&&r.enabled.y&&(w=x),j&&!f){const e=(0,rh.Fp)(c.left,0),n=(0,rh.Fp)(c.right,0),t=(0,rh.Fp)(c.top,0),r=(0,rh.Fp)(c.bottom,0);p?N=h-2*(0!==e||0!==n?e+n:(0,rh.Fp)(c.left,c.right)):w=v-2*(0!==t||0!==r?t+r:(0,rh.Fp)(c.top,c.bottom))}await s({...n,availableWidth:N,availableHeight:w});const S=await a.getDimensions(l.floating);return h!==S.width||v!==S.height?{reset:{rects:!0}}:{}}}},Eh=function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(n){const{rects:t}=n,{strategy:r="referenceHidden",...o}=(0,rh.ku)(e,n);switch(r){case"referenceHidden":{const e=ah(await ih(n,{...o,elementContext:"reference"}),t.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:lh(e)}}}case"escaped":{const e=ah(await ih(n,{...o,altBoundary:!0}),t.floating);return{data:{escapedOffsets:e,escaped:lh(e)}}}default:return{}}}}},Ih=e=>({name:"arrow",options:e,async fn(n){const{x:t,y:r,placement:o,rects:i,platform:a,elements:l,middlewareData:s}=n,{element:u,padding:c=0}=(0,rh.ku)(e,n)||{};if(null==u)return{};const d=(0,rh.yd)(c),f={x:t,y:r},p=(0,rh.Wh)(o),h=(0,rh.I4)(p),v=await a.getDimensions(u),m="y"===p,g=m?"top":"left",x=m?"bottom":"right",b=m?"clientHeight":"clientWidth",y=i.reference[h]+i.reference[p]-f[p]-i.floating[h],C=f[p]-i.reference[p],j=await(null==a.getOffsetParent?void 0:a.getOffsetParent(u));let w=j?j[b]:0;
1w&&await(null==a.isElement?void 0:a.isElement(j))||(w=l.floating[b]||i.floating[h]);const N=y/2-C/2,S=w/2-v[h]/2-1,k=(0,rh.VV)(d[g],S),_=(0,rh.VV)(d[x],S),Z=k,E=w-v[h]-_,I=w/2-v[h]/2+N,O=(0,rh.uZ)(Z,I,E),T=!s.arrow&&null!=(0,rh.hp)(o)&&I!==O&&i.reference[h]/2-(I<Z?k:_)-v[h]/2<0,A=T?I<Z?I-Z:I-E:0;return{[p]:f[p]+A,data:{[p]:O,centerOffset:I-O-A,...T&&{alignmentOffset:A}},reset:T}}}),Oh=function(e){return void 0===e&&(e={}),{options:e,fn(n){const{x:t,y:r,placement:o,rects:i,middlewareData:a}=n,{offset:l=0,mainAxis:s=!0,crossAxis:u=!0}=(0,rh.ku)(e,n),c={x:t,y:r},d=(0,rh.Qq)(o),f=(0,rh.Rn)(d);let p=c[f],h=c[d];const v=(0,rh.ku)(l,n),m="number"===typeof v?{mainAxis:v,crossAxis:0}:{mainAxis:0,crossAxis:0,...v};if(s){const e="y"===f?"height":"width",n=i.reference[f]-i.floating[e]+m.mainAxis,t=i.reference[f]+i.reference[e]-m.mainAxis;p<n?p=n:p>t&&(p=t)}if(u){var g,x;const e="y"===f?"width":"height",n=["top","left"].includes((0,rh.k3)(o)),t=i.reference[d]-i.floating[e]+(n&&(null==(g=a.offset)?void 0:g[d])||0)+(n?0:m.crossAxis),r=i.reference[d]+i.reference[e]+(n?0:(null==(x=a.offset)?void 0:x[d])||0)-(n?m.crossAxis:0);h<t?h=t:h>r&&(h=r)}return{[f]:p,[d]:h}}}},Th=(e,n,t)=>{const r=new Map,o={platform:wh,...t},i={...o.platform,_c:r};return(async(e,n,t)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:a}=t,l=i.filter(Boolean),s=await(null==a.isRTL?void 0:a.isRTL(n));let u=await a.getElementRects({reference:e,floating:n,strategy:o}),{x:c,y:d}=oh(u,r,s),f=r,p={},h=0;for(let v=0;v<l.length;v++){const{name:t,fn:i}=l[v],{x:m,y:g,data:x,reset:b}=await i({x:c,y:d,initialPlacement:r,placement:f,strategy:o,middlewareData:p,rects:u,platform:a,elements:{reference:e,floating:n}});c=null!=m?m:c,d=null!=g?g:d,p={...p,[t]:{...p[t],...x}},b&&h<=50&&(h++,"object"===typeof b&&(b.placement&&(f=b.placement),b.rects&&(u=!0===b.rects?await a.getElementRects({reference:e,floating:n,strategy:o}):b.rects),({x:c,y:d}=oh(u,f,s))),v=-1)}return{x:c,y:d,placement:f,strategy:o,middlewareData:p}})(e,n,{...o,platform:i})};var Ah="undefined"!==typeof document?l.useLayoutEffect:l.useEffect;function Dh(e,n){if(e===n)return!0;if(typeof e!==typeof n)return!1;if("function"===typeof e&&e.toString()===n.toString())return!0;let t,r,o;if(e&&n&&"object"===typeof e){if(Array.isArray(e)){if(t=e.length,t!==n.length)return!1;for(r=t;0!==r--;)if(!Dh(e[r],n[r]))return!1;return!0}if(o=Object.keys(e),t=o.length,t!==Object.keys(n).length)return!1;for(r=t;0!==r--;)if(!{}.hasOwnProperty.call(n,o[r]))return!1;for(r=t;0!==r--;){const t=o[r];if(("_owner"!==t||!e.$$typeof)&&!Dh(e[t],n[t]))return!1}return!0}return e!==e&&n!==n}function Lh(e){if("undefined"===typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Mh(e,n){const t=Lh(e);return Math.round(n*t)/t}function Ph(e){const n=l.useRef(e);return Ah((()=>{n.current=e})),n}const Rh=e=>({name:"arrow",options:e,fn(n){const{element:t,padding:r}="function"===typeof e?e(n):e;return t&&(o=t,{}.hasOwnProperty.call(o,"current"))?null!=t.current?Ih({element:t.current,padding:r}).fn(n):{}:t?Ih({element:t,padding:r}).fn(n):{};var o}}),Fh=(e,n)=>({...Sh(e),options:[e,n]}),zh=(e,n)=>({...kh(e),options:[e,n]}),Bh=(e,n)=>({...Oh(e),options:[e,n]}),Hh=(e,n)=>({..._h(e),options:[e,n]}),Vh=(e,n)=>({...Zh(e),options:[e,n]}),$h=(e,n)=>({...Eh(e),options:[e,n]}),Uh=(e,n)=>({...Rh(e),options:[e,n]});var Wh=l.forwardRef(((e,n)=>{const{children:t,width:r=10,height:o=5,...a}=e;return(0,i.jsx)(Np.svg,{...a,ref:n,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?t:(0,i.jsx)("polygon",{points:"0,0 30,0 15,10"})})}));Wh.displayName="Arrow";var qh=Wh;function Kh(...e){const n=e[0];if(1===e.length)return n;const t=()=>{const t=e.map((e=>({useScope:e(),scopeName:e.scopeName})));return function(e){const r=t.reduce(((n,{useScope:t,scopeName:r})=>({...n,...t(e)[`__scope${r}`]})),{});return l.useMemo((()=>({[`__scope${n.scopeName}`]:r})),[r])}};return t.scopeName=n.scopeName,t}var Gh="Popper",[Jh,Xh]=function(e,n=[]){let t=[];const r=()=>{const n=t.map((e=>l.createContext(e)));return function(t){const r=t?.[e]||n;return l.useMemo((()=>({[`__scope${e}`]:{...t,[e]:r}})),[t,r])}};return r.scopeName=e,[function(n,r){const o=l.createContext(r),a=t.length;function s(n){const{scope:t,children:r,...s}=n,u=t?.[e][a]||o,c=l.useMemo((()=>s),Object.values(s));return(0,i.jsx)(u.Provider,{value:c,children:r})}return t=[...t,r],s.displayName=n+"Provider",[s,function(t,i){const s=i?.[e][a]||o,u=l.useContext(s);if(u)return u;if(void 0!==r)return r;throw new Error(`\`${t}\` must be used within \`${n}\``)}]},Kh(r,...n)]}(Gh),[Yh,Qh]=Jh(Gh),ev=e=>{const{__scopePopper:n,children:t}=e,[r,o]=l.useState(null);return(0,i.jsx)(Yh,{scope:n,anchor:r,onAnchorChange:o,children:t})};ev.displayName=Gh;var nv="PopperAnchor",tv=l.forwardRef(((e,n)=>{const{__scopePopper:t,virtualRef:r,...o}=e,a=Qh(nv,t),s=l.useRef(null),u=xp(n,s);return l.useEffect((()=>{a.onAnchorChange(r?.current||s.current)})),r?null:(0,i.jsx)(Np.div,{...o,ref:u})}));tv.displayName=nv;var rv="PopperContent",[ov,iv]=Jh(rv),av=l.forwardRef(((e,n)=>{const{__scopePopper:t,side:r="bottom",sideOffset:o=0,align:a="center",alignOffset:s=0,arrowPadding:u=0,avoidCollisions:c=!0,collisionBoundary:d=[],collisionPadding:f=0,sticky:p="partial",hideWhenDetached:h=!1,updatePositionStrategy:v="optimized",onPlaced:m,...g}=e,x=Qh(rv,t),[b,y]=l.useState(null),C=xp(n,(e=>y(e))),[j,w]=l.useState(null),N=function(e){const[n,t]=l.useState(void 0);return Qp((()=>
vendor: 6,043 bytes, line 1
1{if(e){t({width:e.offsetWidth,height:e.offsetHeight});const n=new ResizeObserver((n=>{if(!Array.isArray(n))return;if(!n.length)return;const r=n[0];let o,i;if("borderBoxSize"in r){const e=r.borderBoxSize,n=Array.isArray(e)?e[0]:e;o=n.inlineSize,i=n.blockSize}else o=e.offsetWidth,i=e.offsetHeight;t({width:o,height:i})}));return n.observe(e,{box:"border-box"}),()=>n.unobserve(e)}t(void 0)}),[e]),n}(j),S=N?.width??0,k=N?.height??0,_=r+("center"!==a?"-"+a:""),Z="number"===typeof f?f:{top:0,right:0,bottom:0,left:0,...f},E=Array.isArray(d)?d:[d],I=E.length>0,O={padding:Z,boundary:E.filter(cv),altBoundary:I},{refs:T,floatingStyles:A,placement:D,isPositioned:L,middlewareData:M}=function(e){void 0===e&&(e={});const{placement:n="bottom",strategy:t="absolute",middleware:r=[],platform:o,elements:{reference:i,floating:a}={},transform:s=!0,whileElementsMounted:u,open:c}=e,[d,f]=l.useState({x:0,y:0,strategy:t,placement:n,middlewareData:{},isPositioned:!1}),[p,h]=l.useState(r);Dh(p,r)||h(r);const[v,m]=l.useState(null),[g,x]=l.useState(null),b=l.useCallback((e=>{e!==w.current&&(w.current=e,m(e))}),[]),y=l.useCallback((e=>{e!==N.current&&(N.current=e,x(e))}),[]),C=i||v,j=a||g,w=l.useRef(null),N=l.useRef(null),S=l.useRef(d),k=null!=u,_=Ph(u),Z=Ph(o),E=Ph(c),I=l.useCallback((()=>{if(!w.current||!N.current)return;const e={placement:n,strategy:t,middleware:p};Z.current&&(e.platform=Z.current),Th(w.current,N.current,e).then((e=>{const n={...e,isPositioned:!1!==E.current};O.current&&!Dh(S.current,n)&&(S.current=n,pu.flushSync((()=>{f(n)})))}))}),[p,n,t,Z,E]);Ah((()=>{!1===c&&S.current.isPositioned&&(S.current.isPositioned=!1,f((e=>({...e,isPositioned:!1}))))}),[c]);const O=l.useRef(!1);Ah((()=>(O.current=!0,()=>{O.current=!1})),[]),Ah((()=>{if(C&&(w.current=C),j&&(N.current=j),C&&j){if(_.current)return _.current(C,j,I);I()}}),[C,j,I,_,k]);const T=l.useMemo((()=>({reference:w,floating:N,setReference:b,setFloating:y})),[b,y]),A=l.useMemo((()=>({reference:C,floating:j})),[C,j]),D=l.useMemo((()=>{const e={position:t,left:0,top:0};if(!A.floating)return e;const n=Mh(A.floating,d.x),r=Mh(A.floating,d.y);return s?{...e,transform:"translate("+n+"px, "+r+"px)",...Lh(A.floating)>=1.5&&{willChange:"transform"}}:{position:t,left:n,top:r}}),[t,s,A.floating,d.x,d.y]);return l.useMemo((()=>({...d,update:I,refs:T,elements:A,floatingStyles:D})),[d,I,T,A,D])}({strategy:"fixed",placement:_,whileElementsMounted:(...e)=>Nh(...e,{animationFrame:"always"===v}),elements:{reference:x.anchor},middleware:[Fh({mainAxis:o+k,alignmentAxis:s}),c&&zh({mainAxis:!0,crossAxis:!1,limiter:"partial"===p?Bh():void 0,...O}),c&&Hh({...O}),Vh({...O,apply:({elements:e,rects:n,availableWidth:t,availableHeight:r})=>{const{width:o,height:i}=n.reference,a=e.floating.style;a.setProperty("--radix-popper-available-width",`${t}px`),a.setProperty("--radix-popper-available-height",`${r}px`),a.setProperty("--radix-popper-anchor-width",`${o}px`),a.setProperty("--radix-popper-anchor-height",`${i}px`)}}),j&&Uh({element:j,padding:u}),dv({arrowWidth:S,arrowHeight:k}),h&&$h({strategy:"referenceHidden",...O})]}),[P,R]=fv(D),F=Ip(m);Qp((()=>{L&&F?.()}),[L,F]);const z=M.arrow?.x,B=M.arrow?.y,H=0!==M.arrow?.centerOffset,[V,$]=l.useState();return Qp((()=>{b&&$(window.getComputedStyle(b).zIndex)}),[b]),(0,i.jsx)("div",{ref:T.setFloating,"data-radix-popper-content-wrapper":"",style:{...A,transform:L?A.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:V,"--radix-popper-transform-origin":[M.transformOrigin?.x,M.transformOrigin?.y].join(" "),...M.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:(0,i.jsx)(ov,{scope:t,placedSide:P,onArrowChange:w,arrowX:z,arrowY:B,shouldHideArrow:H,children:(0,i.jsx)(Np.div,{"data-side":P,"data-align":R,...g,ref:C,style:{...g.style,animation:L?void 0:"none"}})})})}));av.displayName=rv;var lv="PopperArrow",sv={top:"bottom",right:"left",bottom:"top",left:"right"},uv=l.forwardRef((function(e,n){const{__scopePopper:t,...r}=e,o=iv(lv,t),a=sv[o.placedSide];return(0,i.jsx)("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0},children:(0,i.jsx)(qh,{...r,ref:n,style:{...r.style,display:"block"}})})}));function cv(e){return null!==e}uv.displayName=lv;var dv=e=>({name:"transformOrigin",options:e,fn(n){const{placement:t,rects:r,middlewareData:o}=n,i=0!==o.arrow?.centerOffset,a=i?0:e.arrowWidth,l=i?0:e.arrowHeight,[s,u]=fv(t),c={start:"0%",center:"50%",end:"100%"}[u],d=(o.arrow?.x??0)+a/2,f=(o.arrow?.y??0)+l/2;let p="",h="";return"bottom"===s?(p=i?c:`${d}px`,h=-l+"px"):"top"===s?(p=i?c:`${d}px`,h=`${r.floating.height+l}px`):"right"===s?(p=-l+"px",h=i?c:`${f}px`):"left"===s&&(p=`${r.floating.width+l}px`,h=i?c:`${f}px`),{data:{x:p,y:h}}}});function fv(e){const[n,t="center"]=e.split("-");return[n,t]}var pv=ev,hv=tv,vv=av,mv=uv,gv=l.forwardRef(((e,n)=>{const{container:t,...r}=e,[o,a]=l.useState(!1);Qp((()=>a(!0)),[]);const s=t||o&&globalThis?.document?.body;return s?pu.createPortal((0,i.jsx)(Np.div,{...r,ref:n}),s):null}));gv.displayName="Portal";var xv=e=>{const{present:n,children:t}=e,r=function(e){const[n,t]=l.useState(),r=l.useRef({}),o=l.useRef(e),i=l.useRef("none"),a=e?"mounted":"unmounted",[s,u]=function(e,n){return l.useReducer(((e,t)=>n[e][t]??e),e)}(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return l.useEffect((()=>{const e=bv(r.current);i.current="mounted"===s?e:"none"}),[s]),Qp((()=>{const n=r.current,t=o.current;if(t!==e){const r=i.current,a=bv(n);if(e)u("MOUNT");else if("none"===a||"none"===n?.display)u("UNMOUNT");else{const e=r!==a;u(t&&e?"ANIMATION_OUT":"UNMOUNT")}o.current=e}}),[e,u]),Qp((()=>
1{if(n){let e;const t=n.ownerDocument.defaultView??window,a=i=>{const a=bv(r.current).includes(i.animationName);if(i.target===n&&a&&(u("ANIMATION_END"),!o.current)){const r=n.style.animationFillMode;n.style.animationFillMode="forwards",e=t.setTimeout((()=>{"forwards"===n.style.animationFillMode&&(n.style.animationFillMode=r)}))}},l=e=>{e.target===n&&(i.current=bv(r.current))};return n.addEventListener("animationstart",l),n.addEventListener("animationcancel",a),n.addEventListener("animationend",a),()=>{t.clearTimeout(e),n.removeEventListener("animationstart",l),n.removeEventListener("animationcancel",a),n.removeEventListener("animationend",a)}}u("ANIMATION_END")}),[n,u]),{isPresent:["mounted","unmountSuspended"].includes(s),ref:l.useCallback((e=>{e&&(r.current=getComputedStyle(e)),t(e)}),[])}}(n),o="function"===typeof t?t({present:r.isPresent}):l.Children.only(t),i=xp(r.ref,function(e){let n=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,t=n&&"isReactWarning"in n&&n.isReactWarning;if(t)return e.ref;if(n=Object.getOwnPropertyDescriptor(e,"ref")?.get,t=n&&"isReactWarning"in n&&n.isReactWarning,t)return e.props.ref;return e.props.ref||e.ref}(o));return"function"===typeof t||r.isPresent?l.cloneElement(o,{ref:i}):null};function bv(e){return e?.animationName||"none"}function yv(...e){const n=e[0];if(1===e.length)return n;const t=()=>{const t=e.map((e=>({useScope:e(),scopeName:e.scopeName})));return function(e){const r=t.reduce(((n,{useScope:t,scopeName:r})=>({...n,...t(e)[`__scope${r}`]})),{});return l.useMemo((()=>({[`__scope${n.scopeName}`]:r})),[r])}};return t.scopeName=n.scopeName,t}function Cv({prop:e,defaultProp:n,onChange:t=(()=>{})}){const[r,o]=function({defaultProp:e,onChange:n}){const t=l.useState(e),[r]=t,o=l.useRef(r),i=Ip(n);return l.useEffect((()=>{o.current!==r&&(i(r),o.current=r)}),[r,o,i]),t}({defaultProp:n,onChange:t}),i=void 0!==e,a=i?e:r,s=Ip(t);return[a,l.useCallback((n=>{if(i){const t=n,r="function"===typeof n?t(e):n;r!==e&&s(r)}else o(n)}),[i,e,o,s])]}xv.displayName="Presence";var jv="rovingFocusGroup.onEntryFocus",wv={bubbles:!1,cancelable:!0},Nv="RovingFocusGroup",[Sv,kv,_v]=_p(Nv),[Zv,Ev]=function(e,n=[]){let t=[];const r=()=>{const n=t.map((e=>l.createContext(e)));return function(t){const r=t?.[e]||n;return l.useMemo((()=>({[`__scope${e}`]:{...t,[e]:r}})),[t,r])}};return r.scopeName=e,[function(n,r){const o=l.createContext(r),a=t.length;function s(n){const{scope:t,children:r,...s}=n,u=t?.[e][a]||o,c=l.useMemo((()=>s),Object.values(s));return(0,i.jsx)(u.Provider,{value:c,children:r})}return t=[...t,r],s.displayName=n+"Provider",[s,function(t,i){const s=i?.[e][a]||o,u=l.useContext(s);if(u)return u;if(void 0!==r)return r;throw new Error(`\`${t}\` must be used within \`${n}\``)}]},yv(r,...n)]}(Nv,[_v]),[Iv,Ov]=Zv(Nv),Tv=l.forwardRef(((e,n)=>(0,i.jsx)(Sv.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,i.jsx)(Sv.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,i.jsx)(Av,{...e,ref:n})})})));Tv.displayName=Nv;var Av=l.forwardRef(((e,n)=>{const{__scopeRovingFocusGroup:t,orientation:r,loop:o=!1,dir:a,currentTabStopId:s,defaultCurrentTabStopId:u,onCurrentTabStopIdChange:c,onEntryFocus:d,preventScrollOnEntryFocus:f=!1,...p}=e,h=l.useRef(null),v=xp(n,h),m=Ep(a),[g=null,x]=Cv({prop:s,defaultProp:u,onChange:c}),[b,y]=l.useState(!1),C=Ip(d),j=kv(t),w=l.useRef(!1),[N,S]=l.useState(0);return l.useEffect((()=>{const e=h.current;if(e)return e.addEventListener(jv,C),()=>e.removeEventListener(jv,C)}),[C]),(0,i.jsx)(Iv,{scope:t,orientation:r,dir:m,loop:o,currentTabStopId:g,onItemFocus:l.useCallback((e=>x(e)),[x]),onItemShiftTab:l.useCallback((()=>y(!0)),[]),onFocusableItemAdd:l.useCallback((()=>S((e=>e+1))),[]),onFocusableItemRemove:l.useCallback((()=>S((e=>e-1))),[]),children:(0,i.jsx)(Np.div,{tabIndex:b||0===N?-1:0,"data-orientation":r,...p,ref:v,style:{outline:"none",...e.style},onMouseDown:hp(e.onMouseDown,(()=>{w.current=!0})),onFocus:hp(e.onFocus,(e=>{const n=!w.current;if(e.target===e.currentTarget&&n&&!b){const n=new CustomEvent(jv,wv);if(e.currentTarget.dispatchEvent(n),!n.defaultPrevented){const e=j().filter((e=>
1e.focusable));Pv([e.find((e=>e.active)),e.find((e=>e.id===g)),...e].filter(Boolean).map((e=>e.ref.current)),f)}}w.current=!1})),onBlur:hp(e.onBlur,(()=>y(!1)))})})})),Dv="RovingFocusGroupItem",Lv=l.forwardRef(((e,n)=>{const{__scopeRovingFocusGroup:t,focusable:r=!0,active:o=!1,tabStopId:a,...s}=e,u=th(),c=a||u,d=Ov(Dv,t),f=d.currentTabStopId===c,p=kv(t),{onFocusableItemAdd:h,onFocusableItemRemove:v}=d;return l.useEffect((()=>{if(r)return h(),()=>v()}),[r,h,v]),(0,i.jsx)(Sv.ItemSlot,{scope:t,id:c,focusable:r,active:o,children:(0,i.jsx)(Np.span,{tabIndex:f?0:-1,"data-orientation":d.orientation,...s,ref:n,onMouseDown:hp(e.onMouseDown,(e=>{r?d.onItemFocus(c):e.preventDefault()})),onFocus:hp(e.onFocus,(()=>d.onItemFocus(c))),onKeyDown:hp(e.onKeyDown,(e=>{if("Tab"===e.key&&e.shiftKey)return void d.onItemShiftTab();if(e.target!==e.currentTarget)return;const n=function(e,n,t){const r=function(e,n){return"rtl"!==n?e:"ArrowLeft"===e?"ArrowRight":"ArrowRight"===e?"ArrowLeft":e}(e.key,t);return"vertical"===n&&["ArrowLeft","ArrowRight"].includes(r)||"horizontal"===n&&["ArrowUp","ArrowDown"].includes(r)?void 0:Mv[r]}(e,d.orientation,d.dir);if(void 0!==n){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let o=p().filter((e=>e.focusable)).map((e=>e.ref.current));if("last"===n)o.reverse();else if("prev"===n||"next"===n){"prev"===n&&o.reverse();const i=o.indexOf(e.currentTarget);o=d.loop?(r=i+1,(t=o).map(((e,n)=>t[(r+n)%t.length]))):o.slice(i+1)}setTimeout((()=>Pv(o)))}var t,r}))})})}));Lv.displayName=Dv;var Mv={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Pv(e,n=!1){const t=document.activeElement;for(const r of e){if(r===t)return;if(r.focus({preventScroll:n}),document.activeElement!==t)return}}var Rv=Tv,Fv=Lv,zv=t(49732),Bv="right-scroll-bar-position",Hv="width-before-scroll-bar",Vv=t(22442),$v=(0,t(64597)._)(),Uv=function(){},Wv=l.forwardRef((function(e,n){var t=l.useRef(null),r=l.useState({onScrollCapture:Uv,onWheelCapture:Uv,onTouchMoveCapture:Uv}),o=r[0],i=r[1],a=e.forwardProps,s=e.children,u=e.className,c=e.removeScrollBar,d=e.enabled,f=e.shards,p=e.sideCar,h=e.noIsolation,v=e.inert,m=e.allowPinchZoom,g=e.as,b=void 0===g?"div":g,y=e.gapMode,C=(0,x.__rest)(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),j=p,w=(0,Vv.q)([t,n]),N=(0,x.__assign)((0,x.__assign)({},C),o);return l.createElement(l.Fragment,null,d&&l.createElement(j,{sideCar:$v,removeScrollBar:c,shards:f,noIsolation:h,inert:v,setCallbacks:i,allowPinchZoom:!!m,lockRef:t,gapMode:y}),a?l.cloneElement(l.Children.only(s),(0,x.__assign)((0,x.__assign)({},N),{ref:w})):l.createElement(b,(0,x.__assign)({},N,{className:u,ref:w}),s))}));Wv.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},Wv.classNames={fullWidth:Hv,zeroRight:Bv};var qv=t(57758),Kv=t(50132);var Gv=function(){var e=0,n=null;return{add:function(t){var r,o;0==e&&(n=function(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var n=(0,Kv.V)();return n&&e.setAttribute("nonce",n),e}())&&(o=t,(r=n).styleSheet?r.styleSheet.cssText=o:r.appendChild(document.createTextNode(o)),function(e){(document.head||document.getElementsByTagName("head")[0]).appendChild(e)}(n)),e++},remove:function(){!--e&&n&&(n.parentNode&&n.parentNode.removeChild(n),n=null)}}},Jv=function(){var e=function(){var e=Gv();return function(n,t){l.useEffect((function(){return e.add(n),function(){e.remove()}}),[n&&t])}}();return function(n){var t=n.styles,r=n.dynamic;return e(t,r),null}},Xv={left:0,top:0,right:0,gap:0},Yv=function(e){return parseInt(e||"",10)||0},Qv=function(e){if(void 0===e&&(e="margin"),"undefined"===typeof window)return Xv;var n=function(e){var n=window.getComputedStyle(document.body),t=n["padding"===e?"paddingLeft":"marginLeft"],r=n["padding"===e?"paddingTop":"marginTop"],o=n["padding"===e?"paddingRight":"marginRight"];return[Yv(t),Yv(r),Yv(o)]}(e),t=document.documentElement.clientWidth,r=window.innerWidth;return{left:n[0],top:n[1],right:n[2],gap:Math.max(0,r-t+n[2]-n[0])}},em=Jv(),nm="data-scroll-locked",tm=function(e,n,t,r){var o=e.left,i=e.top,a=e.right,l=e.gap;return void 0===t&&(t="margin"),"\n  .".concat("with-scroll-bars-hidden"," {\n   overflow: hidden ").concat(r,";\n   padding-right: ").concat(l,"px ").concat(r,";\n  }\n  body[").concat(nm,"] {\n    overflow: hidden ").concat(r,";\n    overscroll-behavior: contain;\n    ").concat([n&&"position: relative ".concat(r,";"),"margin"===t&&"\n    padding-left: ".concat(o,"px;\n    padding-top: ").concat(i,"px;\n    padding-right: ").concat(a,"px;\n    margin-left:0;\n    margin-top:0;\n    margin-right: ").concat(l,"px ").concat(r,";\n    "),"padding"===t&&"padding-right: ".concat(l,"px ").concat(r,";
1")].filter(Boolean).join(""),"\n  }\n  \n  .").concat(Bv," {\n    right: ").concat(l,"px ").concat(r,";\n  }\n  \n  .").concat(Hv," {\n    margin-right: ").concat(l,"px ").concat(r,";\n  }\n  \n  .").concat(Bv," .").concat(Bv," {\n    right: 0 ").concat(r,";\n  }\n  \n  .").concat(Hv," .").concat(Hv," {\n    margin-right: 0 ").concat(r,";\n  }\n  \n  body[").concat(nm,"] {\n    ").concat("--removed-body-scroll-bar-size",": ").concat(l,"px;\n  }\n")},rm=function(){var e=parseInt(document.body.getAttribute(nm)||"0",10);return isFinite(e)?e:0},om=function(e){var n=e.noRelative,t=e.noImportant,r=e.gapMode,o=void 0===r?"margin":r;l.useEffect((function(){return document.body.setAttribute(nm,(rm()+1).toString()),function(){var e=rm()-1;e<=0?document.body.removeAttribute(nm):document.body.setAttribute(nm,e.toString())}}),[]);var i=l.useMemo((function(){return Qv(o)}),[o]);return l.createElement(em,{styles:tm(i,!n,o,t?"":"!important")})},im=!1;if("undefined"!==typeof window)try{var am=Object.defineProperty({},"passive",{get:function(){return im=!0,!0}});window.addEventListener("test",am,am),window.removeEventListener("test",am,am)}catch(AS){im=!1}var lm=!!im&&{passive:!1},sm=function(e,n){if(!(e instanceof Element))return!1;var t=window.getComputedStyle(e);return"hidden"!==t[n]&&!(t.overflowY===t.overflowX&&!function(e){return"TEXTAREA"===e.tagName}(e)&&"visible"===t[n])},um=function(e,n){var t=n.ownerDocument,r=n;do{if("undefined"!==typeof ShadowRoot&&r instanceof ShadowRoot&&(r=r.host),cm(e,r)){var o=dm(e,r);if(o[1]>o[2])return!0}r=r.parentNode}while(r&&r!==t.body);return!1},cm=function(e,n){return"v"===e?function(e){return sm(e,"overflowY")}(n):function(e){return sm(e,"overflowX")}(n)},dm=function(e,n){return"v"===e?[(t=n).scrollTop,t.scrollHeight,t.clientHeight]:function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]}(n);var t},fm=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},pm=function(e){return[e.deltaX,e.deltaY]},hm=function(e){return e&&"current"in e?e.current:e},vm=function(e){return"\n  .block-interactivity-".concat(e," {pointer-events: none;}\n  .allow-interactivity-").concat(e," {pointer-events: all;}\n")},mm=0,gm=[];function xm(e){for(var n=null;null!==e;)e instanceof ShadowRoot&&(n=e.host,e=e.host),e=e.parentNode;return n}var bm=(0,qv.L)($v,(function(e){var n=l.useRef([]),t=l.useRef([0,0]),r=l.useRef(),o=l.useState(mm++)[0],i=l.useState(Jv)[0],a=l.useRef(e);l.useEffect((function(){a.current=e}),[e]),l.useEffect((function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var n=(0,x.__spreadArray)([e.lockRef.current],(e.shards||[]).map(hm),!0).filter(Boolean);return n.forEach((function(e){return e.classList.add("allow-interactivity-".concat(o))})),function(){document.body.classList.remove("block-interactivity-".concat(o)),n.forEach((function(e){return e.classList.remove("allow-interactivity-".concat(o))}))}}}),[e.inert,e.lockRef.current,e.shards]);var s=l.useCallback((function(e,n){if("touches"in e&&2===e.touches.length||"wheel"===e.type&&e.ctrlKey)return!a.current.allowPinchZoom;var o,i=fm(e),l=t.current,s="deltaX"in e?e.deltaX:l[0]-i[0],u="deltaY"in e?e.deltaY:l[1]-i[1],c=e.target,d=Math.abs(s)>Math.abs(u)?"h":"v";if("touches"in e&&"h"===d&&"range"===c.type)return!1;var f=um(d,c);if(!f)return!0;if(f?o=d:(o="v"===d?"h":"v",f=um(d,c)),!f)return!1;if(!r.current&&"changedTouches"in e&&(s||u)&&(r.current=o),!o)return!0;var p=r.current||o;return function(e,n,t,r,o){var i=function(e,n){return"h"===e&&"rtl"===n?-1:1}(e,window.getComputedStyle(n).direction),a=i*r,l=t.target,s=n.contains(l),u=!1,c=a>0,d=0,f=0;do{var p=dm(e,l),h=p[0],v=p[1]-p[2]-i*h;(h||v)&&cm(e,l)&&(d+=v,f+=h),l=l instanceof ShadowRoot?l.host:l.parentNode}while(!s&&l!==document.body||s&&(n.contains(l)||n===l));return(c&&(o&&Math.abs(d)<1||!o&&a>d)||!c&&(o&&Math.abs(f)<1||!o&&-a>f))&&(u=!0),u}(p,n,e,"h"===p?s:u,!0)}),[]),u=l.useCallback((function(e){var t=e;if(gm.length&&gm[gm.length-1]===i){var r="deltaY"in t?pm(t):fm(t),o=n.current.filter((function(e){return e.name===t.type&&(e.target===t.target||t.target===e.shadowParent)&&(n=e.delta,o=r,n[0]===o[0]&&n[1]===o[1]);var n,o}))[0];if(o&&o.should)t.cancelable&&t.preventDefault();
1else if(!o){var l=(a.current.shards||[]).map(hm).filter(Boolean).filter((function(e){return e.contains(t.target)}));(l.length>0?s(t,l[0]):!a.current.noIsolation)&&t.cancelable&&t.preventDefault()}}}),[]),c=l.useCallback((function(e,t,r,o){var i={name:e,delta:t,target:r,should:o,shadowParent:xm(r)};n.current.push(i),setTimeout((function(){n.current=n.current.filter((function(e){return e!==i}))}),1)}),[]),d=l.useCallback((function(e){t.current=fm(e),r.current=void 0}),[]),f=l.useCallback((function(n){c(n.type,pm(n),n.target,s(n,e.lockRef.current))}),[]),p=l.useCallback((function(n){c(n.type,fm(n),n.target,s(n,e.lockRef.current))}),[]);l.useEffect((function(){return gm.push(i),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:p}),document.addEventListener("wheel",u,lm),document.addEventListener("touchmove",u,lm),document.addEventListener("touchstart",d,lm),function(){gm=gm.filter((function(e){return e!==i})),document.removeEventListener("wheel",u,lm),document.removeEventListener("touchmove",u,lm),document.removeEventListener("touchstart",d,lm)}}),[]);var h=e.removeScrollBar,v=e.inert;return l.createElement(l.Fragment,null,v?l.createElement(i,{styles:vm(o)}):null,h?l.createElement(om,{gapMode:e.gapMode}):null)})),ym=l.forwardRef((function(e,n){return l.createElement(Wv,(0,x.__assign)({},e,{ref:n,sideCar:bm}))}));ym.classNames=Wv.classNames;var Cm=ym,jm=["Enter"," "],wm=["ArrowUp","PageDown","End"],Nm=["ArrowDown","PageUp","Home",...wm],Sm={ltr:[...jm,"ArrowRight"],rtl:[...jm,"ArrowLeft"]},km={ltr:["ArrowLeft"],rtl:["ArrowRight"]},_m="Menu",[Zm,Em,Im]=_p(_m),[Om,Tm]=vp(_m,[Im,Xh,Ev]),Am=Xh(),Dm=Ev(),[Lm,Mm]=Om(_m),[Pm,Rm]=Om(_m),Fm=e=>{const{__scopeMenu:n,open:t=!1,children:r,dir:o,onOpenChange:a,modal:s=!0}=e,u=Am(n),[c,d]=l.useState(null),f=l.useRef(!1),p=Ip(a),h=Ep(o);return l.useEffect((()=>{const e=()=>{f.current=!0,document.addEventListener("pointerdown",n,{capture:!0,once:!0}),document.addEventListener("pointermove",n,{capture:!0,once:!0})},n=()=>f.current=!1;return document.addEventListener("keydown",e,{capture:!0}),()=>{document.removeEventListener("keydown",e,{capture:!0}),document.removeEventListener("pointerdown",n,{capture:!0}),document.removeEventListener("pointermove",n,{capture:!0})}}),[]),(0,i.jsx)(pv,{...u,children:(0,i.jsx)(Lm,{scope:n,open:t,onOpenChange:p,content:c,onContentChange:d,children:(0,i.jsx)(Pm,{scope:n,onClose:l.useCallback((()=>p(!1)),[p]),isUsingKeyboardRef:f,dir:h,modal:s,children:r})})})};Fm.displayName=_m;var zm=l.forwardRef(((e,n)=>{const{__scopeMenu:t,...r}=e,o=Am(t);return(0,i.jsx)(hv,{...o,...r,ref:n})}));zm.displayName="MenuAnchor";var Bm="MenuPortal",[Hm,Vm]=Om(Bm,{forceMount:void 0}),$m=e=>{const{__scopeMenu:n,forceMount:t,children:r,container:o}=e,a=Mm(Bm,n);return(0,i.jsx)(Hm,{scope:n,forceMount:t,children:(0,i.jsx)(xv,{present:t||a.open,children:(0,i.jsx)(gv,{asChild:!0,container:o,children:r})})})};$m.displayName=Bm;var Um="MenuContent",[Wm,qm]=Om(Um),Km=l.forwardRef(((e,n)=>{const t=Vm(Um,e.__scopeMenu),{forceMount:r=t.forceMount,...o}=e,a=Mm(Um,e.__scopeMenu),l=Rm(Um,e.__scopeMenu);return(0,i.jsx)(Zm.Provider,{scope:e.__scopeMenu,children:(0,i.jsx)(xv,{present:r||a.open,children:(0,i.jsx)(Zm.Slot,{scope:e.__scopeMenu,children:l.modal?(0,i.jsx)(Gm,{...o,ref:n}):(0,i.jsx)(Jm,{...o,ref:n})})})})})),Gm=l.forwardRef(((e,n)=>{const t=Mm(Um,e.__scopeMenu),r=l.useRef(null),o=xp(n,r);return l.useEffect((()=>{const e=r.current;if(e)return(0,zv.Ry)(e)}),[]),(0,i.jsx)(Xm,{...e,ref:o,trapFocus:t.open,disableOutsidePointerEvents:t.open,disableOutsideScroll:!0,onFocusOutside:hp(e.onFocusOutside,(e=>e.preventDefault()),{checkForDefaultPrevented:!1}),onDismiss:()=>t.onOpenChange(!1)})})),Jm=l.forwardRef(((e,n)=>{const t=Mm(Um,e.__scopeMenu);return(0,i.jsx)(Xm,{...e,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>t.onOpenChange(!1)})})),Xm=l.forwardRef(((e,n)=>{const{__scopeMenu:t,loop:r=!1,trapFocus:o,onOpenAutoFocus:a,onCloseAutoFocus:s,disableOutsidePointerEvents:u,onEntryFocus:c,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:p,onInteractOutside:h,onDismiss:v,disableOutsideScroll:m,...g}=e,x=Mm(Um,t),b=Rm(Um,t),y=Am(t),C=Dm(t),j=Em(t),[w,N]=l.useState(null),S=l.useRef(null),k=xp(n,S,x.onContentChange),_=l.useRef(0),Z=l.useRef(""),E=l.useRef(0),I=l.useRef(null),O=l.useRef("right"),T=l.useRef(0),A=m?Cm:l.Fragment,D=m?{as:bp,allowPinchZoom:!0}:void 0,L=e=>{const n=Z.current+e,t=j().filter((e=>!e.disabled)),r=document.activeElement,o=t.find((e=>e.ref.current===r))?.textValue,i=function(e,n,t){const r=n.length>1&&Array.from(n).every((e=>e===n[0]))?n[0]:n,o=t?e.indexOf(t):-1;let i=(a=e,l=Math.max(o,0),a.map(((e,n)=>a[(l+n)%a.length])));var a,l;1===r.length&&(i=i.filter((e=>e!==t)));const s=i.find((e=>e.toLowerCase().startsWith(r.toLowerCase())));return s!==t?s:void 0}(t.map((e=>e.textValue)),n,o),a=t.find((e=>e.textValue===i))?.ref.current;!function e(n){Z.current=n,window.clearTimeout(_.current),""!==n&&(_.current=window.setTimeout((()=>e("")),1e3))}(n),a&&setTimeout((()=>a.focus()))};l.useEffect((()=>()=>window.clearTimeout(_.current)),[]),Bp();const M=l.useCallback((e=>O.current===I.current?.side&&function(e,n){if(!n)return!1;return function(e,n){const{x:t,y:r}=e;let o=!1;for(let i=0,a=n.length-1;i<n.length;a=i++){const e=n[i].x,l=n[i].y,s=n[a].x,u=n[a].y;l>r!==u>r&&t<(s-e)*(r-l)/(u-l)+e&&(o=!o)}return o}({x:e.clientX,y:e.clientY},n)}(e,I.current?.area)),[]);return(0,i.jsx)(Wm,{scope:t,searchRef:Z,onItemEnter:l.useCallback((e=>{M(e)&&e.preventDefault()}),[M]),onItemLeave:l.useCallback((e=>{M(e)||(S.current?.focus(),N(null))}),[M]),onTriggerLeave:l.useCallback((e=>{M(e)&&e.preventDefault()}),[M]),pointerGraceTimerRef:E,onPointerGraceIntentChange:l.useCallback((e=>{I.current=e}),[]),children:(0,i.jsx)(A,{...D,children:(0,i.jsx)(Wp,{asChild:!0,trapped:o,onMountAutoFocus:hp(a,(e=>{e.preventDefault(),S.current?.focus({preventScroll:!0})}
vendor: 4,147 bytes, line 1
1)),onUnmountAutoFocus:s,children:(0,i.jsx)(Mp,{asChild:!0,disableOutsidePointerEvents:u,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:p,onInteractOutside:h,onDismiss:v,children:(0,i.jsx)(Rv,{asChild:!0,...C,dir:b.dir,orientation:"vertical",loop:r,currentTabStopId:w,onCurrentTabStopIdChange:N,onEntryFocus:hp(c,(e=>{b.isUsingKeyboardRef.current||e.preventDefault()})),preventScrollOnEntryFocus:!0,children:(0,i.jsx)(vv,{role:"menu","aria-orientation":"vertical","data-state":Sg(x.open),"data-radix-menu-content":"",dir:b.dir,...y,...g,ref:k,style:{outline:"none",...g.style},onKeyDown:hp(g.onKeyDown,(e=>{const n=e.target.closest("[data-radix-menu-content]")===e.currentTarget,t=e.ctrlKey||e.altKey||e.metaKey,r=1===e.key.length;n&&("Tab"===e.key&&e.preventDefault(),!t&&r&&L(e.key));const o=S.current;if(e.target!==o)return;if(!Nm.includes(e.key))return;e.preventDefault();const i=j().filter((e=>!e.disabled)).map((e=>e.ref.current));wm.includes(e.key)&&i.reverse(),function(e){const n=document.activeElement;for(const t of e){if(t===n)return;if(t.focus(),document.activeElement!==n)return}}(i)})),onBlur:hp(e.onBlur,(e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(_.current),Z.current="")})),onPointerMove:hp(e.onPointerMove,Zg((e=>{const n=e.target,t=T.current!==e.clientX;if(e.currentTarget.contains(n)&&t){const n=e.clientX>T.current?"right":"left";O.current=n,T.current=e.clientX}})))})})})})})})}));Km.displayName=Um;var Ym=l.forwardRef(((e,n)=>{const{__scopeMenu:t,...r}=e;return(0,i.jsx)(Np.div,{role:"group",...r,ref:n})}));Ym.displayName="MenuGroup";var Qm=l.forwardRef(((e,n)=>{const{__scopeMenu:t,...r}=e;return(0,i.jsx)(Np.div,{...r,ref:n})}));Qm.displayName="MenuLabel";var eg="MenuItem",ng="menu.itemSelect",tg=l.forwardRef(((e,n)=>{const{disabled:t=!1,onSelect:r,...o}=e,a=l.useRef(null),s=Rm(eg,e.__scopeMenu),u=qm(eg,e.__scopeMenu),c=xp(n,a),d=l.useRef(!1);return(0,i.jsx)(rg,{...o,ref:c,disabled:t,onClick:hp(e.onClick,(()=>{const e=a.current;if(!t&&e){const n=new CustomEvent(ng,{bubbles:!0,cancelable:!0});e.addEventListener(ng,(e=>r?.(e)),{once:!0}),Sp(e,n),n.defaultPrevented?d.current=!1:s.onClose()}})),onPointerDown:n=>{e.onPointerDown?.(n),d.current=!0},onPointerUp:hp(e.onPointerUp,(e=>{d.current||e.currentTarget?.click()})),onKeyDown:hp(e.onKeyDown,(e=>{const n=""!==u.searchRef.current;t||n&&" "===e.key||jm.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())}))})}));tg.displayName=eg;var rg=l.forwardRef(((e,n)=>{const{__scopeMenu:t,disabled:r=!1,textValue:o,...a}=e,s=qm(eg,t),u=Dm(t),c=l.useRef(null),d=xp(n,c),[f,p]=l.useState(!1),[h,v]=l.useState("");return l.useEffect((()=>{const e=c.current;e&&v((e.textContent??"").trim())}),[a.children]),(0,i.jsx)(Zm.ItemSlot,{scope:t,disabled:r,textValue:o??h,children:(0,i.jsx)(Fv,{asChild:!0,...u,focusable:!r,children:(0,i.jsx)(Np.div,{role:"menuitem","data-highlighted":f?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...a,ref:d,onPointerMove:hp(e.onPointerMove,Zg((e=>{if(r)s.onItemLeave(e);else if(s.onItemEnter(e),!e.defaultPrevented){e.currentTarget.focus({preventScroll:!0})}}))),onPointerLeave:hp(e.onPointerLeave,Zg((e=>s.onItemLeave(e)))),onFocus:hp(e.onFocus,(()=>p(!0))),onBlur:hp(e.onBlur,(()=>p(!1)))})})})})),og=l.forwardRef(((e,n)=>{const{checked:t=!1,onCheckedChange:r,...o}=e;return(0,i.jsx)(fg,{scope:e.__scopeMenu,checked:t,children:(0,i.jsx)(tg,{role:"menuitemcheckbox","aria-checked":kg(t)?"mixed":t,...o,ref:n,"data-state":_g(t),onSelect:hp(o.onSelect,(()=>r?.(!!kg(t)||!t)),{checkForDefaultPrevented:!1})})})}));og.displayName="MenuCheckboxItem";var ig="MenuRadioGroup",[ag,lg]=Om(ig,{value:void 0,onValueChange:()=>{}}),sg=l.forwardRef(((e,n)=>{const{value:t,onValueChange:r,...o}=e,a=Ip(r);return(0,i.jsx)(ag,{scope:e.__scopeMenu,value:t,onValueChange:a,children:(0,i.jsx)(Ym,{...o,ref:n})})}));sg.displayName=ig;var ug="MenuRadioItem",cg=l.forwardRef(((e,n)=>{const{value:t,...r}=e,o=lg(ug,e.__scopeMenu),a=t===o.value;return(0,i.jsx)(fg,{scope:e.__scopeMenu,checked:a,children:(0,i.jsx)(tg,{role:"menuitemradio","aria-checked":a,...r,ref:n,"data-state":_g(a),onSelect:hp(r.onSelect,(()=>
1o.onValueChange?.(t)),{checkForDefaultPrevented:!1})})})}));cg.displayName=ug;var dg="MenuItemIndicator",[fg,pg]=Om(dg,{checked:!1}),hg=l.forwardRef(((e,n)=>{const{__scopeMenu:t,forceMount:r,...o}=e,a=pg(dg,t);return(0,i.jsx)(xv,{present:r||kg(a.checked)||!0===a.checked,children:(0,i.jsx)(Np.span,{...o,ref:n,"data-state":_g(a.checked)})})}));hg.displayName=dg;var vg=l.forwardRef(((e,n)=>{const{__scopeMenu:t,...r}=e;return(0,i.jsx)(Np.div,{role:"separator","aria-orientation":"horizontal",...r,ref:n})}));vg.displayName="MenuSeparator";var mg=l.forwardRef(((e,n)=>{const{__scopeMenu:t,...r}=e,o=Am(t);return(0,i.jsx)(mv,{...o,...r,ref:n})}));mg.displayName="MenuArrow";var gg="MenuSub",[xg,bg]=Om(gg),yg=e=>{const{__scopeMenu:n,children:t,open:r=!1,onOpenChange:o}=e,a=Mm(gg,n),s=Am(n),[u,c]=l.useState(null),[d,f]=l.useState(null),p=Ip(o);return l.useEffect((()=>(!1===a.open&&p(!1),()=>p(!1))),[a.open,p]),(0,i.jsx)(pv,{...s,children:(0,i.jsx)(Lm,{scope:n,open:r,onOpenChange:p,content:d,onContentChange:f,children:(0,i.jsx)(xg,{scope:n,contentId:th(),triggerId:th(),trigger:u,onTriggerChange:c,children:t})})})};yg.displayName=gg;var Cg="MenuSubTrigger",jg=l.forwardRef(((e,n)=>{const t=Mm(Cg,e.__scopeMenu),r=Rm(Cg,e.__scopeMenu),o=bg(Cg,e.__scopeMenu),a=qm(Cg,e.__scopeMenu),s=l.useRef(null),{pointerGraceTimerRef:u,onPointerGraceIntentChange:c}=a,d={__scopeMenu:e.__scopeMenu},f=l.useCallback((()=>{s.current&&window.clearTimeout(s.current),s.current=null}),[]);return l.useEffect((()=>f),[f]),l.useEffect((()=>{const e=u.current;return()=>{window.clearTimeout(e),c(null)}}),[u,c]),(0,i.jsx)(zm,{asChild:!0,...d,children:(0,i.jsx)(rg,{id:o.triggerId,"aria-haspopup":"menu","aria-expanded":t.open,"aria-controls":o.contentId,"data-state":Sg(t.open),...e,ref:gp(n,o.onTriggerChange),onClick:n=>{e.onClick?.(n),e.disabled||n.defaultPrevented||(n.currentTarget.focus(),t.open||t.onOpenChange(!0))},onPointerMove:hp(e.onPointerMove,Zg((n=>{a.onItemEnter(n),n.defaultPrevented||e.disabled||t.open||s.current||(a.onPointerGraceIntentChange(null),s.current=window.setTimeout((()=>{t.onOpenChange(!0),f()}),100))}))),onPointerLeave:hp(e.onPointerLeave,Zg((e=>{f();const n=t.content?.getBoundingClientRect();if(n){const r=t.content?.dataset.side,o="right"===r,i=o?-5:5,l=n[o?"left":"right"],s=n[o?"right":"left"];a.onPointerGraceIntentChange({area:[{x:e.clientX+i,y:e.clientY},{x:l,y:n.top},{x:s,y:n.top},{x:s,y:n.bottom},{x:l,y:n.bottom}],side:r}),window.clearTimeout(u.current),u.current=window.setTimeout((()=>a.onPointerGraceIntentChange(null)),300)}else{if(a.onTriggerLeave(e),e.defaultPrevented)return;a.onPointerGraceIntentChange(null)}}))),onKeyDown:hp(e.onKeyDown,(n=>{const o=""!==a.searchRef.current;e.disabled||o&&" "===n.key||Sm[r.dir].includes(n.key)&&(t.onOpenChange(!0),t.content?.focus(),n.preventDefault())}))})})}));jg.displayName=Cg;var wg="MenuSubContent",Ng=l.forwardRef(((e,n)=>{const t=Vm(Um,e.__scopeMenu),{forceMount:r=t.forceMount,...o}=e,a=Mm(Um,e.__scopeMenu),s=Rm(Um,e.__scopeMenu),u=bg(wg,e.__scopeMenu),c=l.useRef(null),d=xp(n,c);return(0,i.jsx)(Zm.Provider,{scope:e.__scopeMenu,children:(0,i.jsx)(xv,{present:r||a.open,children:(0,i.jsx)(Zm.Slot,{scope:e.__scopeMenu,children:(0,i.jsx)(Xm,{id:u.contentId,"aria-labelledby":u.triggerId,...o,ref:d,align:"start",side:"rtl"===s.dir?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{s.isUsingKeyboardRef.current&&c.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:hp(e.onFocusOutside,(e=>{e.target!==u.trigger&&a.onOpenChange(!1)})),onEscapeKeyDown:hp(e.onEscapeKeyDown,(e=>{s.onClose(),e.preventDefault()})),onKeyDown:hp(e.onKeyDown,(e=>{const n=e.currentTarget.contains(e.target),t=km[s.dir].includes(e.key);n&&t&&(a.onOpenChange(!1),u.trigger?.focus(),e.preventDefault())}))})})})})}));function Sg(e){return e?"open":"closed"}function kg(e){return"indeterminate"===e}function _g(e){return kg(e)?"indeterminate":e?"checked":"unchecked"}function Zg(e){return n=>"mouse"===n.pointerType?e(n):void 0}Ng.displayName=wg;var Eg=Fm,Ig=zm,Og=$m,Tg=Km,Ag=Ym,Dg=Qm,Lg=tg,Mg=og,Pg=sg,Rg=cg,Fg=hg,zg=vg,Bg=mg,Hg=yg,Vg=jg,$g=Ng,Ug="ContextMenu",[Wg,qg]=vp(Ug,[Tm]),Kg=Tm
1(),[Gg,Jg]=Wg(Ug),Xg=e=>{const{__scopeContextMenu:n,children:t,onOpenChange:r,dir:o,modal:a=!0}=e,[s,u]=l.useState(!1),c=Kg(n),d=Ip(r),f=l.useCallback((e=>{u(e),d(e)}),[d]);return(0,i.jsx)(Gg,{scope:n,open:s,onOpenChange:f,modal:a,children:(0,i.jsx)(Eg,{...c,dir:o,open:s,onOpenChange:f,modal:a,children:t})})};Xg.displayName=Ug;var Yg="ContextMenuTrigger",Qg=l.forwardRef(((e,n)=>{const{__scopeContextMenu:t,disabled:r=!1,...o}=e,a=Jg(Yg,t),s=Kg(t),u=l.useRef({x:0,y:0}),c=l.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...u.current})}),d=l.useRef(0),f=l.useCallback((()=>window.clearTimeout(d.current)),[]),p=e=>{u.current={x:e.clientX,y:e.clientY},a.onOpenChange(!0)};return l.useEffect((()=>f),[f]),l.useEffect((()=>{r&&f()}),[r,f]),(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(Ig,{...s,virtualRef:c}),(0,i.jsx)(Np.span,{"data-state":a.open?"open":"closed","data-disabled":r?"":void 0,...o,ref:n,style:{WebkitTouchCallout:"none",...e.style},onContextMenu:r?e.onContextMenu:hp(e.onContextMenu,(e=>{f(),p(e),e.preventDefault()})),onPointerDown:r?e.onPointerDown:hp(e.onPointerDown,vx((e=>{f(),d.current=window.setTimeout((()=>p(e)),700)}))),onPointerMove:r?e.onPointerMove:hp(e.onPointerMove,vx(f)),onPointerCancel:r?e.onPointerCancel:hp(e.onPointerCancel,vx(f)),onPointerUp:r?e.onPointerUp:hp(e.onPointerUp,vx(f))})]})}));Qg.displayName=Yg;var ex=e=>{const{__scopeContextMenu:n,...t}=e,r=Kg(n);return(0,i.jsx)(Og,{...r,...t})};ex.displayName="ContextMenuPortal";var nx="ContextMenuContent",tx=l.forwardRef(((e,n)=>{const{__scopeContextMenu:t,...r}=e,o=Jg(nx,t),a=Kg(t),s=l.useRef(!1);return(0,i.jsx)(Tg,{...a,...r,ref:n,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:n=>{e.onCloseAutoFocus?.(n),!n.defaultPrevented&&s.current&&n.preventDefault(),s.current=!1},onInteractOutside:n=>{e.onInteractOutside?.(n),n.defaultPrevented||o.modal||(s.current=!0)},style:{...e.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})}));tx.displayName=nx;var rx=l.forwardRef(((e,n)=>{const{__scopeContextMenu:t,...r}=e,o=Kg(t);return(0,i.jsx)(Ag,{...o,...r,ref:n})}));rx.displayName="ContextMenuGroup";var ox=l.forwardRef(((e,n)=>{const{__scopeContextMenu:t,...r}=e,o=Kg(t);return(0,i.jsx)(Dg,{...o,...r,ref:n})}));ox.displayName="ContextMenuLabel";var ix=l.forwardRef(((e,n)=>{const{__scopeContextMenu:t,...r}=e,o=Kg(t);return(0,i.jsx)(Lg,{...o,...r,ref:n})}));ix.displayName="ContextMenuItem";var ax=l.forwardRef(((e,n)=>{const{__scopeContextMenu:t,...r}=e,o=Kg(t);return(0,i.jsx)(Mg,{...o,...r,ref:n})}));ax.displayName="ContextMenuCheckboxItem";var lx=l.forwardRef(((e,n)=>{const{__scopeContextMenu:t,...r}=e,o=Kg(t);return(0,i.jsx)(Pg,{...o,...r,ref:n})}));lx.displayName="ContextMenuRadioGroup";var sx=l.forwardRef(((e,n)=>{const{__scopeContextMenu:t,...r}=e,o=Kg(t);return(0,i.jsx)(Rg,{...o,...r,ref:n})}));sx.displayName="ContextMenuRadioItem";var ux=l.forwardRef(((e,n)=>{const{__scopeContextMenu:t,...r}=e,o=Kg(t);return(0,i.jsx)(Fg,{...o,...r,ref:n})}));ux.displayName="ContextMenuItemIndicator";var cx=l.forwardRef(((e,n)=>{const{__scopeContextMenu:t,...r}=e,o=Kg(t);return(0,i.jsx)(zg,{...o,...r,ref:n})}));cx.displayName="ContextMenuSeparator";var dx=l.forwardRef(((e,n)=>{const{__scopeContextMenu:t,...r}=e,o=Kg(t);return(0,i.jsx)(Bg,{...o,...r,ref:n})}));dx.displayName="ContextMenuArrow";var fx=e=>{const{__scopeContextMenu:n,children:t,onOpenChange:r,open:o,defaultOpen:a}=e,l=Kg(n),[s,u]=Cv({prop:o,defaultProp:a,onChange:r});return(0,i.jsx)(Hg,{...l,open:s,onOpenChange:u,children:t})};fx.displayName="ContextMenuSub";var px=l.forwardRef(((e,n)=>{const{__scopeContextMenu:t,...r}=e,o=Kg(t);return(0,i.jsx)(Vg,{...o,...r,ref:n})}));px.displayName="ContextMenuSubTrigger";var hx=l.forwardRef(((e,n)=>{const{__scopeContextMenu:t,...r}=e,o=Kg(t);return(0,i.jsx)($g,{...o,...r,ref:n,style:{...e.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})}));function vx(e){return n=>"mouse"!==n.pointerType?e(n):void 0}hx.displayName="ContextMenuSubContent";
1var mx=ex,gx=tx,xx=ox,bx=ix,yx=ax,Cx=sx,jx=ux,wx=cx,Nx=px,Sx=hx,kx=Xg,_x=Qg,Zx=mx,Ex=l.forwardRef((function(e,n){var t=e.className,r=e.inset,o=e.children,a=(0,be.Z)(e,["className","inset","children"]);return(0,i.jsxs)(Nx,(0,g.Z)((0,m.Z)({ref:n,className:y()("focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none",r&&"pl-8",t)},a),{children:[o,(0,i.jsx)(J.O6d,{className:"ml-auto h-4 w-4"})]}))}));Ex.displayName=Nx.displayName;var Ix=l.forwardRef((function(e,n){var t=e.className,r=(0,be.Z)(e,["className"]);return(0,i.jsx)(Sx,(0,m.Z)({ref:n,className:y()("bg-popover text-popover-foreground z-50 min-w-[8rem] overflow-hidden rounded-md border p-1 shadow-md data-[state=open]:animate-in data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t)},r))}));Ix.displayName=Sx.displayName;var Ox=l.forwardRef((function(e,n){var t=e.className,r=(0,be.Z)(e,["className"]);return(0,i.jsx)(mx,{children:(0,i.jsx)(gx,(0,m.Z)({ref:n,className:y()("bg-popover text-popover-foreground z-50 min-w-[8rem] overflow-hidden rounded-md border p-1 shadow-md animate-in fade-in-80 data-[state=open]:animate-in data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t)},r))})}));Ox.displayName=gx.displayName;var Tx=l.forwardRef((function(e,n){var t=e.className,r=e.inset,o=(0,be.Z)(e,["className","inset"]);return(0,i.jsx)(bx,(0,m.Z)({ref:n,className:y()("focus:bg-accent focus:text-accent-foreground relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50",r&&"pl-8",t)},o))}));Tx.displayName=bx.displayName;var Ax=l.forwardRef((function(e,n){var t=e.className,r=e.children,o=e.checked,a=(0,be.Z)(e,["className","children","checked"]);return(0,i.jsxs)(yx,(0,g.Z)((0,m.Z)({ref:n,className:y()("focus:bg-accent focus:text-accent-foreground relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),checked:o},a),{children:[(0,i.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,i.jsx)(jx,{children:(0,i.jsx)(J.MCw,{className:"h-4 w-4"})})}),r]}))}));Ax.displayName=yx.displayName;var Dx=l.forwardRef((function(e,n){var t=e.className,r=e.children,o=(0,be.Z)(e,["className","children"]);return(0,i.jsxs)(Cx,(0,g.Z)((0,m.Z)({ref:n,className:y()("focus:bg-accent focus:text-accent-foreground relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t)},o),{children:[(0,i.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,i.jsx)(jx,{children:(0,i.jsx)(J.fWl,{className:"h-2 w-2 fill-current"})})}),r]}))}));Dx.displayName=Cx.displayName;var Lx=l.forwardRef((function(e,n){var t=e.className,r=e.inset,o=(0,be.Z)(e,["className","inset"]);return(0,i.jsx)(xx,(0,m.Z)({ref:n,className:y()("text-foreground px-2 py-1.5 text-sm font-semibold",r&&"pl-8",t)},o))}));Lx.displayName=xx.displayName;var Mx=l.forwardRef((function(e,n){var t=e.className,r=(0,be.Z)(e,["className"]);return(0,i.jsx)(wx,(0,m.Z)({ref:n,className:y()("bg-border -mx-1 my-1 h-px",t)},r))}));Mx.displayName=wx.displayName;var Px=t(51471),Rx=function(e){var n=e.onAddNode,t=e.templateId,r=e.mousePos,o=(0,Ma._K)(),a=(0,z.ye)("automations-get-profile"),l=function(e){var i=o.screenToFlowPosition({x:r.x,y:r.y});n((0,Px.w)({type:e,position:i,templateId:t,templateVersion:"2024-05-09"}))};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(Bx,{onClick:function(){return l("add-to-digest")},children:"Add to Digest"}),(0,i.jsx)(Bx,{onClick:function(){return l("batch")},children:"Add to Batch"}),(0,i.jsx)(Bx,{onClick:function(){return l("throttle")},children:"Throttle"}),(0,i.jsx)(Bx,{onClick:function(){return l("cancel")},children:"Cancel Automation"}),(0,i.jsx)(Bx,{onClick:function(){return l("delay")},children:"Delay"}),(0,i.jsx)(Bx,{onClick:function(){return l("fetch")},children:"Fetch Data"}),(0,i.jsx)(Bx,{onClick:function(){return l("invoke")},children:"Invoke Automation"}),(0,i.jsx)(Bx,{onClick:function(){return l("send")},children:"Send"}),(0,i.jsx)(Bx,{onClick:function(){return l("send-to-list")},children:"Send to List"}),(0,i.jsx)(Bx,{onClick:function(){return l("subscribe-to-list")},children:"Subscribe to List"}),(0,i.jsx)(Bx,{onClick:function(){return l("update-profile")},children:"Update Profile"}),a&&(0,i.jsx)(Bx,{onClick:function(){return l("get-profile")},children:"GET Profile"}),(0,i.jsx)(Bx,{onClick:function(){return l("if")},children:"If"}),(0,i.jsx)(Bx,{onClick:function(){return l("switch")},children:"Switch"})]})},Fx=function(e){var n=e.nodeId,t=e.onRemoveNode;return(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(Bx,{className:"text-red",onClick:function(){t(n)},children:"Delete"})})},zx=function(e){var n=e.children,t=e.onAddNode,r=e.onRemoveNode,o=e.templateId,a=e.nodeId,s=e.onPaneClick,u=e.debugMode,c=(0,(0,Ma._K)().getNode)(a),d=(0,l.useState)({x:0,y:0}
1),f=d[0],p=d[1];return(0,i.jsxs)(kx,{children:[(0,i.jsx)(Hx,{onContextMenu:function(e){p({x:e.clientX,y:e.clientY}),(0,eu.Z)(e.target,HTMLElement)&&e.target.classList.contains("react-flow__pane")&&s()},disabled:u,children:n}),(0,i.jsx)(Zx,{children:(0,i.jsx)(Vx,{children:c&&"trigger"!==c.type?(0,i.jsx)(Fx,{nodeId:a,onRemoveNode:r}):(0,i.jsx)(Rx,{onAddNode:t,templateId:o,mousePos:f})})})]})},Bx=function(e){var n=e.children,t=e.onClick,r=e.className;return(0,i.jsx)(Tx,{className:y()("hover:bg-cell-hover",r),onClick:t,children:n})},Hx=function(e){var n=e.children,t=e.onContextMenu,r=e.disabled;return(0,i.jsx)(_x,{className:"h-full w-full",onContextMenu:t,disabled:r,children:n})},Vx=(0,l.forwardRef)((function(e,n){var t=e.children;return(0,i.jsx)(Ox,{ref:n,className:"space-y-2 rounded bg-background-panels p-3 font-text",children:t})})),$x=t(81797),Ux=t(38175),Wx=t(43827),qx=function(e){var n=e.name,t=e.description,r=e.children,o=e.onClick,a=(0,l.useState)(),s=a[0],u=a[1],c=(0,l.useMemo)((function(){return{display:function(e){return u(e)}}}),[]);return(0,i.jsx)("div",{className:"h-full overflow-auto",onClick:o,children:(0,i.jsxs)(Gx.Provider,{value:c,children:[!s&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)("div",{className:"px-4 pt-4",children:[(0,i.jsx)("div",{className:"flex items-center justify-between",children:(0,i.jsx)("div",{className:"flex items-center space-x-3",children:(0,i.jsx)(cf.default,{variant:"semibold-xl",className:"block text-header",children:n})})}),t&&(0,i.jsx)(cf.default,{variant:"regular-sm",className:"block text-subtext",children:t})]}),r]}),!!s&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("div",{className:"border-0 border-b border-solid border-structure-border",children:(0,i.jsxs)("div",{className:"flex items-center justify-between px-md py-md",children:[(0,i.jsx)("div",{className:"flex items-center",children:(0,i.jsx)(ki.default,{variant:"link",onClick:function(){return u(void 0)},children:(0,i.jsxs)("div",{className:"flex items-center",children:[(0,i.jsx)(J.vdC,{className:"h-6 w-6 text-link"}),"Go back"]})})}),(0,i.jsxs)(cf.default,{variant:"semibold-sm",className:"block text-header",children:["Edit ",s.label]})]})}),s.node]})]})})},Kx=function(e){var n=e.heading,t=e.children,r=e.className;return(0,i.jsxs)("div",{className:(0,rs.m6)("flex flex-col gap-4 border-0 border-b border-solid border-structure-divider px-4 pb-10 pt-4 last:border-b-0",r),children:[n&&(0,i.jsx)(cf.default,{variant:"semibold-sm",className:"pb-2 pt-2 text-header",children:n}),t]})},Gx=(0,l.createContext)({display:function(){}}),Jx=function(e){var n=e.hasError,t=e.status,r=e.onChange;(0,l.useEffect)((function(){n&&!t.error&&r({temp_props:{hasError:!0}}),!n&&t.edited&&t.error&&r({temp_props:{hasError:!1}})}),[n,t,r])},Xx=function(e){var n,t,r,o,a=e.node,l=e.onChange,s=nb({node:a,onChange:l});return(0,i.jsx)(qx,{name:"Batch",children:(0,i.jsxs)(Kx,{children:[(0,i.jsx)(yf.M,{label:"Wait Period",value:a.wait_period,onChange:function(e){return l({wait_period:e})},error:s.wait_period}),(0,i.jsx)(yf.M,{label:"Max Wait",value:a.max_wait_period,onChange:function(e){return l({max_wait_period:e})},error:s.max_wait_period}),(0,i.jsx)(Yx,{retain:a.retain,onChange:function(e){return l({retain:e})}}),("highest"===(null===(n=a.retain)||void 0===n?void 0:n.type)||"lowest"===(null===(t=a.retain)||void 0===t?void 0:t.type))&&(0,i.jsx)($x.default,{label:"Sort Key",value:null===(r=a.retain)||void 0===r?void 0:r.sort_key,onChange:function(e){return l({retain:{sort_key:e.target.value}})}}),(0,i.jsx)(Ux.Z,{label:"Max Items",value:null===a||void 0===a?void 0:a.max_items,onChange:function(e){return l({max_items:e})}}),(0,i.jsx)(Wx.Z,{label:"Scope",options:eb,value:null!==(o=a.scope)&&void 0!==o?o:"global",labelForOptions:"label",valueForOptions:"value",onChange:function(e){var n,t=e.value;return"dynamic"!==(n=t)&&l({scope:n,batch_key:void 0}),void l({scope:n})}}),"dynamic"===a.scope&&(0,i.jsx)($x.default,{label:"Batch Key",value:a.batch_key,onChange:function(e){return l({batch_key:e.target.value})}}),(0,i.jsx)($x.default,{label:"Category Key",value:a.category_key,onChange:function(e){return l({category_key:e.target.value})}})]})})},Yx=function(e){var n=e.retain,t=e.onChange;return(0,z.ye)("batch-retention-100")?(0,i.jsxs)("div",{className:"flex w-full items-end space-x-2",children:[(0,i.jsx)(Wx.Z,{label:"Retain Items",options:Qx,value:null===n||void 0===n?void 0:n.type,labelForOptions:"label",valueForOptions:"value",className:"basis-3/5",onChange:function(e){var r=e.value;return t((0,g.Z)((0,m.Z)({},n),{type:r}))}}),(0,i.jsx)(Ux.Z,{className:"basis-2/5",value:null===n||void 0===n?void 0:n.count,min:0,max:100,onChange:function(e){return t((0,g.Z)((0,m.Z)({}
1,n),{count:e}))}})]}):(0,i.jsxs)("div",{className:"flex h-fit w-full items-end justify-between",children:[(0,i.jsx)(Wx.Z,{label:"Retain Items",options:Qx,value:null===n||void 0===n?void 0:n.type,labelForOptions:"label",valueForOptions:"value",className:"basis-3/5",onChange:function(e){var r=e.value;return t((0,g.Z)((0,m.Z)({},n),{type:r}))}}),(0,i.jsx)("div",{className:"flex h-[40px] basis-2/5 items-center justify-center align-middle",children:(0,i.jsx)(cf.default,{variant:"regular-md",children:n.count})})]})},Qx=[{label:"First",value:"first"},{label:"Last",value:"last"},{label:"Highest",value:"highest"},{label:"Lowest",value:"lowest"}],eb=[{label:"Global",value:"global"},{label:"User",value:"user"},{label:"Dynamic",value:"dynamic"}],nb=function(e){var n=e.node,t=e.onChange,r=n.wait_period,o=n.max_wait_period,i=Cf(n),a={};(0,kd.$b)(r)&&(a.wait_period="Wait Period is required"),(0,kd.$b)(o)&&(a.max_wait_period="Max Wait Period is required"),a.wait_period||a.max_wait_period||!(0,kd.m1)(o,r)||(a.wait_period="Wait Period must be less than Max Wait Perio
1d");var l=Object.keys(a).length>0&&i.edited;return Jx({hasError:l,status:i,onChange:t}),l?a:{}},tb={condition_type:"simple",source:"data",operator:"eq",field:"",value:""},rb=[{label:"Data",value:"data"},{label:"Profile",value:"profile"},{label:"Step Ref",value:"ref"},{label:"JS Condition",value:"js"}],ob=[{label:"is",value:"eq"},{label:"is not",value:"neq"},{label:"is greater than",value:"gt"},{label:"is greater than or equal to",value:"gte"},{label:"is less than",value:"lt"},{label:"is less than or equal to",value:"lte"},{label:"is one of",value:"one_of"},{label:"contains",value:"contains"},{label:"does not contain",value:"not_contains"}],ib=function(e){var n,t=e.node,o=e.onChange,a=Cf(t),s=(0,l.useMemo)((function(){return null!==(n=t.condition)&&void 0!==n?n:(0,m.Z)({},tb)}),[t.condition]),u=s.condition_type,c="simple"===u?s.source:"js",d=function(e){if("simple"!==u)return o({condition:(0,m.Z)({},tb,e)});o({condition:(0,m.Z)({},s,e)})},f=function(e){if("js"!==u)return o({condition:(0,m.Z)({condition_type:"js",expression:""},e)});o({condition:(0,m.Z)({},s,e)})},p=(0,r.Z)(function(e,n){return(0,l.useMemo)((function(){return e.edited?"simple"===n.condition_type?[ab(n),void 0]:[{},n.expression?void 0:"Expression is required"]:[{},void 0]}),[n,e])}(a,s),2),h=p[0],v=p[1],g=!(!Object.keys(h).length&&!v);return Jx({hasError:g,status:a,onChange:o}),(0,i.jsx)(qx,{name:"If",children:(0,i.jsxs)(Kx,{children:[(0,i.jsx)(Wx.Z,{label:"Source",labelForOptions:"label",valueForOptions:"value",options:rb,value:c,onChange:function(e){return function(e){if("js"===e)return f({condition_type:"js"});d({source:e})}(e.value)}}),"simple"===u&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)($x.default,{label:"ref"===s.source?"Ref":"Field",value:s.field,errorValidator:function(e){return e?null:"Field is required"},error:h.field,onChange:function(e){return d({field:e.target.value})}}),(0,i.jsx)(Wx.Z,{labelForOptions:"label",valueForOptions:"value",options:ob,value:s.operator,label:"Comparison",onChange:function(e){return d({operator:e.value})}}),(0,i.jsx)($x.default,{label:"Value",value:s.value,error:h.value,onChange:function(e){return d({value:e.target.value})}})]}),"js"===u&&(0,i.jsx)($x.default,{label:"Expression",value:s.expression,error:v,onChange:function(e){return f({expression:e.target.value})}})]})})},ab=function(e){var n={};return e.field||(n.field="Field is required"),e.value||(n.value="Value is required"),n};var lb=function(e){var n=e.node,t=e.onChange;hb({node:n,onChange:t});var r=(0,l.useCallback)((function(e,r){var o=(0,N.Z)(n.cases),i=o[e];o[e]=(0,g.Z)((0,m.Z)({},i),{condition:(0,m.Z)({},null===i||void 0===i?void 0:i.condition,r)}),t({cases:o})}),[n.cases,t]),o=(0,l.useCallback)((function(e){var r=(0,N.Z)(n.cases);r.splice(e,1),t({cases:r})}),[n.cases,t]),a=(0,l.useCallback)((function(){var e=(0,N.Z)(n.cases);e.push({condition:db()}),t({cases:e})}),[n.cases,t]);return(0,i.jsxs)(qx,{name:"Switch",description:"Handle multiple conditions",children:[n.cases.map((function(e,n){return(0,i.jsxs)(Kx,{className:"pb-4",children:[(0,i.jsxs)(cf.default,{variant:"semibold-sm",className:"pb-2 pt-2 text-header",children:["Case ",n+1]}),(0,i.jsx)(sb,{condition:e.condition,onChange:function(e){return r(n,e)},onDelete:function(){return o(n)}})]},n)})),(0,i.jsx)(Kx,{children:(0,i.jsx)(ki.default,{variant:"confirm",className:"w-full",onClick:a,children:"Add Case"})})]})},sb=function(e){var n=e.condition,t=void 0===n?db():n,r=e.onChange,o=e.onDelete,a="simple"===t.condition_type?t.source:"js",l=function(e){if("simple"!==t.condition_type)return r((0,m.Z)({},db(),e));r(e)},s=function(e){if("js"!==t.condition_type)return r((0,m.Z)({condition_type:"js",expression:""},e));r(e)};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(Wx.Z,{className:"w-full",options:fb,value:a,labelForOptions:"label",valueForOptions:"value",label:"Source",onChange:function(e){return function(e){if("js"===e)return s({condition_type:"js"});l({source:e})}(e.value)}}),"simple"===t.condition_type&&(0,i.jsx)(cb,{condition:t,onChange:l}),"js"===t.condition_type&&(0,i.jsx)(ub,{condition:t,onChange:s}),(0,i.jsx)(ki.default,{variant:"default",onClick:o,className:"w-full",children:(0,i.jsx)(cf.default,{variant:"regular-sm",className:"text-red",children:"Delete case"})})]})},ub=function(e){var n=e.condition,t=e.onChange;return(0,i.jsx)($x.default,{label:"Expression",value:n.expression,onChange:function(e){return t({expression:e.target.value})}})},cb=function(e){var n=e.condition,t=e.onChange,r=ab(n);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)($x.default,{label:"ref"===n.source?"Ref":"Field",value:n.field,onChange:function(e){return t({field:e.target.value})},error:r.field}),(0,i.jsx)(Wx.Z,{className:"w-full",options:pb,value:n.operator,label:"Comparison",labelForOptions:"label",valueForOptions:"value",onCh
1ange:function(e){var n=e.value;return t({operator:n})}}),(0,i.jsx)($x.default,{label:"Value",value:n.value,onChange:function(e){return t({value:e.target.value})},error:r.value})]})},db=function(){return{condition_type:"simple",source:"data",operator:"eq",field:"",value:""}},fb=[{label:"Data",value:"data"},{label:"Profile",value:"profile"},{label:"Step Ref",value:"ref"},{label:"JS Condition",value:"js"}],pb=[{label:"is",value:"eq"},{label:"is not",value:"neq"},{label:"is greater than",value:"gt"},{label:"is greater than or equal to",value:"gte"},{label:"is less than",value:"lt"},{label:"is less than or equal to",value:"lte"},{label:"is one of",value:"one_of"},{label:"contains",value:"contains"},{label:"does not contain",value:"not_contains"}],hb=function(e){var n=e.node,t=e.onChange,r=n.cases,o=Cf(n),i=o.edited&&r.some((function(e){if("simple"===e.condition.condition_type){var n=ab(e.condition);return Object.keys(n).length>0}}));Jx({hasError:i,status:o,onChange:t})},vb=t(54332),mb=t(46210),gb=[{label:"Duration",value:"duration"},{label:"Until",value:"until"},{label:"Dynamic Duration",value:"dynamic-duration"},{label:"Dynamic Until",value:"dynamic-until"}],xb=function(e){var n=e.node,t=e.onChange,r=(0,l.useState)(If(n)),o=r[0],a=r[1],s=bb({node:n,onChange:t}),u=function(e){return t((0,m.Z)({until:void 0,duration:void 0},e))};return(0,i.jsx)(qx,{name:"Delay",description:"Add event to delay",children:(0,i.jsxs)(Kx,{children:[(0,i.jsx)(Wx.Z,{label:"Type",options:gb,value:o,labelForOptions:"label",valueForOptions:"value",onChange:function(e){var n=e.value;a(n),u("duration"===n?{duration:"P1D"}:{duration:"",until:""})}}),"duration"===o&&(0,i.jsx)(yf.M,{value:n.duration,onChange:function(e){u({duration:e})},error:s.duration}),"until"===o&&(0,i.jsx)(vb.Z,{onChange:function(e){return u({until:e?e.toISOString():""})},value:n.until?new Date(n.until):new Date,errorValidator:function(){return s.until},disabledAfter:(0,mb.oK)()}),"dynamic-duration"===o&&(0,i.jsx)($x.default,{placeholder:"refs.data.duration",value:n.duration,onChange:function(e){return u({duration:e.target.value})}}),"dynamic-until"===o&&(0,i.jsx)($x.default,{placeholder:"refs.data.until",value:n.until,onChange:function(e){return u({until:e.target.value})}})]})})},bb=function(e){var n=e.node,t=e.onChange,r=n.duration,o=n.until,i=If(n),a=Cf(n),l={};if("duration"===i){var s=(0,mb.qG)(r);s&&(l.duration=s)}if("until"===i){var u=(0,mb.e4)(o);u&&(l.until=u)}var c=Object.keys(l).length>0&&a.edited;return Jx({hasError:c,status:a,onChange:t}),c?l:{}},yb=function(e){var n=e.node,t=e.onChange,r=n.cancelation_token,o=n.ref,a=Cb({node:n,onChange:t});return(0,i.jsx)(qx,{name:"Cancel",children:(0,i.jsxs)(Kx,{children:[(0,i.jsx)($x.default,{label:"Token",value:r,onChange:function(e){return t({cancelation_token:e.target.value})},error:a.cancelation_token}),n.ref&&(0,i.jsx)($x.default,{label:"Reference",value:o,onChange:function(e){return t({ref:e.target.value})}})]})})},Cb=function(e){var n=e.node,t=e.onChange,r=n.cancelation_token,o=Cf(n),i={};r||(i.cancelation_token="Cancelation token is required");var a=Object.keys(i).length>0&&o.edited;return Jx({hasError:a,status:o,onChange:t}),a?i:{}},jb=function(e){var n=e.node,t=e.onChange,r=(0,Es.vF)(),o=wb({node:n,onChange:t});return(0,i.jsx)(qx,{name:"Digest",children:(0,i.jsx)(Kx,{children:(0,i.jsx)(Wx.Z,{label:"Subscription topic",options:r,value:null===n||void 0===n?void 0:n.subscription_topic_id,labelForOptions:"label",valueForOptions:"value",onChange:function(e){return n={subscription_topic_id:e.value},void t((0,m.Z)({},n));var n},error:o.subscription_topic_id})})})},wb=function(e){var n=e.node,t=e.onChange,r=n.subscription_topic_id,o=Cf(n),i={};r||(i.subscription_topic_id="Subscription topic is required");var a=Object.keys(i).length>0&&o.edited;return Jx({hasError:a,status:o,onChange:t}),a?i:{}},Nb=t(87670),Sb=function(e){var n=e.node,t=e.onChange,r=n.template_id,o=n.passContext,a=kb({node:n,onChange:t}),l=[{label:"Pass run context",value:"passContext"}];return(0,i.jsx)(qx,{name:"Invoke Automation",children:(0,i.jsxs)(Kx,{children:[(0,i.jsx)($x.default,{label:"Automation ID",value:r,onChange:function(e){t({template_id:e.target.value})},error:a.template_id}),(0,i.jsx)(Nb.Z,{labelForOptions:"label",valueForOptions:"value",options:l,value:o?[l[0]]:[],onChange:function(e){t({passContext:e.length>0})}})]})})},kb=function(e){var n=e.node,t=e.onChange,r=n.template_id,o=Cf(n),i={};r||(i.template_id="Automation ID is required");var a=Object.keys(i).length>0&&o.edited;return Jx({hasError:a,status:o,onChange:t}),a?i:{}},_b=t(40366),Zb=function(e){var n=e.label,t=e.value,r=e.onChange,o=(0,l.useMemo)((function(){return JSON.stringify(null!==t&&void 0!==t?t:{},null,2)}),[t]),a=(0,l.useContext)(Gx).display;return(0,i.jsxs)("div",{className:"flex items-center justify-between",children:[(0,i.jsxs)(cf.default,{variant:"regular-sm",className:"flex items-center justify-start text-header",children:[(0,i.jsx)("span",{className:"mr-1 block",children:n}),(0,i.jsx)("span",{className:"block max-w-[100px] truncate text-placeholder",children:o})]}),(0,i.jsx)(ki.default,{variant:"link",onClick:function(){return a({label:n,node:(0,i.jsx)(_b.m,{value:t,onChange:r})})},children:(0,i.jsxs)("div",{className:"flex items-center",children:["Edit",(0,i.jsx)(J.lWn,{className:"h-6 w-6"})]})})]})},Eb=[{value:"replace",label:"Replace"},{value:"soft-merge",label:"Soft Merge"},{value:"overwrite",label:"Overwrite"},{value:"none",label:"None"}],Ib=function(e){var n,t=e.node,r=e.onChange,o=e.onSet,a=Ob({node:t,onChange:r});return(0,i.jsx)(qx,{name:"Update Profile",children:(0,i.jsxs)(Kx,{children:[(0,i.jsx)(Zb,{label:"Profile",value:t.profile,onChange:function(e){return o((0,g.Z)((0,m.Z)({},t),{profile:e}))}}),(0,i.jsx)($x.default,{label:"User ID",value:null!==(n=t.user_id)&&void 0!==n?n:t.recipient_id,onChange:function(e){return r({user_id:e.target.value})},error:a.user_id}),(0,i.jsx)(Wx.Z,{label:"Merge Strategy",labelForOptions:"label",valueForOptions:"value",options:Eb,value:t.merge_strategy,onChange:function(e){return r({merge_strategy:e.value})}})]})})},Ob=function(e){var n=e.node,t=e.onChange,r=n.user_id,o=Cf(n),i={};r||(i.user_id="User ID is required");var a=Object.keys(i).length>0&&o.edited;return Jx({hasError:a,status:o,onChange:t}),a?i:{}},Tb=function(e){var n=e.node,t=e.onChange,r=e.onSet,o=n.list_id,a=n.recipient_id,l=Ab({node:n,onChange:t});return(0,i.jsx)(qx,{name:"Subscribe User to List",children:(0,i.jsxs)(Kx,{children:[(0,i.jsx)($x.default,{label:"User ID",value:a,onChange:function(e){return t({recipient_id:e.target.value})},error:l.recipient_id}),(0,i.jsx)($x.default,{label:"List ID",value:o,onChange:function(e){return t({list_id:e.target.value})},error:l.list_id}),(0,i.jsx)(Zb,{label:"Preferences",value:n.preferences,onChange:function(e){return r((0,g.Z)((0,m.Z)({},n),{preferences:e}))}})]})})},Ab=function(e){var n=e.node,t=e.onChange,r=n.recipient_id,o=n.list_id,i=Cf(n),a={};r||(a.recipient_id="User ID is required"),o||(a.list_id="List ID is required");var l=Object.keys(a).length>0&&i.edited;return Jx({hasError:l,status:i,onChange:t}),l?a:{}},Db=function(e){var n,t,r,o,a=e.node,l=e.onChange,s=e.onSet,u=(0,Es.ew)(),c=(0,Es.HG)(),d=Lb({node:a,onChange:l});return(0,i.jsxs)(qx,{name:"Send to List",children:[(0,i.jsxs)(Kx,{children:[(0,i.jsx)(Wx.Z,{label:"Notification",labelForOptions:"label",valueForOptions:"value",options:u,value:null!==(t=null!==(n=a.template_id)&&void 0!==n?n:a.template)&&void 0!==t?t:"",onChange:function(e){return l({template_id:e.value})},error:d.template_id,tooltipForOptionsSide:"left"}),(0,i.jsx)($x.default,{label:"List ID",value:a.list_id,onChange:function(e){return l({list_id:e.target.value})},error:d.list_id}),(0,i.jsx)(Zb,{label:"Data",value:null!==(r=a.data)&&void 0!==r?r:{},onChange:function(e){return s((0,g.Z)((0,m.Z)({},a),{data:e}))}})]}),(0,i.jsxs)(Kx,{heading:"Advanced",children:[(0,i.jsx)(Wx.Z,{labelForOptions:"label",valueForOptions:"value",options:c,label:"Brand ID",value:a.brand_id,onChange:function(e){return l({brand_id:e.value})}}),(0,i.jsx)($x.default,{label:"Idempotency Key",value:a.idempotency_key,onChange:function(e){return l({idempotency_key:e.target.value})}}),(0,i.jsx)($x.default,{label:"Idempotency Expiry",value:a.idempotency_expiry,onChange:function(e){return l({idempotency_expiry:e.target.value})}}),(0,i.jsx)($x.default,{label:"Filter",value:a.filter,onChange:function(e){return l({filter:e.target.value})}}),(0,i.jsx)(Zb,{label:"Override",value:null!==(o=a.override)&&void 0!==o?o:{},onChange:function(e){return s((0,g.Z)((0,m.Z)({},a),{override:e}))}})]})]})},Lb=function(e){var n=e.node,t=e.onChange,r=n.template_id,o=n.list_id,i=Cf(n),a={};r||(a.template_id="Template ID is required"),o||(a.list_id="List ID is required");var l=Object.keys(a).length>0&&i.edited;return Jx({hasError:l,status:i,onChange:t}),l?a:{}}
1,Mb="refs.",Pb="dynamic",Rb=[{label:"User",value:"user"},{label:"GLOBAL",value:"global"},{label:"Dynamic (pulled from refs.*)",value:Pb}],Fb=new Intl.NumberFormat("en-US",{style:"decimal",minimumFractionDigits:0,maximumFractionDigits:0}),zb=function(e){var n,t=e.node,r=e.onChange,o=t.scope,a=t.throttle_key,s=Bb({node:t,onChange:r});return(0,l.useEffect)((function(){o!==Pb&&a&&r({throttle_key:void 0})}),[o,a,r]),(0,i.jsx)(qx,{name:"Throttle",children:(0,i.jsxs)(Kx,{children:[(0,i.jsx)($x.default,{label:"Maximum Allowed",value:Fb.format(t.max_allowed),onChange:function(e){var n=e.target.value||"0";r({max_allowed:Number.parseFloat(n.replace(/,/g,""))})},error:s.max_allowed}),(0,i.jsx)(yf.M,{label:"Wait Period",value:t.period,onChange:function(e){return r({period:e})},error:s.period}),(0,i.jsx)(Wx.Z,{labelForOptions:"label",valueForOptions:"value",label:"Scope",value:o,options:Rb,onChange:function(e){r({scope:e.value})}}),o===Pb&&(0,i.jsx)($x.default,{label:"Throttle Key",value:null!==(n=t.throttle_key)&&void 0!==n?n:Mb,onChange:function(e){r({throttle_key:e.target.value})},error:s.throttle_key})]})})},Bb=function(e){var n=e.node,t=e.onChange,r=n.max_allowed,o=n.period,i=n.scope,a=n.throttle_key,l=Cf(n),s={};r<=0&&(s.max_allowed="Maximum allowed must be greater than 0"),(0,kd.$b)(o)&&(s.period="Period is required"),i!==Pb||a&&a!==Mb||(s.throttle_key="Throttle key is required");var u=Object.keys(s).length>0&&l.edited;return Jx({hasError:u,status:l,onChange:t}),u?s:{}},Hb=function(e){var n,t,r,o,a,l,s,u,c,d,f=e.node,p=e.onChange,h=e.onSet,x=f.message,b=(0,eu.Z)(null===x||void 0===x?void 0:x.to,Array)?{}:null===x||void 0===x?void 0:x.to,y=function(e){return $b(b,e)},C=(0,Es.ew)(),j=(0,Es.kY)(),w=j.options,N=j.setSearch,S=function(e,n){x&&p({message:(0,v.Z)({},e,n)})},k=function(e){return h((0,g.Z)((0,m.Z)({},f),{message:(0,m.Z)({},x,e)}))},_=function(e){return k({to:(0,m.Z)({},x.to,e)})},Z=Ub(x)?x.template:void 0,E=function(e){var n=e.node,t=e.onChange,r=n.message,o=Cf(n),i={};Ub(r)||function(e){return"object"===typeof e&&"content"in e&&!!e.content}(r)||(i.template="Template or Content is required");var a=Object.keys(i).length>0&&o.edited;return Jx({hasError:a,status:o,onChange:t}),a?i:{}}({node:f,onChange:p});return(0,i.jsxs)(qx,{name:"Send",children:[(0,i.jsx)(Kx,{children:(0,i.jsx)(Wx.Z,{label:"Message template",labelForOptions:"label",valueForOptions:"value",options:C,value:Z,error:E.template,onChange:function(e){S("template",e.value)},tooltipForOptionsSide:"left"})}),(0,i.jsxs)(Kx,{heading:"Configure",children:[(0,i.jsx)(Vb,{label:"User Id",value:y("user_id"),onChange:function(e){return _({user_id:e})}}),(0,i.jsx)(Vb,{label:"Email",value:y("email"),onChange:function(e){return _({email:e})}}),(0,i.jsx)(Vb,{label:"Phone Number",value:y("phone_number"),onChange:function(e){return _({phone_number:e})}}),(0,i.jsx)(Wx.Z,{labelForOptions:"label",valueForOptions:"value",label:"Audience",options:w,value:y("audience_id"),onChange:function(e){return _({audience_id:e.value})},onInputChange:N}),(0,i.jsx)(Vb,{label:"List Id",value:y("list_id"),onChange:function(e){return _({list_id:e})}}),(0,i.jsx)(Vb,{label:"List Pattern",value:y("list_pattern"),onChange:function(e){return _({list_pattern:e})}}),(0,i.jsx)(Zb,{label:"Data",value:null!==(n=x.data)&&void 0!==n?n:{},onChange:function(e){return k({data:e})}}),(0,i.jsx)(Zb,{label:"Preferences",value:null!==(t=null===b||void 0===b?void 0:b.preferences)&&void 0!==t?t:{},onChange:function(e){return k({to:(0,g.Z)((0,m.Z)({},b),{preferences:e})})}})]}),(0,i.jsxs)(Kx,{heading:"Advanced",children:[(0,i.jsx)(Vb,{label:"Brand ID",value:null===x||void 0===x?void 0:x.brand_id,onChange:function(e){return k({brand_id:e})}}),(0,i.jsx)(Zb,{label:"Routing",value:null!==(r=null===x||void 0===x?void 0:x.routing)&&void 0!==r?r:{},onChange:function(e){return k({routing:e})}}),(0,i.jsx)(Zb,{label:"Channels",value:null!==(o=null===x||void 0===x?void 0:x.channels)&&void 0!==o?o:{},onChange:function(e){return k({channels:e})}}),(0,i.jsx)(Zb,{label:"Providers",value:null!==(a=null===x||void 0===x?void 0:x.providers)&&void 0!==a?a:{},onChange:function(e){return k({providers:e})}}),(0,i.jsx)(Zb,{label:"Metadata",value:null!==(l=null===x||void 0===x?void 0:x.metadata)&&void 0!==l?l:{},onChange:function(e){return k({metadata:e})}}),(0,i.jsx)(Zb,{label:"Timeout",value:null!==(s=null===x||void 0===x?void 0:x.timeout)&&void 0!==s?s:{},onChange:function(e){return k({timeout:e})}}),(0,i.jsx)(Zb,{label:"Delay",value:null!==(u=null===x||void 0===x?void 0:x.delay)&&void 0!==u?u:{},onChange:function(e){return k({delay:e})}}),(0,i.jsx)(Zb,{label:"Expiry",value:null!==(c=null===x||void 0===x?void 0:x.expiry)&&void 0!==c?c:{},onChange:function(e){return k({expiry:e})}}),(0,i.jsx)(Vb,{label:"Ref",value:null!==(d=f.ref)&&void 0!==d?d:"",onCh
1ange:function(e){return p({ref:e})}})]}),(0,i.jsx)(Kx,{heading:"Developer",children:(0,i.jsx)(Zb,{label:"JSON",value:x,onChange:function(e){return h((0,g.Z)((0,m.Z)({},f),{message:e}))}})})]})},Vb=function(e){var n=e.label,t=e.value,r=e.onChange;return(0,i.jsx)($x.default,{label:n,value:t,onChange:function(e){return e.target.value?r(e.target.value):r(void 0)}})},$b=function(e,n){var t=null===e||void 0===e?void 0:e[n];return"string"===typeof t?t:""};function Ub(e){return"object"===typeof e&&"template"in e&&!!e.template}var Wb=[{label:"GET",value:"get"},{label:"POST",value:"post"}],qb=[{label:"Replace",value:"replace"},{label:"Overwrite",value:"overwrite"},{label:"Soft Merge",value:"soft-merge"},{label:"None",value:"none"}],Kb=function(e){var n=e.node,t=e.onChange,r=e.onSet,o=n.method,a=n.merge_strategy,l=n.idempotency_key,s=n.idempotency_expiry,u=n.headers,c=n.query_params,d=n.body,f=Gb({node:n,onChange:t});return(0,i.jsxs)(qx,{name:"Fetch",children:[(0,i.jsxs)(Kx,{heading:"API",children:[(0,i.jsx)(Wx.Z,{labelForOptions:"label",valueForOptions:"value",options:Wb,value:o,onChange:function(e){return t({method:e.value})}}),(0,i.jsx)($x.default,{label:"URL",value:n.url,onChange:function(e){return t({url:e.target.value})},error:f.url}),(0,i.jsx)(Zb,{label:"Query Params",value:c,onChange:function(e){return r((0,g.Z)((0,m.Z)({},n),{query_params:e}))}}),(0,i.jsx)(Zb,{label:"Headers",value:u,onChange:function(e){return r((0,g.Z)((0,m.Z)({},n),{headers:e}))}}),"post"===o&&(0,i.jsx)(Zb,{label:"Body",value:d,onChange:function(e){return r((0,g.Z)((0,m.Z)({},n),{body:e}))}}),(0,i.jsx)(Wx.Z,{labelForOptions:"label",valueForOptions:"value",options:qb,value:a,onChange:function(e){return t({merge_strategy:e.value})},label:"Merge Strategy"})]}),(0,i.jsxs)(Kx,{heading:"Idempotency",children:[(0,i.jsx)($x.default,{label:"Key",value:l,onChange:function(e){return t({idempotency_key:e.target.value})}}),(0,i.jsx)(vb.Z,{label:"Expiry",value:s?new Date(s):null,onChange:function(e){return t({idempotency_expiry:null===e||void 0===e?void 0:e.toISOString()})}})]})]})},Gb=function(e){var n=e.node,t=e.onChange,r=n.url,o=Cf(n),i={};r||(i.url="URL is required"),r&&!(r.startsWith("${")||r.startsWith("refs.")||Jb(r))&&(i.url="URL is invalid (be sure to include http:// or https://)");var a=Object.keys(i).length>0&&o.edited;return Jx({hasError:a,status:o,onChange:t}),a?i:{}},Jb=function(e){try{return new URL(e),!0}catch(AS){return!1}},Xb=t(62117),Yb="audiences:user:matched",Qb=[{label:"Match",value:Yb},{label:"Unmatch",value:"audiences:user:unmatched"}],ey=[{label:"All members",value:"all"},{label:"New members only",value:"new"}],ny=function(e){var n,t,r=e.node,o=e.onChange,a=(0,Es.kY)().options,l=(n=r.member_scope,ey.some((function(e){return e.value===n}))?r.member_scope:"all");return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(Wx.Z,{label:"Type",options:Qb,value:null!==(t=r.event_type)&&void 0!==t?t:Yb,labelForOptions:"label",valueForOptions:"value",onChange:function(e){var n=e.value;return o((0,g.Z)((0,m.Z)({},r),{event_type:n}))}}),(0,i.jsx)(Wx.Z,{label:"Audience",options:a,value:r.audience_id,labelForOptions:"label",valueForOptions:"value",onChange:function(e){var n=e.value;return o((0,g.Z)((0,m.Z)({},r),{audience_id:n}))}}),(0,i.jsx)(Wx.Z,{label:"Members",options:ey,value:l,labelForOptions:"label",valueForOptions:"value",onChange:function(e){var n=e.value;return o((0,g.Z)((0,m.Z)({},r),{member_scope:n}))}})]})},ty=function(e){var n=e.node,t=e.onChange,r=(0,Es.vF)();return(0,i.jsx)(Wx.Z,{label:"Subscription topic",options:r,value:n.subscription_topic_id,labelForOptions:"label",valueForOptions:"value",onChange:function(e){var r=e.value;return t((0,g.Z)((0,m.Z)({},n),{subscription_topic_id:r}))}})},ry=t(82737),oy="track",iy="page",ay="group",ly=function(e,n){return n.find((function(n){return n.value===e}))},sy=function(e){var n=e.node,t=e.onChange,r=n.event_id,o=n.event_source,a=(0,Bs.mz)(),l=(0,Ds.Xv)(o);return r&&!l.find((function(e){return e.value===r}))&&l.push({label:r,value:r}),(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)($x.default,{label:"Type",value:"Track",disabled:!0}),(0,i.jsx)(Wx.Z,{options:a,label:"Source",value:o,onChange:function(e){var r=e.value;return t((0,g.Z)((0,m.Z)({},n),{event_source:r}))},labelForOptions:"label",valueForOptions:"value"}),(0,i.jsx)(ry.Z,{options:l,label:"Event",value:ly(r,l),onChange:function(e){var r=e.value;return t((0,g.Z)((0,m.Z)({},n),{event_id:r}))},onInputChange:function(e){t((0,g.Z)((0,m.Z)({},n),{event_id:e}))},creatable:!0,labelForOptions:"label",valueForOptions:"value"})]})},uy=[{label:"Every Day",value:"day"},{label:"Every Week",value:"week"},{label:"Every Month",value:"month"},{label:"Every Year",value:"year"}],cy=[{label:"Sunday",value:"sunday"},{label:"Monday",value:"monday"},{label:"Tuesday",value:"tuesday"},{label:"Wednesday",value:"wednesday"},{label:"Thursday",value:"thursday"},{label:"Friday",value:"friday"},{label:"Saturday",value:"saturday"}],dy=function(e){return"recurrence"===e?{type:e,startDate:(new Date).toISOString(),frequency:1,repeatUnit:"day"}:{type:e,value:""}},fy=t(1417),py=function(e){var n=e.value,t=e.onChange;return"cron"!==n.type?null:(0,i.jsx)($x.default,{label:"Cron String",value:n.value,onChange:function(e){return t((0,g.Z)((0,m.Z)({},n),{value:e.target.value}))}})},hy=function(e){var n=e.value,t=e.onChange;return"date"!==n.type?null:(0,i.jsx)(vb.Z,{label:"Date",value:n.value?new Date(n.value):null,onChange:function(e){return t((0,g.Z)((0,m.Z)({},n),{value:e?e.toISOString():null}))}})},vy=function(e){var n=e.value,t=e.onChange;if("recurrence"!==n.type)return null;var r,o,a=function(e){var r=(0,m.Z)({},n,e);"year"===r.repeatUnit&&(r.frequency=1),t(r)};return n.repeatOn=null!==(r=n.repeatOn)&&void 0!==r?r:{sunday:!1,monday:!1,tuesday:!1,wednesday:!1,thursday:!1,friday:!1,saturday:!1},(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(Wx.Z,{labelForOptions:"label",valueForOptions:"value",label:"Frequency",value:n.repeatUnit,options:uy,onChange:function(e){var n=e.value;return a({repeatUnit:n})}}),"week"===n.repeatUnit&&(0,i.jsx)(fy.Z,{options:cy,value:(o=n.repeatOn,cy.filter((function(e){return o[e.value]}))),onChange:function(e){return a({repeatOn:(n=e,cy.reduce((function(e,t){return e[t.value]=n.includes(t),e}),{}))});var n},labelForOptions:"label"}),(0,i.jsx)(vb.Z,{label:"Start Date",value:n.startDate?new Date(n.startDate):null,onChange:function(e){return a({startDate:e?e.toISOString():null})}}),(0,i.jsx)(vb.Z,{label:"End Date",value:n.endDate?new Date(n.endDate):null,onChange:function(e){return a({endDate:e?e.toISOString():null})}})]})},my=[{label:"Date",value:"date"},{label:"Recurrence",value:"recurrence"},{label:"Cron",value:"cron"}],gy=function(e){var n,t,r,o=e.node,a=e.onChange,l=null!==(t=null===o||void 0===o||null===(n=o.schedule)||void 0===n?void 0:n.type)&&void 0!==t?t:"recurrence",s="date"===l?hy:"recurrence"===l?vy:py;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(Wx.Z,{label:"Type",options:my,value:l,labelForOptions:"label",valueForOptions:"value",onCh
1ange:function(e){var n=e.value;return a((0,g.Z)((0,m.Z)({},o),{schedule:dy(n)}))}}),(0,i.jsx)(s,{value:null!==(r=null===o||void 0===o?void 0:o.schedule)&&void 0!==r?r:dy(l),onChange:function(e){return a((0,g.Z)((0,m.Z)({},o),{schedule:e}))}})]})},xy=[{label:"Track",value:oy},{label:"Page",value:iy},{label:"Identify",value:"identify"},{label:"Group",value:ay}],by=[oy,iy],yy=function(e){var n=e.node,t=e.onChange,r=n.request_type,o=n.event_id,i=Cf(n),a={};by.includes(r)&&(o&&""!==o.trim()||(a.event_id="A Segment event must be selected for ".concat(r," events")));var l=Object.keys(a).length>0&&i.edited;return Jx({hasError:l,status:i,onChange:t}),l?a:{}},Cy=function(e){var n=e.node,t=e.onChange,r=n.request_type,o=n.event_id,a=(0,Xi.hE)(),s=yy({node:n,onChange:t}),u=Object.keys(s).length>0,c=(0,l.useMemo)((function(){var e=r===iy?a.page:a.track;return o&&!e.some((function(e){return e.value===o}))?(0,N.Z)(e).concat([{label:o,value:o}]):e}),[o,r,a]);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(Wx.Z,{label:"Type",options:xy,value:r,labelForOptions:"label",valueForOptions:"value",onChange:function(e){var r=e.value;return t((0,g.Z)((0,m.Z)({},n),{request_type:r,event_id:""}))}}),by.includes(r)&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(ry.Z,{label:"Event",options:c,value:ly(o,c),onChange:function(e){var r=e.value;return t((0,g.Z)((0,m.Z)({},n),{event_id:r}))},onInputChange:function(e){t((0,g.Z)((0,m.Z)({},n),{event_id:e}))},creatable:!0,labelForOptions:"label",valueForOptions:"value",error:s.event_id}),u&&(0,i.jsx)("p",{className:"mt-1 text-xs text-text-red",children:s.event_id})]}),r===ay&&(0,i.jsx)($x.default,{label:"Group ID",value:o,onChange:function(e){return t((0,g.Z)((0,m.Z)({},n),{event_id:e.target.value}))}})]})},jy=[{label:"Identify",value:"user"},{label:"Track",value:oy},{label:"Group",value:ay}],wy=function(e){var n=e.node,t=e.onChange,r=n.event_type,o=n.event_id,a=(0,Ds.ob)();return o&&!a.find((function(e){return e.value===o}))&&a.push({label:o,value:o}),(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(Wx.Z,{label:"Type",options:jy,value:r,labelForOptions:"label",valueForOptions:"value",onChange:function(e){var r=e.value;return t((0,g.Z)((0,m.Z)({},n),{event_type:r,event_id:""}))}}),r===oy&&(0,i.jsx)(ry.Z,{label:"Event",options:a,value:ly(o,a),onChange:function(e){var r=e.value;return t((0,g.Z)((0,m.Z)({},n),{event_id:r}))},onInputChange:function(e){t((0,g.Z)((0,m.Z)({},n),{event_id:e}))},creatable:!0,labelForOptions:"label",valueForOptions:"value"}),r===ay&&(0,i.jsx)($x.default,{label:"Group ID",value:o,onChange:function(e){return t((0,g.Z)((0,m.Z)({},n),{event_id:e.target.value}))}})]})},Ny=function(e){var n=e.node,t=e.onChange,r=n.event_id,o=(0,Ds.up)();return r&&!o.find((function(e){return e.value===r}))&&o.push({label:r,value:r}),(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)($x.default,{label:"Type",value:"Track",disabled:!0}),(0,i.jsx)(ry.Z,{label:"Event",options:o,value:ly(r,o),onChange:function(e){var r=e.value;return t((0,g.Z)((0,m.Z)({},n),{event_id:r}))},onInputChange:function(e){t((0,g.Z)((0,m.Z)({},n),{event_id:e}))},creatable:!0,labelForOptions:"label",valueForOptions:"value"})]})},Sy=[{label:"None selected",value:"api-invoke"},{label:"Audience",value:"audience"},{label:"Digest",value:"digest"},{label:"Schedule",value:"schedule"},{label:"Segment",value:"segment"},{label:"Rudderstack",value:"rudderstack"},{label:"Courier",value:"courier"},{label:"Webhook",value:"webhook"}],ky=function(e){var n,t=e.node,o=e.onSet,a=e.onChange,l=t.trigger_type,s=(n=t.automation_template_id,"https://api.courier.com/automations/".concat(n,"/invoke")),u=(0,r.Z)((0,Xb.Z)(s),2),c=u[0],d=u[1],f=Yd(t);return(0,i.jsx)(qx,{name:"Trigger",children:(0,i.jsx)(Kx,{children:(0,i.jsxs)("div",{className:"flex flex-col gap-xl",children:[(0,i.jsx)(cf.default,{variant:"regular-md",children:"Invoke from API"}),(0,i.jsxs)("div",{className:"flex gap-2",children:[(0,i.jsx)(D.Tooltip,{content:c,delay:[0,0],children:(0,i.jsx)("button",{className:"m-0 cursor-pointer truncate border-0 bg-transparent p-0 text-link",onClick:d,children:(0,i.jsx)(cf.default,{variant:"regular-sm",className:"text-link",children:s})})}),(0,i.jsx)(D.Tooltip,{content:c,delay:[0,0],children:(0,i.jsx)("button",{className:"flex cursor-pointer items-center border-none bg-transparent p-0",onClick:d,children:(0,i.jsx)(J.CKM,{className:"h-5 w-5 text-link"})})})]}),(0,i.jsx)("div",{className:"flex justify-center",children:(0,i.jsx)(cf.default,{variant:"regular-md",children:"or"})}),(0,i.jsx)(cf.default,{variant:"regular-md",children:"Invoke from source"}),(0,i.jsx)(Wx.Z,{label:"Source",options:Sy,value:f,labelForOptions:"label",valueForOptions:"value",onCh
1ange:function(e){var n=e.value,r="courier"===n||"rudderstack"===n;o((0,g.Z)((0,m.Z)({},(0,Px.w)({type:"trigger",position:t.properties.position,templateId:t.automation_template_id,triggerType:r?"inbound-event":n,eventSource:r?n:void 0,templateVersion:"2024-05-09"})),{id:t.id,temp_props:t.temp_props,properties:t.properties,next_step:t.next_step}))}}),"audience"===l&&(0,i.jsx)(ny,{node:t,onChange:a}),"digest"===l&&(0,i.jsx)(ty,{node:t,onChange:a}),"webhook"===l&&(0,i.jsx)(sy,{node:t,onChange:a}),"schedule"===l&&(0,i.jsx)(gy,{node:t,onChange:a}),"segment"===l&&(0,i.jsx)(Cy,{node:t,onChange:a}),"inbound-event"===l&&"rudderstack"===t.event_source&&(0,i.jsx)(wy,{node:t,onChange:a}),"inbound-event"===l&&"courier"===t.event_source&&(0,i.jsx)(Ny,{node:t,onChange:a})]})})})},_y=[{value:"replace",label:"Replace"},{value:"soft-merge",label:"Soft Merge"},{value:"overwrite",label:"Overwrite"},{value:"none",label:"None"}],Zy=function(e){var n=e.node,t=e.onChange,r=Ey({node:n,onChange:t});return(0,i.jsx)(qx,{name:"GET Profile",children:(0,i.jsxs)(Kx,{children:[(0,i.jsx)($x.default,{label:"User ID",value:n.user_id,error:r.user_id,onChange:function(e){return t({user_id:e.target.value})}}),(0,i.jsx)($x.default,{label:"Path",value:n.path,error:r.path,onChange:function(e){return t({path:e.target.value})}}),(0,i.jsx)($x.default,{label:"Tenant",value:n.user_tenant_id,onChange:function(e){return t({user_tenant_id:e.target.value})}}),(0,i.jsx)(Wx.Z,{label:"Merge Strategy",labelForOptions:"label",valueForOptions:"value",options:_y,value:n.merge_strategy,onChange:function(e){return t({merge_strategy:e.value})}})]})})},Ey=function(e){var n=e.node,t=e.onChange,r=n.user_id,o=n.path,i=Cf(n),a={};r||(a.user_id="User ID is required"),o&&!/^data(?:\.\w+)+|profile$/.test(o)&&(a.path="Path must be profile or data(.<key>)+");var l=Object.keys(a).length>0&&i.edited;return Jx({hasError:l,status:i,onChange:t}),l?a:{}},Iy=function(){return(0,i.jsx)(qx,{name:"Canvas Controls",children:(0,i.jsxs)(Kx,{children:[(0,i.jsx)(Oy,{label:"Create",description:"Right mouse click on canvas"}),(0,i.jsx)(Oy,{label:"Pan",description:"Click + drag mouse, scroll middle or right mouse wheel"}),(0,i.jsx)(Oy,{label:"Zoom",description:"Pinch or cmd (ctrl) + scroll"}),(0,i.jsx)(Oy,{label:"Node options",description:"Right mouse click on node"}),(0,i.jsx)(Oy,{label:"Undo",description:"cmd (ctrl) + z"}),(0,i.jsx)(Oy,{label:"Redo",description:"cmd (ctrl) + shift + z"})]})})},Oy=function(e){var n=e.label,t=e.description;return(0,i.jsxs)("div",{className:"flex w-full justify-between",children:[(0,i.jsx)(cf.default,{variant:"regular-sm",className:"block w-1/3 flex-none text-subtext",children:n}),(0,i.jsx)(cf.default,{variant:"regular-sm",className:"block flex-grow pl-1 text-content",children:t})]})},Ty=t(62470),Ay=t(14310),Dy=t(78719),Ly=function(e){return(0,Dy.default)(new Date(e),"MMM d, h:mm aaa")},My=t(13242),Py=t(34314),Ry=t(58943),Fy=t(22582),zy=t(38712);function By(){var e=(0,o.Z)(["\n  query GetAutomationDiff(\n    $templateId: String!\n    $baseVersion: String!\n    $compareVersion: String!\n  ) {\n    automationsV2 {\n      templateVersionDiff(\n        templateId: $templateId\n        baseVersion: $baseVersion\n        compareVersion: $compareVersion\n      )\n    }\n  }\n"]);return By=function(){return e},e}var Hy,Vy=(0,Fy.Ps)(By()),$y=function(e){var n=e.templateId,t=e.baseVersion,r=e.compareVersion,o=(0,zy.Hw)(Vy);return(0,Ry.a)({queryKey:["automation-diff",n,t,r],queryFn:function(){return o({templateId:n,baseVersion:t,compareVersion:r})},enabled:!!n&&!!t&&!!r})};!function(e){e.INSERT="insert",e.DELETE="delete",e.CONTEXT="context"}(Hy||(Hy={}));var Uy;!function(e){e.AUTO="auto",e.DARK="dark",e.LIGHT="light"}(Uy||(Uy={}));const Wy=RegExp("["+["-","[","]","/","{","}","(",")","*","+","?",".","\\","^","$","|"].join("\\")+"]","g");function qy(e){return e?e.replace(/\\/g,"/"):e}function Ky(e,n){const t=e.split(".");return t.length>1?t[t.length-1]:n}function Gy(e,n){return n.reduce(((n,t)=>n||e.startsWith(t)),!1)}const Jy=["a/","b/","i/","w/","c/","o/"];function Xy(e,n,t){const r=void 0!==t?[...Jy,t]:Jy,o=n?new RegExp(`^${i=n,i.replace(Wy,"\\$&")}
1 "?(.+?)"?$`):new RegExp('^"?(.+?)"?$');var i;const[,a=""]=o.exec(e)||[],l=r.find((e=>0===a.indexOf(e)));return(l?a.slice(l.length):a).replace(/\s+\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}(?:\.\d+)? [+-]\d{4}.*$/,"")}function Yy(e,n={}){const t=[];let r=null,o=null,i=null,a=null,l=null,s=null,u=null;const c="--- ",d="+++ ",f="@@",p=/^old mode (\d{6})/,h=/^new mode (\d{6})/,v=/^deleted file mode (\d{6})/,m=/^new file mode (\d{6})/,g=/^copy from "?(.+)"?/,x=/^copy to "?(.+)"?/,b=/^rename from "?(.+)"?/,y=/^rename to "?(.+)"?/,C=/^similarity index (\d+)%/,j=/^dissimilarity index (\d+)%/,w=/^index ([\da-z]+)\.\.([\da-z]+)\s*(\d{6})?/,N=/^Binary files (.*) and (.*) differ/,S=/^GIT binary patch/,k=/^index ([\da-z]+),([\da-z]+)\.\.([\da-z]+)/,_=/^mode (\d{6}),(\d{6})\.\.(\d{6})/,Z=/^new file mode (\d{6})/,E=/^deleted file mode (\d{6}),(\d{6})/,I=e.replace(/\\ No newline at end of file/g,"").replace(/\r\n?/g,"\n").split("\n");function O(){null!==o&&null!==r&&(r.blocks.push(o),o=null)}function T(){null!==r&&(r.oldName||null===s||(r.oldName=s),r.newName||null===u||(r.newName=u),r.newName&&(t.push(r),r=null)),s=null,u=null}function A(){O(),T(),r={blocks:[],deletedLines:0,addedLines:0}}function D(e){let n;O(),null!==r&&((n=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@.*/.exec(e))?(r.isCombined=!1,i=parseInt(n[1],10),l=parseInt(n[2],10)):(n=/^@@@ -(\d+)(?:,\d+)? -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@@.*/.exec(e))?(r.isCombined=!0,i=parseInt(n[1],10),a=parseInt(n[2],10),l=parseInt(n[3],10)):(e.startsWith(f)&&console.error("Failed to parse lines, starting in 0!"),i=0,l=0,r.isCombined=!1)),o={lines:[],oldStartLine:i,oldStartLine2:a,newStartLine:l,header:e}}return I.forEach(((e,a)=>{if(!e||e.startsWith("*"))return;let O;const T=I[a-1],L=I[a+1],M=I[a+2];if(e.startsWith("diff --git")||e.startsWith("diff --combined")){A();if((O=/^diff --git "?([a-ciow]\/.+)"? "?([a-ciow]\/.+)"?/.exec(e))&&(s=Xy(O[1],void 0,n.dstPrefix),u=Xy(O[2],void 0,n.srcPrefix)),null===r)throw new Error("Where is my file !!!");return void(r.isGitDiff=!0)}if(e.startsWith("Binary files")&&!(null===r||void 0===r?void 0:r.isGitDiff)){A();if((O=/^Binary files "?([a-ciow]\/.+)"? and "?([a-ciow]\/.+)"? differ/.exec(e))&&(s=Xy(O[1],void 0,n.dstPrefix),u=Xy(O[2],void 0,n.srcPrefix)),null===r)throw new Error("Where is my file !!!");return void(r.isBinary=!0)}if((!r||!r.isGitDiff&&r&&e.startsWith(c)&&L.startsWith(d)&&M.startsWith(f))&&A(),null===r||void 0===r?void 0:r.isTooBig)return;if(r&&("number"===typeof n.diffMaxChanges&&r.addedLines+r.deletedLines>n.diffMaxChanges||"number"===typeof n.diffMaxLineLength&&e.length>n.diffMaxLineLength)){r.isTooBig=!0,r.addedLines=0,r.deletedLines=0,r.blocks=[],o=null;return void D("function"===typeof n.diffTooBigMessage?n.diffTooBigMessage(t.length):"Diff too big to be displayed")}if(e.startsWith(c)&&L.startsWith(d)||e.startsWith(d)&&T.startsWith(c)){if(r&&!r.oldName&&e.startsWith("--- ")&&(O=function(e,n){return Xy(e,"---",n)}(e,n.srcPrefix)))return r.oldName=O,void(r.language=Ky(r.oldName,r.language));if(r&&!r.newName&&e.startsWith("+++ ")&&(O=function(e,n){return Xy(e,"+++",n)}(e,n.dstPrefix)))return r.newName=O,void(r.language=Ky(r.newName,r.language))}if(r&&(e.startsWith(f)||r.isGitDiff&&r.oldName&&r.newName&&!o))return void D(e);if(o&&(e.startsWith("+")||e.startsWith("-")||e.startsWith(" ")))return void function(e){if(null===r||null===o||null===i||null===l)return;const n={content:e},t=r.isCombined?["+ "," +","++"]:["+"],a=r.isCombined?["- "," -","--"]:["-"];Gy(e,t)?(r.addedLines++,n.type=Hy.INSERT,n.oldNumber=void 0,n.newNumber=l++):Gy(e,a)?(r.deletedLines++,n.type=Hy.DELETE,n.oldNumber=i++,n.newNumber=void 0):(n.type=Hy.CONTEXT,n.oldNumber=i++,n.newNumber=l++),o.lines.push(n)}(e);const P=!function(e,n){let t=n;for(;t<I.length-3;){if(e.startsWith("diff"))return!1;if(I[t].startsWith(c)&&I[t+1].startsWith(d)&&I[t+2].startsWith(f))return!0;t++}return!1}(e,a);if(null===r)throw new Error("Where is my file !!!");(O=p.exec(e))?r.oldMode=O[1]:(O=h.exec(e))?r.newMode=O[1]:(O=v.exec(e))?(r.deletedFileMode=O[1],r.isDeleted=!0):(O=m.exec(e))?(r.newFileMode=O[1],r.isNew=!0):(O=g.exec(e))?(P&&(r.oldName=O[1]),r.isCopy=!0):(O=x.exec(e))?(P&&(r.newName=O[1]),r.isCopy=!0):(O=b.exec(e))?(P&&(r.oldName=O[1]),r.isRename=!0):(O=y.exec(e))?(P&&(r.newName=O[1]),r.isRename=!0):(O=N.exec(e))?(r.isBinary=!0,r.oldName=Xy(O[1],void 0,n.srcPrefix),r.newName=Xy(O[2],void 0,n.dstPrefix),D("Binary f
1ile")):S.test(e)?(r.isBinary=!0,D(e)):(O=C.exec(e))?r.unchangedPercentage=parseInt(O[1],10):(O=j.exec(e))?r.changedPercentage=parseInt(O[1],10):(O=w.exec(e))?(r.checksumBefore=O[1],r.checksumAfter=O[2],O[3]&&(r.mode=O[3])):(O=k.exec(e))?(r.checksumBefore=[O[2],O[3]],r.checksumAfter=O[1]):(O=_.exec(e))?(r.oldMode=[O[2],O[3]],r.newMode=O[1]):(O=Z.exec(e))?(r.newFileMode=O[1],r.isNew=!0):(O=E.exec(e))&&(r.deletedFileMode=O[1],r.isDeleted=!0)})),O(),T(),t}function Qy(){}function eC(e,n,t,r,o){for(var i=0,a=n.length,l=0,s=0;i<a;i++){var u=n[i];if(u.removed){if(u.value=e.join(r.slice(s,s+u.count)),s+=u.count,i&&n[i-1].added){var c=n[i-1];n[i-1]=n[i],n[i]=c}}else{if(!u.added&&o){var d=t.slice(l,l+u.count);d=d.map((function(e,n){var t=r[s+n];return t.length>e.length?t:e})),u.value=e.join(d)}else u.value=e.join(t.slice(l,l+u.count));l+=u.count,u.added||(s+=u.count)}}var f=n[a-1];return a>1&&"string"===typeof f.value&&(f.added||f.removed)&&e.equals("",f.value)&&(n[a-2].value+=f.value,n.pop()),n}function nC(e){return{newPos:e.newPos,components:e.components.slice(0)}}Qy.prototype={diff:function(e,n){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=t.callback;"function"===typeof t&&(r=t,t={}),this.options=t;var o=this;function i(e){return r?(setTimeout((function(){r(void 0,e)}),0),!0):e}e=this.castInput(e),n=this.castInput(n),e=this.removeEmpty(this.tokenize(e));var a=(n=this.removeEmpty(this.tokenize(n))).length,l=e.length,s=1,u=a+l;t.maxEditLength&&(u=Math.min(u,t.maxEditLength));var c=[{newPos:-1,components:[]}],d=this.extractCommon(c[0],n,e,0);if(c[0].newPos+1>=a&&d+1>=l)return i([{value:this.join(n),count:n.length}]);function f(){for(var t=-1*s;t<=s;t+=2){var r=void 0,u=c[t-1],d=c[t+1],f=(d?d.newPos:0)-t;u&&(c[t-1]=void 0);var p=u&&u.newPos+1<a,h=d&&0<=f&&f<l;if(p||h){if(!p||h&&u.newPos<d.newPos?(r=nC(d),o.pushComponent(r.components,void 0,!0)):((r=u).newPos++,o.pushComponent(r.components,!0,void 0)),f=o.extractCommon(r,n,e,t),r.newPos+1>=a&&f+1>=l)return i(eC(o,r.components,n,e,o.useLongestToken));c[t]=r}else c[t]=void 0}s++}if(r)!function e(){setTimeout((function(){if(s>u)return r();f()||e()}),0)}();else for(;s<=u;){var p=f();if(p)return p}},pushComponent:function(e,n,t){var r=e[e.length-1];r&&r.added===n&&r.removed===t?e[e.length-1]={count:r.count+1,added:n,removed:t}:e.push({count:1,added:n,removed:t})},extractCommon:function(e,n,t,r){for(var o=n.length,i=t.length,a=e.newPos,l=a-r,s=0;a+1<o&&l+1<i&&this.equals(n[a+1],t[l+1]);)a++,l++,s++;return s&&e.components.push({count:s}),e.newPos=a,l},equals:function(e,n){return this.options.comparator?this.options.comparator(e,n):e===n||this.options.ignoreCase&&e.toLowerCase()===n.toLowerCase()},removeEmpty:function(e){for(var n=[],t=0;t<e.length;t++)e[t]&&n.push(e[t]);return n},castInput:function(e){return e},tokenize:function(e){return e.split("")},join:function(e){return e.join("")}};var tC=new Qy;var rC=/^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/,oC=/\S/,iC=new Qy;iC.equals=function(e,n){return this.options.ignoreCase&&(e=e.toLowerCase(),n=n.toLowerCase()),e===n||this.options.ignoreWhitespace&&!oC.test(e)&&!oC.test(n)},iC.tokenize=function(e){for(var n=e.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/),t=0;t<n.length-1;t++)!n[t+1]&&n[t+2]&&rC.test(n[t])&&rC.test(n[t+2])&&(n[t]+=n[t+2],n.splice(t+1,2),t--);return n};var aC=new Qy;aC.tokenize=function(e){var n=[],t=e.split(/(\n|\r\n)/);t[t.length-1]||t.pop();for(var r=0;r<t.length;r++){var o=t[r];r%2&&!this.options.newlineIsToken?n[n.length-1]+=o:(this.options.ignoreWhitespace&&(o=o.trim()),n.push(o))}return n};var lC=new Qy;lC.tokenize=function(e){return e.split(/(\S.+?[.!?])(?=\s+|$)/)};var sC=new Qy;function uC(e){return uC="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},uC(e)}sC.tokenize=function(e){return e.split(/([{}:;,]|\s+)/)};var cC=Object.prototype.toString,dC=new Qy;function fC(e,n,t,r,o){var i,a;for(n=n||[],t=t||[],r&&(e=r(o,e)),i=0;i<n.length;i+=1)if(n[i]===e)return t[i];if("[object Array]"===cC.call(e)){for(n.push(e),a=new Array(e.length),t.push(a),i=0;i<e.length;
1i+=1)a[i]=fC(e[i],n,t,r,o);return n.pop(),t.pop(),a}if(e&&e.toJSON&&(e=e.toJSON()),"object"===uC(e)&&null!==e){n.push(e),a={},t.push(a);var l,s=[];for(l in e)e.hasOwnProperty(l)&&s.push(l);for(s.sort(),i=0;i<s.length;i+=1)a[l=s[i]]=fC(e[l],n,t,r,l);n.pop(),t.pop()}else a=e;return a}dC.useLongestToken=!0,dC.tokenize=aC.tokenize,dC.castInput=function(e){var n=this.options,t=n.undefinedReplacement,r=n.stringifyReplacer,o=void 0===r?function(e,n){return"undefined"===typeof n?t:n}:r;return"string"===typeof e?e:JSON.stringify(fC(e,null,null,o),o,"  ")},dC.equals=function(e,n){return Qy.prototype.equals.call(dC,e.replace(/,([\r\n])/g,"$1"),n.replace(/,([\r\n])/g,"$1"))};var pC=new Qy;function hC(e){return(n,t)=>{const r=e(n).trim(),o=e(t).trim();return function(e,n){if(0===e.length)return n.length;if(0===n.length)return e.length;const t=[];let r,o;for(r=0;r<=n.length;r++)t[r]=[r];for(o=0;o<=e.length;o++)t[0][o]=o;for(r=1;r<=n.length;r++)for(o=1;o<=e.length;o++)n.charAt(r-1)===e.charAt(o-1)?t[r][o]=t[r-1][o-1]:t[r][o]=Math.min(t[r-1][o-1]+1,Math.min(t[r][o-1]+1,t[r-1][o]+1));return t[n.length][e.length]}(r,o)/(r.length+o.length)}}function vC(e){return function n(t,r,o=0,i=new Map){const a=function(n,t,r=new Map){let o,i=1/0;for(let a=0;a<n.length;++a)for(let l=0;l<t.length;++l){const s=JSON.stringify([n[a],t[l]]);let u;r.has(s)&&(u=r.get(s))||(u=e(n[a],t[l]),r.set(s,u)),u<i&&(i=u,o={indexA:a,indexB:l,score:i})}return o}(t,r,i);if(!a||t.length+r.length<3)return[[t,r]];const l=t.slice(0,a.indexA),s=r.slice(0,a.indexB),u=[t[a.indexA]],c=[r[a.indexB]],d=a.indexA+1,f=a.indexB+1,p=t.slice(d),h=r.slice(f),v=n(l,s,o+1,i),m=n(u,c,o+1,i),g=n(p,h,o+1,i);let x=m;return(a.indexA>0||a.indexB>0)&&(x=v.concat(x)),(t.length>d||r.length>f)&&(x=x.concat(g)),x}}pC.tokenize=function(e){return e.slice()},pC.join=pC.removeEmpty=function(e){return e};const mC={INSERTS:"d2h-ins",DELETES:"d2h-del",CONTEXT:"d2h-cntx",INFO:"d2h-info",INSERT_CHANGES:"d2h-ins d2h-change",DELETE_CHANGES:"d2h-del d2h-change"},gC={matching:"none",matchWordsThreshold:.25,maxLineLengthHighlight:1e4,diffStyle:"word",colorScheme:Uy.LIGHT},xC="/",bC=hC((e=>e.value)),yC=vC(bC);function CC(e){return-1!==e.indexOf("dev/null")}function jC(e){return e.replace(/(<del[^>]*>((.|\n)*?)<\/del>)/g,"")}function wC(e){switch(e){case Hy.CONTEXT:return mC.CONTEXT;case Hy.INSERT:return mC.INSERTS;case Hy.DELETE:return mC.DELETES}}function NC(e){switch(e){case Uy.DARK:return"d2h-dark-color-scheme";case Uy.AUTO:return"d2h-auto-color-scheme";case Uy.LIGHT:default:return"d2h-light-color-scheme"}}function SC(e){return e.slice(0).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;").replace(/\//g,"&#x2F;")}function kC(e,n,t=!0){const r=function(e){return e?2:1}(n);return{prefix:e.substring(0,r),content:t?SC(e.substring(r)):e.substring(r)}}function _C(e){const n=qy(e.oldName),t=qy(e.newName);if(n===t||CC(n)||CC(t))return CC(t)?n:t;{const e=[],r=[],o=n.split(xC),i=t.split(xC);let a=0,l=o.length-1,s=i.length-1;for(;a<l&&a<s&&o[a]===i[a];)e.push(i[a]),a+=1;for(;l>a&&s>a&&o[l]===i[s];)r.unshift(i[s]),l-=1,s-=1;const u=e.join(xC),c=r.join(xC),d=o.slice(a,l+1).join(xC),f=i.slice(a,s+1).join(xC);return u.length&&c.length?u+xC+"{"+d+" \u2192 "+f+"}"+xC+c:u.length?u+xC+"{"+d+" \u2192 "+f+"}":c.length?"{"+d+" \u2192 "+f+"}"+xC+c:n+" \u2192 "+t}}function ZC(e){return`d2h-${function(e){let n,t,r,o=0;for(n=0,r=e.length;n<r;n++)t=e.charCodeAt(n),o=(o<<5)-o+t,o|=0;return o}(_C(e)).toString().slice(-6)}`}function EC(e){let n="file-changed";return e.isRename||e.isCopy?n="file-renamed":e.isNew?n="file-added":e.isDeleted?n="file-deleted":e.newName!==e.oldName&&(n="file-renamed"),n}function IC(e,n,t,r={}){const{matching:o,maxLineLengthHighlight:i,matchWordsThreshold:a,diffStyle:l}=Object.assign(Object.assign({},gC),r),s=kC(e,t,!1),u=kC(n,t,!1);if(s.content.length>i||u.content.length>i)return{oldLine:{prefix:s.prefix,content:SC(s.content)},newLine:{prefix:u.prefix,content:SC(u.content)}};const c="char"===l?function(e,n,t){return tC.diff(e,n,t)}(s.content,u.content):function(e,n,t){return iC.diff(e,n,t)}(s.content,u.content),d=[];if("word"===l&&"words"===o){const e=c.filter((e=>e.removed)),n=c.filter((e=>e.added));yC(n,e).forEach((e=>{if(1===e[0].length&&1===e[1].length){bC(e[0][0],e[1][0])<a&&(d.push(e[0][0]),d.push(e[1][0]))}}))}const f=c.reduce(((e,n)=>{const t=n.added?"ins":n.removed?"del":null,r=d.indexOf(n)>-1?' class="d2h-change"':"",o=SC(n.value);return null!==t?`${e}<${t}${r}>${o}</${t}>`:`${e}${o}`}),"");return{oldLine:{prefix:s.prefix,content:(p=f,p.replace(/(<ins[^>]*>((.|\n)*?)<\/ins>)/g,""))},newLine:{prefix:u.prefix,content:jC(f)}};var p}const OC="file-summary",TC={colorScheme:gC.colorScheme};class AC{constructor(e,n={}){this.hoganUtils=e,this.config=Object.assign(Object.assign({},TC),n)}render(e){const n=e.map((e=>this.hoganUtils.render(OC,"line",{fileHtmlId:ZC(e),oldName:e.oldName,newName:e.newName,fileName:_C(e),deletedLine
1s:"-"+e.deletedLines,addedLines:"+"+e.addedLines},{fileIcon:this.hoganUtils.template("icon",EC(e))}))).join("\n");return this.hoganUtils.render(OC,"wrapper",{colorScheme:NC(this.config.colorScheme),filesNumber:e.length,files:n})}}const DC=Object.assign(Object.assign({},gC),{renderNothingWhenEmpty:!1,matchingMaxComparisons:2500,maxLineSizeInBlockForComparison:200}),LC="generic",MC="line-by-line";class PC{constructor(e,n={}){this.hoganUtils=e,this.config=Object.assign(Object.assign({},DC),n)}render(e){const n=e.map((e=>{let n;return n=e.blocks.length?this.generateFileHtml(e):this.generateEmptyDiff(),this.makeFileDiffHtml(e,n)})).join("\n");return this.hoganUtils.render(LC,"wrapper",{colorScheme:NC(this.config.colorScheme),content:n})}makeFileDiffHtml(e,n){if(this.config.renderNothingWhenEmpty&&Array.isArray(e.blocks)&&0===e.blocks.length)return"";const t=this.hoganUtils.template(MC,"file-diff"),r=this.hoganUtils.template(LC,"file-path"),o=this.hoganUtils.template("icon","file"),i=this.hoganUtils.template("tag",EC(e));return t.render({file:e,fileHtmlId:ZC(e),diffs:n,filePath:r.render({fileDiffName:_C(e)},{fileIcon:o,fileTag:i})})}generateEmptyDiff(){return this.hoganUtils.render(LC,"empty-diff",{contentClass:"d2h-code-line",CSSLineClass:mC})}generateFileHtml(e){const n=vC(hC((n=>kC(n.content,e.isCombined).content)));return e.blocks.map((t=>{let r=this.hoganUtils.render(LC,"block-header",{CSSLineClass:mC,blockHeader:e.isTooBig?t.header:SC(t.header),lineClass:"d2h-code-linenumber",contentClass:"d2h-code-line"});return this.applyLineGroupping(t).forEach((([t,o,i])=>{if(o.length&&i.length&&!t.length)this.applyRematchMatching(o,i,n).map((([n,t])=>{const{left:o,right:i}=this.processChangedLines(e,e.isCombined,n,t);r+=o,r+=i}));else if(t.length)t.forEach((n=>{const{prefix:t,content:o}=kC(n.content,e.isCombined);r+=this.generateSingleLineHtml(e,{type:mC.CONTEXT,prefix:t,content:o,oldNumber:n.oldNumber,newNumber:n.newNumber})}));else if(o.length||i.length){const{left:n,right:t}=this.processChangedLines(e,e.isCombined,o,i);r+=n,r+=t}else console.error("Unknown state reached while processing groups of lines",t,o,i)})),r})).join("\n")}applyLineGroupping(e){const n=[];let t=[],r=[];for(let o=0;o<e.lines.length;o++){const i=e.lines[o];(i.type!==Hy.INSERT&&r.length||i.type===Hy.CONTEXT&&t.length>0)&&(n.push([[],t,r]),t=[],r=[]),i.type===Hy.CONTEXT?n.push([[i],[],[]]):i.type===Hy.INSERT&&0===t.length?n.push([[],[],[i]]):i.type===Hy.INSERT&&t.length>0?r.push(i):i.type===Hy.DELETE&&t.push(i)}return(t.length||r.length)&&(n.push([[],t,r]),t=[],r=[]),n}applyRematchMatching(e,n,t){const r=e.length*n.length,o=Math.max.apply(null,[0].concat(e.concat(n).map((e=>e.content.length))));return r<this.config.matchingMaxComparisons&&o<this.config.maxLineSizeInBlockForComparison&&("lines"===this.config.matching||"words"===this.config.matching)?t(e,n):[[e,n]]}processChangedLines(e,n,t,r){const o={right:"",left:""},i=Math.max(t.length,r.length);for(let a=0;a<i;a++){const i=t[a],l=r[a],s=void 0!==i&&void 0!==l?IC(i.content,l.content,n,this.config):void 0,u=void 0!==i&&void 0!==i.oldNumber?Object.assign(Object.assign({},void 0!==s?{prefix:s.oldLine.prefix,content:s.oldLine.content,type:mC.DELETE_CHANGES}:Object.assign(Object.assign({},kC(i.content,n)),{type:wC(i.type)})),{oldNumber:i.oldNumber,newNumber:i.newNumber}):void 0,c=void 0!==l&&void 0!==l.newNumber?Object.assign(Object.assign({},void 0!==s?{prefix:s.newLine.prefix,content:s.newLine.content,type:mC.INSERT_CHANGES}:Object.assign(Object.assign({},kC(l.content,n)),{type:wC(l.type)})),{oldNumber:l.oldNumber,newNumber:l.newNumber}):void 0,{left:d,right:f}=this.generateLineHtml(e,u,c);o.left+=d,o.right+=f}return o}generateLineHtml(e,n,t){return{left:this.generateSingleLineHtml(e,n),right:this.generateSingleLineHtml(e,t)}}generateSingleLineHtml(e,n){if(void 0===n)return"";const t=this.hoganUtils.render(MC,"numbers",{oldNumber:n.oldNumber||"",newNumber:n.newNumber||""});return this.hoganUtils.render(LC,"line",{type:n.type,lineClass:"d2h-code-linenumber",contentClass:"d2h-code-line",prefix:" "===n.prefix?"&nbsp;":n.prefix,content:n.content,lineNumber:t,line:n,file:e})}}const RC=Object.assign(Object.assign({},gC),{renderNothingWhenEmpty:!1,matchingMaxComparisons:2500,maxLineSizeInBlockFor
1Comparison:200}),FC="generic";class zC{constructor(e,n={}){this.hoganUtils=e,this.config=Object.assign(Object.assign({},RC),n)}render(e){const n=e.map((e=>{let n;return n=e.blocks.length?this.generateFileHtml(e):this.generateEmptyDiff(),this.makeFileDiffHtml(e,n)})).join("\n");return this.hoganUtils.render(FC,"wrapper",{colorScheme:NC(this.config.colorScheme),content:n})}makeFileDiffHtml(e,n){if(this.config.renderNothingWhenEmpty&&Array.isArray(e.blocks)&&0===e.blocks.length)return"";const t=this.hoganUtils.template("side-by-side","file-diff"),r=this.hoganUtils.template(FC,"file-path"),o=this.hoganUtils.template("icon","file"),i=this.hoganUtils.template("tag",EC(e));return t.render({file:e,fileHtmlId:ZC(e),diffs:n,filePath:r.render({fileDiffName:_C(e)},{fileIcon:o,fileTag:i})})}generateEmptyDiff(){return{right:"",left:this.hoganUtils.render(FC,"empty-diff",{contentClass:"d2h-code-side-line",CSSLineClass:mC})}}generateFileHtml(e){const n=vC(hC((n=>kC(n.content,e.isCombined).content)));return e.blocks.map((t=>{const r={left:this.makeHeaderHtml(t.header,e),right:this.makeHeaderHtml("")};return this.applyLineGroupping(t).forEach((([t,o,i])=>{if(o.length&&i.length&&!t.length)this.applyRematchMatching(o,i,n).map((([n,t])=>{const{left:o,right:i}=this.processChangedLines(e.isCombined,n,t);r.left+=o,r.right+=i}));else if(t.length)t.forEach((n=>{const{prefix:t,content:o}=kC(n.content,e.isCombined),{left:i,right:a}=this.generateLineHtml({type:mC.CONTEXT,prefix:t,content:o,number:n.oldNumber},{type:mC.CONTEXT,prefix:t,content:o,number:n.newNumber});r.left+=i,r.right+=a}));else if(o.length||i.length){const{left:n,right:t}=this.processChangedLines(e.isCombined,o,i);r.left+=n,r.right+=t}else console.error("Unknown state reached while processing groups of lines",t,o,i)})),r})).reduce(((e,n)=>({left:e.left+n.left,right:e.right+n.right})),{left:"",right:""})}applyLineGroupping(e){const n=[];let t=[],r=[];for(let o=0;o<e.lines.length;o++){const i=e.lines[o];(i.type!==Hy.INSERT&&r.length||i.type===Hy.CONTEXT&&t.length>0)&&(n.push([[],t,r]),t=[],r=[]),i.type===Hy.CONTEXT?n.push([[i],[],[]]):i.type===Hy.INSERT&&0===t.length?n.push([[],[],[i]]):i.type===Hy.INSERT&&t.length>0?r.push(i):i.type===Hy.DELETE&&t.push(i)}return(t.length||r.length)&&(n.push([[],t,r]),t=[],r=[]),n}applyRematchMatching(e,n,t){const r=e.length*n.length,o=Math.max.apply(null,[0].concat(e.concat(n).map((e=>e.content.length))));return r<this.config.matchingMaxComparisons&&o<this.config.maxLineSizeInBlockForComparison&&("lines"===this.config.matching||"words"===this.config.matching)?t(e,n):[[e,n]]}makeHeaderHtml(e,n){return this.hoganUtils.render(FC,"block-header",{CSSLineClass:mC,blockHeader:(null===n||void 0===n?void 0:n.isTooBig)?e:SC(e),lineClass:"d2h-code-side-linenumber",contentClass:"d2h-code-side-line"})}processChangedLines(e,n,t){const r={right:"",left:""},o=Math.max(n.length,t.length);for(let i=0;i<o;i++){const o=n[i],a=t[i],l=void 0!==o&&void 0!==a?IC(o.content,a.content,e,this.config):void 0,s=void 0!==o&&void 0!==o.oldNumber?Object.assign(Object.assign({},void 0!==l?{prefix:l.oldLine.prefix,content:l.oldLine.content,type:mC.DELETE_CHANGES}:Object.assign(Object.assign({},kC(o.content,e)),{type:wC(o.type)})),{number:o.oldNumber}):void 0,u=void 0!==a&&void 0!==a.newNumber?Object.assign(Object.assign({},void 0!==l?{prefix:l.newLine.prefix,content:l.newLine.content,type:mC.INSERT_CHANGES}:Object.assign(Object.assign({},kC(a.content,e)),{type:wC(a.type)})),{number:a.newNumber}):void 0,{left:c,right:d}=this.generateLineHtml(s,u);r.left+=c,r.right+=d}return r}generateLineHtml(e,n){return{left:this.generateSingleHtml(e),right:this.generateSingleHtml(n)}}generateSingleHtml(e){const n="d2h-code-side-linenumber",t="d2h-code-side-line";return this.hoganUtils.render(FC,"line",{type:(null===e||void 0===e?void 0:e.type)||`${mC.CONTEXT} d2h-emptyplaceholder`,lineClass:void 0!==e?n:`${n} d2h-code-side-emptyplaceholder`,contentClass:void 0!==e?t:`${t} d2h-code-side-emptyplaceholder`,prefix:" "===(null===e||void 0===e?void 0:e.prefix)?"&nbsp;":null===e||void 0===e?void 0:e.prefix,content:null===e||void 0===e?void 0:e.content,lineNumber:null===e||void 0===e?void 0:e.number})}}var BC=t(50112);const HC={};HC["file-summary-line"]=new BC.Template({code:function(e,n,t){var r=this;return r.b(t=t||""),r.b('<li class="d2h-file-list-line">
1'),r.b("\n"+t),r.b('    <span class="d2h-file-name-wrapper">'),r.b("\n"+t),r.b(r.rp("<fileIcon0",e,n,"      ")),r.b('      <a href="#'),r.b(r.v(r.f("fileHtmlId",e,n,0))),r.b('" class="d2h-file-name">'),r.b(r.v(r.f("fileName",e,n,0))),r.b("</a>"),r.b("\n"+t),r.b('      <span class="d2h-file-stats">'),r.b("\n"+t),r.b('          <span class="d2h-lines-added">'),r.b(r.v(r.f("addedLines",e,n,0))),r.b("</span>"),r.b("\n"+t),r.b('          <span class="d2h-lines-deleted">'),r.b(r.v(r.f("deletedLines",e,n,0))),r.b("</span>"),r.b("\n"+t),r.b("      </span>"),r.b("\n"+t),r.b("    </span>"),r.b("\n"+t),r.b("</li>"),r.fl()},partials:{"<fileIcon0":{name:"fileIcon",partials:{},subs:{}}},subs:{}}),HC["file-summary-wrapper"]=new BC.Template({code:function(e,n,t){var r=this;return r.b(t=t||""),r.b('<div class="d2h-file-list-wrapper '),r.b(r.v(r.f("colorScheme",e,n,0))),r.b('">'),r.b("\n"+t),r.b('    <div class="d2h-file-list-header">'),r.b("\n"+t),r.b('        <span class="d2h-file-list-title">Files changed ('),r.b(r.v(r.f("filesNumber",e,n,0))),r.b(")</span>"),r.b("\n"+t),r.b('        <a class="d2h-file-switch d2h-hide">hide</a>'),r.b("\n"+t),r.b('        <a class="d2h-file-switch d2h-show">show</a>'),r.b("\n"+t),r.b("    </div>"),r.b("\n"+t),r.b('    <ol class="d2h-file-list">'),r.b("\n"+t),r.b("    "),r.b(r.t(r.f("files",e,n,0))),r.b("\n"+t),r.b("    </ol>"),r.b("\n"+t),r.b("</div>"),r.fl()},partials:{},subs:{}}),HC["generic-block-header"]=new BC.Template({code:function(e,n,t){var r=this;return r.b(t=t||""),r.b("<tr>"),r.b("\n"+t),r.b('    <td class="'),r.b(r.v(r.f("lineClass",e,n,0))),r.b(" "),r.b(r.v(r.d("CSSLineClass.INFO",e,n,0))),r.b('"></td>'),r.b("\n"+t),r.b('    <td class="'),r.b(r.v(r.d("CSSLineClass.INFO",e,n,0))),r.b('">'),r.b("\n"+t),r.b('        <div class="'),r.b(r.v(r.f("contentClass",e,n,0))),r.b('">'),r.s(r.f("blockHeader",e,n,1),e,n,0,156,173,"{{ }}")&&(r.rs(e,n,(function(e,n,t){t.b(t.t(t.f("blockHeader",e,n,0)))})),e.pop()),r.s(r.f("blockHeader",e,n,1),e,n,1,0,0,"")||r.b("&nbsp;"),r.b("</div>"),r.b("\n"+t),r.b("    </td>"),r.b("\n"+t),r.b("</tr>"),r.fl()},partials:{},subs:{}}),HC["generic-empty-diff"]=new BC.Template({code:function(e,n,t){var r=this;return r.b(t=t||""),r.b("<tr>"),r.b("\n"+t),r.b('    <td class="'),r.b(r.v(r.d("CSSLineClass.INFO",e,n,0))),r.b('">'),r.b("\n"+t),r.b('        <div class="'),r.b(r.v(r.f("contentClass",e,n,0))),r.b('">'),r.b("\n"+t),r.b("            File without changes"),r.b("\n"+t),r.b("        </div>"),r.b("\n"+t),r.b("    </td>"),r.b("\n"+t),r.b("</tr>"),r.fl()},partials:{},subs:{}}),HC["generic-file-path"]=new BC.Template({code:function(e,n,t){var r=this;return r.b(t=t||""),r.b('<span class="d2h-file-name-wrapper">'),r.b("\n"+t),r.b(r.rp("<fileIcon0",e,n,"    ")),r.b('    <span class="d2h-file-name">'),r.b(r.v(r.f("fileDiffName",e,n,0))),r.b("</span>"),r.b("\n"+t),r.b(r.rp("<fileTag1",e,n,"    ")),r.b("</span>"),r.b("\n"+t),r.b('<label class="d2h-file-collapse">'),r.b("\n"+t),r.b('    <input class="d2h-file-collapse-input" type="checkbox" name="viewed" value="viewed">'),r.b("\n"+t),r.b("    Viewed"),r.b("\n"+t),r.b("</label>"),r.fl()},partials:{"<fileIcon0":{name:"fileIcon",partials:{},subs:{}},"<fileTag1":{name:"fileTag",partials:{},subs:{}}},subs:{}}),HC["generic-line"]=new BC.Template({code:function(e,n,t){var r=this;return r.b(t=t||""),r.b("<tr>"),r.b("\n"+t),r.b('    <td class="'),r.b(r.v(r.f("lineClass",e,n,0))),r.b(" "),r.b(r.v(r.f("type",e,n,0))),r.b('">'),r.b("\n"+t),r.b("      "),r.b(r.t(r.f("lineNumber",e,n,0))),r.b("\n"+t),r.b("    </td>"),r.b("\n"+t),r.b('    <td class="'),r.b(r.v(r.f("type",e,n,0))),r.b('">'),r.b("\n"+t),r.b('        <div class="'),r.b(r.v(r.f("contentClass",e,n,0))),r.b('">'),r.b("\n"+t),r.s(r.f("prefix",e,n,1),e,n,0,162,238,"{{ }}")&&(r.rs(e,n,(function(e,n,r){r.b('            <span class="d2h-code-line-prefix">'),r.b(r.t(r.f("prefix",e,n,0))),r.b("</span>"),r.b("\n"+t)})),e.pop()),r.s(r.f("prefix",e,n,1),e,n,1,0,0,"")||(r.b('            <span class="d2h-code-line-prefix">&nbsp;</span>'),r.b("\n"+t)),r.s(r.f("content",e,n,1),e,n,0,371,445,"{{ }}
1")&&(r.rs(e,n,(function(e,n,r){r.b('            <span class="d2h-code-line-ctn">'),r.b(r.t(r.f("content",e,n,0))),r.b("</span>"),r.b("\n"+t)})),e.pop()),r.s(r.f("content",e,n,1),e,n,1,0,0,"")||(r.b('            <span class="d2h-code-line-ctn"><br></span>'),r.b("\n"+t)),r.b("        </div>"),r.b("\n"+t),r.b("    </td>"),r.b("\n"+t),r.b("</tr>"),r.fl()},partials:{},subs:{}}),HC["generic-wrapper"]=new BC.Template({code:function(e,n,t){var r=this;return r.b(t=t||""),r.b('<div class="d2h-wrapper '),r.b(r.v(r.f("colorScheme",e,n,0))),r.b('">'),r.b("\n"+t),r.b("    "),r.b(r.t(r.f("content",e,n,0))),r.b("\n"+t),r.b("</div>"),r.fl()},partials:{},subs:{}}),HC["icon-file-added"]=new BC.Template({code:function(e,n,t){var r=this;return r.b(t=t||""),r.b('<svg aria-hidden="true" class="d2h-icon d2h-added" height="16" title="added" version="1.1" viewBox="0 0 14 16"'),r.b("\n"+t),r.b('     width="14">'),r.b("\n"+t),r.b('    <path d="M13 1H1C0.45 1 0 1.45 0 2v12c0 0.55 0.45 1 1 1h12c0.55 0 1-0.45 1-1V2c0-0.55-0.45-1-1-1z m0 13H1V2h12v12zM6 9H3V7h3V4h2v3h3v2H8v3H6V9z"></path>'),r.b("\n"+t),r.b("</svg>"),r.fl()},partials:{},subs:{}}),HC["icon-file-changed"]=new BC.Template({code:function(e,n,t){var r=this;return r.b(t=t||""),r.b('<svg aria-hidden="true" class="d2h-icon d2h-changed" height="16" title="modified" version="1.1"'),r.b("\n"+t),r.b('     viewBox="0 0 14 16" width="14">'),r.b("\n"+t),r.b('    <path d="M13 1H1C0.45 1 0 1.45 0 2v12c0 0.55 0.45 1 1 1h12c0.55 0 1-0.45 1-1V2c0-0.55-0.45-1-1-1z m0 13H1V2h12v12zM4 8c0-1.66 1.34-3 3-3s3 1.34 3 3-1.34 3-3 3-3-1.34-3-3z"></path>'),r.b("\n"+t),r.b("</svg>"),r.fl()},partials:{},subs:{}}),HC["icon-file-deleted"]=new BC.Template({code:function(e,n,t){var r=this;return r.b(t=t||""),r.b('<svg aria-hidden="true" class="d2h-icon d2h-deleted" height="16" title="removed" version="1.1"'),r.b("\n"+t),r.b('     viewBox="0 0 14 16" width="14">'),r.b("\n"+t),r.b('    <path d="M13 1H1C0.45 1 0 1.45 0 2v12c0 0.55 0.45 1 1 1h12c0.55 0 1-0.45 1-1V2c0-0.55-0.45-1-1-1z m0 13H1V2h12v12zM11 9H3V7h8v2z"></path>'),r.b("\n"+t),r.b("</svg>"),r.fl()},partials:{},subs:{}}),HC["icon-file-renamed"]=new BC.Template({code:function(e,n,t){var r=this;return r.b(t=t||""),r.b('<svg aria-hidden="true" class="d2h-icon d2h-moved" height="16" title="renamed" version="1.1"'),r.b("\n"+t),r.b('     viewBox="0 0 14 16" width="14">'),r.b("\n"+t),r.b('    <path d="M6 9H3V7h3V4l5 4-5 4V9z m8-7v12c0 0.55-0.45 1-1 1H1c-0.55 0-1-0.45-1-1V2c0-0.55 0.45-1 1-1h12c0.55 0 1 0.45 1 1z m-1 0H1v12h12V2z"></path>'),r.b("\n"+t),r.b("</svg>"),r.fl()},partials:{},subs:{}}),HC["icon-file"]=new BC.Template({code:function(e,n,t){var r=this;return r.b(t=t||""),r.b('<svg aria-hidden="true" class="d2h-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12">'),r.b("\n"+t),r.b('    <path d="M6 5H2v-1h4v1zM2 8h7v-1H2v1z m0 2h7v-1H2v1z m0 2h7v-1H2v1z m10-7.5v9.5c0 0.55-0.45 1-1 1H1c-0.55 0-1-0.45-1-1V2c0-0.55 0.45-1 1-1h7.5l3.5 3.5z m-1 0.5L8 2H1v12h10V5z"></path>'),r.b("\n"+t),r.b("</svg>"),r.fl()},partials:{},subs:{}}),HC["line-by-line-file-diff"]=new BC.Template({code:function(e,n,t){var r=this;return r.b(t=t||""),r.b('<div id="'),r.b(r.v(r.f("fileHtmlId",e,n,0))),r.b('" class="d2h-file-wrapper" data-lang="'),r.b(r.v(r.d("file.language",e,n,0))),r.b('">'),r.b("\n"+t),r.b('    <div class="d2h-file-header">'),r.b("\n"+t),r.b("    "),r.b(r.t(r.f("filePath",e,n,0))),r.b("\n"+t),r.b("    </div>"),r.b("\n"+t),r.b('    <div class="d2h-file-diff">'),r.b("\n"+t),r.b('        <div class="d2h-code-wrapper">'),r.b("\n"+t),r.b('            <table class="d2h-diff-table">'),r.b("\n"+t),r.b('                <tbody class="d2h-diff-tbody">'),r.b("\n"+t),r.b("                "),r.b(r.t(r.f("diffs",e,n,0))),r.b("\n"+t),r.b("                </tbody>"),r.b("\n"+t),r.b("            </table>"),r.b("\n"+t),r.b("        </div>"),r.b("\n"+t),r.b("    </div>"),r.b("\n"+t),r.b("</div>"),r.fl()},partials:{},subs:{}}),HC["line-by-line-numbers"]=new BC.Template({code:function(e,n,t){var r=this;return r.b(t=t||""),r.b('<div class="line-num1">'),r.b(r.v(r.f("oldNumber",e,n,0))),r.b("</div>"),r.b("\n"+t),r.b('<div class="line-num2">'),r.b(r.v(r.f("newNumber",e,n,0))),r.b("</div>"),r.fl()},partials:{},subs:{}}),HC["side-by-side-file-diff"]=new BC.Template({code:function(e,n,t){var r=this;return r.b(t=t||""),r.b('<div id="'),r.b(r.v(r.f("fileHtmlId",e,n,0))),r.b('" class="d2h-file-wrapper" data-lang="'),r.b(r.v(r.d("file.language",e,n,0))),r.b('">'),r.b("\n"+t),r.b('    <div class="d2h-file-header">'),r.b("\n"+t),r.b("      "),r.b(r.t(r.f("filePath",e,n,0))),r.b("\n"+t),r.b("    </div>"),r.b("\n"+t),r.b('    <div class="d2h-files-diff">'),r.b("\n"+t),r.b('        <div class="d2h-file-side-diff">'),r.b("\n"+t),r.b('            <div class="d2h-code-wrapper">'),r.b("\n"+t),r.b('                <table class="d2h-diff-table">'),r.b("\n"+t),r.b('                    <tbody class="d2h-diff-tbody">'),r.b("\n"+t),r.b("                    "),r.b(r.t(r.d("diffs.left",e,n,0))),r.b("\n"+t),r.b("                    </tbody>"),r.b("\n"+t),r.b("                </table>"),r.b("\n"+t),r.b("            </div>"),r.b("\n"+t),r.b("        </div>"),r.b("\n"+t),r.b('        <div class="d2h-file-side-diff">'),r.b("\n"+t),r.b('            <div class="d2h-code-wrapper">'),r.b("\n"+t),r.b('                <table class="d2h-diff-table">'),r.b("\n"+t),r.b('                    <tbody class="d2h-diff-tbody">'),r.b("\n"+t),r.b("                    "),r.b(r.t(r.d("diffs.right",e,n,0))),r.b("\n"+t),r.b("                    </tbody>"),r.b("\n"+t),r.b("                </table>"),r.b("\n"+t),r.b("            </div>"),r.b("\n"+t),r.b("        </div>"),r.b("\n"+t),r.b("    </div>"),r.b("\n"+t),r.b("</div>"),r.fl()},partials:{},subs:{}}),HC["tag-file-added"]=new BC.Template({code:function(e,n,t){var r=this;return r.b(t=t||""),r.b('<span class="d2h-tag d2h-added d2h-added-tag">ADDED</span>'),r.fl()},partials:{},subs:{}}),HC["tag-file-changed"]=new BC.Template({code:function(e,n,t){var r=this;return r.b(t=t||""),r.b('<span class="d2h-tag d2h-changed d2h-changed-tag">CHANGED</span>'),r.fl()},partials:{},subs:{}}),HC["tag-file-deleted"]=new BC.Template({code:function(e,n,t){var r=this;return r.b(t=t||""),r.b('<span class="d2h-tag d2h-deleted d2h-deleted-tag">DELETED</span>'),r.fl()},partials:{},subs:{}}),HC["tag-file-renamed"]=new BC.Template({code:function(e,n,t){var r=this;return r.b(t=t||""),r.b('<span class="d2h-tag d2h-moved d2h-moved-tag">RENAMED</span>'),r.fl()},partials:{},subs:{}});class VC{constructor({compiledTemplates:e={},rawTemplates:n={}}){const t=Object.entries(n).reduce(((e,[n,t])=>{const r=BC.compile(t,{asString:!1});return Object.assign(Object.assign({},e),{[n]:r})}),{});this.preCompiledTemplates=Object.assign(Object.assign(Object.assign({},HC),e),t)}static compile(e){return BC.compile(e,{asString:!1})}render(e,n,t,r,o){const i=this.templateKey(e,n);try{return this.preCompiledTemplates[i].render(t,r,o)}catch(a){throw new Error(`Could not find template to render '${i}'`)}}template(e,n){return this.preCompiledTemplates[this.templateKey(e,n)]}templateKey(e,n){return`${e}-${n}`}}const $C=Object.assign(Object.assign(Object.assign({},DC),RC),{outputFormat:"line-by-line",drawFileList:!0});t(32117);var UC,WC=t(43556),qC=function(e){var n=e.loading,r=e.children,o=e.className;return(0,l.useEffect)((function(){function e(){return(e=(0,h.Z)((function(){return(0,x.__generator)(this,(function(e){switch(e.label){case 0:return[4,t.e(4551).then(t.bind(t,64551))];case 1:return e.sent().lineSpinner.register(),[2]}}))}))).apply(this,arguments)}!function(){e.apply(this,arguments)}()}),[]),n?(0,i.jsx)("div",{className:o,children:(0,i.jsx)("l-line-spinner",{speed:"1.5",size:"48",stroke:"4",color:"#B8B8B8"})}):(0,i.jsx)(i.Fragment,{children:r})},KC=function(e){var n,t,r=e.templateId,o=e.baseVersion,a=e.compareVersion,l=(0,ic.F)().resolvedTheme,s=$y({templateId:r,baseVersion:o,compareVersion:a}),u=s.data,c=s.isLoading,d=s.isFetching,f=null!==(t=null===u||void 0===u||null===(n=u.automationsV2)||void 0===n?void 0:n.templateVersionDiff)&&void 0!==t?t:"",p=function(e,n={}){const t=Object.assign(Object.assign({},$C),n),r="string"===typeof e?Yy(e,t):e,o=new VC(t),{colorScheme:i}=t,a={colorScheme:i};return(t.drawFileList?new AC(o,a).render(r):"")+("side-by-side"===t.outputFormat?new zC(o,t).render(r):new PC(o,t).render(r))}(f,{colorScheme:"dark"===l?WC.ux.DARK:WC.ux.LIGHT,matching:WC.YO.LINES,outputFormat:WC.Mi.SIDE_BY_SIDE,renderNothingWhenEmpty:!0});return(0,i.jsx)("div",{className:"flex h-full w-full flex-col items-center justify-center overflow-auto border-0 border-t border-solid border-structure-default",children:(0,i.jsxs)(qC,{loading:c||d,children:[f&&(0,i.jsx)("div",{className:"h-full w-full",dangerouslySetInnerHTML:{__html:p}}),!f&&(0,i.jsx)(cf.default,{variant:"regular-md",className:"flex h-full w-full flex-col items-center justify-center",children:"Positional changes not shown."})]})})},GC=function(e){var n=e.children,t=e.title;return(0,i.jsxs)("div",{className:"flex w-full items-center justify-between pb-3 pt-[10px]",children:[t&&(0,i.jsx)(JC,{children:t}),n]})},JC=function(e){var n=e.children;return(0,i.jsx)(cf.default,{variant:"semibold-md",className:"text-header",children:n})},XC=function(e){var n=e.children;return(0,i.jsx)("div",{className:"flex h-full w-full flex-col items-center justify-center bg-diff-background px-6 pb-4",children:n})},YC=function(e){var n=e.templateId,t=e.isOpen,r=e.onClose,o=e.onRevertToDraft,a=e.baseVersion,l=e.compareVersion,s=e.publishTime,u=e.email;return(0,i.jsx)(Py.Z,{variant:"full-screen",isOpen:t,onClose:r,children:(0,i.jsxs)(XC,{children:[(0,i.jsxs)(GC,{children:[(0,i.jsxs)(cf.default,{variant:"medium-sm",className:"flex flex-col items-start text-header",children:["Published ",s,u&&(0,i.jsx)("span",{className:"text-subtext",children:u})]}),(0,i.jsxs)("div",{className:"flex gap-2",children:[(0,i.jsx)(ki.default,{variant:"default",onClick:function(){o(),r()},children:"Revert to draft"}),(0,i.jsx)(ki.default,{variant:"default",onClick:r,children:"Close"})]})]}),(0,i.jsx)(KC,{templateId:n,baseVersion:a,compareVersion:l})]})})},QC=function(e){var n,t=e.template,r=e.onTemplateChange,o=e.setNodes,a=e.isPublished,s=null===(n=(0,Ty.Z)({templateId:t.id}).data)||void 0===n?void 0:n.automationsV2.templateVersions,u=(0,l.useState)(!1),c=u[0],d=u[1],f=(0,l.useState)(null),p=f[0],h=f[1],v=(0,l.useState)(null),m=v[0],g=v[1],x=(0,Ay.S)().users,b=null!==x&&void 0!==x?x:[],y=p?a?"Load ".concat(Ly(p.published)," as a new draft?"):"Your current draft changes will be lost.  Discard current draft and load ".concat(Ly(p.published)," as a new draft?"):null;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(qx,{name:"Version history",description:"History of published versions",onClick:function(e){e.stopPropagation()},children:null===s||void 0===s?void 0:s.map((function(e,n){var r;return(0,i.jsx)(ej,{isCurrent:e.published===t.published,templateVersion:e,previousTemplateVersion:n<s.length-1?s[n+1]:null,
1setTemplateVersion:h,setShowConfirmation:d,setSelectedTemplateNodes:g,email:null===(r=b.find((function(n){return n.id===e.published_by})))||void 0===r?void 0:r.email},e.version)}))}),(0,i.jsx)(L.Z,{variant:"confirm",subtext:y,isOpen:c,onClose:function(){return d(!1)},onConfirm:function(){r(p,!0),o(m),d(!1),h(null)}})]})},ej=function(e){var n,t=e.templateVersion,r=e.previousTemplateVersion,o=e.email,a=e.setTemplateVersion,s=e.setShowConfirmation,u=e.isCurrent,c=e.setSelectedTemplateNodes,d=(0,My.w$)({templateId:t.id,version:t.version}),f=d.nodes,p=d.loading,h=d.error,v=(0,l.useState)(!1),m=v[0],g=v[1],x=function(){p||h||(c(f),a(t),s(!0))};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)("div",{className:"group flex justify-between border-0 border-b border-solid border-structure-border p-4",children:[(0,i.jsxs)("div",{className:"flex flex-col gap-xs",children:[(0,i.jsxs)(cf.default,{variant:"regular-sm",className:(0,Jd.cx)(u?"text-content":"text-subtext","flex w-full gap-[18px]"),children:[Ly(t.published),u&&(0,i.jsx)("span",{className:"text-status-green",children:"Current"})]}),o&&(0,i.jsx)(cf.default,{variant:"regular-sm",className:"text-subtext",children:o})]}),!p&&!h&&(0,i.jsxs)("div",{className:"invisible ml-auto flex justify-center group-hover:visible",children:[(0,i.jsx)(D.Tooltip,{content:"Revert to draft",delay:[0,0],children:(0,i.jsx)(ki.default,{variant:"icon",className:"border-none",Icon:J.xhZ,onClick:x})}),(0,i.jsx)(D.Tooltip,{content:"View diff",delay:[0,0],children:(0,i.jsx)(ki.default,{variant:"icon",className:"border-none",Icon:J.MZy,onClick:function(){return g(!0)}})})]})]}),(0,i.jsx)(YC,{publishTime:Ly(t.published),email:o,templateId:t.id,isOpen:m,onClose:function(){return g(!1)},onRevertToDraft:x,baseVersion:null!==(n=null===r||void 0===r?void 0:r.version)&&void 0!==n?n:"no previous version",compareVersion:t.version})]})},nj=function(e){var n=e.onNodeChange,t=e.onNodeSet,r=e.onTemplateChange,o=e.setNodes,a=e.template,s=e.isPublished,u=df(),c=(0,l.useState)(u),d=c[0],f=c[1];(0,l.useEffect)((function(){f(u)}),[u]);return(0,i.jsx)("div",{className:"z-10 mb-6 mr-6 mt-6 w-[320px] flex-none rounded-lg border border-solid border-structure-border bg-background-panels shadow-automations-config",children:(0,i.jsx)(tj,{node:d,onNodeChange:function(e){return n((0,g.Z)((0,m.Z)({id:d.id},e),{properties:(0,g.Z)((0,m.Z)({},e.properties),{edited:!0})}))},onNodeSet:function(e){return t((0,g.Z)((0,m.Z)({},e),{properties:(0,g.Z)((0,m.Z)({},e.properties),{edited:!0})}))},onTemplateChange:r,setNodes:o,template:a,isPublished:s})})},tj=function(e){var n=e.node,t=e.onNodeChange,r=e.onNodeSet,o=e.onTemplateChange,a=e.setNodes,l=e.template,s=e.isPublished;if((0,Pa.Dv)(ef))return(0,i.jsx)(QC,{template:l,onTemplateChange:o,isPublished:s,setNodes:a});if(!n)return(0,i.jsx)(Iy,{});var u=n.type;return"trigger"===u?(0,i.jsx)(ky,{node:n,onChange:t,onSet:r}):"batch"===u?(0,i.jsx)(Xx,{node:n,onChange:t,onSet:r}):"switch"===u?(0,i.jsx)(lb,{node:n,onChange:t,onSet:r}):"delay"===u?(0,i.jsx)(xb,{node:n,onChange:t,onSet:r}):"cancel"===u?(0,i.jsx)(yb,{node:n,onChange:t,onSet:r}):"add-to-digest"===u?(0,i.jsx)(jb,{node:n,onChange:t,onSet:r}):"invoke"===u?(0,i.jsx)(Sb,{node:n,onChange:t,onSet:r}):"update-profile"===u?(0,i.jsx)(Ib,{node:n,onChange:t,onSet:r}):"get-profile"===u?(0,i.jsx)(Zy,{node:n,onChange:t,onSet:r}):"subscribe-to-list"===u?(0,i.jsx)(Tb,{node:n,onChange:t,onSet:r}):"send-to-list"===u?(0,i.jsx)(Db,{node:n,onChange:t,onSet:r}):"throttle"===u?(0,i.jsx)(zb,{node:n,onChange:t,onSet:r}):"if"===u?(0,i.jsx)(ib,{node:n,onChange:t,onSet:r}):"send"===u?(0,i.jsx)(Hb,{node:n,onChange:t,onSet:r}):"fetch"===u?(0,i.jsx)(Kb,{node:n,onChange:t,onSet:r}):null},rj=t(83095),oj=function(){return(0,i.jsx)("span",{className:"block h-[22px] w-[1px] bg-structure-divider"})},ij=t(37399),aj=function(e){var n=e.children,t=e.onClick;return(0,i.jsx)(ij.sN,{align:"start",onClick:t,children:(0,i.jsx)(cf.default,{variant:"medium-sm",className:"text-subtext group-hover/menu-item:text-white",children:n})})},lj=function(e){var n=e.onAddNode,t=e.templateId,r=(0,z.ye)("automations-get-profile"),o=function(e){var r=window.innerWidth/2,o=window.innerHeight/2;n((0,Px.w)({type:e,position:{x:r,y:o},templateId:t,templateVersion:"2024-05-09"}))};return(0,i.jsxs)(ij.v2,{children:[(0,i.jsx)(ij.bF,{asChild:!0,children:(0,i.jsx)("div",{className:"flex justify-center",children:(0,i.jsx)(ki.default,{variant:"default",Icon:J.mm_,className:"truncate",children:"Add node"})})}),(0,i.jsxs)(ij.Dv,{align:"start",className:"w-[208px]",children:[(0,i.jsx)(aj,{onClick:function(){return o("add-to-digest")},children:"Add to Digest"}),(0,i.jsx)(aj,{onClick:function(){return o("batch")},children:"Add to Batch"}),(0,i.jsx)(aj,{onClick:function(){return o("throttle")},children:"Throttle"}),(0,i.jsx)(aj,{onClick:function(){return o("cancel")},children:"Cancel Automation"}),(0,i.jsx)(aj,{onClick:function(){return o("delay")},children:"Delay"}),(0,i.jsx)(aj,{onClick:function(){return o("fetch")},children:"Fetch Data"}),(0,i.jsx)(aj,{onClick:function(){return o("invoke")},children:"Invoke Automation"}),(0,i.jsx)(aj,{onClick:function(){return o("send")},children:"Send"}),(0,i.jsx)(aj,{onClick:function(){return o("send-to-list")},children:"Send to List"}),(0,i.jsx)(aj,{onClick:function(){return o("subscribe-to-list")},children:"Subscribe to List"}),(0,i.jsx)(aj,{onClick:function(){return o("update-profile")},children:"Update Profile"}),r&&(0,i.jsx)(aj,{onClick:function(){return o("get-profile")},children:"GET Profile"}),(0,i.jsx)(aj,{onClick:function(){return o("if")},children:"If"}),(0,i.jsx)(aj,{onClick:function(){return o("switch")},children:"Switch"})]})]})},sj=function(e){var n=e.onAddNode,t=e.onAutoArrange,r=e.templateId,o=e.debugMode,a=(0,Ma._K)();return(0,i.jsxs)("div",{className:"flex h-full flex-grow items-center justify-end gap-md",children:[!
1o&&(0,i.jsxs)("div",{className:"flex items-center justify-end gap-md",children:[(0,i.jsx)(lj,{onAddNode:n,templateId:r}),(0,i.jsx)(ki.default,{className:"truncate",variant:"default",Icon:J.If,onClick:function(){return t().then((function(){return a.fitView()}))},children:"Auto arrange nodes"})]}),(0,i.jsx)(oj,{}),(0,i.jsxs)("div",{className:"flex items-center",children:[(0,i.jsx)(D.Tooltip,{content:"Fit zoom",delay:[0,0],children:(0,i.jsx)(ki.default,{variant:"icon",className:"border-none",Icon:J.Ixn,onClick:function(){return a.fitView()}})}),(0,i.jsx)(D.Tooltip,{content:"Actual size (100%)",delay:[0,0],children:(0,i.jsx)(ki.default,{variant:"icon",className:"border-none",Icon:J.LZv,onClick:function(){return a.zoomTo(1,{duration:200})}})}),(0,i.jsx)(uj,{})]})]})},uj=function(){var e=(0,Ma._K)(),n=(0,Ma.Sj)().zoom,t=Math.ceil(10*n)/10,r=Math.floor(10*n)/10;return Math.abs(t-n)<.01&&(t+=.1),Math.abs(r-n)<.01&&(r-=.1),(0,i.jsxs)("div",{className:"flex items-center",children:[(0,i.jsx)(D.Tooltip,{content:"Zoom out",delay:[0,0],children:(0,i.jsx)(ki.default,{variant:"icon",className:"border-none",Icon:J.LBz,onClick:function(){return e.zoomTo(r,{duration:200})}})}),(0,i.jsx)("div",{className:"flex flex-none items-center justify-center",children:(0,i.jsxs)(cf.default,{variant:"regular-sm",className:"flex w-[40px] justify-center text-subtext",children:[Math.round(100*n),"%"]})}),(0,i.jsx)(D.Tooltip,{content:"Zoom in",delay:[0,0],children:(0,i.jsx)(ki.default,{variant:"icon",className:"border-none",Icon:J.mm_,onClick:function(){return e.zoomTo(t,{duration:200})}})})]})},cj=t(34547),dj=function(e){var n=e.onConfigClick,t=e.onVersionHistoryClick;return(0,i.jsxs)(ij.v2,{children:[(0,i.jsx)(ij.bF,{asChild:!0,children:(0,i.jsx)(ki.default,{variant:"icon",className:"border-none",Icon:J.pEs})}),(0,i.jsxs)(ij.Dv,{align:"start",className:"w-[216px]",children:[(0,i.jsx)(aj,{onClick:n,children:"Automation configuration"}),(0,i.jsx)(aj,{onClick:t,children:"Version history"})]})]})},fj=function(e){var n=e.templateId,t=e.isOpen,r=e.onClose,o=e.onPublish;return(0,i.jsx)(Py.Z,{variant:"full-screen",isOpen:t,onClose:r,children:(0,i.jsxs)(XC,{children:[(0,i.jsx)(GC,{title:"Review and publish changes",children:(0,i.jsxs)("div",{className:"flex gap-2",children:[(0,i.jsx)(ki.default,{variant:"default",onClick:r,children:"Cancel"}),(0,i.jsx)(ki.default,{className:"w-[190px]",variant:"confirm",onClick:function(){o(),r()},children:"Confirm and Publish"})]})}),(0,i.jsx)(KC,{templateId:n,baseVersion:"v0",compareVersion:"draft"})]})})},pj=function(e){var n=e.name,t=e.updatedAt,r=e.tab,o=e.templateId,a=e.onAddNode,s=e.onAutoArrange,u=e.onTabChange,c=e.onNameChange,d=e.onPublishClick,f=e.published,p=e.hasErrors,h=void 0!==p&&p,v=(0,cj.D)(t),m=(0,Pa.b9)(ef),g=(0,l.useState)(!1),x=g[0],b=g[1],y=(0,z.ye)("automations-diff-modal"),C=(0,l.useMemo)((function(){return"design"===r||"run"===r?(0,i.jsx)(sj,{onAddNode:a,onAutoArrange:s,templateId:o,debugMode:"run"===r}):null}),[r,a,s,o]);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)("div",{className:"flex h-[65px] w-full flex-row items-center justify-between overflow-x-scroll border-0 border-b border-solid border-structure-border bg-background-panels pr-6",children:[(0,i.jsxs)("div",{className:"flex h-full flex-grow items-center space-x-5 px-6",children:[(0,i.jsx)(hj,{value:n,onChange:c}),(0,i.jsx)("div",{className:"flex items-center",children:(0,i.jsx)(oj,{})}),(0,i.jsx)(vj,{tab:r,onTabChange:u})]}),(0,i.jsxs)("div",{className:"flex h-full justify-end gap-lg",children:[C,(0,i.jsxs)("div",{className:"flex flex-none items-center justify-between gap-lg",children:[(0,i.jsx)(oj,{}),(0,i.jsxs)("div",{className:"flex flex-none items-center justify-end gap-lg",children:[v&&(0,i.jsx)(cf.default,{variant:"regular-sm",className:"flex items-center justify-end truncate text-subtext",children:v}),(0,i.jsx)(ki.default,{onClick:function(){y?b(!0):d()},variant:"confirm",disabled:f||"run"===r||h,title:h?"Please fix validation errors before publishing":void 0,children:f?"Published":"Publish"}),(0,i.jsx)(dj,{onConfigClick:function(){return u("settings")},onVersionHistoryClick:function(e){e.stopPropagation(),m(!0),u("design")}})]})]})]})]}),(0,i.jsx)(fj,{templateId:o,isOpen:x,onClose:function(){return b(!1)},onPublish:d})]})},hj=function(e){var n,t=e.value,r=e.onChange,o=(0,l.useRef)(null);return(0,i.jsxs)("div",{className:"w-fit py-6",children:[(0,i.jsx)("input",{className:"h-[38px] min-w-[1em] max-w-[23ch] overflow-hidden text-ellipsis border-none bg-transparent p-0 font-semi-bold-sm text-semi-bold-sm",style:{width:(null===o||void 0===o||null===(n=o.current)||void 0===n?void 0:n.offsetWidth)+5},value:t,onChange:function(e){return r(e.target.value)}}),(0,i.jsx)("span",{className:"block h-0 w-fit min-w-[1em] max-w-[23ch] overflow-hidden text-ellipsis whitespace-pre border-none bg-transparent p-0 font-semi-bold-sm text-semi-bold-sm",ref:o,children:t})]})},vj=function(e){var n=e.tab,t=e.onTabChange,r=(0,Ma.oR)((function(e){return e.unselectNodesAndEdges})),o=(0,Pa.Dv)(tf);return(0,i.jsx)(rj.mQ,{value:n,className:"h-full",children:(0,i.jsxs)(rj.dr,{variant:"lineTab",className:"justify-start",children:[(0,i.jsx)(rj.SP,{variant:"lineTab",value:"design",onClick:function(){t("design")},children:"Design"}),(0,i.jsx)(rj.SP,{variant:"lineTab",value:"run",onClick:function(){o||r(),t("run")},children:"Debug"}),(0,i.jsx)(rj.SP,{variant:"lineTab",value:"source",onClick:function(){t("source")},children:"Source"}),(0,i.jsx)(rj.SP,{variant:"lineTab",value:"invoke",onClick:function(){t("invoke")},children:"Invoke"})]})})},mj=t(36386),gj=t(53261),xj=function(e){var n=(0,My.hP)(),t=(0,l.useState)(!1),r=t[0],o=t[1],i=e.nodes,a=e.template,s=e.setTemplate,u=e.ready,c=(0,l.useCallback)((function(){return n(a,i.map(gj.D)).then((function(e){s((function(n){return(0,g.Z)((0,m.Z)({},n),{updated:e.updated})}))}))}),[a,i,n,s]),d=bj({onUndoRedo:function(n){var t;null===(t=e.onUndoRedo)||void 0===t||t.call(e,n),yj(c)}});return(0,l.useEffect)((function(){r&&u&&(o(!1),yj((function(){return d({nodes:i,template:a}),c()})))}),[r,i,a,c,u,d]),o},bj=function(e){var n=(0,l.useState)([]),t=n[0],r=n[1],o=(0,l.useState)([]),i=o[0],a=o[1],s=e.onUndoRedo,u=(0,l.useCallback)((function(){if(!(t.length<2)){var e=t.at(-1),n=t.at(-2);r((function(e){return e.slice(0,-1)})),a((function(n){return n.concat(e)})),s(n)}}),[t,s]),c=(0,l.useCallback)((function(){if(!(i.length<1)){var n=i.at(-1);a((function(e){return e.slice(0,-1)})),r((function(e){return(0,N.Z)(e).concat([n])})),e.onUndoRedo(n)}}),[i,e]);(0,l.useEffect)((function(){var e=function(e){(e.ctrlKey||e.metaKey)&&("z"!==e.key||e.shiftKey||(u(),e.preventDefault()),"z"===e.key&&e.shiftKey&&(c(),e.preventDefault()))};return document.addEventListener("keydown",e),function(){document.removeEventListener("keydown",e)}}),[c,u]);return function(e){r((function(n){return(n.length>=10?n.slice(1):n).concat(e)})),a([])}},yj=(0,mj.debounce)(function(){var e=(0,h.Z)((function(e){return(0,x.__generator)(this,(function(n){return[2,e()]}))}));return function(n){return e.apply(this,arguments)}}(),500),Cj=t(32557),jj=t.n(Cj),wj=function(e){var n=e.nodes,t=(0,l.useMemo)((function(){return op(n)}),[n]),r=(0,ic.F)().resolvedTheme;return(0,i.jsx)("div",{className:"flex w-full flex-col bg-background-panels",children:(0,i.jsx)(D.SyntaxHighlighter,{value:t,themeType:r})})}
1,Nj=t(27050);function Sj(){var e=(0,o.Z)(["\n  .CodeMirror .CodeMirror-sizer {\n    min-width: 0;\n  }\n  .clipboard-copy {\n    right: 5px;\n  }\n"]);return Sj=function(){return e},e}var kj,_j=function(e){var n=e.template,t=e.onChange;return(0,i.jsx)("div",{className:"w-full bg-background-panels",children:(0,i.jsxs)("div",{className:"flex w-full flex-col p-8",children:[(0,i.jsx)("span",{className:"mb-8 font-inter text-xl font-semibold text-text-default",children:"Automation Settings"}),(0,i.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,i.jsx)(ts,{className:"max-w-xl",label:"Template ID",value:n.id,readOnly:!0}),(0,i.jsx)(ts,{className:"max-w-xl",label:"Alias",value:n.alias,onChange:function(e){return t((0,g.Z)((0,m.Z)({},n),{alias:e.target.value}))}}),(0,i.jsx)(ts,{className:"max-w-xl",label:"Cancelation token",placeholder:"Enter token...",value:(0,Nj.UZ)(null!==(UC=n.cancelation_token)&&void 0!==UC?UC:""),onChange:function(e){return t((0,g.Z)((0,m.Z)({},n),{cancelation_token:e.target.value}))}})]})]})})},Zj=function(e){var n=e.disabled,t=e.templateId,r=e.onClick,o=(0,ic.F)().resolvedTheme,a="curl --request POST \\\n     --url ".concat("https://api.courier.com","/automations/").concat(t,"/invoke \\\n     --header 'Accept: application/json' \\\n     --header 'Authorization: Bearer <YOUR_API_KEY>' \\\n     --header 'Content-Type: application/json' \\\n     --data '{}'\n  ");return(0,i.jsxs)("div",{className:"flex w-full flex-col bg-background-panels p-8 font-inter text-text-default",children:[(0,i.jsx)("h3",{className:"m-0 p-0 text-xl font-semibold",children:"Invoke automation"}),(0,i.jsxs)("p",{className:"opacity-75",children:["This will invoke the most recent published version of the automation template. ",(0,i.jsx)("br",{}),"The data payload passed to this automation run will be empty."]}),(0,i.jsx)("div",{className:"h-40 max-w-3xl",children:(0,i.jsx)(Ej,{themeType:o,value:a,options:{readOnly:!0,mode:{name:"shell"},lineWrapping:!0}})}),(0,i.jsx)("button",{className:"mt-4 w-fit cursor-pointer rounded border-0 bg-button-green px-4 py-2 font-inter text-sm text-white transition-colors duration-200 hover:bg-button-states-green-hover disabled:pointer-events-none disabled:cursor-default disabled:opacity-25",disabled:n,onClick:r,children:"Invoke"})]})},Ej=(0,u.default)(ui.default)(Sj()),Ij=function(e){var n=e.templateId,t=(0,My.PY)(n),r=(0,l.useState)(!1),o=r[0],a=r[1],s=(0,j.t)(),u=function(){var e=(0,h.Z)((function(){return(0,x.__generator)(this,(function(e){switch(e.label){case 0:a(!0),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,t()];case 2:return e.sent(),s.automationInvokedSuccess(),setTimeout((function(){a(!1)}),5e3),[3,4];case 3:return e.sent(),a(!1),s.failedToInvokeAutomation(),[3,4];case 4:return[2]}}
1))}));return function(){return e.apply(this,arguments)}}();return(0,i.jsx)(Zj,{onClick:u,disabled:o,templateId:n})},Oj=function(e){var n=e.template,t=e.onChange;return(0,i.jsx)("div",{className:"w-full bg-background-panels",children:(0,i.jsxs)("div",{className:"flex w-full flex-col p-8",children:[(0,i.jsx)(cf.default,{variant:"bold-md",className:"mb-8",children:"Automation Settings"}),(0,i.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,i.jsx)($x.default,{className:"max-w-xl",label:"Template ID",value:n.id,readOnly:!0,disabled:!0}),(0,i.jsx)($x.default,{className:"max-w-xl",label:"Alias",value:n.alias,onChange:function(e){return t((0,g.Z)((0,m.Z)({},n),{alias:e.target.value}))}}),(0,i.jsx)($x.default,{className:"max-w-xl",label:"Cancelation token",placeholder:"Enter token...",value:(0,Nj.UZ)(null!==(kj=n.cancelation_token)&&void 0!==kj?kj:""),onChange:function(e){return t((0,g.Z)((0,m.Z)({},n),{cancelation_token:e.target.value}))}})]})]})})},Tj=t(25253),Aj=t(55830),Dj=t(96325),Lj=new(t.n(Dj)()),Mj=function(){var e=(0,h.Z)((function(e,n){var t,r,o,i,a,l,s,u,c,d,f,p;return(0,x.__generator)(this,(function(h){switch(h.label){case 0:return o={id:"elk-root",layoutOptions:{"elk.algorithm":"mrtree","elk.direction":"RIGHT","elk.spacing.nodeNode":"50"},children:e.map((function(e){return{id:e.id,width:null!==(t=e.temp_props.width)&&void 0!==t?t:0,height:null!==(r=e.temp_props.height)&&void 0!==r?r:0}})),edges:n.map((function(e){return{id:e.id,sources:[e.source],targets:[e.target]}}))},[4,Lj.layout(o)];case 1:i=h.sent(),a=new Map,s=!0,u=!1,c=void 0;try{for(d=(null!==(l=i.children)&&void 0!==l?l:[])[Symbol.iterator]();!(s=(f=d.next()).done);s=!0)p=f.value,a.set(p.id,p)}catch(AS){u=!0,c=AS}finally{try{s||null==d.return||d.return()}finally{if(u)throw c}}return[2,e.map((function(e){var n=a.get(e.id),t={x:n.x,y:n.y};return(0,g.Z)((0,m.Z)({},e),{properties:(0,g.Z)((0,m.Z)({},e.properties),{position:t})})}))]}}))}));return function(n,t){return e.apply(this,arguments)}}(),Pj=t(53218),Rj=function(e){var n=e.loading,r=e.children,o=e.className;return(0,l.useEffect)((function(){function e(){return(e=(0,h.Z)((function(){return(0,x.__generator)(this,(function(e){switch(e.label){case 0:return[4,t.e(4551).then(t.bind(t,64551))];case 1:return e.sent().ring.register(),[2]}}))}))).apply(this,arguments)}!function(){e.apply(this,arguments)}()}),[]),n?(0,i.jsx)("div",{className:o,children:(0,i.jsx)("l-ring",{speed:"2.0",size:"22",stroke:"2",color:"currentColor"})}):(0,i.jsx)(i.Fragment,{children:r})},Fj=function(e){var n=e.templateId,t=e.runId,r=e.isRunning,o=e.testEvents,a=e.selectedTestEvent,l=e.setSelectedTestEvent,s=e.saveAutomationTestEvent,u=e.deleteAutomationTestEvent,c=e.handleRunTestEvent,d=e.invokeDidError,f=e.stepsDidError,p=e.runIsOutdated,h=o.map((function(e){return{label:e.label,value:e.id}}));return(0,i.jsx)("div",{className:"flex h-[50px] items-center border-0 border-b border-t border-solid border-structure-border px-6 py-1",children:(0,i.jsxs)("div",{className:"flex items-center gap-md",children:[h.length>0&&(0,i.jsx)(Wx.Z,{className:"w-[271px]",options:h,value:null===a||void 0===a?void 0:a.id,labelForOptions:"label",valueForOptions:"value",onChange:function(e){var n=e.value,t=o.find((function(e){return e.id===n}));l(t)},disabled:0===h.length||r}),(0,i.jsx)(Pj.Z,{selectedTestEvent:a,setSelectedTestEvent:l,templateId:n,events:o,saveTestEvent:s,deleteTestEvent:u,isRunning:r,buttonIsEditIcon:0!==h.length}),(0,i.jsx)(ki.default,{variant:"default",icon:(0,i.jsx)(zj,{isRunning:r,runId:t,didError:d||f}),iconClassName:(0,Jd.cx)(t?"text-icon-green":""),onClick:c,disabled:r||!a,children:r?"Running...":t?"Run again":"Run"}),p&&(0,i.jsx)(cf.default,{variant:"regular-sm",className:"text-yellow-700 dark:text-yellow-500",children:"Outdated"})]})})},zj=function(e){var n=e.isRunning,t=e.runId,r=e.didError;return(0,i.jsx)(Rj,{loading:n,className:"flex h-6 w-6 justify-center text-button",children:t&&!r?(0,i.jsx)(J.MCw,{className:"h-6 w-6 text-icon-green"}):r?(0,i.jsx)(J.X,{className:"h-6 w-6 text-icon-red"}):(0,i.jsx)(J.shV,{className:"h-6 w-6"})})},Bj=t(39017),Hj=t(5966),Vj=t(48791),$j=new Map([["add-to-digest","Digest"],["batch","Batch"],["throttle","Throttle"],["delay","Delay"],["
1if","If"],["fetch","Fetch Data"],["invoke","Invoke Automation"],["cancel","Cancel Automation"],["send","Send"],["send-to-list","Send to List"],["subscribe-to-list","Subscribe to List"],["update-profile","Update Profile"],["switch","Switch"]]),Uj=function(e){var n;return null!==(n=$j.get(e))&&void 0!==n?n:e},Wj=function(e){var n,t,r,o=e.templateId,a=e.testEvents,l=e.selectedTestEvent,s=e.setSelectedTestEvent,u=e.selectedNode,c=e.saveAutomationTestEvent,d=e.deleteAutomationTestEvent,f=e.previousNode,p=e.stepContextResults,h=e.invokeDidError,v=e.isRunning,m=(0,Pa.Dv)(tf);if(h)return(0,i.jsx)(Gj,{text:"Error running test event"});if(v)return(0,i.jsx)(Gj,{text:"Running test event..."});if(u&&m&&p.isLoading)return(0,i.jsx)(Gj,{text:"Loading context..."});if(l&&!m)return(0,i.jsx)(Gj,{text:"Run a test event to begin"});var g={runContext:JSON.parse(null!==(r=null===l||void 0===l?void 0:l.testEvent)&&void 0!==r?r:"{}")};return(0,i.jsxs)(i.Fragment,{children:[!l&&(0,i.jsx)(Jj,{templateId:o,testEvents:a,saveAutomationTestEvent:c,deleteAutomationTestEvent:d,selectedTestEvent:l,setSelectedTestEvent:s}),l&&(u?(0,i.jsxs)(i.Fragment,{children:[f&&(0,i.jsx)(Kj,{title:Uj(null===f||void 0===f?void 0:f.type),value:p.isLoading?null:"trigger"===(null===f||void 0===f?void 0:f.type)?g:null===p||void 0===p||null===(n=p.data)||void 0===n?void 0:n.prevStepContext}),(0,i.jsx)(Kj,{title:Uj(null===u||void 0===u?void 0:u.type),value:p.isLoading?null:"trigger"===(null===u||void 0===u?void 0:u.type)?g:null===p||void 0===p||null===(t=p.data)||void 0===t?void 0:t.curStepContext})]}):(0,i.jsx)(Gj,{text:"Select a node to view data"}))]})},qj=function(e){var n=e.title;return(0,i.jsx)("div",{className:"flex min-h-[41px] items-center border-0 border-b border-solid border-violet-dark-7 bg-violet-dark-9 pl-5",children:(0,i.jsx)(cf.default,{variant:"debugger-text",className:"capitalize",children:n})})},Kj=function(e){var n=e.title,t=e.value;return t?(0,i.jsxs)("div",{className:"flex flex-1 flex-col",children:[(0,i.jsx)(qj,{title:n}),(0,i.jsx)(D.SyntaxHighlighter,{value:t?JSON.stringify(t,null,2):"",themeType:"dark"})]}):(0,i.jsx)(Gj,{title:n,text:"Node did not process"})},Gj=function(e){var n=e.title,t=void 0===n?"":n,r=e.text;return(0,i.jsxs)("div",{className:"flex flex-1 flex-col",children:[(0,i.jsx)(qj,{title:t}),(0,i.jsx)("div",{className:"flex h-full flex-col items-center justify-center bg-[#292D3E]",children:(0,i.jsx)(cf.default,{variant:"debugger-text",className:"pb-[125px]",children:r})})]})},Jj=function(e){var n=e.templateId,t=e.testEvents,r=e.saveAutomationTestEvent,o=e.deleteAutomationTestEvent,a=e.selectedTestEvent,l=e.setSelectedTestEvent;return(0,i.jsxs)("div",{className:"flex flex-1 flex-col",children:[(0,i.jsx)(qj,{title:""}),(0,i.jsxs)("div",{className:"flex h-full flex-col items-center justify-center gap-[24px] bg-[#292D3E] pb-[125px]",children:[(0,i.jsx)(cf.default,{variant:"debugger-text",children:"Create or select a test event"}),(0,i.jsx)(Pj.Z,{selectedTestEvent:a,setSelectedTestEvent:l,templateId:n,events:t,saveTestEvent:r,deleteTestEvent:o,buttonIsEditIcon:!1,isButtonDarkMode:!0})]})]})},Xj=function(){var e,n,t,r=(0,Ma.SM)().find((function(e){var n,t;return"trigger"===(null===e||void 0===e||null===(n=e.data)||void 0===n||null===(t=n.node)||void 0===t?void 0:t.type)})),o=null===r||void 0===r||null===(e=r.data)||void 0===e||null===(n=e.node)||void 0===n||null===(t=n.next_step)||void 0===t?void 0:t.$node_id;return"action-placeholder"===o?null===r||void 0===r?void 0:r.id:o},Yj="ERROR",Qj=function(e){var n,t,r,o=e.templateId,a=e.runId,s=e.setRunId,u=e.isRunning,c=e.setIsRunning,d=e.testEvents,f=e.saveAutomationTestEvent,p=e.deleteAutomationTestEvent,v=e.runIsOutdated,b=e.setRunIsOutdated,y=(0,l.useState)(!1),C=y[0],j=y[1],w=(0,Ma.oR)((function(e){return e.unselectNodesAndEdges})),N=df(),S=ff(),k=Xj(),_=(0,Ma.oR)((function(e){return e.addSelectedNodes})),Z=(0,Ma.SM)(),E=(0,Bj.Z)({runId:a,curStepId:null===N||void 0===N?void 0:N.id,prevStepId:null===S||void 0===S?void 0:S.id}),I=(0,Hj.Z)({runId:a}),O=I.startPolling,T=I.stopPolling,A=I.data,D=null!==(t=null===A||void 0===A?void 0:A.run)&&void 0!==t?t:{},L=D.status,M=D.steps,P=(null!==M&&void 0!==M?M:{}).nodes;(0,l.useEffect)((function(){if(L){if("PROCESSING"===L&&a)c(!0),O(2e3);else if(u)if(c(!1),T(),L===Yj){var e=ew(P);nw(Z,e),_([null===e||void 0===e?void 0:e[0]])}else _([k]);return function(){T()}}}),[L,T,a,O,c,_,k]);var R=(0,l.useState)(null!==(r=null===d||void 0===d||null===(n=d[0])||void 0===n?void 0:n.id)&&void 0!==r?r:null),F=R[0],z=R[1],B=d.find((function(e){return e.id===F})),H=(0,My.PY)(o,{version:"draft",context:(0,g.Z)((0,m.Z)({},(0,Vj.p)(null===B||void 0===B?void 0:B.testEvent)),{isDebug:!0})});(0,l.useEffect)((function(){d.length>0&&!B&&z(d[0].id)}),[B,d]);var V=function(){var e=(0,h.Z)((function(){var e;return(0,x.__generator)(this,(function(n){switch(n.label){case 0:return w(),c(!0),j(!1),tw(Z),b(!1),[4,H()];case 1:return(e=n.sent())?s(e):(j(!0),c(!1)),[2]}}))}));return function(){return e.apply(this,arguments)}}(),$=function(e){var n;z(null!==(n=null===e||void 0===e?void 0:e.id)&&void 0!==n?n:null)};return(0,i.jsxs)("div",{className:"flex h-full w-full flex-col bg-background-panels",children:[(0,i.jsx)(Fj,{templateId:o,runI
1d:a,isRunning:u,testEvents:d,selectedTestEvent:B,setSelectedTestEvent:$,saveAutomationTestEvent:f,deleteAutomationTestEvent:p,handleRunTestEvent:V,invokeDidError:C,stepsDidError:L===Yj,runIsOutdated:v}),(0,i.jsx)("div",{className:"flex h-full gap-[1px] bg-[#48465B]",children:(0,i.jsx)(Wj,{templateId:o,testEvents:d,selectedTestEvent:B,setSelectedTestEvent:$,selectedNode:N,saveAutomationTestEvent:f,deleteAutomationTestEvent:p,previousNode:S,stepContextResults:E,invokeDidError:C,isRunning:u})})]})},ew=function(e){return null===e||void 0===e?void 0:e.filter((function(e){return"ERROR"===(null===e||void 0===e?void 0:e.status)})).map((function(e){return null===e||void 0===e?void 0:e.stepId}))},nw=function(e,n){null===n||void 0===n||n.forEach((function(n){var t=e.find((function(e){return e.id===n}));t&&(t.data.node.temp_props={hasDebugError:!0})}))},tw=function(e){e.forEach((function(e){e.data.node.temp_props={hasDebugError:!1}}))};const{createElement:rw,createContext:ow,createRef:iw,forwardRef:aw,useCallback:lw,useContext:sw,useEffect:uw,useImperativeHandle:cw,useLayoutEffect:dw,useMemo:fw,useRef:pw,useState:hw}=s,vw=s[`useId${Math.random()}`.slice(0,5)],mw=dw,gw=ow(null);gw.displayName="PanelGroupContext";const xw=mw,bw="function"===typeof vw?vw:()=>null;let yw=0;function Cw(e=null){const n=bw(),t=pw(e||n||null);return null===t.current&&(t.current=""+yw++),null!==e&&void 0!==e?e:t.current}function jw({children:e,className:n="",collapsedSize:t,collapsible:r,defaultSize:o,forwardedRef:i,id:a,maxSize:l,minSize:s,onCollapse:u,onExpand:c,onResize:d,order:f,style:p,tagName:h="div",...v}){const m=sw(gw);if(null===m)throw Error("Panel components must be rendered within a PanelGroup container");const{collapsePanel:g,expandPanel:x,getPanelSize:b,getPanelStyle:y,groupId:C,isPanelCollapsed:j,reevaluatePanelConstraints:w,registerPanel:N,resizePanel:S,unregisterPanel:k}=m,_=Cw(a),Z=pw({callbacks:{onCollapse:u,onExpand:c,onResize:d},constraints:{collapsedSize:t,collapsible:r,defaultSize:o,maxSize:l,minSize:s},id:_,idIsFromProps:void 0!==a,order:f});pw({didLogMissingDefaultSizeWarning:!1}),xw((()=>{const{callbacks:e,constraints:n}=Z.current,i={...n};Z.current.id=_,Z.current.idIsFromProps=void 0!==a,Z.current.order=f,e.onCollapse=u,e.onExpand=c,e.onResize=d,n.collapsedSize=t,n.collapsible=r,n.defaultSize=o,n.maxSize=l,n.minSize=s,i.collapsedSize===n.collapsedSize&&i.collapsible===n.collapsible&&i.maxSize===n.maxSize&&i.minSize===n.minSize||w(Z.current,i)})),xw((()=>{const e=Z.current;return N(e),()=>{k(e)}}),[f,_,N,k]),cw(i,(()=>({collapse:()=>{g(Z.current)},expand:e=>{x(Z.current,e)},getId:()=>_,getSize:()=>b(Z.current),isCollapsed:()=>j(Z.current),isExpanded:()=>!j(Z.current),resize:e=>{S(Z.current,e)}})),[g,x,b,j,_,S]);const E=y(Z.current,o);return rw(h,{...v,children:e,className:n,id:a,style:{...E,...p},"data-panel":"","data-panel-collapsible":r||void 0,"data-panel-group-id":C,"data-panel-id":_,"data-panel-size":parseFloat(""+E.flexGrow).toFixed(1)})}const ww=aw(((e,n)=>rw(jw,{...e,forwardedRef:n})));let Nw;function Sw(){return Nw}jw.displayName="Panel",ww.displayName="forwardRef(Panel)";let kw=null,_w=!0,Zw=null;function Ew(e,n){if(!_w)return;const t=function(e,n){if(n){const e=0!==(n&Vw),t=0!==(n&$w);if(0!==(n&Bw))return e?"se-resize":t?"ne-resize":"e-resize";if(0!==(n&Hw))return e?"sw-resize":t?"nw-resize":"w-resize";if(e)return"s-resize";if(t)return"n-resize"}switch(e){case"horizontal":return"ew-resize";case"intersection":return"move";case"vertical":return"ns-resize"}}(e,n);if(kw!==t){if(kw=t,null===Zw){Zw=document.createElement("style");const e=Sw();e&&Zw.setAttribute("nonce",e),document.head.appendChild(Zw)}Zw.innerHTML=`*{cursor: ${t}!important;}`}}function Iw(e){return"keydown"===e.type}function Ow(e){return e.type.startsWith("pointer")}function Tw(e){return e.type.startsWith("mouse")}function Aw(e){if(Ow(e)){if(e.isPrimary)return{x:e.clientX,y:e.clientY}}else if(Tw(e))return{x:e.clientX,y:e.clientY};return{x:1/0,y:1/0}}function Dw(e,n,t){return t?e.x<n.x+n.width&&e.x+e.width>n.x&&e.y<n.y+n.height&&e.y+e.height>n.y:e.x<=n.x+n.width&&e.x+e.width>=n.x&&e.y<=n.y+n.height&&e.y+e.height>=n.y}const Lw=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Mw(e){const n=getComputedStyle(e);return"fixed"===n.position||(!("auto"===n.zIndex||"static"===n.position&&!function(e){var n;const t=getComputedStyle(null!==(n=zw(e))&&void 0!==n?n:e).display;return"flex"===t||"inline-flex"===t}(e))||(+n.opacity<1||("transform"in n&&"none"!==n.transform||("webkitTransform"in n&&"none"!==n.webkitTransform||("mixBlendMode"in n&&"normal"!==n.mixBlendMode||("filter"in n&&"none"!==n.filter||("webkitFilter"in n&&"none"!==n.webkitFilter||("isolation"in n&&"isolate"===n.isolation||(!!Lw.test(n.willChange)||"touch"===n.webkitOverflowScrolling)))))))))}function Pw(e){let n=e.length;for(;n--;
1){const t=e[n];if(iN(t,"Missing node"),Mw(t))return t}return null}function Rw(e){return e&&Number(getComputedStyle(e).zIndex)||0}function Fw(e){const n=[];for(;e;)n.push(e),e=zw(e);return n}function zw(e){const{parentNode:n}=e;return n&&n instanceof ShadowRoot?n.host:n}const Bw=1,Hw=2,Vw=4,$w=8,Uw="coarse"===function(){if("function"===typeof matchMedia)return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}();let Ww=[],qw=!1,Kw=new Map,Gw=new Map;const Jw=new Set;function Xw(e){const{target:n}=e,{x:t,y:r}=Aw(e);qw=!0,eN({target:n,x:t,y:r}),rN(),Ww.length>0&&(oN("down",e),e.preventDefault(),e.stopPropagation())}function Yw(e){const{x:n,y:t}=Aw(e);if(qw&&0===e.buttons&&(qw=!1,oN("up",e)),!qw){const{target:r}=e;eN({target:r,x:n,y:t})}oN("move",e),tN(),Ww.length>0&&e.preventDefault()}function Qw(e){const{target:n}=e,{x:t,y:r}=Aw(e);Gw.clear(),qw=!1,Ww.length>0&&e.preventDefault(),oN("up",e),eN({target:n,x:t,y:r}),tN(),rN()}function eN({target:e,x:n,y:t}){Ww.splice(0);let r=null;e instanceof HTMLElement&&(r=e),Jw.forEach((e=>{const{element:o,hitAreaMargins:i}=e,a=o.getBoundingClientRect(),{bottom:l,left:s,right:u,top:c}=a,d=Uw?i.coarse:i.fine;if(n>=s-d&&n<=u+d&&t>=c-d&&t<=l+d){if(null!==r&&document.contains(r)&&o!==r&&!o.contains(r)&&!r.contains(o)&&function(e,n){if(e===n)throw new Error("Cannot compare node with itself");const t={a:Fw(e),b:Fw(n)};let r;for(;t.a.at(-1)===t.b.at(-1);)e=t.a.pop(),n=t.b.pop(),r=e;iN(r,"Stacking order can only be calculated for elements with a common ancestor");const o=Rw(Pw(t.a)),i=Rw(Pw(t.b));if(o===i){const e=r.childNodes,n={a:t.a.at(-1),b:t.b.at(-1)};let o=e.length;for(;o--;){const t=e[o];if(t===n.a)return 1;if(t===n.b)return-1}}return Math.sign(o-i)}(r,o)>0){let e=r,n=!1;for(;e&&!e.contains(o);){if(Dw(e.getBoundingClientRect(),a,!0)){n=!0;break}e=e.parentElement}if(n)return}Ww.push(e)}}))}function nN(e,n){Gw.set(e,n)}function tN(){let e=!1,n=!1;Ww.forEach((t=>{const{direction:r}=t;"horizontal"===r?e=!0:n=!0}));let t=0;Gw.forEach((e=>{t|=e})),e&&n?Ew("intersection",t):e?Ew("horizontal",t):n?Ew("vertical",t):null!==Zw&&(document.head.removeChild(Zw),kw=null,Zw=null)}function rN(){Kw.forEach(((e,n)=>{const{body:t}=n;t.removeEventListener("contextmenu",Qw),t.removeEventListener("pointerdown",Xw),t.removeEventListener("pointerleave",Yw),t.removeEventListener("pointermove",Yw)})),window.removeEventListener("pointerup",Qw),window.removeEventListener("pointercancel",Qw),Jw.size>0&&(qw?(Ww.length>0&&Kw.forEach(((e,n)=>{const{body:t}=n;e>0&&(t.addEventListener("contextmenu",Qw),t.addEventListener("pointerleave",Yw),t.addEventListener("pointermove",Yw))})),window.addEventListener("pointerup",Qw),window.addEventListener("pointercancel",Qw)):Kw.forEach(((e,n)=>{const{body:t}=n;e>0&&(t.addEventListener("pointerdown",Xw,{capture:!0}),t.addEventListener("pointermove",Yw))})))}function oN(e,n){Jw.forEach((t=>{const{setResizeHandlerState:r}=t,o=Ww.includes(t);r(e,o,n)}))}function iN(e,n){if(!e)throw console.error(n),Error(n)}function aN(e,n,t=10){return e.toFixed(t)===n.toFixed(t)?0:e>n?1:-1}function lN(e,n,t=10){return 0===aN(e,n,t)}function sN(e,n,t){return 0===aN(e,n,t)}function uN({panelConstraints:e,panelIndex:n,size:t}){const r=e[n];iN(null!=r,`Panel constraints not found for index ${n}`);let{collapsedSize:o=0,collapsible:i,maxSize:a=100,minSize:l=0}=r;if(aN(t,l)<0)if(i){t=aN(t,(o+l)/2)<0?o:l}else t=l;return t=Math.min(a,t),t=parseFloat(t.toFixed(10))}function cN({delta:e,initialLayout:n,panelConstraints:t,pivotIndices:r,prevLayout:o,trigger:i}){if(sN(e,0))return n;const a=[...n],[l,s]=r;iN(null!=l,"Invalid first pivot index"),iN(null!=s,"Invalid second pivot index");let u=0;if("keyboard"===i){{const r=e<0?s:l,o=t[r];iN(o,`Panel constraints not found for index ${r}`);const{collapsedSize:i=0,collapsible:a,minSize:u=0}=o;if(a){const t=n[r];if(iN(null!=t,`Previous layout not found for panel index ${r}`),sN(t,i)){const n=u-t;aN(n,Math.abs(e))>0&&(e=e<0?0-n:n)}}}{const r=e<0?l:s,o=t[r];iN(o,`No panel constraints found for index ${r}`);const{collapsedSize:i=0,collapsible:a,minSize:u=0}=o;if(a){const t=n[r];if(iN(null!=t,`Previous layout not found for panel index ${r}`),sN(t,u)){const n=t-i;aN(n,Math.abs(e))>0&&(e=e<0?0-n:n)}}}}{const r=e<0?1:-1;let o=e<0?s:l,i=0;for(;;){const e=n[o];iN(null!=e,`Previous layout not found for panel index ${o}`);if(i+=uN({panelConstraints:t,panelIndex:o,size:100})-e,o+=r,o<0||o>=t.length)break}const a=Math.min(Math.abs(e),Math.abs(i));e=e<0?0-a:a}{let r=e<0?l:s;for(;r>=0&&r<t.length;){const o=Math.abs(e)-Math.abs(u),i=n[r];iN(null!=i,`Previous layout not found for panel index ${r}`);const l=uN({panelConstraints:t,panelIndex:r,size:i-o});if(!sN(i,l)&&(u+=i-l,a[r]=l,u.toPrecision(3).localeCompare(Math.abs(e).toPrecision(3),void 0,{numeric:!0})>=0))break;e<0?r--:r++}}if(function(e,n,t){if(e.length!==n.length)return!1;for(let r=0;r<e.length;r++)if(!sN(e[r],n[r],t))return!1;return!0}(o,a))return o;{const r=e<0?s:l,o=n[r];iN(null!=o,`Previous layout not found for panel index ${r}`);const i=o+u,c=uN({panelConstraints:t,panelIndex:r,size:i});if(a[r]=c,!sN(c,i)){let n=i-c;let r=e<0?s:l;for(;r>=0&&r<t.length;){const o=a[r];iN(null!=o,`Previous layout not found for panel index ${r}`);const i=uN({panelConstraints:t,panelIndex:r,size:o+n});if(sN(o,i)||(n-=i-o,a[r]=i),sN(n,0))break;e>0?r--:r++}}}const c=a.reduce(((e,n)=>n+e),0);return sN(c,100)?a:o}function dN({layout:e,panelsArray:n,pivotIndices:t}){let r=0,o=100,i=0,a=0;const l=t[0];
1iN(null!=l,"No pivot index found"),n.forEach(((e,n)=>{const{constraints:t}=e,{maxSize:s=100,minSize:u=0}=t;n===l?(r=u,o=s):(i+=u,a+=s)}));return{valueMax:Math.min(o,100-i),valueMin:Math.max(r,100-a),valueNow:e[l]}}function fN(e,n=document){return Array.from(n.querySelectorAll(`[data-panel-resize-handle-id][data-panel-group-id="${e}"]`))}function pN(e,n,t=document){const r=fN(e,t).findIndex((e=>e.getAttribute("data-panel-resize-handle-id")===n));return null!==r&&void 0!==r?r:null}function hN(e,n,t){const r=pN(e,n,t);return null!=r?[r,r+1]:[-1,-1]}function vN(e,n=document){var t;if(n instanceof HTMLElement&&(null===n||void 0===n||null===(t=n.dataset)||void 0===t?void 0:t.panelGroupId)==e)return n;const r=n.querySelector(`[data-panel-group][data-panel-group-id="${e}"]`);return r||null}function mN(e,n=document){const t=n.querySelector(`[data-panel-resize-handle-id="${e}"]`);return t||null}function gN({committedValuesRef:e,eagerValuesRef:n,groupId:t,layout:r,panelDataArray:o,panelGroupElement:i,setLayout:a}){pw({didWarnAboutMissingResizeHandle:!1}),xw((()=>{if(!i)return;const e=fN(t,i);for(let n=0;n<o.length-1;n++){const{valueMax:t,valueMin:i,valueNow:a}=dN({layout:r,panelsArray:o,pivotIndices:[n,n+1]}),l=e[n];if(null==l);else{const e=o[n];iN(e,`No panel data found for index "${n}"`),l.setAttribute("aria-controls",e.id),l.setAttribute("aria-valuemax",""+Math.round(t)),l.setAttribute("aria-valuemin",""+Math.round(i)),l.setAttribute("aria-valuenow",null!=a?""+Math.round(a):"")}}return()=>{e.forEach(((e,n)=>{e.removeAttribute("aria-controls"),e.removeAttribute("aria-valuemax"),e.removeAttribute("aria-valuemin"),e.removeAttribute("aria-valuenow")}))}}),[t,r,o,i]),uw((()=>{if(!i)return;const e=n.current;iN(e,"Eager values not found");const{panelDataArray:o}=e;iN(null!=vN(t,i),`No group found for id "${t}"`);const l=fN(t,i);iN(l,`No resize handles found for group id "${t}"`);const s=l.map((e=>{const n=e.getAttribute("data-panel-resize-handle-id");iN(n,"Resize handle element has no handle id attribute");const[l,s]=function(e,n,t,r=document){var o,i,a,l;const s=mN(n,r),u=fN(e,r),c=s?u.indexOf(s):-1;return[null!==(o=null===(i=t[c])||void 0===i?void 0:i.id)&&void 0!==o?o:null,null!==(a=null===(l=t[c+1])||void 0===l?void 0:l.id)&&void 0!==a?a:null]}(t,n,o,i);if(null==l||null==s)return()=>{};const u=e=>{if(!e.defaultPrevented)switch(e.key){case"Enter":{e.preventDefault();const s=o.findIndex((e=>e.id===l));if(s>=0){const e=o[s];iN(e,`No panel data found for index ${s}`);const l=r[s],{collapsedSize:u=0,collapsible:c,minSize:d=0}=e.constraints;if(null!=l&&c){const e=cN({delta:sN(l,u)?d-u:u-l,initialLayout:r,panelConstraints:o.map((e=>e.constraints)),pivotIndices:hN(t,n,i),prevLayout:r,trigger:"keyboard"});r!==e&&a(e)}}break}}};return e.addEventListener("keydown",u),()=>{e.removeEventListener("keydown",u)}}));return()=>{s.forEach((e=>e()))}}),[i,e,n,t,r,o,a])}function xN(e,n){if(e.length!==n.length)return!1;for(let t=0;t<e.length;t++)if(e[t]!==n[t])return!1;return!0}function bN(e,n){const t="horizontal"===e,{x:r,y:o}=Aw(n);return t?r:o}function yN(e,n,t,r,o,i){if(Iw(e)){const n="horizontal"===t;let r=0;r=e.shiftKey?100:null!=o?o:10;let i=0;switch(e.key){case"ArrowDown":i=n?0:r;break;case"ArrowLeft":i=n?-r:0;break;case"ArrowRight":i=n?r:0;break;case"ArrowUp":i=n?0:-r;break;case"End":i=100;break;case"Home":i=-100}return i}return null==r?0:function(e,n,t,r,o){const i="horizontal"===t,a=mN(n,o);iN(a,`No resize handle element found for id "${n}"`);const l=a.getAttribute("data-panel-group-id");iN(l,"Resize handle element has no group id attribute");let{initialCursorPosition:s}=r;const u=bN(t,e),c=vN(l,o);iN(c,`No group element found for id "${l}"`);const d=c.getBoundingClientRect();return(u-s)/(i?d.width:d.height)*100}(e,n,t,r,i)}function CN(e,n,t){n.forEach(((n,r)=>{const o=e[r];iN(o,`Panel data not found for index ${r}`);const{callbacks:i,constraints:a,id:l}=o,{collapsedSize:s=0,collapsible:u}=a,c=t[l];if(null==c||n!==c){t[l]=n;const{onCollapse:e,onExpand:r,onResize:o}=i;o&&o(n,c),u&&(e||r)&&(!r||null!=c&&!lN(c,s)||lN(n,s)||r(),!e||null!=c&&lN(c,s)||!lN(n,s)||e())}}))}function jN(e,n){if(e.length!==n.length)return!1;for(let t=0;t<e.length;t++)if(e[t]!=n[t])return!1;return!0}function wN(e){try{if("undefined"===typeof localStorage)throw new Error("localStorage not supported in this environment");e.getItem=e=>
1localStorage.getItem(e),e.setItem=(e,n)=>{localStorage.setItem(e,n)}}catch(n){console.error(n),e.getItem=()=>null,e.setItem=()=>{}}}function NN(e){return`react-resizable-panels:${e}`}function SN(e){return e.map((e=>{const{constraints:n,id:t,idIsFromProps:r,order:o}=e;return r?t:o?`${o}:${JSON.stringify(n)}`:JSON.stringify(n)})).sort(((e,n)=>e.localeCompare(n))).join(",")}function kN(e,n){try{const t=NN(e),r=n.getItem(t);if(r){const e=JSON.parse(r);if("object"===typeof e&&null!=e)return e}}catch(t){}return null}function _N(e,n,t,r,o){var i;const a=NN(e),l=SN(n),s=null!==(i=kN(e,o))&&void 0!==i?i:{};s[l]={expandToSizes:Object.fromEntries(t.entries()),layout:r};try{o.setItem(a,JSON.stringify(s))}catch(u){console.error(u)}}function ZN({layout:e,panelConstraints:n}){const t=[...e],r=t.reduce(((e,n)=>e+n),0);if(t.length!==n.length)throw Error(`Invalid ${n.length} panel layout: ${t.map((e=>`${e}%`)).join(", ")}`);if(!sN(r,100)&&t.length>0)for(let i=0;i<n.length;i++){const e=t[i];iN(null!=e,`No layout data found for index ${i}`);const n=100/r*e;t[i]=n}let o=0;for(let i=0;i<n.length;i++){const e=t[i];iN(null!=e,`No layout data found for index ${i}`);const r=uN({panelConstraints:n,panelIndex:i,size:e});e!=r&&(o+=e-r,t[i]=r)}if(!sN(o,0))for(let i=0;i<n.length;i++){const e=t[i];iN(null!=e,`No layout data found for index ${i}`);const r=uN({panelConstraints:n,panelIndex:i,size:e+o});if(e!==r&&(o-=r-e,t[i]=r,sN(o,0)))break}return t}const EN={getItem:e=>(wN(EN),EN.getItem(e)),setItem:(e,n)=>{wN(EN),EN.setItem(e,n)}},IN={};function ON({autoSaveId:e=null,children:n,className:t="",direction:r,forwardedRef:o,id:i=null,onLayout:a=null,keyboardResizeBy:l=null,storage:s=EN,style:u,tagName:c="div",...d}){const f=Cw(i),p=pw(null),[h,v]=hw(null),[m,g]=hw([]),x=function(){const[e,n]=hw(0);return lw((()=>n((e=>e+1))),[])}(),b=pw({}),y=pw(new Map),C=pw(0),j=pw({autoSaveId:e,direction:r,dragState:h,id:f,keyboardResizeBy:l,onLayout:a,storage:s}),w=pw({layout:m,panelDataArray:[],panelDataArrayChanged:!1});pw({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),cw(o,(()=>({getId:()=>j.current.id,getLayout:()=>{const{layout:e}=w.current;return e},setLayout:e=>{const{onLayout:n}=j.current,{layout:t,panelDataArray:r}=w.current,o=ZN({layout:e,panelConstraints:r.map((e=>e.constraints))});xN(t,o)||(g(o),w.current.layout=o,n&&n(o),CN(r,o,b.current))}})),[]),xw((()=>{j.current.autoSaveId=e,j.current.direction=r,j.current.dragState=h,j.current.id=f,j.current.onLayout=a,j.current.storage=s})),gN({committedValuesRef:j,eagerValuesRef:w,groupId:f,layout:m,panelDataArray:w.current.panelDataArray,setLayout:g,panelGroupElement:p.current}),uw((()=>{const{panelDataArray:n}=w.current;if(e){if(0===m.length||m.length!==n.length)return;let t=IN[e];null==t&&(t=function(e,n=10){let t=null;return(...r)=>{null!==t&&clearTimeout(t),t=setTimeout((()=>{e(...r)}),n)}}(_N,100),IN[e]=t);const r=[...n],o=new Map(y.current);t(e,r,o,m,s)}}),[e,m,s]),uw((()=>{}));const N=lw((e=>{const{onLayout:n}=j.current,{layout:t,panelDataArray:r}=w.current;if(e.constraints.collapsible){const o=r.map((e=>e.constraints)),{collapsedSize:i=0,panelSize:a,pivotIndices:l}=DN(r,e,t);if(iN(null!=a,`Panel size not found for panel "${e.id}"`),!lN(a,i)){y.current.set(e.id,a);const s=cN({delta:AN(r,e)===r.length-1?a-i:i-a,initialLayout:t,panelConstraints:o,pivotIndices:l,prevLayout:t,trigger:"imperative-api"});jN(t,s)||(g(s),w.current.layout=s,n&&n(s),CN(r,s,b.current))}}}),[]),S=lw(((e,n)=>{const{onLayout:t}=j.current,{layout:r,panelDataArray:o}=w.current;if(e.constraints.collapsible){const i=o.map((e=>e.constraints)),{collapsedSize:a=0,panelSize:l=0,minSize:s=0,pivotIndices:u}=DN(o,e,r),c=null!==n&&void 0!==n?n:s;if(lN(l,a)){const n=y.current.get(e.id),a=null!=n&&n>=c?n:c,s=cN({delta:AN(o,e)===o.length-1?l-a:a-l,initialLayout:r,panelConstraints:i,pivotIndices:u,prevLayout:r,trigger:"imperative-api"});jN(r,s)||(g(s),w.current.layout=s,t&&t(s),CN(o,s,b.current))}}}),[]),k=lw((e=>{const{layout:n,panelDataArray:t}=w.current,{panelSize:r}=DN(t,e,n);return iN(null!=r,`Panel size not found for panel "${e.id}"`),r}),[]),_=lw(((e,n)=>{const{panelDataArray:t}=w.current,r=AN(t,e);return function({defaultSize:e,dragState:n,layout:t,panelData:r,panelIndex:o,precision:i=3}){const a=t[o];let l;return l=null==a?void 0!=e?e.toPrecision(i):"1":1===r.length?"1":a.toPrecision(i),{flexBasis:0,flexGrow:l,flexShrink:1,overflow:"hidden",pointerEvents:null!==n?"none":void 0}}({defaultSize:n,dragState:h,layout:m,panelData:t,panelIndex:r})}),[h,m]),Z=lw((e=>{const{layout:n,panelDataArray:t}=w.current,{collapsedSize:r=0,collapsible:o,panelSize:i}=DN(t,e,n);return iN(null!=i,`Panel size not found for panel "${e.id}"`),!0===o&&lN(i,r)}),[]),E=lw((e=>{const{layout:n,panelDataArray:t}=w.current,{collapsedSize:r=0,collapsible:o,panelSize:i}=DN(t,e,n);return iN(null!=i,`Panel size not found for panel "${e.id}"`),!o||aN(i,r)>0}),[]),I=lw((e=>{const{panelDataArray:n}=w.current;n.push(e),n.sort(((e,n)=>{const t=e.order,r=n.order;return null==t&&null==r?0:null==t?-1:null==r?1:t-r})),w.current.panelDataArrayChanged=!0,x()}),[x]);xw((()=>
1{if(w.current.panelDataArrayChanged){w.current.panelDataArrayChanged=!1;const{autoSaveId:e,onLayout:n,storage:t}=j.current,{layout:r,panelDataArray:o}=w.current;let i=null;if(e){const n=function(e,n,t){var r,o;return null!==(o=(null!==(r=kN(e,t))&&void 0!==r?r:{})[SN(n)])&&void 0!==o?o:null}(e,o,t);n&&(y.current=new Map(Object.entries(n.expandToSizes)),i=n.layout)}null==i&&(i=function({panelDataArray:e}){const n=Array(e.length),t=e.map((e=>e.constraints));let r=0,o=100;for(let i=0;i<e.length;i++){const e=t[i];iN(e,`Panel constraints not found for index ${i}`);const{defaultSize:a}=e;null!=a&&(r++,n[i]=a,o-=a)}for(let i=0;i<e.length;i++){const a=t[i];iN(a,`Panel constraints not found for index ${i}`);const{defaultSize:l}=a;if(null!=l)continue;const s=o/(e.length-r);r++,n[i]=s,o-=s}return n}({panelDataArray:o}));const a=ZN({layout:i,panelConstraints:o.map((e=>e.constraints))});xN(r,a)||(g(a),w.current.layout=a,n&&n(a),CN(o,a,b.current))}})),xw((()=>{const e=w.current;return()=>{e.layout=[]}}),[]);const O=lw((e=>{let n=!1;const t=p.current;if(t){"rtl"===window.getComputedStyle(t,null).getPropertyValue("direction")&&(n=!0)}return function(t){t.preventDefault();const r=p.current;if(!r)return()=>null;const{direction:o,dragState:i,id:a,keyboardResizeBy:l,onLayout:s}=j.current,{layout:u,panelDataArray:c}=w.current,{initialLayout:d}=null!==i&&void 0!==i?i:{},f=hN(a,e,r);let h=yN(t,e,o,i,l,r);const v="horizontal"===o;v&&n&&(h=-h);const m=cN({delta:h,initialLayout:null!==d&&void 0!==d?d:u,panelConstraints:c.map((e=>e.constraints)),pivotIndices:f,prevLayout:u,trigger:Iw(t)?"keyboard":"mouse-or-touch"}),x=!jN(u,m);(Ow(t)||Tw(t))&&C.current!=h&&(C.current=h,nN(e,x||0===h?0:v?h<0?Bw:Hw:h<0?Vw:$w)),x&&(g(m),w.current.layout=m,s&&s(m),CN(c,m,b.current))}}),[]),T=lw(((e,n)=>{const{onLayout:t}=j.current,{layout:r,panelDataArray:o}=w.current,i=o.map((e=>e.constraints)),{panelSize:a,pivotIndices:l}=DN(o,e,r);iN(null!=a,`Panel size not found for panel "${e.id}"`);const s=cN({delta:AN(o,e)===o.length-1?a-n:n-a,initialLayout:r,panelConstraints:i,pivotIndices:l,prevLayout:r,trigger:"imperative-api"});jN(r,s)||(g(s),w.current.layout=s,t&&t(s),CN(o,s,b.current))}),[]),A=lw(((e,n)=>{const{layout:t,panelDataArray:r}=w.current,{collapsedSize:o=0,collapsible:i}=n,{collapsedSize:a=0,collapsible:l,maxSize:s=100,minSize:u=0}=e.constraints,{panelSize:c}=DN(r,e,t);null!=c&&(i&&l&&lN(c,o)?lN(o,a)||T(e,a):c<u?T(e,u):c>s&&T(e,s))}),[T]),D=lw(((e,n)=>{const{direction:t}=j.current,{layout:r}=w.current;if(!p.current)return;const o=mN(e,p.current);iN(o,`Drag handle element not found for id "${e}"`);const i=bN(t,n);v({dragHandleId:e,dragHandleRect:o.getBoundingClientRect(),initialCursorPosition:i,initialLayout:r})}),[]),L=lw((()=>{v(null)}),[]),M=lw((e=>{const{panelDataArray:n}=w.current,t=AN(n,e);t>=0&&(n.splice(t,1),delete b.current[e.id],w.current.panelDataArrayChanged=!0,x())}),[x]),P=fw((()=>({collapsePanel:N,direction:r,dragState:h,expandPanel:S,getPanelSize:k,getPanelStyle:_,groupId:f,isPanelCollapsed:Z,isPanelExpanded:E,reevaluatePanelConstraints:A,registerPanel:I,registerResizeHandle:O,resizePanel:T,startDragging:D,stopDragging:L,unregisterPanel:M,panelGroupElement:p.current})),[N,h,r,S,k,_,f,Z,E,A,I,O,T,D,L,M]),R={display:"flex",flexDirection:"horizontal"===r?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return rw(gw.Provider,{value:P},rw(c,{...d,children:n,className:t,id:i,ref:p,style:{...R,...u},"data-panel-group":"","data-panel-group-direction":r,"data-panel-group-id":f}))}const TN=aw(((e,n)=>rw(ON,{...e,forwardedRef:n})));function AN(e,n){return e.findIndex((e=>e===n||e.id===n.id))}function DN(e,n,t){const r=AN(e,n),o=r===e.length-1?[r-1,r]:[r,r+1],i=t[r];return{...n.constraints,panelSize:i,pivotIndices:o}}function LN({children:e=null,className:n="",disabled:t=!1,hitAreaMargins:r,id:o,onBlur:i,onDragging:a,onFocus:l,style:s={},tabIndex:u=0,tagName:c="div",...d}){var f,p;const h=pw(null),v=pw({onDragging:a});uw((()=>{v.current.onDragging=a}));const m=sw(gw);if(null===m)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{direction:g,groupId:x,registerResizeHandle:b,startDragging:y,stopDragging:C,panelGroupElement:j}=m,w=Cw(o),[N,S]=hw("inactive"),[k,_]=hw(!1),[Z,E]=hw(null),I=pw({state:N});xw((()=>{I.current.state=N})),uw((()=>
1{if(t)E(null);else{const e=b(w);E((()=>e))}}),[t,w,b]);const O=null!==(f=null===r||void 0===r?void 0:r.coarse)&&void 0!==f?f:15,T=null!==(p=null===r||void 0===r?void 0:r.fine)&&void 0!==p?p:5;uw((()=>{if(t||null==Z)return;const e=h.current;iN(e,"Element ref not attached");return function(e,n,t,r,o){var i;const{ownerDocument:a}=n,l={direction:t,element:n,hitAreaMargins:r,setResizeHandlerState:o},s=null!==(i=Kw.get(a))&&void 0!==i?i:0;return Kw.set(a,s+1),Jw.add(l),rN(),function(){var n;Gw.delete(e),Jw.delete(l);const t=null!==(n=Kw.get(a))&&void 0!==n?n:1;if(Kw.set(a,t-1),rN(),1===t&&Kw.delete(a),Ww.includes(l)){const e=Ww.indexOf(l);e>=0&&Ww.splice(e,1),tN(),o("up",!0,null)}}}(w,e,g,{coarse:O,fine:T},((e,n,t)=>{if(n)switch(e){case"down":{S("drag"),iN(t,'Expected event to be defined for "down" action'),y(w,t);const{onDragging:e}=v.current;e&&e(!0);break}case"move":{const{state:e}=I.current;"drag"!==e&&S("hover"),iN(t,'Expected event to be defined for "move" action'),Z(t);break}case"up":{S("hover"),C();const{onDragging:e}=v.current;e&&e(!1);break}}else S("inactive")}))}),[O,g,t,T,b,w,Z,y,C]),function({disabled:e,handleId:n,resizeHandler:t,panelGroupElement:r}){uw((()=>{if(e||null==t||null==r)return;const o=mN(n,r);if(null==o)return;const i=e=>{if(!e.defaultPrevented)switch(e.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":e.preventDefault(),t(e);break;case"F6":{e.preventDefault();const t=o.getAttribute("data-panel-group-id");iN(t,`No group element found for id "${t}"`);const i=fN(t,r),a=pN(t,n,r);iN(null!==a,`No resize element found for id "${n}"`),i[e.shiftKey?a>0?a-1:i.length-1:a+1<i.length?a+1:0].focus();break}}};return o.addEventListener("keydown",i),()=>{o.removeEventListener("keydown",i)}}),[r,e,n,t])}({disabled:t,handleId:w,resizeHandler:Z,panelGroupElement:j});return rw(c,{...d,children:e,className:n,id:o,onBlur:()=>{_(!1),null===i||void 0===i||i()},onFocus:()=>{_(!0),null===l||void 0===l||l()},ref:h,role:"separator",style:{touchAction:"none",userSelect:"none",...s},tabIndex:u,"data-panel-group-direction":g,"data-panel-group-id":x,"data-resize-handle":"","data-resize-handle-active":"drag"===N?"pointer":k?"keyboard":void 0,"data-resize-handle-state":N,"data-panel-resize-handle-enabled":!t,"data-panel-resize-handle-id":w})}ON.displayName="PanelGroup",TN.displayName="forwardRef(PanelGroup)",LN.displayName="PanelResizeHandle";var MN=function(e){var n=e.className,t=(0,be.Z)(e,["className"]);return(0,i.jsx)(TN,(0,m.Z)({className:y()("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",n)},t))},PN=ww,RN=function(e){var n=e.className,t=(0,be.Z)(e,["className"]);return(0,i.jsx)(LN,(0,m.Z)({className:y()("relative flex w-px items-center justify-center bg-structure-default after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-active focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90",n)},t))},FN=t(21941);function zN(){var e=(0,o.Z)(["\n  .react-flow__node {\n    cursor: default;\n  }\n\n  .react-flow__edge-path {\n    stroke: var(--text-link);\n    stroke-width: 1;\n    fill: none;\n  }\n\n  .react-flow__connection-path {\n    stroke: var(--text-link);\n  }\n"]);return zN=function(){return e},e}var BN=function(e){var n,t,o,a=e.startTemplate,s=(0,l.useState)(a),u=s[0],c=s[1],d=(0,r.Z)((0,Pa.KO)(nf),2),f=d[0],p=d[1],h=(0,r.Z)((0,Pa.KO)(tf),2),v=h[0],x=h[1],b=(0,l.useState)(!1),y=b[0],C=b[1],j=(0,l.useState)(!1),w=j[0],N=j[1],S=(0,My.w$)({templateId:u.id,version:u.version}),k=S.nodes,_=S.setNodes,Z=S.loading,E=S.error,I=function(e){var n=e.template,t=e.nodes,r=e.setTemplate,o=(0,My.rx)(),i=(0,My.hP)(),a=(0,l.useState)(!1),s=a[0],u=a[1],c=(0,Aj.NL)(),d=t.some((function(e){var n;return!0===(null===(n=e.temp_props)||void 0===n?void 0:n.hasError)}));return(0,l.useEffect)((function(){(0,Tj.p)({updated:n.updated,published:n.published})?u(!1):u(!0)}),[n.updated,n.published]),{published:s,publish:function(){d||(i(n,t),o(n,t).then((function(e){return r((function(n){return(0,m.Z)({},n,e)}))})),u(!0),c.invalidateQueries({queryKey:[Ty.k,n.id]}))},hasErrors:d}}({template:u,setTemplate:c,nodes:k}),O=I.publish,T=I.published,A=I.hasErrors,D=(0,Pa.b9)(ef),L=xj({nodes:k,template:u,setTemplate:c,ready:!Z&&!E,onUndoRedo:function(e){_(e.nodes),c(e.template)}}),M=(0,r.Z)((0,FN.ZP)({templateId:u.id}),2),P=M[0],R=M[1],F=R.saveAutomationTestEvent,z=R.deleteAutomationTestEvent,B=(0,l.useMemo)((function(){var e,n;return null!==(o=null===P||void 0===P||null===(e=P.data)||void 0===e||null===(n=e.automationTestEvents)||void 0===n?void 0:n.nodes)&&void 0!==o?o:[]}),[null===P||void 0===P||null===(n=P.data)||void 0===n||null===(t=n.automationTestEvents)||void 0===t?void 0:t.nodes]);(0,l.useEffect)((function(){return function(){x(null)}}),[x]);var H=function(e){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];c((function(t){return n?(0,g.Z)((0,m.Z)({},e),{updated:(new Date).toISOString()}):(0,m.Z)({},t,e)})),L(!0)},V=(0,l.useCallback)((function(e){_((function(n){var t=n.map((function(n){return n.id!==e.id?n:jj()({},n,e)})),r=Object.keys(e).some((function(e){return"id"!==e&&"temp_props"!==e}));return v&&r&&N(!0),L(r),t}))}),[_,v,L]),$=(0,l.useCallback)((function(e){_((function(n){var t=n.map((function(n){return n.id!==e.id?n:e}));return v&&N(!0),L(!0),t}))}),[_,v,L]),U=function(e){"delay"===e.type&&(e.duration="P1D"),_((function(n){return v&&N(!0),L(!0),n.map((function(e){return(0,g.Z)((0,m.Z)({},e),{temp_props:(0,g.Z)((0,m.Z)({},e.temp_props),{selected:!1})})})).concat((0,g.Z)((0,m.Z)({},e),{temp_props:{selected:!0}}))}))},W=function(e){_((function(n){return n.filter((function(n){return v&&N(!0),L(!0),n.id!==e||"trigger"===n.type}))}))},q=function(e){var n,t=(0,l.useMemo)((function(){return Yf(e.nodes,e.onNodeChange,e.onNodeSet)}
1),[e.nodes,e.onNodeChange,e.onNodeSet]),r=(0,l.useMemo)((function(){return Qf(e.nodes)}),[e.nodes]);return{nodes:t,edges:r,onEdgesChange:lp({edges:r,nodes:null!==(n=e.nodes)&&void 0!==n?n:[],onNodeChange:e.onNodeChange}),onNodesChange:up(e),onConnect:cp(e.nodes,e.onNodeChange)}}({nodes:k,onNodeChange:V,onRemoveNode:W,onNodeSet:$});return E?(0,i.jsx)("div",{children:"Error loading automation"}):(0,i.jsx)("div",{className:"h-full w-full overflow-hidden",onClick:function(){return D(!1)},children:(0,i.jsxs)(Ma.tV,{children:[(0,i.jsx)(pj,{name:u.name,updatedAt:new Date(u.updated).getTime(),onNameChange:function(e){return H((0,g.Z)((0,m.Z)({},u),{name:e}))},onPublishClick:O,published:T,tab:f,onTabChange:p,onAddNode:U,onAutoArrange:function(){return Mj(k,q.edges).then((function(e){return _((function(){return L(!0),e}))}))},templateId:u.id,hasErrors:A}),(0,i.jsxs)(MN,{direction:"vertical",children:[("design"===f||"run"===f)&&(0,i.jsx)(PN,{defaultSize:50,children:(0,i.jsx)(VN,{template:u,onNodeChange:V,onRemoveNode:W,onTemplateChange:H,setNodes:_,onNodeSet:$,onAddNode:U,flowStateProps:Z?null:q,isPublished:T,debugMode:"run"===f,nodesSelectable:!("run"===f&&(y||!v))})}),"run"===f&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(RN,{}),(0,i.jsx)(PN,{defaultSize:50,children:(0,i.jsx)(Qj,{templateId:u.id,runId:v,setRunId:x,isRunning:y,setIsRunning:C,testEvents:B,saveAutomationTestEvent:F,deleteAutomationTestEvent:z,runIsOutdated:w,setRunIsOutdated:N})})]}),"invoke"===f&&(0,i.jsx)(Ij,{templateId:u.id}),"source"===f&&(0,i.jsx)(wj,{nodes:k}),"settings"===f&&(0,i.jsx)(Oj,{template:u,onChange:H})]})]})})},HN=u.default.div(zN()),VN=function(e){var n=e.template,t=e.isPublished,r=e.debugMode,o=e.nodesSelectable,a=e.onRemoveNode,s=e.onNodeChange,u=e.onAddNode,c=e.onNodeSet,d=e.onTemplateChange,f=e.setNodes,p=(0,l.useState)(null),h=p[0],v=p[1],x=(0,ti.WX)((function(e){return e.brands.fetch})),b=(0,ti.WX)((function(e){return e.notifications.fetch})),y=function(){var e=(0,Ma._K)(),n=e.getNodes,t=e.getEdges,r=(0,l.useCallback)((function(e){var r=n(),o=t(),i=r.find((function(n){return n.id===e.target})),a=function(n){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Set;if(t.has(n.id))return!1;t.add(n.id);var i=!0,l=!1,s=void 0;try{for(var u,c=(0,Ma.xA)(n,r,o)[Symbol.iterator]();!(i=(u=c.next()).done);i=!0){var d=u.value;if(d.id===e.source)return!0;if(a(d,t))return!0}}catch(AS){l=!0,s=AS}finally{try{i||null==c.return||c.return()}finally{if(l)throw s}}};return i.id!==e.source&&!a(i)}),[n,t]);return r}();(0,l.useEffect)((function(){x(),b()}),[x,b]);var C=function(){v(null)};return(0,i.jsxs)(HN,{className:(0,Jd.cx)("relative flex h-[calc(100vh-64px)] w-full"),children:[(0,i.jsx)(J.Lo0,{className:"absolute h-full w-full bg-background-dotgrid text-background-dotgrid-dot"}),(0,i.jsx)(zx,{templateId:n.id,onAddNode:u,onRemoveNode:a,nodeId:h,onPaneClick:C,debugMode:r,children:(0,i.jsx)(Ma.x$,(0,g.Z)((0,m.Z)({},e.flowStateProps),{isValidConnection:y,minZoom:.1,nodeTypes:$N,panOnScroll:!0,proOptions:{hideAttribution:!0},onNodeContextMenu:function(e,n){v(n.id)},onPaneClick:C,fitView:!0,fitViewOptions:{maxZoom:.8},edgesUpdatable:!r,edgesFocusable:!r,nodesDraggable:!r,nodesConnectable:!r,nodesFocusable:!r,deleteKeyCode:r?null:"Backspace",elementsSelectable:o}))}),!r&&(0,i.jsx)(nj,{onNodeChange:s,onNodeSet:c,onTemplateChange:d,setNodes:f,template:n,isPublished:t})]})},$N=(0,g.Z)((0,m.Z)({},Gd),{trigger:function(e){var n,t,r,o=e.data,a=e.selected,l=(0,Pa.Dv)(nf),s=Boolean(null===o||void 0===o||null===(n=o.node)||void 0===n||null===(t=n.temp_props)||void 0===t?void 0:t.debugError),u=ff(),c={selected:a,debugError:s};c.prevOfSelected=(null===u||void 0===u?void 0:u.id)===(null===o||void 0===o||null===(r=o.node)||void 0===r?void 0:r.id);var d=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=Yd(e);return{sourceName:Qd.get(t),icon:(0,i.jsx)(Xd,{bg:n.error?"bg-[#FF33631A]":void 0,selected:n.selected})}}(o.node,c),f=d.icon,p=d.sourceName,h=af(c,l);return(0,i.jsxs)("div",{className:(0,Jd.cx)("h-[74px] w-[360px] rounded-full p-4 font-text",h),children:[(0,i.jsxs)("div",{className:"flex h-full w-full items-center justify-start gap-3",children:[f,(0,i.jsxs)("div",{className:"flex w-full max-w-[274px] flex-col",children:[(0,i.jsx)(cf.default,{variant:"regular-sm",className:(0,Jd.cx)(c.selected?"text-content":"text-label"),children:"Invoke via"}),p&&(0,i.jsx)(cf.default,{variant:"regular-sm",className:"overflow-hidden truncate text-content",children:p})]})]}),(0,i.jsx)(of,{status:c})]})},batch:function(e){var n,t,r,o,a,l,s,u=e.data,c=null===(n=u.node.properties)||void 0===n?void 0:n.edited,d=Cf(u.node),f=null===u||void 0===u||null===(t=u.node)||void 0===t?void 0:t.wait_period,p=null===u||void 0===u||null===(r=u.node)||void 0===r?void 0:r.max_wait_period,h=null===u||void 0===u||null===(o=u.node)||void 0===o||null===(a=o.retain)||void 0===a?void 0:a.type,v=null===u||void 0===u||null===(l=u.node)||void 0===l||null===(s=l.retain)||void 0===s?void 0:s.count;return(0,i.jsx)(vf,{icon:(0,i.jsx)(jf,{configured:!0,selected:d.selected}),actionName:c?(0,i.jsx)(wf,{retainType:h,count:v}
1):"Batch",actionDescription:Nf({waitPeriod:f,maxWaitPeriod:p}),status:d,configured:!(!f||!p)})},switch:function(e){var n,t=e.id,r=e.data,o=Cf(r.node),a=r.node,s=(0,Ma.Bn)(),u=(0,Pa.Dv)(nf),c=af(o,u),d=null!==(n=a.cases)&&void 0!==n?n:[];return(0,l.useEffect)((function(){s(t)}),[t,s]),(0,i.jsxs)("div",{className:(0,Jd.cx)("h-fit w-[360px] overflow-visible rounded-lg font-text",c),children:[(0,i.jsxs)("div",{className:"flex h-[74px] w-full items-center justify-between",children:[(0,i.jsxs)("div",{className:"flex h-full w-full flex-grow items-center space-x-4 p-4",children:[(0,i.jsx)(Zf,{configured:a.properties.edited,selected:o.selected}),(0,i.jsx)("div",{className:"flex w-full flex-col overflow-hidden align-middle text-sm",children:(0,i.jsx)(cf.default,{variant:"regular-xs",className:"text-label",children:"Switch"})})]}),(0,i.jsxs)("div",{className:"flex items-center",children:[(0,i.jsx)(cf.default,{variant:"regular-sm",className:"text-subtext",children:"Default"}),(0,i.jsx)(Sf,{status:o,id:"handle-default"})]})]}),!!d.length&&(0,i.jsx)("div",{className:"h-fit w-full divide-x-0 divide-y divide-solid divide-structure-border border-0 border-t border-solid border-structure-border",children:d.map((function(e,n){return(0,i.jsxs)("div",{className:"flex h-[50px] w-full items-center justify-between",children:[(0,i.jsx)("div",{className:"text-ellipsis p-4",children:(0,i.jsx)(kf,{condition:e.condition})}),(0,i.jsxs)("div",{className:"flex items-center",children:[(0,i.jsxs)(cf.default,{variant:"regular-sm",className:"text-subtext",children:["Case ",n+1]}),(0,i.jsx)(Sf,{status:o,id:"handle-".concat(n)})]})]},n)}))}),(0,i.jsx)(pf,{status:o})]})},delay:function(e){var n=e.data,t=Cf(n.node),r=Tf(n.node);return(0,i.jsx)(vf,{icon:(0,i.jsx)(Of,{configured:!0,selected:t.selected}),actionName:"Delay",actionDescription:r||"Select time",status:t,configured:!!r})},cancel:function(e){var n,t=e.data,r=Cf(t.node),o=null===t||void 0===t||null===(n=t.node)||void 0===n?void 0:n.cancelation_token,a=!!o;return(0,i.jsx)(vf,{icon:(0,i.jsx)(Af,{configured:a,selected:r.selected}),actionName:a?"Cancel automation with token":"Cancel automation",actionDescription:o||"Insert cancel token",status:r,configured:a})},"add-to-digest":function(e){var n,t,r,o=e.data,a=Cf(o.node),l=null===o||void 0===o||null===(n=o.node)||void 0===n?void 0:n.subscription_topic_id,s=(0,Es.sG)(l);return(0,i.jsx)(vf,{icon:(0,i.jsx)(Df,{configured:null===o||void 0===o||null===(t=o.node)||void 0===t||null===(r=t.properties)||void 0===r?void 0:r.edited,selected:a.selected}),actionName:"Add to digest",actionDescription:s?s.label:"Select subscription topic",status:a,configured:!!s})},invoke:function(e){var n,t,r,o,a=e.data,l=Cf(a.node),s=null===a||void 0===a||null===(n=a.node)||void 0===n?void 0:n.template_id,u=null===a||void 0===a||null===(t=a.node)||void 0===t?void 0:t.passContext;return(0,i.jsx)(vf,{icon:(0,i.jsx)(Lf,{configured:null===a||void 0===a||null===(r=a.node)||void 0===r||null===(o=r.properties)||void 0===o?void 0:o.edited,selected:l.selected}),actionName:(0,i.jsx)(Mf,{passContext:u}),actionDescription:s||"Select template",status:l,configured:!!s})},"update-profile":function(e){var n,t,r,o=e.data,a=Cf(o.node),l=null===o||void 0===o||null===(n=o.node)||void 0===n?void 0:n.user_id;return(0,i.jsx)(vf,{icon:(0,i.jsx)(Pf,{configured:null===o||void 0===o||null===(t=o.node)||void 0===t||null===(r=t.properties)||void 0===r?void 0:r.edited,selected:a.selected}),actionName:"Update user profile",actionDescription:l||"Select parameters",status:a,configured:!!l})},"subscribe-to-list":function(e){var n,t,r,o=e.data,a=Cf(o.node),l=null===o||void 0===o||null===(n=o.node)||void 0===n?void 0:n.list_id;return(0,i.jsx)(vf,{icon:(0,i.jsx)(Rf,{configured:null===o||void 0===o||null===(t=o.node)||void 0===t||null===(r=t.properties)||void 0===r?void 0:r.edited,selected:a.selected}),actionName:"Subscribe user to list",actionDescription:l?"".concat(l):"Select list",status:a,configured:!!l})},"send-to-list":function(e){var n,t,r,o=e.data,a=Cf(o.node),l=null===o||void 0===o||null===(n=o.node)||void 0===n?void 0:n.list_id;return(0,i.jsx)(vf,{icon:(0,i.jsx)(Ff,{configured:null===o||void 0===o||null===(t=o.node)||void 0===t||null===(r=t.properties)||void 0===r?void 0:r.edited,selected:a.selected}),actionName:"Send to list",actionDescription:l||"Select list",status:a,configured:!!l})},throttle:function(e){var n,t,r,o,a=e.data,l=Cf(a.node),s=null===a||void 0===a||null===(n=a.node)||void 0===n?void 0:n.period,u=null===a||void 0===a||null===(t=a.node)||void 0===t?void 0:t.max_allowed;return(0,i.jsx)(Bf,{icon:(0,i.jsx)(Hf,{configured:null===a||void 0===a||null===(r=a.node)||void 0===r||null===(o=r.properties)||void 0===o?void 0:o.edited,selected:l.selected}),actionName:(0,i.jsx)(Vf,{maxAllowed:u}),actionDescription:$f(s),status:l,firstSourceLabel:"Throttled",secondSourceLabel:"Unthrottled",firstSourceId:"on-throttle",secondSourceId:"nominal",configured:!!s})},if:function(e){var n=e.data,t=Cf(n.node);return(0,i.jsx)(Bf,{icon:(0,i.jsx)(Uf,{configured:t.edited,selected:t.selected}),actionName:"If",status:t,firstSourceLabel:"True",secondSourceLabel:"False",firstSourceId:"true",secondSourceId:"false"})},send:function(e){var n,t,r,o=e.data,a=Cf(o.node),l=null===o||void 0===o||null===(n=o.node)||void 0===n?void 0:n.message,s=null===l||void 0===l?void 0:l.template,u=(0,Es.$y)(s),c=(null===u||void 0===u?void 0:u.label)?u.label:"content"in l?"Elemental Template":void 0,d=Array.isArray(null===l||void 0===l?void 0:l.to)||null===l||void 0===l?void 0:l.to;return(0,i.jsx)(vf,{icon:(0,i.jsx)(Wf,{configured:null===o||void 0===o||null===(t=o.node)||void 0===t||null===(r=t.properties)||void 0===r?void 0:r.edited,selected:a.selected}),actionName:(0,i.jsx)(qf,{recipient:d}),actionDescription:null!==c&&void 0!==c?c:"Select template",status:a,configured:!!c})},fetch:function(e){var n,t,r,o,a,l=e.data,s=Cf(l.node),u=null===l||void 0===l||null===(n=l.node)||void 0===n?void 0:n.url,c=null===l||void 0===l||null===(t=l.node)||void 0===t||null===(r=t.method)||void 0===r?void 0:r.toUpperCase();return(0,i.jsx)(vf,{icon:(0,i.jsx)(Kf,{configured:null===l||void 0===l||null===(o=l.node)||void 0===o||null===(a=o.properties)||void 0===a?void 0:a.edited,selected:s.selected}),actionName:(0,i.jsx)(Gf,{method:c,url:u}),actionDescription:u||"Set URL",configured:!!u,status:s})},"get-profile":function(e){var n,t,r,o=e.data,a=Cf(o.node),l=null===o||void 0===o||null===(n=o.node)||void 0===n?void 0:n.user_id;return(0,i.jsx)(vf,{icon:(0,i.jsx)(Jf,{configured:null===o||void 0===o||null===(t=o.node)||void 0===t||null===(r=t.properties)||void 0===r?void 0:r.edited,selected:a.selected}),actionName:"Get profile",actionDescription:l||"Select parameters",status:a,configured:!!l})}}),UN=function(){return(0,i.jsxs)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-icon-default",children:[(0,i.jsx)("path",{d:"M17 12H15C13.9 12 13 11.1 13 10V8C13 7.45 12.55 7 12 7C11.45 7 11 7.45 11 8V10C11 11.1 10.1 12 9 12H7C5.35 12 4 13.35 4 15V16C4 16.55 4.45 17 5 17C5.55 17 6 16.55 6 16V15C6 14.45 6.45 14 7 14H9C10.19 14 11.27 13.47 12 12.64C12.73 13.47 13.81 14 15 14H17C17.55 14 18 14.45 18 
115V16C18 16.55 18.45 17 19 17C19.55 17 20 16.55 20 16V15C20 13.35 18.65 12 17 12Z",fill:"currentColor"}),(0,i.jsx)("path",{d:"M16 1H8C7.44772 1 7 1.44772 7 2V5C7 5.55228 7.44772 6 8 6H16C16.5523 6 17 5.55228 17 5V2C17 1.44772 16.5523 1 16 1Z",fill:"currentColor"}),(0,i.jsx)("path",{d:"M9 18H1C0.447715 18 0 18.4477 0 19V22C0 22.5523 0.447715 23 1 23H9C9.55229 23 10 22.5523 10 22V19C10 18.4477 9.55229 18 9 18Z",fill:"currentColor"}),(0,i.jsx)("path",{d:"M23 18H15C14.4477 18 14 18.4477 14 19V22C14 22.5523 14.4477 23 15 23H23C23.5523 23 24 22.5523 24 22V19C24 18.4477 23.5523 18 23 18Z",fill:"currentColor"})]})};function WN(){var e=(0,o.Z)(["\n  padding: 24px;\n"]);return WN=function(){return e},e}function qN(){var e=(0,o.Z)(['\n  height: 40px;\n  margin-top: 16px;\n  cursor: grab;\n\n  /* Button Layout */\n  box-sizing: border-box;\n\n  /* Auto layout */\n\n  display: flex;\n  flex-direction: row;\n  align-items: flex-start;\n  padding: 8px;\n  gap: 8px;\n\n  border-radius: 6px;\n\n  font-family: "Inter";\n  font-style: normal;\n  font-weight: 400;\n  font-size: 14px;\n  line-height: 21px;\n  display: flex;\n  align-items: center;\n']);return qN=function(){return e},e}function KN(){var e=(0,o.Z)(["\n  padding-top: 8px;\n"]);return KN=function(){return e},e}function GN(){var e=(0,o.Z)(['\n  font-family: "Inter";\n  font-style: normal;\n  font-weight: 700;\n  font-size: 12px;\n  line-height: 16px;\n  display: flex;\n  align-items: center;\n  letter-spacing: 0.12em;\n  text-transform: uppercase;\n\n  margin-left: 8px;\n']);return GN=function(){return e},e}function JN(){var e=(0,o.Z)(["\n  box-sizing: border-box;\n  min-width: 264px;\n  border-right: 1px solid #dcdee4;\n  max-height: 100%;\n  overflow-y: auto;\n"]);return JN=function(){return e},e}var XN=(0,u.default)(bu)(WN()),YN=u.default.div(qN()),QN=u.default.div(KN()),eS=u.default.div(GN()),nS=u.default.div(JN()),tS=function(e,n){var t=(0,Pa.b9)(cl),r=(0,Pa.b9)(dl),o=function(){r(!1),t(!1)},a=function(e){e.target.style.opacity="0.1"},s=function(e){e.target.style.opacity="1"};return(0,l.useEffect)((function(){var e=document.querySelectorAll(".accordion-item");return e.forEach((function(e){e.addEventListener("dragstart",a),e.addEventListener("dragend",s)})),function(){e.forEach((function(e){e.removeEventListener("dragstart",a),e.removeEventListener("dragend",s)}))}}),[e]),(0,i.jsx)(QN,{children:e.map((function(e){return(0,i.jsxs)(YN,{onDragStart:function(o){return function(e,o){e.dataTransfer.setData("groupType",n),e.dataTransfer.setData("nodeType",o.type),e.dataTransfer.setData("triggerType",o.triggerType),e.dataTransfer.setData("eventSource",o.eventSource),e.dataTransfer.effectAllowed="move","trigger"===n?r(!0):t(!0)}(o,e)},onDragEnd:o,draggable:!0,className:y()("accordion-item border border-solid border-default text-text-default","trigger"===n?"bg-table-row-odd":""),children:[(0,i.jsx)(J.GgY,{className:"pointer-events-none h-6 w-6 text-icon-default"}),e.name,"segment"===e.triggerType&&(0,i.jsx)(Cs,{className:"pointer-events-none ml-auto"}),"inbound-event"===e.triggerType&&"rudderstack"===e.eventSource&&(0,i.jsx)(Ls,{className:"pointer-events-none ml-auto"})]},e.name)}))})},rS=function(){var e=(0,r.Z)((0,Pa.KO)(hl),2),n=e[0],t=e[1],o=(0,r.Z)((0,Pa.KO)(pl),2),s=o[0],u=o[1],c=(0,l.useState)(!1),d=c[0],f=c[1],p=(0,z.ye)("courier-inbound-track"),h=(0,z.ye)("webhook-trigger-integration"),v=(0,z.ye)("digests"),m=(0,z.ye)("throttle"),g=(0,z.ye)("batching"),x=(0,a.useRouter)().query.tab,b=[{name:"Audience",type:"trigger",triggerType:"audience"}].concat((0,N.Z)(v?[{name:"Digest",type:"trigger",triggerType:"digest"}]:[]),[{name:"Schedule",type:"trigger",triggerType:"schedule"},{name:"Segment",type:"trigger",triggerType:"segment"},{name:"Rudderstack",type:"trigger",triggerType:"inbound-event",eventSource:"rudderstack"}]);p&&b.push({name:"Courier",type:"trigger",triggerType:"inbound-event",eventSource:"courier"}),h&&b.push({name:"Webhook",type:"trigger",triggerType:"webhook"});var C=(0,N.Z)(v?[{name:"Add to Digest",type:"add-to-digest"}]:[]).concat((0,N.Z)(g?[{name:"Add to Batch",type:"batch"}]:[]),(0,N.Z)(m?[{name:"Throttle",type:"throttle"}]:[]),[{name:"Cancel Automation",type:"cancel"},{name:"Delay",type:"delay"},{name:"Fetch Data",type:"fetch"},{name:"Invoke Automation",type:"invoke"},{name:"Send",type:"send"},{name:"Send to List",type:"send-to-list"},{name:"Subscribe to List",type:"subscribe-to-list"},{name:"Update Profile",type:"update-profile"}]);return(0,i.jsx)(nS,{className:"border-l-0 border-default bg-background-panels",children:(0,i.jsxs)("div",{className:y()({"pointer-events-none opacity-10":"code"===x||"settings"===x||"invoke"===x}),children:[(0,i.jsx)(XN,{className:"border-0 border-b border-solid border-default",isOpen:s,onExpandClick:function(){return u(!s)},title:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(il,{}),(0,i.jsx)(eS,{className:"text-text-default",children:"Triggers"})]}),children:tS(b,"trigger")}),(0,i.jsx)(XN,{className:"border-0 border-b border-solid border-default",isOpen:n,onExpandClick:function(){return t(!n)},title:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(Xs,{}),(0,i.jsx)(eS,{className:"text-text-default",children:"Actions"})]}),children:tS(C,"action")}),(0,i.jsx)(XN,{className:"border-0 border-b border-solid border-default",isOpen:d,onExpandClick:function(){return f(!d)},title:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(UN,{}),(0,i.jsx)(eS,{className:"text-text-default",children:"Control Flow"})]}),children:tS([{name:"If",type:"if"}],"conditional")})]})})};function oS(e){var n=e.reactFlowInstance,t=e.reactFlowWrapper,r=e.templateId,o=e.onAddNode,i=e.onNodeChange,a=e.onNodeSet,s=(0,Pa.b9)(pl),u=(0,Pa.b9)(hl);return(0,l.useCallback)((function(e){if(e.preventDefault(),(0,eu.Z)(e.target,Element)){var l=e.dataTransfer.getData("nodeType"),c=e.dataTransfer.getData("triggerType"),d=e.dataTransfer.getData("eventSource");if(l){var f=t.current.getBoundingClientRect(),p=function(e){var n=e.type,t=e.position,r=e.templateId,o=e.triggerType,i=e.eventSource,a=e.onChange,l=e.onSet,s="placeholder"===n?"action-placeholder":zi().v4();return{id:s,type:n,position:t,data:{node:(0,Px.w)({type:n,id:s,position:t,templateId:r,triggerType:o,eventSource:i}),onChange:function(e){return a((0,m.Z)({id:s},e))},onSet:l}}}({type:l,position:n.project({x:e.clientX-f.left,y:e.clientY-f.top}),triggerType:c,eventSource:d,templateId:r,onChange:i,onSet:a});o(p.data.node),"trigger"===p.data.node.type&&(s(!1),u(!0))}}}),[n,r,o,t,s,u,i,a])}var iS=t(50355),aS=function(){return(0,i.jsx)(iS.default,{arrow:!1,placement:"top-start",className:"bg-background-panels shadow-heron-card",content:(0,i.jsxs)("div",{className:"rounded-md bg-background-panels p-3 font-inter text-text-default",children:[(0,i.jsx)("h3",{className:"m-1 mt-0 p-0 font-semibold",children:"Controls"}),(0,i.jsxs)("ul",{className:"m-0 p-0 pl-4",children:[(0,i.jsx)("li",{children:"pan: space + drag mouse, scroll, middle or right mouse"}),(0,i.jsx)("li",{children:"zoom: pinch or cmd + scroll "}),(0,i.jsx)("li",{children:"create selection: drag mouse"})]})]}),children:(0,i.jsx)("div",{className:"flex",children:(0,i.jsx)(J.I$T,{className:"h-6 w-6 text-icon-default"})})})},lS=t(39097),sS=t.n(lS),uS=t(40697),cS=t(81321),dS=t(17276),fS=function(e){var n=e.templateId,t=e.name,o=e.onNameChange,s=e.onNameBlur,u=e.onPublish,c=e.updatedAt,d=e.published,f=(0,a.useRouter)().query,h=(0,dS.V$)(),v=f.tab,m=(0,p.Z)((function(e){return e.automationTemplates.canListItems()})),g=(0,p.Z)((function(e){return e.automationTemplates.canWriteItem(n)})),x=(0,p.Z)((function(e){return e.automationTemplates.canPublishItem(n)})),b=[{name:"Design",value:"design",href:h.assets.automations.design(n)},{name:"Code",value:"code",href:h.assets.automations.code(n)},{name:"Invoke",value:"invoke",href:h.assets.automations.invokeV2(n)},{name:"Settings",value:"settings",href:h.assets.automations.settings(n)}],y=(0,l.useState)(v||b[0].value),C=y[0],j=y[1],w=(0,r.Z)(D.Modal.useModal(),2),N=w[0],S=w[1];return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(N,{styles:{body:{width:"600px",height:"400px"},backdrop:{backgroundColor:"rgba(36, 40, 45, 0.5)"}},className:"bg-background-panels shadow-heron-card",children:(0,i.jsx)(cS.D,{templateId:n,templateName:t,close:function(){return S.setClosed()}})}),(0,i.jsxs)("header",{className:"flex h-[72px] items-center border-0 border-b border-solid border-default bg-background-panels px-6 py-4",children:[(0,i.jsx)("div",{className:"flex w-[300px] flex-col justify-center",children:m?(0,i.jsxs)(i.Fragment,{children:[g&&"Loading..."!==t?(0,i.jsx)(D.EditableText,{widthIsDynamic:!1,inputStyle:{fontFamily:"Inter",fontSize:"16px",fontWeight:600,lineHeight:"24px"},inputClassName:"text-text-default",placeholder:"Untitled Automation",renderText:function(e){return(0,i.jsx)("h2",{className:"m-0 font-inter text-base font-semibold text-text-default",children:e})},value:t,onChange:o,onBlur:s}):(0,i.jsx)("h2",{className:"m-0 font-inter text-base font-semibold text-text-default",children:t}),(0,i.jsxs)("div",{children:[(0,i.jsx)(uS.Z,{className:"text-text-link"}),(0,i.jsx)(sS(),{href:h.assets.automations.list,legacyBehavior:!0,children:(0,i.jsx)("a",{className:"list-link ml-1 font-inter text-sm font-normal not-italic text-link",children:"Assets"})})]})]}):(0,i.jsx)("h2",{className:"m-0 font-inter text-base font-semibold text-text-default",children:"Automation Templates"})}),(0,i.jsxs)("div",{className:"flex w-full items-center justify-between",children:[(0,i.jsx)("div",{children:(0,i.jsx)("nav",{className:"flex space-x-2","aria-label":"Tabs",children:b.map((function(e){return(0,i.jsx)(sS(),{replace:!0,shallow:!0,href:e.href,"aria-current":e.value===C?"page":void 0,legacyBehavior:!0,children:(0,i.jsx)("button",{className:"cursor-pointer rounded-md border-none px-3 py-2 font-inter text-sm font-semibold ".concat(e.value===C?"bg-background-active-link text-text-active":"bg-transparent text-button hover:bg-background-active-link"),onClick:function(){return n=e.value,void j(n);var n},children:e.name})},e.value)}))})}),(0,i.jsx)("div",{children:(0,i.jsx)(Mi._q,{readOnly:!x,disabled:d,disablePulse:!0,created:c,onClick:u,buttonClassName:"bg-button-green bg-none",timeStyle:{fontFamily:"Inter",fontStyle:"normal",fontWeight:"normal",fontSize:"14px",lineHeight:"21px"},menuItems:[x?{label:"Copy Template",name:"copy",onClick:function(e){return(n=e).preventDefault(),n.stopPropagation(),void S.setOpen();var n}}
1:void 0].filter(Boolean)})})]})]})]})},pS=t(12533);function hS(e,n){var t,o,i=(0,r.Z)((0,pS.n)(n),2),a=i[0],l=i[1],s=e.filter((function(e){return"trigger"===e.type})),u=null!==(t=s[0])&&void 0!==t?t:a,c=e.filter((function(e){return"trigger"!==e.type}));if(2===s.length)return function(e){var n,t=e.triggers,r=e.actions,o=t[1],i=t[0];o.next_step=i.next_step,o.properties=(0,g.Z)((0,m.Z)({},o.properties),{position:null===(n=i.properties)||void 0===n?void 0:n.position});var a=vS({newTrigger:o,oldTrigger:i,actions:r});return[o].concat((0,N.Z)(a))}({triggers:s,actions:c});if(1===s.length&&1===c.length&&"placeholder"===c[0].type){var d=vS({newTrigger:s[0],oldTrigger:null,actions:c});return[u].concat((0,N.Z)(d))}if(2===c.length&&"placeholder"===c[0].type)return[(0,g.Z)((0,m.Z)({},u),{next_step:{$node_id:c[1].id}}),(0,g.Z)((0,m.Z)({},c[1]),{properties:(0,g.Z)((0,m.Z)({},c[1].properties),{position:null===(o=c[0].properties)||void 0===o?void 0:o.position})})];if(!c.length){var f=vS({newTrigger:s[0],oldTrigger:null,actions:[l]});return[(0,g.Z)((0,m.Z)({},u),{next_step:{$node_id:l.id}})].concat((0,N.Z)(f))}return[u].concat((0,N.Z)(c))}function vS(e){var n,t,r={"api-invoke":122,segment:122,audience:122,schedule:318},o=e.newTrigger,i=e.oldTrigger,a=function(e){var n=e.nodes,t=e.yOffset,r=e.yThreshold;return 0===t?n:n.map((function(e){var n,o,i,a;return(0,g.Z)((0,m.Z)({},e),{properties:(0,g.Z)((0,m.Z)({},e.properties),{position:(0,g.Z)((0,m.Z)({},null===(n=e.properties)||void 0===n?void 0:n.position),{y:(null===(o=e.properties)||void 0===o?void 0:o.position.y)<r?(null===(i=e.properties)||void 0===i?void 0:i.position.y)+t:null===(a=e.properties)||void 0===a?void 0:a.position.y})})})}))}({nodes:e.actions,yOffset:r[o.trigger_type]-(null!==(t=r[null===i||void 0===i?void 0:i.trigger_type])&&void 0!==t?t:r["api-invoke"]),yThreshold:(null===(n=o.properties)||void 0===n?void 0:n.position.y)+r[o.trigger_type]});return a}function mS(){var e=(0,o.Z)(["\n  display: flex;\n  width: 100%;\n  height: calc(100vh - 72px);\n"]);return mS=function(){return e},e}function gS(){var e=(0,o.Z)(["\n  width: 100%;\n  background-color: ",";\n\n  .react-flow__node {\n    cursor: default;\n  }\n  .react-flow__handle-top {\n    top: -6px;\n  }\n  .react-flow__handle-bottom {\n    bottom: -6px;\n  }\n  .react-flow__edge-path {\n    stroke: var(--text-link);\n    stroke-width: 1;\n    fill: none;\n  }\n\n  .react-flow__connection-path {\n    stroke: var(--text-link);\n  }\n"]);return gS=function(){return e},e}var xS=function(e){var n=e.nodes,t=e.template,r=e.onNodeChange,o=e.onNodeSet,s=e.onTemplateChange,u=e.onAddNode,c=e.onInvoke,d=(0,ic.F)().resolvedTheme,f=e.onRemoveNode,p=(0,a.useRouter)().query.tab,v=(0,j.t)(),m=(0,Pa.b9)(ll),g=(0,Pa.b9)(fl),b=(0,l.useState)(!1),y=b[0],C=b[1],w=(0,l.useRef)(null),N=(0,l.useState)(null),S=N[0],k=N[1],_=(0,ti.WX)((function(e){return e.brands.fetch})),Z=(0,ti.WX)((function(e){return e.notifications.fetch}));(0,l.useEffect)((function(){return _(),Z(),function(){g(!1),m(!1)}}),[_,Z,g,m]);var E,I=Yf(n,r,o),O=Qf(n),T=cp(n,r),A=(0,l.useCallback)((function(e){e.preventDefault(),e.dataTransfer.dropEffect="move"}),[]),D=oS({reactFlowWrapper:w,reactFlowInstance:S,templateId:null!==(E=null===t||void 0===t?void 0:t.id)&&void 0!==E?E:"",onAddNode:u,onNodeChange:r,onNodeSet:o}),L=lp({edges:O,onNodeChange:r,nodes:n}),M=up({onNodeChange:e.onNodeChange,onRemoveNode:f}),P=0,R="code"===p||"settings"===p||"invoke"===p,F=(0,l.useMemo)((function(){return op(n)}),[n]),z=function(){var e=(0,h.Z)((function(){return(0,x.__generator)(this,(function(e){switch(e.label){case 0:C(!0),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,c()];case 2:return e.sent(),v.automationInvokedSuccess(),setTimeout((function(){C(!1)}),5e3),[3,4];case 3:return e.sent(),C(!1),v.failedToInvokeAutomation(),[3,4];case 4:return[2]}}
1))}));return function(){return e.apply(this,arguments)}}();return(0,i.jsx)(yS,{children:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(rS,{}),!R&&(0,i.jsx)(wS,{ref:w,children:(0,i.jsxs)(Ma.x$,{defaultEdgeOptions:CS,deleteKeyCode:null,edges:O,minZoom:.1,nodes:I,nodeTypes:Gd,onConnect:T,onDragEnter:function(){P++,g(!0)},onDragLeave:function(){--P>0||g(!1)},onDragOver:A,onDrop:function(e){P=0,g(!1),D(e)},onEdgesChange:L,onInit:k,onNodesChange:M,panOnDrag:!1,panOnScroll:!0,proOptions:{hideAttribution:!0},selectionKeyCode:null,selectionMode:Ma.oW.Partial,selectionOnDrag:!0,children:[(0,i.jsx)(J.Lo0,{className:"absolute h-full w-full text-background-dotgrid-dot"}),(0,i.jsx)(Ma.s_,{position:"bottom-left",children:(0,i.jsx)(aS,{})})]})}),"settings"===p&&t&&(0,i.jsx)(_j,{template:t,onChange:s}),"code"===p&&(0,i.jsx)("div",{className:"flex w-full flex-col bg-background-panels",children:(0,i.jsx)(ui.default,{value:F,themeType:d})}),"invoke"===p&&(0,i.jsx)(Zj,{onClick:z,disabled:y,templateId:null===t||void 0===t?void 0:t.id}),(0,i.jsx)(kc,{})]})})},bS=function(e){var n=e.startTemplate,t=(0,l.useState)(n),r=t[0],o=t[1],a=(0,My.w$)({templateId:null===r||void 0===r?void 0:r.id}),s=a.nodes,u=a.setNodes,c=a.loading,d=a.error,f=(0,My.rx)(),p=(0,My.hP)(),h=(0,My.PY)(r.id),v=xj({nodes:s,template:r,setTemplate:o,ready:!c&&!d}),x=(0,l.useState)(!1),b=x[0],y=x[1],C=function(e){var n=e.templateId,t=e.nodes,r=e.setNodesState,o=(0,Pa.b9)(pl),i=(0,Pa.b9)(hl);return(0,l.useEffect)((function(){var e=t;if(e&&0!==e.length){var n=e.filter((function(e){return"trigger"===e.type}))[0],r=e.filter((function(e){return"trigger"!==e.type&&"placeholder"!==e.type}));"api-invoke"!==(null===n||void 0===n?void 0:n.trigger_type)||r.length?(o(!1),i(!0)):(o(!0),i(!1))}}),[t,i,o]),(0,l.useCallback)((function(e){return r((function(t){return hS("function"===typeof e?e(t):e,n)}))}),[r,n])}({templateId:r.id,nodes:s,setNodesState:u}),j=function(e){o((function(n){return(0,m.Z)({},n,e)})),v(!0)},w=function(e){j((0,g.Z)((0,m.Z)({},r),{name:e}))},N=(0,l.useCallback)((function(e){C((function(n){var t=n.map((function(n){return n.id!==e.id?n:jj()({},n,e)}));return v(!0),t}))}),[C,v]),S=(0,l.useCallback)((function(e){C((function(n){var t=n.map((function(n){return n.id!==e.id?n:e}));return v(!0),t}))}),[C,v]);return(0,l.useEffect)((function(){(0,Tj.p)({updated:r.updated,published:r.published})?y(!1):y(!0)}),[r.published,r.updated]),c?null:d?(0,i.jsx)("div",{children:"Error loading automation"}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(fS,{name:r.name,onNameChange:w,onNameBlur:w,onPublish:function(){p(r,s),f(r,s).then((function(e){return o((function(n){return(0,m.Z)({},n,e)}))})),y(!0)},updatedAt:new Date(r.updated).getTime(),published:b,templateId:r.id}),(0,i.jsx)(xS,{onTemplateChange:j,onAddNode:function(e){C((function(n){return n.concat(e)})),v(!0)},onNodeChange:N,onNodeSet:S,onRemoveNode:function(e){C((function(n){return n.filter((function(n){return n.id!==e}))})),v(!0)},onInvoke:h,template:r,nodes:s})]})},yS=function(e){var n=e.children;return(0,i.jsx)(u.ThemeProvider,{theme:xl,children:(0,i.jsx)(Ma.tV,{children:(0,i.jsx)(jS,{children:n})})})},CS={animated:!0},jS=u.default.div(mS()),wS=u.default.div(gS(),(function(e){return e.theme.colors.canvas})),NS=function(e){var n=e.startTemplate;return"2022-12-01"===n.spec_version?(0,i.jsx)(bS,{startTemplate:n}):"2024-05-09"===n.spec_version?(0,i.jsx)(BN,{startTemplate:n}):(0,i.jsx)("div",{children:"Unrecognized template version"})},SS=t(84697);function kS(){var e=(0,o.Z)(["\n  background-color: ",";\n  display: flex;\n  flex: 1;\n"]);return kS=function(){return e},e}function _S(){var e=(0,o.Z)(["\n  display: flex;\n  flex: 1;\n  flex-direction: column;\n  overflow: hidden;\n"]);return _S=function(){return e},e}var ZS=u.default.div(kS(),(function(e){return e.theme.colors.bgContrast})),ES=u.default.div(_S()),IS=function(){var e=(0,a.useRouter)().query.id,n=(0,Z.X)(e),t=(0,r.Z)((0,Ji.ZP)(e),1)[0],o=t.loading,s=t.data,u=(0,l.useState)(""),c=u[0],d=u[1],f=!!n&&(0,La.T)(n),p=(0,SS.G)(f);return(0,l.useEffect)((function(){(null===n||void 0===n?void 0:n.name)&&d(n.name)}),[null===n||void 0===n?void 0:n.name]),!n||o?null:(0,La.T)(n)?p?null:(0,i.jsx)("div",{className:"flex flex-1 flex-col overflow-hidden",children:(0,i.jsx)(NS,{startTemplate:n})}):(0,i.jsx)(OS,{template:n,name:c,setName:d,children:(0,i.jsx)(Aa,{automationTemplate:n,name:c,setName:d,sources:s})})},OS=function(e){var n=e.template,t=e.name,r=e.setName,o=e.children,a=e.onPublish,l=e.onNameBlur;return(0,i.jsx)(d.Z,{children:(0,i.jsxs)(ES,{children:[(0,i.jsx)(f.Z,{template:n,name:t,setName:r,onPublish:a,onNameBlur:l}),(0,i.jsx)(ZS,{children:(0,i.jsx)(c.ZP.Content,{fullBleed:!0,children:o})})]})})},TS=IS;IS.Layout=Da.Z},32117:function(){},75691:function(e,n,t){"use strict";var r;if(!Object.keys){var o=Object.prototype.hasOwnProperty,i=Object.prototype.toString,a=t(30801),l=Object.prototype.propertyIsEnumerable,s=!l.call({toString:null},"toString"),u=l.call((function(){}
1),"prototype"),c=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],d=function(e){var n=e.constructor;return n&&n.prototype===e},f={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},p=function(){if("undefined"===typeof window)return!1;for(var e in window)try{if(!f["$"+e]&&o.call(window,e)&&null!==window[e]&&"object"===typeof window[e])try{d(window[e])}catch(n){return!0}}catch(n){return!0}return!1}();r=function(e){var n=null!==e&&"object"===typeof e,t="[object Function]"===i.call(e),r=a(e),l=n&&"[object String]"===i.call(e),f=[];if(!n&&!t&&!r)throw new TypeError("Object.keys called on a non-object");var h=u&&t;if(l&&e.length>0&&!o.call(e,0))for(var v=0;v<e.length;++v)f.push(String(v));if(r&&e.length>0)for(var m=0;m<e.length;++m)f.push(String(m));else for(var g in e)h&&"prototype"===g||!o.call(e,g)||f.push(String(g));if(s)for(var x=function(e){if("undefined"===typeof window||!p)return d(e);try{return d(e)}catch(n){return!1}}(e),b=0;b<c.length;++b)x&&"constructor"===c[b]||!o.call(e,c[b])||f.push(c[b]);return f}}e.exports=r},33464:function(e,n,t){"use strict";var r=Array.prototype.slice,o=t(30801),i=Object.keys,a=i?function(e){return i(e)}:t(75691),l=Object.keys;a.shim=function(){if(Object.keys){var e=function(){var e=Object.keys(arguments);return e&&e.length===arguments.length}(1,2);e||(Object.keys=function(e){return o(e)?l(r.call(e)):l(e)})}else Object.keys=a;return Object.keys||a},e.exports=a},30801:function(e){"use strict";var n=Object.prototype.toString;e.exports=function(e){var t=n.call(e),r="[object Arguments]"===t;return r||(r="[object Array]"!==t&&null!==e&&"object"===typeof e&&"number"===typeof e.length&&e.length>=0&&"[object Function]"===n.call(e.callee)),r}},78435:function(e){"use strict";var n=Array.isArray,t=Object.keys,r=Object.prototype.hasOwnProperty,o="undefined"!==typeof Element;function i(e,a){if(e===a)return!0;if(e&&a&&"object"==typeof e&&"object"==typeof a){var l,s,u,c=n(e),d=n(a);if(c&&d){if((s=e.length)!=a.length)return!1;for(l=s;0!==l--;)if(!i(e[l],a[l]))return!1;return!0}if(c!=d)return!1;var f=e instanceof Date,p=a instanceof Date;if(f!=p)return!1;if(f&&p)return e.getTime()==a.getTime();var h=e instanceof RegExp,v=a instanceof RegExp;if(h!=v)return!1;if(h&&v)return e.toString()==a.toString();var m=t(e);if((s=m.length)!==t(a).length)return!1;for(l=s;0!==l--;)if(!r.call(a,m[l]))return!1;if(o&&e instanceof Element&&a instanceof Element)return e===a;for(l=s;0!==l--;)if(("_owner"!==(u=m[l])||!e.$$typeof)&&!i(e[u],a[u]))return!1;return!0}return e!==e&&a!==a}e.exports=function(e,n){try{return i(e,n)}catch(t){if(t.message&&t.message.match(/stack|recursion/i)||-2146828260===t.number)return console.warn("Warning: react-fast-compare does not handle circular references.",t.name,t.message),!1;throw t}}},38668:function(e,n,t){var r=t(2784);function o(){return o=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},o.apply(this,arguments)}var i=r.createElement("svg",{viewBox:"-2 -5 14 20",height:"100%",width:"100%",style:{position:"absolute",top:0}},r.createElement("path",{d:"M9.9 2.12L7.78 0 4.95 2.828 2.12 0 0 2.12l2.83 2.83L0 7.776 2.123 9.9 4.95 7.07 7.78 9.9 9.9 7.776 7.072 4.95 9.9 2.12",fill:"#fff",fillRule:"evenodd"})),a=r.createElement("svg",{height:"100%",width:"100%",viewBox:"-2 -5 17 21",style:{position:"absolute",top:0}},r.createElement("path",{d:"M11.264 0L5.26 6.004 2.103 2.847 0 4.95l5.26 5.26 8.108-8.107L11.264 0",fill:"#fff",fillRule:"evenodd"}));function l(e){if(7===e.length)return e;for(var n="#",t=1;t<4;t+=1)n+=e[t]+e[t];return n}function s(e,n,t,r,o){return function(e,n,t,r,o){var i=(e-t)/(n-t);if(0===i)return r;if(1===i)return o;for(var a="#",l=1;l<6;l+=2){var s=parseInt(r.substr(l,2),16),u=parseInt(o.substr(l,2),16),c=Math.round((1-i)*s+i*u).toString(16);1===c.length&&(c="0"+c),a+=c}return a}(e,n,t,l(r),l(o))}var u=function(e){function n(n){e.call(this,n);var t=n.height,r=n.width,o=n.checked;this.t=n.handleDiameter||t-2,this.i=Math.max(r-t,r-(t+this.t)/2),this.o=Math.max(0,(t-this.t)/2),this.state={h:o?this.i:this.o},this.l=0,this.u=0,this.p=this.p.bind(this),this.v=this.v.bind(this),this.g=this.g.bind(this),this.k=this.k.bind(this),this.M=this.M.bind(this),this.m=this.m.bind(this),this.T=this.T.bind(this),this.$=this.$.bind(this),this.C=this.C.bind(this),this.D=this.D.bind(this),this.O=this.O.bind(this),this.S=this.S.bind(this)}return e&&(n.__proto__=e),(n.prototype=Object.create(e&&e.prototype)).constructor=n,n.prototype.componentDidMount=function(){this.W=!0},n.prototype.componentDidUpdate=function(e){e.checked!==this.props.checked&&this.setState({h:this.props.checked?this.i:this.o})},n.prototype.componentWillUnmount=function(){this.W=!1},n.prototype.I=function(e){this.H.focus(),this.setState({R:e,j:!0,B:Date.now()})},n.prototype.L=function(e){var n=this.state,t=n.R,r=n.h,o=(this.props.checked?this.i:this.o)+e-t;n.N||e===t||this.setState({N:!0});var i=Math.min(this.i,Math.max(this.o,o));i!==r&&this.setState({h:i})},n.prototype.U=function(e){var n=this.state,t=n.h,r=n.N,o=n.B,i=this.props.checked,a=(this.i+this.o)/2;this.setState({h:this.props.checked?this.i:this.o});var l=Date.now()-o;(!r||l<250||i&&t<=a||!i&&t>=a)&&this.A(e),this.W&&this.setState({N:!1,j:!1}),this.l=Date.now()},n.prototype.p=function(e){e.preventDefault(),"number"==typeof e.button&&0!==e.button||(this.I(e.clientX),window.addEventListener("mousemove",this.v),window.addEventListener("mouseup",this.g))},n.prototype.v=function(e){e.preventDefault(),this.L(e.clientX)},n.prototype.g=function(e){this.U(e),window.removeEventListener("mousemove",this.v),window.removeEventListener("mouseup",this.g)},n.prototype.k=function(e){this.X=null,this.I(e.touches[0].clientX)},n.prototype.M=function(e){this.L(e.touches[0].clientX)},n.prototype.m=function(e){e.preventDefault(),this.U(e)},n.prototype.$=function(e){Date.now()-this.l>50&&(this.A(e),Date.now()-this.u>50&&this.W&&this.setState({j:!1}))},n.prototype.C=function(){this.u=Date.now()},n.prototype.D=function(){this.setState({j:!0})},n.prototype.O=function(){this.setState({j:!1})},n.prototype.S=function(e){this.H=e},n.prototype.T=function(e){e.preventDefault(),this.H.focus(),this.A(e),this.W&&this.setState({j:!1})},n.prototype.A=function(e){var n=this.props;(0,n.onChange)(!n.checked,e,n.id)},n.prototype.render=function(){var e=this.props,n=e.checked,t=e.disabled,i=e.className,a=e.offColor,l=e.onColor,u=e.offHandleColor,c=e.onHandleColor,d=e.checkedIcon,f=e.uncheckedIcon,p=e.checkedHandleIcon,h=e.uncheckedHandleIcon,v=e.boxShadow,m=e.activeBoxShadow,g=e.height,x=e.width,b=e.borderRadius,y=function(e,n){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&-1===n.indexOf(r)&&(t[r]=e[r]);return t}(e,["checked","disabled","className","offColor","onColor","offHandleColor","onHandleColor","checkedIcon","uncheckedIcon","checkedHandleIcon","uncheckedHandleIcon","boxShadow","activeBoxShadow","height","width","borderRadius","handleDiameter"]),C=this.state,j=C.h,w=C.N,N=C.j,S={position:"relative",display:"inline-block",textAlign:"left",opacity:t?.5:1,direction:"ltr",borderRadius:g/2,WebkitTransition:"opacity 0.25s",MozTransition:"opacity 0.25s",transition:"opacity 0.25s",touchAction:"none",WebkitTapHighlightColor:"rgba(0, 0, 0, 0)",WebkitUserSelect:"none",MozUserSelect:"none",msUserSelect:"none",userSelect:"none"},k={height:g,width:x,margin:Math.max(0,(this.t-g)/2),position:"relative",background:s(j,this.i,this.o,a,l),borderRadius:"number"==typeof b?b:g/2,cursor:t?"default":"pointer",WebkitTransition:w?null:"background 0.25s",MozTransition:w?null:"background 0.25s",transition:w?null:"background 0.25s"},_={height:g,width:Math.min(1.5*g,x-(this.t+g)/2+1),position:"relative",opacity:(j-this.o)/(this.i-this.o),pointerEvents:"none",WebkitTransition:w?null:"opacity 0.25s",MozTransition:w?null:"opacity 0.25s",transition:w?null:"opacity 0.25s"},Z={height:g,width:Math.min(1.5*g,x-(this.t+g)/2+1),position:"absolute",opacity:1-(j-this.o)/(this.i-this.o),right:0,top:0,pointerEvents:"none",WebkitTransition:w?null:"opacity 0.25s",MozTransition:w?null:"opacity 0.25s",transition:w?null:"opacity 0.25s"},E={height:this.t,width:this.t,background:s(j,this.i,this.o,u,c),display:"inline-block",cursor:t?"default":"pointer",borderRadius:"number"==typeof b?b-1:"50%",position:"absolute",transform:"translateX("+j+"px)",top:Math.max(0,(g-this.t)/2),outline:0,boxShadow:N?m:v,border:0,WebkitTransition:w?null:"background-color 0.25s, transform 0.25s, box-shadow 0.15s",MozTransition:w?null:"background-color 0.25s, transform 0.25s, box-shadow 0.15s",transition:w?null:"background-color 0.25s, transform 0.25s, box-shadow 0.15s"},I={height:this.t,width:this.t,opacity:Math.max(2*(1-(j-this.o)/(this.i-this.o)-.5),0),position:"absolute",left:0,top:0,pointerEvents:"none",WebkitTransition:w?null:"opacity 0.25s",MozTransition:w?null:"opacity 0.25s",transition:w?null:"opacity 0.25s"},O={height:this.t,width:this.t,opacity:Math.max(2*((j-this.o)/(this.i-this.o)-.5),0),position:"absolute",left:0,top:0,pointerEvents:"none",WebkitTransition:w?null:"opacity 0.25s",MozTransition:w?null:"opacity 0.25s",transition:w?null:"opacity 0.25s"};return r.createElement("div",{className:i,style:S},r.createElement("div",{className:"react-switch-bg",style:k,onClick:t?null:this.T,onMouseDown:function(e){return e.preventDefault()}},d&&r.createElement("div",{style:_},d),f&&r.createElement("div",{style:Z},f)),r.createElement("div",{className:"react-switch-handle",style:E,onClick:function(e){return e.preventDefault()},onMouseDown:t?null:this.p,onTouchStart:t?null:this.k,onTouchMove:t?null:this.M,onTouchEnd:t?null:this.m,onTouchCancel:t?null:this.O},h&&r.createElement("div",{style:I},h),p&&r.createElement("div",{style:O},p)),r.createElement("input",o({},{type:"checkbox",role:"switch","aria-checked":n,checked:n,disabled:t,style:{border:0,clip:"rect(0 0 0 0)",height:1,margin:-1,overflow:"hidden",padding:0,position:"absolute",width:1}},y,{ref:this.S,onFocus:this.D,onBlur:this.O,onKeyUp:this.C,onChange:this.$})))},n}(r.Component);u.defaultProps={disabled:!1,offColor:"#888",onColor:"#080",offHandleColor:"#fff",onHandleColor:"#fff",uncheckedIcon:i,checkedIcon:a,boxShadow:null,activeBoxShadow:"0 0 2px 3px #3bf",height:28,width:56},n.default=u},98001:function(e,n,t){e.exports=t(38668)},16831:function(){},23945:function(e,n,t){"use strict";t.d(n,{Z:function(){return o}});var r=t(1899);function o(e){var n=function(e,n){if("object"!==(0,r.Z)(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var o=t.call(e,n||"default");if("object"!==(0,r.Z)(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(e)}(e,"string");return"symbol"===(0,r.Z)(n)?n:String(n)}},53745:function(e,n,t){"use strict";t.d(n,{Z:function(){return p}});var r=t(55695);function o(e,n,t){var r=function(e,n,t){if(t&&!t.code)throw new Error("date-fns-tz error: Please set a language code on the locale object imported from date-fns, e.g. `locale.code = 'en-US'`");return new Intl.DateTimeFormat(t?[t.code,"en-US"]:void 0,{timeZone:n,timeZoneName:e})}(e,t.timeZone,t.locale);return r.formatToParts?function(e,n){for(var t=e.formatToParts(n),r=t.length-1;r>=0;--r)if("timeZoneName"===t[r].type)return t[r].value}(r,n):function(e,n){var t=e.format(n).replace(/\u200E/g,""),r=/ [\w-+ ]+$/.exec(t);return r?r[0].substr(1):""}(r,n)}var i=t(63729);function a(e,n){var t=e?(0,i.Z)(e,n,!0)/6e4:n.getTimezoneOffset();if(Number.isNaN(t))throw new RangeError("Invalid time zone specified: "+e);return t}function l(e,n){for(var t=e<0?"-":"",r=Math.abs(e).toString();r.length<n;)r="0"+r;return t+r}function s(e,n){var t=n||"",r=e>0?"-":"+",o=Math.abs(e);return r+l(Math.floor(o/60),2)+t+l(Math.floor(o%60),2)}function u(e,n){return e%60===0?(e>0?"-":"+")+l(Math.abs(e)/60,2):s(e,n)}var c={X:function(e,n,t,r){var o=a(r.timeZone,e);if(0===o)return"Z";switch(n){case"X":return u(o);case"XXXX":case"XX":return s(o);default:return s(o,":")}},x:function(e,n,t,r){var o=a(r.timeZone,e);switch(n){case"x":return u(o);case"xxxx":case"xx":return s(o);default:return s(o,":")}},O:function(e,n,t,r){var o=a(r.timeZone,e);switch(n){case"O":case"OO":case"OOO":return"GMT"+function(e,n){var t=e>0?"-":"+",r=Math.abs(e),o=Math.floor(r/60),i=r%60;if(0===i)return t+String(o);var a=n||"";return t+String(o)+a+l(i,2)}(o,":");default:return"GMT"+s(o,":")}},z:function(e,n,t,r){switch(n){case"z":case"zz":case"zzz":return o("short",e,r);default:return o("long",e,r)}}},d=t(99560),f=/([xXOz]+)|''|'(''|[^'])+('|$)/g;function p(e,n,t){var o=String(n),i=t||{},a=o.match(f);if(a){var l=(0,d.Z)(i.originalDate||e,i);o=a.reduce((function(e,n){if("'"===n[0])return e;var t=e.indexOf(n),r="'"===e[t-1],o=e.replace(n,"'"+c[n[0]](l,n,null,i)+"'");return r?o.substring(0,t-1)+o.substring(t+1):o}),o)}return r(e,o,i)}}},function(e){e.O(0,[9774,6139,2816,1330,9795,4733,6651,423,5399,7781,3506,5245,6355,1292,9323,663,752,2582,8582,315,8100,6577,5526,8599,3245,4123,4637,8005,5358,7840,172,4364,2888,179],(function(){return n=63141,e(e.s=n);var n}));var n=e.O();_N_E=n}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.