HEX
Server: Apache/2.4.57 (Ubuntu) mod_fcgid/2.3.9 OpenSSL/3.0.2
System: Linux vmi267337.contaboserver.net 5.15.0-25-generic #25-Ubuntu SMP Wed Mar 30 15:54:22 UTC 2022 x86_64
User: ohirex (1008)
PHP: 8.2.8
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,exec,system,passthru,shell_exec
Upload Files
File: /home/ohirex/web/ohirex.com/public_html/wp-content/plugins/mailster/build/workflows/delay/index.js
(()=>{var e={6942:(e,t)=>{var s;!function(){"use strict";var n={}.hasOwnProperty;function i(){for(var e="",t=0;t<arguments.length;t++){var s=arguments[t];s&&(e=a(e,r(s)))}return e}function r(e){if("string"==typeof e||"number"==typeof e)return e;if("object"!=typeof e)return"";if(Array.isArray(e))return i.apply(null,e);if(e.toString!==Object.prototype.toString&&!e.toString.toString().includes("[native code]"))return e.toString();var t="";for(var s in e)n.call(e,s)&&e[s]&&(t=a(t,s));return t}function a(e,t){return t?e?e+" "+t:e+t:e}e.exports?(i.default=i,e.exports=i):void 0===(s=function(){return i}.apply(t,[]))||(e.exports=s)}()}},t={};function s(n){var i=t[n];if(void 0!==i)return i.exports;var r=t[n]={exports:{}};return e[n](r,r.exports,s),r.exports}s.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return s.d(t,{a:t}),t},s.d=(e,t)=>{for(var n in t)s.o(t,n)&&!s.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";const e=window.wp.blocks,t=window.wp.i18n,n=window.wp.element,i=window.wp.components,r=window.wp.blockEditor,a=window.wp.date,o=window.wp.data,l=(0,a.getSettings)(),h=[{single:(0,t.__)("Minute","mailster"),plural:(0,t.__)("Minutes","mailster"),value:"minutes"},{single:(0,t.__)("Hour","mailster"),plural:(0,t.__)("Hours","mailster"),value:"hours"},{single:(0,t.__)("Day","mailster"),plural:(0,t.__)("Days","mailster"),value:"days"},{single:(0,t.__)("Week","mailster"),plural:(0,t.__)("Weeks","mailster"),value:"weeks"},{single:(0,t.__)("Month","mailster"),plural:(0,t.__)("Months","mailster"),value:"months"},{single:(0,t.__)("Specific Time of the day","mailster"),value:"day"},{single:(0,t.__)("Specific day of the week","mailster"),value:"week"},{single:(0,t.__)("Specific day of the month","mailster"),value:"month"},{single:(0,t.__)("Specific date","mailster"),value:"year"}],m={1:(0,t.sprintf)((0,t.__)("%s day of the month","mailster"),(0,t._x)("1st","[x] day of the month","mailster")),2:(0,t.sprintf)((0,t.__)("%s day of the month","mailster"),(0,t._x)("2nd","[x] day of the month","mailster")),3:(0,t.sprintf)((0,t.__)("%s day of the month","mailster"),(0,t._x)("3rd","[x] day of the month","mailster")),4:(0,t.sprintf)((0,t.__)("%s day of the month","mailster"),(0,t._x)("4th","[x] day of the month","mailster")),5:(0,t.sprintf)((0,t.__)("%s day of the month","mailster"),(0,t._x)("5th","[x] day of the month","mailster")),6:(0,t.sprintf)((0,t.__)("%s day of the month","mailster"),(0,t._x)("6th","[x] day of the month","mailster")),7:(0,t.sprintf)((0,t.__)("%s day of the month","mailster"),(0,t._x)("7th","[x] day of the month","mailster")),8:(0,t.sprintf)((0,t.__)("%s day of the month","mailster"),(0,t._x)("8th","[x] day of the month","mailster")),9:(0,t.sprintf)((0,t.__)("%s day of the month","mailster"),(0,t._x)("9th","[x] day of the month","mailster")),10:(0,t.sprintf)((0,t.__)("%s day of the month","mailster"),(0,t._x)("10th","[x] day of the month","mailster")),11:(0,t.sprintf)((0,t.__)("%s day of the month","mailster"),(0,t._x)("11st","[x] day of the month","mailster")),12:(0,t.sprintf)((0,t.__)("%s day of the month","mailster"),(0,t._x)("12nd","[x] day of the month","mailster")),13:(0,t.sprintf)((0,t.__)("%s day of the month","mailster"),(0,t._x)("13rd","[x] day of the month","mailster")),14:(0,t.sprintf)((0,t.__)("%s day of the month","mailster"),(0,t._x)("14th","[x] day of the month","mailster")),15:(0,t.sprintf)((0,t.__)("%s day of the month","mailster"),(0,t._x)("15th","[x] day of the month","mailster")),16:(0,t.sprintf)((0,t.__)("%s day of the month","mailster"),(0,t._x)("16th","[x] day of the month","mailster")),17:(0,t.sprintf)((0,t.__)("%s day of the month","mailster"),(0,t._x)("17th","[x] day of the month","mailster")),18:(0,t.sprintf)((0,t.__)("%s day of the month","mailster"),(0,t._x)("18th","[x] day of the month","mailster")),19:(0,t.sprintf)((0,t.__)("%s day of the month","mailster"),(0,t._x)("19th","[x] day of the month","mailster")),20:(0,t.sprintf)((0,t.__)("%s day of the month","mailster"),(0,t._x)("20th","[x] day of the month","mailster")),21:(0,t.sprintf)((0,t.__)("%s day of the month","mailster"),(0,t._x)("21st","[x] day of the month","mailster")),22:(0,t.sprintf)((0,t.__)("%s day of the month","mailster"),(0,t._x)("22nd","[x] day of the month","mailster")),23:(0,t.sprintf)((0,t.__)("%s day of the month","mailster"),(0,t._x)("23rd","[x] day of the month","mailster")),24:(0,t.sprintf)((0,t.__)("%s day of the month","mailster"),(0,t._x)("24th","[x] day of the month","mailster")),25:(0,t.sprintf)((0,t.__)("%s day of the month","mailster"),(0,t._x)("25th","[x] day of the month","mailster")),26:(0,t.sprintf)((0,t.__)("%s day of the month","mailster"),(0,t._x)("26th","[x] day of the month","mailster")),27:(0,t.sprintf)((0,t.__)("%s day of the month","mailster"),(0,t._x)("27th","[x] day of the month","mailster")),28:(0,t.sprintf)((0,t.__)("%s day of the month","mailster"),(0,t._x)("28th","[x] day of the month","mailster")),29:(0,t.sprintf)((0,t.__)("%s day of the month","mailster"),(0,t._x)("29th","[x] day of the month","mailster")),30:(0,t.sprintf)((0,t.__)("%s day of the month","mailster"),(0,t._x)("30th","[x] day of the month","mailster")),31:(0,t.sprintf)((0,t.__)("%s day of the month","mailster"),(0,t._x)("31st","[x] day of the month","mailster")),"-1":(0,t.__)("Last day of the month","mailster")},d=l.l10n.weekdays,c=l.l10n.startOfWeek,_=l.formats.date,f=l.formats.time,u=(l.formats.datetime,!!l.formats.time.match(/[a|A]/)),p=(window.lodash,window.moment,window.ReactJSXRuntime);function x({id:e,align:t}){const s=new URL("https://kb.mailster.co/"+e);s.searchParams.set("utm_campaign","plugin"),s.searchParams.set("utm_medium","link"),s.searchParams.set("utm_source","Mailster Plugin"),s.searchParams.set("utm_term","workflow");var n={};return t&&(n.float=t),(0,p.jsx)("a",{className:"mailster-help",href:s.toString(),"data-article":e,style:n})}const y=(0,t.__)("Wait for %s","mailster"),w=(0,t.__)("Wait until %s","mailster");function j(e){const{unit:s,amount:n,weekdays:i,date:r=new Date,month:o=1}=e;if(g(s))return"";switch(new Date(r),s){case"day":return"";case"week":if(!i||7==i.length)return(0,t.__)("on ever day in the week.","mailster");const e=d.filter(((e,t)=>i.includes(t))).join(", ").replace(/,([^,]*)$/," "+(0,t.__)("or","mailster")+"$1");return(0,t.sprintf)((0,t.__)("on a %s.","mailster"),e);case"month":return(0,t.sprintf)((0,t.__)("on the %s.","mailster"),m[o]);case"year":return(0,t.sprintf)((0,t.__)("on the %s.","mailster"),(0,a.dateI18n)(_,r))}return new Date(r).toString()}function b(e){const{unit:s,amount:n,weekdays:i,date:r=new Date,month:o=1}=e,l=function(e){const{unit:s,amount:n,weekdays:i,date:r=new Date,month:o=1}=e;if(g(s)){const e=h.find((e=>e.value===s));return(0,t.sprintf)("%d %s",n,n>1&&e.plural||e.single)}const l=new Date(r);switch(s){case"day":case"week":case"month":case"year":return(0,a.dateI18n)(f,l)}return(0,a.dateI18n)(f,l)}(e);return g(s)?(0,t.sprintf)(y,l):(0,t.sprintf)(w,l)}function g(e){return["minutes","hours","days","weeks","months"].includes(e)}const k=[...d.slice(c),...d.slice(0,c)];function v({attributes:e,setAttributes:s}){const{id:o,amount:l,date:c,unit:y,timezone:w,month:j,weekdays:g=[0,1,2,3,4,5,6]}=e,[v,C]=(0,n.useState)(!1),S=+new Date-+new Date(c)>0,P=e=>{s({date:new Date(e||Date.now()).toISOString()})},B=()=>(0,p.jsx)(i.Button,{variant:"tertiary",size:"small",onClick:()=>P(),className:"alignright",children:(0,t.__)("now","mailster")}),N=Object.keys(h).map(((e,t)=>({label:l>1&&h[e].plural||h[e].single,value:h[e].value}))),D=()=>["day","week","month","year"].includes(y)?(0,p.jsx)(i.PanelBody,{children:(0,p.jsx)(i.PanelRow,{children:(0,p.jsxs)(i.FlexItem,{children:[(0,p.jsx)(x,{id:"63fb2e7c52af714471a1738a",align:"right"}),(0,p.jsx)(i.ToggleControl,{__nextHasNoMarginBottom:!0,onChange:()=>s({timezone:!w}),checked:w,label:(0,t.__)("Timezone based sending","mailster"),help:(0,t.__)("Delay based on the subscribers timezone if known. This is usefull if you have global subscribers and like to get the email in their in box at the defined time.","mailster")})]})})}):null;return(0,p.jsx)(r.InspectorControls,{children:(0,p.jsxs)(i.Panel,{children:[(0,p.jsxs)(i.PanelBody,{children:[(0,p.jsx)(x,{id:"64623a1035c39a6db5f441e4",align:"right"}),(0,p.jsx)(i.PanelRow,{children:(0,p.jsx)(i.BaseControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Delay Workflow","mailster"),children:(0,p.jsxs)(i.Flex,{gap:4,align:"center",justify:"space-between",children:[["minutes","hours","days","weeks","months"].includes(y)&&(0,p.jsxs)(p.Fragment,{children:[(0,t.__)("for","mailster"),(0,p.jsx)(i.FlexItem,{children:(0,p.jsx)(i.__experimentalNumberControl,{onChange:e=>s({amount:parseInt(e,10)}),value:l,min:"1"})})]}),(0,p.jsx)(i.FlexItem,{children:(0,p.jsx)(i.SelectControl,{__nextHasNoMarginBottom:!0,value:y,options:N,onChange:e=>function(e){switch(e){case"month":j||s({month:1});break;case"year":S&&P(+new Date+864e5)}s({unit:e})}(e)})})]})})}),"day"===y&&(0,p.jsx)(i.PanelRow,{children:(0,p.jsx)(i.Flex,{gap:4,align:"center",justify:"space-between",children:(0,p.jsx)(i.BaseControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Wait until current time of the day is","mailster"),help:(0,t.__)("If the current time is later the workflow will be delayed by one day.","mailster"),children:(0,p.jsx)(i.FlexItem,{children:(0,p.jsxs)(i.Button,{variant:"secondary",onClick:e=>C(!0),children:[b(e),v&&(0,p.jsxs)(i.Popover,{onClose:e=>C(!1),className:"delay-popover",children:[(0,p.jsx)(i.TimePicker,{currentTime:c,onChange:e=>P(e),is12Hour:u}),(0,p.jsx)(B,{})]})]})})})})}),"week"===y&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(i.PanelRow,{children:(0,p.jsx)(i.BaseControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Wait until current time of the day is","mailster"),children:(0,p.jsxs)(i.Button,{variant:"secondary",onClick:e=>C(!0),children:[b(e),v&&(0,p.jsxs)(i.Popover,{onClose:e=>C(!1),className:"delay-popover",children:[(0,p.jsx)(i.TimePicker,{currentTime:c,onChange:e=>P(e),is12Hour:u}),(0,p.jsx)(B,{})]})]})})}),(0,p.jsx)(i.PanelRow,{children:(0,p.jsx)(i.BaseControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("only on","mailster"),help:(0,t.__)("If the current time is later the workflow will be delayed by next selected weekday.","mailster"),children:k.map(((e,t)=>{const n=d.indexOf(k[t]);return(0,p.jsx)(i.CheckboxControl,{__nextHasNoMarginBottom:!0,className:"inspector-checkbox",label:k[t],checked:!g||g.includes(n),onChange:e=>{!function(e,t=!0){var n=[...g];t?n.push(e):n=n.filter((t=>t!=e)),s({weekdays:n.length?n.sort():void 0})}(n,e)},__nextHasNoMarginBottom:!0},n)}))})})]}),"month"===y&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(i.PanelRow,{children:(0,p.jsx)(i.BaseControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Wait until current time of the day is","mailster"),children:(0,p.jsxs)(i.Button,{variant:"secondary",onClick:e=>C(!0),children:[b(e),v&&(0,p.jsxs)(i.Popover,{onClose:e=>C(!1),className:"delay-popover",children:[(0,p.jsx)(i.TimePicker,{currentTime:c,onChange:e=>P(e),is12Hour:u}),(0,p.jsx)(B,{})]})]})})}),(0,p.jsx)(i.PanelRow,{children:(0,p.jsx)(i.BaseControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("and it is the","mailster"),help:(0,t.__)("If the current time is later the workflow will be delayed by next selected day in the next month.","mailster"),children:(0,p.jsx)(i.SelectControl,{__nextHasNoMarginBottom:!0,value:j,options:Object.keys(m).map(((e,t)=>({label:m[e],value:e}))),onChange:e=>s({month:parseInt(e,10)})})})}),j>=29&&(0,p.jsx)(i.PanelRow,{children:(0,p.jsx)(i.Tip,{children:sprintf((0,t.__)("The month will be skipped if it doesn't have %d days.","mailster"),j)})})]}),"year"===y&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(i.PanelRow,{children:(0,p.jsx)(i.BaseControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Continue Workflow on the","mailster"),children:(0,p.jsxs)(i.Button,{variant:"secondary",onClick:e=>C(!0),isDestructive:S,children:[(0,a.dateI18n)(_,c)+" @ "+(0,a.dateI18n)(f,c),v&&(0,p.jsxs)(i.Popover,{onClose:e=>C(!1),className:"delay-popover",children:[(0,p.jsx)(i.DateTimePicker,{currentDate:c,onChange:e=>P(e),is12Hour:u}),(0,p.jsx)(B,{})]})]})})}),S&&(0,p.jsx)(i.PanelRow,{children:(0,p.jsx)(i.Button,{variant:"link",onClick:e=>C(!0),isDestructive:!0,children:(0,t.__)("Date is in the past!","mailster")})})]})]}),(0,p.jsx)(D,{})]})})}var C=s(6942),S=s.n(C);const P=window.wp.apiFetch;var B=s.n(P);const N=(0,a.getSettings)(),D=((0,t.__)("Minute","mailster"),(0,t.__)("Minutes","mailster"),(0,t.__)("Hour","mailster"),(0,t.__)("Hours","mailster"),(0,t.__)("Day","mailster"),(0,t.__)("Days","mailster"),(0,t.__)("Week","mailster"),(0,t.__)("Weeks","mailster"),(0,t.__)("Month","mailster"),(0,t.__)("Months","mailster"),(0,t.__)("Specific Time of the day","mailster"),(0,t.__)("Specific day of the week","mailster"),(0,t.__)("Specific day of the month","mailster"),(0,t.__)("Specific date","mailster"),(0,t.sprintf)((0,t.__)("%s day of the month","mailster"),"1st"),(0,t.sprintf)((0,t.__)("%s day of the month","mailster"),"2nd"),(0,t.sprintf)((0,t.__)("%s day of the month","mailster"),"3rd"),(0,t.sprintf)((0,t.__)("%s day of the month","mailster"),"4th"),(0,t.sprintf)((0,t.__)("%s day of the month","mailster"),"5th"),(0,t.sprintf)((0,t.__)("%s day of the month","mailster"),"6th"),(0,t.sprintf)((0,t.__)("%s day of the month","mailster"),"7th"),(0,t.sprintf)((0,t.__)("%s day of the month","mailster"),"8th"),(0,t.sprintf)((0,t.__)("%s day of the month","mailster"),"9th"),(0,t.sprintf)((0,t.__)("%s day of the month","mailster"),"10th"),(0,t.sprintf)((0,t.__)("%s day of the month","mailster"),"11st"),(0,t.sprintf)((0,t.__)("%s day of the month","mailster"),"12nd"),(0,t.sprintf)((0,t.__)("%s day of the month","mailster"),"13rd"),(0,t.sprintf)((0,t.__)("%s day of the month","mailster"),"14th"),(0,t.sprintf)((0,t.__)("%s day of the month","mailster"),"15th"),(0,t.sprintf)((0,t.__)("%s day of the month","mailster"),"16th"),(0,t.sprintf)((0,t.__)("%s day of the month","mailster"),"17th"),(0,t.sprintf)((0,t.__)("%s day of the month","mailster"),"18th"),(0,t.sprintf)((0,t.__)("%s day of the month","mailster"),"19th"),(0,t.sprintf)((0,t.__)("%s day of the month","mailster"),"20th"),(0,t.sprintf)((0,t.__)("%s day of the month","mailster"),"21st"),(0,t.sprintf)((0,t.__)("%s day of the month","mailster"),"22nd"),(0,t.sprintf)((0,t.__)("%s day of the month","mailster"),"23rd"),(0,t.sprintf)((0,t.__)("%s day of the month","mailster"),"24th"),(0,t.sprintf)((0,t.__)("%s day of the month","mailster"),"25th"),(0,t.sprintf)((0,t.__)("%s day of the month","mailster"),"26th"),(0,t.sprintf)((0,t.__)("%s day of the month","mailster"),"27th"),(0,t.sprintf)((0,t.__)("%s day of the month","mailster"),"28th"),(0,t.sprintf)((0,t.__)("%s day of the month","mailster"),"29th"),(0,t.sprintf)((0,t.__)("%s day of the month","mailster"),"30th"),(0,t.sprintf)((0,t.__)("%s day of the month","mailster"),"31st"),(0,t.sprintf)((0,t.__)("%s day of the month","mailster"),"Last"),N.l10n.weekdays.slice(N.l10n.startOfWeek),N.l10n.weekdays.slice(0,N.l10n.startOfWeek),N.l10n.startOfWeek,N.formats.date),I=N.formats.time;function M(e){const{attributes:s}=e,{id:a}=s,l=(0,o.useSelect)((e=>e("core/editor").getCurrentPostId()),[]),[h,m]=(0,n.useState)(!1),[d,c]=(0,n.useState)(!1),_=function(e){const t=(0,o.useSelect)((e=>e("mailster/automation").getQueue()),[]),[s,i]=(0,n.useState)(0);return(0,n.useEffect)((()=>{t&&i(t[e]||0)}),[e,t]),s}(a),f=(0,t.sprintf)((0,t._n)("%s subscriber queued","%s subscribers queued",_,"mailster"),_);return(0,n.useEffect)((()=>{if(h&&a&&l)return _?void B()({path:"/mailster/v1/automations/queue/"+l+"/"+a}).then((e=>{c(e)})):c([])}),[h,l,a,_]),(0,p.jsxs)(p.Fragment,{children:[_>0&&(0,p.jsx)("span",{className:"mailster-step-queued",title:f,onClick:()=>m(!0),children:_}),h&&(0,p.jsxs)(i.Modal,{title:f,onRequestClose:()=>m(!1),children:[(0,p.jsx)(x,{id:"66b09cdba62a7505fcf33836",align:"right"}),(0,p.jsxs)("div",{className:"mailster-queue-table",children:[!d&&(0,p.jsx)(i.Panel,{children:(0,p.jsx)(i.PanelBody,{children:(0,p.jsx)(i.PanelRow,{children:(0,p.jsx)(i.Spinner,{})})})}),d&&(0,p.jsx)(T,{data:d,setData:c,...e})]}),(0,p.jsx)(i.Tip,{children:(0,t.__)("This table shows you the subscribers which are currently queued in this step. You can finish, trash or move them to the next step with the action buttons.","mailster")})]}),(0,p.jsx)(r.InspectorControls,{children:_>0&&(0,p.jsxs)(i.Panel,{children:[(0,p.jsxs)(i.PanelBody,{title:(0,t.__)("Queue","mailster"),children:[(0,p.jsx)(x,{id:"66b09cdba62a7505fcf33836",align:"right"}),(0,p.jsx)(i.PanelRow,{children:(0,p.jsx)(i.Button,{onClick:()=>m(!0),variant:"secondary",children:f})})]}),(0,p.jsx)(i.PanelBody,{children:(0,p.jsx)(i.Tip,{children:(0,t.__)("Subscribers who are already queued in this step will not be affected by any changes you make.","mailster")})})]})})]})}N.formats.datetime,N.formats.time.match(/[a|A]/);const T=e=>{const{attributes:s,data:r,setData:l}=e,{id:h}=s,[m,d]=(0,n.useState)(!1),c=(0,o.useSelect)((e=>e("core/editor").getCurrentPostId()),[]),_=(e,t,s,n)=>{const i="/mailster/v1/automations/queue/"+c+"/"+h+"/"+e.ID;d(!0),B()({path:i,method:s,data:n}).then((e=>{e&&l(r.filter(((e,s)=>s!==t))),d(!1),(0,o.dispatch)("mailster/automation").invalidateResolutionForStoreSelector("getQueue")}))},f=(new Date).getTime(),u=r.map(((e,n)=>{const r=1e3*e.timestamp,o=1e3*e.added;return(0,p.jsxs)("tr",{children:[(0,p.jsxs)("td",{children:[(0,p.jsx)(i.ExternalLink,{href:"edit.php?post_type=newsletter&page=mailster_subscribers&ID="+e.subscriber_id,children:e.email}),0==e.status&&(0,p.jsx)("p",{className:"description",children:(0,t.__)("This subscriber hasn't confirmed their subscription yet. The workflow will continue once the user confirms their subscriptions.","mailster")})]}),(0,p.jsx)("td",{children:e.trigger}),(0,p.jsx)("td",{children:o&&(0,p.jsx)(i.Tooltip,{text:(0,a.dateI18n)(D,o)+" @ "+(0,a.dateI18n)(I,o),children:(0,p.jsx)("div",{children:(0,a.humanTimeDiff)(o)})})}),(0,p.jsx)("td",{children:r&&(0,p.jsx)(i.Tooltip,{text:(0,a.dateI18n)(D,r)+" @ "+(0,a.dateI18n)(I,r),children:(0,p.jsx)("div",{children:r>f?(0,a.humanTimeDiff)(r):(0,t.__)("right now","mailster")})})}),(0,p.jsxs)("td",{children:[(0,p.jsx)(i.Button,{icon:"flag",disabled:m,label:(0,t.__)("Finish Journey","mailster"),onClick:()=>((e,s)=>{const n=(0,t.sprintf)((0,t.__)("Do you really like to finish the journey for %s?","mailster"),e.email);confirm(n)&&_(e,s,"POST",{finish:!0})})(e,n)}),(0,p.jsx)(i.Button,{icon:"controls-skipforward",disabled:m||1!=e.status||s.disabled,label:(0,t.__)("Forward to next step","mailster"),onClick:()=>((e,s)=>{const n=(0,t.sprintf)((0,t.__)("Do you really like to forward %s to the next step?","mailster"),e.email);confirm(n)&&_(e,s,"POST",{forward:!0})})(e,n)}),(0,p.jsx)(i.Button,{icon:"trash",disabled:m,isDestructive:!0,label:(0,t.__)("Remove entry","mailster"),onClick:()=>((e,s)=>{const n=(0,t.sprintf)((0,t.__)("Do you really like to remove %s from the queue?","mailster"),e.email);confirm(n)&&_(e,s,"DELETE")})(e,n)})]})]},n)}));return(0,p.jsxs)("table",{className:"wp-list-table widefat striped",children:[(0,p.jsx)("thead",{children:(0,p.jsxs)("tr",{children:[(0,p.jsx)("th",{children:(0,t.__)("Subscriber","mailster")}),(0,p.jsx)("th",{children:(0,t.__)("Trigger","mailster")}),(0,p.jsx)("th",{children:(0,t.__)("Added","mailster")}),(0,p.jsx)("th",{children:(0,t.__)("Continues","mailster")}),(0,p.jsx)("th",{style:{width:"150px"},children:(0,t.__)("Actions","mailster")})]})}),(0,p.jsx)("tbody",{children:u})]})},H={label:(0,t.__)("Skip Step","mailster"),help:(0,t.__)("Skip this step when the workflow is executed.","mailster")},R={label:(0,t.__)("Skip Trigger","mailster"),help:(0,t.__)("Disable this trigger for the workflow.","mailster")};function F(e){const{attributes:t,setAttributes:s,name:n}=e,{disabled:a=!1}=t;if("mailster-workflow/stop"===n)return null;const o="mailster-workflow/trigger"==n?R:H;return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(r.BlockControls,{group:"other",children:(0,p.jsx)(i.ToolbarButton,{icon:a?"hidden":"visibility",isPressed:a,title:o.label,onClick:()=>s({disabled:!a||void 0})})}),(0,p.jsx)(r.InspectorControls,{children:(0,p.jsx)(i.Panel,{children:(0,p.jsx)(i.PanelBody,{children:(0,p.jsx)(i.PanelRow,{children:(0,p.jsx)(i.ToggleControl,{__nextHasNoMarginBottom:!0,icon:a?"hidden":"visibility",label:o.label,help:o.help,checked:a,onChange:e=>s({disabled:!!e||void 0})})})})})})]})}function W(e){const{attributes:s,setAttributes:n,name:a}=e,{comment:o=""}=s;return"mailster-workflow/trigger"===a?null:(0,p.jsxs)(p.Fragment,{children:[o&&(0,p.jsx)("div",{className:"mailster-step-comment",children:o}),(0,p.jsx)(r.InspectorControls,{children:(0,p.jsx)(i.Panel,{children:(0,p.jsx)(i.PanelBody,{children:(0,p.jsx)(i.PanelRow,{children:(0,p.jsx)(i.TextControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Comment","mailster"),help:(0,t.__)("Add a comment to help you understand your workflow.","mailster"),value:o,onChange:e=>n({comment:e||void 0})})})})})})]})}function O(e){const{attributes:s}=e,{id:n}=s;if(n)return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("span",{className:"mailster-step-id",title:sprintf((0,t.__)("Step ID : %s","mailster"),n),children:n}),(0,p.jsx)(r.InspectorControls,{children:(0,p.jsx)(i.Panel,{children:(0,p.jsx)(i.PanelBody,{className:"code",children:sprintf((0,t.__)("Step ID : %s","mailster"),n)})})})]})}function A(e){const{attributes:s,clientId:n,name:a,isSelectionEnabled:l}=e,{isExample:h}=s;if((0,o.useSelect)((e=>{const t=e("core/block-editor").getBlocks();return t.length?t.at(-1).clientId:null}))!==n)return null;const m="mailster-workflow/triggers"===a?(0,t.__)("Click + to add a step","mailster"):(0,t.__)("Workflow Finished","mailster");return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(i.Tooltip,{text:(0,t.__)("Once the user reaches this point the workflow will be finished.","mailster"),children:(0,p.jsx)("span",{className:"workflow-finished "+a.replace("mailster-workflow/","workflow-finished-"),children:!h&&m})}),l&&(0,p.jsx)(r.ButtonBlockAppender,{})]})}function E(e){const{attributes:t,setAttributes:s,children:a,className:l=[],hasStepId:h=!0,before:m,after:d,inspectorControls:c,isSelected:_,isIncomplete:f,clientId:u,blockAttributes:x={},isSelectionEnabled:y}=e,{id:w,disabled:j=!1}=t;!function(e){const[t,s]=(0,n.useState)();(0,n.useEffect)((()=>{new Promise((e=>{const t=(0,o.subscribe)((()=>{if((0,o.select)("core/editor").isCleanNewPost()||(0,o.select)("core/block-editor").getBlockCount()>0){const s=document.querySelector('iframe[name="editor-canvas"]'),n=s?s.contentWindow:window,i=()=>{n.removeEventListener("load",i),t(),e(n)};n.document.querySelector(".is-root-container")?i():n.addEventListener("load",i)}}))})).then((t=>{s(t.document),e&&e(t.document)}))}),[])}((e=>{e&&h&&(!w||e.querySelectorAll(".mailster-step-"+w).length>1)&&s({id:u.substring(30)})})),(0,n.useEffect)((()=>{if(_&&w)return history.replaceState(void 0,void 0,"#step-"+w),()=>{history.pushState("",document.title,location.pathname+location.search)}}),[_]);const b=(0,n.useRef)();w&&l.push("mailster-step-"+w),f&&y&&l.push("mailster-step-incomplete"),j&&l.push("mailster-step-disabled");const g=(0,r.useBlockProps)({className:S()({},l),...x});return(0,p.jsxs)(p.Fragment,{children:[c,(0,p.jsxs)("div",{...g,children:[m,(0,p.jsxs)(i.Card,{className:"mailster-step",ref:b,children:[(0,p.jsx)(W,{...e}),(0,p.jsx)(F,{...e}),(0,p.jsx)(M,{...e}),(0,p.jsx)(O,{...e}),(0,p.jsx)("div",{className:"mailster-step-inner",children:a})]}),d,(0,p.jsx)("div",{className:"end-stop canvas-handle"})]}),(0,p.jsx)(A,{...e})]})}const q=(0,p.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[(0,p.jsxs)("g",{fill:"none",stroke:"#323232",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",children:[(0,p.jsx)("path",{d:"M12 21v0a9 9 0 009-9v0a9 9 0 00-9-9v0a9 9 0 00-9 9v0a9 9 0 009 9z"}),(0,p.jsx)("path",{d:"M14 14l-2-2V9M5.5 12H6M18.5 12H18M7.76 16.24l-.36.36M16.24 7.76l.36-.36M12 18v.5M12 5.5V6M16.24 16.24l.36.36M7.4 7.4l.36.36"})]}),(0,p.jsx)("path",{fill:"none",d:"M0 0h24v24H0V0z"})]}),z=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"mailster-workflow/delay","title":"Delay","category":"mailster-workflow-steps","keywords":["delay","time"],"description":"Delay your workflow and continue at a later point.","parent":["core/post-content","mailster-workflow/condition-yes","mailster-workflow/condition-no"],"example":{},"supports":{"html":false,"className":false,"customClassName":false},"attributes":{"id":{"type":"string"},"disabled":{"type":"boolean"},"amount":{"type":"integer"},"unit":{"type":"string"},"date":{"type":"string"},"weekdays":{"type":"array"},"month":{"type":"integer"},"timezone":{"type":"boolean","default":false},"comment":{"type":"string"}},"textdomain":"mailster","editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css"}'),{name:L,...V}=z;(0,e.registerBlockType)(L,{...V,__experimentalLabel:function(e,{context:s}){const{content:n,metadata:i}=e;if(i?.name)return i.name;const r=j(e),a=b(e);return(0,t.sprintf)("%s %s",a,r)||n},icon:q,edit:function(e){const{attributes:s,setAttributes:r}=e,{amount:a,unit:o,date:l,month:h,timezone:m}=s;(0,n.useEffect)((()=>{!a&&r({amount:1}),!o&&r({unit:"hours"}),!h&&r({month:1}),!l&&r({date:new Date})}));const d=j(s),c=b(s);return(0,p.jsx)(E,{...e,className:[],inspectorControls:(0,p.jsx)(v,{...e}),children:(0,p.jsxs)(i.CardBody,{size:"small",children:[(0,p.jsxs)("div",{className:"mailster-step-label",children:[(0,p.jsx)(i.Icon,{icon:q}),c]}),d&&(0,p.jsx)("div",{className:"mailster-step-info",children:d}),!g()&&m&&(0,p.jsxs)("div",{className:"mailster-step-info",children:[(0,p.jsx)("br",{}),(0,t.__)("Respect users timezone","mailster")]})]})})},save:()=>null})})()})();