1"use strict";(self["webpackChunkclient"]=self["webpackChunkclient"]||[]).push([[375],{70375:function(e,t,i){i.r(t),i.d(t,{default:function(){return At}});var a=i(20641),s=i(90033),o=i(53751);const n={class:"workflow-editor p-5"},l={class:"workflow-header"},r={class:"is-flex is-align-items-center"},d={class:"is-flex is-align-items-center"},c={class:"workflow-container"},g={class:"workflow-sidebar"},h={class:"sidebar-section-header"},u={class:"sidebar-section-title"},p=["aria-label"],f={key:0,class:"trigger-search"},y=["placeholder"],m={class:"node-palette triggers-scroll"},v=["onDragstart"],k={class:"icon"},b={key:0,class:"palette-empty"},T={class:"sidebar-fixed"},$={class:"sidebar-section-title mb-3"},N={class:"node-palette"},w=["onDragstart"],L={class:"icon"},C={class:"sidebar-section-title mb-3 mt-4"},F={class:"node-palette"},S={class:"icon"},D={class:"sidebar-help mt-4"},E={class:"has-text-grey is-size-7"},_={class:"node-with-prompt"},x={class:"node-icon"},I={class:"node-content"},A={class:"node-type"},O={class:"node-label"},U={key:0,class:"node-badge"},W=["onClick"],P=["onDragover","onDrop","onClick"],Q={class:"prompt-button"},V={class:"node-with-prompt"},X={class:"node-icon"},R={class:"node-content"},H={class:"node-type"},z={class:"node-label"},j={key:0,class:"node-delay"},B=["onClick"],M=["onDragover","onDrop","onClick"],J={class:"prompt-button"},K={class:"note-header"},q=["onClick"],Y={class:"note-content"},Z={key:0,class:"canvas-empty-state"},G={class:"action-config-modal"},ee={class:"modal-header"},te={class:"header-left"},ie={class:"header-icon"},ae={class:"header-text"},se={class:"modal-body"},oe={class:"config-section"},ne={class:"section-label"},le={class:"action-type-options"},re=["value"],de={class:"option-icon"},ce={class:"option-label"},ge={class:"config-section"},he={class:"section-label"},ue=["placeholder"],pe={class:"config-section"},fe={class:"section-label"},ye={class:"editor-wrapper"},me={key:1,class:"config-section"},ve={class:"section-label"},ke={class:"has-text-grey has-text-centered py-2"},be={key:0},Te={key:1},$e={class:"tag-option"},Ne={key:0,class:"selected-tag mt-2"},we={class:"tag is-primary is-medium is-rounded"},Le={key:2,class:"config-section"},Ce={class:"section-label"},Fe={class:"has-text-grey has-text-centered py-2"},Se={class:"tag-option"},De={key:0,class:"selected-tag mt-2"},Ee={class:"tag is-danger is-medium is-rounded"},_e={class:"config-section delay-section"},xe={class:"collapse-label"},Ie={class:"label-hint"},Ae={key:0,class:"delay-content"},Oe={class:"section-description"},Ue={class:"delay-inputs"},We={class:"delay-input-group"},Pe={class:"delay-label"},Qe={class:"delay-input-group"},Ve={class:"delay-label"},Xe={class:"delay-input-group"},Re={class:"delay-label"},He={class:"modal-footer"},ze={class:"action-config-modal trigger-modal"},je={class:"modal-header"},Be={class:"header-left"},Me={class:"header-icon trigger-icon"},Je={class:"header-text"},Ke={class:"modal-body"},qe={class:"config-section"},Ye={class:"section-label"},Ze={class:"trigger-select-wrapper"},Ge=["label"],et=["value"],tt={key:0,class:"config-section mt-4"},it={class:"section-label"},at={class:"section-description mb-3"},st={class:"help"},ot={key:1,class:"config-section mt-4"},nt={class:"section-label"},lt={class:"section-description mb-3"},rt={class:"user-type-checkboxes"},dt={key:0,class:"help mt-2"},ct={key:2,class:"config-section mt-4"},gt={class:"section-label"},ht={class:"section-description mb-3"},ut={class:"modal-footer"},pt={class:"action-config-modal note-modal"},ft={class:"modal-header"},yt={class:"header-left"},mt={class:"header-icon note-icon"},vt={class:"header-text"},kt={class:"modal-body"},bt={class:"config-section"},Tt={class:"section-label"},$t=["placeholder"],Nt={class:"modal-footer"};function wt(e,t,i,wt,Lt,Ct){const Ft=(0,a.g2)("b-button"),St=(0,a.g2)("b-input"),Dt=(0,a.g2)("b-switch"),Et=(0,a.g2)("font-awesome-icon"),_t=(0,a.g2)("Backgroun
1d"),xt=(0,a.g2)("Controls"),It=(0,a.g2)("MiniMap"),At=(0,a.g2)("Handle"),Ot=(0,a.g2)("VueFlow"),Ut=(0,a.g2)("EmailTemplateEditorTipTap"),Wt=(0,a.g2)("b-autocomplete"),Pt=(0,a.g2)("b-field"),Qt=(0,a.g2)("b-select"),Vt=(0,a.g2)("b-numberinput"),Xt=(0,a.g2)("b-checkbox"),Rt=(0,a.g2)("b-taginput");return(0,a.uX)(),(0,a.CE)("section",n,[(0,a.Lk)("div",l,[(0,a.Lk)("div",r,[(0,a.bF)(Ft,{class:"is-rounded mr-2 is-small","icon-left":"fa-arrow-left",onClick:Ct.goBack},null,8,["onClick"]),(0,a.bF)(St,{modelValue:Lt.workflow.name,"onUpdate:modelValue":t[0]||(t[0]=e=>Lt.workflow.name=e),placeholder:e.$t("Workflow name"),size:"is-small",class:"workflow-name-input"},null,8,["modelValue","placeholder"])]),(0,a.Lk)("div",d,[Ct.workflowId?((0,a.uX)(),(0,a.Wv)(Ft,{key:0,class:"is-rounded mr-2 is-small","icon-left":"fa-list-check",onClick:Ct.viewLogs},{default:(0,a.k6)(()=>[(0,a.eW)((0,s.v_)(e.$t("Logs")),1)]),_:1},8,["onClick"])):(0,a.Q3)("",!0),(0,a.bF)(Ft,{class:"is-rounded mr-2 is-small","icon-left":"fa-play",disabled:!Ct.canTest,onClick:Ct.testWorkflow},{default:(0,a.k6)(()=>[(0,a.eW)((0,s.v_)(e.$t("Test")),1)]),_:1},8,["disabled","onClick"]),(0,a.bF)(Ft,{class:"is-primary is-rounded mr-2 is-small","icon-left":"fa-save",loading:Lt.isSaving,onClick:Ct.saveWorkflow},{default:(0,a.k6)(()=>[(0,a.eW)((0,s.v_)(e.$t("Save")),1)]),_:1},8,["loading","onClick"]),(0,a.bF)(Dt,{modelValue:Lt.workflow.isActive,"onUpdate:modelValue":t[1]||(t[1]=e=>Lt.workflow.isActive=e),disabled:!Ct.canActivate,size:"is-small",class:"ml-2"},{default:(0,a.k6)(()=>[(0,a.eW)((0,s.v_)(Lt.workflow.isActive?e.$t("Active"):e.$t("Inactive")),1)]),_:1},8,["modelValue","disabled"])])]),(0,a.Lk)("div",c,[(0,a.Lk)("div",g,[(0,a.Lk)("div",h,[(0,a.Lk)("p",u,(0,s.v_)(e.$t("Triggers")),1),(0,a.Lk)("button",{type:"button",class:(0,s.C4)(["trigger-search-toggle",{"is-active":Lt.showTriggerSearch}]),"aria-label":e.$t("Search triggers"),onClick:t[2]||(t[2]=(...e)=>Ct.toggleTriggerSearch&&Ct.toggleTriggerSearch(...e))},[(0,a.bF)(Et,{icon:"fa-light fa-magnifying-glass"})],10,p)]),Lt.showTriggerSearch?((0,a.uX)(),(0,a.CE)("div",f,[(0,a.bo)((0,a.Lk)("input",{ref:"triggerSearchInput","onUpdate:modelValue":t[3]||(t[3]=e=>Lt.triggerSearchQuery=e),type:"text",class:"trigger-search-input",placeholder:e.$t("Search triggers..."),onKeydown:t[4]||(t[4]=(0,o.jR)((...e)=>Ct.toggleTriggerSearch&&Ct.toggleTriggerSearch(...e),["esc"]))},null,40,y),[[o.Jo,Lt.triggerSearchQuery]])])):(0,a.Q3)("",!0),(0,a.Lk)("div",m,[((0,a.uX)(!0),(0,a.CE)(a.FK,null,(0,a.pI)(Ct.filteredTriggers,e=>((0,a.uX)(),(0,a.CE)("div",{key:e.eventType,class:"palette-item",draggable:"true",onDragstart:t=>Ct.onDragStart(t,"trigger",e)},[(0,a.Lk)("span",k,[(0,a.bF)(Et,{icon:"fa-light fa-bolt"})]),(0,a.Lk)("span",null,(0,s.v_)(e.label),1)],40,v))),128)),Ct.filteredTriggers.length?(0,a.Q3)("",!0):((0,a.uX)(),(0,a.CE)("p",b,(0,s.v_)(e.$t("No triggers found")),1))]),(0,a.Lk)("div",T,[(0,a.Lk)("p",$,(0,s.v_)(e.$t("Actions")),1),(0,a.Lk)("div",N,[((0,a.uX)(!0),(0,a.CE)(a.FK,null,(0,a.pI)(Lt.availableActions,e=>((0,a.uX)(),(0,a.CE)("div",{key:e.type,class:"palette-item",draggable:"true",onDragstart:t=>Ct.onDragStart(t,"action",e)},[(0,a.Lk)("span",L,[(0,a.bF)(Et,{icon:Ct.getActionIcon(e.type)},null,8,["icon"])]),(0,a.Lk)("span",null,(0,s.v_)(e.label),1)],40,w))),128))]),(0,a.Lk)("p",C,(0,s.v_)(e.$t("Annotations")),1),(0,a.Lk)("div",F,[(0,a.Lk)("div",{class:"palette-item note-item",draggable:"true",onDragstart:t[5]||(t[5]=e=>Ct.onDragStart(e,"note",{type:"note"}))},[(0,a.Lk)("span",S,[(0,a.bF)(Et,{icon:"fa-light fa-sticky-note"})]),(0,a.Lk)("span",null,(0,s.v_)(e.$t("Text Note")),1)],32)]),(0,a.Lk)("div",D,[(0,a.Lk)("p",E,(0,s.v_)(e.$t("Drag items to canvas. Shift+drag to select multiple.")),1)])])]),(0,a.Lk)("div",{ref:"canvasWrapper",class:"workflow-canvas-wrapper",onDragover:t[10]||(t[10]=(0,o.D$)(()=>{},["prevent"])),onDrop:t[11]||(t[11]=(...e)=>Ct.onCanvasDrop&&Ct.onCanvasDrop(...e))},[(0,a.bF)(Ot,{ref:"vueFlowRef",nodes:Lt.nodes,"onUpdate:nodes":t[8]||(t[8]=e=>Lt.nodes=e),edges:Lt.edges,"onUpdate:edges":[t[9]||(t[9]=e=>Lt.edges=e),Ct.onEdgesUpdate],"default-viewport":{zoom:1,x:50,y:50},"min-zoom":.25,"max-zoom":2,"snap-to-grid":!0,"snap-grid":[20,20],"default-edge-options":Ct.defaultEdgeOptions,"delete-key-code":null,"selection-mode":"partial",class:"workflow-canvas",onNodeClick:Ct.onNodeClick,onPaneClick:Ct.onPaneClick,onConnect:Ct.onConnect,onSelectionEnd:Ct.onSelectionEnd,onNodeDragStart:Ct.onNodeDragStart,onNodeDragStop:Ct.onNodeDragStop},{"node-trigger":(0,a.k6)(i=>[(0,a.Lk)("div",_,[(0,a.Lk)("div",{class:(0,s.C4)(["vue-flow-node trigger-node",{selected:Lt.selectedNode?.id===i.id,"multi-selected":i.selected}])},[(0,a.bF)(At,{type:"source",position:Lt.Position.Bottom},null,8,["position"]),(0,a.Lk)("div",x,[(0,a.bF)(Et,{icon:"fa-light fa-bolt"})]),(0,a.Lk)("div",I,[(0,a.Lk)("span",A,(0,s.v_)(e.$t("When")),1),(0,a.Lk)("span",O,(0,s.v_)(Ct.getTriggerLabel(i.data)),1),Ct.getTriggerUserTypeCount(i.data)>0?((0,a.uX)(),(0,a.CE)("span",U,(0,s.v_)(Ct.getTriggerUserTypeCount(i.data))+" "+(0,s.v_)(e.$t("user types")),1)):(0,a.Q3)("",!0)]),(0,a.Lk)("button",{class:"node-delete",onClick:(0,o.D$)(e=>Ct.removeNode(i.id),["stop"])},[(0,a.bF)(Et,{icon:"fa-light fa-times"})],8,W)],2),Ct.hasOutgoingEdge(i.id)?(0,a.Q3)("",!0):((0,a.uX)(),(0,a.CE)("div",{key:0,class:(0,s.C4)(["add-action-prompt",{"drag-over":Lt.dragOverNodeId===i.id}]),onDragover:(0,o.D$)(e=>Ct.onPromptDragOver(i.id),["prevent"]),onDragleave:t[6]||(t[6]=(...e)=>Ct.onPromptDragLeave&&Ct.onPromptDragLeave(...e)),onDrop:(0,o.D$)(e=>Ct.onPromptDrop(e,i.id),["prevent"]),onClick:(0,o.D$)(e=>Ct.addActionBelowNode(i.id),["stop"])},[t[38]||(t[38]=(0,a.Lk)("div",{class:"prompt-line"},null,-1)),(0,a.Lk)("div",Q,[(0,a.bF)(Et,{icon:"fa-light fa-plus"}),(0,a.Lk)("span",null,(0,s.v_)(e.$t("Add action")),1)])],42,P))])]),"node-action":(0,a.k6)(i=>[(0,a.Lk)("div",V,[(0,a.Lk)("div",{class:(0,s.C4)(["vue-flow-node action-node",{selected:Lt.selectedNode?.id===i.id,"multi-selected":i.selected}])},[(0,a.bF)(At,{type:"target",position:Lt.Position.Top},null,8,["position"]),(0,a.bF)(At,{type:"source",position:Lt.Position.Bottom},null,8,["position"]),(0,a.Lk)("div",X,[(0,a.bF)(Et,{icon:Ct.getActionIcon(i.data.type)},null,8,["icon"])]),(0,a.Lk)("div",R,[(0,a.Lk)("span",H,(0,s.v_)(e.$t("Then")),1),(0,a.Lk)("span",z,(0,s.v_)(Ct.getActionNodeLabel(i.data)),1),Ct.getDelayText(i.data)?((0,a.uX)(),(0,a.CE)("span",j,[(0,a.bF)(Et,{icon:"fa-light fa-clock"}),(0,a.eW)(" "+(0,s.v_)(Ct.getDelayText(i.data)),1)])):(0,a.Q3)("",!0)]),(0,a.Lk)("button",{class:"node-delete",onClick:(0,o.D$)(e=>Ct.removeNode(i.id),["stop"])},[(0,a.bF)(Et,{icon:"fa-light fa-times"})],8,B)],2),Ct.hasOutgoingEdge(i.id)?(0,a.Q3)("",!0):((0,a.uX)(),(0,a.CE)("div",{key:0,class:(0,s.C4)(["add-action-prompt",{"drag-over":Lt.dragOverNodeId===i.id}]),onDragover:(0,o.D$)(e=>Ct.onPromptDragOver(i.id),["prevent"]),onDragleave:t[7]||(t[7]=(...e)=>Ct.onPromptDragLeave&&Ct.onPromptDragLeave(...e)),onDrop:(0,o.D$)(e=>Ct.onPromptDrop(e,i.id),["prevent"]),onClick:(0,o.D$)(e=>Ct.addActionBelowNode(i.id),["stop"])},[t[39]||(t[39]=(0,a.Lk)("div",{class:"prompt-line"},null,-1)),(0,a.Lk)("div",J,[(0,a.bF)(Et,{icon:"fa-light fa-plus"}),(0,a.Lk)("span",null,(0,s.v_)(e.$t("Add action")),1)])],42,M))])]),"node-note":(0,a.k6)(t=>[(0,a.Lk)("div",{class:(0,s.C4)(["vue-flow-node note-node",{selected:Lt.selectedNode?.id===t.id,"multi-selected":t.selected}])},[(0,a.Lk)("div",K,[(0,a.bF)(Et,{icon:"fa-light fa-sticky-note"}),(0,a.Lk)("span",null,(0,s.v_)(e.$t("Note")),1),(0,a.Lk)("button",{class:"node-delete",onClick:(0,o.D$)(e=>Ct.removeNode(t.id),["stop"])},[(0,a.bF)(Et,{icon:"fa-light fa-times"}
1)],8,q)]),(0,a.Lk)("div",Y,(0,s.v_)(t.data.text||e.$t("Click to add note...")),1)],2)]),default:(0,a.k6)(()=>[(0,a.bF)(_t,{variant:"dots",gap:20,size:2,"pattern-color":"#94a3b8"}),(0,a.bF)(xt,{"show-fit-view":!0,"show-interactive":!1,position:"bottom-right"}),(0,a.bF)(It,{position:"bottom-left",pannable:!0,zoomable:!0})]),_:1},8,["nodes","edges","default-edge-options","onNodeClick","onPaneClick","onConnect","onUpdate:edges","onSelectionEnd","onNodeDragStart","onNodeDragStop"]),0===Lt.nodes.length?((0,a.uX)(),(0,a.CE)("div",Z,[(0,a.bF)(Et,{icon:"fa-light fa-diagram-project",class:"empty-icon"}),(0,a.Lk)("p",null,(0,s.v_)(e.$t("Drag a trigger from the sidebar to start building your workflow")),1)])):(0,a.Q3)("",!0)],544)]),Lt.selectedNode&&"action"===Lt.selectedNode.type?((0,a.uX)(),(0,a.CE)("div",{key:0,class:"action-config-overlay",onClick:t[27]||(t[27]=(0,o.D$)(e=>Lt.selectedNode=null,["self"]))},[(0,a.Lk)("div",G,[(0,a.Lk)("div",ee,[(0,a.Lk)("div",te,[(0,a.Lk)("div",ie,[(0,a.bF)(Et,{icon:Ct.getActionIcon(Lt.selectedNode.data.type)},null,8,["icon"])]),(0,a.Lk)("div",ae,[(0,a.Lk)("h3",null,(0,s.v_)(e.$t("Configure Action")),1),(0,a.Lk)("p",null,(0,s.v_)(Ct.getActionDescription(Lt.selectedNode.data.type)),1)])]),(0,a.Lk)("button",{class:"close-btn",onClick:t[12]||(t[12]=e=>Lt.selectedNode=null)},[(0,a.bF)(Et,{icon:"fa-light fa-times"})])]),(0,a.Lk)("div",se,[(0,a.Lk)("div",oe,[(0,a.Lk)("label",ne,[(0,a.bF)(Et,{icon:"fa-light fa-cog",class:"label-icon"}),(0,a.eW)(" "+(0,s.v_)(e.$t("Action Type")),1)]),(0,a.Lk)("div",le,[((0,a.uX)(!0),(0,a.CE)(a.FK,null,(0,a.pI)(Lt.availableActions,e=>((0,a.uX)(),(0,a.CE)("label",{key:e.type,class:(0,s.C4)(["action-type-option",{"is-selected":Lt.selectedNode.data.type===e.type}])},[(0,a.bo)((0,a.Lk)("input",{"onUpdate:modelValue":t[13]||(t[13]=e=>Lt.selectedNode.data.type=e),type:"radio",value:e.type,class:"action-type-radio"},null,8,re),[[o.XL,Lt.selectedNode.data.type]]),(0,a.Lk)("span",de,[(0,a.bF)(Et,{icon:Ct.getActionIcon(e.type)},null,8,["icon"])]),(0,a.Lk)("span",ce,(0,s.v_)(e.label),1),(0,a.bF)(Et,{icon:"fa-light fa-check",class:"option-check"})],2))),128))])]),"send_email"===Lt.selectedNode.data.type?((0,a.uX)(),(0,a.CE)(a.FK,{key:0},[(0,a.Lk)("div",ge,[(0,a.Lk)("label",he,[(0,a.bF)(Et,{icon:"fa-light fa-heading",class:"label-icon"}),(0,a.eW)(" "+(0,s.v_)(e.$t("Subject Line")),1)]),(0,a.bo)((0,a.Lk)("input",{"onUpdate:modelValue":t[14]||(t[14]=e=>Lt.selectedNode.data.config.customSubject=e),type:"text",class:"config-input",placeholder:e.$t("Enter a compelling subject line...")},null,8,ue),[[o.Jo,Lt.selectedNode.data.config.customSubject]])]),(0,a.Lk)("div",pe,[(0,a.Lk)("label",fe,[(0,a.bF)(Et,{icon:"fa-light fa-file-lines",class:"label-icon"}),(0,a.eW)(" "+(0,s.v_)(e.$t("Email Content")),1)]),(0,a.Lk)("div",ye,[(0,a.bF)(Ut,{modelValue:Lt.selectedNode.data.config.emailBody,"onUpdate:modelValue":t[15]||(t[15]=e=>Lt.selectedNode.data.config.emailBody=e),placeholders:Ct.emailPlaceholders,"is-editable":!0},null,8,["modelValue","placeholders"])])])],64)):(0,a.Q3)("",!0),"add_tag"===Lt.selectedNode.data.type?((0,a.uX)(),(0,a.CE)("div",me,[(0,a.Lk)("label",ve,[(0,a.bF)(Et,{icon:"fa-light fa-tag",class:"label-icon"}),(0,a.eW)(" "+(0,s.v_)(e.$t("Select or Create Tag")),1)]),(0,a.bF)(Pt,null,{default:(0,a.k6)(()=>[(0,a.bF)(Wt,{modelValue:Lt.tagSearchQuery,"onUpdate:modelValue":t[18]||(t[18]=e=>Lt.tagSearchQuery=e),data:Lt.filteredTags,field:"name",loading:Lt.isLoadingTags,placeholder:e.$t("Search or type to create..."),icon:"tag",clearable:"","open-on-focus":"",onTyping:Ct.searchTags,onSelect:Ct.onTagSelect,onKeydown:(0,o.jR)(Ct.onTagTabKey,["tab"])},{empty:(0,a.k6)(()=>[(0,a.Lk)("div",ke,[Lt.tagSearchQuery&&Lt.tagSearchQuery.length>=2?((0,a.uX)(),(0,a.CE)("div",be,[(0,a.eW)((0,s.v_)(e.$t("No tags found."))+" ",1),t[40]||(t[40]=(0,a.Lk)("br",null,null,-1)),(0,a.Lk)("a",{class:"has-text-primary has-text-weight-semibold",onClick:t[16]||(t[16]=e=>Ct.createAndSelectTag(Lt.tagSearchQuery))},(0,s.v_)(e.$t("Press Tab or click here to create"))+' "'+(0,s.v_)(Lt.tagSearchQuery)+'" ',1)])):((0,a.uX)(),(0,a.CE)("div",Te,(0,s.v_)(e.$t("Start typing to search or create a tag")),1))])]),default:(0,a.k6)(e=>[(0,a.Lk)("div",$e,[(0,a.bF)(Et,{icon:"fa-light fa-tag",class:"mr-2"}),(0,a.eW)(" "+(0,s.v_)(e.option.name),1)])]),footer:(0,a.k6)(()=>[Lt.tagSearchQuery&&Lt.tagSearchQuery.length>=2&&!Ct.hasExactTagMatch?((0,a.uX)(),(0,a.CE)("div",{key:0,class:"dropdown-item create-tag-option",onClick:t[17]||(t[17]=e=>Ct.createAndSelectTag(Lt.tagSearchQuery))},[(0,a.bF)(Et,{icon:"fa-light fa-plus",class:"mr-2"}),(0,a.eW)(" "+(0,s.v_)(e.$t("Create"))+' " ',1),(0,a.Lk)("strong",null,(0,s.v_)(Lt.tagSearchQuery),1),t[41]||(t[41]=(0,a.eW)(' " ',-1)),t[42]||(t[42]=(0,a.Lk)("span",{class:"has-text-grey is-size-7 ml-2"},"(Tab)",-1))])):(0,a.Q3)("",!0)]),_:1},8,["modelValue","data","loading","placeholder","onTyping","onSelect","onKeydown"])]),_:1}),Ct.selectedTagName?((0,a.uX)(),(0,a.CE)("div",Ne,[(0,a.Lk)("span",we,[(0,a.bF)(Et,{icon:"fa-light fa-tag",class:"mr-2"}),(0,a.eW)(" "+(0,s.v_)(Ct.selectedTagName)+" ",1),(0,a.Lk)("button",{class:"delete is-small",onClick:t[19]||(t[19]=(...e)=>Ct.clearSelectedTag&&Ct.clearSelectedTag(...e))})])])):(0,a.Q3)("",!0)])):(0,a.Q3)("",!0),"remove_tag"===Lt.selectedNode.data.type?((0,a.uX)(),(0,a.CE)("div",Le,[(0,a.Lk)("label",Ce,[(0,a.bF)(Et,{icon:"fa-light fa-tag",class:"label-icon"}),(0,a.eW)(" "+(0,s.v_)(e.$t("Select Tag to Remove")),1)]),(0,a.bF)(Pt,null,{default:(0,a.k6)(()=>[(0,a.bF)(Wt,{modelValue:Lt.tagSearchQuery,"onUpdate:modelValue":t[20]||(t[20]=e=>Lt.tagSearchQuery=e),data:Lt.filteredTags,field:"name",loading:Lt.isLoadingTags,placeholder:e.$t("Search for a tag..."),icon:"tag",clearable:"","open-on-focus":"",onTyping:Ct.searchTags,onSelect:Ct.onTagSelect},{empty:(0,a.k6)(()=>[(0,a.Lk)("div",Fe,(0,s.v_)(e.$t("No tags found")),1)]),default:(0,a.k6)(e=>[(0,a.Lk)("div",Se,[(0,a.bF)(Et,{icon:"fa-light fa-tag",class:"mr-2"}),(0,a.eW)(" "+(0,s.v_)(e.option.name),1)])]),_:1},8,["modelValue","data","loading","placeholder","onTyping","onSelect"])]),_:1}),Ct.selectedTagName?((0,a.uX)(),(0,a.CE)("div",De,[(0,a.Lk)("span",Ee,[(0,a.bF)(Et,{icon:"fa-light fa-tag",class:"mr-2"}),(0,a.eW)(" "+(0,s.v_)(Ct.selectedTagName)+" ",1),(0,a.Lk)("button",{class:"delete is-small",onClick:t[21]||(t[21]=(...e)=>Ct.clearSelectedTag&&Ct.clearSelectedTag(...e))})])])):(0,a.Q3)("",!0)])):(0,a.Q3)("",!0),(0,a.Lk)("div",_e,[(0,a.Lk)("button",{type:"button",class:"collapse-toggle",onClick:t[22]||(t[22]=e=>Lt.showDelaySection=!Lt.showDelaySection)},[(0,a.bF)(Et,{icon:Lt.showDelaySection?"fa-light fa-chevron-down":"fa-light fa-chevron-right",class:"collapse-icon"},null,8,["icon"]),(0,a.bF)(Et,{icon:"fa-light fa-clock",class:"label-icon"}
1),(0,a.Lk)("span",xe,(0,s.v_)(e.$t("Delay")),1),(0,a.Lk)("span",Ie,(0,s.v_)(e.$t("Optional")),1)]),Lt.showDelaySection?((0,a.uX)(),(0,a.CE)("div",Ae,[(0,a.Lk)("p",Oe,(0,s.v_)(e.$t("Schedule when this action runs after the trigger fires")),1),(0,a.Lk)("div",Ue,[(0,a.Lk)("div",We,[(0,a.bo)((0,a.Lk)("input",{"onUpdate:modelValue":t[23]||(t[23]=e=>Lt.selectedNode.data.config.delayDays=e),type:"number",min:"0",class:"delay-input"},null,512),[[o.Jo,Lt.selectedNode.data.config.delayDays,void 0,{number:!0}]]),(0,a.Lk)("span",Pe,(0,s.v_)(e.$t("days")),1)]),(0,a.Lk)("div",Qe,[(0,a.bo)((0,a.Lk)("input",{"onUpdate:modelValue":t[24]||(t[24]=e=>Lt.selectedNode.data.config.delayHours=e),type:"number",min:"0",max:"23",class:"delay-input"},null,512),[[o.Jo,Lt.selectedNode.data.config.delayHours,void 0,{number:!0}]]),(0,a.Lk)("span",Ve,(0,s.v_)(e.$t("hours")),1)]),(0,a.Lk)("div",Xe,[(0,a.bo)((0,a.Lk)("input",{"onUpdate:modelValue":t[25]||(t[25]=e=>Lt.selectedNode.data.config.delayMinutes=e),type:"number",min:"0",max:"59",class:"delay-input"},null,512),[[o.Jo,Lt.selectedNode.data.config.delayMinutes,void 0,{number:!0}]]),(0,a.Lk)("span",Re,(0,s.v_)(e.$t("minutes")),1)])])])):(0,a.Q3)("",!0)])]),(0,a.Lk)("div",He,[(0,a.bF)(Ft,{class:"is-rounded",onClick:t[26]||(t[26]=e=>Lt.selectedNode=null)},{default:(0,a.k6)(()=>[(0,a.eW)((0,s.v_)(e.$t("Cancel")),1)]),_:1}),(0,a.bF)(Ft,{class:"is-primary is-rounded","icon-left":"fa-check",onClick:Ct.applyNodeChanges},{default:(0,a.k6)(()=>[(0,a.eW)((0,s.v_)(e.$t("Done")),1)]),_:1},8,["onClick"])])])])):(0,a.Q3)("",!0),Lt.selectedNode&&"trigger"===Lt.selectedNode.type?((0,a.uX)(),(0,a.CE)("div",{key:1,class:"action-config-overlay",onClick:t[33]||(t[33]=(0,o.D$)(e=>Lt.selectedNode=null,["self"]))},[(0,a.Lk)("div",ze,[(0,a.Lk)("div",je,[(0,a.Lk)("div",Be,[(0,a.Lk)("div",Me,[(0,a.bF)(Et,{icon:"fa-light fa-bolt"})]),(0,a.Lk)("div",Je,[(0,a.Lk)("h3",null,(0,s.v_)(e.$t("Configure Trigger")),1),(0,a.Lk)("p",null,(0,s.v_)(e.$t("Choose when this workflow should run")),1)])]),(0,a.Lk)("button",{class:"close-btn",onClick:t[28]||(t[28]=e=>Lt.selectedNode=null)},[(0,a.bF)(Et,{icon:"fa-light fa-times"})])]),(0,a.Lk)("div",Ke,[(0,a.Lk)("div",qe,[(0,a.Lk)("label",Ye,[(0,a.bF)(Et,{icon:"fa-light fa-calendar-check",class:"label-icon"}),(0,a.eW)(" "+(0,s.v_)(e.$t("Event Type")),1)]),(0,a.Lk)("div",Ze,[(0,a.bF)(Qt,{modelValue:Lt.selectedNode.data.eventType,"onUpdate:modelValue":t[29]||(t[29]=e=>Lt.selectedNode.data.eventType=e),expanded:"",class:"trigger-select"},{default:(0,a.k6)(()=>[((0,a.uX)(!0),(0,a.CE)(a.FK,null,(0,a.pI)(Ct.triggersByCategory,(e,t)=>((0,a.uX)(),(0,a.CE)("optgroup",{key:t,label:Ct.getCategoryLabel(t)},[((0,a.uX)(!0),(0,a.CE)(a.FK,null,(0,a.pI)(e,e=>((0,a.uX)(),(0,a.CE)("option",{key:e.eventType,value:e.eventType},(0,s.v_)(e.label),9,et))),128))],8,Ge))),128))]),_:1},8,["modelValue"])])]),Ct.triggerRequiresInactiveDays(Lt.selectedNode.data.eventType)?((0,a.uX)(),(0,a.CE)("div",tt,[(0,a.Lk)("label",it,[(0,a.bF)(Et,{icon:"fa-light fa-clock",class:"label-icon"}),(0,a.eW)(" "+(0,s.v_)(e.$t("Days of Inactivity")),1)]),(0,a.Lk)("p",at,(0,s.v_)(e.$t("Trigger when user has been inactive for this many days")),1),(0,a.bF)(Pt,null,{default:(0,a.k6)(()=>[(0,a.bF)(Vt,{modelValue:Lt.selectedNode.data.eventFilters.inactiveDays,"onUpdate:modelValue":t[30]||(t[30]=e=>Lt.selectedNode.data.eventFilters.inactiveDays=e),min:1,max:365,step:1,"controls-position":"compact","controls-rounded":"",onWheel:Ct.blurOnWheel},null,8,["modelValue","onWheel"])]),_:1}),(0,a.Lk)("p",st,(0,s.v_)(e.$t("Common values: 30, 60, 90 days")),1)])):(0,a.Q3)("",!0),Ct.userTypes.length>0&&Ct.triggerSupportsUserTypeFilter(Lt.selectedNode.data.eventType)?((0,a.uX)(),(0,a.CE)("div",ot,[(0,a.Lk)("label",nt,[(0,a.bF)(Et,{icon:"fa-light fa-users",class:"label-icon"}),(0,a.eW)(" "+(0,s.v_)(e.$t("Filter by User Type")),1)]),(0,a.Lk)("p",lt,(0,s.v_)(e.$t("Only trigger for specific user types (leave empty for all)")),1),(0,a.Lk)("div",rt,[((0,a.uX)(!0),(0,a.CE)(a.FK,null,(0,a.pI)(Ct.userTypes,e=>((0,a.uX)(),(0,a.CE)("div",{key:e.id,class:"user-type-checkbox"},[(0,a.bF)(Xt,{"model-value":Ct.isUserTypeSelected(e.id),"onUpdate:modelValue":t=>Ct.toggleUserType(e.id,t)},{default:(0,a.k6)(()=>[(0,a.eW)((0,s.v_)(e.name),1)]),_:2},1032,["model-value","onUpdate:modelValue"])]))),128))]),Ct.userTypeFilterNote?((0,a.uX)(),(0,a.CE)("p",dt,(0,s.v_)(e.$t(Ct.userTypeFilterNote)),1)):(0,a.Q3)("",!0)])):(0,a.Q3)("",!0),Ct.currentEntityFilter?((0,a.uX)(),(0,a.CE)("div",ct,[(0,a.Lk)("label",gt,[(0,a.bF)(Et,{icon:"fa-light fa-filter",class:"label-icon"}),(0,a.eW)(" "+(0,s.v_)(e.$t("Filter by"))+" "+(0,s.v_)(Ct.entityFilterLabel(Lt.selectedNode.data.eventType)),1)]),(0,a.Lk)("p",ht,(0,s.v_)(e.$t("Only trigger for the selected items (leave empty for all)")),1),(0,a.bF)(Rt,{modelValue:Ct.selectedEntityFilterOptions,"onUpdate:modelValue":t[31]||(t[31]=e=>Ct.selectedEntityFilterOptions=e),data:Ct.filteredEntityFilterOptions,autocomplete:"","open-on-focus":!0,"allow-new":!1,"append-to-body":"",field:"name",icon:"magnifying-glass",placeholder:e.$t("Search and select..."),onTyping:Ct.onEntityFilterTyping},null,8,["modelValue","data","placeholder","onTyping"])])):(0,a.Q3)("",!0)]),(0,a.Lk)("div",ut,[(0,a.bF)(Ft,{class:"is-rounded",onClick:t[32]||(t[32]=e=>Lt.selectedNode=null)},{default:(0,a.k6)(()=>[(0,a.eW)((0,s.v_)(e.$t("Cancel")),1)]),_:1}),(0,a.bF)(Ft,{class:"is-primary is-rounded","icon-left":"fa-check",onClick:Ct.applyNodeChanges},{default:(0,a.k6)(()=>[(0,a.eW)((0,s.v_)(e.$t("Done")),1)]),_:1},8,["onClick"])])])])):(0,a.Q3)("",!0),Lt.selectedNode&&"note"===Lt.selectedNode.type?((0,a.uX)(),(0,a.CE)("div",{key:2,class:"action-config-overlay",onClick:t[37]||(t[37]=(0,o.D$)(e=>Lt.selectedNode=null,["self"]))},[(0,a.Lk)("div",pt,[(0,a.Lk)("div",ft,[(0,a.Lk)("div",yt,[(0,a.Lk)("div",mt,[(0,a.bF)(Et,{icon:"fa-light fa-sticky-note"})]),(0,a.Lk)("div",vt,[(0,a.Lk)("h3",null,(0,s.v_)(e.$t("Edit Note")),1),(0,a.Lk)("p",null,(0,s.v_)(e.$t("Add a description or annotation")),1)])]),(0,a.Lk)("button",{class:"close-btn",onClick:t[34]||(t[34]=e=>Lt.selectedNode=null)},[(0,a.bF)(Et,{icon:"fa-light fa-times"})])]),(0,a.Lk)("div",kt,[(0,a.Lk)("div",bt,[(0,a.Lk)("label",Tt,[(0,a.bF)(Et,{icon:"fa-light fa-pen",class:"label-icon"}),(0,a.eW)(" "+(0,s.v_)(e.$t("Note Text")),1)]),(0,a.bo)((0,a.Lk)("textarea",{"onUpdate:modelValue":t[35]||(t[35]=e=>Lt.selectedNode.data.text=e),class:"note-textarea",rows:"5",placeholder:e.$t("Describe what this part of the workflow does...")},null,8,$t),[[o.Jo,Lt.selectedNode.data.text]])])]),(0,a.Lk)("div",Nt,[(0,a.bF)(Ft,{class:"is-rounded",onClick:t[36]||(t[36]=e=>Lt.selectedNode=null)},{default:(0,a.k6)(()=>[(0,a.eW)((0,s.v_)(e.$t("Cancel")),1)]),_:1}),(0,a.bF)(Ft,{class:"is-primary is-rounded","icon-left":"fa-check",onClick:Ct.applyNodeChanges},{default:(0,a.k6)(()=>[(0,a.eW)((0,s.v_)(e.$t("Done")),1)]),_:1},8,["onClick"])])])])):(0,a.Q3)("",!0)])}i(44114),i(18111),i(22489),i(20116),i(7588),i(61701),i(13579);var Lt=i(40834),Ct=i(75408),Ft=i(14366),St=i(76722),Dt=i(65142),Et=i(83350),_t={name:"WorkflowEdit",components:{VueFlow:Ct.nO,Backgroun
1d:Ft.V,Controls:St.H,MiniMap:Dt.of,Handle:Ct.h7,EmailTemplateEditorTipTap:Et.A},data(){return{Position:Ct.yX,isLoading:!1,isSaving:!1,workflow:{name:"",description:"",isActive:!1,priority:0,triggers:[],actions:[],canvasData:null},nodes:[],edges:[],selectedNode:null,showDelaySection:!1,availableTriggers:[],availableActions:[],showTriggerSearch:!1,triggerSearchQuery:"",availableTags:[],availableDonationProducts:[],availableEvents:[],availableForms:[],entityFilterSearch:"",tagSearchQuery:"",filteredTags:[],isLoadingTags:!1,tagSearchDebounceTimer:null,categoryLabels:{user:"User Events",adhesion:"Adhesion Events",course:"Course Events",contract:"Contract Events",membership:"Membership Events",identity:"Identity Events",donation:"Donation Events",event:"Event Attendance",form:"Form Events"},nodeIdCounter:0,dragOverNodeId:null,lastConnectTime:0,history:[],historyIndex:-1,maxHistorySize:50,isUndoingOrRedoing:!1}},computed:{...(0,Lt.L8)(["tenant"]),workflowId(){return this.$route.params.uuid},filteredTriggers(){const e=this.triggerSearchQuery.trim().toLowerCase();return e?this.availableTriggers.filter(t=>(t.label||"").toLowerCase().includes(e)):this.availableTriggers},isNew(){return!this.$route.params.uuid},hasTriggerAndAction(){const e=this.nodes.some(e=>"trigger"===e.type),t=this.nodes.some(e=>"action"===e.type);return e&&t},canTest(){return!!this.workflowId&&this.hasTriggerAndAction},canActivate(){return this.hasTriggerAndAction},triggersByCategory(){const e={};return this.availableTriggers.forEach(t=>{const i=t.category||"other";e[i]||(e[i]=[]),e[i].push(t)}),e},userTypes(){return this.tenant?.roles?this.tenant.roles.filter(e=>!0===e.isUserType):[]},currentEntityFilter(){return this.selectedNode?.data?.eventType?this.triggerEntityFilter(this.selectedNode.data.eventType):null},userTypeFilterNote(){if(!this.selectedNode?.data?.eventType)return null;const e=this.availableTriggers.find(e=>e.eventType===this.selectedNode.data.eventType);return e?.userTypeFilterNote||null},selectedEntityFilterOptions:{get(){const e=this.currentEntityFilter;if(!e)return[];const t=this.selectedNode?.data?.eventFilters?.[e.key]||[];return this.entityFilterOptionsFor(e).filter(e=>t.includes(e.id))},set(e){const t=this.currentEntityFilter;if(!t||!this.selectedNode?.data)return;this.selectedNode.data.eventFilters||(this.selectedNode.data.eventFilters={});const i=this.entityFilterOptionsFor(t).map(e=>e.id),a=this.selectedNode.data.eventFilters[t.key]||[],s=a.filter(e=>!i.includes(e)),o=[...s,...e.map(e=>e.id)];0!==o.length?this.selectedNode.data.eventFilters[t.key]=o:delete this.selectedNode.data.eventFilters[t.key]}},filteredEntityFilterOptions(){const e=this.currentEntityFilter;if(!e)return[];const t=this.selectedNode?.data?.eventFilters?.[e.key]||[],i=this.entityFilterSearch.trim().toLowerCase();return this.entityFilterOptionsFor(e).filter(e=>!t.includes(e.id)&&(!i||(e.name||"").toLowerCase().includes(i)))},emailPlaceholders(){return[{value:"{{firstName}}",description:this.$t("Recipient first name")},{value:"{{lastName}}",description:this.$t("Recipient last name")},{value:"{{fullName}}",description:this.$t("Recipient full name")},{value:"{{userEmail}}",description:this.$t("User email address")},{value:"{{userCompanyName}}",description:this.$t("Recipient company name")},{value:"{{platformLink}}",description:this.$t("Platform link")},{value:"{{profileLink}}",description:this.$t("Profile link")},{value:"{{unsubscribeUrl}}",description:this.$t("Unsubscribe link")}]},defaultEdgeOptions(){return{type:"default",animated:!0}},selectedTagName(){if(!this.selectedNode?.data?.config?.tagId)return null;if(this.selectedNode.data.config.tagName)return this.selectedNode.data.config.tagName;const e=this.availableTags.find(e=>e.id===this.selectedNode.data.config.tagId);return e?.name||null},hasExactTagMatch(){if(!this.tagSearchQuery)return!1;const e=this.tagSearchQuery.toLowerCase().trim();return this.filteredTags.some(t=>t.name.toLowerCase().trim()===e)},selectedNodesCount(){return this.nodes.filter(e=>e.selected).length},canUndo(){return this.historyIndex>0},canRedo(){return this.historyIndex<this.history.length-1}},watch:{currentEntityFilter(e){document.body.classList.toggle("workflow-entity-filter-open",Boolean(e))}},created(){this.fetchMetadata(),this.isNew||this.fetchWorkflow(),document.addEventListener("keydown",this.handleKeyDown)},beforeUnmount(){document.removeEventListener("keydown",this.handleKeyDown),this.tagSearchDebounceTimer&&clearTimeout(this.tagSearchDebounceTimer),document.body.classList.remove("workflow-entity-filter-open")},methods:{toggleTriggerSearch(){this.showTriggerSearch=!this.showTriggerSearch,this.showTriggerSearch?this.$nextTick(()=>{this.$refs.triggerSearchInput?.focus()}):this.triggerSearchQuery=""},handleKeyDown(e){if("INPUT"===e.target.tagName||"TEXTAREA"===e.target.tagName||e.target.isContentEditable)return;const t=navigator.platform.toUpperCase().indexOf("MAC")>=0,i=t?e.metaKey:e.ctrlKey;return i&&"z"===e.key&&!e.shiftKey?(e.preventDefault(),void this.undo()):i&&"z"===e.key&&e.shiftKey||i&&"y"===e.key?(e.preventDefault(),void this.redo()):void("Escape"!==e.key?("Delete"===e.key||"Backspace"===e.key)&&this.selectedNodesCount>0&&(e.preventDefault(),this.deleteSelectedNodes()):this.selectedNode?this.selectedNode=null:this.selectedNodesCount>0&&this.clearSelection())},saveHistory(){if(this.isUndoingOrRedoing)return;const e={nodes:JSON.parse(JSON.stringify(this.nodes.map(e=>({...e,selected:!1})))),edges:JSON.parse(JSON.stringify(this.edges))};this.historyIndex<this.history.length-1&&(this.history=this.history.slice(0,this.historyIndex+1)),this.history.push(e),this.history.length>this.maxHistorySize?this.history.shift():this.historyIndex++}
1,undo(){if(!this.canUndo)return;this.isUndoingOrRedoing=!0,this.historyIndex--;const e=this.history[this.historyIndex];this.nodes=JSON.parse(JSON.stringify(e.nodes)),this.edges=JSON.parse(JSON.stringify(e.edges)),this.selectedNode=null,this.$nextTick(()=>{this.isUndoingOrRedoing=!1})},redo(){if(!this.canRedo)return;this.isUndoingOrRedoing=!0,this.historyIndex++;const e=this.history[this.historyIndex];this.nodes=JSON.parse(JSON.stringify(e.nodes)),this.edges=JSON.parse(JSON.stringify(e.edges)),this.selectedNode=null,this.$nextTick(()=>{this.isUndoingOrRedoing=!1})},fetchMetadata(){this.$http.plain.get("/workflow-metadata").then(e=>{this.availableTriggers=e.data.triggers||[],this.availableActions=e.data.actions||[],this.availableTags=e.data.tags||[],this.availableDonationProducts=e.data.donationProducts||[],this.availableEvents=e.data.events||[],this.availableForms=(e.data.forms||[]).map(e=>({id:e.id,name:e.isAnonymous?`${e.name} (${this.$t("anonymous - cannot trigger")})`:e.name}))}).catch(e=>{console.log(e)})},fetchWorkflow(){this.isLoading=!0,this.$http.plain.get(`/workflows/${this.$route.params.uuid}`).then(e=>{this.workflow=e.data,this.workflow.triggers=this.workflow.triggers||[],this.workflow.actions=this.workflow.actions||[],this.loadCanvasFromWorkflow()}).catch(e=>{console.log(e),this.$buefy.toast.open({message:this.$t("Failed to load workflow"),type:"is-danger"})}).finally(()=>{this.isLoading=!1})},loadCanvasFromWorkflow(){if(this.workflow.canvasData?.nodes&&this.workflow.canvasData?.edges)return this.nodes=this.workflow.canvasData.nodes.map(e=>({...e,selected:!1})),this.edges=this.workflow.canvasData.edges,this.nodes.forEach(e=>{const t=parseInt(e.id.split("-")[1]||"0");t>=this.nodeIdCounter&&(this.nodeIdCounter=t+1)}),this.fitViewToNodes(),void this.$nextTick(()=>this.saveHistory());const e=[],t=[];let i=50;this.workflow.triggers.forEach((t,a)=>{const s="trigger-"+this.nodeIdCounter++;e.push({id:s,type:"trigger",position:{x:200+350*a,y:i},data:{eventType:t.eventType,eventFilters:t.eventFilters||null}})}),i+=150,this.workflow.actions.forEach((a,s)=>{const o="action-"+this.nodeIdCounter++;if(e.push({id:o,type:"action",position:{x:200,y:i+150*s},data:{type:a.type||"send_email",config:a.config||{delayMinutes:0,delayHours:0,delayDays:0,customSubject:"",emailBody:""},stopOnFailure:a.stopOnFailure||!1}}),0===s&&e.find(e=>"trigger"===e.type)){const i=e.find(e=>"trigger"===e.type);t.push({id:`e-${i.id}-${o}`,source:i.id,target:o,type:"default",animated:!0})}else if(s>0){const e="action-"+(this.nodeIdCounter-2);t.push({id:`e-${e}-${o}`,source:e,target:o,type:"default",animated:!0})}}),this.nodes=e,this.edges=t,e.length>0&&this.fitViewToNodes(),this.$nextTick(()=>this.saveHistory())},fitViewToNodes(){this.$nextTick(()=>{setTimeout(()=>{const e=this.$refs.vueFlowRef;e&&"function"===typeof e.fitView&&e.fitView({padding:.3,maxZoom:1,duration:300})},100)})},validateWorkflow(){const e=[],t=this.nodes.filter(e=>"action"===e.type);return t.forEach((t,i)=>{const a=t.data.type||"send_email",s=t.data.config||{},o=i+1;"send_email"===a&&(s.customSubject&&s.customSubject.trim()||e.push(this.$t("Action {num}: Email subject is required",{num:o})),s.emailBody&&s.emailBody.trim()||e.push(this.$t("Action {num}: Email content is required",{num:o}))),"add_tag"===a&&(s.tagId||e.push(this.$t("Action {num}: Tag is required for Add Tag action",{num:o}))),"remove_tag"===a&&(s.tagId||e.push(this.$t("Action {num}: Tag is required for Remove Tag action",{num:o})))}),e},saveWorkflow(){const e=this.validateWorkflow();if(e.length>0)return void this.$buefy.toast.open({message:e[0],type:"is-danger",duration:5e3});this.isSaving=!0;const t=this.nodes.filter(e=>"trigger"===e.type).map(e=>({eventType:e.data.eventType,eventFilters:e.data.eventFilters})),i=this.nodes.filter(e=>"trigger"===e.type),a={};i.forEach((e,t)=>{a[e.id]=t});const s=this.nodes.filter(e=>"action"===e.type),o=s.map((e,t)=>{const i=this.edges.find(t=>t.target===e.id);let s=null;return i&&void 0!==a[i.source]&&(s=a[i.source]),{type:e.data.type||"send_email",position:t,config:e.data.config||{},stopOnFailure:e.data.stopOnFailure||!1,triggerIndex:s}}),n={name:this.workflow.name||"Untitled Workflow",description:this.workflow.description,isActive:this.workflow.isActive,priority:this.workflow.priority,triggers:t,actions:o,canvasData:{nodes:this.nodes,edges:this.edges}},l=this.isNew?this.$http.plain.post("/workflows",n):this.$http.plain.patch(`/workflows/${this.$route.params.uuid}`,n);l.then(e=>
1{this.$buefy.toast.open({message:this.$t("Workflow saved"),type:"is-success"}),this.isNew&&this.$router.replace({name:"WorkflowEdit",params:{uuid:e.data.uuid}}),this.workflow=e.data}).catch(e=>{console.log(e),this.$buefy.toast.open({message:e.response?.data?.detail||this.$t("Failed to save workflow"),type:"is-danger"})}).finally(()=>{this.isSaving=!1})},testWorkflow(){this.$http.plain.post(`/workflows/${this.$route.params.uuid}/test`,{}).then(e=>{const t=e.data.result;t.would_execute?this.$buefy.toast.open({message:this.$t("Workflow test passed - conditions met"),type:"is-success"}):this.$buefy.toast.open({message:this.$t("Workflow test: conditions not met"),type:"is-warning"})}).catch(e=>{console.log(e),this.$buefy.toast.open({message:this.$t("Failed to test workflow"),type:"is-danger"})})},goBack(){this.$router.push({name:"WorkflowList"})},viewLogs(){this.workflowId&&this.$router.push({name:"WorkflowLogs",params:{uuid:this.workflowId}})},getTriggerLabel(e){const t=e.eventType,i=this.availableTriggers.find(e=>e.eventType===t);let a=i?.label||t;return"user.inactive_days"===t&&e.eventFilters?.inactiveDays&&(a=this.$t("User Inactive")+` (${e.eventFilters.inactiveDays} ${this.$t("days")})`),a},getCategoryLabel(e){return this.categoryLabels[e]||e},getActionIcon(e){const t={send_email:"fa-light fa-envelope",add_tag:"fa-light fa-tag",remove_tag:"fa-light fa-tag"};return t[e]||"fa-light fa-bolt"},getActionDescription(e){const t={send_email:this.$t("Set up your automated email"),add_tag:this.$t("Add a tag to the user profile"),remove_tag:this.$t("Remove a tag from the user profile")};return t[e]||""},getActionLabel(e){const t=this.availableActions.find(t=>t.type===e);return t?.label||e},getActionNodeLabel(e){const t=e.type||"send_email",i=e.config||{};if("send_email"===t)return i.customSubject||this.$t("Send Email");if("add_tag"===t){const e=i.tagName||this.availableTags.find(e=>e.id===i.tagId)?.name;return e?this.$t("Add tag: {name}",{name:e}):this.$t("Add Tag")}if("remove_tag"===t){const e=i.tagName||this.availableTags.find(e=>e.id===i.tagId)?.name;return e?this.$t("Remove tag: {name}",{name:e}):this.$t("Remove Tag")}return this.getActionLabel(t)},searchTags(e){this.tagSearchDebounceTimer&&clearTimeout(this.tagSearchDebounceTimer),!e||e.length<2?this.filteredTags=[]:this.tagSearchDebounceTimer=setTimeout(()=>{this.isLoadingTags=!0,this.$http.plain.get("/tags",{params:{name:e}}).then(e=>{const t=e.data["hydra:member"]||[];this.filteredTags=t.map(e=>({id:e.id,name:e.name,"@id":e["@id"]})),t.forEach(e=>{this.availableTags.find(t=>t.id===e.id)||this.availableTags.push({id:e.id,name:e.name})})}).catch(e=>{console.log(e),this.filteredTags=[]}).finally(()=>{this.isLoadingTags=!1})},300)},onTagSelect(e){e&&this.selectedNode&&(this.selectedNode.data.config.tagId=e.id,this.tagSearchQuery="",this.availableTags.find(t=>t.id===e.id)||this.availableTags.push({id:e.id,name:e.name}))},createAndSelectTag(e){if(!e||e.length<2)return;const t=-Date.now(),i={id:t,name:e,isTemp:!0};this.availableTags.push(i),this.selectedNode&&(this.selectedNode.data.config.tagId=t,this.selectedNode.data.config.tagName=e),this.tagSearchQuery="",this.filteredTags=[],this.$http.plain.post("/tags/create-or-get",{name:e}).then(e=>{const i={id:e.data.id,name:e.data.name},a=this.availableTags.findIndex(e=>e.id===t);-1!==a&&this.availableTags.splice(a,1),this.availableTags.find(e=>e.id===i.id)||this.availableTags.push(i),this.selectedNode&&this.selectedNode.data.config.tagId===t&&(this.selectedNode.data.config.tagId=i.id,delete this.selectedNode.data.config.tagName),this.nodes.forEach(e=>{e.data?.config?.tagId===t&&(e.data.config.tagId=i.id,delete e.data.config.tagName)})}).catch(e=>{console.log(e);const i=this.availableTags.findIndex(e=>e.id===t);-1!==i&&this.availableTags.splice(i,1),this.selectedNode&&this.selectedNode.data.config.tagId===t&&(this.selectedNode.data.config.tagId=null,delete this.selectedNode.data.config.tagName),this.$buefy.toast.open({message:this.$t("Failed to create tag"),type:"is-danger"})})},clearSelectedTag(){this.selectedNode&&(this.selectedNode.data.config.tagId=null),this.tagSearchQuery=""},onTagTabKey(e){this.tagSearchQuery&&this.tagSearchQuery.length>=2&&!this.hasExactTagMatch&&(e.preventDefault(),this.createAndSelectTag(this.tagSearchQuery))},getDelayText(e){const t=e.config||{},i=t.delayDays||0,a=t.delayHours||0,s=t.delayMinutes||0;if(0===i&&0===a&&0===s)return"";const o=[];return i>0&&o.push(`${i}d`),a>0&&o.push(`${a}h`),s>0&&o.push(`${s}m`),o.join(" ")},getTriggerUserTypeCount(e){return e.eventFilters?.userTypeIds?.length||0},onNodeClick(e){const t=e.node,i=e.event;
1if(!(i?.shiftKey||i?.metaKey||i?.ctrlKey)&&(this.clearSelection(),this.selectedNode={id:t.id,type:t.type,data:JSON.parse(JSON.stringify(t.data))},"trigger"===this.selectedNode.type)){this.selectedNode.data.eventFilters||(this.selectedNode.data.eventFilters={});const e=this.triggerRequiresInactiveDays(this.selectedNode.data.eventType);e&&!this.selectedNode.data.eventFilters.inactiveDays&&(this.selectedNode.data.eventFilters.inactiveDays=30)}},onPaneClick(){this.selectedNode=null},onEdgesUpdate(){},onConnect(e){const t=Date.now();if(t-this.lastConnectTime<100)return;this.lastConnectTime=t;const i=this.nodes.find(t=>t.id===e.source),a=this.nodes.find(t=>t.id===e.target);if(!i||!a)return;if("action"===i.type&&"trigger"===a.type)return void this.$buefy.toast.open({message:this.$t("Actions cannot connect to triggers"),type:"is-warning"});const s=this.edges.find(t=>t.source===e.source&&t.target===e.target);s||(this.edges.push({id:`e-${e.source}-${e.target}`,source:e.source,target:e.target,type:"default",animated:!0}),this.saveHistory())},addEdgeToFlow(e){this.edges.push(e)},applyNodeChanges(){if(!this.selectedNode)return;const e=this.nodes.findIndex(e=>e.id===this.selectedNode.id);-1!==e&&(this.nodes[e].data={...this.selectedNode.data}),this.selectedNode=null,this.saveHistory()},removeNode(e){this.nodes=this.nodes.filter(t=>t.id!==e),this.edges=this.edges.filter(t=>t.source!==e&&t.target!==e),this.selectedNode?.id===e&&(this.selectedNode=null),this.saveHistory()},deleteSelectedNodes(){const e=this.nodes.filter(e=>e.selected).map(e=>e.id);0!==e.length&&(this.nodes=this.nodes.filter(e=>!e.selected),this.edges=this.edges.filter(t=>!e.includes(t.source)&&!e.includes(t.target)),this.selectedNode&&e.includes(this.selectedNode.id)&&(this.selectedNode=null),this.saveHistory())},clearSelection(){this.nodes=this.nodes.map(e=>({...e,selected:!1}))},onSelectionEnd(){},onNodeDragStart(){},onNodeDragStop(){this.saveHistory()},onDragStart(e,t,i){e.dataTransfer.setData("nodeType",t),e.dataTransfer.setData("nodeData",JSON.stringify(i))},onCanvasDrop(e){const t=e.dataTransfer.getData("nodeType"),i=JSON.parse(e.dataTransfer.getData("nodeData")||"{}");if(!t)return;const a=this.$refs.vueFlowRef;let s;if(a&&"function"===typeof a.screenToFlowCoordinate)s=a.screenToFlowCoordinate({x:e.clientX,y:e.clientY});else if(a&&"function"===typeof a.project){const t=this.$refs.canvasWrapper.getBoundingClientRect();s=a.project({x:e.clientX-t.left,y:e.clientY-t.top})}else{const t=this.$refs.canvasWrapper.getBoundingClientRect(),i=a?.viewport||{x:0,y:0,zoom:1};s={x:(e.clientX-t.left-i.x)/i.zoom,y:(e.clientY-t.top-i.y)/i.zoom}}"trigger"===t?this.addTriggerNode(i,s):"action"===t?this.addActionNode(i,s):"note"===t&&this.addNoteNode(s)},onPromptDragOver(e){this.dragOverNodeId=e},onPromptDragLeave(){this.dragOverNodeId=null},onPromptDrop(e,t){e.stopPropagation(),this.dragOverNodeId=null;const i=e.dataTransfer.getData("nodeType"),a=JSON.parse(e.dataTransfer.getData("nodeData")||"{}");if("action"!==i)return void this.$buefy.toast.open({message:this.$t("Only actions can be added here"),type:"is-warning"});const s=this.nodes.find(e=>e.id===t);if(!s)return;const o={x:s.position.x,y:s.position.y+180},n=this.addActionNode(a,o);this.addEdgeToFlow({id:`e-${t}-${n}`,source:t,target:n,type:"default",animated:!0})},addTriggerNode(e,t=null){const i="trigger-"+this.nodeIdCounter++,a=t||{x:200,y:50+150*this.nodes.filter(e=>"trigger"===e.type).length};this.nodes.push({id:i,type:"trigger",position:a,data:{eventType:e.eventType,eventFilters:null}}),this.saveHistory()},addActionNode(e,t=null){const i="action-"+this.nodeIdCounter++,a=this.nodes.filter(e=>"action"===e.type).length,s=t||{x:200,y:200+150*a};return this.nodes.push({id:i,type:"action",position:s,data:{type:e.type,config:{delayMinutes:0,delayHours:0,delayDays:0,customSubject:"",emailBody:""},stopOnFailure:!1}}),this.saveHistory(),i},addNoteNode(e=null){const t="note-"+this.nodeIdCounter++,i=this.nodes.filter(e=>"note"===e.type).length,a=e||{x:500,y:50+120*i};return this.nodes.push({id:t,type:"note",position:a,data:{text:""}}),this.saveHistory(),this.$nextTick(()=>{const e=this.nodes.find(e=>e.id===t);e&&(this.selectedNode={id:e.id,type:e.type,data:JSON.parse(JSON.stringify(e.data))})}),t},hasOutgoingEdge(e){return this.edges.some(t=>t.source===e)},addActionBelowNode(e,t){const i=this.nodes.find(t=>
1t.id===e);if(!i)return;const a={x:i.position.x,y:i.position.y+180},s=this.availableActions.find(e=>"send_email"===e.type)||this.availableActions[0];if(!s)return;const o=this.addActionNode(s,a);this.addEdgeToFlow({id:`e-${e}-${o}`,source:e,target:o,type:"default",animated:!0}),this.$nextTick(()=>{const e=this.nodes.find(e=>e.id===o);e&&(this.clearSelection(),this.selectedNode={id:e.id,type:e.type,data:JSON.parse(JSON.stringify(e.data))})})},triggerSupportsUserTypeFilter(e){const t=this.availableTriggers.find(t=>t.eventType===e);return t?.supportsUserTypeFilter||!1},triggerRequiresInactiveDays(e){const t=this.availableTriggers.find(t=>t.eventType===e);return t?.requiresInactiveDays||!1},blurOnWheel(e){e.target.blur()},isUserTypeSelected(e){return!!this.selectedNode?.data?.eventFilters?.userTypeIds&&this.selectedNode.data.eventFilters.userTypeIds.includes(e)},toggleUserType(e,t){if(!this.selectedNode?.data)return;this.selectedNode.data.eventFilters||(this.selectedNode.data.eventFilters={}),this.selectedNode.data.eventFilters.userTypeIds||(this.selectedNode.data.eventFilters.userTypeIds=[]);const i=this.selectedNode.data.eventFilters.userTypeIds,a=i.indexOf(e);t&&-1===a?i.push(e):t||-1===a||i.splice(a,1)},triggerEntityFilter(e){const t=this.availableTriggers.find(t=>t.eventType===e);return t?.entityFilter||null},entityFilterLabel(e){const t=this.triggerEntityFilter(e);return t?this.$t(t.label):""},entityFilterOptionsFor(e){return e?"donationProducts"===e.optionsKey?this.availableDonationProducts:"events"===e.optionsKey?this.availableEvents:"tags"===e.optionsKey?this.availableTags:"forms"===e.optionsKey?this.availableForms:[]:[]},onEntityFilterTyping(e){this.entityFilterSearch=e||""}}},xt=i(66262);const It=(0,xt.A)(_t,[["render",wt],["__scopeId","data-v-18e7c9ca"]]);var At=It},83350:function(e,t,i){i.d(t,{A:function(){return N}});var a=i(20641),s=i(90033);const o={class:"email-template-editor-tiptap"},n={class:"template-actions-row py-4"},l={class:"icon-text"},r={class:"icon"},d={class:"icon-text"},c={class:"icon"},g={class:"placeholder-item"},h={class:"has-text-grey is-size-7"},u={key:1},p={class:"tag is-rounded p-4 ml-2"},f={class:"icon-text mr-3"},y={class:"icon is-small"};function m(e,t,i,m,v,k){const b=(0,a.g2)("font-awesome-icon"),T=(0,a.g2)("b-button"),$=(0,a.g2)("b-dropdown-item"),N=(0,a.g2)("b-dropdown"),w=(0,a.g2)("TipTap");return(0,a.uX)(),(0,a.CE)("div",o,[(0,a.Lk)("div",n,[i.showTemplateActions?((0,a.uX)(),(0,a.Wv)(T,{key:0,size:"is-small is-rounded",onClick:k.handleUseDefault},{default:(0,a.k6)(()=>[(0,a.Lk)("span",l,[(0,a.Lk)("span",r,[(0,a.bF)(b,{icon:"fa-light fa-refresh"})]),(0,a.Lk)("span",null,(0,s.v_)(e.$t("Use default")),1)])]),_:1},8,["onClick"])):(0,a.Q3)("",!0),(0,a.bF)(N,{"aria-role":"list",position:"is-bottom-left",class:"placeholder-dropdown ml-2"},{trigger:(0,a.k6)(()=>[(0,a.bF)(T,{size:"is-small",type:"is-info",class:"is-rounded"},{default:(0,a.k6)(()=>[(0,a.Lk)("span",d,[(0,a.Lk)("span",c,[(0,a.bF)(b,{icon:"fa-light fa-brackets-curly"})]),(0,a.Lk)("span",null,(0,s.v_)(e.$t("Insert Placeholder")),1)])]),_:1})]),default:(0,a.k6)(()=>[((0,a.uX)(!0),(0,a.CE)(a.FK,null,(0,a.pI)(v.availablePlaceholders,e=>((0,a.uX)(),(0,a.Wv)($,{key:e.value,"aria-role":"listitem",onClick:t=>k.insertPlaceholder(e)},{default:(0,a.k6)(()=>[(0,a.Lk)("div",g,[(0,a.Lk)("strong",null,(0,s.v_)(e.value),1),(0,a.Lk)("span",h,(0,s.v_)(e.description),1)])]),_:2},1032,["onClick"]))),128))]),_:1}),i.showTemplateActions&&k.showDraftIndicator?((0,a.uX)(),(0,a.CE)("div",u,[(0,a.Lk)("span",p,[(0,a.Lk)("span",f,[(0,a.Lk)("span",y,[(0,a.bF)(b,{icon:"fa-light fa-file-pen"})])]),(0,a.Lk)("span",null,(0,s.v_)(e.$t("Draft")),1)])])):(0,a.Q3)("",!0)]),(0,a.bF)(w,{ref:"tiptapEditor",modelValue:v.content,"onUpdate:modelValue":[t[0]||(t[0]=e=>v.content=e),k.handleContentUpdate],"is-editable":i.isEditable,"has-placeholders":!0},null,8,["modelValue","is-editable","onUpdate:modelValue"])])}i(44114),i(18111),i(7588);var v=i(53719),k=i(61273),b={name:"EmailTemplateEditorTipTap",components:{TipTap:v.A,FontAwesomeIcon:k.gc},props:{modelValue:{type:String,default:""},templateType:{type:String,default:""},isEditable:{type:Boolean,default:!0},placeholders:{type:[Array,Object],default:()=>[]},showTemplateActions:{type:Boolean,default:!0}},data(){return{content:this.modelValue,isDirty:!1,isDefault:!1,originalContent:"",hasSubjectDraft:!1,availablePlaceholders:[]}},computed:{showDraftIndicator(){return this.isDirty&&this.originalContent!==this.getCurrentContent()||this.isDefault||this.hasSubjectDraft}},watch:{modelValue(e){this.content=e},placeholders:{immediate:!0,handler(e){this.updateAvailablePlaceholders(e)}}},mounted(){this.$nextTick(()=>{this.originalContent=this.getCurrentContent(),this.isDirty=!1}),this.placeholders&&this.updateAvailablePlaceholders(this.placeholders)},methods:{handleContentUpdate(e){this.$emit("update:modelValue",e),this.isDirty=!0},updateAvailablePlaceholders(e){const t=[];if(e)if("object"!==typeof e||Array.isArray(e)){if(Array.isArray(e))return void(this.availablePlaceholders=e)}else Object.keys(e).forEach(i=>
1{i.includes(".")||t.push({value:e[i],description:this.getPlaceholderDescription(i)})});this.availablePlaceholders=t},getPlaceholderDescription(e){const t={firstName:this.$t("Recipient first name"),lastName:this.$t("Recipient last name"),fullName:this.$t("Recipient full name"),organizationName:this.$t("Organization name"),organizationHost:this.$t("Organization host"),organizationSlug:this.$t("Organization slug"),platformLink:this.$t("Platform link"),link:this.$t("Action link"),userEmail:this.$t("User email address"),contactEmail:this.$t("Contact email"),localCenterName:this.$t("Local center name"),profileLink:this.$t("Profile link"),actionLabel:this.$t("Action button label"),tenantName:this.$t("Tenant name"),organizationLogo:this.$t("Organization logo"),expirationDate:this.$t("Expiration date"),eventDate:this.$t("Event date"),eventName:this.$t("Event name"),eventLocation:this.$t("Event location"),platformLink:this.$t("Agenda management link"),productName:this.$t("Product name"),paymentAmount:this.$t("Payment amount"),invoicedFor:this.$t("Invoiced for"),rejectionReason:this.$t("Rejection reason"),confirmationLink:this.$t("Confirmation link"),subscriptionLink:this.$t("Subscription link"),unsubscribeUrl:this.$t("Unsubscribe link"),preferencesUrl:this.$t("Preferences link")};return t[e]||e},insertPlaceholder(e){const t=this.$refs.tiptapEditor?.editor;if(t){const i=e.value.replace(/[{}]/g,"").trim(),a=["renewalLink","unsubscribeLink"].includes(i);if(a){const i=`<a href="${e.value}" class="email-placeholder-link">${e.value}</a>`;t.chain().focus().insertContent(i).run()}else{const a=`<span data-placeholder="${i}" class="email-placeholder">${e.value}</span>`;t.chain().focus().insertContent(a).run()}}},getContent(){const e=this.$refs.tiptapEditor?.editor;return e?e.getHTML():""},getCurrentContent(){const e=this.$refs.tiptapEditor?.editor;return e?e.getHTML():""},getContentForEmail(){const e=this.$refs.tiptapEditor?.editor;return e?this.getHTMLWithInlineStyles():""},getHTMLWithInlineStyles(){const e=this.$refs.tiptapEditor?.editor;if(!e)return"";let t=e.getHTML();return t=t.replace(/<h1([^>]*)>/gi,"<h1$1 style=\"font-size: 2em; font-weight: bold; margin: 0.67em 0; text-decoration: none; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;\">"),t=t.replace(/<h2([^>]*)>/gi,"<h2$1 style=\"font-size: 1.5em; font-weight: bold; margin: 0.83em 0; text-decoration: none; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;\">"),t=t.replace(/<h3([^>]*)>/gi,"<h3$1 style=\"font-size: 1.17em; font-weight: bold; margin: 1em 0; text-decoration: none; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;\">"),t=t.replace(/<p([^>]*)>/gi,(e,t)=>{const i=t.match(/style="[^"]*text-align:\s*([^;"]*)"/),a=i?i[1]:"left";return`<p${t.replace(/style="[^"]*"/,"")} style="margin: 1em 0; line-height: 1.6; text-decoration: none; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif; font-size: 14px; text-align: ${a};">`}),t=t.replace(/<ul([^>]*)>/gi,"<ul$1 style=\"padding-left: 2rem; margin: 1em 0; text-decoration: none; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;\">"),t=t.replace(/<ol([^>]*)>/gi,"<ol$1 style=\"padding-left: 2rem; margin: 1em 0; text-decoration: none; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;\">"),t=t.replace(/<li([^>]*)>/gi,'<li$1 style="margin: 0.25em 0; font-size: 14px; text-decoration: none;">'),t=t.replace(/<a([^>]*)>/gi,(e,t)=>t.includes("email-placeholder-link")?e:`<a${t} style="color: #007bff; text-decoration: underline;">`),t=t.replace(/<strong\b([^>]*)>/gi,'<strong$1 style="font-weight: bold; text-decoration: none;">'),t=t.replace(/<b\b([^>]*)>/gi,'<b$1 style="font-weight: bold; text-decoration: none;">'),t=t.replace(/<em\b([^>]*)>/gi,'<em$1 style="font-style: italic; text-decoration: none;">'),t=t.replace(/<i\b([^>]*)>/gi,'<i$1 style="font-style: italic; text-decoration: none;">'),t=t.replace(/<u\b([^>]*)>/gi,'<u$1 style="text-decoration: underline;">'),t=t.replace(/<s\b([^>]*)>/gi,'<s$1 style="text-decoration: line-through;">'),t=t.replace(/<strike\b([^>]*)>/gi,'<strike$1 style="text-decoration: line-through;">'),t=t.replace(/<code\b([^>]*)>/gi,'<code$1 style="font-family: monospace; background-color: #f4f4f4; padding: 2px 4px; border-radius: 3px;">'),t=t.replace(/<img([^>]*)>/gi,(e,t)=>t.includes("style=")?e:`<img${t} style="max-width: 100%; height: auto; display: block; margin: 1em 0;">`),t},markAsSaved(){this.originalContent=this.getCurrentContent(),this.isDirty=!1,this.isDefault=!1,this.hasSubjectDraft=!1},setSubjectDraft(e){this.hasSubjectDraft=e},resetDraftState(){this.originalContent=this.getCurrentContent(),this.isDirty=!1,this.hasSubjectDraft=!1},handleUseDefault(){this.isDefault=!0,this.$emit("use-default")},setContent(e){const t=this.$refs.tiptapEditor?.editor;if(t){let i=e;e&&"string"===typeof e&&(i=e.replace(/<h1[^>]*>\s*<\/h1>/gi,"").replace(/<h1[^>]*><br[^>]*>\s*<\/h1>/gi,"").replace(/<h1[^>]*> \s*<\/h1>/gi,"")),t.commands.setContent(i),this.$nextTick(()=>{const e=this.$el.querySelector(".ProseMirror");
1if(e){const t=e.querySelectorAll("img");t.forEach(e=>{e.src.includes("orgo-black.png")||e.src.includes("orgo-square.png")?(e.style.width="200px",e.style.height="auto",e.style.maxWidth="100%",e.style.objectFit="contain"):(e.style.width="400px",e.style.height="auto",e.style.maxWidth="100%",e.style.objectFit="contain")})}this.resetDraftState()})}},uploadPendingImages(){return this.$refs.tiptapEditor?.uploadPendingImages()}}},T=i(66262);const $=(0,T.A)(b,[["render",m],["__scopeId","data-v-f90b4ae8"]]);var 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.