@nuraly/lumenui 0.2.2 → 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/dist/cdn.js +1 -0
  2. package/dist/nuralyui.bundle.js +2467 -1857
  3. package/dist/nuralyui.bundle.js.gz +0 -0
  4. package/dist/src/components/canvas/bundle.js +569 -204
  5. package/dist/src/components/canvas/bundle.js.gz +0 -0
  6. package/dist/src/components/canvas/canvas.constants.d.ts +1 -1
  7. package/dist/src/components/canvas/canvas.constants.js +1 -1
  8. package/dist/src/components/canvas/workflow-canvas.component.d.ts +7 -0
  9. package/dist/src/components/canvas/workflow-canvas.component.js +46 -2
  10. package/dist/src/components/canvas/workflow-canvas.types.d.ts +8 -1
  11. package/dist/src/components/canvas/workflow-canvas.types.js +157 -0
  12. package/dist/src/components/chat-panel/bundle.js +216 -0
  13. package/dist/src/components/chat-panel/bundle.js.gz +0 -0
  14. package/dist/src/components/chat-panel/chat-panel.component.d.ts +85 -0
  15. package/dist/src/components/chat-panel/chat-panel.component.js +510 -0
  16. package/dist/src/components/chat-panel/chat-panel.style.d.ts +2 -0
  17. package/dist/src/components/chat-panel/chat-panel.style.js +127 -0
  18. package/dist/src/components/chat-panel/chat-panel.types.d.ts +54 -0
  19. package/dist/src/components/chat-panel/chat-panel.types.js +2 -0
  20. package/dist/src/components/chat-panel/index.d.ts +3 -0
  21. package/dist/src/components/chat-panel/index.js +2 -0
  22. package/dist/src/components/chatbot/bundle.js +1 -1
  23. package/dist/src/components/chatbot/bundle.js.gz +0 -0
  24. package/dist/src/components/chatbot/providers/workflow-socket-provider.js +1 -1
  25. package/dist/src/components/presence/bundle.js +69 -42
  26. package/dist/src/components/presence/bundle.js.gz +0 -0
  27. package/dist/src/components/presence/presence-chat.component.d.ts +2 -0
  28. package/dist/src/components/presence/presence-chat.component.js +12 -2
  29. package/dist/src/components/presence/presence.component.d.ts +30 -6
  30. package/dist/src/components/presence/presence.component.js +277 -30
  31. package/dist/src/components/presence/presence.types.d.ts +2 -0
  32. package/dist/src/components/toast/bundle.js +11 -9
  33. package/dist/src/components/toast/bundle.js.gz +0 -0
  34. package/dist/src/components/toast/toast.component.d.ts +8 -0
  35. package/dist/src/components/toast/toast.component.js +17 -7
  36. package/dist/src/components/video/bundle.js +13 -12
  37. package/dist/src/components/video/bundle.js.gz +0 -0
  38. package/dist/src/components/video/video.component.d.ts +15 -1
  39. package/dist/src/components/video/video.component.js +131 -3
  40. package/package.json +5 -10
  41. package/packages/common/dist/VERSIONS.md +1 -1
@@ -1,4 +1,4 @@
1
- import{css as e,LitElement as t,html as i,nothing as n,svg as a}from"lit";import{property as o,state as s,customElement as r,query as l}from"lit/decorators.js";import{styleMap as c}from"lit/directives/style-map.js";import{unsafeSVG as d}from"lit/directives/unsafe-svg.js";import{classMap as p}from"lit/directives/class-map.js";import{unsafeHTML as h}from"lit/directives/unsafe-html.js";import{repeat as u}from"lit/directives/repeat.js";import{io as b}from"socket.io-client";import{map as f}from"lit/directives/map.js";import{ifDefined as g}from"lit/directives/if-defined.js";import{createRef as v,ref as m}from"lit/directives/ref.js";import{CodeJar as x}from"codejar";import y from"highlight.js/lib/core";import w from"highlight.js/lib/languages/javascript";import $ from"highlight.js/lib/languages/typescript";import k from"highlight.js/lib/languages/json";import S from"highlight.js/lib/languages/xml";import C from"highlight.js/lib/languages/css";import T from"highlight.js/lib/languages/markdown";import M from"highlight.js/lib/languages/python";import z from"highlight.js/lib/languages/sql";import{choose as E}from"lit/directives/choose.js";var O=function(e,t,i,n){for(var a,o=arguments.length,s=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n,r=e.length-1;r>=0;r--)(a=e[r])&&(s=(o<3?a(s):o>3?a(t,i,s):a(t,i))||s);return o>3&&s&&Object.defineProperty(t,i,s),s};let A=class extends t{constructor(){super(...arguments),this.nodes=[{id:1,x:100,y:100,label:"Node 1"},{id:2,x:300,y:150,label:"Node 2"},{id:4,x:600,y:250,label:"Node 3"}],this.connections=[{from:1,to:2}],this.activeNode=null,this.connectionStart=null,this.offsetX=0,this.offsetY=0,this.startPos=null,this.canvas=null,this.ctx=null,this.dragNode=e=>{this.activeNode&&(this.activeNode.x=e.clientX-this.offsetX,this.activeNode.y=e.clientY-this.offsetY,this.requestUpdate(),this.drawConnections())},this.stopDragging=()=>{this.activeNode=null,window.removeEventListener("mousemove",this.dragNode),window.removeEventListener("mouseup",this.stopDragging)}}render(){return i`
1
+ import{css as e,LitElement as t,html as i,nothing as n,svg as a}from"lit";import{property as o,state as s,customElement as r,query as l}from"lit/decorators.js";import{styleMap as c}from"lit/directives/style-map.js";import{unsafeSVG as d}from"lit/directives/unsafe-svg.js";import{classMap as p}from"lit/directives/class-map.js";import{unsafeHTML as h}from"lit/directives/unsafe-html.js";import{repeat as u}from"lit/directives/repeat.js";import{io as b}from"socket.io-client";import{map as f}from"lit/directives/map.js";import{ifDefined as g}from"lit/directives/if-defined.js";import{createRef as v,ref as m}from"lit/directives/ref.js";import{CodeJar as x}from"codejar";import y from"highlight.js/lib/core";import w from"highlight.js/lib/languages/javascript";import $ from"highlight.js/lib/languages/typescript";import k from"highlight.js/lib/languages/json";import S from"highlight.js/lib/languages/xml";import C from"highlight.js/lib/languages/css";import T from"highlight.js/lib/languages/markdown";import M from"highlight.js/lib/languages/python";import E from"highlight.js/lib/languages/sql";import{choose as z}from"lit/directives/choose.js";var A=function(e,t,i,n){for(var a,o=arguments.length,s=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n,r=e.length-1;r>=0;r--)(a=e[r])&&(s=(o<3?a(s):o>3?a(t,i,s):a(t,i))||s);return o>3&&s&&Object.defineProperty(t,i,s),s};let O=class extends t{constructor(){super(...arguments),this.nodes=[{id:1,x:100,y:100,label:"Node 1"},{id:2,x:300,y:150,label:"Node 2"},{id:4,x:600,y:250,label:"Node 3"}],this.connections=[{from:1,to:2}],this.activeNode=null,this.connectionStart=null,this.offsetX=0,this.offsetY=0,this.startPos=null,this.canvas=null,this.ctx=null,this.dragNode=e=>{this.activeNode&&(this.activeNode.x=e.clientX-this.offsetX,this.activeNode.y=e.clientY-this.offsetY,this.requestUpdate(),this.drawConnections())},this.stopDragging=()=>{this.activeNode=null,window.removeEventListener("mousemove",this.dragNode),window.removeEventListener("mouseup",this.stopDragging)}}render(){return i`
2
2
  <div class="container">
3
3
  <div class="canvas-container">
4
4
  <!--button class="add-button" @click="${this.addNode}">+</button-->
@@ -34,7 +34,7 @@ import{css as e,LitElement as t,html as i,nothing as n,svg as a}from"lit";import
34
34
  * Copyright 2024 Nuraly, Laabidi Aymen
35
35
  * SPDX-License-Identifier: MIT
36
36
  */
37
- var I,P;A.styles=e`
37
+ var I,P;O.styles=e`
38
38
  .container {
39
39
  display: flex;
40
40
  justify-content: space-between;
@@ -98,12 +98,12 @@ var I,P;A.styles=e`
98
98
  white-space: pre-wrap;
99
99
  word-wrap: break-word;
100
100
  }
101
- `,O([o({type:Array})],A.prototype,"nodes",void 0),O([o({type:Array})],A.prototype,"connections",void 0),O([s()],A.prototype,"activeNode",void 0),O([s()],A.prototype,"connectionStart",void 0),O([s()],A.prototype,"canvas",void 0),O([s()],A.prototype,"ctx",void 0),A=O([r("nodes-canvas")],A),function(e){e.QUERY="QUERY",e.INSERT="INSERT",e.UPDATE="UPDATE",e.DELETE="DELETE",e.LIST="LIST",e.READ="READ",e.SEARCH="SEARCH",e.COPY="COPY",e.MOVE="MOVE",e.UPLOAD="UPLOAD",e.DOWNLOAD="DOWNLOAD",e.GET_SIGNED_URL="GET_SIGNED_URL",e.MARK_READ="MARK_READ",e.MARK_UNREAD="MARK_UNREAD"}(I||(I={})),function(e){e.EQUALS="=",e.NOT_EQUALS="!=",e.GREATER_THAN=">",e.GREATER_OR_EQUAL=">=",e.LESS_THAN="<",e.LESS_OR_EQUAL="<=",e.IN="in",e.NOT_IN="notIn",e.LIKE="like",e.IS_NULL="isNull",e.IS_NOT_NULL="isNotNull"}(P||(P={}));const N=[{value:P.EQUALS,label:"equals",types:["string","number","boolean"]},{value:P.NOT_EQUALS,label:"not equals",types:["string","number","boolean"]},{value:P.GREATER_THAN,label:"greater than",types:["number","date"]},{value:P.GREATER_OR_EQUAL,label:"greater or equal",types:["number","date"]},{value:P.LESS_THAN,label:"less than",types:["number","date"]},{value:P.LESS_OR_EQUAL,label:"less or equal",types:["number","date"]},{value:P.IN,label:"in list",types:["string","number"]},{value:P.NOT_IN,label:"not in list",types:["string","number"]},{value:P.LIKE,label:"contains",types:["string"]},{value:P.IS_NULL,label:"is empty",types:["any"],requiresValue:!1},{value:P.IS_NOT_NULL,label:"is not empty",types:["any"],requiresValue:!1}],R=[{value:"postgresql",label:"PostgreSQL",icon:"database",defaultPort:5432},{value:"mysql",label:"MySQL",icon:"database",defaultPort:3306},{value:"mongodb",label:"MongoDB",icon:"database",defaultPort:27017},{value:"sqlite",label:"SQLite",icon:"database",defaultPort:0},{value:"mssql",label:"SQL Server",icon:"database",defaultPort:1433},{value:"oracle",label:"Oracle",icon:"database",defaultPort:1521}],D={operation:I.QUERY,connectionPath:null,dbType:null,schema:null,dataSource:null,entity:null,filter:null,fields:{},select:[],orderBy:[],limit:null,offset:null,outputVariable:"results"},_=[{value:I.QUERY,label:"Query",icon:"search",description:"Fetch records"},{value:I.INSERT,label:"Insert",icon:"plus",description:"Create record"},{value:I.UPDATE,label:"Update",icon:"edit",description:"Modify records"},{value:I.DELETE,label:"Delete",icon:"trash",description:"Remove records"}],j=[{id:"basic",title:"Basic"},{id:"filter",title:"Filter",description:"Define conditions to filter records",showWhen:{operation:[I.QUERY,I.UPDATE,I.DELETE]}},{id:"fields",title:"Fields",showWhen:{operation:[I.INSERT,I.UPDATE]}},{id:"select",title:"Select Fields",showWhen:{operation:[I.QUERY]}},{id:"sorting",title:"Sorting",showWhen:{operation:[I.QUERY]}},{id:"pagination",title:"Pagination",showWhen:{operation:[I.QUERY]}},{id:"output",title:"Output"}];function L(e,t){return!e.showWhen||e.showWhen.operation.includes(t)}function F(e){const t=[];return e.operation||t.push({field:"operation",message:"Operation is required"}),e.connectionPath||e.dataSource||t.push({field:"connectionPath",message:"Database connection is required"}),e.entity||t.push({field:"entity",message:"Table/collection is required"}),e.operation!==I.INSERT&&e.operation!==I.UPDATE||0!==Object.keys(e.fields).length||t.push({field:"fields",message:"At least one field is required"}),e.operation!==I.DELETE||e.filter||t.push({field:"filter",message:"Filter is required for DELETE (safety)"}),t}
101
+ `,A([o({type:Array})],O.prototype,"nodes",void 0),A([o({type:Array})],O.prototype,"connections",void 0),A([s()],O.prototype,"activeNode",void 0),A([s()],O.prototype,"connectionStart",void 0),A([s()],O.prototype,"canvas",void 0),A([s()],O.prototype,"ctx",void 0),O=A([r("nodes-canvas")],O),function(e){e.QUERY="QUERY",e.INSERT="INSERT",e.UPDATE="UPDATE",e.DELETE="DELETE",e.LIST="LIST",e.READ="READ",e.SEARCH="SEARCH",e.COPY="COPY",e.MOVE="MOVE",e.UPLOAD="UPLOAD",e.DOWNLOAD="DOWNLOAD",e.GET_SIGNED_URL="GET_SIGNED_URL",e.MARK_READ="MARK_READ",e.MARK_UNREAD="MARK_UNREAD"}(I||(I={})),function(e){e.EQUALS="=",e.NOT_EQUALS="!=",e.GREATER_THAN=">",e.GREATER_OR_EQUAL=">=",e.LESS_THAN="<",e.LESS_OR_EQUAL="<=",e.IN="in",e.NOT_IN="notIn",e.LIKE="like",e.IS_NULL="isNull",e.IS_NOT_NULL="isNotNull"}(P||(P={}));const N=[{value:P.EQUALS,label:"equals",types:["string","number","boolean"]},{value:P.NOT_EQUALS,label:"not equals",types:["string","number","boolean"]},{value:P.GREATER_THAN,label:"greater than",types:["number","date"]},{value:P.GREATER_OR_EQUAL,label:"greater or equal",types:["number","date"]},{value:P.LESS_THAN,label:"less than",types:["number","date"]},{value:P.LESS_OR_EQUAL,label:"less or equal",types:["number","date"]},{value:P.IN,label:"in list",types:["string","number"]},{value:P.NOT_IN,label:"not in list",types:["string","number"]},{value:P.LIKE,label:"contains",types:["string"]},{value:P.IS_NULL,label:"is empty",types:["any"],requiresValue:!1},{value:P.IS_NOT_NULL,label:"is not empty",types:["any"],requiresValue:!1}],R=[{value:"postgresql",label:"PostgreSQL",icon:"database",defaultPort:5432},{value:"mysql",label:"MySQL",icon:"database",defaultPort:3306},{value:"mongodb",label:"MongoDB",icon:"database",defaultPort:27017},{value:"sqlite",label:"SQLite",icon:"database",defaultPort:0},{value:"mssql",label:"SQL Server",icon:"database",defaultPort:1433},{value:"oracle",label:"Oracle",icon:"database",defaultPort:1521}],D={operation:I.QUERY,connectionPath:null,dbType:null,schema:null,dataSource:null,entity:null,filter:null,fields:{},select:[],orderBy:[],limit:null,offset:null,outputVariable:"results"},_=[{value:I.QUERY,label:"Query",icon:"search",description:"Fetch records"},{value:I.INSERT,label:"Insert",icon:"plus",description:"Create record"},{value:I.UPDATE,label:"Update",icon:"edit",description:"Modify records"},{value:I.DELETE,label:"Delete",icon:"trash",description:"Remove records"}],j=[{id:"basic",title:"Basic"},{id:"filter",title:"Filter",description:"Define conditions to filter records",showWhen:{operation:[I.QUERY,I.UPDATE,I.DELETE]}},{id:"fields",title:"Fields",showWhen:{operation:[I.INSERT,I.UPDATE]}},{id:"select",title:"Select Fields",showWhen:{operation:[I.QUERY]}},{id:"sorting",title:"Sorting",showWhen:{operation:[I.QUERY]}},{id:"pagination",title:"Pagination",showWhen:{operation:[I.QUERY]}},{id:"output",title:"Output"}];function L(e,t){return!e.showWhen||e.showWhen.operation.includes(t)}function F(e){const t=[];return e.operation||t.push({field:"operation",message:"Operation is required"}),e.connectionPath||e.dataSource||t.push({field:"connectionPath",message:"Database connection is required"}),e.entity||t.push({field:"entity",message:"Table/collection is required"}),e.operation!==I.INSERT&&e.operation!==I.UPDATE||0!==Object.keys(e.fields).length||t.push({field:"fields",message:"At least one field is required"}),e.operation!==I.DELETE||e.filter||t.push({field:"filter",message:"Filter is required for DELETE (safety)"}),t}
102
102
  /**
103
103
  * @license
104
104
  * Copyright 2024 Nuraly, Laabidi Aymen
105
105
  * SPDX-License-Identifier: MIT
106
- */var B,U,V,H,q,W,K,G,J;!function(e){e.START="START",e.END="END",e.HTTP_START="HTTP_START",e.HTTP_END="HTTP_END",e.CHAT_START="CHAT_START",e.CHAT_OUTPUT="CHAT_OUTPUT",e.FUNCTION="FUNCTION",e.HTTP="HTTP",e.CONDITION="CONDITION",e.DELAY="DELAY",e.PARALLEL="PARALLEL",e.LOOP="LOOP",e.TRANSFORM="TRANSFORM",e.SUB_WORKFLOW="SUB_WORKFLOW",e.EMAIL="EMAIL",e.EMAIL_READER="EMAIL_READER",e.SENDGRID="SENDGRID",e.NOTIFICATION="NOTIFICATION",e.DATABASE="DATABASE",e.VARIABLE="VARIABLE",e.CHATBOT="CHATBOT",e.DEBUG="DEBUG",e.LLM="LLM",e.OCR="OCR",e.WEB_SEARCH="WEB_SEARCH",e.WEB_CRAWL="WEB_CRAWL",e.DOCUMENT_GENERATOR="DOCUMENT_GENERATOR",e.FILE_STORAGE="FILE_STORAGE",e.GOOGLE_CLOUD_STORAGE="GOOGLE_CLOUD_STORAGE",e.S3="S3",e.EMBEDDING="EMBEDDING",e.DOCUMENT_LOADER="DOCUMENT_LOADER",e.TEXT_SPLITTER="TEXT_SPLITTER",e.VECTOR_WRITE="VECTOR_WRITE",e.VECTOR_SEARCH="VECTOR_SEARCH",e.CONTEXT_BUILDER="CONTEXT_BUILDER",e.SUMMARIZATION="SUMMARIZATION",e.GUARDRAIL="GUARDRAIL",e.SLACK_SEND_MESSAGE="SLACK_SEND_MESSAGE",e.SLACK_GET_CHANNEL_INFO="SLACK_GET_CHANNEL_INFO",e.SLACK_LIST_CHANNELS="SLACK_LIST_CHANNELS",e.SLACK_ADD_REACTION="SLACK_ADD_REACTION",e.SLACK_UPLOAD_FILE="SLACK_UPLOAD_FILE",e.RERANKER="RERANKER",e.SHOPIFY="SHOPIFY",e.TELEGRAM_SEND="TELEGRAM_SEND",e.TWILIO_SMS="TWILIO_SMS",e.TWILIO_VOICE="TWILIO_VOICE",e.TELEGRAM_BOT="TELEGRAM_BOT",e.SLACK_SOCKET="SLACK_SOCKET",e.DISCORD_BOT="DISCORD_BOT",e.WHATSAPP_WEBHOOK="WHATSAPP_WEBHOOK",e.CUSTOM_WEBSOCKET="CUSTOM_WEBSOCKET",e.GOOGLE_CALENDAR="GOOGLE_CALENDAR",e.RABBITMQ_TRIGGER="RABBITMQ_TRIGGER",e.KAFKA="KAFKA",e.KAFKA_TRIGGER="KAFKA_TRIGGER",e.ZENDESK="ZENDESK",e.GITLAB="GITLAB",e.MCP="MCP",e.INFORMATION_EXTRACTOR="INFORMATION_EXTRACTOR",e.HUBSPOT="HUBSPOT",e.JIRA="JIRA",e.ELASTICSEARCH="ELASTICSEARCH",e.CALENDLY_TRIGGER="CALENDLY_TRIGGER",e.UI_TABLE="UI_TABLE",e.NOTE="NOTE",e.FRAME="FRAME"}(B||(B={})),function(e){e.AGENT="AGENT",e.TOOL="TOOL",e.MEMORY="MEMORY",e.CONTEXT_MEMORY="CONTEXT_MEMORY",e.PROMPT="PROMPT",e.LLM="AGENT_LLM",e.RETRIEVER="RETRIEVER",e.CHAIN="CHAIN",e.ROUTER="ROUTER",e.HUMAN_INPUT="HUMAN_INPUT",e.OUTPUT_PARSER="OUTPUT_PARSER",e.STRUCTURED_OUTPUT="STRUCTURED_OUTPUT"}(U||(U={})),function(e){e.TABLE="DB_TABLE",e.VIEW="DB_VIEW",e.INDEX="DB_INDEX",e.RELATIONSHIP="DB_RELATIONSHIP",e.CONSTRAINT="DB_CONSTRAINT",e.QUERY="DB_QUERY"}(V||(V={})),function(e){e.STICKY_NOTE="WB_STICKY_NOTE",e.SHAPE_RECTANGLE="WB_SHAPE_RECTANGLE",e.SHAPE_CIRCLE="WB_SHAPE_CIRCLE",e.SHAPE_DIAMOND="WB_SHAPE_DIAMOND",e.SHAPE_TRIANGLE="WB_SHAPE_TRIANGLE",e.SHAPE_ARROW="WB_SHAPE_ARROW",e.SHAPE_LINE="WB_SHAPE_LINE",e.SHAPE_STAR="WB_SHAPE_STAR",e.SHAPE_HEXAGON="WB_SHAPE_HEXAGON",e.TEXT_BLOCK="WB_TEXT_BLOCK",e.IMAGE="WB_IMAGE",e.DRAWING="WB_DRAWING",e.FRAME="WB_FRAME",e.VOTING="WB_VOTING",e.MERMAID="WB_MERMAID",e.ANCHOR="WB_ANCHOR",e.WORKFLOW="WB_WORKFLOW",e.DATABASE="WB_DATABASE"}(H||(H={})),function(e){e.WORKFLOW="WORKFLOW",e.DATABASE="DATABASE",e.WHITEBOARD="WHITEBOARD"}(q||(q={})),function(e){e.DISCONNECTED="DISCONNECTED",e.CONNECTING="CONNECTING",e.CONNECTED="CONNECTED",e.PAUSED="PAUSED",e.HANDOFF_PENDING="HANDOFF_PENDING",e.ERROR="ERROR"}(W||(W={})),function(e){e.IDLE="IDLE",e.PENDING="PENDING",e.RUNNING="RUNNING",e.COMPLETED="COMPLETED",e.FAILED="FAILED",e.CANCELLED="CANCELLED",e.PAUSED="PAUSED",e.WAITING="WAITING"}(K||(K={})),function(e){e.INPUT="INPUT",e.OUTPUT="OUTPUT",e.CONFIG="CONFIG",e.CONDITIONAL_TRUE="CONDITIONAL_TRUE",e.CONDITIONAL_FALSE="CONDITIONAL_FALSE",e.CONDITIONAL_DEFAULT="CONDITIONAL_DEFAULT",e.LOOP_ITEM="LOOP_ITEM",e.LOOP_DONE="LOOP_DONE",e.PARALLEL_BRANCH="PARALLEL_BRANCH",e.ERROR="ERROR"}(G||(G={})),function(e){e.SELECT="SELECT",e.PAN="PAN",e.CONNECT="CONNECT",e.ADD_NODE="ADD_NODE"}(J||(J={}));const Y={[B.START]:"#22c55e",[B.END]:"#ef4444",[B.HTTP_START]:"#059669",[B.HTTP_END]:"#dc2626",[B.CHAT_START]:"#0ea5e9",[B.CHAT_OUTPUT]:"#06b6d4",[B.FUNCTION]:"#3b82f6",[B.HTTP]:"#8b5cf6",[B.CONDITION]:"#f59e0b",[B.DELAY]:"#6b7280",[B.PARALLEL]:"#06b6d4",[B.LOOP]:"#ec4899",[B.TRANSFORM]:"#14b8a6",[B.SUB_WORKFLOW]:"#6366f1",[B.EMAIL]:"#f97316",[B.EMAIL_READER]:"#06b6d4",[B.SENDGRID]:"#1A82E2",[B.NOTIFICATION]:"#84cc16",[B.DATABASE]:"#a855f7",[B.VARIABLE]:"#64748b",[B.CHATBOT]:"#0ea5e9",[B.DEBUG]:"#f97316",[B.LLM]:"#22d3ee",[B.OCR]:"#0d9488",[B.INFORMATION_EXTRACTOR]:"#8B5CF6",[B.WEB_SEARCH]:"#3b82f6",[B.WEB_CRAWL]:"#6366f1",[B.DOCUMENT_GENERATOR]:"#0284c7",[B.FILE_STORAGE]:"#f59e0b",[B.GOOGLE_CLOUD_STORAGE]:"#4285f4",[B.S3]:"#FF9900",[B.EMBEDDING]:"#8b5cf6",[B.DOCUMENT_LOADER]:"#ec4899",[B.TEXT_SPLITTER]:"#14b8a6",[B.VECTOR_WRITE]:"#10b981",[B.VECTOR_SEARCH]:"#06b6d4",[B.CONTEXT_BUILDER]:"#a855f7",[B.SUMMARIZATION]:"#8B5CF6",[B.GUARDRAIL]:"#ef4444",[B.SLACK_SEND_MESSAGE]:"#4A154B",[B.SLACK_GET_CHANNEL_INFO]:"#4A154B",[B.SLACK_LIST_CHANNELS]:"#4A154B",[B.SLACK_ADD_REACTION]:"#4A154B",[B.SLACK_UPLOAD_FILE]:"#4A154B",[B.RERANKER]:"#d946ef",[B.SHOPIFY]:"#96bf48",[B.TELEGRAM_SEND]:"#0088cc",[B.TWILIO_SMS]:"#F22F46",[B.TWILIO_VOICE]:"#F22F46",[B.TELEGRAM_BOT]:"#0088cc",[B.SLACK_SOCKET]:"#4A154B",[B.DISCORD_BOT]:"#5865F2",[B.WHATSAPP_WEBHOOK]:"#25D366",[B.CUSTOM_WEBSOCKET]:"#6366f1",[B.GOOGLE_CALENDAR]:"#4285F4",[B.RABBITMQ_TRIGGER]:"#FF6600",[B.KAFKA]:"#231F20",[B.KAFKA_TRIGGER]:"#231F20",[B.ZENDESK]:"#03363d",[B.GITLAB]:"#FC6D26",[B.MCP]:"#7c3aed",[B.HUBSPOT]:"#FF7A59",[B.JIRA]:"#0052CC",[B.ELASTICSEARCH]:"#00bfb3",[B.CALENDLY_TRIGGER]:"#006BFF",[B.UI_TABLE]:"#0891b2",[B.NOTE]:"#fef08a",[B.FRAME]:"#6366f1",[U.AGENT]:"#10b981",[U.TOOL]:"#0ea5e9",[U.MEMORY]:"#d946ef",[U.CONTEXT_MEMORY]:"#c026d3",[U.PROMPT]:"#f472b6",[U.LLM]:"#22d3ee",[U.RETRIEVER]:"#a78bfa",[U.CHAIN]:"#fbbf24",[U.ROUTER]:"#fb923c",[U.HUMAN_INPUT]:"#4ade80",[U.OUTPUT_PARSER]:"#2dd4bf",[U.STRUCTURED_OUTPUT]:"#f59e0b",[V.TABLE]:"#64748b",[V.VIEW]:"#a855f7",[V.INDEX]:"#f59e0b",[V.RELATIONSHIP]:"#ec4899",[V.CONSTRAINT]:"#ef4444",[V.QUERY]:"#06b6d4",[H.STICKY_NOTE]:"#fef08a",[H.SHAPE_RECTANGLE]:"#3b82f6",[H.SHAPE_CIRCLE]:"#8b5cf6",[H.SHAPE_DIAMOND]:"#f59e0b",[H.SHAPE_TRIANGLE]:"#22c55e",[H.SHAPE_ARROW]:"#6b7280",[H.SHAPE_LINE]:"#6b7280",[H.SHAPE_STAR]:"#f97316",[H.SHAPE_HEXAGON]:"#ec4899",[H.TEXT_BLOCK]:"#111827",[H.IMAGE]:"#06b6d4",[H.DRAWING]:"#14b8a6",[H.FRAME]:"#6366f1",[H.VOTING]:"#ef4444",[H.MERMAID]:"#8b5cf6",[H.ANCHOR]:"#f59e0b",[H.WORKFLOW]:"#6366f1",[H.DATABASE]:"#64748b"},Q={[B.START]:"play",[B.END]:"stop",[B.HTTP_START]:"download",[B.HTTP_END]:"upload",[B.CHAT_START]:"message-circle",[B.CHAT_OUTPUT]:"message-square",[B.FUNCTION]:"code",[B.HTTP]:"globe",[B.CONDITION]:"git-branch",[B.DELAY]:"clock",[B.PARALLEL]:"git-merge",[B.LOOP]:"repeat",[B.TRANSFORM]:"shuffle",[B.SUB_WORKFLOW]:"layers",[B.EMAIL]:"mail",[B.EMAIL_READER]:"mail-open",[B.SENDGRID]:"send",[B.NOTIFICATION]:"bell",[B.DATABASE]:"database",[B.VARIABLE]:"box",[B.CHATBOT]:"message-circle",[B.DEBUG]:"bug",[B.LLM]:"brain",[B.OCR]:"scan",[B.INFORMATION_EXTRACTOR]:"search",[B.WEB_SEARCH]:"search",[B.WEB_CRAWL]:"globe",[B.DOCUMENT_GENERATOR]:"file-text",[B.FILE_STORAGE]:"hard-drive",[B.GOOGLE_CLOUD_STORAGE]:"cloud",[B.S3]:"cloud",[B.EMBEDDING]:"hash",[B.DOCUMENT_LOADER]:"file-text",[B.TEXT_SPLITTER]:"scissors",[B.VECTOR_WRITE]:"database",[B.VECTOR_SEARCH]:"search",[B.CONTEXT_BUILDER]:"layers",[B.SUMMARIZATION]:"file-minus",[B.GUARDRAIL]:"shield",[B.SLACK_SEND_MESSAGE]:"message-square",[B.SLACK_GET_CHANNEL_INFO]:"hash",[B.SLACK_LIST_CHANNELS]:"list",[B.SLACK_ADD_REACTION]:"smile-plus",[B.SLACK_UPLOAD_FILE]:"upload",[B.RERANKER]:"arrow-up-down",[B.SHOPIFY]:"shopping-cart",[B.TELEGRAM_SEND]:"send",[B.TWILIO_SMS]:"message-square",[B.TWILIO_VOICE]:"phone",[B.TELEGRAM_BOT]:"send",[B.SLACK_SOCKET]:"message-square",[B.DISCORD_BOT]:"gamepad-2",[B.WHATSAPP_WEBHOOK]:"phone",[B.CUSTOM_WEBSOCKET]:"radio",[B.GOOGLE_CALENDAR]:"calendar",[B.RABBITMQ_TRIGGER]:"inbox",[B.KAFKA]:"message-square-share",[B.KAFKA_TRIGGER]:"radio",[B.ZENDESK]:"ticket",[B.GITLAB]:"git-merge",[B.MCP]:"plug",[B.HUBSPOT]:"users",[B.JIRA]:"ticket",[B.ELASTICSEARCH]:"search",[B.CALENDLY_TRIGGER]:"calendar",[B.UI_TABLE]:"table",[B.NOTE]:"sticky-note",[B.FRAME]:"square",[U.AGENT]:"cpu",[U.TOOL]:"tool",[U.MEMORY]:"hard-drive",[U.CONTEXT_MEMORY]:"brain",[U.PROMPT]:"message-square",[U.LLM]:"brain",[U.RETRIEVER]:"search",[U.CHAIN]:"link",[U.ROUTER]:"git-pull-request",[U.HUMAN_INPUT]:"user",[U.OUTPUT_PARSER]:"file-text",[U.STRUCTURED_OUTPUT]:"braces",[V.TABLE]:"table",[V.VIEW]:"eye",[V.INDEX]:"list",[V.RELATIONSHIP]:"git-merge",[V.CONSTRAINT]:"shield",[V.QUERY]:"terminal",[H.STICKY_NOTE]:"sticky-note",[H.SHAPE_RECTANGLE]:"square",[H.SHAPE_CIRCLE]:"circle",[H.SHAPE_DIAMOND]:"diamond",[H.SHAPE_TRIANGLE]:"triangle",[H.SHAPE_ARROW]:"arrow-right",[H.SHAPE_LINE]:"minus",[H.SHAPE_STAR]:"star",[H.SHAPE_HEXAGON]:"hexagon",[H.TEXT_BLOCK]:"type",[H.IMAGE]:"image",[H.DRAWING]:"pen-tool",[H.FRAME]:"frame",[H.VOTING]:"thumbs-up",[H.MERMAID]:"git-branch",[H.ANCHOR]:"anchor",[H.WORKFLOW]:"layers",[H.DATABASE]:"table"},Z=[{type:B.START,name:"Start",description:"Entry point of the workflow",icon:Q[B.START],color:Y[B.START],category:"control",defaultConfig:{},defaultPorts:{inputs:[],outputs:[{id:"out",type:G.OUTPUT,label:"Output"}]}},{type:B.END,name:"End",description:"Exit point of the workflow",icon:Q[B.END],color:Y[B.END],category:"control",defaultConfig:{},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[]}},{type:B.HTTP_START,name:"HTTP Trigger",description:"Start workflow from HTTP request",icon:Q[B.HTTP_START],color:Y[B.HTTP_START],category:"trigger",defaultConfig:{httpPath:"/webhook",httpMethod:"POST",httpAuth:"none",httpCors:!0,httpRateLimit:100,httpRequestSchema:{}},defaultPorts:{inputs:[],outputs:[{id:"out",type:G.OUTPUT,label:"Request"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.HTTP_END,name:"HTTP Response",description:"Return HTTP response to caller",icon:Q[B.HTTP_END],color:Y[B.HTTP_END],category:"control",defaultConfig:{httpStatusCode:200,httpResponseHeaders:{"Content-Type":"application/json"},httpResponseBody:"{{data}}",httpContentType:"application/json"},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[]}},{type:B.CHAT_START,name:"Chat Trigger",description:"Start workflow from chatbot message",icon:Q[B.CHAT_START],color:Y[B.CHAT_START],category:"trigger",defaultConfig:{outputVariable:"chatInput",enableFileUpload:!1,maxFileSize:10,maxFiles:5,allowImages:!0,allowDocuments:!1,allowText:!1,allowAudio:!1,allowVideo:!1},defaultPorts:{inputs:[],outputs:[{id:"out",type:G.OUTPUT,label:"Message"},{id:"files",type:G.OUTPUT,label:"Files"}]}},{type:B.CHAT_OUTPUT,name:"Chat Output",description:"Send message to chatbot during execution",icon:Q[B.CHAT_OUTPUT],color:Y[B.CHAT_OUTPUT],category:"action",defaultConfig:{message:"${variables.response}",messageType:"text",typing:!1,typingDelay:1e3},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"out",type:G.OUTPUT,label:"Output"}]}},{type:B.LLM,name:"LLM",description:"Call AI language model (OpenAI, Anthropic, etc.)",icon:Q[B.LLM],color:Y[B.LLM],category:"action",defaultConfig:{provider:"openai",model:"gpt-4",temperature:.7,maxTokens:2048,systemPrompt:"",userPrompt:"${variables.message}"},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"},{id:"context_memory",type:G.INPUT,label:"Context Memory"}],outputs:[{id:"out",type:G.OUTPUT,label:"Response"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.OCR,name:"OCR",description:"Extract text from images using OCR",icon:Q[B.OCR],color:Y[B.OCR],category:"action",defaultConfig:{imageSource:"variable",imageField:"${input.files[0].base64}",language:"fr",detectLayout:!1,outputVariable:"ocrResult"},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Image"}],outputs:[{id:"out",type:G.OUTPUT,label:"Text"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.INFORMATION_EXTRACTOR,name:"Information Extractor",description:"Extract structured data from unstructured text using AI",icon:Q[B.INFORMATION_EXTRACTOR],color:Y[B.INFORMATION_EXTRACTOR],category:"action",defaultConfig:{inputField:"text",schema:[{name:"field1",type:"string",description:"",required:!0}],model:"gpt-4o-mini",provider:"openai",instructions:""},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"out",type:G.OUTPUT,label:"Extracted"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.FUNCTION,name:"Function",description:"Invoke a Nuraly function",icon:Q[B.FUNCTION],color:Y[B.FUNCTION],category:"action",defaultConfig:{functionId:"",inputMapping:{},outputMapping:{}},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"out",type:G.OUTPUT,label:"Output"}]}},{type:B.HTTP,name:"HTTP Request",description:"Make an HTTP request",icon:Q[B.HTTP],color:Y[B.HTTP],category:"action",defaultConfig:{method:"GET",url:"",headers:{},timeout:3e4},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"out",type:G.OUTPUT,label:"Success"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.CONDITION,name:"Condition",description:"Branch based on a condition",icon:Q[B.CONDITION],color:Y[B.CONDITION],category:"control",defaultConfig:{expression:"",language:"javascript"},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"true",type:G.CONDITIONAL_TRUE,label:"True"},{id:"false",type:G.CONDITIONAL_FALSE,label:"False"}]}},{type:B.DELAY,name:"Delay",description:"Wait for a specified duration",icon:Q[B.DELAY],color:Y[B.DELAY],category:"control",defaultConfig:{duration:1e3,unit:"milliseconds"},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"out",type:G.OUTPUT,label:"Output"}]}},{type:B.PARALLEL,name:"Parallel",description:"Execute branches in parallel",icon:Q[B.PARALLEL],color:Y[B.PARALLEL],category:"control",defaultConfig:{},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"branch1",type:G.PARALLEL_BRANCH,label:"Branch 1"},{id:"branch2",type:G.PARALLEL_BRANCH,label:"Branch 2"}]}},{type:B.LOOP,name:"Loop",description:"Iterate over an array",icon:Q[B.LOOP],color:Y[B.LOOP],category:"control",defaultConfig:{iteratorVariable:"item",arrayExpression:"",maxIterations:100},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"item",type:G.LOOP_ITEM,label:"Each Item"},{id:"done",type:G.LOOP_DONE,label:"Done"}]}},{type:B.TRANSFORM,name:"Transform",description:"Transform data using expressions",icon:Q[B.TRANSFORM],color:Y[B.TRANSFORM],category:"data",defaultConfig:{transformExpression:"",language:"jsonata"},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"out",type:G.OUTPUT,label:"Output"}]}},{type:B.SUB_WORKFLOW,name:"Sub-Workflow",description:"Invoke another workflow",icon:Q[B.SUB_WORKFLOW],color:Y[B.SUB_WORKFLOW],category:"action",defaultConfig:{workflowId:""},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"out",type:G.OUTPUT,label:"Output"}]}},{type:B.EMAIL,name:"Email",description:"Send an email",icon:Q[B.EMAIL],color:Y[B.EMAIL],category:"action",defaultConfig:{to:"",cc:"",bcc:"",subject:"",body:"",bodyType:"text",fromName:"",replyTo:"",priority:"normal"},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"out",type:G.OUTPUT,label:"Output"}]}},{type:B.EMAIL_READER,name:"Email Reader",description:"Read and manage emails from Gmail, Outlook, Yahoo, or IMAP",icon:Q[B.EMAIL_READER],color:Y[B.EMAIL_READER],category:"action",defaultConfig:{provider:"imap",operation:"LIST",folder:"INBOX",limit:10,includeAttachments:!1,markAsReadOnFetch:!1,searchQuery:"",host:"",port:993,tls:!0,credentialPath:"",sinceDate:"",beforeDate:""},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"out",type:G.OUTPUT,label:"Output"}]}},{type:B.SENDGRID,name:"SendGrid",description:"Send email via SendGrid API",icon:Q[B.SENDGRID],color:Y[B.SENDGRID],category:"action",defaultConfig:{to:"",cc:"",bcc:"",fromEmail:"",fromName:"",replyTo:"",subject:"",body:"",contentType:"text/html",templateId:"",dynamicTemplateData:"",categories:""},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"out",type:G.OUTPUT,label:"Output"},{id:"error",type:G.OUTPUT,label:"Error"}]}},{type:B.NOTIFICATION,name:"Notification",description:"Send a notification",icon:Q[B.NOTIFICATION],color:Y[B.NOTIFICATION],category:"action",defaultConfig:{channel:"",message:""},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"out",type:G.OUTPUT,label:"Output"}]}},{type:B.DATABASE,name:"Data",description:"Read and write data to databases",icon:Q[B.DATABASE],color:"#6366F1",category:"data",defaultConfig:{operation:I.QUERY,dataSource:null,entity:null,filter:null,fields:{},select:[],orderBy:[],limit:null,offset:null,outputVariable:"results"},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"out",type:G.OUTPUT,label:"Output"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.VARIABLE,name:"Variable",description:"Set or get a workflow variable",icon:Q[B.VARIABLE],color:Y[B.VARIABLE],category:"data",defaultConfig:{variableOperation:"set",variableName:"",value:""},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"out",type:G.OUTPUT,label:"Output"}]}},{type:B.CHATBOT,name:"Chatbot Trigger",description:"Trigger workflow from chatbot interactions",icon:Q[B.CHATBOT],color:Y[B.CHATBOT],category:"trigger",defaultConfig:{triggerEvents:["MESSAGE_SENT"],chatbotSize:"medium",chatbotVariant:"floating",title:"Chat Assistant",subtitle:"Ask me anything",placeholder:"Type a message...",initialMessage:"",enableTypingIndicator:!0,enableSuggestions:!1,suggestions:[],loadingType:"dots",enableFileUpload:!1,maxFileSize:10,maxFiles:5,allowImages:!0,allowDocuments:!1,allowText:!1,allowAudio:!1,allowVideo:!1},defaultPorts:{inputs:[],outputs:[{id:"message",type:G.OUTPUT,label:"Message"},{id:"files",type:G.OUTPUT,label:"Files"},{id:"session",type:G.OUTPUT,label:"Session Start"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.DEBUG,name:"Debug",description:"Display input, output, and variables for debugging",icon:Q[B.DEBUG],color:Y[B.DEBUG],category:"data",defaultConfig:{},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"out",type:G.OUTPUT,label:"Output"}]}},{type:B.UI_TABLE,name:"Table",description:"Display data as an interactive table",icon:Q[B.UI_TABLE],color:Y[B.UI_TABLE],category:"display",defaultConfig:{tableColumns:[],dataExpression:"",tablePageSize:10,tableEnableFilter:!1,tableEnableSort:!0,tableFixedHeader:!1,tableSize:"normal",tableEmptyText:"No data available"},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Data"}],outputs:[{id:"out",type:G.OUTPUT,label:"Output"}]}},{type:B.WEB_SEARCH,name:"Web Search",description:"Search the web using Google, Bing, Brave, or DuckDuckGo",icon:Q[B.WEB_SEARCH],color:Y[B.WEB_SEARCH],category:"web",defaultConfig:{provider:"google",queryField:"query",numResults:10,safeSearch:!0,timeout:3e4},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"out",type:G.OUTPUT,label:"Results"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.WEB_CRAWL,name:"Web Crawl",description:"Crawl web pages and extract text content",icon:Q[B.WEB_CRAWL],color:Y[B.WEB_CRAWL],category:"web",defaultConfig:{urlField:"url",maxDepth:1,maxPages:10,sameDomainOnly:!0,renderJs:!1},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"out",type:G.OUTPUT,label:"Pages"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.DOCUMENT_GENERATOR,name:"Document Generator",description:"Generate Word documents from templates with dynamic data",icon:Q[B.DOCUMENT_GENERATOR],color:Y[B.DOCUMENT_GENERATOR],category:"documents",defaultConfig:{templateId:"",data:{},outputVariable:"documentResult"},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"out",type:G.OUTPUT,label:"Result"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.FILE_STORAGE,name:"File Storage",description:"Store files to S3, MinIO, or local filesystem",icon:Q[B.FILE_STORAGE],color:Y[B.FILE_STORAGE],category:"storage",defaultConfig:{provider:"local",bucket:"default",path:"",fileField:"file",filenameField:"filename"},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"out",type:G.OUTPUT,label:"Result"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.GOOGLE_CLOUD_STORAGE,name:"Google Cloud Storage",description:"Manage objects in Google Cloud Storage buckets",icon:Q[B.GOOGLE_CLOUD_STORAGE],color:Y[B.GOOGLE_CLOUD_STORAGE],category:"storage",defaultConfig:{operation:"LIST",bucketName:"",objectPath:"",serviceAccountPath:"",signedUrlExpiration:3600},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"out",type:G.OUTPUT,label:"Result"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.S3,name:"AWS S3",description:"Upload, download, and manage files in Amazon S3",icon:Q[B.S3],color:Y[B.S3],category:"integrations",defaultConfig:{s3Operation:"upload",s3Bucket:"",s3Key:"",s3Region:"us-east-1",s3ContentType:"auto"},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"out",type:G.OUTPUT,label:"Result"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.EMBEDDING,name:"Embedding",description:"Convert text to vector embeddings",icon:Q[B.EMBEDDING],color:Y[B.EMBEDDING],category:"rag",defaultConfig:{provider:"openai",model:"text-embedding-3-small",inputField:"text",batchSize:100},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Text"}],outputs:[{id:"out",type:G.OUTPUT,label:"Embedding"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.DOCUMENT_LOADER,name:"Document Loader",description:"Load and parse documents (PDF, Word, HTML, etc.)",icon:Q[B.DOCUMENT_LOADER],color:Y[B.DOCUMENT_LOADER],category:"rag",defaultConfig:{sourceType:"text",contentField:"content",filenameField:"filename",defaultType:"txt",timeout:3e4},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Document"}],outputs:[{id:"out",type:G.OUTPUT,label:"Content"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.TEXT_SPLITTER,name:"Text Splitter",description:"Split text into chunks for embedding",icon:Q[B.TEXT_SPLITTER],color:Y[B.TEXT_SPLITTER],category:"rag",defaultConfig:{strategy:"recursive",chunkSize:1e3,chunkOverlap:200,contentField:"content"},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Text"}],outputs:[{id:"out",type:G.OUTPUT,label:"Chunks"}]}},{type:B.VECTOR_WRITE,name:"Vector Write",description:"Store embeddings in vector database",icon:Q[B.VECTOR_WRITE],color:Y[B.VECTOR_WRITE],category:"rag",defaultConfig:{collectionName:"",upsertMode:"replace"},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Embeddings"}],outputs:[{id:"out",type:G.OUTPUT,label:"Result"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.VECTOR_SEARCH,name:"Vector Search",description:"Search for similar documents in vector store",icon:Q[B.VECTOR_SEARCH],color:Y[B.VECTOR_SEARCH],category:"rag",defaultConfig:{collectionName:"",topK:5,minScore:.7,includeContent:!0,includeMetadata:!0,provider:"openai",model:"text-embedding-3-small"},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Query"}],outputs:[{id:"out",type:G.OUTPUT,label:"Results"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.CONTEXT_BUILDER,name:"Context Builder",description:"Format retrieved documents into LLM-ready context",icon:Q[B.CONTEXT_BUILDER],color:Y[B.CONTEXT_BUILDER],category:"rag",defaultConfig:{template:"default",maxTokens:4e3,maxDocuments:10,includeSourceInfo:!0,includeSimilarityScore:!1,separator:"\n\n---\n\n"},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Results"}],outputs:[{id:"out",type:G.OUTPUT,label:"Context"}]}},{type:B.RERANKER,name:"Reranker",description:"Re-rank search results by relevance",icon:Q[B.RERANKER],color:Y[B.RERANKER],category:"rag",defaultConfig:{model:"cross-encoder",topK:5,threshold:.5},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Results"}],outputs:[{id:"out",type:G.OUTPUT,label:"Reranked"}]}},{type:B.SUMMARIZATION,name:"Summarize Document",description:"Summarize long text using AI with chunking strategies",icon:Q[B.SUMMARIZATION],color:Y[B.SUMMARIZATION],category:"action",defaultConfig:{inputField:"text",outputField:"summary",strategy:"map_reduce",chunkSize:4e3,chunkOverlap:200,model:"gpt-4o-mini"},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"out",type:G.OUTPUT,label:"Summary"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.GUARDRAIL,name:"Guardrail",description:"Validate and filter LLM inputs/outputs for safety",icon:Q[B.GUARDRAIL],color:Y[B.GUARDRAIL],category:"safety",defaultConfig:{mode:"input",contentField:"content",onFail:"block",checks:[]},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"out",type:G.OUTPUT,label:"Passed"},{id:"blocked",type:G.ERROR,label:"Blocked"}]}},{type:B.SLACK_SEND_MESSAGE,name:"Slack: Send Message",description:"Send a message to a Slack channel or user",icon:Q[B.SLACK_SEND_MESSAGE],color:Y[B.SLACK_SEND_MESSAGE],category:"slack",defaultConfig:{slackMethod:"api",botToken:"",channel:"",text:"",unfurlLinks:!0,unfurlMedia:!0},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"out",type:G.OUTPUT,label:"Response"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.SLACK_GET_CHANNEL_INFO,name:"Slack: Channel Info",description:"Get information about a Slack channel",icon:Q[B.SLACK_GET_CHANNEL_INFO],color:Y[B.SLACK_GET_CHANNEL_INFO],category:"slack",defaultConfig:{botToken:"",channel:"",includeLocale:!1,includeNumMembers:!1},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"out",type:G.OUTPUT,label:"Info"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.SLACK_LIST_CHANNELS,name:"Slack: List Channels",description:"List available Slack channels in the workspace",icon:Q[B.SLACK_LIST_CHANNELS],color:Y[B.SLACK_LIST_CHANNELS],category:"slack",defaultConfig:{botToken:"",types:"public_channel",excludeArchived:!0,limit:100},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"out",type:G.OUTPUT,label:"Channels"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.SLACK_ADD_REACTION,name:"Slack: Add Reaction",description:"Add a reaction emoji to a Slack message",icon:Q[B.SLACK_ADD_REACTION],color:Y[B.SLACK_ADD_REACTION],category:"slack",defaultConfig:{botToken:"",channel:"",timestamp:"",name:"thumbsup"},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"out",type:G.OUTPUT,label:"Response"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.SLACK_UPLOAD_FILE,name:"Slack: Upload File",description:"Upload a file to a Slack channel",icon:Q[B.SLACK_UPLOAD_FILE],color:Y[B.SLACK_UPLOAD_FILE],category:"slack",defaultConfig:{botToken:"",channels:"",filename:"",content:"",title:""},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"out",type:G.OUTPUT,label:"Response"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.GOOGLE_CALENDAR,name:"Google Calendar",description:"Create, read, update, and delete Google Calendar events",icon:Q[B.GOOGLE_CALENDAR],color:Y[B.GOOGLE_CALENDAR],category:"google-calendar",defaultConfig:{googleCalendarCredential:"",googleCalendarId:"primary",googleCalendarOperation:"getAll",googleCalendarEventSummary:"",googleCalendarEventDescription:"",googleCalendarEventStart:"",googleCalendarEventEnd:"",googleCalendarEventAttendees:"",googleCalendarEventLocation:"",googleCalendarTimeMin:"",googleCalendarTimeMax:"",googleCalendarRecurrence:"",googleCalendarConferenceData:!1},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"out",type:G.OUTPUT,label:"Response"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.SHOPIFY,name:"Shopify",description:"Manage Shopify products, orders, customers, inventory, and fulfillments via the Admin API",icon:Q[B.SHOPIFY],color:Y[B.SHOPIFY],category:"shopify",defaultConfig:{resource:"ORDER",operation:I.LIST,resourceId:"",filters:"",shopDomain:"",accessToken:""},defaultPorts:{inputs:[{id:"input",type:G.INPUT,label:"Input"}],outputs:[{id:"out",type:G.OUTPUT,label:"Output"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.GITLAB,name:"GitLab",description:"Manage GitLab repositories, issues, merge requests, pipelines, and releases",icon:Q[B.GITLAB],color:Y[B.GITLAB],category:"developer",defaultConfig:{gitlabBaseUrl:"https://gitlab.com",gitlabAccessToken:"",gitlabResource:"issue",gitlabOperation:"getAll",gitlabProjectId:"",gitlabTitle:"",gitlabDescription:"",gitlabLabels:[],gitlabAssigneeIds:[],gitlabSourceBranch:"",gitlabTargetBranch:"",gitlabRef:""},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"out",type:G.OUTPUT,label:"Response"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.TELEGRAM_SEND,name:"Telegram: Send Message",description:"Send a message to a Telegram chat with typing indicator and optional emoji reaction",icon:Q[B.TELEGRAM_SEND],color:Y[B.TELEGRAM_SEND],category:"telegram",defaultConfig:{botToken:"",chatId:"",text:"",parseMode:"",replyToMessageId:"",showTyping:!0,reaction:"",disableNotification:!1},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"out",type:G.OUTPUT,label:"Response"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.ZENDESK,name:"Zendesk",description:"Manage Zendesk tickets, users, organizations, and satisfaction ratings",icon:Q[B.ZENDESK],color:Y[B.ZENDESK],category:"zendesk",defaultConfig:{zendeskResource:"TICKET",zendeskOperation:"LIST",zendeskSubdomain:"",zendeskApiToken:"",zendeskEmail:""},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"out",type:G.OUTPUT,label:"Response"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.TWILIO_SMS,name:"Twilio: Send SMS",description:"Send an SMS or WhatsApp message via the Twilio API",icon:Q[B.TWILIO_SMS],color:Y[B.TWILIO_SMS],category:"twilio",defaultConfig:{twilioAccountSid:"",twilioAuthToken:"",twilioFromNumber:"",twilioToNumber:"",twilioMessageBody:"",twilioOperation:"send_sms",twilioStatusCallback:""},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"out",type:G.OUTPUT,label:"Response"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.TWILIO_VOICE,name:"Twilio: Voice Call",description:"Make a voice call via the Twilio API",icon:Q[B.TWILIO_VOICE],color:Y[B.TWILIO_VOICE],category:"twilio",defaultConfig:{twilioAccountSid:"",twilioAuthToken:"",twilioFromNumber:"",twilioToNumber:"",twilioOperation:"make_call",twilioVoiceUrl:"",twilioStatusCallback:""},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"out",type:G.OUTPUT,label:"Response"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.TELEGRAM_BOT,name:"Telegram Bot",description:"Receive messages from a Telegram bot via polling or webhook",icon:Q[B.TELEGRAM_BOT],color:Y[B.TELEGRAM_BOT],category:"trigger",defaultConfig:{botToken:"",mode:"polling",pollingTimeout:30,allowedUpdates:[],allowedChatIds:"",allowedUserIds:""},defaultPorts:{inputs:[],outputs:[{id:"out",type:G.OUTPUT,label:"Message"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.SLACK_SOCKET,name:"Slack Socket",description:"Receive events via Slack Socket Mode (WebSocket)",icon:Q[B.SLACK_SOCKET],color:Y[B.SLACK_SOCKET],category:"trigger",defaultConfig:{appToken:"",botToken:""},defaultPorts:{inputs:[],outputs:[{id:"out",type:G.OUTPUT,label:"Event"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.DISCORD_BOT,name:"Discord Bot",description:"Receive events from a Discord bot (Gateway WebSocket)",icon:Q[B.DISCORD_BOT],color:Y[B.DISCORD_BOT],category:"trigger",defaultConfig:{botToken:""},defaultPorts:{inputs:[],outputs:[{id:"out",type:G.OUTPUT,label:"Event"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.WHATSAPP_WEBHOOK,name:"WhatsApp",description:"Receive messages via WhatsApp Business API",icon:Q[B.WHATSAPP_WEBHOOK],color:Y[B.WHATSAPP_WEBHOOK],category:"trigger",defaultConfig:{},defaultPorts:{inputs:[],outputs:[{id:"out",type:G.OUTPUT,label:"Message"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.CUSTOM_WEBSOCKET,name:"WebSocket Listener",description:"Listen for messages on a custom WebSocket endpoint",icon:Q[B.CUSTOM_WEBSOCKET],color:Y[B.CUSTOM_WEBSOCKET],category:"trigger",defaultConfig:{url:""},defaultPorts:{inputs:[],outputs:[{id:"out",type:G.OUTPUT,label:"Message"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.RABBITMQ_TRIGGER,name:"RabbitMQ Trigger",description:"Triggers workflow on new messages from a RabbitMQ queue",icon:Q[B.RABBITMQ_TRIGGER],color:Y[B.RABBITMQ_TRIGGER],category:"trigger",defaultConfig:{connectionUrl:"",queueName:"",exchange:"",routingKey:"#",autoAck:!1,contentType:"application/json",prefetchCount:1},defaultPorts:{inputs:[],outputs:[{id:"out",type:G.OUTPUT,label:"Message"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.KAFKA,name:"Kafka: Send Message",description:"Produce a message to a Kafka topic",icon:Q[B.KAFKA],color:Y[B.KAFKA],category:"messaging",defaultConfig:{kafkaBrokers:"localhost:9092",kafkaAcks:"all",kafkaCompressionType:"none"},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"In"}],outputs:[{id:"out",type:G.OUTPUT,label:"Out"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.KAFKA_TRIGGER,name:"Kafka Trigger",description:"Triggers workflow on new messages from a Kafka topic",icon:Q[B.KAFKA_TRIGGER],color:Y[B.KAFKA_TRIGGER],category:"messaging",defaultConfig:{kafkaBrokers:"localhost:9092",kafkaConsumerGroup:"nuraly-workflow",kafkaFromBeginning:!1,kafkaSessionTimeout:3e4},defaultPorts:{inputs:[],outputs:[{id:"out",type:G.OUTPUT,label:"Message"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.MCP,name:"MCP Server",description:"Connect to MCP server - provides tools to Agent/LLM nodes",icon:Q[B.MCP],color:Y[B.MCP],category:"trigger",defaultConfig:{serverUrl:"",transportType:"streamable_http"},defaultPorts:{inputs:[],outputs:[{id:"out",type:G.OUTPUT,label:"Event"}]}},{type:B.HUBSPOT,name:"HubSpot",description:"Manage contacts, deals, companies, and tickets via HubSpot CRM",icon:Q[B.HUBSPOT],color:Y[B.HUBSPOT],category:"crm",defaultConfig:{hubspotAccessToken:"",hubspotResource:"contact",hubspotOperation:"getAll",hubspotProperties:{},hubspotFilterGroups:[],hubspotLimit:100,hubspotAssociations:[]},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"out",type:G.OUTPUT,label:"Result"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.JIRA,name:"Jira",description:"Create, update, and manage Jira issues",icon:Q[B.JIRA],color:Y[B.JIRA],category:"jira",defaultConfig:{operation:"createIssue",jiraInstanceUrl:"",projectKey:"",issueType:"Task",summary:"",description:"",assignee:"",priority:"Medium",labels:"",jqlQuery:"",transitionId:"",issueKey:"",comment:""},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"out",type:G.OUTPUT,label:"Result"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.ELASTICSEARCH,name:"Elasticsearch",description:"Search, index, and manage documents in Elasticsearch",icon:Q[B.ELASTICSEARCH],color:Y[B.ELASTICSEARCH],category:"integration",defaultConfig:{elasticsearchUrl:"",elasticsearchCredentialPath:"",elasticsearchOperation:"search",elasticsearchIndex:"",elasticsearchDocumentId:"",elasticsearchQueryBody:"",elasticsearchSize:10,elasticsearchFrom:0,elasticsearchRefresh:"false",elasticsearchTimeout:"30s",elasticsearchRouting:"",outputVariable:"elasticsearchResult"},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"out",type:G.OUTPUT,label:"Result"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.CALENDLY_TRIGGER,name:"Calendly Trigger",description:"Triggers workflow when a Calendly event is booked or cancelled",icon:Q[B.CALENDLY_TRIGGER],color:Y[B.CALENDLY_TRIGGER],category:"trigger",defaultConfig:{events:["invitee.created"],scope:"user",outputVariable:"calendlyEvent"},defaultPorts:{inputs:[],outputs:[{id:"out",type:G.OUTPUT,label:"Event"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.NOTE,name:"Note",description:"Add annotations and comments to your workflow",icon:Q[B.NOTE],color:Y[B.NOTE],category:"annotation",defaultConfig:{noteContent:"Add your note here...",noteBackgroundColor:"#fef08a",noteTextColor:"#713f12",noteFontSize:"medium",noteShowBorder:!1},defaultPorts:{inputs:[],outputs:[]}},{type:B.FRAME,name:"Frame",description:"Group related nodes together with a labeled container",icon:Q[B.FRAME],color:Y[B.FRAME],category:"annotation",defaultConfig:{frameLabel:"Group",frameWidth:400,frameHeight:300,frameBackgroundColor:"rgba(99, 102, 241, 0.05)",frameBorderColor:"rgba(99, 102, 241, 0.3)",frameLabelPosition:"top-left",frameLabelPlacement:"outside",frameShowLabel:!0,frameCollapsed:!1},defaultPorts:{inputs:[],outputs:[]}},{type:U.AGENT,name:"AI Agent",description:"Autonomous AI agent that can use tools",icon:Q[U.AGENT],color:Y[U.AGENT],category:"agent",defaultConfig:{agentId:"",maxIterations:10},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"},{id:"retriever",type:G.INPUT,label:"Retriever"}],configs:[{id:"llm",type:G.CONFIG,label:"LLM"},{id:"prompt",type:G.CONFIG,label:"Prompt"},{id:"memory",type:G.CONFIG,label:"Memory"},{id:"tools",type:G.CONFIG,label:"Tools",multiple:!0},{id:"structured_output",type:G.CONFIG,label:"Structured Output"}],outputs:[{id:"out",type:G.OUTPUT,label:"Output"}]}},{type:U.TOOL,name:"Tool",description:"A tool that can be used by an agent",icon:Q[U.TOOL],color:Y[U.TOOL],category:"agent",defaultConfig:{toolName:"",description:"",parameters:[]},defaultPorts:{inputs:[{id:"function",type:G.INPUT,label:"Function"}],outputs:[{id:"out",type:G.OUTPUT,label:"Tool"}]}},{type:U.MEMORY,name:"Context Memory",description:"Conversation memory for agents - stores and retrieves chat history",icon:Q[U.MEMORY],color:Y[U.MEMORY],category:"agent",defaultConfig:{cutoffMode:"message",maxMessages:50,maxTokens:4e3,conversationIdExpression:"${input.threadId}"},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"out",type:G.OUTPUT,label:"Memory Config"}]}},{type:U.CONTEXT_MEMORY,name:"Context Memory (RAG)",description:"RAG-enhanced conversation memory with buffer, semantic, or hybrid modes",icon:Q[U.CONTEXT_MEMORY],color:Y[U.CONTEXT_MEMORY],category:"agent",defaultConfig:{memoryType:"hybrid",cutoffMode:"message",maxMessages:50,maxTokens:4e3,conversationIdExpression:"${input.threadId}"},defaultPorts:{inputs:[],outputs:[{id:"out",type:G.OUTPUT,label:"Memory Config"}]}},{type:U.PROMPT,name:"Prompt",description:"Prompt template for LLM",icon:Q[U.PROMPT],color:Y[U.PROMPT],category:"agent",defaultConfig:{template:"",variables:[]},defaultPorts:{inputs:[],outputs:[{id:"out",type:G.OUTPUT,label:"Prompt"}]}},{type:U.LLM,name:"LLM",description:"Large Language Model call",icon:Q[U.LLM],color:Y[U.LLM],category:"agent",defaultConfig:{provider:"openai",modelName:"gpt-4",temperature:.7,maxTokens:2048},defaultPorts:{inputs:[],outputs:[{id:"out",type:G.OUTPUT,label:"Response"}]}},{type:U.RETRIEVER,name:"Retriever",description:"Retrieve relevant documents from vector store",icon:Q[U.RETRIEVER],color:Y[U.RETRIEVER],category:"agent",defaultConfig:{vectorStoreId:"",topK:5},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Query"}],outputs:[{id:"out",type:G.OUTPUT,label:"Documents"}]}},{type:U.CHAIN,name:"Chain",description:"Chain multiple LLM calls together",icon:Q[U.CHAIN],color:Y[U.CHAIN],category:"agent",defaultConfig:{chainType:"sequential"},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"out",type:G.OUTPUT,label:"Output"}]}},{type:U.ROUTER,name:"Router",description:"Route to different chains based on input",icon:Q[U.ROUTER],color:Y[U.ROUTER],category:"agent",defaultConfig:{routingExpression:""},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"route1",type:G.OUTPUT,label:"Route 1"},{id:"route2",type:G.OUTPUT,label:"Route 2"},{id:"default",type:G.CONDITIONAL_DEFAULT,label:"Default"}]}},{type:U.HUMAN_INPUT,name:"Human Input",description:"Wait for human input in the workflow",icon:Q[U.HUMAN_INPUT],color:Y[U.HUMAN_INPUT],category:"agent",defaultConfig:{prompt:"",timeout:864e5},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Context"}],outputs:[{id:"out",type:G.OUTPUT,label:"Response"}]}},{type:U.OUTPUT_PARSER,name:"Output Parser",description:"Parse LLM output into structured data",icon:Q[U.OUTPUT_PARSER],color:Y[U.OUTPUT_PARSER],category:"agent",defaultConfig:{parserType:"json",schema:{}},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Raw Output"}],outputs:[{id:"out",type:G.OUTPUT,label:"Parsed Data"}]}},{type:U.STRUCTURED_OUTPUT,name:"Structured Output",description:"Define a JSON schema to enforce structured LLM output",icon:Q[U.STRUCTURED_OUTPUT],color:Y[U.STRUCTURED_OUTPUT],category:"agent",defaultConfig:{schemaName:"structured_output",strict:!0,schema:{type:"object",properties:{},required:[],additionalProperties:!1}},defaultPorts:{inputs:[],outputs:[{id:"out",type:G.OUTPUT,label:"Schema"}]}},{type:V.TABLE,name:"Table",description:"Define a database table with columns",icon:Q[V.TABLE],color:Y[V.TABLE],category:"db-tables-views",defaultConfig:{tableName:"",columns:[],primaryKey:""},defaultPorts:{inputs:[],outputs:[{id:"ref",type:G.OUTPUT,label:"Reference"}]}},{type:V.VIEW,name:"View",description:"Create a database view based on queries",icon:Q[V.VIEW],color:Y[V.VIEW],category:"db-tables-views",defaultConfig:{viewName:"",query:"",materialized:!1},defaultPorts:{inputs:[{id:"source",type:G.INPUT,label:"Source Tables"}],outputs:[{id:"ref",type:G.OUTPUT,label:"Reference"}]}},{type:V.INDEX,name:"Index",description:"Create an index on table columns",icon:Q[V.INDEX],color:Y[V.INDEX],category:"db-indexes-queries",defaultConfig:{indexName:"",indexColumns:[],unique:!1,indexType:"BTREE"},defaultPorts:{inputs:[{id:"table",type:G.INPUT,label:"Table"}],outputs:[]}},{type:V.RELATIONSHIP,name:"Relationship",description:"Define foreign key relationships between tables",icon:Q[V.RELATIONSHIP],color:Y[V.RELATIONSHIP],category:"db-relations-constraints",defaultConfig:{relationshipType:"ONE_TO_MANY",sourceColumn:"",targetColumn:"",onDelete:"CASCADE",onUpdate:"CASCADE"},defaultPorts:{inputs:[{id:"source",type:G.INPUT,label:"Source Table"},{id:"target",type:G.INPUT,label:"Target Table"}],outputs:[]}},{type:V.CONSTRAINT,name:"Constraint",description:"Add constraints (unique, check, foreign_key)",icon:Q[V.CONSTRAINT],color:Y[V.CONSTRAINT],category:"db-relations-constraints",defaultConfig:{constraintName:"",constraintType:"UNIQUE",constraintColumns:[],checkExpression:""},defaultPorts:{inputs:[{id:"table",type:G.INPUT,label:"Table"}],outputs:[]}},{type:V.QUERY,name:"Query",description:"Define saved queries or stored procedures",icon:Q[V.QUERY],color:Y[V.QUERY],category:"db-indexes-queries",defaultConfig:{queryName:"",queryText:"",parameters:[]},defaultPorts:{inputs:[{id:"tables",type:G.INPUT,label:"Tables"}],outputs:[{id:"result",type:G.OUTPUT,label:"Result Schema"}]}},{type:H.STICKY_NOTE,name:"Sticky Note",description:"Add a sticky note to the whiteboard",icon:Q[H.STICKY_NOTE],color:Y[H.STICKY_NOTE],category:"wb-notes-text",defaultConfig:{textContent:"",backgroundColor:"#fef08a",textColor:"#713f12",fontSize:14,width:200,height:200},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"In"}],outputs:[{id:"out",type:G.OUTPUT,label:"Out"}]}},{type:H.TEXT_BLOCK,name:"Text Block",description:"Add a text block to the whiteboard",icon:Q[H.TEXT_BLOCK],color:Y[H.TEXT_BLOCK],category:"wb-notes-text",defaultConfig:{textContent:"",fontSize:16,fontWeight:"normal",textAlign:"left",width:200,height:50},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"In"}],outputs:[{id:"out",type:G.OUTPUT,label:"Out"}]}},{type:H.SHAPE_RECTANGLE,name:"Rectangle",description:"Add a rectangle shape",icon:Q[H.SHAPE_RECTANGLE],color:Y[H.SHAPE_RECTANGLE],category:"wb-shapes",defaultConfig:{width:120,height:120,fillColor:"#3b82f6"},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"In"}],outputs:[{id:"out",type:G.OUTPUT,label:"Out"}]}},{type:H.SHAPE_CIRCLE,name:"Circle",description:"Add a circle shape",icon:Q[H.SHAPE_CIRCLE],color:Y[H.SHAPE_CIRCLE],category:"wb-shapes",defaultConfig:{width:120,height:120,fillColor:"#8b5cf6"},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"In"}],outputs:[{id:"out",type:G.OUTPUT,label:"Out"}]}},{type:H.SHAPE_DIAMOND,name:"Diamond",description:"Add a diamond shape",icon:Q[H.SHAPE_DIAMOND],color:Y[H.SHAPE_DIAMOND],category:"wb-shapes",defaultConfig:{width:120,height:120,fillColor:"#f59e0b"},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"In"}],outputs:[{id:"out",type:G.OUTPUT,label:"Out"}]}},{type:H.SHAPE_TRIANGLE,name:"Triangle",description:"Add a triangle shape",icon:Q[H.SHAPE_TRIANGLE],color:Y[H.SHAPE_TRIANGLE],category:"wb-shapes",defaultConfig:{width:120,height:120,fillColor:"#22c55e"},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"In"}],outputs:[{id:"out",type:G.OUTPUT,label:"Out"}]}},{type:H.SHAPE_ARROW,name:"Arrow",description:"Add an arrow shape",icon:Q[H.SHAPE_ARROW],color:Y[H.SHAPE_ARROW],category:"wb-shapes",defaultConfig:{width:120,height:60,fillColor:"#6b7280"},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"In"}],outputs:[{id:"out",type:G.OUTPUT,label:"Out"}]}},{type:H.SHAPE_LINE,name:"Line",description:"Add a line shape",icon:Q[H.SHAPE_LINE],color:Y[H.SHAPE_LINE],category:"wb-shapes",defaultConfig:{width:120,height:4,fillColor:"#6b7280"},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"In"}],outputs:[{id:"out",type:G.OUTPUT,label:"Out"}]}},{type:H.SHAPE_STAR,name:"Star",description:"Add a star shape",icon:Q[H.SHAPE_STAR],color:Y[H.SHAPE_STAR],category:"wb-shapes",defaultConfig:{width:120,height:120,fillColor:"#f97316"},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"In"}],outputs:[{id:"out",type:G.OUTPUT,label:"Out"}]}},{type:H.SHAPE_HEXAGON,name:"Hexagon",description:"Add a hexagon shape",icon:Q[H.SHAPE_HEXAGON],color:Y[H.SHAPE_HEXAGON],category:"wb-shapes",defaultConfig:{width:120,height:120,fillColor:"#ec4899"},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"In"}],outputs:[{id:"out",type:G.OUTPUT,label:"Out"}]}},{type:H.IMAGE,name:"Image",description:"Add an image to the whiteboard",icon:Q[H.IMAGE],color:Y[H.IMAGE],category:"wb-media",defaultConfig:{imageUrl:"",width:200,height:200},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"In"}],outputs:[{id:"out",type:G.OUTPUT,label:"Out"}]}},{type:H.DRAWING,name:"Drawing",description:"Add a freehand drawing area",icon:Q[H.DRAWING],color:Y[H.DRAWING],category:"wb-media",defaultConfig:{pathData:"",width:200,height:200},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"In"}],outputs:[{id:"out",type:G.OUTPUT,label:"Out"}]}},{type:H.VOTING,name:"Voting",description:"Add a voting element for collaboration",icon:Q[H.VOTING],color:Y[H.VOTING],category:"wb-media",defaultConfig:{textContent:"Vote",width:200,height:150},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"In"}],outputs:[{id:"out",type:G.OUTPUT,label:"Out"}]}},{type:H.MERMAID,name:"Mermaid Diagram",description:"Add a Mermaid diagram to the whiteboard",icon:Q[H.MERMAID],color:Y[H.MERMAID],category:"wb-media",defaultConfig:{textContent:"graph TD\n A[Start] --\x3e B[End]",width:400,height:300},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"In"}],outputs:[{id:"out",type:G.OUTPUT,label:"Out"}]}},{type:H.ANCHOR,name:"Anchor",description:"Navigation anchor — other elements can link here",icon:Q[H.ANCHOR],color:Y[H.ANCHOR],category:"wb-navigation",defaultConfig:{anchorLabel:"Anchor",width:120,height:48},defaultPorts:{inputs:[],outputs:[]}},{type:H.FRAME,name:"Frame",description:"Group whiteboard elements together",icon:Q[H.FRAME],color:Y[H.FRAME],category:"wb-layout",defaultConfig:{frameLabel:"Group",frameWidth:400,frameHeight:300,frameBackgroundColor:"rgba(99, 102, 241, 0.05)",frameBorderColor:"rgba(99, 102, 241, 0.3)",frameLabelPosition:"top-left",frameLabelPlacement:"outside",frameShowLabel:!0,frameCollapsed:!1},defaultPorts:{inputs:[],outputs:[]}},{type:H.WORKFLOW,name:"Workflow",description:"Embed a workflow on the whiteboard",icon:Q[H.WORKFLOW],color:Y[H.WORKFLOW],category:"wb-media",defaultConfig:{workflowId:"",workflowName:"Workflow",workflowSteps:[],width:280,height:200},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"In"}],outputs:[{id:"out",type:G.OUTPUT,label:"Out"}]}},{type:H.DATABASE,name:"Database Table",description:"Embed a database table on the whiteboard",icon:Q[H.DATABASE],color:Y[H.DATABASE],category:"wb-media",defaultConfig:{dbTableId:"",dbTableName:"Table",dbTableColumns:[],dbPrimaryKey:"",width:280,height:200},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"In"}],outputs:[{id:"out",type:G.OUTPUT,label:"Out"}]}}],X=[{id:"trigger",name:"Triggers",icon:"zap",nodeTypes:[B.START,B.HTTP_START,B.CHAT_START,B.TELEGRAM_BOT,B.SLACK_SOCKET,B.DISCORD_BOT,B.WHATSAPP_WEBHOOK,B.CUSTOM_WEBSOCKET,B.MCP,B.CALENDLY_TRIGGER],canvasType:q.WORKFLOW},{id:"control",name:"Control Flow",icon:"git-branch",nodeTypes:[B.END,B.HTTP_END,B.CONDITION,B.DELAY,B.PARALLEL,B.LOOP],canvasType:q.WORKFLOW},{id:"action",name:"Actions",icon:"zap",nodeTypes:[B.FUNCTION,B.HTTP,B.INFORMATION_EXTRACTOR,B.OCR,B.CHAT_OUTPUT,B.SUB_WORKFLOW,B.EMAIL,B.EMAIL_READER,B.SENDGRID,B.NOTIFICATION,B.DOCUMENT_GENERATOR,B.SUMMARIZATION],canvasType:q.WORKFLOW},{id:"data",name:"Data",icon:"database",nodeTypes:[B.TRANSFORM,B.DATABASE,B.ELASTICSEARCH,B.VARIABLE,B.DEBUG],canvasType:q.WORKFLOW},{id:"web",name:"Web",icon:"globe",nodeTypes:[B.WEB_SEARCH,B.WEB_CRAWL],canvasType:q.WORKFLOW},{id:"storage",name:"Storage",icon:"hard-drive",nodeTypes:[B.FILE_STORAGE,B.GOOGLE_CLOUD_STORAGE,B.S3],canvasType:q.WORKFLOW},{id:"messaging",name:"Messaging",icon:"inbox",nodeTypes:[B.RABBITMQ_TRIGGER,B.KAFKA,B.KAFKA_TRIGGER],canvasType:q.WORKFLOW},{id:"rag",name:"RAG",icon:"layers",nodeTypes:[B.DOCUMENT_LOADER,B.TEXT_SPLITTER,B.EMBEDDING,B.VECTOR_WRITE,B.VECTOR_SEARCH,B.CONTEXT_BUILDER,B.RERANKER],canvasType:q.WORKFLOW},{id:"safety",name:"Safety",icon:"shield",nodeTypes:[B.GUARDRAIL],canvasType:q.WORKFLOW},{id:"display",name:"Display",icon:"monitor",nodeTypes:[B.UI_TABLE],canvasType:q.WORKFLOW},{id:"google-calendar",name:"Google Calendar",icon:"calendar",nodeTypes:[B.GOOGLE_CALENDAR],canvasType:q.WORKFLOW},{id:"shopify",name:"Shopify",icon:"shopping-cart",nodeTypes:[B.SHOPIFY],canvasType:q.WORKFLOW},{id:"twilio",name:"Twilio",icon:"phone",nodeTypes:[B.TWILIO_SMS,B.TWILIO_VOICE],canvasType:q.WORKFLOW},{id:"telegram",name:"Telegram",icon:"send",nodeTypes:[B.TELEGRAM_SEND],canvasType:q.WORKFLOW},{id:"zendesk",name:"Zendesk",icon:"ticket",nodeTypes:[B.ZENDESK],canvasType:q.WORKFLOW},{id:"slack",name:"Slack",icon:"message-square",nodeTypes:[B.SLACK_SEND_MESSAGE,B.SLACK_GET_CHANNEL_INFO,B.SLACK_LIST_CHANNELS,B.SLACK_ADD_REACTION,B.SLACK_UPLOAD_FILE],canvasType:q.WORKFLOW},{id:"crm",name:"CRM",icon:"users",nodeTypes:[B.HUBSPOT],canvasType:q.WORKFLOW},{id:"jira",name:"Jira",icon:"ticket",nodeTypes:[B.JIRA],canvasType:q.WORKFLOW},{id:"gitlab",name:"GitLab",icon:"git-merge",nodeTypes:[B.GITLAB],canvasType:q.WORKFLOW},{id:"annotation",name:"Annotations",icon:"message-square",nodeTypes:[B.NOTE,B.FRAME],canvasType:q.WORKFLOW},{id:"agent",name:"AI Agents",icon:"cpu",nodeTypes:[U.AGENT,U.LLM,U.PROMPT,U.MEMORY,U.CONTEXT_MEMORY,U.TOOL,U.RETRIEVER,U.CHAIN,U.ROUTER,U.HUMAN_INPUT,U.OUTPUT_PARSER,U.STRUCTURED_OUTPUT],canvasType:q.WORKFLOW},{id:"db-tables-views",name:"Tables & Views",icon:"table",nodeTypes:[V.TABLE,V.VIEW],canvasType:q.DATABASE},{id:"db-relations-constraints",name:"Relations & Constraints",icon:"git-merge",nodeTypes:[V.RELATIONSHIP,V.CONSTRAINT],canvasType:q.DATABASE},{id:"db-indexes-queries",name:"Indexes & Queries",icon:"list",nodeTypes:[V.INDEX,V.QUERY],canvasType:q.DATABASE},{id:"wb-notes-text",name:"Notes & Text",icon:"sticky-note",nodeTypes:[H.STICKY_NOTE,H.TEXT_BLOCK],canvasType:q.WHITEBOARD},{id:"wb-shapes",name:"Shapes",icon:"square",nodeTypes:[H.SHAPE_RECTANGLE,H.SHAPE_CIRCLE,H.SHAPE_DIAMOND,H.SHAPE_TRIANGLE,H.SHAPE_ARROW,H.SHAPE_LINE,H.SHAPE_STAR,H.SHAPE_HEXAGON],canvasType:q.WHITEBOARD},{id:"wb-media",name:"Media & Interactive",icon:"image",nodeTypes:[H.IMAGE,H.DRAWING,H.VOTING,H.MERMAID],canvasType:q.WHITEBOARD},{id:"wb-navigation",name:"Navigation",icon:"anchor",nodeTypes:[H.ANCHOR],canvasType:q.WHITEBOARD},{id:"wb-layout",name:"Layout",icon:"frame",nodeTypes:[H.FRAME],canvasType:q.WHITEBOARD}];function ee(e){return Z.find(t=>t.type===e)}function te(e){return Object.values(U).includes(e)}function ie(e){return Object.values(B).includes(e)}function ne(e){return Object.values(V).includes(e)}function ae(e){return Object.values(H).includes(e)}function oe(e){return X.filter(t=>t.canvasType===e)}function se(e,t,i){var n;const a=ee(e);return a?{id:i||"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}),name:a.name,type:a.type,position:t,configuration:Object.assign({},a.defaultConfig),ports:{inputs:a.defaultPorts.inputs.map(e=>Object.assign({},e)),configs:null===(n=a.defaultPorts.configs)||void 0===n?void 0:n.map(e=>Object.assign({},e)),outputs:a.defaultPorts.outputs.map(e=>Object.assign({},e))},metadata:{icon:a.icon,color:a.color,description:a.description},status:K.IDLE,selected:!1}:null}const re=[{name:"Yellow",bg:"#fef08a",text:"#713f12"},{name:"Blue",bg:"#bfdbfe",text:"#1e3a5f"},{name:"Green",bg:"#bbf7d0",text:"#14532d"},{name:"Pink",bg:"#fbcfe8",text:"#831843"},{name:"Orange",bg:"#fed7aa",text:"#7c2d12"},{name:"Purple",bg:"#ddd6fe",text:"#4c1d95"},{name:"Gray",bg:"#e5e7eb",text:"#374151"}],le=[{name:"Indigo",bg:"rgba(99, 102, 241, 0.05)",border:"rgba(99, 102, 241, 0.3)",solid:"#6366f1"},{name:"Blue",bg:"rgba(59, 130, 246, 0.05)",border:"rgba(59, 130, 246, 0.3)",solid:"#3b82f6"},{name:"Green",bg:"rgba(34, 197, 94, 0.05)",border:"rgba(34, 197, 94, 0.3)",solid:"#22c55e"},{name:"Orange",bg:"rgba(249, 115, 22, 0.05)",border:"rgba(249, 115, 22, 0.3)",solid:"#f97316"},{name:"Red",bg:"rgba(239, 68, 68, 0.05)",border:"rgba(239, 68, 68, 0.3)",solid:"#ef4444"},{name:"Purple",bg:"rgba(168, 85, 247, 0.05)",border:"rgba(168, 85, 247, 0.3)",solid:"#a855f7"},{name:"Gray",bg:"rgba(107, 114, 128, 0.05)",border:"rgba(107, 114, 128, 0.3)",solid:"#6b7280"}];function ce(e){return e===B.NOTE||e===B.FRAME}function de(e){return e===B.FRAME}function pe(e){return e===B.NOTE}const he=new Set([B.TELEGRAM_BOT,B.SLACK_SOCKET,B.DISCORD_BOT,B.WHATSAPP_WEBHOOK,B.CUSTOM_WEBSOCKET,B.CALENDLY_TRIGGER,B.KAFKA_TRIGGER]);function ue(e){return he.has(e)}
106
+ */var B,U,V,H,q,W,K,G,J;!function(e){e.START="START",e.END="END",e.HTTP_START="HTTP_START",e.HTTP_END="HTTP_END",e.CHAT_START="CHAT_START",e.CHAT_OUTPUT="CHAT_OUTPUT",e.SOCIAL_POST="SOCIAL_POST",e.FUNCTION="FUNCTION",e.HTTP="HTTP",e.CONDITION="CONDITION",e.SWITCH="SWITCH",e.DELAY="DELAY",e.PARALLEL="PARALLEL",e.MERGE="MERGE",e.LOOP="LOOP",e.BREAK="BREAK",e.WAIT="WAIT",e.TRY_CATCH="TRY_CATCH",e.TRANSFORM="TRANSFORM",e.SUB_WORKFLOW="SUB_WORKFLOW",e.EMAIL="EMAIL",e.EMAIL_READER="EMAIL_READER",e.SENDGRID="SENDGRID",e.NOTIFICATION="NOTIFICATION",e.DATABASE="DATABASE",e.VARIABLE="VARIABLE",e.CHATBOT="CHATBOT",e.DEBUG="DEBUG",e.LLM="LLM",e.OCR="OCR",e.WEB_SEARCH="WEB_SEARCH",e.WEB_CRAWL="WEB_CRAWL",e.DOCUMENT_GENERATOR="DOCUMENT_GENERATOR",e.FILE_STORAGE="FILE_STORAGE",e.GOOGLE_CLOUD_STORAGE="GOOGLE_CLOUD_STORAGE",e.S3="S3",e.EMBEDDING="EMBEDDING",e.DOCUMENT_LOADER="DOCUMENT_LOADER",e.TEXT_SPLITTER="TEXT_SPLITTER",e.VECTOR_WRITE="VECTOR_WRITE",e.VECTOR_SEARCH="VECTOR_SEARCH",e.CONTEXT_BUILDER="CONTEXT_BUILDER",e.SUMMARIZATION="SUMMARIZATION",e.GUARDRAIL="GUARDRAIL",e.SLACK_SEND_MESSAGE="SLACK_SEND_MESSAGE",e.SLACK_GET_CHANNEL_INFO="SLACK_GET_CHANNEL_INFO",e.SLACK_LIST_CHANNELS="SLACK_LIST_CHANNELS",e.SLACK_ADD_REACTION="SLACK_ADD_REACTION",e.SLACK_UPLOAD_FILE="SLACK_UPLOAD_FILE",e.RERANKER="RERANKER",e.SHOPIFY="SHOPIFY",e.TELEGRAM_SEND="TELEGRAM_SEND",e.TWILIO_SMS="TWILIO_SMS",e.TWILIO_VOICE="TWILIO_VOICE",e.TELEGRAM_BOT="TELEGRAM_BOT",e.SLACK_SOCKET="SLACK_SOCKET",e.DISCORD_BOT="DISCORD_BOT",e.WHATSAPP_WEBHOOK="WHATSAPP_WEBHOOK",e.CUSTOM_WEBSOCKET="CUSTOM_WEBSOCKET",e.GOOGLE_CALENDAR="GOOGLE_CALENDAR",e.RABBITMQ_TRIGGER="RABBITMQ_TRIGGER",e.KAFKA="KAFKA",e.KAFKA_TRIGGER="KAFKA_TRIGGER",e.ZENDESK="ZENDESK",e.GITLAB="GITLAB",e.MCP="MCP",e.INFORMATION_EXTRACTOR="INFORMATION_EXTRACTOR",e.HUBSPOT="HUBSPOT",e.JIRA="JIRA",e.ELASTICSEARCH="ELASTICSEARCH",e.CALENDLY_TRIGGER="CALENDLY_TRIGGER",e.UI_TABLE="UI_TABLE",e.NOTE="NOTE",e.FRAME="FRAME",e.CRON="CRON"}(B||(B={})),function(e){e.AGENT="AGENT",e.TOOL="TOOL",e.MEMORY="MEMORY",e.CONTEXT_MEMORY="CONTEXT_MEMORY",e.PROMPT="PROMPT",e.LLM="AGENT_LLM",e.RETRIEVER="RETRIEVER",e.CHAIN="CHAIN",e.ROUTER="ROUTER",e.HUMAN_INPUT="HUMAN_INPUT",e.OUTPUT_PARSER="OUTPUT_PARSER",e.STRUCTURED_OUTPUT="STRUCTURED_OUTPUT"}(U||(U={})),function(e){e.TABLE="DB_TABLE",e.VIEW="DB_VIEW",e.INDEX="DB_INDEX",e.RELATIONSHIP="DB_RELATIONSHIP",e.CONSTRAINT="DB_CONSTRAINT",e.QUERY="DB_QUERY"}(V||(V={})),function(e){e.STICKY_NOTE="WB_STICKY_NOTE",e.SHAPE_RECTANGLE="WB_SHAPE_RECTANGLE",e.SHAPE_CIRCLE="WB_SHAPE_CIRCLE",e.SHAPE_DIAMOND="WB_SHAPE_DIAMOND",e.SHAPE_TRIANGLE="WB_SHAPE_TRIANGLE",e.SHAPE_ARROW="WB_SHAPE_ARROW",e.SHAPE_LINE="WB_SHAPE_LINE",e.SHAPE_STAR="WB_SHAPE_STAR",e.SHAPE_HEXAGON="WB_SHAPE_HEXAGON",e.TEXT_BLOCK="WB_TEXT_BLOCK",e.IMAGE="WB_IMAGE",e.DRAWING="WB_DRAWING",e.FRAME="WB_FRAME",e.VOTING="WB_VOTING",e.MERMAID="WB_MERMAID",e.ANCHOR="WB_ANCHOR",e.WORKFLOW="WB_WORKFLOW",e.DATABASE="WB_DATABASE"}(H||(H={})),function(e){e.WORKFLOW="WORKFLOW",e.DATABASE="DATABASE",e.WHITEBOARD="WHITEBOARD"}(q||(q={})),function(e){e.DISCONNECTED="DISCONNECTED",e.CONNECTING="CONNECTING",e.CONNECTED="CONNECTED",e.PAUSED="PAUSED",e.HANDOFF_PENDING="HANDOFF_PENDING",e.ERROR="ERROR"}(W||(W={})),function(e){e.IDLE="IDLE",e.PENDING="PENDING",e.RUNNING="RUNNING",e.COMPLETED="COMPLETED",e.FAILED="FAILED",e.CANCELLED="CANCELLED",e.PAUSED="PAUSED",e.WAITING="WAITING"}(K||(K={})),function(e){e.INPUT="INPUT",e.OUTPUT="OUTPUT",e.CONFIG="CONFIG",e.CONDITIONAL_TRUE="CONDITIONAL_TRUE",e.CONDITIONAL_FALSE="CONDITIONAL_FALSE",e.CONDITIONAL_DEFAULT="CONDITIONAL_DEFAULT",e.LOOP_ITEM="LOOP_ITEM",e.LOOP_DONE="LOOP_DONE",e.PARALLEL_BRANCH="PARALLEL_BRANCH",e.ERROR="ERROR"}(G||(G={})),function(e){e.SELECT="SELECT",e.PAN="PAN",e.CONNECT="CONNECT",e.ADD_NODE="ADD_NODE"}(J||(J={}));const Y={[B.START]:"#22c55e",[B.END]:"#ef4444",[B.HTTP_START]:"#059669",[B.HTTP_END]:"#dc2626",[B.CHAT_START]:"#0ea5e9",[B.CHAT_OUTPUT]:"#06b6d4",[B.SOCIAL_POST]:"#7c3aed",[B.FUNCTION]:"#3b82f6",[B.HTTP]:"#8b5cf6",[B.CONDITION]:"#f59e0b",[B.SWITCH]:"#eab308",[B.DELAY]:"#6b7280",[B.PARALLEL]:"#06b6d4",[B.MERGE]:"#0891b2",[B.LOOP]:"#ec4899",[B.BREAK]:"#991b1b",[B.WAIT]:"#a78bfa",[B.TRY_CATCH]:"#f43f5e",[B.TRANSFORM]:"#14b8a6",[B.SUB_WORKFLOW]:"#6366f1",[B.EMAIL]:"#f97316",[B.EMAIL_READER]:"#06b6d4",[B.SENDGRID]:"#1A82E2",[B.NOTIFICATION]:"#84cc16",[B.DATABASE]:"#a855f7",[B.VARIABLE]:"#64748b",[B.CHATBOT]:"#0ea5e9",[B.DEBUG]:"#f97316",[B.LLM]:"#22d3ee",[B.OCR]:"#0d9488",[B.INFORMATION_EXTRACTOR]:"#8B5CF6",[B.WEB_SEARCH]:"#3b82f6",[B.WEB_CRAWL]:"#6366f1",[B.DOCUMENT_GENERATOR]:"#0284c7",[B.FILE_STORAGE]:"#f59e0b",[B.GOOGLE_CLOUD_STORAGE]:"#4285f4",[B.S3]:"#FF9900",[B.EMBEDDING]:"#8b5cf6",[B.DOCUMENT_LOADER]:"#ec4899",[B.TEXT_SPLITTER]:"#14b8a6",[B.VECTOR_WRITE]:"#10b981",[B.VECTOR_SEARCH]:"#06b6d4",[B.CONTEXT_BUILDER]:"#a855f7",[B.SUMMARIZATION]:"#8B5CF6",[B.GUARDRAIL]:"#ef4444",[B.SLACK_SEND_MESSAGE]:"#4A154B",[B.SLACK_GET_CHANNEL_INFO]:"#4A154B",[B.SLACK_LIST_CHANNELS]:"#4A154B",[B.SLACK_ADD_REACTION]:"#4A154B",[B.SLACK_UPLOAD_FILE]:"#4A154B",[B.RERANKER]:"#d946ef",[B.SHOPIFY]:"#96bf48",[B.TELEGRAM_SEND]:"#0088cc",[B.TWILIO_SMS]:"#F22F46",[B.TWILIO_VOICE]:"#F22F46",[B.TELEGRAM_BOT]:"#0088cc",[B.SLACK_SOCKET]:"#4A154B",[B.DISCORD_BOT]:"#5865F2",[B.WHATSAPP_WEBHOOK]:"#25D366",[B.CUSTOM_WEBSOCKET]:"#6366f1",[B.GOOGLE_CALENDAR]:"#4285F4",[B.RABBITMQ_TRIGGER]:"#FF6600",[B.KAFKA]:"#231F20",[B.KAFKA_TRIGGER]:"#231F20",[B.ZENDESK]:"#03363d",[B.GITLAB]:"#FC6D26",[B.MCP]:"#7c3aed",[B.HUBSPOT]:"#FF7A59",[B.JIRA]:"#0052CC",[B.ELASTICSEARCH]:"#00bfb3",[B.CALENDLY_TRIGGER]:"#006BFF",[B.UI_TABLE]:"#0891b2",[B.NOTE]:"#fef08a",[B.FRAME]:"#6366f1",[B.CRON]:"#d97706",[U.AGENT]:"#10b981",[U.TOOL]:"#0ea5e9",[U.MEMORY]:"#d946ef",[U.CONTEXT_MEMORY]:"#c026d3",[U.PROMPT]:"#f472b6",[U.LLM]:"#22d3ee",[U.RETRIEVER]:"#a78bfa",[U.CHAIN]:"#fbbf24",[U.ROUTER]:"#fb923c",[U.HUMAN_INPUT]:"#4ade80",[U.OUTPUT_PARSER]:"#2dd4bf",[U.STRUCTURED_OUTPUT]:"#f59e0b",[V.TABLE]:"#64748b",[V.VIEW]:"#a855f7",[V.INDEX]:"#f59e0b",[V.RELATIONSHIP]:"#ec4899",[V.CONSTRAINT]:"#ef4444",[V.QUERY]:"#06b6d4",[H.STICKY_NOTE]:"#fef08a",[H.SHAPE_RECTANGLE]:"#3b82f6",[H.SHAPE_CIRCLE]:"#8b5cf6",[H.SHAPE_DIAMOND]:"#f59e0b",[H.SHAPE_TRIANGLE]:"#22c55e",[H.SHAPE_ARROW]:"#6b7280",[H.SHAPE_LINE]:"#6b7280",[H.SHAPE_STAR]:"#f97316",[H.SHAPE_HEXAGON]:"#ec4899",[H.TEXT_BLOCK]:"#111827",[H.IMAGE]:"#06b6d4",[H.DRAWING]:"#14b8a6",[H.FRAME]:"#6366f1",[H.VOTING]:"#ef4444",[H.MERMAID]:"#8b5cf6",[H.ANCHOR]:"#f59e0b",[H.WORKFLOW]:"#6366f1",[H.DATABASE]:"#64748b"},Q={[B.START]:"play",[B.END]:"stop",[B.HTTP_START]:"download",[B.HTTP_END]:"upload",[B.CHAT_START]:"message-circle",[B.CHAT_OUTPUT]:"message-square",[B.SOCIAL_POST]:"send",[B.FUNCTION]:"code",[B.HTTP]:"globe",[B.CONDITION]:"git-branch",[B.SWITCH]:"git-fork",[B.DELAY]:"clock",[B.PARALLEL]:"git-merge",[B.MERGE]:"merge",[B.LOOP]:"repeat",[B.BREAK]:"circle-stop",[B.WAIT]:"hourglass",[B.TRY_CATCH]:"shield-alert",[B.TRANSFORM]:"shuffle",[B.SUB_WORKFLOW]:"layers",[B.EMAIL]:"mail",[B.EMAIL_READER]:"mail-open",[B.SENDGRID]:"send",[B.NOTIFICATION]:"bell",[B.DATABASE]:"database",[B.VARIABLE]:"box",[B.CHATBOT]:"message-circle",[B.DEBUG]:"bug",[B.LLM]:"brain",[B.OCR]:"scan",[B.INFORMATION_EXTRACTOR]:"search",[B.WEB_SEARCH]:"search",[B.WEB_CRAWL]:"globe",[B.DOCUMENT_GENERATOR]:"file-text",[B.FILE_STORAGE]:"hard-drive",[B.GOOGLE_CLOUD_STORAGE]:"cloud",[B.S3]:"cloud",[B.EMBEDDING]:"hash",[B.DOCUMENT_LOADER]:"file-text",[B.TEXT_SPLITTER]:"scissors",[B.VECTOR_WRITE]:"database",[B.VECTOR_SEARCH]:"search",[B.CONTEXT_BUILDER]:"layers",[B.SUMMARIZATION]:"file-minus",[B.GUARDRAIL]:"shield",[B.SLACK_SEND_MESSAGE]:"message-square",[B.SLACK_GET_CHANNEL_INFO]:"hash",[B.SLACK_LIST_CHANNELS]:"list",[B.SLACK_ADD_REACTION]:"smile-plus",[B.SLACK_UPLOAD_FILE]:"upload",[B.RERANKER]:"arrow-up-down",[B.SHOPIFY]:"shopping-cart",[B.TELEGRAM_SEND]:"send",[B.TWILIO_SMS]:"message-square",[B.TWILIO_VOICE]:"phone",[B.TELEGRAM_BOT]:"send",[B.SLACK_SOCKET]:"message-square",[B.DISCORD_BOT]:"gamepad-2",[B.WHATSAPP_WEBHOOK]:"phone",[B.CUSTOM_WEBSOCKET]:"radio",[B.GOOGLE_CALENDAR]:"calendar",[B.RABBITMQ_TRIGGER]:"inbox",[B.KAFKA]:"message-square-share",[B.KAFKA_TRIGGER]:"radio",[B.ZENDESK]:"ticket",[B.GITLAB]:"git-merge",[B.MCP]:"plug",[B.HUBSPOT]:"users",[B.JIRA]:"ticket",[B.ELASTICSEARCH]:"search",[B.CALENDLY_TRIGGER]:"calendar",[B.UI_TABLE]:"table",[B.NOTE]:"sticky-note",[B.FRAME]:"square",[B.CRON]:"timer",[U.AGENT]:"cpu",[U.TOOL]:"tool",[U.MEMORY]:"hard-drive",[U.CONTEXT_MEMORY]:"brain",[U.PROMPT]:"message-square",[U.LLM]:"brain",[U.RETRIEVER]:"search",[U.CHAIN]:"link",[U.ROUTER]:"git-pull-request",[U.HUMAN_INPUT]:"user",[U.OUTPUT_PARSER]:"file-text",[U.STRUCTURED_OUTPUT]:"braces",[V.TABLE]:"table",[V.VIEW]:"eye",[V.INDEX]:"list",[V.RELATIONSHIP]:"git-merge",[V.CONSTRAINT]:"shield",[V.QUERY]:"terminal",[H.STICKY_NOTE]:"sticky-note",[H.SHAPE_RECTANGLE]:"square",[H.SHAPE_CIRCLE]:"circle",[H.SHAPE_DIAMOND]:"diamond",[H.SHAPE_TRIANGLE]:"triangle",[H.SHAPE_ARROW]:"arrow-right",[H.SHAPE_LINE]:"minus",[H.SHAPE_STAR]:"star",[H.SHAPE_HEXAGON]:"hexagon",[H.TEXT_BLOCK]:"type",[H.IMAGE]:"image",[H.DRAWING]:"pen-tool",[H.FRAME]:"frame",[H.VOTING]:"thumbs-up",[H.MERMAID]:"git-branch",[H.ANCHOR]:"anchor",[H.WORKFLOW]:"layers",[H.DATABASE]:"table"},Z=[{type:B.START,name:"Start",description:"Entry point of the workflow",icon:Q[B.START],color:Y[B.START],category:"control",defaultConfig:{},defaultPorts:{inputs:[],outputs:[{id:"out",type:G.OUTPUT,label:"Output"}]}},{type:B.END,name:"End",description:"Exit point of the workflow",icon:Q[B.END],color:Y[B.END],category:"control",defaultConfig:{},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[]}},{type:B.HTTP_START,name:"HTTP Trigger",description:"Start workflow from HTTP request",icon:Q[B.HTTP_START],color:Y[B.HTTP_START],category:"trigger",defaultConfig:{httpPath:"/webhook",httpMethod:"POST",httpAuth:"none",httpCors:!0,httpRateLimit:100,httpRequestSchema:{}},defaultPorts:{inputs:[],outputs:[{id:"out",type:G.OUTPUT,label:"Request"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.HTTP_END,name:"HTTP Response",description:"Return HTTP response to caller",icon:Q[B.HTTP_END],color:Y[B.HTTP_END],category:"control",defaultConfig:{httpStatusCode:200,httpResponseHeaders:{"Content-Type":"application/json"},httpResponseBody:"{{data}}",httpContentType:"application/json"},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[]}},{type:B.CHAT_START,name:"Chat Trigger",description:"Start workflow from chatbot message",icon:Q[B.CHAT_START],color:Y[B.CHAT_START],category:"trigger",defaultConfig:{outputVariable:"chatInput",enableFileUpload:!1,maxFileSize:10,maxFiles:5,allowImages:!0,allowDocuments:!1,allowText:!1,allowAudio:!1,allowVideo:!1},defaultPorts:{inputs:[],outputs:[{id:"out",type:G.OUTPUT,label:"Message"},{id:"files",type:G.OUTPUT,label:"Files"}]}},{type:B.CHAT_OUTPUT,name:"Chat Output",description:"Send message to chatbot during execution",icon:Q[B.CHAT_OUTPUT],color:Y[B.CHAT_OUTPUT],category:"action",defaultConfig:{message:"${variables.response}",messageType:"text",typing:!1,typingDelay:1e3},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"out",type:G.OUTPUT,label:"Output"}]}},{type:B.SOCIAL_POST,name:"Social Post",description:"Post to social feed on behalf of an agent",icon:Q[B.SOCIAL_POST],color:Y[B.SOCIAL_POST],category:"action",defaultConfig:{agentId:"",content:"${variables.response}",mediaUrl:"",mediaType:""},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"out",type:G.OUTPUT,label:"Output"}]}},{type:B.LLM,name:"LLM",description:"Call AI language model (OpenAI, Anthropic, etc.)",icon:Q[B.LLM],color:Y[B.LLM],category:"action",defaultConfig:{provider:"openai",model:"gpt-4",temperature:.7,maxTokens:2048,systemPrompt:"",userPrompt:"${variables.message}"},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"},{id:"context_memory",type:G.INPUT,label:"Context Memory"}],outputs:[{id:"out",type:G.OUTPUT,label:"Response"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.OCR,name:"OCR",description:"Extract text from images using OCR",icon:Q[B.OCR],color:Y[B.OCR],category:"action",defaultConfig:{imageSource:"variable",imageField:"${input.files[0].base64}",language:"fr",detectLayout:!1,outputVariable:"ocrResult"},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Image"}],outputs:[{id:"out",type:G.OUTPUT,label:"Text"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.INFORMATION_EXTRACTOR,name:"Information Extractor",description:"Extract structured data from unstructured text using AI",icon:Q[B.INFORMATION_EXTRACTOR],color:Y[B.INFORMATION_EXTRACTOR],category:"action",defaultConfig:{inputField:"text",schema:[{name:"field1",type:"string",description:"",required:!0}],model:"gpt-4o-mini",provider:"openai",instructions:""},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"out",type:G.OUTPUT,label:"Extracted"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.FUNCTION,name:"Function",description:"Invoke a Nuraly function",icon:Q[B.FUNCTION],color:Y[B.FUNCTION],category:"action",defaultConfig:{functionId:"",inputMapping:{},outputMapping:{}},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"out",type:G.OUTPUT,label:"Output"}]}},{type:B.HTTP,name:"HTTP Request",description:"Make an HTTP request",icon:Q[B.HTTP],color:Y[B.HTTP],category:"action",defaultConfig:{method:"GET",url:"",headers:{},timeout:3e4},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"out",type:G.OUTPUT,label:"Success"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.CONDITION,name:"Condition",description:"Branch based on a condition",icon:Q[B.CONDITION],color:Y[B.CONDITION],category:"control",defaultConfig:{expression:"",language:"javascript"},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"true",type:G.CONDITIONAL_TRUE,label:"True"},{id:"false",type:G.CONDITIONAL_FALSE,label:"False"}]}},{type:B.DELAY,name:"Delay",description:"Wait for a specified duration",icon:Q[B.DELAY],color:Y[B.DELAY],category:"control",defaultConfig:{duration:1e3,unit:"milliseconds"},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"out",type:G.OUTPUT,label:"Output"}]}},{type:B.PARALLEL,name:"Parallel",description:"Execute branches in parallel",icon:Q[B.PARALLEL],color:Y[B.PARALLEL],category:"control",defaultConfig:{},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"branch1",type:G.PARALLEL_BRANCH,label:"Branch 1"},{id:"branch2",type:G.PARALLEL_BRANCH,label:"Branch 2"}]}},{type:B.LOOP,name:"Loop",description:"Iterate over an array",icon:Q[B.LOOP],color:Y[B.LOOP],category:"control",defaultConfig:{iteratorVariable:"item",arrayExpression:"",maxIterations:100},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"item",type:G.LOOP_ITEM,label:"Each Item"},{id:"done",type:G.LOOP_DONE,label:"Done"}]}},{type:B.SWITCH,name:"Switch",description:"Route to a branch based on a value",icon:Q[B.SWITCH],color:Y[B.SWITCH],category:"control",defaultConfig:{expression:"",language:"javascript",cases:[{value:"case1",label:"Case 1"},{value:"case2",label:"Case 2"}],includeDefault:!0},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"case1",type:G.OUTPUT,label:"Case 1"},{id:"case2",type:G.OUTPUT,label:"Case 2"},{id:"default",type:G.CONDITIONAL_DEFAULT,label:"Default"}]}},{type:B.MERGE,name:"Merge",description:"Join multiple branches into one",icon:Q[B.MERGE],color:Y[B.MERGE],category:"control",defaultConfig:{mode:"waitAll"},defaultPorts:{inputs:[{id:"in1",type:G.INPUT,label:"Input 1",multiple:!0},{id:"in2",type:G.INPUT,label:"Input 2",multiple:!0}],outputs:[{id:"out",type:G.OUTPUT,label:"Output"}]}},{type:B.WAIT,name:"Wait",description:"Pause until a signal or event is received",icon:Q[B.WAIT],color:Y[B.WAIT],category:"control",defaultConfig:{signalName:"",timeout:3e5},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"out",type:G.OUTPUT,label:"Signal"},{id:"timeout",type:G.OUTPUT,label:"Timeout"}]}},{type:B.TRY_CATCH,name:"Try / Catch",description:"Catch errors from the connected branch",icon:Q[B.TRY_CATCH],color:Y[B.TRY_CATCH],category:"control",defaultConfig:{catchTypes:["*"],errorVariable:"error"},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"try",type:G.OUTPUT,label:"Try"},{id:"catch",type:G.ERROR,label:"Catch"}]}},{type:B.BREAK,name:"Break",description:"Exit the enclosing loop",icon:Q[B.BREAK],color:Y[B.BREAK],category:"control",defaultConfig:{},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[]}},{type:B.TRANSFORM,name:"Transform",description:"Transform data using expressions",icon:Q[B.TRANSFORM],color:Y[B.TRANSFORM],category:"data",defaultConfig:{transformExpression:"",language:"jsonata"},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"out",type:G.OUTPUT,label:"Output"}]}},{type:B.SUB_WORKFLOW,name:"Sub-Workflow",description:"Invoke another workflow",icon:Q[B.SUB_WORKFLOW],color:Y[B.SUB_WORKFLOW],category:"action",defaultConfig:{workflowId:""},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"out",type:G.OUTPUT,label:"Output"}]}},{type:B.EMAIL,name:"Email",description:"Send an email",icon:Q[B.EMAIL],color:Y[B.EMAIL],category:"action",defaultConfig:{to:"",cc:"",bcc:"",subject:"",body:"",bodyType:"text",fromName:"",replyTo:"",priority:"normal"},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"out",type:G.OUTPUT,label:"Output"}]}},{type:B.EMAIL_READER,name:"Email Reader",description:"Read and manage emails from Gmail, Outlook, Yahoo, or IMAP",icon:Q[B.EMAIL_READER],color:Y[B.EMAIL_READER],category:"action",defaultConfig:{provider:"imap",operation:"LIST",folder:"INBOX",limit:10,includeAttachments:!1,markAsReadOnFetch:!1,searchQuery:"",host:"",port:993,tls:!0,credentialPath:"",sinceDate:"",beforeDate:""},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"out",type:G.OUTPUT,label:"Output"}]}},{type:B.SENDGRID,name:"SendGrid",description:"Send email via SendGrid API",icon:Q[B.SENDGRID],color:Y[B.SENDGRID],category:"action",defaultConfig:{to:"",cc:"",bcc:"",fromEmail:"",fromName:"",replyTo:"",subject:"",body:"",contentType:"text/html",templateId:"",dynamicTemplateData:"",categories:""},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"out",type:G.OUTPUT,label:"Output"},{id:"error",type:G.OUTPUT,label:"Error"}]}},{type:B.NOTIFICATION,name:"Notification",description:"Send a notification",icon:Q[B.NOTIFICATION],color:Y[B.NOTIFICATION],category:"action",defaultConfig:{channel:"",message:""},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"out",type:G.OUTPUT,label:"Output"}]}},{type:B.DATABASE,name:"Data",description:"Read and write data to databases",icon:Q[B.DATABASE],color:"#6366F1",category:"data",defaultConfig:{operation:I.QUERY,dataSource:null,entity:null,filter:null,fields:{},select:[],orderBy:[],limit:null,offset:null,outputVariable:"results"},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"out",type:G.OUTPUT,label:"Output"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.VARIABLE,name:"Variable",description:"Set or get a workflow variable",icon:Q[B.VARIABLE],color:Y[B.VARIABLE],category:"data",defaultConfig:{variableOperation:"set",variableName:"",value:""},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"out",type:G.OUTPUT,label:"Output"}]}},{type:B.CHATBOT,name:"Chatbot Trigger",description:"Trigger workflow from chatbot interactions",icon:Q[B.CHATBOT],color:Y[B.CHATBOT],category:"trigger",defaultConfig:{triggerEvents:["MESSAGE_SENT"],chatbotSize:"medium",chatbotVariant:"floating",title:"Chat Assistant",subtitle:"Ask me anything",placeholder:"Type a message...",initialMessage:"",enableTypingIndicator:!0,enableSuggestions:!1,suggestions:[],loadingType:"dots",enableFileUpload:!1,maxFileSize:10,maxFiles:5,allowImages:!0,allowDocuments:!1,allowText:!1,allowAudio:!1,allowVideo:!1},defaultPorts:{inputs:[],outputs:[{id:"message",type:G.OUTPUT,label:"Message"},{id:"files",type:G.OUTPUT,label:"Files"},{id:"session",type:G.OUTPUT,label:"Session Start"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.DEBUG,name:"Debug",description:"Display input, output, and variables for debugging",icon:Q[B.DEBUG],color:Y[B.DEBUG],category:"data",defaultConfig:{},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"out",type:G.OUTPUT,label:"Output"}]}},{type:B.UI_TABLE,name:"Table",description:"Display data as an interactive table",icon:Q[B.UI_TABLE],color:Y[B.UI_TABLE],category:"display",defaultConfig:{tableColumns:[],dataExpression:"",tablePageSize:10,tableEnableFilter:!1,tableEnableSort:!0,tableFixedHeader:!1,tableSize:"normal",tableEmptyText:"No data available"},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Data"}],outputs:[{id:"out",type:G.OUTPUT,label:"Output"}]}},{type:B.WEB_SEARCH,name:"Web Search",description:"Search the web using Google, Bing, Brave, or DuckDuckGo",icon:Q[B.WEB_SEARCH],color:Y[B.WEB_SEARCH],category:"web",defaultConfig:{provider:"google",queryField:"query",numResults:10,safeSearch:!0,timeout:3e4},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"out",type:G.OUTPUT,label:"Results"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.WEB_CRAWL,name:"Web Crawl",description:"Crawl web pages and extract text content",icon:Q[B.WEB_CRAWL],color:Y[B.WEB_CRAWL],category:"web",defaultConfig:{urlField:"url",maxDepth:1,maxPages:10,sameDomainOnly:!0,renderJs:!1},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"out",type:G.OUTPUT,label:"Pages"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.DOCUMENT_GENERATOR,name:"Document Generator",description:"Generate Word documents from templates with dynamic data",icon:Q[B.DOCUMENT_GENERATOR],color:Y[B.DOCUMENT_GENERATOR],category:"documents",defaultConfig:{templateId:"",data:{},outputVariable:"documentResult"},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"out",type:G.OUTPUT,label:"Result"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.FILE_STORAGE,name:"File Storage",description:"Store files to S3, MinIO, or local filesystem",icon:Q[B.FILE_STORAGE],color:Y[B.FILE_STORAGE],category:"storage",defaultConfig:{provider:"local",bucket:"default",path:"",fileField:"file",filenameField:"filename"},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"out",type:G.OUTPUT,label:"Result"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.GOOGLE_CLOUD_STORAGE,name:"Google Cloud Storage",description:"Manage objects in Google Cloud Storage buckets",icon:Q[B.GOOGLE_CLOUD_STORAGE],color:Y[B.GOOGLE_CLOUD_STORAGE],category:"storage",defaultConfig:{operation:"LIST",bucketName:"",objectPath:"",serviceAccountPath:"",signedUrlExpiration:3600},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"out",type:G.OUTPUT,label:"Result"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.S3,name:"AWS S3",description:"Upload, download, and manage files in Amazon S3",icon:Q[B.S3],color:Y[B.S3],category:"integrations",defaultConfig:{s3Operation:"upload",s3Bucket:"",s3Key:"",s3Region:"us-east-1",s3ContentType:"auto"},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"out",type:G.OUTPUT,label:"Result"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.EMBEDDING,name:"Embedding",description:"Convert text to vector embeddings",icon:Q[B.EMBEDDING],color:Y[B.EMBEDDING],category:"rag",defaultConfig:{provider:"openai",model:"text-embedding-3-small",inputField:"text",batchSize:100},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Text"}],outputs:[{id:"out",type:G.OUTPUT,label:"Embedding"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.DOCUMENT_LOADER,name:"Document Loader",description:"Load and parse documents (PDF, Word, HTML, etc.)",icon:Q[B.DOCUMENT_LOADER],color:Y[B.DOCUMENT_LOADER],category:"rag",defaultConfig:{sourceType:"text",contentField:"content",filenameField:"filename",defaultType:"txt",timeout:3e4},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Document"}],outputs:[{id:"out",type:G.OUTPUT,label:"Content"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.TEXT_SPLITTER,name:"Text Splitter",description:"Split text into chunks for embedding",icon:Q[B.TEXT_SPLITTER],color:Y[B.TEXT_SPLITTER],category:"rag",defaultConfig:{strategy:"recursive",chunkSize:1e3,chunkOverlap:200,contentField:"content"},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Text"}],outputs:[{id:"out",type:G.OUTPUT,label:"Chunks"}]}},{type:B.VECTOR_WRITE,name:"Vector Write",description:"Store embeddings in vector database",icon:Q[B.VECTOR_WRITE],color:Y[B.VECTOR_WRITE],category:"rag",defaultConfig:{collectionName:"",upsertMode:"replace"},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Embeddings"}],outputs:[{id:"out",type:G.OUTPUT,label:"Result"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.VECTOR_SEARCH,name:"Vector Search",description:"Search for similar documents in vector store",icon:Q[B.VECTOR_SEARCH],color:Y[B.VECTOR_SEARCH],category:"rag",defaultConfig:{collectionName:"",topK:5,minScore:.7,includeContent:!0,includeMetadata:!0,provider:"openai",model:"text-embedding-3-small"},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Query"}],outputs:[{id:"out",type:G.OUTPUT,label:"Results"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.CONTEXT_BUILDER,name:"Context Builder",description:"Format retrieved documents into LLM-ready context",icon:Q[B.CONTEXT_BUILDER],color:Y[B.CONTEXT_BUILDER],category:"rag",defaultConfig:{template:"default",maxTokens:4e3,maxDocuments:10,includeSourceInfo:!0,includeSimilarityScore:!1,separator:"\n\n---\n\n"},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Results"}],outputs:[{id:"out",type:G.OUTPUT,label:"Context"}]}},{type:B.RERANKER,name:"Reranker",description:"Re-rank search results by relevance",icon:Q[B.RERANKER],color:Y[B.RERANKER],category:"rag",defaultConfig:{model:"cross-encoder",topK:5,threshold:.5},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Results"}],outputs:[{id:"out",type:G.OUTPUT,label:"Reranked"}]}},{type:B.SUMMARIZATION,name:"Summarize Document",description:"Summarize long text using AI with chunking strategies",icon:Q[B.SUMMARIZATION],color:Y[B.SUMMARIZATION],category:"action",defaultConfig:{inputField:"text",outputField:"summary",strategy:"map_reduce",chunkSize:4e3,chunkOverlap:200,model:"gpt-4o-mini"},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"out",type:G.OUTPUT,label:"Summary"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.GUARDRAIL,name:"Guardrail",description:"Validate and filter LLM inputs/outputs for safety",icon:Q[B.GUARDRAIL],color:Y[B.GUARDRAIL],category:"safety",defaultConfig:{mode:"input",contentField:"content",onFail:"block",checks:[]},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"out",type:G.OUTPUT,label:"Passed"},{id:"blocked",type:G.ERROR,label:"Blocked"}]}},{type:B.SLACK_SEND_MESSAGE,name:"Slack: Send Message",description:"Send a message to a Slack channel or user",icon:Q[B.SLACK_SEND_MESSAGE],color:Y[B.SLACK_SEND_MESSAGE],category:"slack",defaultConfig:{slackMethod:"api",botToken:"",channel:"",text:"",unfurlLinks:!0,unfurlMedia:!0},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"out",type:G.OUTPUT,label:"Response"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.SLACK_GET_CHANNEL_INFO,name:"Slack: Channel Info",description:"Get information about a Slack channel",icon:Q[B.SLACK_GET_CHANNEL_INFO],color:Y[B.SLACK_GET_CHANNEL_INFO],category:"slack",defaultConfig:{botToken:"",channel:"",includeLocale:!1,includeNumMembers:!1},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"out",type:G.OUTPUT,label:"Info"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.SLACK_LIST_CHANNELS,name:"Slack: List Channels",description:"List available Slack channels in the workspace",icon:Q[B.SLACK_LIST_CHANNELS],color:Y[B.SLACK_LIST_CHANNELS],category:"slack",defaultConfig:{botToken:"",types:"public_channel",excludeArchived:!0,limit:100},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"out",type:G.OUTPUT,label:"Channels"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.SLACK_ADD_REACTION,name:"Slack: Add Reaction",description:"Add a reaction emoji to a Slack message",icon:Q[B.SLACK_ADD_REACTION],color:Y[B.SLACK_ADD_REACTION],category:"slack",defaultConfig:{botToken:"",channel:"",timestamp:"",name:"thumbsup"},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"out",type:G.OUTPUT,label:"Response"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.SLACK_UPLOAD_FILE,name:"Slack: Upload File",description:"Upload a file to a Slack channel",icon:Q[B.SLACK_UPLOAD_FILE],color:Y[B.SLACK_UPLOAD_FILE],category:"slack",defaultConfig:{botToken:"",channels:"",filename:"",content:"",title:""},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"out",type:G.OUTPUT,label:"Response"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.GOOGLE_CALENDAR,name:"Google Calendar",description:"Create, read, update, and delete Google Calendar events",icon:Q[B.GOOGLE_CALENDAR],color:Y[B.GOOGLE_CALENDAR],category:"google-calendar",defaultConfig:{googleCalendarCredential:"",googleCalendarId:"primary",googleCalendarOperation:"getAll",googleCalendarEventSummary:"",googleCalendarEventDescription:"",googleCalendarEventStart:"",googleCalendarEventEnd:"",googleCalendarEventAttendees:"",googleCalendarEventLocation:"",googleCalendarTimeMin:"",googleCalendarTimeMax:"",googleCalendarRecurrence:"",googleCalendarConferenceData:!1},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"out",type:G.OUTPUT,label:"Response"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.SHOPIFY,name:"Shopify",description:"Manage Shopify products, orders, customers, inventory, and fulfillments via the Admin API",icon:Q[B.SHOPIFY],color:Y[B.SHOPIFY],category:"shopify",defaultConfig:{resource:"ORDER",operation:I.LIST,resourceId:"",filters:"",shopDomain:"",accessToken:""},defaultPorts:{inputs:[{id:"input",type:G.INPUT,label:"Input"}],outputs:[{id:"out",type:G.OUTPUT,label:"Output"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.GITLAB,name:"GitLab",description:"Manage GitLab repositories, issues, merge requests, pipelines, and releases",icon:Q[B.GITLAB],color:Y[B.GITLAB],category:"developer",defaultConfig:{gitlabBaseUrl:"https://gitlab.com",gitlabAccessToken:"",gitlabResource:"issue",gitlabOperation:"getAll",gitlabProjectId:"",gitlabTitle:"",gitlabDescription:"",gitlabLabels:[],gitlabAssigneeIds:[],gitlabSourceBranch:"",gitlabTargetBranch:"",gitlabRef:""},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"out",type:G.OUTPUT,label:"Response"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.TELEGRAM_SEND,name:"Telegram: Send Message",description:"Send a message to a Telegram chat with typing indicator and optional emoji reaction",icon:Q[B.TELEGRAM_SEND],color:Y[B.TELEGRAM_SEND],category:"telegram",defaultConfig:{botToken:"",chatId:"",text:"",parseMode:"",replyToMessageId:"",showTyping:!0,reaction:"",disableNotification:!1},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"out",type:G.OUTPUT,label:"Response"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.ZENDESK,name:"Zendesk",description:"Manage Zendesk tickets, users, organizations, and satisfaction ratings",icon:Q[B.ZENDESK],color:Y[B.ZENDESK],category:"zendesk",defaultConfig:{zendeskResource:"TICKET",zendeskOperation:"LIST",zendeskSubdomain:"",zendeskApiToken:"",zendeskEmail:""},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"out",type:G.OUTPUT,label:"Response"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.TWILIO_SMS,name:"Twilio: Send SMS",description:"Send an SMS or WhatsApp message via the Twilio API",icon:Q[B.TWILIO_SMS],color:Y[B.TWILIO_SMS],category:"twilio",defaultConfig:{twilioAccountSid:"",twilioAuthToken:"",twilioFromNumber:"",twilioToNumber:"",twilioMessageBody:"",twilioOperation:"send_sms",twilioStatusCallback:""},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"out",type:G.OUTPUT,label:"Response"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.TWILIO_VOICE,name:"Twilio: Voice Call",description:"Make a voice call via the Twilio API",icon:Q[B.TWILIO_VOICE],color:Y[B.TWILIO_VOICE],category:"twilio",defaultConfig:{twilioAccountSid:"",twilioAuthToken:"",twilioFromNumber:"",twilioToNumber:"",twilioOperation:"make_call",twilioVoiceUrl:"",twilioStatusCallback:""},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"out",type:G.OUTPUT,label:"Response"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.TELEGRAM_BOT,name:"Telegram Bot",description:"Receive messages from a Telegram bot via polling or webhook",icon:Q[B.TELEGRAM_BOT],color:Y[B.TELEGRAM_BOT],category:"trigger",defaultConfig:{botToken:"",mode:"polling",pollingTimeout:30,allowedUpdates:[],allowedChatIds:"",allowedUserIds:""},defaultPorts:{inputs:[],outputs:[{id:"out",type:G.OUTPUT,label:"Message"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.SLACK_SOCKET,name:"Slack Socket",description:"Receive events via Slack Socket Mode (WebSocket)",icon:Q[B.SLACK_SOCKET],color:Y[B.SLACK_SOCKET],category:"trigger",defaultConfig:{appToken:"",botToken:""},defaultPorts:{inputs:[],outputs:[{id:"out",type:G.OUTPUT,label:"Event"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.DISCORD_BOT,name:"Discord Bot",description:"Receive events from a Discord bot (Gateway WebSocket)",icon:Q[B.DISCORD_BOT],color:Y[B.DISCORD_BOT],category:"trigger",defaultConfig:{botToken:""},defaultPorts:{inputs:[],outputs:[{id:"out",type:G.OUTPUT,label:"Event"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.WHATSAPP_WEBHOOK,name:"WhatsApp",description:"Receive messages via WhatsApp Business API",icon:Q[B.WHATSAPP_WEBHOOK],color:Y[B.WHATSAPP_WEBHOOK],category:"trigger",defaultConfig:{},defaultPorts:{inputs:[],outputs:[{id:"out",type:G.OUTPUT,label:"Message"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.CUSTOM_WEBSOCKET,name:"WebSocket Listener",description:"Listen for messages on a custom WebSocket endpoint",icon:Q[B.CUSTOM_WEBSOCKET],color:Y[B.CUSTOM_WEBSOCKET],category:"trigger",defaultConfig:{url:""},defaultPorts:{inputs:[],outputs:[{id:"out",type:G.OUTPUT,label:"Message"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.RABBITMQ_TRIGGER,name:"RabbitMQ Trigger",description:"Triggers workflow on new messages from a RabbitMQ queue",icon:Q[B.RABBITMQ_TRIGGER],color:Y[B.RABBITMQ_TRIGGER],category:"trigger",defaultConfig:{connectionUrl:"",queueName:"",exchange:"",routingKey:"#",autoAck:!1,contentType:"application/json",prefetchCount:1},defaultPorts:{inputs:[],outputs:[{id:"out",type:G.OUTPUT,label:"Message"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.KAFKA,name:"Kafka: Send Message",description:"Produce a message to a Kafka topic",icon:Q[B.KAFKA],color:Y[B.KAFKA],category:"messaging",defaultConfig:{kafkaBrokers:"localhost:9092",kafkaAcks:"all",kafkaCompressionType:"none"},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"In"}],outputs:[{id:"out",type:G.OUTPUT,label:"Out"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.KAFKA_TRIGGER,name:"Kafka Trigger",description:"Triggers workflow on new messages from a Kafka topic",icon:Q[B.KAFKA_TRIGGER],color:Y[B.KAFKA_TRIGGER],category:"messaging",defaultConfig:{kafkaBrokers:"localhost:9092",kafkaConsumerGroup:"nuraly-workflow",kafkaFromBeginning:!1,kafkaSessionTimeout:3e4},defaultPorts:{inputs:[],outputs:[{id:"out",type:G.OUTPUT,label:"Message"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.CRON,name:"Cron Trigger",description:"Triggers workflow on a scheduled cron expression",icon:Q[B.CRON],color:Y[B.CRON],category:"trigger",defaultConfig:{cronExpression:"0 * * * *",timezone:"UTC"},defaultPorts:{inputs:[],outputs:[{id:"out",type:G.OUTPUT,label:"Tick"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.MCP,name:"MCP Server",description:"Connect to MCP server - provides tools to Agent/LLM nodes",icon:Q[B.MCP],color:Y[B.MCP],category:"trigger",defaultConfig:{serverUrl:"",transportType:"streamable_http"},defaultPorts:{inputs:[],outputs:[{id:"out",type:G.OUTPUT,label:"Event"}]}},{type:B.HUBSPOT,name:"HubSpot",description:"Manage contacts, deals, companies, and tickets via HubSpot CRM",icon:Q[B.HUBSPOT],color:Y[B.HUBSPOT],category:"crm",defaultConfig:{hubspotAccessToken:"",hubspotResource:"contact",hubspotOperation:"getAll",hubspotProperties:{},hubspotFilterGroups:[],hubspotLimit:100,hubspotAssociations:[]},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"out",type:G.OUTPUT,label:"Result"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.JIRA,name:"Jira",description:"Create, update, and manage Jira issues",icon:Q[B.JIRA],color:Y[B.JIRA],category:"jira",defaultConfig:{operation:"createIssue",jiraInstanceUrl:"",projectKey:"",issueType:"Task",summary:"",description:"",assignee:"",priority:"Medium",labels:"",jqlQuery:"",transitionId:"",issueKey:"",comment:""},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"out",type:G.OUTPUT,label:"Result"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.ELASTICSEARCH,name:"Elasticsearch",description:"Search, index, and manage documents in Elasticsearch",icon:Q[B.ELASTICSEARCH],color:Y[B.ELASTICSEARCH],category:"integration",defaultConfig:{elasticsearchUrl:"",elasticsearchCredentialPath:"",elasticsearchOperation:"search",elasticsearchIndex:"",elasticsearchDocumentId:"",elasticsearchQueryBody:"",elasticsearchSize:10,elasticsearchFrom:0,elasticsearchRefresh:"false",elasticsearchTimeout:"30s",elasticsearchRouting:"",outputVariable:"elasticsearchResult"},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"out",type:G.OUTPUT,label:"Result"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.CALENDLY_TRIGGER,name:"Calendly Trigger",description:"Triggers workflow when a Calendly event is booked or cancelled",icon:Q[B.CALENDLY_TRIGGER],color:Y[B.CALENDLY_TRIGGER],category:"trigger",defaultConfig:{events:["invitee.created"],scope:"user",outputVariable:"calendlyEvent"},defaultPorts:{inputs:[],outputs:[{id:"out",type:G.OUTPUT,label:"Event"},{id:"error",type:G.ERROR,label:"Error"}]}},{type:B.NOTE,name:"Note",description:"Add annotations and comments to your workflow",icon:Q[B.NOTE],color:Y[B.NOTE],category:"annotation",defaultConfig:{noteContent:"Add your note here...",noteBackgroundColor:"#fef08a",noteTextColor:"#713f12",noteFontSize:"medium",noteShowBorder:!1},defaultPorts:{inputs:[],outputs:[]}},{type:B.FRAME,name:"Frame",description:"Group related nodes together with a labeled container",icon:Q[B.FRAME],color:Y[B.FRAME],category:"annotation",defaultConfig:{frameLabel:"Group",frameWidth:400,frameHeight:300,frameBackgroundColor:"rgba(99, 102, 241, 0.05)",frameBorderColor:"rgba(99, 102, 241, 0.3)",frameLabelPosition:"top-left",frameLabelPlacement:"outside",frameShowLabel:!0,frameCollapsed:!1},defaultPorts:{inputs:[],outputs:[]}},{type:U.AGENT,name:"AI Agent",description:"Autonomous AI agent that can use tools",icon:Q[U.AGENT],color:Y[U.AGENT],category:"agent",defaultConfig:{agentId:"",maxIterations:10},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"},{id:"retriever",type:G.INPUT,label:"Retriever"}],configs:[{id:"llm",type:G.CONFIG,label:"LLM"},{id:"prompt",type:G.CONFIG,label:"Prompt"},{id:"memory",type:G.CONFIG,label:"Memory"},{id:"tools",type:G.CONFIG,label:"Tools",multiple:!0},{id:"structured_output",type:G.CONFIG,label:"Structured Output"}],outputs:[{id:"out",type:G.OUTPUT,label:"Output"}]}},{type:U.TOOL,name:"Tool",description:"A tool that can be used by an agent",icon:Q[U.TOOL],color:Y[U.TOOL],category:"agent",defaultConfig:{toolName:"",description:"",parameters:[]},defaultPorts:{inputs:[{id:"function",type:G.INPUT,label:"Function"}],outputs:[{id:"out",type:G.OUTPUT,label:"Tool"}]}},{type:U.MEMORY,name:"Context Memory",description:"Conversation memory for agents - stores and retrieves chat history",icon:Q[U.MEMORY],color:Y[U.MEMORY],category:"agent",defaultConfig:{cutoffMode:"message",maxMessages:50,maxTokens:4e3,conversationIdExpression:"${input.threadId}"},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"out",type:G.OUTPUT,label:"Memory Config"}]}},{type:U.CONTEXT_MEMORY,name:"Context Memory (RAG)",description:"RAG-enhanced conversation memory with buffer, semantic, or hybrid modes",icon:Q[U.CONTEXT_MEMORY],color:Y[U.CONTEXT_MEMORY],category:"agent",defaultConfig:{memoryType:"hybrid",cutoffMode:"message",maxMessages:50,maxTokens:4e3,conversationIdExpression:"${input.threadId}"},defaultPorts:{inputs:[],outputs:[{id:"out",type:G.OUTPUT,label:"Memory Config"}]}},{type:U.PROMPT,name:"Prompt",description:"Prompt template for LLM",icon:Q[U.PROMPT],color:Y[U.PROMPT],category:"agent",defaultConfig:{template:"",variables:[]},defaultPorts:{inputs:[],outputs:[{id:"out",type:G.OUTPUT,label:"Prompt"}]}},{type:U.LLM,name:"LLM",description:"Large Language Model call",icon:Q[U.LLM],color:Y[U.LLM],category:"agent",defaultConfig:{provider:"openai",modelName:"gpt-4",temperature:.7,maxTokens:2048},defaultPorts:{inputs:[],outputs:[{id:"out",type:G.OUTPUT,label:"Response"}]}},{type:U.RETRIEVER,name:"Retriever",description:"Retrieve relevant documents from vector store",icon:Q[U.RETRIEVER],color:Y[U.RETRIEVER],category:"agent",defaultConfig:{vectorStoreId:"",topK:5},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Query"}],outputs:[{id:"out",type:G.OUTPUT,label:"Documents"}]}},{type:U.CHAIN,name:"Chain",description:"Chain multiple LLM calls together",icon:Q[U.CHAIN],color:Y[U.CHAIN],category:"agent",defaultConfig:{chainType:"sequential"},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"out",type:G.OUTPUT,label:"Output"}]}},{type:U.ROUTER,name:"Router",description:"Route to different chains based on input",icon:Q[U.ROUTER],color:Y[U.ROUTER],category:"agent",defaultConfig:{routingExpression:""},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Input"}],outputs:[{id:"route1",type:G.OUTPUT,label:"Route 1"},{id:"route2",type:G.OUTPUT,label:"Route 2"},{id:"default",type:G.CONDITIONAL_DEFAULT,label:"Default"}]}},{type:U.HUMAN_INPUT,name:"Human Input",description:"Wait for human input in the workflow",icon:Q[U.HUMAN_INPUT],color:Y[U.HUMAN_INPUT],category:"agent",defaultConfig:{prompt:"",timeout:864e5},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Context"}],outputs:[{id:"out",type:G.OUTPUT,label:"Response"}]}},{type:U.OUTPUT_PARSER,name:"Output Parser",description:"Parse LLM output into structured data",icon:Q[U.OUTPUT_PARSER],color:Y[U.OUTPUT_PARSER],category:"agent",defaultConfig:{parserType:"json",schema:{}},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"Raw Output"}],outputs:[{id:"out",type:G.OUTPUT,label:"Parsed Data"}]}},{type:U.STRUCTURED_OUTPUT,name:"Structured Output",description:"Define a JSON schema to enforce structured LLM output",icon:Q[U.STRUCTURED_OUTPUT],color:Y[U.STRUCTURED_OUTPUT],category:"agent",defaultConfig:{schemaName:"structured_output",strict:!0,schema:{type:"object",properties:{},required:[],additionalProperties:!1}},defaultPorts:{inputs:[],outputs:[{id:"out",type:G.OUTPUT,label:"Schema"}]}},{type:V.TABLE,name:"Table",description:"Define a database table with columns",icon:Q[V.TABLE],color:Y[V.TABLE],category:"db-tables-views",defaultConfig:{tableName:"",columns:[],primaryKey:""},defaultPorts:{inputs:[],outputs:[{id:"ref",type:G.OUTPUT,label:"Reference"}]}},{type:V.VIEW,name:"View",description:"Create a database view based on queries",icon:Q[V.VIEW],color:Y[V.VIEW],category:"db-tables-views",defaultConfig:{viewName:"",query:"",materialized:!1},defaultPorts:{inputs:[{id:"source",type:G.INPUT,label:"Source Tables"}],outputs:[{id:"ref",type:G.OUTPUT,label:"Reference"}]}},{type:V.INDEX,name:"Index",description:"Create an index on table columns",icon:Q[V.INDEX],color:Y[V.INDEX],category:"db-indexes-queries",defaultConfig:{indexName:"",indexColumns:[],unique:!1,indexType:"BTREE"},defaultPorts:{inputs:[{id:"table",type:G.INPUT,label:"Table"}],outputs:[]}},{type:V.RELATIONSHIP,name:"Relationship",description:"Define foreign key relationships between tables",icon:Q[V.RELATIONSHIP],color:Y[V.RELATIONSHIP],category:"db-relations-constraints",defaultConfig:{relationshipType:"ONE_TO_MANY",sourceColumn:"",targetColumn:"",onDelete:"CASCADE",onUpdate:"CASCADE"},defaultPorts:{inputs:[{id:"source",type:G.INPUT,label:"Source Table"},{id:"target",type:G.INPUT,label:"Target Table"}],outputs:[]}},{type:V.CONSTRAINT,name:"Constraint",description:"Add constraints (unique, check, foreign_key)",icon:Q[V.CONSTRAINT],color:Y[V.CONSTRAINT],category:"db-relations-constraints",defaultConfig:{constraintName:"",constraintType:"UNIQUE",constraintColumns:[],checkExpression:""},defaultPorts:{inputs:[{id:"table",type:G.INPUT,label:"Table"}],outputs:[]}},{type:V.QUERY,name:"Query",description:"Define saved queries or stored procedures",icon:Q[V.QUERY],color:Y[V.QUERY],category:"db-indexes-queries",defaultConfig:{queryName:"",queryText:"",parameters:[]},defaultPorts:{inputs:[{id:"tables",type:G.INPUT,label:"Tables"}],outputs:[{id:"result",type:G.OUTPUT,label:"Result Schema"}]}},{type:H.STICKY_NOTE,name:"Sticky Note",description:"Add a sticky note to the whiteboard",icon:Q[H.STICKY_NOTE],color:Y[H.STICKY_NOTE],category:"wb-notes-text",defaultConfig:{textContent:"",backgroundColor:"#fef08a",textColor:"#713f12",fontSize:14,width:200,height:200},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"In"}],outputs:[{id:"out",type:G.OUTPUT,label:"Out"}]}},{type:H.TEXT_BLOCK,name:"Text Block",description:"Add a text block to the whiteboard",icon:Q[H.TEXT_BLOCK],color:Y[H.TEXT_BLOCK],category:"wb-notes-text",defaultConfig:{textContent:"",fontSize:16,fontWeight:"normal",textAlign:"left",width:200,height:50},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"In"}],outputs:[{id:"out",type:G.OUTPUT,label:"Out"}]}},{type:H.SHAPE_RECTANGLE,name:"Rectangle",description:"Add a rectangle shape",icon:Q[H.SHAPE_RECTANGLE],color:Y[H.SHAPE_RECTANGLE],category:"wb-shapes",defaultConfig:{width:120,height:120,fillColor:"#3b82f6"},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"In"}],outputs:[{id:"out",type:G.OUTPUT,label:"Out"}]}},{type:H.SHAPE_CIRCLE,name:"Circle",description:"Add a circle shape",icon:Q[H.SHAPE_CIRCLE],color:Y[H.SHAPE_CIRCLE],category:"wb-shapes",defaultConfig:{width:120,height:120,fillColor:"#8b5cf6"},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"In"}],outputs:[{id:"out",type:G.OUTPUT,label:"Out"}]}},{type:H.SHAPE_DIAMOND,name:"Diamond",description:"Add a diamond shape",icon:Q[H.SHAPE_DIAMOND],color:Y[H.SHAPE_DIAMOND],category:"wb-shapes",defaultConfig:{width:120,height:120,fillColor:"#f59e0b"},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"In"}],outputs:[{id:"out",type:G.OUTPUT,label:"Out"}]}},{type:H.SHAPE_TRIANGLE,name:"Triangle",description:"Add a triangle shape",icon:Q[H.SHAPE_TRIANGLE],color:Y[H.SHAPE_TRIANGLE],category:"wb-shapes",defaultConfig:{width:120,height:120,fillColor:"#22c55e"},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"In"}],outputs:[{id:"out",type:G.OUTPUT,label:"Out"}]}},{type:H.SHAPE_ARROW,name:"Arrow",description:"Add an arrow shape",icon:Q[H.SHAPE_ARROW],color:Y[H.SHAPE_ARROW],category:"wb-shapes",defaultConfig:{width:120,height:60,fillColor:"#6b7280"},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"In"}],outputs:[{id:"out",type:G.OUTPUT,label:"Out"}]}},{type:H.SHAPE_LINE,name:"Line",description:"Add a line shape",icon:Q[H.SHAPE_LINE],color:Y[H.SHAPE_LINE],category:"wb-shapes",defaultConfig:{width:120,height:4,fillColor:"#6b7280"},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"In"}],outputs:[{id:"out",type:G.OUTPUT,label:"Out"}]}},{type:H.SHAPE_STAR,name:"Star",description:"Add a star shape",icon:Q[H.SHAPE_STAR],color:Y[H.SHAPE_STAR],category:"wb-shapes",defaultConfig:{width:120,height:120,fillColor:"#f97316"},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"In"}],outputs:[{id:"out",type:G.OUTPUT,label:"Out"}]}},{type:H.SHAPE_HEXAGON,name:"Hexagon",description:"Add a hexagon shape",icon:Q[H.SHAPE_HEXAGON],color:Y[H.SHAPE_HEXAGON],category:"wb-shapes",defaultConfig:{width:120,height:120,fillColor:"#ec4899"},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"In"}],outputs:[{id:"out",type:G.OUTPUT,label:"Out"}]}},{type:H.IMAGE,name:"Image",description:"Add an image to the whiteboard",icon:Q[H.IMAGE],color:Y[H.IMAGE],category:"wb-media",defaultConfig:{imageUrl:"",width:200,height:200},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"In"}],outputs:[{id:"out",type:G.OUTPUT,label:"Out"}]}},{type:H.DRAWING,name:"Drawing",description:"Add a freehand drawing area",icon:Q[H.DRAWING],color:Y[H.DRAWING],category:"wb-media",defaultConfig:{pathData:"",width:200,height:200},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"In"}],outputs:[{id:"out",type:G.OUTPUT,label:"Out"}]}},{type:H.VOTING,name:"Voting",description:"Add a voting element for collaboration",icon:Q[H.VOTING],color:Y[H.VOTING],category:"wb-media",defaultConfig:{textContent:"Vote",width:200,height:150},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"In"}],outputs:[{id:"out",type:G.OUTPUT,label:"Out"}]}},{type:H.MERMAID,name:"Mermaid Diagram",description:"Add a Mermaid diagram to the whiteboard",icon:Q[H.MERMAID],color:Y[H.MERMAID],category:"wb-media",defaultConfig:{textContent:"graph TD\n A[Start] --\x3e B[End]",width:400,height:300},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"In"}],outputs:[{id:"out",type:G.OUTPUT,label:"Out"}]}},{type:H.ANCHOR,name:"Anchor",description:"Navigation anchor — other elements can link here",icon:Q[H.ANCHOR],color:Y[H.ANCHOR],category:"wb-navigation",defaultConfig:{anchorLabel:"Anchor",width:120,height:48},defaultPorts:{inputs:[],outputs:[]}},{type:H.FRAME,name:"Frame",description:"Group whiteboard elements together",icon:Q[H.FRAME],color:Y[H.FRAME],category:"wb-layout",defaultConfig:{frameLabel:"Group",frameWidth:400,frameHeight:300,frameBackgroundColor:"rgba(99, 102, 241, 0.05)",frameBorderColor:"rgba(99, 102, 241, 0.3)",frameLabelPosition:"top-left",frameLabelPlacement:"outside",frameShowLabel:!0,frameCollapsed:!1},defaultPorts:{inputs:[],outputs:[]}},{type:H.WORKFLOW,name:"Workflow",description:"Embed a workflow on the whiteboard",icon:Q[H.WORKFLOW],color:Y[H.WORKFLOW],category:"wb-media",defaultConfig:{workflowId:"",workflowName:"Workflow",workflowSteps:[],width:280,height:200},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"In"}],outputs:[{id:"out",type:G.OUTPUT,label:"Out"}]}},{type:H.DATABASE,name:"Database Table",description:"Embed a database table on the whiteboard",icon:Q[H.DATABASE],color:Y[H.DATABASE],category:"wb-media",defaultConfig:{dbTableId:"",dbTableName:"Table",dbTableColumns:[],dbPrimaryKey:"",width:280,height:200},defaultPorts:{inputs:[{id:"in",type:G.INPUT,label:"In"}],outputs:[{id:"out",type:G.OUTPUT,label:"Out"}]}}],X=[{id:"trigger",name:"Triggers",icon:"zap",nodeTypes:[B.START,B.HTTP_START,B.CHAT_START,B.CRON,B.TELEGRAM_BOT,B.SLACK_SOCKET,B.DISCORD_BOT,B.WHATSAPP_WEBHOOK,B.CUSTOM_WEBSOCKET,B.MCP,B.CALENDLY_TRIGGER],canvasType:q.WORKFLOW},{id:"control",name:"Control Flow",icon:"git-branch",nodeTypes:[B.END,B.HTTP_END,B.CONDITION,B.SWITCH,B.DELAY,B.WAIT,B.PARALLEL,B.MERGE,B.LOOP,B.BREAK,B.TRY_CATCH],canvasType:q.WORKFLOW},{id:"action",name:"Actions",icon:"zap",nodeTypes:[B.FUNCTION,B.HTTP,B.INFORMATION_EXTRACTOR,B.OCR,B.CHAT_OUTPUT,B.SOCIAL_POST,B.SUB_WORKFLOW,B.EMAIL,B.EMAIL_READER,B.SENDGRID,B.NOTIFICATION,B.DOCUMENT_GENERATOR,B.SUMMARIZATION],canvasType:q.WORKFLOW},{id:"data",name:"Data",icon:"database",nodeTypes:[B.TRANSFORM,B.DATABASE,B.ELASTICSEARCH,B.VARIABLE,B.DEBUG],canvasType:q.WORKFLOW},{id:"web",name:"Web",icon:"globe",nodeTypes:[B.WEB_SEARCH,B.WEB_CRAWL],canvasType:q.WORKFLOW},{id:"storage",name:"Storage",icon:"hard-drive",nodeTypes:[B.FILE_STORAGE,B.GOOGLE_CLOUD_STORAGE,B.S3],canvasType:q.WORKFLOW},{id:"messaging",name:"Messaging",icon:"inbox",nodeTypes:[B.RABBITMQ_TRIGGER,B.KAFKA,B.KAFKA_TRIGGER],canvasType:q.WORKFLOW},{id:"rag",name:"RAG",icon:"layers",nodeTypes:[B.DOCUMENT_LOADER,B.TEXT_SPLITTER,B.EMBEDDING,B.VECTOR_WRITE,B.VECTOR_SEARCH,B.CONTEXT_BUILDER,B.RERANKER],canvasType:q.WORKFLOW},{id:"safety",name:"Safety",icon:"shield",nodeTypes:[B.GUARDRAIL],canvasType:q.WORKFLOW},{id:"display",name:"Display",icon:"monitor",nodeTypes:[B.UI_TABLE],canvasType:q.WORKFLOW},{id:"google-calendar",name:"Google Calendar",icon:"calendar",nodeTypes:[B.GOOGLE_CALENDAR],canvasType:q.WORKFLOW},{id:"shopify",name:"Shopify",icon:"shopping-cart",nodeTypes:[B.SHOPIFY],canvasType:q.WORKFLOW},{id:"twilio",name:"Twilio",icon:"phone",nodeTypes:[B.TWILIO_SMS,B.TWILIO_VOICE],canvasType:q.WORKFLOW},{id:"telegram",name:"Telegram",icon:"send",nodeTypes:[B.TELEGRAM_SEND],canvasType:q.WORKFLOW},{id:"zendesk",name:"Zendesk",icon:"ticket",nodeTypes:[B.ZENDESK],canvasType:q.WORKFLOW},{id:"slack",name:"Slack",icon:"message-square",nodeTypes:[B.SLACK_SEND_MESSAGE,B.SLACK_GET_CHANNEL_INFO,B.SLACK_LIST_CHANNELS,B.SLACK_ADD_REACTION,B.SLACK_UPLOAD_FILE],canvasType:q.WORKFLOW},{id:"crm",name:"CRM",icon:"users",nodeTypes:[B.HUBSPOT],canvasType:q.WORKFLOW},{id:"jira",name:"Jira",icon:"ticket",nodeTypes:[B.JIRA],canvasType:q.WORKFLOW},{id:"gitlab",name:"GitLab",icon:"git-merge",nodeTypes:[B.GITLAB],canvasType:q.WORKFLOW},{id:"annotation",name:"Annotations",icon:"message-square",nodeTypes:[B.NOTE,B.FRAME],canvasType:q.WORKFLOW},{id:"agent",name:"AI Agents",icon:"cpu",nodeTypes:[U.AGENT,U.LLM,U.PROMPT,U.MEMORY,U.CONTEXT_MEMORY,U.TOOL,U.RETRIEVER,U.CHAIN,U.ROUTER,U.HUMAN_INPUT,U.OUTPUT_PARSER,U.STRUCTURED_OUTPUT],canvasType:q.WORKFLOW},{id:"db-tables-views",name:"Tables & Views",icon:"table",nodeTypes:[V.TABLE,V.VIEW],canvasType:q.DATABASE},{id:"db-relations-constraints",name:"Relations & Constraints",icon:"git-merge",nodeTypes:[V.RELATIONSHIP,V.CONSTRAINT],canvasType:q.DATABASE},{id:"db-indexes-queries",name:"Indexes & Queries",icon:"list",nodeTypes:[V.INDEX,V.QUERY],canvasType:q.DATABASE},{id:"wb-notes-text",name:"Notes & Text",icon:"sticky-note",nodeTypes:[H.STICKY_NOTE,H.TEXT_BLOCK],canvasType:q.WHITEBOARD},{id:"wb-shapes",name:"Shapes",icon:"square",nodeTypes:[H.SHAPE_RECTANGLE,H.SHAPE_CIRCLE,H.SHAPE_DIAMOND,H.SHAPE_TRIANGLE,H.SHAPE_ARROW,H.SHAPE_LINE,H.SHAPE_STAR,H.SHAPE_HEXAGON],canvasType:q.WHITEBOARD},{id:"wb-media",name:"Media & Interactive",icon:"image",nodeTypes:[H.IMAGE,H.DRAWING,H.VOTING,H.MERMAID],canvasType:q.WHITEBOARD},{id:"wb-navigation",name:"Navigation",icon:"anchor",nodeTypes:[H.ANCHOR],canvasType:q.WHITEBOARD},{id:"wb-layout",name:"Layout",icon:"frame",nodeTypes:[H.FRAME],canvasType:q.WHITEBOARD}];function ee(e){return Z.find(t=>t.type===e)}function te(e){return Object.values(U).includes(e)}function ie(e){return Object.values(B).includes(e)}function ne(e){return Object.values(V).includes(e)}function ae(e){return Object.values(H).includes(e)}function oe(e){return X.filter(t=>t.canvasType===e)}function se(e,t,i){var n;const a=ee(e);return a?{id:i||"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}),name:a.name,type:a.type,position:t,configuration:Object.assign({},a.defaultConfig),ports:{inputs:a.defaultPorts.inputs.map(e=>Object.assign({},e)),configs:null===(n=a.defaultPorts.configs)||void 0===n?void 0:n.map(e=>Object.assign({},e)),outputs:a.defaultPorts.outputs.map(e=>Object.assign({},e))},metadata:{icon:a.icon,color:a.color,description:a.description},status:K.IDLE,selected:!1}:null}const re=[{name:"Yellow",bg:"#fef08a",text:"#713f12"},{name:"Blue",bg:"#bfdbfe",text:"#1e3a5f"},{name:"Green",bg:"#bbf7d0",text:"#14532d"},{name:"Pink",bg:"#fbcfe8",text:"#831843"},{name:"Orange",bg:"#fed7aa",text:"#7c2d12"},{name:"Purple",bg:"#ddd6fe",text:"#4c1d95"},{name:"Gray",bg:"#e5e7eb",text:"#374151"}],le=[{name:"Indigo",bg:"rgba(99, 102, 241, 0.05)",border:"rgba(99, 102, 241, 0.3)",solid:"#6366f1"},{name:"Blue",bg:"rgba(59, 130, 246, 0.05)",border:"rgba(59, 130, 246, 0.3)",solid:"#3b82f6"},{name:"Green",bg:"rgba(34, 197, 94, 0.05)",border:"rgba(34, 197, 94, 0.3)",solid:"#22c55e"},{name:"Orange",bg:"rgba(249, 115, 22, 0.05)",border:"rgba(249, 115, 22, 0.3)",solid:"#f97316"},{name:"Red",bg:"rgba(239, 68, 68, 0.05)",border:"rgba(239, 68, 68, 0.3)",solid:"#ef4444"},{name:"Purple",bg:"rgba(168, 85, 247, 0.05)",border:"rgba(168, 85, 247, 0.3)",solid:"#a855f7"},{name:"Gray",bg:"rgba(107, 114, 128, 0.05)",border:"rgba(107, 114, 128, 0.3)",solid:"#6b7280"}];function ce(e){return e===B.NOTE||e===B.FRAME}function de(e){return e===B.FRAME}function pe(e){return e===B.NOTE}const he=new Set([B.TELEGRAM_BOT,B.SLACK_SOCKET,B.DISCORD_BOT,B.WHATSAPP_WEBHOOK,B.CUSTOM_WEBSOCKET,B.RABBITMQ_TRIGGER,B.CALENDLY_TRIGGER,B.KAFKA_TRIGGER,B.CRON]);function ue(e){return he.has(e)}
107
107
  /**
108
108
  * @license
109
109
  * Copyright 2023 Nuraly, Laabidi Aymen
@@ -250,7 +250,7 @@ var Ce=function(e,t,i,n){for(var a,o=arguments.length,s=o<3?t:null===n?n=Object.
250
250
  * Copyright 2023 Nuraly Laabidi Aymen
251
251
  * SPDX-License-Identifier: MIT
252
252
  */
253
- var Te=function(e,t,i,n){for(var a,o=arguments.length,s=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n,r=e.length-1;r>=0;r--)(a=e[r])&&(s=(o<3?a(s):o>3?a(t,i,s):a(t,i))||s);return o>3&&s&&Object.defineProperty(t,i,s),s};const Me=(e=>{class t extends e{constructor(){super(...arguments),this.clickable=!1,this.disabled=!1}handleIconClick(e){if(this.disabled||!this.clickable)return e.preventDefault(),void e.stopPropagation();this.dispatchCustomEvent("icon-click",{iconName:this.name,iconType:this.type,originalEvent:e,timestamp:Date.now()})}handleIconKeydown(e){if(this.disabled||!this.clickable)return;("function"==typeof this.isActivationKey?this.isActivationKey(e):"Enter"===e.key||" "===e.key)&&(e.preventDefault(),e.stopPropagation(),this.handleIconClick(e),"function"==typeof this.dispatchCustomEvent&&this.dispatchCustomEvent("icon-keyboard-activation",{iconName:this.name,iconType:this.type,key:e.key,originalEvent:e,timestamp:Date.now()}))}getIconRole(){return this.clickable?"button":"img"}getIconTabIndex(){return this.clickable?this.disabled?"-1":"0":"-1"}getAriaDisabled(){return this.clickable&&this.disabled?"true":void 0}}return Ce([o({type:Boolean,reflect:!0})],t.prototype,"clickable",void 0),Ce([o({type:Boolean,reflect:!0})],t.prototype,"disabled",void 0),t})(we(t));let ze=class extends Me{constructor(){super(...arguments),this.type="regular",this.alt=""}willUpdate(e){if(super.willUpdate(e),e.has("name")&&!this.name&&console.error('HyIconElement: "name" property is required'),e.has("type")&&"solid"!==this.type&&"regular"!==this.type&&(console.warn(`HyIconElement: Invalid type "${this.type}". Using default "solid"`),this.type="solid"),e.has("size")&&this.size){const e=["small","medium","large","xlarge","xxlarge"];e.includes(this.size)||console.warn(`HyIconElement: Invalid size "${this.size}". Valid sizes are: ${e.join(", ")}`)}}render(){let e="";this.color&&(e+=`color: ${this.color};`),this.width&&(e+=`width: ${this.width};`),this.height&&(e+=`height: ${this.height};`);const t=Se[this.name];return i`
253
+ var Te=function(e,t,i,n){for(var a,o=arguments.length,s=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n,r=e.length-1;r>=0;r--)(a=e[r])&&(s=(o<3?a(s):o>3?a(t,i,s):a(t,i))||s);return o>3&&s&&Object.defineProperty(t,i,s),s};const Me=(e=>{class t extends e{constructor(){super(...arguments),this.clickable=!1,this.disabled=!1}handleIconClick(e){if(this.disabled||!this.clickable)return e.preventDefault(),void e.stopPropagation();this.dispatchCustomEvent("icon-click",{iconName:this.name,iconType:this.type,originalEvent:e,timestamp:Date.now()})}handleIconKeydown(e){if(this.disabled||!this.clickable)return;("function"==typeof this.isActivationKey?this.isActivationKey(e):"Enter"===e.key||" "===e.key)&&(e.preventDefault(),e.stopPropagation(),this.handleIconClick(e),"function"==typeof this.dispatchCustomEvent&&this.dispatchCustomEvent("icon-keyboard-activation",{iconName:this.name,iconType:this.type,key:e.key,originalEvent:e,timestamp:Date.now()}))}getIconRole(){return this.clickable?"button":"img"}getIconTabIndex(){return this.clickable?this.disabled?"-1":"0":"-1"}getAriaDisabled(){return this.clickable&&this.disabled?"true":void 0}}return Ce([o({type:Boolean,reflect:!0})],t.prototype,"clickable",void 0),Ce([o({type:Boolean,reflect:!0})],t.prototype,"disabled",void 0),t})(we(t));let Ee=class extends Me{constructor(){super(...arguments),this.type="regular",this.alt=""}willUpdate(e){if(super.willUpdate(e),e.has("name")&&!this.name&&console.error('HyIconElement: "name" property is required'),e.has("type")&&"solid"!==this.type&&"regular"!==this.type&&(console.warn(`HyIconElement: Invalid type "${this.type}". Using default "solid"`),this.type="solid"),e.has("size")&&this.size){const e=["small","medium","large","xlarge","xxlarge"];e.includes(this.size)||console.warn(`HyIconElement: Invalid size "${this.size}". Valid sizes are: ${e.join(", ")}`)}}render(){let e="";this.color&&(e+=`color: ${this.color};`),this.width&&(e+=`width: ${this.width};`),this.height&&(e+=`height: ${this.height};`);const t=Se[this.name];return i`
254
254
  <div
255
255
  part="container"
256
256
  id="icon-slot"
@@ -279,7 +279,7 @@ var Te=function(e,t,i,n){for(var a,o=arguments.length,s=o<3?t:null===n?n=Object.
279
279
  >${d(t)}</svg>
280
280
  `:i`<span part="fallback" class="icon-fallback">${this.name}</span>`}
281
281
  </div>
282
- `}getIconRole(){return this.clickable?"button":this.alt?"img":"presentation"}getIconTabIndex(){return this.clickable&&!this.disabled?"0":"-1"}getAriaDisabled(){return this.disabled?"true":void 0}};ze.useShadowDom=!0,ze.styles=ke,Te([o({type:String})],ze.prototype,"name",void 0),Te([o()],ze.prototype,"type",void 0),Te([o({type:String,attribute:"alt"})],ze.prototype,"alt",void 0),Te([o({type:String,reflect:!0})],ze.prototype,"size",void 0),Te([o({type:String})],ze.prototype,"color",void 0),Te([o({type:String})],ze.prototype,"width",void 0),Te([o({type:String})],ze.prototype,"height",void 0),ze=Te([r("nr-icon")],ze);const Ee=e`
282
+ `}getIconRole(){return this.clickable?"button":this.alt?"img":"presentation"}getIconTabIndex(){return this.clickable&&!this.disabled?"0":"-1"}getAriaDisabled(){return this.disabled?"true":void 0}};Ee.useShadowDom=!0,Ee.styles=ke,Te([o({type:String})],Ee.prototype,"name",void 0),Te([o()],Ee.prototype,"type",void 0),Te([o({type:String,attribute:"alt"})],Ee.prototype,"alt",void 0),Te([o({type:String,reflect:!0})],Ee.prototype,"size",void 0),Te([o({type:String})],Ee.prototype,"color",void 0),Te([o({type:String})],Ee.prototype,"width",void 0),Te([o({type:String})],Ee.prototype,"height",void 0),Ee=Te([r("nr-icon")],Ee);const ze=e`
283
283
  /* ========================================
284
284
  * HOST ELEMENT
285
285
  * ======================================== */
@@ -783,7 +783,7 @@ var Te=function(e,t,i,n){for(var a,o=arguments.length,s=o<3?t:null===n?n=Object.
783
783
  75% { opacity: 1; transform: scale(1.03); }
784
784
  100% { opacity: 0.7; transform: scale(1); }
785
785
  }
786
- `,Oe={EMAIL:/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/,URL:/^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)$/,PHONE:/^[\+]?[1-9][\d]{0,15}$/,PASSWORD_STRONG:/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$/,ALPHANUMERIC:/^[a-zA-Z0-9]+$/,NUMERIC:/^\d+$/,ALPHA:/^[a-zA-Z]+$/,USERNAME:/^[a-zA-Z0-9_-]{3,16}$/,HEX_COLOR:/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,IPV4:/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,CREDIT_CARD:/^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|3[47][0-9]{13}|3[0-9]{13}|6(?:011|5[0-9]{2})[0-9]{12})$/},Ae=e=>({required:!0,message:e||"This field is required"}),Ie=e=>({type:"email",pattern:Oe.EMAIL,message:e||"Please enter a valid email address"}),Pe=e=>({type:"url",pattern:Oe.URL,message:e||"Please enter a valid URL"}),Ne=(e,t)=>({maxLength:e,message:t||`Maximum length is ${e} characters`}),Re=(e,t)=>({type:"number",min:e,message:t||`Minimum value is ${e}`}),De=(e,t)=>({type:"number",max:e,message:t||`Maximum value is ${e}`});
786
+ `,Ae={EMAIL:/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/,URL:/^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)$/,PHONE:/^[\+]?[1-9][\d]{0,15}$/,PASSWORD_STRONG:/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$/,ALPHANUMERIC:/^[a-zA-Z0-9]+$/,NUMERIC:/^\d+$/,ALPHA:/^[a-zA-Z]+$/,USERNAME:/^[a-zA-Z0-9_-]{3,16}$/,HEX_COLOR:/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,IPV4:/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,CREDIT_CARD:/^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|3[47][0-9]{13}|3[0-9]{13}|6(?:011|5[0-9]{2})[0-9]{12})$/},Oe=e=>({required:!0,message:e||"This field is required"}),Ie=e=>({type:"email",pattern:Ae.EMAIL,message:e||"Please enter a valid email address"}),Pe=e=>({type:"url",pattern:Ae.URL,message:e||"Please enter a valid URL"}),Ne=(e,t)=>({maxLength:e,message:t||`Maximum length is ${e} characters`}),Re=(e,t)=>({type:"number",min:e,message:t||`Minimum value is ${e}`}),De=(e,t)=>({type:"number",max:e,message:t||`Maximum value is ${e}`});
787
787
  /**
788
788
  * @license
789
789
  * Copyright 2023 Google Laabidi Aymen
@@ -903,7 +903,7 @@ class Ue{constructor(e){this._host=e,e.addController(this)}get host(){return thi
903
903
  * @license
904
904
  * Copyright 2023 Nuraly, Laabidi Aymen
905
905
  * SPDX-License-Identifier: MIT
906
- */var Ke=function(e,t,i,n){return new(i||(i=Promise))(function(a,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function r(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?a(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(s,r)}l((n=n.apply(e,t||[])).next())})};class Ge extends Ve{constructor(){super(...arguments),this.stateController=new We(this._host)}get validationHost(){return this._host}get isValid(){return this.stateController.isValid}get validationMessage(){return this.stateController.validationMessage}get validationState(){return this.stateController.validationState}get validationResult(){return this.stateController.validationResult}get isValidating(){return this.stateController.isValidating}hostConnected(){this.setupValidationRules()}hostUpdated(){}setupValidationRules(){const e=[],t=this.validationHost;"email"===t.type&&e.push(Ie()),"url"===t.type&&e.push(Pe()),t.required&&e.push(Ae(t.label?`${t.label} is required`:void 0)),t.maxLength&&e.push(Ne(t.maxLength)),"number"===t.type&&(void 0!==t.min&&e.push(Re(Number(t.min))),void 0!==t.max&&e.push(De(Number(t.max))));const i=t.rules||[],n=[...e.filter(e=>!i.some(t=>this.isSameRuleType(e,t))),...i];JSON.stringify(t.rules)!==JSON.stringify(n)&&(t.rules=n,this.requestUpdate())}validate(){try{this.stateController.setValidationState(qe.Pending),this.stateController.setValidating(!0),this.dispatchInputValidationEvent();if(this.hasAsyncValidators())return this.performAsyncValidation(this.validationHost.value),!0;const e=this.performDetailedValidation(this.validationHost.value);return this.stateController.setValidationResult(e),e.hasError?this.setValidationResult(!1,this.stateController.validationMessage,qe.Invalid):e.hasWarning&&this.validationHost.allowWarnings?this.setValidationResult(!0,this.stateController.validationMessage,qe.Warning):this.setValidationResult(!0,"",qe.Valid),this.stateController.setValidating(!1),this.updateHostValidationState(),e.isValid}catch(e){return this.handleError(e,"validate"),this.stateController.setValidating(!1),this.setValidationResult(!1,"Validation error occurred",qe.Invalid),this.updateHostValidationState(),!1}}validateOnChange(){this.stateController.shouldValidateOnChange()&&this.stateController.debounceValidation(()=>{this.validate()})}validateOnBlur(){this.stateController.shouldValidateOnBlur()&&(this.stateController.clearDebounceTimer(),this.validate())}addInputRule(e){const t=this.validationHost.rules||[];this.validationHost.rules=[...t,e],this.requestUpdate()}removeInputRule(e){const t=this.validationHost.rules||[];this.validationHost.rules=t.filter(t=>!e(t)),this.requestUpdate()}clearInputRules(){this.validationHost.rules=[],this.reset()}hasAsyncValidators(){return(this.validationHost.rules||[]).some(e=>e.asyncValidator||e.validator&&this.isValidatorAsync(e.validator))}isValidatorAsync(e){const t=e.toString();return t.includes("Promise")||t.includes("async")||t.includes("setTimeout")||t.includes("new Promise")}performAsyncValidation(e){return Ke(this,void 0,void 0,function*(){try{this.stateController.setValidating(!0),this.updateHostValidationState();const t=[],i=[],n=this.validationHost.rules||[];for(const a of n)if(!(a.asyncValidator||a.validator&&this.isValidatorAsync(a.validator))){const n=this.validateRule(a,e);n.isValid||(a.warningOnly&&this.validationHost.allowWarnings?i.push(n.message):t.push(n.message))}if(t.length>0)return this.stateController.setValidationResult({isValid:!1,errors:t,warnings:i,hasError:!0,hasWarning:i.length>0,errorMessage:t[0],warningMessage:i[0]}),this.setValidationResult(!1,this.stateController.validationMessage,qe.Invalid),this.stateController.setValidating(!1),void this.updateHostValidationState();for(const a of n)if(a.asyncValidator||a.validator&&this.isValidatorAsync(a.validator))try{yield this.validateAsyncRule(a,e)}catch(e){const n=e.message||a.message||"Validation failed";a.warningOnly&&this.validationHost.allowWarnings?i.push(n):t.push(n)}const a=t.length>0,o=i.length>0;this.stateController.setValidationResult({isValid:!a,errors:t,warnings:i,hasError:a,hasWarning:o,errorMessage:t[0],warningMessage:i[0]}),a?this.setValidationResult(!1,this.stateController.validationMessage,qe.Invalid):o&&this.validationHost.allowWarnings?this.setValidationResult(!0,this.stateController.validationMessage,qe.Warning):this.setValidationResult(!0,"",qe.Valid),this.stateController.setValidating(!1),this.updateHostValidationState()}catch(e){this.handleError(e,"performAsyncValidation"),this.stateController.setValidating(!1),this.setValidationResult(!1,"Async validation error occurred",qe.Invalid),this.updateHostValidationState()}})}validateAsyncRule(e,t){return Ke(this,void 0,void 0,function*(){if(e.asyncValidator)yield e.asyncValidator(e,t);else if(e.validator){const i=e.validator(e,t);i&&"object"==typeof i&&"then"in i&&(yield i)}})}reset(){this.stateController.setValidationResult({isValid:!0,errors:[],warnings:[],hasError:!1,hasWarning:!1}),this.stateController.setValidationState(qe.Pristine),this.stateController.setValidating(!1),this.updateHostValidationState(),this.dispatchInputValidationEvent()}getValidationStatus(){return{isValid:this.stateController.validationResult.isValid,isValidating:this.stateController.isValidating,errors:this.stateController.validationResult.errors,warnings:this.stateController.validationResult.warnings,validationResult:this.stateController.validationResult}}setValidationStatus(e){this.stateController.setValidationResult(e),e.hasError?this.setValidationResult(!1,this.stateController.validationMessage,qe.Invalid):e.hasWarning?this.setValidationResult(!0,this.stateController.validationMessage,qe.Warning):e.isValid?this.setValidationResult(!0,"",qe.Valid):this.setValidationResult(!0,"",qe.Pristine),this.updateHostValidationState()}performDetailedValidation(e){const t=[],i=[],n=this.validationHost.rules||[];for(const a of n){const n=this.validateRule(a,e);n.isValid||(a.warningOnly&&this.validationHost.allowWarnings?i.push(n.message):t.push(n.message))}const a=t.length>0;return{isValid:!a,errors:t,warnings:i,hasError:a,hasWarning:i.length>0,errorMessage:t[0],warningMessage:i[0]}}validateRule(e,t){if(e.asyncValidator||e.validator&&this.isValidatorAsync(e.validator))return{isValid:!0,message:""};const i=e.transform?e.transform(t):t;if(e.required&&this.isValueEmpty(t))return{isValid:!1,message:e.message||`${this.validationHost.label||"This field"} is required`};if(this.isValueEmpty(t)&&!e.required)return{isValid:!0,message:""};if(e.type){const t=this.validateType(e.type,i);if(!t.isValid)return{isValid:!1,message:e.message||t.message}}if(e.pattern&&!e.pattern.test(i))return{isValid:!1,message:e.message||"Invalid format"};if(void 0!==e.minLength&&i.length<e.minLength)return{isValid:!1,message:e.message||`Minimum length is ${e.minLength} characters`};if(void 0!==e.maxLength&&i.length>e.maxLength)return{isValid:!1,message:e.message||`Maximum length is ${e.maxLength} characters`};if("number"===e.type||"number"===this.validationHost.type){const t=Number(i);if(void 0!==e.min&&t<e.min)return{isValid:!1,message:e.message||`Minimum value is ${e.min}`};if(void 0!==e.max&&t>e.max)return{isValid:!1,message:e.message||`Maximum value is ${e.max}`}}if(e.enum&&!e.enum.includes(i))return{isValid:!1,message:e.message||`Value must be one of: ${e.enum.join(", ")}`};if(e.validator)try{const t=e.validator(e,i);return t&&"object"==typeof t&&"isValid"in t?{isValid:t.isValid,message:t.isValid?"":t.message||e.message||"Validation failed"}:{isValid:!0,message:""}}catch(t){return{isValid:!1,message:e.message||t.message||"Validation failed"}}return{isValid:!0,message:""}}validateType(e,t){switch(e){case"email":return{isValid:Oe.EMAIL.test(t),message:"Please enter a valid email address"};case"url":return{isValid:Oe.URL.test(t),message:"Please enter a valid URL"};case"number":case"integer":return{isValid:!Number.isNaN(Number(t))&&("number"===e||Number.isInteger(Number(t))),message:`Please enter a valid ${e}`};case"float":return{isValid:!Number.isNaN(Number.parseFloat(t)),message:"Please enter a valid number"};default:return{isValid:!0,message:""}}}isValueEmpty(e){return null==e||""===e}isSameRuleType(e,t){return e.type===t.type&&e.required===t.required&&!!e.pattern==!!t.pattern}setValidationResult(e,t,i){const n=this.stateController.isValid!==e||this.stateController.validationMessage!==t||this.stateController.validationState!==i;this.stateController.setValidationState(i),this.stateController.setValidationResult({isValid:e,errors:e?[]:[t],warnings:[],hasError:!e,hasWarning:!1,errorMessage:e?"":t,warningMessage:""}),this._isValid=e,this._validationMessage=t,this._validationState=i,n&&this.dispatchInputValidationEvent()}updateHostValidationState(){this.dispatchInputValidationEvent()}dispatchInputValidationEvent(){const e={isValid:this.stateController.isValid,validationMessage:this.stateController.validationMessage,validationState:this.stateController.validationState,errors:this.stateController.validationResult.errors,warnings:this.stateController.validationResult.warnings,validationResult:this.stateController.validationResult};this.dispatchEvent(new CustomEvent("nr-validation",{detail:e,bubbles:!0,composed:!0}))}getValidationClasses(){const e=this.host,t=this.host;return{valid:this.stateController.validationResult.isValid&&!this.stateController.validationResult.hasWarning,invalid:this.stateController.validationResult.hasError,warning:this.stateController.validationResult.hasWarning&&!this.stateController.validationResult.hasError,validating:this.stateController.isValidating,"has-feedback":t.hasFeedback||!1,touched:e.isTouched||!1,dirty:e.isDirty||!1,required:this.host.required||!1}}hasValidationFeedback(){const e=this.host;return!!e.hasFeedback&&(this.stateController.isValidating||this.stateController.validationResult.hasError||this.stateController.validationResult.hasWarning||this.stateController.validationResult.isValid&&e.value&&""!==e.value.trim()&&this.stateController.validationState!==qe.Pristine)}renderValidationIcon(){const e=this.host;if(!e.hasFeedback)return"";let t="",n="";return this.stateController.isValidating?(t="hourglass-half",n="validation-loading"):this.stateController.validationResult.hasError?(t="exclamation-circle",n="validation-error"):this.stateController.validationResult.hasWarning?(t="exclamation-triangle",n="validation-warning"):this.stateController.validationResult.isValid&&e.value&&""!==e.value.trim()&&this.stateController.validationState!==qe.Pristine&&(t="check-circle",n="validation-success"),t?i`
906
+ */var Ke=function(e,t,i,n){return new(i||(i=Promise))(function(a,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function r(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?a(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(s,r)}l((n=n.apply(e,t||[])).next())})};class Ge extends Ve{constructor(){super(...arguments),this.stateController=new We(this._host)}get validationHost(){return this._host}get isValid(){return this.stateController.isValid}get validationMessage(){return this.stateController.validationMessage}get validationState(){return this.stateController.validationState}get validationResult(){return this.stateController.validationResult}get isValidating(){return this.stateController.isValidating}hostConnected(){this.setupValidationRules()}hostUpdated(){}setupValidationRules(){const e=[],t=this.validationHost;"email"===t.type&&e.push(Ie()),"url"===t.type&&e.push(Pe()),t.required&&e.push(Oe(t.label?`${t.label} is required`:void 0)),t.maxLength&&e.push(Ne(t.maxLength)),"number"===t.type&&(void 0!==t.min&&e.push(Re(Number(t.min))),void 0!==t.max&&e.push(De(Number(t.max))));const i=t.rules||[],n=[...e.filter(e=>!i.some(t=>this.isSameRuleType(e,t))),...i];JSON.stringify(t.rules)!==JSON.stringify(n)&&(t.rules=n,this.requestUpdate())}validate(){try{this.stateController.setValidationState(qe.Pending),this.stateController.setValidating(!0),this.dispatchInputValidationEvent();if(this.hasAsyncValidators())return this.performAsyncValidation(this.validationHost.value),!0;const e=this.performDetailedValidation(this.validationHost.value);return this.stateController.setValidationResult(e),e.hasError?this.setValidationResult(!1,this.stateController.validationMessage,qe.Invalid):e.hasWarning&&this.validationHost.allowWarnings?this.setValidationResult(!0,this.stateController.validationMessage,qe.Warning):this.setValidationResult(!0,"",qe.Valid),this.stateController.setValidating(!1),this.updateHostValidationState(),e.isValid}catch(e){return this.handleError(e,"validate"),this.stateController.setValidating(!1),this.setValidationResult(!1,"Validation error occurred",qe.Invalid),this.updateHostValidationState(),!1}}validateOnChange(){this.stateController.shouldValidateOnChange()&&this.stateController.debounceValidation(()=>{this.validate()})}validateOnBlur(){this.stateController.shouldValidateOnBlur()&&(this.stateController.clearDebounceTimer(),this.validate())}addInputRule(e){const t=this.validationHost.rules||[];this.validationHost.rules=[...t,e],this.requestUpdate()}removeInputRule(e){const t=this.validationHost.rules||[];this.validationHost.rules=t.filter(t=>!e(t)),this.requestUpdate()}clearInputRules(){this.validationHost.rules=[],this.reset()}hasAsyncValidators(){return(this.validationHost.rules||[]).some(e=>e.asyncValidator||e.validator&&this.isValidatorAsync(e.validator))}isValidatorAsync(e){const t=e.toString();return t.includes("Promise")||t.includes("async")||t.includes("setTimeout")||t.includes("new Promise")}performAsyncValidation(e){return Ke(this,void 0,void 0,function*(){try{this.stateController.setValidating(!0),this.updateHostValidationState();const t=[],i=[],n=this.validationHost.rules||[];for(const a of n)if(!(a.asyncValidator||a.validator&&this.isValidatorAsync(a.validator))){const n=this.validateRule(a,e);n.isValid||(a.warningOnly&&this.validationHost.allowWarnings?i.push(n.message):t.push(n.message))}if(t.length>0)return this.stateController.setValidationResult({isValid:!1,errors:t,warnings:i,hasError:!0,hasWarning:i.length>0,errorMessage:t[0],warningMessage:i[0]}),this.setValidationResult(!1,this.stateController.validationMessage,qe.Invalid),this.stateController.setValidating(!1),void this.updateHostValidationState();for(const a of n)if(a.asyncValidator||a.validator&&this.isValidatorAsync(a.validator))try{yield this.validateAsyncRule(a,e)}catch(e){const n=e.message||a.message||"Validation failed";a.warningOnly&&this.validationHost.allowWarnings?i.push(n):t.push(n)}const a=t.length>0,o=i.length>0;this.stateController.setValidationResult({isValid:!a,errors:t,warnings:i,hasError:a,hasWarning:o,errorMessage:t[0],warningMessage:i[0]}),a?this.setValidationResult(!1,this.stateController.validationMessage,qe.Invalid):o&&this.validationHost.allowWarnings?this.setValidationResult(!0,this.stateController.validationMessage,qe.Warning):this.setValidationResult(!0,"",qe.Valid),this.stateController.setValidating(!1),this.updateHostValidationState()}catch(e){this.handleError(e,"performAsyncValidation"),this.stateController.setValidating(!1),this.setValidationResult(!1,"Async validation error occurred",qe.Invalid),this.updateHostValidationState()}})}validateAsyncRule(e,t){return Ke(this,void 0,void 0,function*(){if(e.asyncValidator)yield e.asyncValidator(e,t);else if(e.validator){const i=e.validator(e,t);i&&"object"==typeof i&&"then"in i&&(yield i)}})}reset(){this.stateController.setValidationResult({isValid:!0,errors:[],warnings:[],hasError:!1,hasWarning:!1}),this.stateController.setValidationState(qe.Pristine),this.stateController.setValidating(!1),this.updateHostValidationState(),this.dispatchInputValidationEvent()}getValidationStatus(){return{isValid:this.stateController.validationResult.isValid,isValidating:this.stateController.isValidating,errors:this.stateController.validationResult.errors,warnings:this.stateController.validationResult.warnings,validationResult:this.stateController.validationResult}}setValidationStatus(e){this.stateController.setValidationResult(e),e.hasError?this.setValidationResult(!1,this.stateController.validationMessage,qe.Invalid):e.hasWarning?this.setValidationResult(!0,this.stateController.validationMessage,qe.Warning):e.isValid?this.setValidationResult(!0,"",qe.Valid):this.setValidationResult(!0,"",qe.Pristine),this.updateHostValidationState()}performDetailedValidation(e){const t=[],i=[],n=this.validationHost.rules||[];for(const a of n){const n=this.validateRule(a,e);n.isValid||(a.warningOnly&&this.validationHost.allowWarnings?i.push(n.message):t.push(n.message))}const a=t.length>0;return{isValid:!a,errors:t,warnings:i,hasError:a,hasWarning:i.length>0,errorMessage:t[0],warningMessage:i[0]}}validateRule(e,t){if(e.asyncValidator||e.validator&&this.isValidatorAsync(e.validator))return{isValid:!0,message:""};const i=e.transform?e.transform(t):t;if(e.required&&this.isValueEmpty(t))return{isValid:!1,message:e.message||`${this.validationHost.label||"This field"} is required`};if(this.isValueEmpty(t)&&!e.required)return{isValid:!0,message:""};if(e.type){const t=this.validateType(e.type,i);if(!t.isValid)return{isValid:!1,message:e.message||t.message}}if(e.pattern&&!e.pattern.test(i))return{isValid:!1,message:e.message||"Invalid format"};if(void 0!==e.minLength&&i.length<e.minLength)return{isValid:!1,message:e.message||`Minimum length is ${e.minLength} characters`};if(void 0!==e.maxLength&&i.length>e.maxLength)return{isValid:!1,message:e.message||`Maximum length is ${e.maxLength} characters`};if("number"===e.type||"number"===this.validationHost.type){const t=Number(i);if(void 0!==e.min&&t<e.min)return{isValid:!1,message:e.message||`Minimum value is ${e.min}`};if(void 0!==e.max&&t>e.max)return{isValid:!1,message:e.message||`Maximum value is ${e.max}`}}if(e.enum&&!e.enum.includes(i))return{isValid:!1,message:e.message||`Value must be one of: ${e.enum.join(", ")}`};if(e.validator)try{const t=e.validator(e,i);return t&&"object"==typeof t&&"isValid"in t?{isValid:t.isValid,message:t.isValid?"":t.message||e.message||"Validation failed"}:{isValid:!0,message:""}}catch(t){return{isValid:!1,message:e.message||t.message||"Validation failed"}}return{isValid:!0,message:""}}validateType(e,t){switch(e){case"email":return{isValid:Ae.EMAIL.test(t),message:"Please enter a valid email address"};case"url":return{isValid:Ae.URL.test(t),message:"Please enter a valid URL"};case"number":case"integer":return{isValid:!Number.isNaN(Number(t))&&("number"===e||Number.isInteger(Number(t))),message:`Please enter a valid ${e}`};case"float":return{isValid:!Number.isNaN(Number.parseFloat(t)),message:"Please enter a valid number"};default:return{isValid:!0,message:""}}}isValueEmpty(e){return null==e||""===e}isSameRuleType(e,t){return e.type===t.type&&e.required===t.required&&!!e.pattern==!!t.pattern}setValidationResult(e,t,i){const n=this.stateController.isValid!==e||this.stateController.validationMessage!==t||this.stateController.validationState!==i;this.stateController.setValidationState(i),this.stateController.setValidationResult({isValid:e,errors:e?[]:[t],warnings:[],hasError:!e,hasWarning:!1,errorMessage:e?"":t,warningMessage:""}),this._isValid=e,this._validationMessage=t,this._validationState=i,n&&this.dispatchInputValidationEvent()}updateHostValidationState(){this.dispatchInputValidationEvent()}dispatchInputValidationEvent(){const e={isValid:this.stateController.isValid,validationMessage:this.stateController.validationMessage,validationState:this.stateController.validationState,errors:this.stateController.validationResult.errors,warnings:this.stateController.validationResult.warnings,validationResult:this.stateController.validationResult};this.dispatchEvent(new CustomEvent("nr-validation",{detail:e,bubbles:!0,composed:!0}))}getValidationClasses(){const e=this.host,t=this.host;return{valid:this.stateController.validationResult.isValid&&!this.stateController.validationResult.hasWarning,invalid:this.stateController.validationResult.hasError,warning:this.stateController.validationResult.hasWarning&&!this.stateController.validationResult.hasError,validating:this.stateController.isValidating,"has-feedback":t.hasFeedback||!1,touched:e.isTouched||!1,dirty:e.isDirty||!1,required:this.host.required||!1}}hasValidationFeedback(){const e=this.host;return!!e.hasFeedback&&(this.stateController.isValidating||this.stateController.validationResult.hasError||this.stateController.validationResult.hasWarning||this.stateController.validationResult.isValid&&e.value&&""!==e.value.trim()&&this.stateController.validationState!==qe.Pristine)}renderValidationIcon(){const e=this.host;if(!e.hasFeedback)return"";let t="",n="";return this.stateController.isValidating?(t="hourglass-half",n="validation-loading"):this.stateController.validationResult.hasError?(t="exclamation-circle",n="validation-error"):this.stateController.validationResult.hasWarning?(t="exclamation-triangle",n="validation-warning"):this.stateController.validationResult.isValid&&e.value&&""!==e.value.trim()&&this.stateController.validationState!==qe.Pristine&&(t="check-circle",n="validation-success"),t?i`
907
907
  <nr-icon
908
908
  name="${t}"
909
909
  class="validation-icon ${n}"
@@ -979,7 +979,7 @@ class Ue{constructor(e){this._host=e,e.addController(this)}get host(){return thi
979
979
  ${this.characterCountDisplay}
980
980
  </div>
981
981
  `:""}
982
- `}};Xe.styles=Ee,Xe.useShadowDom=!0,Qe([o({type:Boolean,reflect:!0})],Xe.prototype,"disabled",void 0),Qe([o({type:Boolean,reflect:!0})],Xe.prototype,"readonly",void 0),Qe([o({type:String,reflect:!0})],Xe.prototype,"state",void 0),Qe([o({type:String,reflect:!0})],Xe.prototype,"value",void 0),Qe([o({type:String})],Xe.prototype,"size",void 0),Qe([o({type:String,reflect:!0})],Xe.prototype,"variant",void 0),Qe([o({reflect:!0})],Xe.prototype,"type",void 0),Qe([o({type:String})],Xe.prototype,"step",void 0),Qe([o({type:String})],Xe.prototype,"min",void 0),Qe([o({type:String})],Xe.prototype,"max",void 0),Qe([o({type:String})],Xe.prototype,"placeholder",void 0),Qe([o({type:String})],Xe.prototype,"autocomplete",void 0),Qe([o({type:String})],Xe.prototype,"name",void 0),Qe([o({type:Boolean})],Xe.prototype,"required",void 0),Qe([o({type:Boolean,reflect:!0})],Xe.prototype,"withCopy",void 0),Qe([o({type:Boolean,reflect:!0})],Xe.prototype,"allowClear",void 0),Qe([o({type:Boolean,reflect:!0})],Xe.prototype,"showCount",void 0),Qe([o({type:Number})],Xe.prototype,"maxLength",void 0),Qe([o({type:Array})],Xe.prototype,"rules",void 0),Qe([o({type:Boolean,attribute:"validate-on-change"})],Xe.prototype,"validateOnChangeInput",void 0),Qe([o({type:Boolean,attribute:"validate-on-blur"})],Xe.prototype,"validateOnBlurInput",void 0),Qe([o({type:Boolean,attribute:"has-feedback"})],Xe.prototype,"hasFeedback",void 0),Qe([o({type:Boolean,attribute:"allow-warnings"})],Xe.prototype,"allowWarnings",void 0),Qe([o({type:String,attribute:"validation-trigger"})],Xe.prototype,"validationTrigger",void 0),Qe([o({type:Number,attribute:"validation-debounce"})],Xe.prototype,"validationDebounce",void 0),Qe([o({type:String})],Xe.prototype,"label",void 0),Qe([o({type:Number})],Xe.prototype,"debounce",void 0),Qe([s()],Xe.prototype,"validationMessage",void 0),Qe([s()],Xe.prototype,"inputType",void 0),Qe([s()],Xe.prototype,"hasAddonBefore",void 0),Qe([s()],Xe.prototype,"hasAddonAfter",void 0),Qe([s()],Xe.prototype,"focused",void 0),Xe=Qe([r("nr-input")],Xe);
982
+ `}};Xe.styles=ze,Xe.useShadowDom=!0,Qe([o({type:Boolean,reflect:!0})],Xe.prototype,"disabled",void 0),Qe([o({type:Boolean,reflect:!0})],Xe.prototype,"readonly",void 0),Qe([o({type:String,reflect:!0})],Xe.prototype,"state",void 0),Qe([o({type:String,reflect:!0})],Xe.prototype,"value",void 0),Qe([o({type:String})],Xe.prototype,"size",void 0),Qe([o({type:String,reflect:!0})],Xe.prototype,"variant",void 0),Qe([o({reflect:!0})],Xe.prototype,"type",void 0),Qe([o({type:String})],Xe.prototype,"step",void 0),Qe([o({type:String})],Xe.prototype,"min",void 0),Qe([o({type:String})],Xe.prototype,"max",void 0),Qe([o({type:String})],Xe.prototype,"placeholder",void 0),Qe([o({type:String})],Xe.prototype,"autocomplete",void 0),Qe([o({type:String})],Xe.prototype,"name",void 0),Qe([o({type:Boolean})],Xe.prototype,"required",void 0),Qe([o({type:Boolean,reflect:!0})],Xe.prototype,"withCopy",void 0),Qe([o({type:Boolean,reflect:!0})],Xe.prototype,"allowClear",void 0),Qe([o({type:Boolean,reflect:!0})],Xe.prototype,"showCount",void 0),Qe([o({type:Number})],Xe.prototype,"maxLength",void 0),Qe([o({type:Array})],Xe.prototype,"rules",void 0),Qe([o({type:Boolean,attribute:"validate-on-change"})],Xe.prototype,"validateOnChangeInput",void 0),Qe([o({type:Boolean,attribute:"validate-on-blur"})],Xe.prototype,"validateOnBlurInput",void 0),Qe([o({type:Boolean,attribute:"has-feedback"})],Xe.prototype,"hasFeedback",void 0),Qe([o({type:Boolean,attribute:"allow-warnings"})],Xe.prototype,"allowWarnings",void 0),Qe([o({type:String,attribute:"validation-trigger"})],Xe.prototype,"validationTrigger",void 0),Qe([o({type:Number,attribute:"validation-debounce"})],Xe.prototype,"validationDebounce",void 0),Qe([o({type:String})],Xe.prototype,"label",void 0),Qe([o({type:Number})],Xe.prototype,"debounce",void 0),Qe([s()],Xe.prototype,"validationMessage",void 0),Qe([s()],Xe.prototype,"inputType",void 0),Qe([s()],Xe.prototype,"hasAddonBefore",void 0),Qe([s()],Xe.prototype,"hasAddonAfter",void 0),Qe([s()],Xe.prototype,"focused",void 0),Xe=Qe([r("nr-input")],Xe);
983
983
  /**
984
984
  * @license
985
985
  * Copyright 2021 Google LLC
@@ -1022,7 +1022,7 @@ class rt{constructor(){this.settled=!1,this.promise=new Promise((e,t)=>{this._re
1022
1022
  * @license
1023
1023
  * Copyright 2021 Google LLC
1024
1024
  * SPDX-License-Identifier: BSD-3-Clause
1025
- */(t),a=e[n];if(a){if("string"==typeof a)return a;if("strTag"in a)return tt(a.strings,t.values,a.values);{let e=dt.get(a);return void 0===e&&(e=a.values,dt.set(a,e)),{...a,values:e.map(e=>t.values[e])}}}}return it(t)}function ut(e){window.dispatchEvent(new CustomEvent(et,{detail:e}))}let bt,ft,gt,vt,mt,xt="",yt=new rt;yt.resolve();let wt=0;const $t=e=>(function(e){if(at)throw new Error("lit-localize can only be configured once");nt=e,at=!0}((e,t)=>ht(mt,e,t)),xt=ft=e.sourceLocale,gt=new Set(e.targetLocales),gt.add(e.sourceLocale),vt=e.loadLocale,{getLocale:kt,setLocale:St}),kt=()=>xt,St=e=>{if(e===(bt??xt))return yt.promise;if(!gt||!vt)throw new Error("Internal error");if(!gt.has(e))throw new Error("Invalid locale code");wt++;const t=wt;bt=e,yt.settled&&(yt=new rt),ut({status:"loading",loadingLocale:e});return(e===ft?Promise.resolve({templates:void 0}):vt(e)).then(i=>{wt===t&&(xt=e,bt=void 0,mt=i.templates,ut({status:"ready",readyLocale:e}),yt.resolve())},i=>{wt===t&&(ut({status:"error",errorLocale:e,errorMessage:i.toString()}),yt.reject(i))}),yt.promise};var Ct,Tt,Mt,zt,Et,Ot,At,It=e`
1025
+ */(t),a=e[n];if(a){if("string"==typeof a)return a;if("strTag"in a)return tt(a.strings,t.values,a.values);{let e=dt.get(a);return void 0===e&&(e=a.values,dt.set(a,e)),{...a,values:e.map(e=>t.values[e])}}}}return it(t)}function ut(e){window.dispatchEvent(new CustomEvent(et,{detail:e}))}let bt,ft,gt,vt,mt,xt="",yt=new rt;yt.resolve();let wt=0;const $t=e=>(function(e){if(at)throw new Error("lit-localize can only be configured once");nt=e,at=!0}((e,t)=>ht(mt,e,t)),xt=ft=e.sourceLocale,gt=new Set(e.targetLocales),gt.add(e.sourceLocale),vt=e.loadLocale,{getLocale:kt,setLocale:St}),kt=()=>xt,St=e=>{if(e===(bt??xt))return yt.promise;if(!gt||!vt)throw new Error("Internal error");if(!gt.has(e))throw new Error("Invalid locale code");wt++;const t=wt;bt=e,yt.settled&&(yt=new rt),ut({status:"loading",loadingLocale:e});return(e===ft?Promise.resolve({templates:void 0}):vt(e)).then(i=>{wt===t&&(xt=e,bt=void 0,mt=i.templates,ut({status:"ready",readyLocale:e}),yt.resolve())},i=>{wt===t&&(ut({status:"error",errorLocale:e,errorMessage:i.toString()}),yt.reject(i))}),yt.promise};var Ct,Tt,Mt,Et,zt,At,Ot,It=e`
1026
1026
  :host {
1027
1027
  display: block;
1028
1028
  width: 100%;
@@ -2803,13 +2803,13 @@ class rt{constructor(){this.settled=!1,this.promise=new Promise((e,t)=>{this._re
2803
2803
  * @license
2804
2804
  * Copyright 2023 Nuraly, Laabidi Aymen
2805
2805
  * SPDX-License-Identifier: MIT
2806
- */;!function(e){e.User="user",e.Bot="bot",e.System="system"}(Ct||(Ct={})),function(e){e.Dots="dots",e.Spinner="spinner",e.Wave="wave",e.Typing="typing"}(Tt||(Tt={})),function(e){e.Small="small",e.Medium="medium",e.Large="large",e.Full="full"}(Mt||(Mt={})),function(e){e.Default="default",e.Minimal="minimal",e.Rounded="rounded",e.ChatGPT="chatgpt"}(zt||(zt={})),function(e){e.Default="default",e.Error="error",e.Success="success",e.Loading="loading",e.Pending="pending"}(Et||(Et={})),function(e){e.Image="image",e.Document="document",e.Audio="audio",e.Video="video",e.Archive="archive",e.Code="code",e.Unknown="unknown"}(Ot||(Ot={})),function(e){e.Upload="upload",e.Clear="clear",e.Export="export",e.Settings="settings",e.Microphone="microphone",e.Camera="camera",e.Attach="attach"}(At||(At={}));
2806
+ */;!function(e){e.User="user",e.Bot="bot",e.System="system"}(Ct||(Ct={})),function(e){e.Dots="dots",e.Spinner="spinner",e.Wave="wave",e.Typing="typing"}(Tt||(Tt={})),function(e){e.Small="small",e.Medium="medium",e.Large="large",e.Full="full"}(Mt||(Mt={})),function(e){e.Default="default",e.Minimal="minimal",e.Rounded="rounded",e.ChatGPT="chatgpt"}(Et||(Et={})),function(e){e.Default="default",e.Error="error",e.Success="success",e.Loading="loading",e.Pending="pending"}(zt||(zt={})),function(e){e.Image="image",e.Document="document",e.Audio="audio",e.Video="video",e.Archive="archive",e.Code="code",e.Unknown="unknown"}(At||(At={})),function(e){e.Upload="upload",e.Clear="clear",e.Export="export",e.Settings="settings",e.Microphone="microphone",e.Camera="camera",e.Attach="attach"}(Ot||(Ot={}));
2807
2807
  /**
2808
2808
  * @license
2809
2809
  * Copyright 2023 Nuraly, Laabidi Aymen
2810
2810
  * SPDX-License-Identifier: MIT
2811
2811
  */
2812
- function Pt(e){if(!e)return"";const t=e instanceof Date?e:new Date(e);if(Number.isNaN(t.getTime()))return"";const i=new Date,n={hour:"numeric",minute:"2-digit",hour12:!0};if(t.toDateString()===i.toDateString())return t.toLocaleTimeString(void 0,n);const a=Object.assign({month:"short",day:"numeric"},n);return t.toLocaleDateString(void 0,a)}Ot.Image,Ot.Audio,Ot.Video,Ot.Document,Ot.Document,Ot.Document,Ot.Document,Ot.Archive,Ot.Archive,Ot.Code,Ot.Code,Ot.Code;const Nt={javascript:"JavaScript",typescript:"TypeScript",python:"Python",java:"Java",go:"Go",rust:"Rust",c:"C",cpp:"C++",csharp:"C#",ruby:"Ruby",php:"PHP",swift:"Swift",kotlin:"Kotlin",html:"HTML",css:"CSS",scss:"SCSS",sql:"SQL",graphql:"GraphQL",json:"JSON",yaml:"YAML",xml:"XML",toml:"TOML",markdown:"Markdown",md:"Markdown",bash:"Bash",shell:"Shell",sh:"Shell",zsh:"Zsh",dockerfile:"Dockerfile",makefile:"Makefile",text:"Text"};function Rt(e,t){var a,o,s,r,l,c,d,u;const b=null===(a=e.text)||void 0===a?void 0:a.includes("[ERROR_START]"),f={error:!!e.error||b,introduction:!!e.introduction,[e.sender]:!0};return i`
2812
+ function Pt(e){if(!e)return"";const t=e instanceof Date?e:new Date(e);if(Number.isNaN(t.getTime()))return"";const i=new Date,n={hour:"numeric",minute:"2-digit",hour12:!0};if(t.toDateString()===i.toDateString())return t.toLocaleTimeString(void 0,n);const a=Object.assign({month:"short",day:"numeric"},n);return t.toLocaleDateString(void 0,a)}At.Image,At.Audio,At.Video,At.Document,At.Document,At.Document,At.Document,At.Archive,At.Archive,At.Code,At.Code,At.Code;const Nt={javascript:"JavaScript",typescript:"TypeScript",python:"Python",java:"Java",go:"Go",rust:"Rust",c:"C",cpp:"C++",csharp:"C#",ruby:"Ruby",php:"PHP",swift:"Swift",kotlin:"Kotlin",html:"HTML",css:"CSS",scss:"SCSS",sql:"SQL",graphql:"GraphQL",json:"JSON",yaml:"YAML",xml:"XML",toml:"TOML",markdown:"Markdown",md:"Markdown",bash:"Bash",shell:"Shell",sh:"Shell",zsh:"Zsh",dockerfile:"Dockerfile",makefile:"Makefile",text:"Text"};function Rt(e,t){var a,o,s,r,l,c,d,u;const b=null===(a=e.text)||void 0===a?void 0:a.includes("[ERROR_START]"),f={error:!!e.error||b,introduction:!!e.introduction,[e.sender]:!0};return i`
2813
2813
  <div
2814
2814
  class="message ${p(f)}"
2815
2815
  part="message"
@@ -3553,12 +3553,12 @@ function(e){if(0===e)return"0 Bytes";const t=Math.floor(Math.log(e)/Math.log(102
3553
3553
  * @license
3554
3554
  * Copyright 2024 Nuraly, Laabidi Aymen
3555
3555
  * SPDX-License-Identifier: MIT
3556
- */var Wt=function(e,t,i,n){return new(i||(i=Promise))(function(a,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function r(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?a(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(s,r)}l((n=n.apply(e,t||[])).next())})};const Kt={active:!1,duration:"00:00",bars:[]};class Gt{constructor(e){this.state=Object.assign({},Kt),this._mediaRecorder=null,this._audioChunks=[],this._waveformSamples=[],this._analyser=null,this._timer=null,this._animFrame=0,this._startTime=0,this._stopResolve=null,this.host=e,e.addController(this)}hostConnected(){}hostDisconnected(){this.cancel()}start(){return Wt(this,void 0,void 0,function*(){try{const e=yield navigator.mediaDevices.getUserMedia({audio:!0});this._audioChunks=[],this._waveformSamples=[];const t=["audio/webm;codecs=opus","audio/webm","audio/mp4","audio/aac",""].find(e=>!e||MediaRecorder.isTypeSupported(e))||"";this._mediaRecorder=new MediaRecorder(e,t?{mimeType:t}:void 0);const i=new AudioContext;"suspended"===i.state&&(yield i.resume());const n=i.createMediaStreamSource(e);this._analyser=i.createAnalyser(),this._analyser.fftSize=256,this._analyser.smoothingTimeConstant=.3,n.connect(this._analyser),this._mediaRecorder.ondataavailable=e=>{e.data.size>0&&this._audioChunks.push(e.data)},this._mediaRecorder.onstop=()=>{var t;e.getTracks().forEach(e=>e.stop()),i.close().catch(()=>{}),this._timer&&clearInterval(this._timer),cancelAnimationFrame(this._animFrame),this._analyser=null,null===(t=this._stopResolve)||void 0===t||t.call(this,[...this._audioChunks]),this._stopResolve=null},this._mediaRecorder.start(100),this._startTime=Date.now(),this.state={active:!0,duration:"00:00",bars:[]},this.host.requestUpdate(),this._timer=setInterval(()=>{const e=Math.floor((Date.now()-this._startTime)/1e3),t=Math.floor(e/60).toString().padStart(2,"0"),i=(e%60).toString().padStart(2,"0");this.state=Object.assign(Object.assign({},this.state),{duration:`${t}:${i}`}),this.host.requestUpdate()},500);let a=0;const o=()=>{if(!this._analyser||!this.state.active)return;const e=performance.now();if(e-a>80){a=e;const t=this._analyser.frequencyBinCount,i=new Uint8Array(t);this._analyser.getByteFrequencyData(i);let n=i.reduce((e,t)=>e+t,0)/t;if(n<1){this._analyser.getByteTimeDomainData(i);let e=0;for(let n=0;n<t;n++){const t=Math.abs(i[n]-128);t>e&&(e=t)}n=e}const o=Math.min(1,n/128);this._waveformSamples.push(o);const s=this._waveformSamples.slice(-40).map(e=>Math.max(.08,e));this.state=Object.assign(Object.assign({},this.state),{bars:s}),this.host.requestUpdate()}this._animFrame=requestAnimationFrame(o)};this._animFrame=requestAnimationFrame(o)}catch(e){console.error("[ChatbotAudio] Mic access denied")}})}cancel(){var e;"recording"===(null===(e=this._mediaRecorder)||void 0===e?void 0:e.state)&&(this._stopResolve=null,this._mediaRecorder.stop()),this._audioChunks=[],this._waveformSamples=[],this._timer&&clearInterval(this._timer),cancelAnimationFrame(this._animFrame),this._analyser=null,this.state=Object.assign({},Kt),this.host.requestUpdate()}stop(){return Wt(this,void 0,void 0,function*(){var e;if(!this._mediaRecorder||"recording"!==this._mediaRecorder.state)return null;const t=this.state.duration,i=yield new Promise(e=>{this._stopResolve=e,this._mediaRecorder.stop()});yield new Promise(e=>setTimeout(e,200)),this.state=Object.assign({},Kt),this.host.requestUpdate();const n=(null===(e=this._mediaRecorder)||void 0===e?void 0:e.mimeType)||"audio/webm",a=new Blob(i,{type:n});this._audioChunks=[],this._waveformSamples=[];try{const{compressToOpus:e}=yield Promise.resolve().then(function(){return Rr}),{blob:i,mimeType:o}=yield e(a,n);return{blob:i,mimeType:o,duration:t}}catch(e){return{blob:a,mimeType:n,duration:t}}})}}
3556
+ */var Wt=function(e,t,i,n){return new(i||(i=Promise))(function(a,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function r(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?a(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(s,r)}l((n=n.apply(e,t||[])).next())})};const Kt={active:!1,duration:"00:00",bars:[]};class Gt{constructor(e){this.state=Object.assign({},Kt),this._mediaRecorder=null,this._audioChunks=[],this._waveformSamples=[],this._analyser=null,this._timer=null,this._animFrame=0,this._startTime=0,this._stopResolve=null,this.host=e,e.addController(this)}hostConnected(){}hostDisconnected(){this.cancel()}start(){return Wt(this,void 0,void 0,function*(){try{const e=yield navigator.mediaDevices.getUserMedia({audio:!0});this._audioChunks=[],this._waveformSamples=[];const t=["audio/webm;codecs=opus","audio/webm","audio/mp4","audio/aac",""].find(e=>!e||MediaRecorder.isTypeSupported(e))||"";this._mediaRecorder=new MediaRecorder(e,t?{mimeType:t}:void 0);const i=new AudioContext;"suspended"===i.state&&(yield i.resume());const n=i.createMediaStreamSource(e);this._analyser=i.createAnalyser(),this._analyser.fftSize=256,this._analyser.smoothingTimeConstant=.3,n.connect(this._analyser),this._mediaRecorder.ondataavailable=e=>{e.data.size>0&&this._audioChunks.push(e.data)},this._mediaRecorder.onstop=()=>{var t;e.getTracks().forEach(e=>e.stop()),i.close().catch(()=>{}),this._timer&&clearInterval(this._timer),cancelAnimationFrame(this._animFrame),this._analyser=null,null===(t=this._stopResolve)||void 0===t||t.call(this,[...this._audioChunks]),this._stopResolve=null},this._mediaRecorder.start(100),this._startTime=Date.now(),this.state={active:!0,duration:"00:00",bars:[]},this.host.requestUpdate(),this._timer=setInterval(()=>{const e=Math.floor((Date.now()-this._startTime)/1e3),t=Math.floor(e/60).toString().padStart(2,"0"),i=(e%60).toString().padStart(2,"0");this.state=Object.assign(Object.assign({},this.state),{duration:`${t}:${i}`}),this.host.requestUpdate()},500);let a=0;const o=()=>{if(!this._analyser||!this.state.active)return;const e=performance.now();if(e-a>80){a=e;const t=this._analyser.frequencyBinCount,i=new Uint8Array(t);this._analyser.getByteFrequencyData(i);let n=i.reduce((e,t)=>e+t,0)/t;if(n<1){this._analyser.getByteTimeDomainData(i);let e=0;for(let n=0;n<t;n++){const t=Math.abs(i[n]-128);t>e&&(e=t)}n=e}const o=Math.min(1,n/128);this._waveformSamples.push(o);const s=this._waveformSamples.slice(-40).map(e=>Math.max(.08,e));this.state=Object.assign(Object.assign({},this.state),{bars:s}),this.host.requestUpdate()}this._animFrame=requestAnimationFrame(o)};this._animFrame=requestAnimationFrame(o)}catch(e){console.error("[ChatbotAudio] Mic access denied")}})}cancel(){var e;"recording"===(null===(e=this._mediaRecorder)||void 0===e?void 0:e.state)&&(this._stopResolve=null,this._mediaRecorder.stop()),this._audioChunks=[],this._waveformSamples=[],this._timer&&clearInterval(this._timer),cancelAnimationFrame(this._animFrame),this._analyser=null,this.state=Object.assign({},Kt),this.host.requestUpdate()}stop(){return Wt(this,void 0,void 0,function*(){var e;if(!this._mediaRecorder||"recording"!==this._mediaRecorder.state)return null;const t=this.state.duration,i=yield new Promise(e=>{this._stopResolve=e,this._mediaRecorder.stop()});yield new Promise(e=>setTimeout(e,200)),this.state=Object.assign({},Kt),this.host.requestUpdate();const n=(null===(e=this._mediaRecorder)||void 0===e?void 0:e.mimeType)||"audio/webm",a=new Blob(i,{type:n});this._audioChunks=[],this._waveformSamples=[];try{const{compressToOpus:e}=yield Promise.resolve().then(function(){return Vr}),{blob:i,mimeType:o}=yield e(a,n);return{blob:i,mimeType:o,duration:t}}catch(e){return{blob:a,mimeType:n,duration:t}}})}}
3557
3557
  /**
3558
3558
  * @license
3559
3559
  * Copyright 2023 Nuraly, Laabidi Aymen
3560
3560
  * SPDX-License-Identifier: MIT
3561
- */var Jt=function(e,t,i,n){for(var a,o=arguments.length,s=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n,r=e.length-1;r>=0;r--)(a=e[r])&&(s=(o<3?a(s):o>3?a(t,i,s):a(t,i))||s);return o>3&&s&&Object.defineProperty(t,i,s),s},Yt=function(e,t,i,n){return new(i||(i=Promise))(function(a,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function r(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?a(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(s,r)}l((n=n.apply(e,t||[])).next())})};let Qt=class extends(we(t)){constructor(){super(...arguments),this.requiredComponents=["nr-input","nr-button","nr-icon","nr-dropdown","nr-select","nr-modal","nr-popconfirm"],this.messages=[],this.currentInput="",this.isBotTyping=!1,this.isQueryRunning=!1,this.suggestions=[],this.chatStarted=!1,this.isRTL=!1,this.size=Mt.Medium,this.variant=zt.Default,this.loadingIndicator=Tt.Dots,this.loadingText=nt("Agent is working..."),this.disabled=!1,this.placeholder=nt("Type your message..."),this.showSendButton=!0,this.autoScroll=!0,this.showThreads=!1,this.enableThreadCreation=!1,this.threads=[],this.mode="chat",this.boxed=!1,this.enableUrlSync=!1,this.showMessages=!0,this.enableFileUpload=!1,this.uploadedFiles=[],this.actionButtons=[],this.enableModuleSelection=!1,this.modules=[],this.selectedModules=[],this.moduleSelectionLabel=nt("Select Modules"),this.enableArtifacts=!1,this.showAudioButton=!1,this.focused=!1,this.isArtifactPanelOpen=!1,this.selectedArtifact=null,this.isThreadSidebarOpen=!0,this.isUrlModalOpen=!1,this.urlInput="",this.urlModalError="",this.isUrlLoading=!1,this.selectedUrlFileName="",this.isFilePreviewModalOpen=!1,this.previewFile=null,this.controllerUnsubscribes=[],this._audio=new Gt(this),this._audioMode="message",this._artifactResizeBound=!1,this.toggleThreadSidebar=()=>{this.isThreadSidebarOpen=!this.isThreadSidebarOpen}}get moduleSelectOptions(){return this.modules.map(e=>({value:e.id,label:e.name,icon:e.icon,disabled:!1===e.enabled,description:e.description}))}connectedCallback(){super.connectedCallback(),this.controller&&this.setupControllerIntegration(),this.setupUrlSync()}firstUpdated(){var e,t,i,n;null===(e=this.shadowRoot)||void 0===e||e.addEventListener("click",e=>{var t,i;const n=null===(i=(t=e.target).closest)||void 0===i?void 0:i.call(t,"[data-artifact-id]");if(n){const e=n.dataset.artifactId;e&&this.handleArtifactClick(e)}}),null===(t=this.shadowRoot)||void 0===t||t.addEventListener("nr-thread-edit",e=>{const t=e.detail;(null==t?void 0:t.threadId)&&(this._editingThreadId=t.threadId,this.requestUpdate(),this.updateComplete.then(()=>{var e;const t=null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector(".thread-item__rename-input");t&&(t.focus(),t.select())}))}),null===(i=this.shadowRoot)||void 0===i||i.addEventListener("click",e=>{var t,i;const n=null===(i=(t=e.target).closest)||void 0===i?void 0:i.call(t,"[data-selection-value]");if(n){const e=n.dataset.selectionValue;e&&this.controller&&this.controller.sendMessage(e)}}),null===(n=this.shadowRoot)||void 0===n||n.addEventListener("keydown",e=>{var t,i,n,a;const o=e;if("Enter"!==o.key&&" "!==o.key)return;const s=null===(i=(t=o.target).closest)||void 0===i?void 0:i.call(t,"[data-artifact-id]");if(s){o.preventDefault();const e=s.dataset.artifactId;return void(e&&this.handleArtifactClick(e))}const r=null===(a=(n=o.target).closest)||void 0===a?void 0:a.call(n,"[data-selection-value]");if(r){o.preventDefault();const e=r.dataset.selectionValue;e&&this.controller&&this.controller.sendMessage(e)}})}disconnectedCallback(){var e;super.disconnectedCallback(),this.controller&&this.cleanupControllerIntegration(),this.teardownUrlSync(),null===(e=this._artifactResizeCleanup)||void 0===e||e.call(this),this._artifactResizeBound=!1}updated(e){if(super.updated(e),e.has("controller")&&(this.cleanupControllerIntegration(),this.controller)){this.setupControllerIntegration();try{const e=this.controller.getState();this.handleControllerStateChange(e)}catch(e){}this.enableUrlSync&&this.handleHashChange()}if(e.has("enableUrlSync")&&(this.enableUrlSync?this.setupUrlSync():this.teardownUrlSync()),this.controller&&!e.has("controller")){if(e.has("messages")||e.has("suggestions")||e.has("threads"))try{const e=this.controller.getState();this.handleControllerStateChange(e)}catch(e){}}e.has("messages")&&this.autoScroll&&this.messages.length>0&&this.scrollToLatestMessage(),this.updateArtifactPanelResize()}scrollToLatestMessage(){requestAnimationFrame(()=>{var e;const t=null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector(".messages");t&&(t.scrollTop=t.scrollHeight)})}setupControllerIntegration(){this.controller&&this.controllerUnsubscribes.push(this.controller.on("state:changed",this.handleControllerStateChange.bind(this)),this.controller.on("message:sent",this.handleControllerMessageSent.bind(this)),this.controller.on("message:received",this.handleControllerMessageReceived.bind(this)),this.controller.on("error",this.handleControllerError.bind(this)))}cleanupControllerIntegration(){if(this.controllerUnsubscribes.length)try{this.controllerUnsubscribes.forEach(e=>{try{e()}catch(e){}})}finally{this.controllerUnsubscribes=[]}}setupUrlSync(){this.enableUrlSync&&!this._hashChangeHandler&&(this._hashChangeHandler=this.handleHashChange.bind(this),window.addEventListener("hashchange",this._hashChangeHandler),this.handleHashChange())}teardownUrlSync(){this._hashChangeHandler&&(window.removeEventListener("hashchange",this._hashChangeHandler),this._hashChangeHandler=void 0)}handleHashChange(){const e=window.location.hash.match(/^#conversation\/(.+)$/);if(e){const t=decodeURIComponent(e[1]);t!==this.activeThreadId&&this.controller&&this.controller.switchThread(t)}}handleControllerStateChange(e){var t,i,n,a,o;if(e.messages&&(this.messages=e.messages),e.threads&&(this.threads=e.threads),e.suggestions&&e.suggestions.length>0&&(this.suggestions=e.suggestions),e.currentThreadId&&(this.activeThreadId=e.currentThreadId),this.enableUrlSync&&e.currentThreadId){const t=`#conversation/${encodeURIComponent(e.currentThreadId)}`;window.location.hash!==t&&history.replaceState(null,"",t)}if(this.chatStarted=(null===(t=e.messages)||void 0===t?void 0:t.length)>0,this.isBotTyping=e.isTyping||!1,this.statusText=e.statusText,this.isQueryRunning=e.isProcessing||!1,e.uploadedFiles&&(this.uploadedFiles=e.uploadedFiles),this.enableArtifacts){const t=null===(i=e.messages)||void 0===i?void 0:i.some(e=>{var t,i;return(null===(i=null===(t=e.metadata)||void 0===t?void 0:t.artifactIds)||void 0===i?void 0:i.length)>0});t||(this.isArtifactPanelOpen=!1,this.selectedArtifact=null)}if(this.enableArtifacts&&(null===(n=e.messages)||void 0===n?void 0:n.length)){const t=[...e.messages].reverse().find(e=>"bot"===e.sender),i=null===(a=null==t?void 0:t.metadata)||void 0===a?void 0:a.artifactIds;if(null==i?void 0:i.length){const e=i[i.length-1];if((null===(o=this.selectedArtifact)||void 0===o?void 0:o.id)!==e){const t=this.getArtifactPlugin(),i=null==t?void 0:t.getArtifact(e);i&&(this.selectedArtifact=i,this.isArtifactPanelOpen=!0)}}}}handleControllerMessageSent(e){this.isQueryRunning=!0,this.isBotTyping=!0}handleControllerMessageReceived(e){}handleControllerError(e){this.isQueryRunning=!1,this.isBotTyping=!1,console.error("Controller error:",e.error)}render(){var e;const t={boxed:this.boxed,showMessages:this.showMessages,messages:this.messages,isTyping:this.isBotTyping,loadingIndicator:this.loadingIndicator,loadingText:this.statusText||this.loadingText,chatStarted:this.chatStarted,suggestions:this.suggestions,inputBox:{placeholder:this.placeholder,disabled:this.disabled||this.isQueryRunning,currentInput:this.currentInput,uploadedFiles:this.uploadedFiles,isQueryRunning:this.isQueryRunning,showSendButton:this.showSendButton,enableFileUpload:this.enableFileUpload,fileUploadItems:[{id:"upload-file",label:"Upload File",icon:"upload"},{id:"upload-url",label:"Upload from URL",icon:"link"}],enableModuleSelection:this.enableModuleSelection,moduleOptions:this.moduleSelectOptions,selectedModules:this.selectedModules,moduleSelectionLabel:this.moduleSelectionLabel,renderModuleDisplay:this.renderModuleSelectedDisplay.bind(this),showAudioButton:this.showAudioButton,audioRecording:this._audio.state,audioMode:this._audioMode},enableThreads:this.showThreads,enableThreadCreation:this.enableThreadCreation,isThreadSidebarOpen:this.showThreads&&this.isThreadSidebarOpen,threadSidebar:this.showThreads?{threads:this.threads,activeThreadId:this.activeThreadId,editingThreadId:this._editingThreadId}:void 0,isDragging:!1,enableArtifacts:this.enableArtifacts,artifactPanel:this.enableArtifacts?{artifact:this.selectedArtifact,isOpen:this.isArtifactPanelOpen,renderContent:null!==(e=this.renderArtifactContent)&&void 0!==e?e:this.getPluginArtifactRenderer()}:void 0,urlModal:this.isUrlModalOpen?{isOpen:this.isUrlModalOpen,urlInput:this.urlInput,isLoading:this.isUrlLoading,error:this.urlModalError,selectedFileName:this.selectedUrlFileName}:void 0},n={message:{onRetry:this.handleRetry.bind(this),onRetryKeydown:()=>{},onCopy:this.handleCopyMessage.bind(this),onCopyKeydown:()=>{},onFileClick:this.handleFilePreview.bind(this)},suggestion:{onClick:this.handleSuggestionClick.bind(this),onKeydown:()=>{}},inputBox:{onInput:this.handleContentEditableInput.bind(this),onKeydown:this.handleKeyDown.bind(this),onFocus:this.handleInputFocus.bind(this),onBlur:this.handleInputBlur.bind(this),onSend:this.handleSendMessage.bind(this),onStop:this.handleStopQuery.bind(this),onSendKeydown:()=>{},onFileDropdownClick:this.handleFileDropdownClick.bind(this),onModuleChange:this.handleModuleSelectionChange.bind(this),onFileRemove:this.handleFileRemove.bind(this),onFileClick:this.handleFilePreview.bind(this),onAudioStart:this.handleAudioStart.bind(this),onAudioCancel:this.handleAudioCancel.bind(this),onAudioSend:this.handleAudioSend.bind(this)},threadSidebar:this.showThreads?{onCreateNew:()=>{var e;null===(e=this.controller)||void 0===e||e.createThread("New Chat")},onSelectThread:e=>{var t;this.enableUrlSync&&history.pushState(null,"",`#conversation/${encodeURIComponent(e)}`),null===(t=this.controller)||void 0===t||t.switchThread(e)},onDeleteThread:e=>{var t;null===(t=this.controller)||void 0===t||t.deleteThread(e)},onBookmarkThread:e=>{var t;null===(t=this.controller)||void 0===t||t.bookmarkThread(e)},onRenameThread:(e,t)=>{var i;null===(i=this.controller)||void 0===i||i.renameThread(e,t),this._editingThreadId=void 0}}:void 0,fileUploadArea:{onDrop:()=>{},onDragOver:()=>{},onDragLeave:()=>{}},urlModal:this.isUrlModalOpen?{onClose:this.handleUrlModalClose.bind(this),onUrlInputChange:this.handleUrlInputChange.bind(this),onUrlInputKeydown:this.handleUrlInputKeydown.bind(this),onConfirm:this.handleUrlConfirm.bind(this),onAttachFile:this.handleUrlAttachFile.bind(this)}:void 0,artifactPanel:this.enableArtifacts?{onClose:this.handleArtifactPanelClose.bind(this),onCopy:this.handleArtifactCopy.bind(this)}:void 0,onToggleThreadSidebar:this.showThreads?this.toggleThreadSidebar.bind(this):void 0};return i`
3561
+ */var Jt=function(e,t,i,n){for(var a,o=arguments.length,s=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n,r=e.length-1;r>=0;r--)(a=e[r])&&(s=(o<3?a(s):o>3?a(t,i,s):a(t,i))||s);return o>3&&s&&Object.defineProperty(t,i,s),s},Yt=function(e,t,i,n){return new(i||(i=Promise))(function(a,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function r(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?a(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(s,r)}l((n=n.apply(e,t||[])).next())})};let Qt=class extends(we(t)){constructor(){super(...arguments),this.requiredComponents=["nr-input","nr-button","nr-icon","nr-dropdown","nr-select","nr-modal","nr-popconfirm"],this.messages=[],this.currentInput="",this.isBotTyping=!1,this.isQueryRunning=!1,this.suggestions=[],this.chatStarted=!1,this.isRTL=!1,this.size=Mt.Medium,this.variant=Et.Default,this.loadingIndicator=Tt.Dots,this.loadingText=nt("Agent is working..."),this.disabled=!1,this.placeholder=nt("Type your message..."),this.showSendButton=!0,this.autoScroll=!0,this.showThreads=!1,this.enableThreadCreation=!1,this.threads=[],this.mode="chat",this.boxed=!1,this.enableUrlSync=!1,this.showMessages=!0,this.enableFileUpload=!1,this.uploadedFiles=[],this.actionButtons=[],this.enableModuleSelection=!1,this.modules=[],this.selectedModules=[],this.moduleSelectionLabel=nt("Select Modules"),this.enableArtifacts=!1,this.showAudioButton=!1,this.focused=!1,this.isArtifactPanelOpen=!1,this.selectedArtifact=null,this.isThreadSidebarOpen=!0,this.isUrlModalOpen=!1,this.urlInput="",this.urlModalError="",this.isUrlLoading=!1,this.selectedUrlFileName="",this.isFilePreviewModalOpen=!1,this.previewFile=null,this.controllerUnsubscribes=[],this._audio=new Gt(this),this._audioMode="message",this._artifactResizeBound=!1,this.toggleThreadSidebar=()=>{this.isThreadSidebarOpen=!this.isThreadSidebarOpen}}get moduleSelectOptions(){return this.modules.map(e=>({value:e.id,label:e.name,icon:e.icon,disabled:!1===e.enabled,description:e.description}))}connectedCallback(){super.connectedCallback(),this.controller&&this.setupControllerIntegration(),this.setupUrlSync()}firstUpdated(){var e,t,i,n;null===(e=this.shadowRoot)||void 0===e||e.addEventListener("click",e=>{var t,i;const n=null===(i=(t=e.target).closest)||void 0===i?void 0:i.call(t,"[data-artifact-id]");if(n){const e=n.dataset.artifactId;e&&this.handleArtifactClick(e)}}),null===(t=this.shadowRoot)||void 0===t||t.addEventListener("nr-thread-edit",e=>{const t=e.detail;(null==t?void 0:t.threadId)&&(this._editingThreadId=t.threadId,this.requestUpdate(),this.updateComplete.then(()=>{var e;const t=null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector(".thread-item__rename-input");t&&(t.focus(),t.select())}))}),null===(i=this.shadowRoot)||void 0===i||i.addEventListener("click",e=>{var t,i;const n=null===(i=(t=e.target).closest)||void 0===i?void 0:i.call(t,"[data-selection-value]");if(n){const e=n.dataset.selectionValue;e&&this.controller&&this.controller.sendMessage(e)}}),null===(n=this.shadowRoot)||void 0===n||n.addEventListener("keydown",e=>{var t,i,n,a;const o=e;if("Enter"!==o.key&&" "!==o.key)return;const s=null===(i=(t=o.target).closest)||void 0===i?void 0:i.call(t,"[data-artifact-id]");if(s){o.preventDefault();const e=s.dataset.artifactId;return void(e&&this.handleArtifactClick(e))}const r=null===(a=(n=o.target).closest)||void 0===a?void 0:a.call(n,"[data-selection-value]");if(r){o.preventDefault();const e=r.dataset.selectionValue;e&&this.controller&&this.controller.sendMessage(e)}})}disconnectedCallback(){var e;super.disconnectedCallback(),this.controller&&this.cleanupControllerIntegration(),this.teardownUrlSync(),null===(e=this._artifactResizeCleanup)||void 0===e||e.call(this),this._artifactResizeBound=!1}updated(e){if(super.updated(e),e.has("controller")&&(this.cleanupControllerIntegration(),this.controller)){this.setupControllerIntegration();try{const e=this.controller.getState();this.handleControllerStateChange(e)}catch(e){}this.enableUrlSync&&this.handleHashChange()}if(e.has("enableUrlSync")&&(this.enableUrlSync?this.setupUrlSync():this.teardownUrlSync()),this.controller&&!e.has("controller")){if(e.has("messages")||e.has("suggestions")||e.has("threads"))try{const e=this.controller.getState();this.handleControllerStateChange(e)}catch(e){}}e.has("messages")&&this.autoScroll&&this.messages.length>0&&this.scrollToLatestMessage(),this.updateArtifactPanelResize()}scrollToLatestMessage(){requestAnimationFrame(()=>{var e;const t=null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector(".messages");t&&(t.scrollTop=t.scrollHeight)})}setupControllerIntegration(){this.controller&&this.controllerUnsubscribes.push(this.controller.on("state:changed",this.handleControllerStateChange.bind(this)),this.controller.on("message:sent",this.handleControllerMessageSent.bind(this)),this.controller.on("message:received",this.handleControllerMessageReceived.bind(this)),this.controller.on("error",this.handleControllerError.bind(this)))}cleanupControllerIntegration(){if(this.controllerUnsubscribes.length)try{this.controllerUnsubscribes.forEach(e=>{try{e()}catch(e){}})}finally{this.controllerUnsubscribes=[]}}setupUrlSync(){this.enableUrlSync&&!this._hashChangeHandler&&(this._hashChangeHandler=this.handleHashChange.bind(this),window.addEventListener("hashchange",this._hashChangeHandler),this.handleHashChange())}teardownUrlSync(){this._hashChangeHandler&&(window.removeEventListener("hashchange",this._hashChangeHandler),this._hashChangeHandler=void 0)}handleHashChange(){const e=window.location.hash.match(/^#conversation\/(.+)$/);if(e){const t=decodeURIComponent(e[1]);t!==this.activeThreadId&&this.controller&&this.controller.switchThread(t)}}handleControllerStateChange(e){var t,i,n,a,o;if(e.messages&&(this.messages=e.messages),e.threads&&(this.threads=e.threads),e.suggestions&&e.suggestions.length>0&&(this.suggestions=e.suggestions),e.currentThreadId&&(this.activeThreadId=e.currentThreadId),this.enableUrlSync&&e.currentThreadId){const t=`#conversation/${encodeURIComponent(e.currentThreadId)}`;window.location.hash!==t&&history.replaceState(null,"",t)}if(this.chatStarted=(null===(t=e.messages)||void 0===t?void 0:t.length)>0,this.isBotTyping=e.isTyping||!1,this.statusText=e.statusText,this.isQueryRunning=e.isProcessing||!1,e.uploadedFiles&&(this.uploadedFiles=e.uploadedFiles),this.enableArtifacts){const t=null===(i=e.messages)||void 0===i?void 0:i.some(e=>{var t,i;return(null===(i=null===(t=e.metadata)||void 0===t?void 0:t.artifactIds)||void 0===i?void 0:i.length)>0});t||(this.isArtifactPanelOpen=!1,this.selectedArtifact=null)}if(this.enableArtifacts&&(null===(n=e.messages)||void 0===n?void 0:n.length)){const t=[...e.messages].reverse().find(e=>"bot"===e.sender),i=null===(a=null==t?void 0:t.metadata)||void 0===a?void 0:a.artifactIds;if(null==i?void 0:i.length){const e=i[i.length-1];if((null===(o=this.selectedArtifact)||void 0===o?void 0:o.id)!==e){const t=this.getArtifactPlugin(),i=null==t?void 0:t.getArtifact(e);i&&(this.selectedArtifact=i,this.isArtifactPanelOpen=!0)}}}}handleControllerMessageSent(e){this.isQueryRunning=!0,this.isBotTyping=!0}handleControllerMessageReceived(e){}handleControllerError(e){this.isQueryRunning=!1,this.isBotTyping=!1,console.error("Controller error:",e.error)}render(){var e;const t={boxed:this.boxed,showMessages:this.showMessages,messages:this.messages,isTyping:this.isBotTyping,loadingIndicator:this.loadingIndicator,loadingText:this.statusText||this.loadingText,chatStarted:this.chatStarted,suggestions:this.suggestions,inputBox:{placeholder:this.placeholder,disabled:this.disabled||this.isQueryRunning,currentInput:this.currentInput,uploadedFiles:this.uploadedFiles,isQueryRunning:this.isQueryRunning,showSendButton:this.showSendButton,enableFileUpload:this.enableFileUpload,fileUploadItems:[{id:"upload-file",label:"Upload File",icon:"upload"},{id:"upload-url",label:"Upload from URL",icon:"link"}],enableModuleSelection:this.enableModuleSelection,moduleOptions:this.moduleSelectOptions,selectedModules:this.selectedModules,moduleSelectionLabel:this.moduleSelectionLabel,renderModuleDisplay:this.renderModuleSelectedDisplay.bind(this),showAudioButton:this.showAudioButton,audioRecording:this._audio.state,audioMode:this._audioMode},enableThreads:this.showThreads,enableThreadCreation:this.enableThreadCreation,isThreadSidebarOpen:this.showThreads&&this.isThreadSidebarOpen,threadSidebar:this.showThreads?{threads:this.threads,activeThreadId:this.activeThreadId,editingThreadId:this._editingThreadId}:void 0,isDragging:!1,enableArtifacts:this.enableArtifacts,artifactPanel:this.enableArtifacts?{artifact:this.selectedArtifact,isOpen:this.isArtifactPanelOpen,renderContent:null!==(e=this.renderArtifactContent)&&void 0!==e?e:this.getPluginArtifactRenderer()}:void 0,urlModal:this.isUrlModalOpen?{isOpen:this.isUrlModalOpen,urlInput:this.urlInput,isLoading:this.isUrlLoading,error:this.urlModalError,selectedFileName:this.selectedUrlFileName}:void 0},n={message:{onRetry:this.handleRetry.bind(this),onRetryKeydown:()=>{},onCopy:this.handleCopyMessage.bind(this),onCopyKeydown:()=>{},onFileClick:this.handleFilePreview.bind(this)},suggestion:{onClick:this.handleSuggestionClick.bind(this),onKeydown:()=>{}},inputBox:{onInput:this.handleContentEditableInput.bind(this),onKeydown:this.handleKeyDown.bind(this),onFocus:this.handleInputFocus.bind(this),onBlur:this.handleInputBlur.bind(this),onSend:this.handleSendMessage.bind(this),onStop:this.handleStopQuery.bind(this),onSendKeydown:()=>{},onFileDropdownClick:this.handleFileDropdownClick.bind(this),onModuleChange:this.handleModuleSelectionChange.bind(this),onFileRemove:this.handleFileRemove.bind(this),onFileClick:this.handleFilePreview.bind(this),onAudioStart:this.handleAudioStart.bind(this),onAudioCancel:this.handleAudioCancel.bind(this),onAudioSend:this.handleAudioSend.bind(this)},threadSidebar:this.showThreads?{onCreateNew:()=>{var e;null===(e=this.controller)||void 0===e||e.createThread("New Chat")},onSelectThread:e=>{var t;this.enableUrlSync&&history.pushState(null,"",`#conversation/${encodeURIComponent(e)}`),null===(t=this.controller)||void 0===t||t.switchThread(e)},onDeleteThread:e=>{var t;null===(t=this.controller)||void 0===t||t.deleteThread(e)},onBookmarkThread:e=>{var t;null===(t=this.controller)||void 0===t||t.bookmarkThread(e)},onRenameThread:(e,t)=>{var i;null===(i=this.controller)||void 0===i||i.renameThread(e,t),this._editingThreadId=void 0}}:void 0,fileUploadArea:{onDrop:()=>{},onDragOver:()=>{},onDragLeave:()=>{}},urlModal:this.isUrlModalOpen?{onClose:this.handleUrlModalClose.bind(this),onUrlInputChange:this.handleUrlInputChange.bind(this),onUrlInputKeydown:this.handleUrlInputKeydown.bind(this),onConfirm:this.handleUrlConfirm.bind(this),onAttachFile:this.handleUrlAttachFile.bind(this)}:void 0,artifactPanel:this.enableArtifacts?{onClose:this.handleArtifactPanelClose.bind(this),onCopy:this.handleArtifactCopy.bind(this)}:void 0,onToggleThreadSidebar:this.showThreads?this.toggleThreadSidebar.bind(this):void 0};return i`
3562
3562
  <div
3563
3563
  class="chat-container ${p({"chat-container--with-threads":this.showThreads,"chat-container--disabled":this.disabled,"chat-container--focused":this.focused,"chat-container--boxed":this.boxed})}"
3564
3564
  dir=${this.isRTL?"rtl":"ltr"}
@@ -3648,7 +3648,7 @@ class Zt{constructor(){this.listeners=new Map}on(e,t){return this.listeners.has(
3648
3648
  * Copyright 2023 Nuraly, Laabidi Aymen
3649
3649
  * SPDX-License-Identifier: MIT
3650
3650
  */
3651
- var mi=function(e,t,i,n){return new(i||(i=Promise))(function(a,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function r(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?a(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(s,r)}l((n=n.apply(e,t||[])).next())})};class xi{constructor(e={}){this.plugins=new Map,this.config=e,this.ui=e.ui||{},this.eventBus=new Zt,this.pluginService=new fi,this.plugins=this.pluginService.getPluginsMap(),e.plugins&&e.plugins.forEach(e=>this.pluginService.registerPlugin(e,this));const t=this.initializeState(e);if(this.stateHandler=new ei(t,this.eventBus,this.ui,this.plugins,this.config),this.messageHandler=new ti(this.stateHandler,this.eventBus,this.plugins),this.threadHandler=new ni(this.stateHandler,this.eventBus,this.ui,this.config,e.provider),this.fileHandler=new oi(this.stateHandler,this.eventBus),this.moduleHandler=new si(this.stateHandler,this.eventBus),this.suggestionHandler=new ri(this.stateHandler),this.providerService=new ci(e.provider,this.stateHandler,this.messageHandler,this.fileHandler,this.eventBus,this.ui,this.plugins),this.validationService=new pi(this.config),this.storageService=new ui(e.storage,this.stateHandler,this.config),e.provider){const t=e.provider;queueMicrotask(()=>{this.initializeProvider(t)})}this.setupLifecycleHooks()}initializeProvider(e){return mi(this,void 0,void 0,function*(){try{e.isConnected()||(yield e.connect({})),yield this.autoLoadConversations(e)}catch(e){this.logError("Failed to connect provider:",e)}})}initializeState(e){const t=e.initialMessages?e.initialMessages.map(e=>this.processMessageThroughPlugins(e)):[];return{messages:t,threads:e.initialThreads||[],modules:e.enableModules?[]:void 0,selectedModules:[],uploadedFiles:[],suggestions:e.initialSuggestions||[],isTyping:!1,isProcessing:!1,currentThreadId:void 0,metadata:e.metadata||{}}}processMessageThroughPlugins(e){if(!e.text||"string"!=typeof e.text)return e;const t=Array.from(this.plugins.values()).filter(e=>Array.isArray(e.htmlTags)&&e.htmlTags.length>0);if(0===t.length)return e;let i=e.text,n=!1;for(const e of t){const t=e.htmlTags;for(const a of t){const t=a.open,o=a.close;let s=0;for(;;){const r=i.indexOf(t,s);if(-1===r)break;const l=r+t.length,c=i.indexOf(o,l);if(-1===c){s=l;continue}const d=i.substring(l,c);let p="";if("function"==typeof e.renderHtmlBlock)try{p=e.renderHtmlBlock(a.name,d)}catch(t){console.error(`[ChatbotCore] Error rendering HTML block for plugin ${e.id}:`,t)}p?(i=i.substring(0,r)+p+i.substring(c+o.length),n=!0,s=r+p.length):s=c+o.length}}}return n?Object.assign(Object.assign({},e),{text:i,metadata:Object.assign(Object.assign({},e.metadata),{renderAsHtml:!0})}):e}processRestoredMessagesForPlugins(){const e=this.stateHandler.getState();if(e.messages&&0!==e.messages.length)for(const t of e.messages)"bot"===t.sender&&this.plugins.forEach(e=>{if(e.onMessageReceived)try{e.onMessageReceived(t)}catch(e){}})}setupLifecycleHooks(){this.onBeforeInit(),this.onReady().catch(e=>{this.logError("Error during initialization:",e)})}onBeforeInit(){this.log("Initializing chatbot controller...")}onReady(){return mi(this,void 0,void 0,function*(){this.log("Chatbot controller ready");try{const e=this.stateHandler.getState(),t=e.messages&&e.messages.length>0?e.messages[0]:void 0;t&&"bot"===t.sender&&t.introduction&&Array.isArray(t.suggestions)&&t.suggestions.length>0&&this.suggestionHandler.setSuggestions(t.suggestions)}catch(e){this.logError("Error initializing suggestions from initial messages:",e)}this.processRestoredMessagesForPlugins(),this.ui.onStateChange&&this.ui.onStateChange(this.getState()),this.emit("ready",this.stateHandler.getState())})}onDestroy(){this.log("Destroying chatbot controller..."),this.storageService.stopAutoSave(),this.pluginService.clearPlugins(),this.eventBus.removeAllListeners()}updateState(e){this.stateHandler.updateState(e)}sendMessage(e){return mi(this,arguments,void 0,function*(e,t={}){this.log("Sending message:",e);try{const i=this.stateHandler.getState();this.config.enableThreads&&!i.currentThreadId&&(yield this.threadHandler.createThread("New Chat"));const n=yield this.beforeMessageSent(e,t);if(!t.skipValidation){const e=yield this.validationService.validateMessage(n);if(!e.isValid){const t=new Xt(e.errors);throw this.handleValidationError(t),t}}const a=this.messageHandler.createUserMessage(n,t.metadata);t.files&&(a.files=t.files),this.messageHandler.addMessage(a);const o=this.stateHandler.getState();return(t.threadId||o.currentThreadId)&&this.threadHandler.updateThreadMessages(t.threadId||o.currentThreadId),yield this.afterMessageSent(a),this.providerService.processMessage(a).catch(e=>{this.logError("Error processing with provider:",e)}),a}catch(e){throw this.handleError(e),e}})}stop(){this.providerService.stopCurrentProcessing()}addMessage(e){const t=this.messageHandler.createMessage(e),i="bot"===t.sender?this.processMessageThroughPlugins(t):t;return this.messageHandler.addMessage(i),i}updateMessage(e,t){this.messageHandler.updateMessage(e,t)}deleteMessage(e){this.messageHandler.deleteMessage(e)}clearMessages(){this.updateState({messages:[]})}getMessages(){return this.stateHandler.getState().messages}uploadFiles(e){return mi(this,void 0,void 0,function*(){if(!this.config.enableFileUpload)throw new Error("File upload is not enabled");let t=e;if(!t&&this.ui.openFileDialog&&(t=yield this.ui.openFileDialog()),!t||0===t.length)return[];const i=[];for(const e of t)try{const t=yield this.validationService.validateFile(e,{maxFileSize:this.config.maxFileSize,allowedTypes:this.config.allowedFileTypes});if(!t.isValid){this.ui.showNotification&&this.ui.showNotification(t.errors[0]||"File validation failed","error");continue}const n=yield this.fileHandler.createChatbotFile(e),a=yield this.providerService.uploadFileToProvider(e);a&&Object.assign(n,a),i.push(n),this.fileHandler.addFile(n),this.ui.showFilePreview&&this.ui.showFilePreview(n)}catch(t){this.logError("Error uploading file:",t),this.ui.showNotification&&this.ui.showNotification(`Failed to upload ${e.name}`,"error")}return i})}removeFile(e){this.fileHandler.removeFile(e)}clearFiles(){this.fileHandler.clearFiles()}getUploadedFiles(){return this.stateHandler.getState().uploadedFiles}createThread(e){return mi(this,void 0,void 0,function*(){return yield this.threadHandler.createThread(e)})}switchThread(e){this.threadHandler.switchThread(e),this.processRestoredMessagesForPlugins()}deleteThread(e){this.threadHandler.deleteThread(e)}renameThread(e,t){this.threadHandler.renameThread(e,t)}bookmarkThread(e){this.threadHandler.bookmarkThread(e)}getCurrentThread(){const e=this.stateHandler.getState();return e.threads.find(t=>t.id===e.currentThreadId)}getThreads(){return this.stateHandler.getState().threads}setModules(e){this.moduleHandler.setModules(e)}selectModules(e){this.moduleHandler.selectModules(e)}toggleModule(e){this.moduleHandler.toggleModule(e)}getSelectedModules(){return this.moduleHandler.getSelectedModules()}setSuggestions(e){this.suggestionHandler.setSuggestions(e)}clearSuggestions(){this.suggestionHandler.clearSuggestions()}beforeMessageSent(e,t){return mi(this,void 0,void 0,function*(){let t=e;for(const e of this.plugins.values())e.beforeSend&&(t=yield e.beforeSend(t));return t})}afterMessageSent(e){return mi(this,void 0,void 0,function*(){this.log("Message sent:",e)})}beforeProviderCall(e){return mi(this,void 0,void 0,function*(){this.log("Calling provider for message:",e.id)})}afterProviderCall(){return mi(this,void 0,void 0,function*(){this.log("Provider call completed")})}handleProviderError(e){return mi(this,void 0,void 0,function*(){this.logError("Provider error:",e);const t=this.messageHandler.createMessage({sender:Ct.Bot,text:"Sorry, there was an error processing your request.",state:Et.Error,timestamp:(new Date).toISOString()});this.messageHandler.addMessage(t),this.ui.showNotification&&this.ui.showNotification("Failed to process message","error"),this.emit("provider:error",e),yield this.pluginService.executeHook("onError",e)})}handleValidationError(e){this.logError("Validation error:",e),this.ui.showNotification&&this.ui.showNotification(e.errors[0],"error"),this.emit("validation:error",e)}handleError(e){this.logError("Error:",e),this.emit("error",e),this.plugins.forEach(t=>{t.onError&&t.onError(e)})}registerPlugin(e){this.pluginService.registerPlugin(e,this)}unregisterPlugin(e){this.pluginService.unregisterPlugin(e)}getPlugin(e){return this.pluginService.getPlugin(e)}setProvider(e){this.providerService.setProvider(e),e.isConnected()?(this.autoLoadConversations(e).catch(e=>{this.logError("Failed to auto-load conversations:",e)}),this.emit("provider:connected",e.id)):e.connect({}).then(()=>mi(this,void 0,void 0,function*(){yield this.autoLoadConversations(e),this.emit("provider:connected",e.id)})).catch(e=>{this.logError("Failed to connect provider:",e)})}setStorage(e){this.storageService.setStorage(e)}saveToStorage(){return mi(this,arguments,void 0,function*(e="chatbot-state"){yield this.storageService.saveState(e)})}loadFromStorage(){return mi(this,arguments,void 0,function*(e="chatbot-state"){yield this.storageService.loadState(e);const t=this.stateHandler.getState();if(t.messages&&t.messages.length>0){const e=t.messages.map(e=>this.processMessageThroughPlugins(e));this.stateHandler.updateState({messages:e}),this.processRestoredMessagesForPlugins()}})}on(e,t){return this.eventBus.on(e,t)}emit(e,t){this.eventBus.emit(e,t)}getState(){return this.stateHandler.getState()}setState(e){e.messages&&Array.isArray(e.messages)&&(e.messages=e.messages.map(e=>this.processMessageThroughPlugins(e))),e.threads&&Array.isArray(e.threads)&&(e.threads=e.threads.map(e=>Object.assign(Object.assign({},e),{messages:e.messages.map(e=>this.processMessageThroughPlugins(e))}))),this.updateState(e),e.messages&&this.processRestoredMessagesForPlugins()}loadConversations(e){const t=e.map(e=>Object.assign(Object.assign({},e),{messages:e.messages.map(e=>this.processMessageThroughPlugins(e))}));this.updateState({threads:t,currentThreadId:t.length>0?t[0].id:void 0,messages:t.length>0?t[0].messages:[]}),this.processRestoredMessagesForPlugins()}autoLoadConversations(e){return mi(this,void 0,void 0,function*(){if(e&&"function"==typeof e.loadConversations)try{this.log("Auto-loading conversations from provider...");const t=yield e.loadConversations();if(Array.isArray(t)&&t.length>0){this.log(`Loaded ${t.length} conversation summaries`);const i=[];if("function"==typeof e.loadConversation)for(const n of t)try{const t=yield e.loadConversation(n.id);if(t){const e={id:t.id,title:t.title,messages:t.messages||[],createdAt:t.createdAt,updatedAt:t.updatedAt};i.push(e)}}catch(e){this.logError(`Failed to load conversation ${n.id}:`,e)}else for(const e of t){const t={id:e.id,title:e.title,messages:[],createdAt:e.createdAt,updatedAt:e.updatedAt};i.push(t)}i.length>0&&(this.log(`Successfully loaded ${i.length} conversations`),this.loadConversations(i))}else this.log("No conversations to load from provider")}catch(e){this.logError("Failed to auto-load conversations from provider:",e)}})}setUICallbacks(e){this.ui=Object.assign(Object.assign({},this.ui),e)}getConfig(){return Object.freeze(Object.assign({},this.config))}updateConfig(e){this.config=Object.assign(Object.assign({},this.config),e)}setTyping(e){this.updateState({isTyping:e}),this.emit(e?"typing:start":"typing:end")}setStatusText(e){this.updateState({statusText:e})}clearStatusText(){this.updateState({statusText:void 0})}getContext(){const e=this.stateHandler.getState();return{messages:e.messages,currentThread:this.getCurrentThread(),selectedModules:e.selectedModules,metadata:e.metadata,uploadedFiles:e.uploadedFiles}}destroy(){this.onDestroy()}generateId(e){return`${e}_${Date.now()}_${Math.random().toString(36).substr(2,9)}`}formatFileSize(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(2)} KB`:`${(e/1048576).toFixed(2)} MB`}log(...e){this.config.debug&&console.log("[ChatbotCore]",...e)}logError(...e){console.error("[ChatbotCore]",...e)}}
3651
+ var mi=function(e,t,i,n){return new(i||(i=Promise))(function(a,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function r(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?a(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(s,r)}l((n=n.apply(e,t||[])).next())})};class xi{constructor(e={}){this.plugins=new Map,this.config=e,this.ui=e.ui||{},this.eventBus=new Zt,this.pluginService=new fi,this.plugins=this.pluginService.getPluginsMap(),e.plugins&&e.plugins.forEach(e=>this.pluginService.registerPlugin(e,this));const t=this.initializeState(e);if(this.stateHandler=new ei(t,this.eventBus,this.ui,this.plugins,this.config),this.messageHandler=new ti(this.stateHandler,this.eventBus,this.plugins),this.threadHandler=new ni(this.stateHandler,this.eventBus,this.ui,this.config,e.provider),this.fileHandler=new oi(this.stateHandler,this.eventBus),this.moduleHandler=new si(this.stateHandler,this.eventBus),this.suggestionHandler=new ri(this.stateHandler),this.providerService=new ci(e.provider,this.stateHandler,this.messageHandler,this.fileHandler,this.eventBus,this.ui,this.plugins),this.validationService=new pi(this.config),this.storageService=new ui(e.storage,this.stateHandler,this.config),e.provider){const t=e.provider;queueMicrotask(()=>{this.initializeProvider(t)})}this.setupLifecycleHooks()}initializeProvider(e){return mi(this,void 0,void 0,function*(){try{e.isConnected()||(yield e.connect({})),yield this.autoLoadConversations(e)}catch(e){this.logError("Failed to connect provider:",e)}})}initializeState(e){const t=e.initialMessages?e.initialMessages.map(e=>this.processMessageThroughPlugins(e)):[];return{messages:t,threads:e.initialThreads||[],modules:e.enableModules?[]:void 0,selectedModules:[],uploadedFiles:[],suggestions:e.initialSuggestions||[],isTyping:!1,isProcessing:!1,currentThreadId:void 0,metadata:e.metadata||{}}}processMessageThroughPlugins(e){if(!e.text||"string"!=typeof e.text)return e;const t=Array.from(this.plugins.values()).filter(e=>Array.isArray(e.htmlTags)&&e.htmlTags.length>0);if(0===t.length)return e;let i=e.text,n=!1;for(const e of t){const t=e.htmlTags;for(const a of t){const t=a.open,o=a.close;let s=0;for(;;){const r=i.indexOf(t,s);if(-1===r)break;const l=r+t.length,c=i.indexOf(o,l);if(-1===c){s=l;continue}const d=i.substring(l,c);let p="";if("function"==typeof e.renderHtmlBlock)try{p=e.renderHtmlBlock(a.name,d)}catch(t){console.error(`[ChatbotCore] Error rendering HTML block for plugin ${e.id}:`,t)}p?(i=i.substring(0,r)+p+i.substring(c+o.length),n=!0,s=r+p.length):s=c+o.length}}}return n?Object.assign(Object.assign({},e),{text:i,metadata:Object.assign(Object.assign({},e.metadata),{renderAsHtml:!0})}):e}processRestoredMessagesForPlugins(){const e=this.stateHandler.getState();if(e.messages&&0!==e.messages.length)for(const t of e.messages)"bot"===t.sender&&this.plugins.forEach(e=>{if(e.onMessageReceived)try{e.onMessageReceived(t)}catch(e){}})}setupLifecycleHooks(){this.onBeforeInit(),this.onReady().catch(e=>{this.logError("Error during initialization:",e)})}onBeforeInit(){this.log("Initializing chatbot controller...")}onReady(){return mi(this,void 0,void 0,function*(){this.log("Chatbot controller ready");try{const e=this.stateHandler.getState(),t=e.messages&&e.messages.length>0?e.messages[0]:void 0;t&&"bot"===t.sender&&t.introduction&&Array.isArray(t.suggestions)&&t.suggestions.length>0&&this.suggestionHandler.setSuggestions(t.suggestions)}catch(e){this.logError("Error initializing suggestions from initial messages:",e)}this.processRestoredMessagesForPlugins(),this.ui.onStateChange&&this.ui.onStateChange(this.getState()),this.emit("ready",this.stateHandler.getState())})}onDestroy(){this.log("Destroying chatbot controller..."),this.storageService.stopAutoSave(),this.pluginService.clearPlugins(),this.eventBus.removeAllListeners()}updateState(e){this.stateHandler.updateState(e)}sendMessage(e){return mi(this,arguments,void 0,function*(e,t={}){this.log("Sending message:",e);try{const i=this.stateHandler.getState();this.config.enableThreads&&!i.currentThreadId&&(yield this.threadHandler.createThread("New Chat"));const n=yield this.beforeMessageSent(e,t);if(!t.skipValidation){const e=yield this.validationService.validateMessage(n);if(!e.isValid){const t=new Xt(e.errors);throw this.handleValidationError(t),t}}const a=this.messageHandler.createUserMessage(n,t.metadata);t.files&&(a.files=t.files),this.messageHandler.addMessage(a);const o=this.stateHandler.getState();return(t.threadId||o.currentThreadId)&&this.threadHandler.updateThreadMessages(t.threadId||o.currentThreadId),yield this.afterMessageSent(a),this.providerService.processMessage(a).catch(e=>{this.logError("Error processing with provider:",e)}),a}catch(e){throw this.handleError(e),e}})}stop(){this.providerService.stopCurrentProcessing()}addMessage(e){const t=this.messageHandler.createMessage(e),i="bot"===t.sender?this.processMessageThroughPlugins(t):t;return this.messageHandler.addMessage(i),i}updateMessage(e,t){this.messageHandler.updateMessage(e,t)}deleteMessage(e){this.messageHandler.deleteMessage(e)}clearMessages(){this.updateState({messages:[]})}getMessages(){return this.stateHandler.getState().messages}uploadFiles(e){return mi(this,void 0,void 0,function*(){if(!this.config.enableFileUpload)throw new Error("File upload is not enabled");let t=e;if(!t&&this.ui.openFileDialog&&(t=yield this.ui.openFileDialog()),!t||0===t.length)return[];const i=[];for(const e of t)try{const t=yield this.validationService.validateFile(e,{maxFileSize:this.config.maxFileSize,allowedTypes:this.config.allowedFileTypes});if(!t.isValid){this.ui.showNotification&&this.ui.showNotification(t.errors[0]||"File validation failed","error");continue}const n=yield this.fileHandler.createChatbotFile(e),a=yield this.providerService.uploadFileToProvider(e);a&&Object.assign(n,a),i.push(n),this.fileHandler.addFile(n),this.ui.showFilePreview&&this.ui.showFilePreview(n)}catch(t){this.logError("Error uploading file:",t),this.ui.showNotification&&this.ui.showNotification(`Failed to upload ${e.name}`,"error")}return i})}removeFile(e){this.fileHandler.removeFile(e)}clearFiles(){this.fileHandler.clearFiles()}getUploadedFiles(){return this.stateHandler.getState().uploadedFiles}createThread(e){return mi(this,void 0,void 0,function*(){return yield this.threadHandler.createThread(e)})}switchThread(e){this.threadHandler.switchThread(e),this.processRestoredMessagesForPlugins()}deleteThread(e){this.threadHandler.deleteThread(e)}renameThread(e,t){this.threadHandler.renameThread(e,t)}bookmarkThread(e){this.threadHandler.bookmarkThread(e)}getCurrentThread(){const e=this.stateHandler.getState();return e.threads.find(t=>t.id===e.currentThreadId)}getThreads(){return this.stateHandler.getState().threads}setModules(e){this.moduleHandler.setModules(e)}selectModules(e){this.moduleHandler.selectModules(e)}toggleModule(e){this.moduleHandler.toggleModule(e)}getSelectedModules(){return this.moduleHandler.getSelectedModules()}setSuggestions(e){this.suggestionHandler.setSuggestions(e)}clearSuggestions(){this.suggestionHandler.clearSuggestions()}beforeMessageSent(e,t){return mi(this,void 0,void 0,function*(){let t=e;for(const e of this.plugins.values())e.beforeSend&&(t=yield e.beforeSend(t));return t})}afterMessageSent(e){return mi(this,void 0,void 0,function*(){this.log("Message sent:",e)})}beforeProviderCall(e){return mi(this,void 0,void 0,function*(){this.log("Calling provider for message:",e.id)})}afterProviderCall(){return mi(this,void 0,void 0,function*(){this.log("Provider call completed")})}handleProviderError(e){return mi(this,void 0,void 0,function*(){this.logError("Provider error:",e);const t=this.messageHandler.createMessage({sender:Ct.Bot,text:"Sorry, there was an error processing your request.",state:zt.Error,timestamp:(new Date).toISOString()});this.messageHandler.addMessage(t),this.ui.showNotification&&this.ui.showNotification("Failed to process message","error"),this.emit("provider:error",e),yield this.pluginService.executeHook("onError",e)})}handleValidationError(e){this.logError("Validation error:",e),this.ui.showNotification&&this.ui.showNotification(e.errors[0],"error"),this.emit("validation:error",e)}handleError(e){this.logError("Error:",e),this.emit("error",e),this.plugins.forEach(t=>{t.onError&&t.onError(e)})}registerPlugin(e){this.pluginService.registerPlugin(e,this)}unregisterPlugin(e){this.pluginService.unregisterPlugin(e)}getPlugin(e){return this.pluginService.getPlugin(e)}setProvider(e){this.providerService.setProvider(e),e.isConnected()?(this.autoLoadConversations(e).catch(e=>{this.logError("Failed to auto-load conversations:",e)}),this.emit("provider:connected",e.id)):e.connect({}).then(()=>mi(this,void 0,void 0,function*(){yield this.autoLoadConversations(e),this.emit("provider:connected",e.id)})).catch(e=>{this.logError("Failed to connect provider:",e)})}setStorage(e){this.storageService.setStorage(e)}saveToStorage(){return mi(this,arguments,void 0,function*(e="chatbot-state"){yield this.storageService.saveState(e)})}loadFromStorage(){return mi(this,arguments,void 0,function*(e="chatbot-state"){yield this.storageService.loadState(e);const t=this.stateHandler.getState();if(t.messages&&t.messages.length>0){const e=t.messages.map(e=>this.processMessageThroughPlugins(e));this.stateHandler.updateState({messages:e}),this.processRestoredMessagesForPlugins()}})}on(e,t){return this.eventBus.on(e,t)}emit(e,t){this.eventBus.emit(e,t)}getState(){return this.stateHandler.getState()}setState(e){e.messages&&Array.isArray(e.messages)&&(e.messages=e.messages.map(e=>this.processMessageThroughPlugins(e))),e.threads&&Array.isArray(e.threads)&&(e.threads=e.threads.map(e=>Object.assign(Object.assign({},e),{messages:e.messages.map(e=>this.processMessageThroughPlugins(e))}))),this.updateState(e),e.messages&&this.processRestoredMessagesForPlugins()}loadConversations(e){const t=e.map(e=>Object.assign(Object.assign({},e),{messages:e.messages.map(e=>this.processMessageThroughPlugins(e))}));this.updateState({threads:t,currentThreadId:t.length>0?t[0].id:void 0,messages:t.length>0?t[0].messages:[]}),this.processRestoredMessagesForPlugins()}autoLoadConversations(e){return mi(this,void 0,void 0,function*(){if(e&&"function"==typeof e.loadConversations)try{this.log("Auto-loading conversations from provider...");const t=yield e.loadConversations();if(Array.isArray(t)&&t.length>0){this.log(`Loaded ${t.length} conversation summaries`);const i=[];if("function"==typeof e.loadConversation)for(const n of t)try{const t=yield e.loadConversation(n.id);if(t){const e={id:t.id,title:t.title,messages:t.messages||[],createdAt:t.createdAt,updatedAt:t.updatedAt};i.push(e)}}catch(e){this.logError(`Failed to load conversation ${n.id}:`,e)}else for(const e of t){const t={id:e.id,title:e.title,messages:[],createdAt:e.createdAt,updatedAt:e.updatedAt};i.push(t)}i.length>0&&(this.log(`Successfully loaded ${i.length} conversations`),this.loadConversations(i))}else this.log("No conversations to load from provider")}catch(e){this.logError("Failed to auto-load conversations from provider:",e)}})}setUICallbacks(e){this.ui=Object.assign(Object.assign({},this.ui),e)}getConfig(){return Object.freeze(Object.assign({},this.config))}updateConfig(e){this.config=Object.assign(Object.assign({},this.config),e)}setTyping(e){this.updateState({isTyping:e}),this.emit(e?"typing:start":"typing:end")}setStatusText(e){this.updateState({statusText:e})}clearStatusText(){this.updateState({statusText:void 0})}getContext(){const e=this.stateHandler.getState();return{messages:e.messages,currentThread:this.getCurrentThread(),selectedModules:e.selectedModules,metadata:e.metadata,uploadedFiles:e.uploadedFiles}}destroy(){this.onDestroy()}generateId(e){return`${e}_${Date.now()}_${Math.random().toString(36).substr(2,9)}`}formatFileSize(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(2)} KB`:`${(e/1048576).toFixed(2)} MB`}log(...e){this.config.debug&&console.log("[ChatbotCore]",...e)}logError(...e){console.error("[ChatbotCore]",...e)}}
3652
3652
  /**
3653
3653
  * @license
3654
3654
  * Copyright 2024 Nuraly, Laabidi Aymen
@@ -3693,17 +3693,17 @@ var mi=function(e,t,i,n){return new(i||(i=Promise))(function(a,o){function s(e){
3693
3693
  * @license
3694
3694
  * Copyright 2024 Nuraly, Laabidi Aymen
3695
3695
  * SPDX-License-Identifier: MIT
3696
- */var zi=function(e,t,i,n){return new(i||(i=Promise))(function(a,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function r(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?a(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(s,r)}l((n=n.apply(e,t||[])).next())})};class Ei extends yi{constructor(){super(...arguments),this.undoController=null,this.internalClipboard=null}setUndoController(e){this.undoController=e}copySelected(){return zi(this,void 0,void 0,function*(){if(0===this._host.selectedNodeIds.size)return!1;const e=this.serializeSelection();if(!e)return!1;try{const t=JSON.stringify(e,null,2);yield navigator.clipboard.writeText(t)}catch(e){this.handleError(e,"copySelected: system clipboard unavailable, using internal clipboard")}return this.internalClipboard=e,this.dispatchEvent(new CustomEvent("clipboard-copy",{detail:{nodeCount:e.nodes.length,edgeCount:e.edges.length},bubbles:!0,composed:!0})),!0})}cutSelected(){return zi(this,void 0,void 0,function*(){if(this._host.readonly)return!1;const e=yield this.copySelected();return e&&(this.deleteSelected(),this.dispatchEvent(new CustomEvent("clipboard-cut",{detail:{success:!0},bubbles:!0,composed:!0}))),e})}pasteFromClipboard(e){return zi(this,void 0,void 0,function*(){var t,i,n,a;if(this._host.readonly)return!1;let o=null;try{const e=yield navigator.clipboard.readText();o=this.parseClipboardData(e)}catch(e){this.handleError(e,"pasteFromClipboard: system clipboard unavailable, using internal clipboard")}if(!o&&this.internalClipboard&&(o=structuredClone(this.internalClipboard)),!o||0===o.nodes.length)return!1;const s=e||this.getPastePosition(o.copyOrigin),r=new Map,l=[],c=[];for(const e of o.nodes){const c=this.generateNodeId();r.set(e.id,c);const d=s.x-o.copyOrigin.x,p=s.y-o.copyOrigin.y;l.push(Object.assign(Object.assign({},structuredClone(e)),{id:c,name:this.generateUniqueName(e.name),position:{x:this.snapToGrid(e.position.x+d,e.position.y+p).x,y:this.snapToGrid(e.position.x+d,e.position.y+p).y},ports:{inputs:((null===(t=e.ports)||void 0===t?void 0:t.inputs)||[]).map(e=>Object.assign({},e)),configs:null===(n=null===(i=e.ports)||void 0===i?void 0:i.configs)||void 0===n?void 0:n.map(e=>Object.assign({},e)),outputs:((null===(a=e.ports)||void 0===a?void 0:a.outputs)||[]).map(e=>Object.assign({},e))}}))}for(const e of o.edges){const t=r.get(e.sourceNodeId),i=r.get(e.targetNodeId);t&&i&&c.push(Object.assign(Object.assign({},structuredClone(e)),{id:this.generateEdgeId(),sourceNodeId:t,targetNodeId:i}))}return this._host.selectedNodeIds=new Set(l.map(e=>e.id)),this._host.selectedEdgeIds=new Set(c.map(e=>e.id)),this.undoController&&this.undoController.recordNodesPasted(l,c),this._host.setWorkflow(Object.assign(Object.assign({},this._host.workflow),{nodes:[...this._host.workflow.nodes,...l],edges:[...this._host.workflow.edges,...c]})),this._host.dispatchWorkflowChanged(),yield this._host.updateComplete,this._host.selectedNodeIds=new Set(l.map(e=>e.id)),this._host.selectedEdgeIds=new Set(c.map(e=>e.id)),this._host.requestUpdate(),this.dispatchEvent(new CustomEvent("clipboard-paste",{detail:{nodeCount:l.length,edgeCount:c.length},bubbles:!0,composed:!0})),!0})}hasClipboardContent(){return zi(this,void 0,void 0,function*(){if(this.internalClipboard)return!0;try{const e=yield navigator.clipboard.readText();return null!==this.parseClipboardData(e)}catch(e){return!1}})}serializeSelection(){const e=this._host.workflow.nodes.filter(e=>this._host.selectedNodeIds.has(e.id));if(0===e.length)return null;const t=this._host.workflow.edges.filter(e=>this._host.selectedNodeIds.has(e.sourceNodeId)&&this._host.selectedNodeIds.has(e.targetNodeId)),i=this.calculateSelectionCenter(e);return{type:"nuraly-workflow-nodes",version:"1.0",nodes:structuredClone(e),edges:structuredClone(t),copyOrigin:i}}parseClipboardData(e){if(!e||"string"!=typeof e)return null;try{const t=JSON.parse(e);if("nuraly-workflow-nodes"===t.type&&Array.isArray(t.nodes))return t;if(t.nodes&&Array.isArray(t.nodes))return{type:"nuraly-workflow-nodes",version:"1.0",nodes:t.nodes,edges:t.edges||[],copyOrigin:this.calculateSelectionCenter(t.nodes)};if(t.type&&t.position&&t.ports)return{type:"nuraly-workflow-nodes",version:"1.0",nodes:[t],edges:[],copyOrigin:t.position}}catch(e){}return null}calculateSelectionCenter(e){if(0===e.length)return{x:0,y:0};let t=1/0,i=1/0,n=-1/0,a=-1/0;for(const o of e)t=Math.min(t,o.position.x),i=Math.min(i,o.position.y),n=Math.max(n,o.position.x+200),a=Math.max(a,o.position.y+80);return{x:(t+n)/2,y:(i+a)/2}}getPastePosition(e){return this._host.lastMousePosition?this._host.lastMousePosition:{x:e.x+40,y:e.y+40}}deleteSelected(){const e=this._host.selectedNodeIds,t=this._host.selectedEdgeIds;this._host.setWorkflow(Object.assign(Object.assign({},this._host.workflow),{nodes:this._host.workflow.nodes.filter(t=>!e.has(t.id)),edges:this._host.workflow.edges.filter(i=>!t.has(i.id)&&!e.has(i.sourceNodeId)&&!e.has(i.targetNodeId))})),this._host.selectedNodeIds=new Set,this._host.selectedEdgeIds=new Set,this._host.dispatchWorkflowChanged()}}
3696
+ */var Ei=function(e,t,i,n){return new(i||(i=Promise))(function(a,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function r(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?a(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(s,r)}l((n=n.apply(e,t||[])).next())})};class zi extends yi{constructor(){super(...arguments),this.undoController=null,this.internalClipboard=null}setUndoController(e){this.undoController=e}copySelected(){return Ei(this,void 0,void 0,function*(){if(0===this._host.selectedNodeIds.size)return!1;const e=this.serializeSelection();if(!e)return!1;try{const t=JSON.stringify(e,null,2);yield navigator.clipboard.writeText(t)}catch(e){this.handleError(e,"copySelected: system clipboard unavailable, using internal clipboard")}return this.internalClipboard=e,this.dispatchEvent(new CustomEvent("clipboard-copy",{detail:{nodeCount:e.nodes.length,edgeCount:e.edges.length},bubbles:!0,composed:!0})),!0})}cutSelected(){return Ei(this,void 0,void 0,function*(){if(this._host.readonly)return!1;const e=yield this.copySelected();return e&&(this.deleteSelected(),this.dispatchEvent(new CustomEvent("clipboard-cut",{detail:{success:!0},bubbles:!0,composed:!0}))),e})}pasteFromClipboard(e){return Ei(this,void 0,void 0,function*(){var t,i,n,a;if(this._host.readonly)return!1;let o=null;try{const e=yield navigator.clipboard.readText();o=this.parseClipboardData(e)}catch(e){this.handleError(e,"pasteFromClipboard: system clipboard unavailable, using internal clipboard")}if(!o&&this.internalClipboard&&(o=structuredClone(this.internalClipboard)),!o||0===o.nodes.length)return!1;const s=e||this.getPastePosition(o.copyOrigin),r=new Map,l=[],c=[];for(const e of o.nodes){const c=this.generateNodeId();r.set(e.id,c);const d=s.x-o.copyOrigin.x,p=s.y-o.copyOrigin.y;l.push(Object.assign(Object.assign({},structuredClone(e)),{id:c,name:this.generateUniqueName(e.name),position:{x:this.snapToGrid(e.position.x+d,e.position.y+p).x,y:this.snapToGrid(e.position.x+d,e.position.y+p).y},ports:{inputs:((null===(t=e.ports)||void 0===t?void 0:t.inputs)||[]).map(e=>Object.assign({},e)),configs:null===(n=null===(i=e.ports)||void 0===i?void 0:i.configs)||void 0===n?void 0:n.map(e=>Object.assign({},e)),outputs:((null===(a=e.ports)||void 0===a?void 0:a.outputs)||[]).map(e=>Object.assign({},e))}}))}for(const e of o.edges){const t=r.get(e.sourceNodeId),i=r.get(e.targetNodeId);t&&i&&c.push(Object.assign(Object.assign({},structuredClone(e)),{id:this.generateEdgeId(),sourceNodeId:t,targetNodeId:i}))}return this._host.selectedNodeIds=new Set(l.map(e=>e.id)),this._host.selectedEdgeIds=new Set(c.map(e=>e.id)),this.undoController&&this.undoController.recordNodesPasted(l,c),this._host.setWorkflow(Object.assign(Object.assign({},this._host.workflow),{nodes:[...this._host.workflow.nodes,...l],edges:[...this._host.workflow.edges,...c]})),this._host.dispatchWorkflowChanged(),yield this._host.updateComplete,this._host.selectedNodeIds=new Set(l.map(e=>e.id)),this._host.selectedEdgeIds=new Set(c.map(e=>e.id)),this._host.requestUpdate(),this.dispatchEvent(new CustomEvent("clipboard-paste",{detail:{nodeCount:l.length,edgeCount:c.length},bubbles:!0,composed:!0})),!0})}hasClipboardContent(){return Ei(this,void 0,void 0,function*(){if(this.internalClipboard)return!0;try{const e=yield navigator.clipboard.readText();return null!==this.parseClipboardData(e)}catch(e){return!1}})}serializeSelection(){const e=this._host.workflow.nodes.filter(e=>this._host.selectedNodeIds.has(e.id));if(0===e.length)return null;const t=this._host.workflow.edges.filter(e=>this._host.selectedNodeIds.has(e.sourceNodeId)&&this._host.selectedNodeIds.has(e.targetNodeId)),i=this.calculateSelectionCenter(e);return{type:"nuraly-workflow-nodes",version:"1.0",nodes:structuredClone(e),edges:structuredClone(t),copyOrigin:i}}parseClipboardData(e){if(!e||"string"!=typeof e)return null;try{const t=JSON.parse(e);if("nuraly-workflow-nodes"===t.type&&Array.isArray(t.nodes))return t;if(t.nodes&&Array.isArray(t.nodes))return{type:"nuraly-workflow-nodes",version:"1.0",nodes:t.nodes,edges:t.edges||[],copyOrigin:this.calculateSelectionCenter(t.nodes)};if(t.type&&t.position&&t.ports)return{type:"nuraly-workflow-nodes",version:"1.0",nodes:[t],edges:[],copyOrigin:t.position}}catch(e){}return null}calculateSelectionCenter(e){if(0===e.length)return{x:0,y:0};let t=1/0,i=1/0,n=-1/0,a=-1/0;for(const o of e)t=Math.min(t,o.position.x),i=Math.min(i,o.position.y),n=Math.max(n,o.position.x+200),a=Math.max(a,o.position.y+80);return{x:(t+n)/2,y:(i+a)/2}}getPastePosition(e){return this._host.lastMousePosition?this._host.lastMousePosition:{x:e.x+40,y:e.y+40}}deleteSelected(){const e=this._host.selectedNodeIds,t=this._host.selectedEdgeIds;this._host.setWorkflow(Object.assign(Object.assign({},this._host.workflow),{nodes:this._host.workflow.nodes.filter(t=>!e.has(t.id)),edges:this._host.workflow.edges.filter(i=>!t.has(i.id)&&!e.has(i.sourceNodeId)&&!e.has(i.targetNodeId))})),this._host.selectedNodeIds=new Set,this._host.selectedEdgeIds=new Set,this._host.dispatchWorkflowChanged()}}
3697
3697
  /**
3698
3698
  * @license
3699
3699
  * Copyright 2024 Nuraly, Laabidi Aymen
3700
3700
  * SPDX-License-Identifier: MIT
3701
- */class Oi extends yi{constructor(e){super(e),this._undoProvider=null}set undoProvider(e){this._undoProvider=e}get undoProvider(){return this._undoProvider}getWorkflowId(){return this._host.workflow.id}performUndo(){if(!this._undoProvider)return!1;const e=this.getWorkflowId();if(!this._undoProvider.canUndo(e))return!1;const t=this._undoProvider.undo(e,this._host.workflow);return t.success&&t.workflow?(this._host.setWorkflow(t.workflow),this._host.dispatchWorkflowChanged(),this._host.selectedNodeIds=new Set,this._host.selectedEdgeIds=new Set,this._host.configuredNode=null,this.dispatchEvent(new CustomEvent("undo-performed",{detail:{description:t.description},bubbles:!0,composed:!0})),!0):(t.error&&this.dispatchEvent(new CustomEvent("undo-error",{detail:{error:t.error},bubbles:!0,composed:!0})),!1)}performRedo(){if(!this._undoProvider)return!1;const e=this.getWorkflowId();if(!this._undoProvider.canRedo(e))return!1;const t=this._undoProvider.redo(e,this._host.workflow);return t.success&&t.workflow?(this._host.setWorkflow(t.workflow),this._host.dispatchWorkflowChanged(),this._host.selectedNodeIds=new Set,this._host.selectedEdgeIds=new Set,this._host.configuredNode=null,this.dispatchEvent(new CustomEvent("redo-performed",{detail:{description:t.description},bubbles:!0,composed:!0})),!0):(t.error&&this.dispatchEvent(new CustomEvent("redo-error",{detail:{error:t.error},bubbles:!0,composed:!0})),!1)}canUndo(){var e,t;return null!==(t=null===(e=this._undoProvider)||void 0===e?void 0:e.canUndo(this.getWorkflowId()))&&void 0!==t&&t}canRedo(){var e,t;return null!==(t=null===(e=this._undoProvider)||void 0===e?void 0:e.canRedo(this.getWorkflowId()))&&void 0!==t&&t}getUndoTooltip(){var e;const t=null===(e=this._undoProvider)||void 0===e?void 0:e.getUndoDescription(this.getWorkflowId());return t?`Undo: ${t} (Ctrl+Z)`:"Undo (Ctrl+Z)"}getRedoTooltip(){var e;const t=null===(e=this._undoProvider)||void 0===e?void 0:e.getRedoDescription(this.getWorkflowId());return t?`Redo: ${t} (Ctrl+Shift+Z)`:"Redo (Ctrl+Shift+Z)"}recordNodeAdded(e){var t;null===(t=this._undoProvider)||void 0===t||t.recordAddNode(this.getWorkflowId(),e)}recordNodeDeleted(e,t){var i;null===(i=this._undoProvider)||void 0===i||i.recordDeleteNode(this.getWorkflowId(),e,t)}recordNodesMoved(e){var t;null===(t=this._undoProvider)||void 0===t||t.recordMoveNodes(this.getWorkflowId(),e)}recordNodeConfigUpdated(e,t,i){var n;null===(n=this._undoProvider)||void 0===n||n.recordUpdateNodeConfig(this.getWorkflowId(),e,t,i)}recordEdgeAdded(e){var t;null===(t=this._undoProvider)||void 0===t||t.recordAddEdge(this.getWorkflowId(),e)}recordEdgeDeleted(e){var t;null===(t=this._undoProvider)||void 0===t||t.recordDeleteEdge(this.getWorkflowId(),e)}recordBulkDeleted(e,t){var i;null===(i=this._undoProvider)||void 0===i||i.recordBulkDelete(this.getWorkflowId(),e,t)}recordNodesPasted(e,t){var i;null===(i=this._undoProvider)||void 0===i||i.recordPasteNodes(this.getWorkflowId(),e,t)}recordNodesDuplicated(e,t){var i;null===(i=this._undoProvider)||void 0===i||i.recordDuplicateNodes(this.getWorkflowId(),e,t)}flushPending(){var e;null===(e=this._undoProvider)||void 0===e||e.flushPendingOperations()}clearHistory(){var e;null===(e=this._undoProvider)||void 0===e||e.clearUndoHistory(this.getWorkflowId())}}
3701
+ */class Ai extends yi{constructor(e){super(e),this._undoProvider=null}set undoProvider(e){this._undoProvider=e}get undoProvider(){return this._undoProvider}getWorkflowId(){return this._host.workflow.id}performUndo(){if(!this._undoProvider)return!1;const e=this.getWorkflowId();if(!this._undoProvider.canUndo(e))return!1;const t=this._undoProvider.undo(e,this._host.workflow);return t.success&&t.workflow?(this._host.setWorkflow(t.workflow),this._host.dispatchWorkflowChanged(),this._host.selectedNodeIds=new Set,this._host.selectedEdgeIds=new Set,this._host.configuredNode=null,this.dispatchEvent(new CustomEvent("undo-performed",{detail:{description:t.description},bubbles:!0,composed:!0})),!0):(t.error&&this.dispatchEvent(new CustomEvent("undo-error",{detail:{error:t.error},bubbles:!0,composed:!0})),!1)}performRedo(){if(!this._undoProvider)return!1;const e=this.getWorkflowId();if(!this._undoProvider.canRedo(e))return!1;const t=this._undoProvider.redo(e,this._host.workflow);return t.success&&t.workflow?(this._host.setWorkflow(t.workflow),this._host.dispatchWorkflowChanged(),this._host.selectedNodeIds=new Set,this._host.selectedEdgeIds=new Set,this._host.configuredNode=null,this.dispatchEvent(new CustomEvent("redo-performed",{detail:{description:t.description},bubbles:!0,composed:!0})),!0):(t.error&&this.dispatchEvent(new CustomEvent("redo-error",{detail:{error:t.error},bubbles:!0,composed:!0})),!1)}canUndo(){var e,t;return null!==(t=null===(e=this._undoProvider)||void 0===e?void 0:e.canUndo(this.getWorkflowId()))&&void 0!==t&&t}canRedo(){var e,t;return null!==(t=null===(e=this._undoProvider)||void 0===e?void 0:e.canRedo(this.getWorkflowId()))&&void 0!==t&&t}getUndoTooltip(){var e;const t=null===(e=this._undoProvider)||void 0===e?void 0:e.getUndoDescription(this.getWorkflowId());return t?`Undo: ${t} (Ctrl+Z)`:"Undo (Ctrl+Z)"}getRedoTooltip(){var e;const t=null===(e=this._undoProvider)||void 0===e?void 0:e.getRedoDescription(this.getWorkflowId());return t?`Redo: ${t} (Ctrl+Shift+Z)`:"Redo (Ctrl+Shift+Z)"}recordNodeAdded(e){var t;null===(t=this._undoProvider)||void 0===t||t.recordAddNode(this.getWorkflowId(),e)}recordNodeDeleted(e,t){var i;null===(i=this._undoProvider)||void 0===i||i.recordDeleteNode(this.getWorkflowId(),e,t)}recordNodesMoved(e){var t;null===(t=this._undoProvider)||void 0===t||t.recordMoveNodes(this.getWorkflowId(),e)}recordNodeConfigUpdated(e,t,i){var n;null===(n=this._undoProvider)||void 0===n||n.recordUpdateNodeConfig(this.getWorkflowId(),e,t,i)}recordEdgeAdded(e){var t;null===(t=this._undoProvider)||void 0===t||t.recordAddEdge(this.getWorkflowId(),e)}recordEdgeDeleted(e){var t;null===(t=this._undoProvider)||void 0===t||t.recordDeleteEdge(this.getWorkflowId(),e)}recordBulkDeleted(e,t){var i;null===(i=this._undoProvider)||void 0===i||i.recordBulkDelete(this.getWorkflowId(),e,t)}recordNodesPasted(e,t){var i;null===(i=this._undoProvider)||void 0===i||i.recordPasteNodes(this.getWorkflowId(),e,t)}recordNodesDuplicated(e,t){var i;null===(i=this._undoProvider)||void 0===i||i.recordDuplicateNodes(this.getWorkflowId(),e,t)}flushPending(){var e;null===(e=this._undoProvider)||void 0===e||e.flushPendingOperations()}clearHistory(){var e;null===(e=this._undoProvider)||void 0===e||e.clearUndoHistory(this.getWorkflowId())}}
3702
3702
  /**
3703
3703
  * @license
3704
3704
  * Copyright 2024 Nuraly, Laabidi Aymen
3705
3705
  * SPDX-License-Identifier: MIT
3706
- */class Ai extends yi{constructor(e){super(e),this.resizeState=null,this.MIN_FRAME_WIDTH=200,this.MIN_FRAME_HEIGHT=150,this.handleResizeDrag=e=>{this.handleResizeDragWithCoords(e.clientX,e.clientY)},this.handleResizeTouchDrag=e=>{e.preventDefault(),e.touches.length>0&&this.handleResizeDragWithCoords(e.touches[0].clientX,e.touches[0].clientY)},this.stopResize=()=>{if(!this.resizeState)return;const e=this._host.workflow.nodes.find(e=>e.id===this.resizeState.frameId);e&&this.updateFrameContainment(e),this.resizeState=null,document.removeEventListener("mousemove",this.handleResizeDrag),document.removeEventListener("mouseup",this.stopResize),document.removeEventListener("touchmove",this.handleResizeTouchDrag),document.removeEventListener("touchend",this.stopResizeTouch),this._host.dispatchWorkflowChanged()},this.stopResizeTouch=()=>{this.stopResize()}}startResize(e,t,i){e.stopPropagation(),e.preventDefault();const n=t.configuration||{};this.resizeState={frameId:t.id,handle:i,startX:e.clientX,startY:e.clientY,startWidth:n.frameWidth||400,startHeight:n.frameHeight||300,startPosition:Object.assign({},t.position)},document.addEventListener("mousemove",this.handleResizeDrag),document.addEventListener("mouseup",this.stopResize),document.addEventListener("touchmove",this.handleResizeTouchDrag,{passive:!1}),document.addEventListener("touchend",this.stopResizeTouch)}handleResizeDragWithCoords(e,t){if(!this.resizeState)return;const{handle:i,startX:n,startY:a,startWidth:o,startHeight:s,startPosition:r,frameId:l}=this.resizeState,c=this._host.workflow.nodes.find(e=>e.id===l);if(!c)return;const d=(e-n)/this._host.viewport.zoom,p=(t-a)/this._host.viewport.zoom;let h=o,u=s,b=r.x,f=r.y;switch(i){case"se":h=Math.max(this.MIN_FRAME_WIDTH,o+d),u=Math.max(this.MIN_FRAME_HEIGHT,s+p);break;case"sw":h=Math.max(this.MIN_FRAME_WIDTH,o-d),u=Math.max(this.MIN_FRAME_HEIGHT,s+p),b=r.x+(o-h);break;case"ne":h=Math.max(this.MIN_FRAME_WIDTH,o+d),u=Math.max(this.MIN_FRAME_HEIGHT,s-p),f=r.y+(s-u);break;case"nw":h=Math.max(this.MIN_FRAME_WIDTH,o-d),u=Math.max(this.MIN_FRAME_HEIGHT,s-p),b=r.x+(o-h),f=r.y+(s-u);break;case"n":u=Math.max(this.MIN_FRAME_HEIGHT,s-p),f=r.y+(s-u);break;case"s":u=Math.max(this.MIN_FRAME_HEIGHT,s+p);break;case"e":h=Math.max(this.MIN_FRAME_WIDTH,o+d);break;case"w":h=Math.max(this.MIN_FRAME_WIDTH,o-d),b=r.x+(o-h)}const g=this.snapToGrid(b,f);b=g.x,f=g.y,h=20*Math.round(h/20),u=20*Math.round(u/20),c.position={x:b,y:f},c.configuration=Object.assign(Object.assign({},c.configuration),{frameWidth:h,frameHeight:u}),this._host.requestUpdate()}isNodeInFrame(e,t){if(e.type===B.FRAME||e.type===B.NOTE)return!1;const i=t.configuration||{},n=i.frameWidth||400,a=i.frameHeight||300,o=t.position.x,s=t.position.y,r=o+n,l=s+a,c=e.position.x+90,d=e.position.y+40;return c>=o&&c<=r&&d>=s&&d<=l}updateFrameContainment(e){const t=[];for(const i of this._host.workflow.nodes)i.id!==e.id&&i.type!==B.FRAME&&(this.isNodeInFrame(i,e)?(t.push(i.id),i.parentFrameId=e.id):i.parentFrameId===e.id&&(i.parentFrameId=null));e.containedNodeIds=t}updateAllFrameContainments(e=!1){const t=this._host.workflow.nodes.filter(e=>e.type===B.FRAME);let i=!1;for(const e of t){const t=new Set(e.containedNodeIds||[]);this.updateFrameContainment(e);const n=new Set(e.containedNodeIds||[]);t.size===n.size&&[...t].every(e=>n.has(e))||(i=!0)}i&&e&&this._host.requestUpdate()}getContainedNodes(e){const t=new Set(e.containedNodeIds||[]);return this._host.workflow.nodes.filter(e=>t.has(e.id))}moveFrameWithContents(e,t,i){e.position.x+=t,e.position.y+=i;const n=this.getContainedNodes(e);for(const e of n)e.position.x+=t,e.position.y+=i}toggleCollapsed(e){const t=e.configuration||{},i=t.frameCollapsed;let n;n=i?Object.assign(Object.assign({},t),{frameWidth:t._frameExpandedWidth||400,frameHeight:t._frameExpandedHeight||300,frameCollapsed:!1}):Object.assign(Object.assign({},t),{_frameExpandedWidth:t.frameWidth,_frameExpandedHeight:t.frameHeight,frameCollapsed:!0});const a=!i,o=new Set(e.containedNodeIds||[]),s=this._host.workflow.nodes.map(t=>t.id===e.id?Object.assign(Object.assign({},t),{configuration:n,containedNodeIds:e.containedNodeIds}):o.has(t.id)?Object.assign(Object.assign({},t),{metadata:Object.assign(Object.assign({},t.metadata),{_hiddenByFrame:a})}):t),r=this._host.workflow.edges.map(e=>{const t=o.has(e.sourceNodeId),i=o.has(e.targetNodeId);return t&&i?Object.assign(Object.assign({},e),{_hiddenByFrame:a}):e});this._host.setWorkflow(Object.assign(Object.assign({},this._host.workflow),{nodes:s,edges:r})),this._host.dispatchWorkflowChanged()}setContainedNodesVisibility(e,t){const i=this.getContainedNodes(e);for(const e of i)e.metadata=e.metadata||{},e.metadata._hiddenByFrame=!t;const n=new Set(e.containedNodeIds||[]);for(const e of this._host.workflow.edges){const i=n.has(e.sourceNodeId),a=n.has(e.targetNodeId);i&&a&&(e._hiddenByFrame=!t)}}getAggregatedPorts(e){const t=new Set(e.containedNodeIds||[]),i=[],n=[];for(const e of this._host.workflow.edges){const a=t.has(e.sourceNodeId),o=t.has(e.targetNodeId);if(!a&&o){const t=this._host.workflow.nodes.find(t=>t.id===e.sourceNodeId);i.push({id:`agg-in-${e.id}`,originalEdgeId:e.id,internalNodeId:e.targetNodeId,internalPortId:e.targetPortId,label:(null==t?void 0:t.name)||"Input",direction:"incoming"})}if(a&&!o){const t=this._host.workflow.nodes.find(t=>t.id===e.targetNodeId);n.push({id:`agg-out-${e.id}`,originalEdgeId:e.id,internalNodeId:e.sourceNodeId,internalPortId:e.sourcePortId,label:(null==t?void 0:t.name)||"Output",direction:"outgoing"})}}return{inputs:i,outputs:n}}fitToContents(e,t=40){const i=this.getContainedNodes(e);if(0===i.length)return;let n=1/0,a=1/0,o=-1/0,s=-1/0;for(const e of i)n=Math.min(n,e.position.x),a=Math.min(a,e.position.y),o=Math.max(o,e.position.x+180),s=Math.max(s,e.position.y+80);const r=e.configuration||{},l=r.frameLabelPlacement||"outside";e.position={x:n-t,y:a-t-("outside"===l?24:0)},e.configuration=Object.assign(Object.assign({},r),{frameWidth:o-n+2*t,frameHeight:s-a+2*t+("outside"===l?24:0)}),this._host.requestUpdate(),this._host.dispatchWorkflowChanged()}createFrameFromSelection(){const e=this._host.workflow.nodes.filter(e=>this._host.selectedNodeIds.has(e.id)&&e.type!==B.FRAME&&e.type!==B.NOTE);if(0===e.length)return null;let t=1/0,i=1/0,n=-1/0,a=-1/0;for(const o of e)t=Math.min(t,o.position.x),i=Math.min(i,o.position.y),n=Math.max(n,o.position.x+180),a=Math.max(a,o.position.y+80);const o={id:`frame-${Date.now()}`,name:"Group",type:B.FRAME,position:{x:t-40,y:i-40-24},configuration:{frameLabel:"Group",frameWidth:n-t+80,frameHeight:a-i+80+24,frameBackgroundColor:"rgba(99, 102, 241, 0.05)",frameBorderColor:"rgba(99, 102, 241, 0.3)",frameLabelPosition:"top-left",frameLabelPlacement:"outside",frameShowLabel:!0,frameCollapsed:!1},ports:{inputs:[],outputs:[]},containedNodeIds:e.map(e=>e.id)},s=new Set(e.map(e=>e.id));return this._host.setWorkflow(Object.assign(Object.assign({},this._host.workflow),{nodes:[o,...this._host.workflow.nodes.map(e=>s.has(e.id)?Object.assign(Object.assign({},e),{parentFrameId:o.id}):e)]})),this._host.dispatchWorkflowChanged(),o}deleteFrame(e,t=!1){if(t){const t=new Set(e.containedNodeIds||[]);this._host.setWorkflow(Object.assign(Object.assign({},this._host.workflow),{edges:this._host.workflow.edges.filter(e=>!t.has(e.sourceNodeId)&&!t.has(e.targetNodeId)),nodes:this._host.workflow.nodes.filter(i=>i.id!==e.id&&!t.has(i.id))}))}else{const t=new Set(e.containedNodeIds||[]);this._host.setWorkflow(Object.assign(Object.assign({},this._host.workflow),{nodes:this._host.workflow.nodes.filter(t=>t.id!==e.id).map(e=>t.has(e.id)?Object.assign(Object.assign({},e),{parentFrameId:null}):e)}))}this._host.dispatchWorkflowChanged()}isFrameCollapsed(e){var t;return Boolean(null===(t=e.configuration)||void 0===t?void 0:t.frameCollapsed)}getContainedNodePreviews(e,t=5){return this.getContainedNodes(e).slice(0,t).map(e=>{var t,i;return{icon:(null===(t=e.metadata)||void 0===t?void 0:t.icon)||Q[e.type]||"box",color:(null===(i=e.metadata)||void 0===i?void 0:i.color)||Y[e.type]||"#3b82f6",name:e.name}})}}
3706
+ */class Oi extends yi{constructor(e){super(e),this.resizeState=null,this.MIN_FRAME_WIDTH=200,this.MIN_FRAME_HEIGHT=150,this.handleResizeDrag=e=>{this.handleResizeDragWithCoords(e.clientX,e.clientY)},this.handleResizeTouchDrag=e=>{e.preventDefault(),e.touches.length>0&&this.handleResizeDragWithCoords(e.touches[0].clientX,e.touches[0].clientY)},this.stopResize=()=>{if(!this.resizeState)return;const e=this._host.workflow.nodes.find(e=>e.id===this.resizeState.frameId);e&&this.updateFrameContainment(e),this.resizeState=null,document.removeEventListener("mousemove",this.handleResizeDrag),document.removeEventListener("mouseup",this.stopResize),document.removeEventListener("touchmove",this.handleResizeTouchDrag),document.removeEventListener("touchend",this.stopResizeTouch),this._host.dispatchWorkflowChanged()},this.stopResizeTouch=()=>{this.stopResize()}}startResize(e,t,i){e.stopPropagation(),e.preventDefault();const n=t.configuration||{};this.resizeState={frameId:t.id,handle:i,startX:e.clientX,startY:e.clientY,startWidth:n.frameWidth||400,startHeight:n.frameHeight||300,startPosition:Object.assign({},t.position)},document.addEventListener("mousemove",this.handleResizeDrag),document.addEventListener("mouseup",this.stopResize),document.addEventListener("touchmove",this.handleResizeTouchDrag,{passive:!1}),document.addEventListener("touchend",this.stopResizeTouch)}handleResizeDragWithCoords(e,t){if(!this.resizeState)return;const{handle:i,startX:n,startY:a,startWidth:o,startHeight:s,startPosition:r,frameId:l}=this.resizeState,c=this._host.workflow.nodes.find(e=>e.id===l);if(!c)return;const d=(e-n)/this._host.viewport.zoom,p=(t-a)/this._host.viewport.zoom;let h=o,u=s,b=r.x,f=r.y;switch(i){case"se":h=Math.max(this.MIN_FRAME_WIDTH,o+d),u=Math.max(this.MIN_FRAME_HEIGHT,s+p);break;case"sw":h=Math.max(this.MIN_FRAME_WIDTH,o-d),u=Math.max(this.MIN_FRAME_HEIGHT,s+p),b=r.x+(o-h);break;case"ne":h=Math.max(this.MIN_FRAME_WIDTH,o+d),u=Math.max(this.MIN_FRAME_HEIGHT,s-p),f=r.y+(s-u);break;case"nw":h=Math.max(this.MIN_FRAME_WIDTH,o-d),u=Math.max(this.MIN_FRAME_HEIGHT,s-p),b=r.x+(o-h),f=r.y+(s-u);break;case"n":u=Math.max(this.MIN_FRAME_HEIGHT,s-p),f=r.y+(s-u);break;case"s":u=Math.max(this.MIN_FRAME_HEIGHT,s+p);break;case"e":h=Math.max(this.MIN_FRAME_WIDTH,o+d);break;case"w":h=Math.max(this.MIN_FRAME_WIDTH,o-d),b=r.x+(o-h)}const g=this.snapToGrid(b,f);b=g.x,f=g.y,h=20*Math.round(h/20),u=20*Math.round(u/20),c.position={x:b,y:f},c.configuration=Object.assign(Object.assign({},c.configuration),{frameWidth:h,frameHeight:u}),this._host.requestUpdate()}isNodeInFrame(e,t){if(e.type===B.FRAME||e.type===B.NOTE)return!1;const i=t.configuration||{},n=i.frameWidth||400,a=i.frameHeight||300,o=t.position.x,s=t.position.y,r=o+n,l=s+a,c=e.position.x+90,d=e.position.y+40;return c>=o&&c<=r&&d>=s&&d<=l}updateFrameContainment(e){const t=[];for(const i of this._host.workflow.nodes)i.id!==e.id&&i.type!==B.FRAME&&(this.isNodeInFrame(i,e)?(t.push(i.id),i.parentFrameId=e.id):i.parentFrameId===e.id&&(i.parentFrameId=null));e.containedNodeIds=t}updateAllFrameContainments(e=!1){const t=this._host.workflow.nodes.filter(e=>e.type===B.FRAME);let i=!1;for(const e of t){const t=new Set(e.containedNodeIds||[]);this.updateFrameContainment(e);const n=new Set(e.containedNodeIds||[]);t.size===n.size&&[...t].every(e=>n.has(e))||(i=!0)}i&&e&&this._host.requestUpdate()}getContainedNodes(e){const t=new Set(e.containedNodeIds||[]);return this._host.workflow.nodes.filter(e=>t.has(e.id))}moveFrameWithContents(e,t,i){e.position.x+=t,e.position.y+=i;const n=this.getContainedNodes(e);for(const e of n)e.position.x+=t,e.position.y+=i}toggleCollapsed(e){const t=e.configuration||{},i=t.frameCollapsed;let n;n=i?Object.assign(Object.assign({},t),{frameWidth:t._frameExpandedWidth||400,frameHeight:t._frameExpandedHeight||300,frameCollapsed:!1}):Object.assign(Object.assign({},t),{_frameExpandedWidth:t.frameWidth,_frameExpandedHeight:t.frameHeight,frameCollapsed:!0});const a=!i,o=new Set(e.containedNodeIds||[]),s=this._host.workflow.nodes.map(t=>t.id===e.id?Object.assign(Object.assign({},t),{configuration:n,containedNodeIds:e.containedNodeIds}):o.has(t.id)?Object.assign(Object.assign({},t),{metadata:Object.assign(Object.assign({},t.metadata),{_hiddenByFrame:a})}):t),r=this._host.workflow.edges.map(e=>{const t=o.has(e.sourceNodeId),i=o.has(e.targetNodeId);return t&&i?Object.assign(Object.assign({},e),{_hiddenByFrame:a}):e});this._host.setWorkflow(Object.assign(Object.assign({},this._host.workflow),{nodes:s,edges:r})),this._host.dispatchWorkflowChanged()}setContainedNodesVisibility(e,t){const i=this.getContainedNodes(e);for(const e of i)e.metadata=e.metadata||{},e.metadata._hiddenByFrame=!t;const n=new Set(e.containedNodeIds||[]);for(const e of this._host.workflow.edges){const i=n.has(e.sourceNodeId),a=n.has(e.targetNodeId);i&&a&&(e._hiddenByFrame=!t)}}getAggregatedPorts(e){const t=new Set(e.containedNodeIds||[]),i=[],n=[];for(const e of this._host.workflow.edges){const a=t.has(e.sourceNodeId),o=t.has(e.targetNodeId);if(!a&&o){const t=this._host.workflow.nodes.find(t=>t.id===e.sourceNodeId);i.push({id:`agg-in-${e.id}`,originalEdgeId:e.id,internalNodeId:e.targetNodeId,internalPortId:e.targetPortId,label:(null==t?void 0:t.name)||"Input",direction:"incoming"})}if(a&&!o){const t=this._host.workflow.nodes.find(t=>t.id===e.targetNodeId);n.push({id:`agg-out-${e.id}`,originalEdgeId:e.id,internalNodeId:e.sourceNodeId,internalPortId:e.sourcePortId,label:(null==t?void 0:t.name)||"Output",direction:"outgoing"})}}return{inputs:i,outputs:n}}fitToContents(e,t=40){const i=this.getContainedNodes(e);if(0===i.length)return;let n=1/0,a=1/0,o=-1/0,s=-1/0;for(const e of i)n=Math.min(n,e.position.x),a=Math.min(a,e.position.y),o=Math.max(o,e.position.x+180),s=Math.max(s,e.position.y+80);const r=e.configuration||{},l=r.frameLabelPlacement||"outside";e.position={x:n-t,y:a-t-("outside"===l?24:0)},e.configuration=Object.assign(Object.assign({},r),{frameWidth:o-n+2*t,frameHeight:s-a+2*t+("outside"===l?24:0)}),this._host.requestUpdate(),this._host.dispatchWorkflowChanged()}createFrameFromSelection(){const e=this._host.workflow.nodes.filter(e=>this._host.selectedNodeIds.has(e.id)&&e.type!==B.FRAME&&e.type!==B.NOTE);if(0===e.length)return null;let t=1/0,i=1/0,n=-1/0,a=-1/0;for(const o of e)t=Math.min(t,o.position.x),i=Math.min(i,o.position.y),n=Math.max(n,o.position.x+180),a=Math.max(a,o.position.y+80);const o={id:`frame-${Date.now()}`,name:"Group",type:B.FRAME,position:{x:t-40,y:i-40-24},configuration:{frameLabel:"Group",frameWidth:n-t+80,frameHeight:a-i+80+24,frameBackgroundColor:"rgba(99, 102, 241, 0.05)",frameBorderColor:"rgba(99, 102, 241, 0.3)",frameLabelPosition:"top-left",frameLabelPlacement:"outside",frameShowLabel:!0,frameCollapsed:!1},ports:{inputs:[],outputs:[]},containedNodeIds:e.map(e=>e.id)},s=new Set(e.map(e=>e.id));return this._host.setWorkflow(Object.assign(Object.assign({},this._host.workflow),{nodes:[o,...this._host.workflow.nodes.map(e=>s.has(e.id)?Object.assign(Object.assign({},e),{parentFrameId:o.id}):e)]})),this._host.dispatchWorkflowChanged(),o}deleteFrame(e,t=!1){if(t){const t=new Set(e.containedNodeIds||[]);this._host.setWorkflow(Object.assign(Object.assign({},this._host.workflow),{edges:this._host.workflow.edges.filter(e=>!t.has(e.sourceNodeId)&&!t.has(e.targetNodeId)),nodes:this._host.workflow.nodes.filter(i=>i.id!==e.id&&!t.has(i.id))}))}else{const t=new Set(e.containedNodeIds||[]);this._host.setWorkflow(Object.assign(Object.assign({},this._host.workflow),{nodes:this._host.workflow.nodes.filter(t=>t.id!==e.id).map(e=>t.has(e.id)?Object.assign(Object.assign({},e),{parentFrameId:null}):e)}))}this._host.dispatchWorkflowChanged()}isFrameCollapsed(e){var t;return Boolean(null===(t=e.configuration)||void 0===t?void 0:t.frameCollapsed)}getContainedNodePreviews(e,t=5){return this.getContainedNodes(e).slice(0,t).map(e=>{var t,i;return{icon:(null===(t=e.metadata)||void 0===t?void 0:t.icon)||Q[e.type]||"box",color:(null===(i=e.metadata)||void 0===i?void 0:i.color)||Y[e.type]||"#3b82f6",name:e.name}})}}
3707
3707
  /**
3708
3708
  * @license
3709
3709
  * Copyright 2024 Nuraly, Laabidi Aymen
@@ -5550,7 +5550,7 @@ const wn=e`
5550
5550
  </div>
5551
5551
  ${this.description?i`<span class="field-description">${this.description}</span>`:n}
5552
5552
  </div>
5553
- `}};Mn.useShadowDom=!0,Mn.styles=wn,Tn([o({type:Array})],Mn.prototype,"value",void 0),Tn([o({type:Boolean})],Mn.prototype,"disabled",void 0),Tn([o({type:String})],Mn.prototype,"label",void 0),Tn([o({type:String})],Mn.prototype,"description",void 0),Mn=Tn([r("nr-trigger-event-select")],Mn);let zn=class extends(we(t)){constructor(){super(...arguments),this.requiredComponents=["nr-icon"],this.value="medium",this.disabled=!1,this.label="",this.sizes=[{value:"small",label:"Small",icon:"minimize-2"},{value:"medium",label:"Medium",icon:"square"},{value:"large",label:"Large",icon:"maximize-2"},{value:"full",label:"Full",icon:"expand"}]}selectSize(e){this.disabled||(this.value=e,this.dispatchEvent(new CustomEvent("value-change",{detail:{value:this.value},bubbles:!0,composed:!0})))}render(){return i`
5553
+ `}};Mn.useShadowDom=!0,Mn.styles=wn,Tn([o({type:Array})],Mn.prototype,"value",void 0),Tn([o({type:Boolean})],Mn.prototype,"disabled",void 0),Tn([o({type:String})],Mn.prototype,"label",void 0),Tn([o({type:String})],Mn.prototype,"description",void 0),Mn=Tn([r("nr-trigger-event-select")],Mn);let En=class extends(we(t)){constructor(){super(...arguments),this.requiredComponents=["nr-icon"],this.value="medium",this.disabled=!1,this.label="",this.sizes=[{value:"small",label:"Small",icon:"minimize-2"},{value:"medium",label:"Medium",icon:"square"},{value:"large",label:"Large",icon:"maximize-2"},{value:"full",label:"Full",icon:"expand"}]}selectSize(e){this.disabled||(this.value=e,this.dispatchEvent(new CustomEvent("value-change",{detail:{value:this.value},bubbles:!0,composed:!0})))}render(){return i`
5554
5554
  <div class="field-container">
5555
5555
  ${this.label?i`<label class="field-label">${this.label}</label>`:n}
5556
5556
  <div class="option-grid">
@@ -5565,7 +5565,7 @@ const wn=e`
5565
5565
  `)}
5566
5566
  </div>
5567
5567
  </div>
5568
- `}};zn.useShadowDom=!0,zn.styles=wn,Tn([o({type:String})],zn.prototype,"value",void 0),Tn([o({type:Boolean})],zn.prototype,"disabled",void 0),Tn([o({type:String})],zn.prototype,"label",void 0),zn=Tn([r("nr-chatbot-size-select")],zn);let En=class extends(we(t)){constructor(){super(...arguments),this.requiredComponents=["nr-icon"],this.value="default",this.disabled=!1,this.label="",this.variants=[{value:"default",label:"Default",icon:"layout"},{value:"minimal",label:"Minimal",icon:"minus-square"},{value:"rounded",label:"Rounded",icon:"circle"},{value:"chatgpt",label:"ChatGPT",icon:"message-circle"}]}selectVariant(e){this.disabled||(this.value=e,this.dispatchEvent(new CustomEvent("value-change",{detail:{value:this.value},bubbles:!0,composed:!0})))}render(){return i`
5568
+ `}};En.useShadowDom=!0,En.styles=wn,Tn([o({type:String})],En.prototype,"value",void 0),Tn([o({type:Boolean})],En.prototype,"disabled",void 0),Tn([o({type:String})],En.prototype,"label",void 0),En=Tn([r("nr-chatbot-size-select")],En);let zn=class extends(we(t)){constructor(){super(...arguments),this.requiredComponents=["nr-icon"],this.value="default",this.disabled=!1,this.label="",this.variants=[{value:"default",label:"Default",icon:"layout"},{value:"minimal",label:"Minimal",icon:"minus-square"},{value:"rounded",label:"Rounded",icon:"circle"},{value:"chatgpt",label:"ChatGPT",icon:"message-circle"}]}selectVariant(e){this.disabled||(this.value=e,this.dispatchEvent(new CustomEvent("value-change",{detail:{value:this.value},bubbles:!0,composed:!0})))}render(){return i`
5569
5569
  <div class="field-container">
5570
5570
  ${this.label?i`<label class="field-label">${this.label}</label>`:n}
5571
5571
  <div class="option-grid">
@@ -5580,7 +5580,7 @@ const wn=e`
5580
5580
  `)}
5581
5581
  </div>
5582
5582
  </div>
5583
- `}};En.useShadowDom=!0,En.styles=wn,Tn([o({type:String})],En.prototype,"value",void 0),Tn([o({type:Boolean})],En.prototype,"disabled",void 0),Tn([o({type:String})],En.prototype,"label",void 0),En=Tn([r("nr-chatbot-variant-select")],En);let On=class extends(we(t)){constructor(){super(...arguments),this.value=!1,this.disabled=!1,this.label="",this.description=""}toggle(){this.disabled||(this.value=!this.value,this.dispatchEvent(new CustomEvent("value-change",{detail:{value:this.value},bubbles:!0,composed:!0})))}render(){return i`
5583
+ `}};zn.useShadowDom=!0,zn.styles=wn,Tn([o({type:String})],zn.prototype,"value",void 0),Tn([o({type:Boolean})],zn.prototype,"disabled",void 0),Tn([o({type:String})],zn.prototype,"label",void 0),zn=Tn([r("nr-chatbot-variant-select")],zn);let An=class extends(we(t)){constructor(){super(...arguments),this.value=!1,this.disabled=!1,this.label="",this.description=""}toggle(){this.disabled||(this.value=!this.value,this.dispatchEvent(new CustomEvent("value-change",{detail:{value:this.value},bubbles:!0,composed:!0})))}render(){return i`
5584
5584
  <div class="toggle-container" @click=${this.toggle}>
5585
5585
  <div class="toggle-label">
5586
5586
  <span class="toggle-label-text">${this.label}</span>
@@ -5590,7 +5590,7 @@ const wn=e`
5590
5590
  <div class="toggle-switch-knob"></div>
5591
5591
  </div>
5592
5592
  </div>
5593
- `}};On.useShadowDom=!0,On.styles=wn,Tn([o({type:Boolean})],On.prototype,"value",void 0),Tn([o({type:Boolean})],On.prototype,"disabled",void 0),Tn([o({type:String})],On.prototype,"label",void 0),Tn([o({type:String})],On.prototype,"description",void 0),On=Tn([r("nr-feature-toggle")],On);let An=class extends(we(t)){constructor(){super(...arguments),this.requiredComponents=["nr-input","nr-icon"],this.value=[],this.disabled=!1,this.label="",this.description=""}updateValue(e){this.value=e,this.dispatchEvent(new CustomEvent("value-change",{detail:{value:this.value},bubbles:!0,composed:!0}))}addSuggestion(){const e={id:`suggestion_${Date.now()}`,text:"",icon:"zap"};this.updateValue([...this.value,e])}removeSuggestion(e){this.updateValue(this.value.filter(t=>t.id!==e))}updateSuggestion(e,t){this.updateValue(this.value.map(i=>i.id===e?Object.assign(Object.assign({},i),t):i))}render(){return i`
5593
+ `}};An.useShadowDom=!0,An.styles=wn,Tn([o({type:Boolean})],An.prototype,"value",void 0),Tn([o({type:Boolean})],An.prototype,"disabled",void 0),Tn([o({type:String})],An.prototype,"label",void 0),Tn([o({type:String})],An.prototype,"description",void 0),An=Tn([r("nr-feature-toggle")],An);let On=class extends(we(t)){constructor(){super(...arguments),this.requiredComponents=["nr-input","nr-icon"],this.value=[],this.disabled=!1,this.label="",this.description=""}updateValue(e){this.value=e,this.dispatchEvent(new CustomEvent("value-change",{detail:{value:this.value},bubbles:!0,composed:!0}))}addSuggestion(){const e={id:`suggestion_${Date.now()}`,text:"",icon:"zap"};this.updateValue([...this.value,e])}removeSuggestion(e){this.updateValue(this.value.filter(t=>t.id!==e))}updateSuggestion(e,t){this.updateValue(this.value.map(i=>i.id===e?Object.assign(Object.assign({},i),t):i))}render(){return i`
5594
5594
  <div class="field-container">
5595
5595
  ${this.label?i`<label class="field-label">${this.label}</label>`:n}
5596
5596
  <div class="suggestion-list">
@@ -5635,7 +5635,7 @@ const wn=e`
5635
5635
  </div>
5636
5636
  ${this.description?i`<span class="field-description">${this.description}</span>`:n}
5637
5637
  </div>
5638
- `}};An.useShadowDom=!0,An.styles=wn,Tn([o({type:Array})],An.prototype,"value",void 0),Tn([o({type:Boolean})],An.prototype,"disabled",void 0),Tn([o({type:String})],An.prototype,"label",void 0),Tn([o({type:String})],An.prototype,"description",void 0),An=Tn([r("nr-suggestion-list")],An);let In=class extends(we(t)){constructor(){super(...arguments),this.requiredComponents=["nr-icon"],this.size="medium",this.variant="default",this.placeholder="Type your message...",this.triggerEvents=[]}render(){var e;const t=this.triggerEvents.length,n=0===t?"No triggers configured":1===t?`Triggers on: ${null===(e=kn.find(e=>e.value===this.triggerEvents[0]))||void 0===e?void 0:e.label}`:`Triggers on ${t} events`;return i`
5638
+ `}};On.useShadowDom=!0,On.styles=wn,Tn([o({type:Array})],On.prototype,"value",void 0),Tn([o({type:Boolean})],On.prototype,"disabled",void 0),Tn([o({type:String})],On.prototype,"label",void 0),Tn([o({type:String})],On.prototype,"description",void 0),On=Tn([r("nr-suggestion-list")],On);let In=class extends(we(t)){constructor(){super(...arguments),this.requiredComponents=["nr-icon"],this.size="medium",this.variant="default",this.placeholder="Type your message...",this.triggerEvents=[]}render(){var e;const t=this.triggerEvents.length,n=0===t?"No triggers configured":1===t?`Triggers on: ${null===(e=kn.find(e=>e.value===this.triggerEvents[0]))||void 0===e?void 0:e.label}`:`Triggers on ${t} events`;return i`
5639
5639
  <div class="chatbot-preview">
5640
5640
  <div class="chatbot-preview-icon">
5641
5641
  <nr-icon name="message-square" size="large"></nr-icon>
@@ -6238,7 +6238,127 @@ function jn(e,t){const i=document.createElement(e);return i.style.cssText=t,i}fu
6238
6238
  * @license
6239
6239
  * Copyright 2024 Nuraly, Laabidi Aymen
6240
6240
  * SPDX-License-Identifier: MIT
6241
- */function Kn(e,t,n,a){const o="html"===e.bodyType,s=(n||[]).filter(e=>e.keyPath.startsWith("smtp/"));return i`
6241
+ */function Kn(e,t){const n=Array.isArray(e.cases)?e.cases:[],a=(e,i)=>{const a=n.map((t,n)=>n===e?Object.assign(Object.assign({},t),i):t);t("cases",a)};return i`
6242
+ <div class="config-field">
6243
+ <label>Expression</label>
6244
+ <nr-input
6245
+ .value=${String(e.expression||"")}
6246
+ placeholder="\${input.status}"
6247
+ @nr-input=${e=>t("expression",e.detail.value)}
6248
+ ></nr-input>
6249
+ <small class="field-hint">Value to match against each case</small>
6250
+ </div>
6251
+
6252
+ <div class="config-field">
6253
+ <label>Language</label>
6254
+ <nr-select
6255
+ .value=${e.language||"javascript"}
6256
+ .options=${[{label:"JavaScript",value:"javascript"},{label:"JSONata",value:"jsonata"}]}
6257
+ @nr-change=${e=>t("language",e.detail.value)}
6258
+ ></nr-select>
6259
+ </div>
6260
+
6261
+ <div class="config-field">
6262
+ <label>Cases</label>
6263
+ ${n.map((e,o)=>i`
6264
+ <div class="condition-row">
6265
+ <nr-input
6266
+ .value=${e.value||""}
6267
+ placeholder="match value"
6268
+ @nr-input=${e=>a(o,{value:e.detail.value})}
6269
+ ></nr-input>
6270
+ <nr-input
6271
+ .value=${e.label||""}
6272
+ placeholder="port label"
6273
+ @nr-input=${e=>a(o,{label:e.detail.value})}
6274
+ ></nr-input>
6275
+ <nr-button size="small" type="text" @click=${()=>(e=>{t("cases",n.filter((t,i)=>i!==e))})(o)}>
6276
+ <nr-icon name="trash-2" size="small"></nr-icon>
6277
+ </nr-button>
6278
+ </div>
6279
+ `)}
6280
+ <nr-button size="small" type="dashed" @click=${()=>{const e=[...n,{value:`case${n.length+1}`,label:`Case ${n.length+1}`}];t("cases",e)}}>
6281
+ <nr-icon name="plus" size="small"></nr-icon>
6282
+ Add Case
6283
+ </nr-button>
6284
+ <small class="field-hint">Edit node ports to wire each case to a downstream branch</small>
6285
+ </div>
6286
+
6287
+ <div class="config-field">
6288
+ <label class="checkbox-label">
6289
+ <nr-checkbox
6290
+ ?checked=${!1!==e.includeDefault}
6291
+ @nr-change=${e=>t("includeDefault",e.detail.checked)}
6292
+ ></nr-checkbox>
6293
+ Include Default Branch
6294
+ </label>
6295
+ <small class="field-hint">Adds a fallback path when no case matches</small>
6296
+ </div>
6297
+ `}
6298
+ /**
6299
+ * @license
6300
+ * Copyright 2024 Nuraly, Laabidi Aymen
6301
+ * SPDX-License-Identifier: MIT
6302
+ */
6303
+ /**
6304
+ * @license
6305
+ * Copyright 2024 Nuraly, Laabidi Aymen
6306
+ * SPDX-License-Identifier: MIT
6307
+ */
6308
+ var Gn=function(e,t,i,n){return new(i||(i=Promise))(function(a,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function r(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?a(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(s,r)}l((n=n.apply(e,t||[])).next())})};const Jn='{\n "arrayExpression": "${variables.users}",\n "iteratorVariable": "user",\n "maxIterations": 1000,\n "batchSize": 1,\n "continueOnError": true,\n "iterationDelay": 200\n}';
6309
+ /**
6310
+ * @license
6311
+ * Copyright 2024 Nuraly, Laabidi Aymen
6312
+ * SPDX-License-Identifier: MIT
6313
+ */
6314
+ function Yn(e,t){var n;const a=Array.isArray(e.catchTypes)?e.catchTypes:["*"];return i`
6315
+ <div class="config-field">
6316
+ <label>Catch Error Types</label>
6317
+ <nr-input
6318
+ .value=${a.join(", ")}
6319
+ placeholder="* (all) or HttpError, TimeoutError"
6320
+ @nr-input=${e=>(e=>{const i=e.split(",").map(e=>e.trim()).filter(Boolean);t("catchTypes",i.length>0?i:["*"])})(e.detail.value)}
6321
+ ></nr-input>
6322
+ <small class="field-hint">Comma-separated list. Use <code>*</code> to catch every error</small>
6323
+ </div>
6324
+
6325
+ <div class="config-field">
6326
+ <label>Error Variable</label>
6327
+ <nr-input
6328
+ .value=${String(e.errorVariable||"error")}
6329
+ placeholder="error"
6330
+ @nr-input=${e=>t("errorVariable",e.detail.value)}
6331
+ ></nr-input>
6332
+ <small class="field-hint">Variable holding the caught error in the Catch branch</small>
6333
+ </div>
6334
+
6335
+ <div class="config-field">
6336
+ <label class="checkbox-label">
6337
+ <nr-checkbox
6338
+ ?checked=${e.rethrowAfterCatch||!1}
6339
+ @nr-change=${e=>t("rethrowAfterCatch",e.detail.checked)}
6340
+ ></nr-checkbox>
6341
+ Rethrow After Catch
6342
+ </label>
6343
+ <small class="field-hint">Re-raise the error once the Catch branch completes</small>
6344
+ </div>
6345
+
6346
+ <div class="config-field">
6347
+ <label>Max Retries</label>
6348
+ <nr-input
6349
+ type="number"
6350
+ .value=${String(null!==(n=e.maxRetries)&&void 0!==n?n:0)}
6351
+ min="0"
6352
+ @nr-input=${e=>t("maxRetries",Number.parseInt(e.detail.value)||0)}
6353
+ ></nr-input>
6354
+ <small class="field-hint">Retry the Try branch this many times before catching</small>
6355
+ </div>
6356
+ `}
6357
+ /**
6358
+ * @license
6359
+ * Copyright 2024 Nuraly, Laabidi Aymen
6360
+ * SPDX-License-Identifier: MIT
6361
+ */function Qn(e,t,n,a){const o="html"===e.bodyType,s=(n||[]).filter(e=>e.keyPath.startsWith("smtp/"));return i`
6242
6362
  <style>
6243
6363
  .email-body-wrapper {
6244
6364
  position: relative;
@@ -6404,19 +6524,19 @@ function(e,t){const i=document.querySelector("#email-body-modal");null==i||i.rem
6404
6524
  * @license
6405
6525
  * Copyright 2024 Nuraly, Laabidi Aymen
6406
6526
  * SPDX-License-Identifier: MIT
6407
- */const Gn={imap:{host:"",port:993,tls:!0},gmail:{host:"imap.gmail.com",port:993,tls:!0},outlook:{host:"outlook.office365.com",port:993,tls:!0},yahoo:{host:"imap.mail.yahoo.com",port:993,tls:!0}};
6527
+ */const Zn={imap:{host:"",port:993,tls:!0},gmail:{host:"imap.gmail.com",port:993,tls:!0},outlook:{host:"outlook.office365.com",port:993,tls:!0},yahoo:{host:"imap.mail.yahoo.com",port:993,tls:!0}};
6408
6528
  /**
6409
6529
  * @license
6410
6530
  * Copyright 2024 Nuraly, Laabidi Aymen
6411
6531
  * SPDX-License-Identifier: MIT
6412
6532
  */
6413
- const Jn=[{value:"mail",label:"Mail"},{value:"contact",label:"Contact"},{value:"list",label:"List"}],Yn=[{value:"send_email",label:"Send Email"},{value:"send_template",label:"Send Template Email"}],Qn=[{value:"add_contact",label:"Create/Update Contact"},{value:"remove_contact",label:"Delete Contact"},{value:"get_contact",label:"Get Contact"},{value:"get_all_contacts",label:"Get All Contacts"}],Zn=[{value:"create_list",label:"Create List"},{value:"delete_list",label:"Delete List"},{value:"get_list",label:"Get List"},{value:"get_all_lists",label:"Get All Lists"},{value:"update_list",label:"Update List"}];
6533
+ const Xn=[{value:"mail",label:"Mail"},{value:"contact",label:"Contact"},{value:"list",label:"List"}],ea=[{value:"send_email",label:"Send Email"},{value:"send_template",label:"Send Template Email"}],ta=[{value:"add_contact",label:"Create/Update Contact"},{value:"remove_contact",label:"Delete Contact"},{value:"get_contact",label:"Get Contact"},{value:"get_all_contacts",label:"Get All Contacts"}],ia=[{value:"create_list",label:"Create List"},{value:"delete_list",label:"Delete List"},{value:"get_list",label:"Get List"},{value:"get_all_lists",label:"Get All Lists"},{value:"update_list",label:"Update List"}];
6414
6534
  /**
6415
6535
  * @license
6416
6536
  * Copyright 2024 Nuraly, Laabidi Aymen
6417
6537
  * SPDX-License-Identifier: MIT
6418
6538
  */
6419
- function Xn(e,t){const n=[];if(e.data&&"object"==typeof e.data)for(const[t,i]of Object.entries(e.data))n.push({key:t,value:String(null!=i?i:"")});const a=(e,i,a)=>{const o=[...n];o[e]=Object.assign(Object.assign({},o[e]),{[i]:a});const s={};for(const e of o)e.key&&(s[e.key]=e.value);t("data",s)};return i`
6539
+ function na(e,t){const n=[];if(e.data&&"object"==typeof e.data)for(const[t,i]of Object.entries(e.data))n.push({key:t,value:String(null!=i?i:"")});const a=(e,i,a)=>{const o=[...n];o[e]=Object.assign(Object.assign({},o[e]),{[i]:a});const s={};for(const e of o)e.key&&(s[e.key]=e.value);t("data",s)};return i`
6420
6540
  <div class="config-section">
6421
6541
  <div class="config-section-header">
6422
6542
  <span class="config-section-title">Template</span>
@@ -6490,7 +6610,7 @@ function Xn(e,t){const n=[];if(e.data&&"object"==typeof e.data)for(const[t,i]of
6490
6610
  <small class="field-hint">Access via \${variables.documentResult.fileUrl}</small>
6491
6611
  </div>
6492
6612
  </div>
6493
- `}const ea=e`
6613
+ `}const aa=e`
6494
6614
  :host {
6495
6615
  display: block;
6496
6616
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
@@ -6860,7 +6980,7 @@ function Xn(e,t){const n=[];if(e.data&&"object"==typeof e.data)for(const[t,i]of
6860
6980
  font-size: 16px;
6861
6981
  }
6862
6982
  }
6863
- `,ta={isImageFile:e=>e.type.startsWith("image/"),formatFileSize(e){if(0===e)return"0 B";const t=Math.floor(Math.log(e)/Math.log(1024));return Number.parseFloat((e/Math.pow(1024,t)).toFixed(2))+" "+["B","KB","MB","GB","TB"][t]},createFilePreview:e=>new Promise(t=>{const i=new FileReader;i.onload=e=>{var i;t(null===(i=e.target)||void 0===i?void 0:i.result)},i.readAsDataURL(e)})};var ia=function(e,t,i,n){for(var a,o=arguments.length,s=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n,r=e.length-1;r>=0;r--)(a=e[r])&&(s=(o<3?a(s):o>3?a(t,i,s):a(t,i))||s);return o>3&&s&&Object.defineProperty(t,i,s),s},na=function(e,t,i,n){return new(i||(i=Promise))(function(a,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function r(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?a(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(s,r)}l((n=n.apply(e,t||[])).next())})};let aa=class extends(we(t)){constructor(){super(...arguments),this.accept="",this.multiple=!1,this.drag=!0,this.tip="",this.limit=0,this.preview=!0,this.generatePreviewOnUpload=!1,this.fileList=[],this.isDragOver=!1,this.showDragArea=!1,this.inputElement=null,this.dragCounter=0,this.previewImage=null,this._onDocumentDragEnter=e=>{e.preventDefault(),this.dragCounter++,1===this.dragCounter&&(this.showDragArea=!0)},this._onDocumentDragLeave=e=>{e.preventDefault(),this.dragCounter--,0===this.dragCounter&&(this.showDragArea=!1,this.isDragOver=!1)},this._onDocumentDrop=e=>{e.target===this||this.contains(e.target)||(e.preventDefault(),this.dragCounter=0,this.showDragArea=!1,this.isDragOver=!1)},this._onDocumentDragOver=e=>{e.preventDefault();const t=e.composedPath().includes(this);this.isDragOver=!!t},this._onDrop=e=>{var t;e.preventDefault(),e.stopPropagation(),this.dragCounter=0,this.isDragOver=!1,this.showDragArea=!1,(null===(t=e.dataTransfer)||void 0===t?void 0:t.files)&&(this.dispatchEvent(new CustomEvent("files-changed",{detail:e.dataTransfer.files,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("file-drop",{detail:{files:e.dataTransfer.files},bubbles:!0,composed:!0})),this._handleFiles(e.dataTransfer.files))},this._onClick=()=>{var e;null===(e=this.inputElement)||void 0===e||e.click()},this._onChange=e=>{const t=e.target;t.files&&(this.dispatchEvent(new CustomEvent("files-changed",{detail:t.files,bubbles:!0,composed:!0})),this._handleFiles(t.files),t.value="")}}connectedCallback(){super.connectedCallback(),this._updateThemeAttribute(),this.drag&&(document.addEventListener("dragenter",this._onDocumentDragEnter),document.addEventListener("dragleave",this._onDocumentDragLeave),document.addEventListener("drop",this._onDocumentDrop),document.addEventListener("dragover",this._onDocumentDragOver))}updated(e){super.updated(e),this._updateThemeAttribute()}_updateThemeAttribute(){const e=this.explicitTheme;e?this.setAttribute("data-theme",e):this.removeAttribute("data-theme")}disconnectedCallback(){super.disconnectedCallback(),this.drag&&(document.removeEventListener("dragenter",this._onDocumentDragEnter),document.removeEventListener("dragleave",this._onDocumentDragLeave),document.removeEventListener("drop",this._onDocumentDrop),document.removeEventListener("dragover",this._onDocumentDragOver))}firstUpdated(e){var t;super.firstUpdated(e),this.inputElement=(null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector('input[type="file"]'))||null}_handleFiles(e){return na(this,void 0,void 0,function*(){if(this.multiple&&this.limit>0&&this.fileList.length+e.length>this.limit)return void this._dispatchEvent("exceed",{files:e});if(!this.multiple&&e.length>0){const t=e[e.length-1];this.previewImage&&this.fileList.some(e=>e.url===this.previewImage)&&(this.previewImage=null);const i=[...this.fileList];for(const e of i)this._dispatchEvent("remove",{file:e});this.fileList=[];const n=ta.isImageFile(t),a={name:t.name,size:ta.formatFileSize(t.size),raw:t,status:"ready",percentage:0,uid:Date.now()+Math.random().toString(36).substring(2),isImage:n};return this.preview&&this.generatePreviewOnUpload&&n&&(a.url=yield ta.createFilePreview(t)),this.fileList=[a],this.requestUpdate(),void this._dispatchEvent("select",{files:[a],fileList:this.fileList})}const t=[];for(const i of Array.from(e)){const e=ta.isImageFile(i),n={name:i.name,size:ta.formatFileSize(i.size),raw:i,status:"ready",percentage:0,uid:Date.now()+Math.random().toString(36).substring(2),isImage:e};this.preview&&this.generatePreviewOnUpload&&e&&(n.url=yield ta.createFilePreview(i)),this.fileList=[...this.fileList,n],t.push(n)}this.requestUpdate(),this._dispatchEvent("select",{files:t,fileList:this.fileList})})}updateFileStatus(e,t,i){const n=this.fileList.find(t=>t.uid===e);n&&(n.status=t,void 0!==i&&(n.percentage=i),this._updateFile(n))}_updateFile(e){this.fileList=this.fileList.map(t=>t.uid===e.uid?e:t),this.requestUpdate()}_removeFile(e){const t=this.fileList.find(t=>t.uid===e);this.fileList=this.fileList.filter(t=>t.uid!==e),t&&this._dispatchEvent("remove",{file:t}),this.requestUpdate()}_dispatchEvent(e,t){this.dispatchEvent(new CustomEvent(`file-${e}`,{detail:t,bubbles:!0,composed:!0}))}_showPreview(e){this.previewImage=e}_closePreview(){this.previewImage=null}render(){return i`
6983
+ `,oa={isImageFile:e=>e.type.startsWith("image/"),formatFileSize(e){if(0===e)return"0 B";const t=Math.floor(Math.log(e)/Math.log(1024));return Number.parseFloat((e/Math.pow(1024,t)).toFixed(2))+" "+["B","KB","MB","GB","TB"][t]},createFilePreview:e=>new Promise(t=>{const i=new FileReader;i.onload=e=>{var i;t(null===(i=e.target)||void 0===i?void 0:i.result)},i.readAsDataURL(e)})};var sa=function(e,t,i,n){for(var a,o=arguments.length,s=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n,r=e.length-1;r>=0;r--)(a=e[r])&&(s=(o<3?a(s):o>3?a(t,i,s):a(t,i))||s);return o>3&&s&&Object.defineProperty(t,i,s),s},ra=function(e,t,i,n){return new(i||(i=Promise))(function(a,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function r(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?a(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(s,r)}l((n=n.apply(e,t||[])).next())})};let la=class extends(we(t)){constructor(){super(...arguments),this.accept="",this.multiple=!1,this.drag=!0,this.tip="",this.limit=0,this.preview=!0,this.generatePreviewOnUpload=!1,this.fileList=[],this.isDragOver=!1,this.showDragArea=!1,this.inputElement=null,this.dragCounter=0,this.previewImage=null,this._onDocumentDragEnter=e=>{e.preventDefault(),this.dragCounter++,1===this.dragCounter&&(this.showDragArea=!0)},this._onDocumentDragLeave=e=>{e.preventDefault(),this.dragCounter--,0===this.dragCounter&&(this.showDragArea=!1,this.isDragOver=!1)},this._onDocumentDrop=e=>{e.target===this||this.contains(e.target)||(e.preventDefault(),this.dragCounter=0,this.showDragArea=!1,this.isDragOver=!1)},this._onDocumentDragOver=e=>{e.preventDefault();const t=e.composedPath().includes(this);this.isDragOver=!!t},this._onDrop=e=>{var t;e.preventDefault(),e.stopPropagation(),this.dragCounter=0,this.isDragOver=!1,this.showDragArea=!1,(null===(t=e.dataTransfer)||void 0===t?void 0:t.files)&&(this.dispatchEvent(new CustomEvent("files-changed",{detail:e.dataTransfer.files,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("file-drop",{detail:{files:e.dataTransfer.files},bubbles:!0,composed:!0})),this._handleFiles(e.dataTransfer.files))},this._onClick=()=>{var e;null===(e=this.inputElement)||void 0===e||e.click()},this._onChange=e=>{const t=e.target;t.files&&(this.dispatchEvent(new CustomEvent("files-changed",{detail:t.files,bubbles:!0,composed:!0})),this._handleFiles(t.files),t.value="")}}connectedCallback(){super.connectedCallback(),this._updateThemeAttribute(),this.drag&&(document.addEventListener("dragenter",this._onDocumentDragEnter),document.addEventListener("dragleave",this._onDocumentDragLeave),document.addEventListener("drop",this._onDocumentDrop),document.addEventListener("dragover",this._onDocumentDragOver))}updated(e){super.updated(e),this._updateThemeAttribute()}_updateThemeAttribute(){const e=this.explicitTheme;e?this.setAttribute("data-theme",e):this.removeAttribute("data-theme")}disconnectedCallback(){super.disconnectedCallback(),this.drag&&(document.removeEventListener("dragenter",this._onDocumentDragEnter),document.removeEventListener("dragleave",this._onDocumentDragLeave),document.removeEventListener("drop",this._onDocumentDrop),document.removeEventListener("dragover",this._onDocumentDragOver))}firstUpdated(e){var t;super.firstUpdated(e),this.inputElement=(null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector('input[type="file"]'))||null}_handleFiles(e){return ra(this,void 0,void 0,function*(){if(this.multiple&&this.limit>0&&this.fileList.length+e.length>this.limit)return void this._dispatchEvent("exceed",{files:e});if(!this.multiple&&e.length>0){const t=e[e.length-1];this.previewImage&&this.fileList.some(e=>e.url===this.previewImage)&&(this.previewImage=null);const i=[...this.fileList];for(const e of i)this._dispatchEvent("remove",{file:e});this.fileList=[];const n=oa.isImageFile(t),a={name:t.name,size:oa.formatFileSize(t.size),raw:t,status:"ready",percentage:0,uid:Date.now()+Math.random().toString(36).substring(2),isImage:n};return this.preview&&this.generatePreviewOnUpload&&n&&(a.url=yield oa.createFilePreview(t)),this.fileList=[a],this.requestUpdate(),void this._dispatchEvent("select",{files:[a],fileList:this.fileList})}const t=[];for(const i of Array.from(e)){const e=oa.isImageFile(i),n={name:i.name,size:oa.formatFileSize(i.size),raw:i,status:"ready",percentage:0,uid:Date.now()+Math.random().toString(36).substring(2),isImage:e};this.preview&&this.generatePreviewOnUpload&&e&&(n.url=yield oa.createFilePreview(i)),this.fileList=[...this.fileList,n],t.push(n)}this.requestUpdate(),this._dispatchEvent("select",{files:t,fileList:this.fileList})})}updateFileStatus(e,t,i){const n=this.fileList.find(t=>t.uid===e);n&&(n.status=t,void 0!==i&&(n.percentage=i),this._updateFile(n))}_updateFile(e){this.fileList=this.fileList.map(t=>t.uid===e.uid?e:t),this.requestUpdate()}_removeFile(e){const t=this.fileList.find(t=>t.uid===e);this.fileList=this.fileList.filter(t=>t.uid!==e),t&&this._dispatchEvent("remove",{file:t}),this.requestUpdate()}_dispatchEvent(e,t){this.dispatchEvent(new CustomEvent(`file-${e}`,{detail:t,bubbles:!0,composed:!0}))}_showPreview(e){this.previewImage=e}_closePreview(){this.previewImage=null}render(){return i`
6864
6984
  <div class="upload" @drop=${this._onDrop} @dragover=${e=>e.preventDefault()}>
6865
6985
  <input
6866
6986
  type="file"
@@ -6967,7 +7087,7 @@ function Xn(e,t){const n=[];if(e.data&&"object"==typeof e.data)for(const[t,i]of
6967
7087
  * Copyright 2024 Nuraly, Laabidi Aymen
6968
7088
  * SPDX-License-Identifier: MIT
6969
7089
  */
6970
- function oa(e,t,i="testFile"){var n;const a=null===(n=e.detail)||void 0===n?void 0:n.files;if(!a||0===a.length)return;const o=a[0].raw,s=new FileReader;s.onload=()=>{const e=s.result,n=e.split(",")[1]||e;t(i,{filename:o.name,contentType:o.type,size:o.size,base64:n})},s.readAsDataURL(o)}function sa(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}
7090
+ function ca(e,t,i="testFile"){var n;const a=null===(n=e.detail)||void 0===n?void 0:n.files;if(!a||0===a.length)return;const o=a[0].raw,s=new FileReader;s.onload=()=>{const e=s.result,n=e.split(",")[1]||e;t(i,{filename:o.name,contentType:o.type,size:o.size,base64:n})},s.readAsDataURL(o)}function da(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}
6971
7091
  /**
6972
7092
  * @license
6973
7093
  * Copyright 2024 Nuraly, Laabidi Aymen
@@ -6978,7 +7098,7 @@ function oa(e,t,i="testFile"){var n;const a=null===(n=e.detail)||void 0===n?void
6978
7098
  * Copyright 2024 Nuraly, Laabidi Aymen
6979
7099
  * SPDX-License-Identifier: MIT
6980
7100
  */
6981
- function ra(e,t){const a=e.checks||[],o=e=>{const i={type:e,action:"block"};"pii"===e&&(i.categories=["email","phone"]),"injection"===e&&(i.sensitivity="high"),"moderation"===e&&(i.categories=["hate","violence"]),"length"===e&&(i.minLength=1,i.maxLength=1e4),t("checks",[...a,i])},s=(e,i,n)=>{const o=[...a];o[e]=Object.assign(Object.assign({},o[e]),{[i]:n}),t("checks",o)};return i`
7101
+ function pa(e,t){const a=e.checks||[],o=e=>{const i={type:e,action:"block"};"pii"===e&&(i.categories=["email","phone"]),"injection"===e&&(i.sensitivity="high"),"moderation"===e&&(i.categories=["hate","violence"]),"length"===e&&(i.minLength=1,i.maxLength=1e4),t("checks",[...a,i])},s=(e,i,n)=>{const o=[...a];o[e]=Object.assign(Object.assign({},o[e]),{[i]:n}),t("checks",o)};return i`
6982
7102
  <div class="config-field">
6983
7103
  <label>Mode</label>
6984
7104
  <nr-select
@@ -7175,25 +7295,25 @@ function ra(e,t){const a=e.checks||[],o=e=>{const i={type:e,action:"block"};"pii
7175
7295
  */(e,o,s)}
7176
7296
  </div>
7177
7297
  `;var r})}
7178
- `}aa.useShadowDom=!0,aa.styles=ea,ia([o({type:String})],aa.prototype,"accept",void 0),ia([o({type:Boolean})],aa.prototype,"multiple",void 0),ia([o({type:Boolean})],aa.prototype,"drag",void 0),ia([o({type:String})],aa.prototype,"tip",void 0),ia([o({type:Number})],aa.prototype,"limit",void 0),ia([o({type:Boolean})],aa.prototype,"preview",void 0),ia([o({type:Boolean})],aa.prototype,"generatePreviewOnUpload",void 0),ia([s()],aa.prototype,"fileList",void 0),ia([s()],aa.prototype,"isDragOver",void 0),ia([s()],aa.prototype,"showDragArea",void 0),ia([s()],aa.prototype,"inputElement",void 0),ia([s()],aa.prototype,"dragCounter",void 0),ia([s()],aa.prototype,"previewImage",void 0),aa=ia([r("nr-file-upload")],aa);const la=[{value:"getAll",label:"Get All Events"},{value:"get",label:"Get Event"},{value:"create",label:"Create Event"},{value:"update",label:"Update Event"},{value:"delete",label:"Delete Event"}];
7298
+ `}la.useShadowDom=!0,la.styles=aa,sa([o({type:String})],la.prototype,"accept",void 0),sa([o({type:Boolean})],la.prototype,"multiple",void 0),sa([o({type:Boolean})],la.prototype,"drag",void 0),sa([o({type:String})],la.prototype,"tip",void 0),sa([o({type:Number})],la.prototype,"limit",void 0),sa([o({type:Boolean})],la.prototype,"preview",void 0),sa([o({type:Boolean})],la.prototype,"generatePreviewOnUpload",void 0),sa([s()],la.prototype,"fileList",void 0),sa([s()],la.prototype,"isDragOver",void 0),sa([s()],la.prototype,"showDragArea",void 0),sa([s()],la.prototype,"inputElement",void 0),sa([s()],la.prototype,"dragCounter",void 0),sa([s()],la.prototype,"previewImage",void 0),la=sa([r("nr-file-upload")],la);const ha=[{value:"getAll",label:"Get All Events"},{value:"get",label:"Get Event"},{value:"create",label:"Create Event"},{value:"update",label:"Update Event"},{value:"delete",label:"Delete Event"}];
7179
7299
  /**
7180
7300
  * @license
7181
7301
  * Copyright 2024 Nuraly, Laabidi Aymen
7182
7302
  * SPDX-License-Identifier: MIT
7183
7303
  */
7184
- const ca=[{value:"ORDER",label:"Order"},{value:"DRAFT_ORDER",label:"Draft Order"},{value:"PRODUCT",label:"Product"},{value:"PRODUCT_VARIANT",label:"Product Variant"},{value:"PRODUCT_IMAGE",label:"Product Image"},{value:"CUSTOMER",label:"Customer"},{value:"INVENTORY",label:"Inventory"},{value:"FULFILLMENT",label:"Fulfillment"},{value:"COLLECTION",label:"Collection"},{value:"SMART_COLLECTION",label:"Smart Collection"}],da=[{value:"LIST",label:"List"},{value:"READ",label:"Read"},{value:"CREATE",label:"Create"},{value:"UPDATE",label:"Update"},{value:"DELETE",label:"Delete"}],pa=[{value:"2025-01",label:"2025-01"},{value:"2024-10",label:"2024-10"},{value:"2024-07",label:"2024-07"},{value:"2024-04",label:"2024-04"},{value:"2024-01",label:"2024-01"},{value:"2023-10",label:"2023-10"}],ha=[{value:"",label:"None"},{value:"created_at",label:"Created At"},{value:"updated_at",label:"Updated At"},{value:"id",label:"ID"}],ua=[{value:"asc",label:"Ascending"},{value:"desc",label:"Descending"}],ba=[{value:"any",label:"Any"},{value:"open",label:"Open"},{value:"closed",label:"Closed"},{value:"cancelled",label:"Cancelled"}],fa=[{value:"any",label:"Any"},{value:"authorized",label:"Authorized"},{value:"pending",label:"Pending"},{value:"paid",label:"Paid"},{value:"partially_paid",label:"Partially Paid"},{value:"refunded",label:"Refunded"},{value:"voided",label:"Voided"}],ga=[{value:"any",label:"Any"},{value:"shipped",label:"Shipped"},{value:"partial",label:"Partial"},{value:"unshipped",label:"Unshipped"},{value:"unfulfilled",label:"Unfulfilled"}];
7304
+ const ua=[{value:"ORDER",label:"Order"},{value:"DRAFT_ORDER",label:"Draft Order"},{value:"PRODUCT",label:"Product"},{value:"PRODUCT_VARIANT",label:"Product Variant"},{value:"PRODUCT_IMAGE",label:"Product Image"},{value:"CUSTOMER",label:"Customer"},{value:"INVENTORY",label:"Inventory"},{value:"FULFILLMENT",label:"Fulfillment"},{value:"COLLECTION",label:"Collection"},{value:"SMART_COLLECTION",label:"Smart Collection"}],ba=[{value:"LIST",label:"List"},{value:"READ",label:"Read"},{value:"CREATE",label:"Create"},{value:"UPDATE",label:"Update"},{value:"DELETE",label:"Delete"}],fa=[{value:"2025-01",label:"2025-01"},{value:"2024-10",label:"2024-10"},{value:"2024-07",label:"2024-07"},{value:"2024-04",label:"2024-04"},{value:"2024-01",label:"2024-01"},{value:"2023-10",label:"2023-10"}],ga=[{value:"",label:"None"},{value:"created_at",label:"Created At"},{value:"updated_at",label:"Updated At"},{value:"id",label:"ID"}],va=[{value:"asc",label:"Ascending"},{value:"desc",label:"Descending"}],ma=[{value:"any",label:"Any"},{value:"open",label:"Open"},{value:"closed",label:"Closed"},{value:"cancelled",label:"Cancelled"}],xa=[{value:"any",label:"Any"},{value:"authorized",label:"Authorized"},{value:"pending",label:"Pending"},{value:"paid",label:"Paid"},{value:"partially_paid",label:"Partially Paid"},{value:"refunded",label:"Refunded"},{value:"voided",label:"Voided"}],ya=[{value:"any",label:"Any"},{value:"shipped",label:"Shipped"},{value:"partial",label:"Partial"},{value:"unshipped",label:"Unshipped"},{value:"unfulfilled",label:"Unfulfilled"}];
7185
7305
  /**
7186
7306
  * @license
7187
7307
  * Copyright 2024 Nuraly, Laabidi Aymen
7188
7308
  * SPDX-License-Identifier: MIT
7189
7309
  */
7190
- const va=[{value:"",label:"None"},{value:"HTML",label:"HTML"},{value:"Markdown",label:"Markdown"},{value:"MarkdownV2",label:"MarkdownV2"}],ma=[{value:"sendMessage",label:"Send Message"},{value:"sendPhoto",label:"Send Photo"},{value:"sendVideo",label:"Send Video"},{value:"sendDocument",label:"Send Document"},{value:"sendAudio",label:"Send Audio"},{value:"sendSticker",label:"Send Sticker"},{value:"sendAnimation",label:"Send Animation (GIF)"},{value:"sendLocation",label:"Send Location"},{value:"sendMediaGroup",label:"Send Media Group"},{value:"editMessageText",label:"Edit Message Text"},{value:"deleteMessage",label:"Delete Message"},{value:"pinChatMessage",label:"Pin Message"},{value:"unpinChatMessage",label:"Unpin Message"},{value:"answerCallbackQuery",label:"Answer Callback Query"},{value:"sendChatAction",label:"Send Chat Action"}],xa=[{value:"typing",label:"Typing"},{value:"upload_photo",label:"Upload Photo"},{value:"record_video",label:"Record Video"},{value:"upload_video",label:"Upload Video"},{value:"record_voice",label:"Record Voice"},{value:"upload_voice",label:"Upload Voice"},{value:"upload_document",label:"Upload Document"},{value:"find_location",label:"Find Location"},{value:"record_video_note",label:"Record Video Note"},{value:"upload_video_note",label:"Upload Video Note"}],ya=[{value:"",label:"None"},{value:"👍",label:"👍 Thumbs Up"},{value:"👀",label:"👀 Eyes (read)"},{value:"✅",label:"✅ Check"},{value:"❤",label:"❤ Heart"},{value:"🔥",label:"🔥 Fire"},{value:"⚡",label:"⚡ Lightning"}],wa=["sendPhoto","sendVideo","sendDocument","sendAudio","sendAnimation"],$a=["sendPhoto","sendVideo","sendDocument","sendAudio","sendSticker","sendAnimation"],ka=["sendMessage","editMessageText",...wa];
7310
+ const wa=[{value:"",label:"None"},{value:"HTML",label:"HTML"},{value:"Markdown",label:"Markdown"},{value:"MarkdownV2",label:"MarkdownV2"}],$a=[{value:"sendMessage",label:"Send Message"},{value:"sendPhoto",label:"Send Photo"},{value:"sendVideo",label:"Send Video"},{value:"sendDocument",label:"Send Document"},{value:"sendAudio",label:"Send Audio"},{value:"sendSticker",label:"Send Sticker"},{value:"sendAnimation",label:"Send Animation (GIF)"},{value:"sendLocation",label:"Send Location"},{value:"sendMediaGroup",label:"Send Media Group"},{value:"editMessageText",label:"Edit Message Text"},{value:"deleteMessage",label:"Delete Message"},{value:"pinChatMessage",label:"Pin Message"},{value:"unpinChatMessage",label:"Unpin Message"},{value:"answerCallbackQuery",label:"Answer Callback Query"},{value:"sendChatAction",label:"Send Chat Action"}],ka=[{value:"typing",label:"Typing"},{value:"upload_photo",label:"Upload Photo"},{value:"record_video",label:"Record Video"},{value:"upload_video",label:"Upload Video"},{value:"record_voice",label:"Record Voice"},{value:"upload_voice",label:"Upload Voice"},{value:"upload_document",label:"Upload Document"},{value:"find_location",label:"Find Location"},{value:"record_video_note",label:"Record Video Note"},{value:"upload_video_note",label:"Upload Video Note"}],Sa=[{value:"",label:"None"},{value:"👍",label:"👍 Thumbs Up"},{value:"👀",label:"👀 Eyes (read)"},{value:"✅",label:"✅ Check"},{value:"❤",label:"❤ Heart"},{value:"🔥",label:"🔥 Fire"},{value:"⚡",label:"⚡ Lightning"}],Ca=["sendPhoto","sendVideo","sendDocument","sendAudio","sendAnimation"],Ta=["sendPhoto","sendVideo","sendDocument","sendAudio","sendSticker","sendAnimation"],Ma=["sendMessage","editMessageText",...Ca];
7191
7311
  /**
7192
7312
  * @license
7193
7313
  * Copyright 2024 Nuraly, Laabidi Aymen
7194
7314
  * SPDX-License-Identifier: MIT
7195
7315
  */
7196
- const Sa=[{value:"TICKET",label:"Ticket"},{value:"USER",label:"User"},{value:"ORGANIZATION",label:"Organization"},{value:"TICKET_COMMENT",label:"Ticket Comment"},{value:"SATISFACTION_RATING",label:"Satisfaction Rating"},{value:"GROUP",label:"Group"}],Ca=[{value:"CREATE",label:"Create"},{value:"READ",label:"Read"},{value:"UPDATE",label:"Update"},{value:"DELETE",label:"Delete"},{value:"LIST",label:"List"},{value:"SEARCH",label:"Search"}],Ta=[{value:"",label:"None"},{value:"low",label:"Low"},{value:"normal",label:"Normal"},{value:"high",label:"High"},{value:"urgent",label:"Urgent"}],Ma=[{value:"",label:"None"},{value:"new",label:"New"},{value:"open",label:"Open"},{value:"pending",label:"Pending"},{value:"hold",label:"Hold"},{value:"solved",label:"Solved"},{value:"closed",label:"Closed"}],za=[{value:"",label:"None"},{value:"question",label:"Question"},{value:"incident",label:"Incident"},{value:"problem",label:"Problem"},{value:"task",label:"Task"}],Ea=[{value:"",label:"Default"},{value:"created_at",label:"Created At"},{value:"updated_at",label:"Updated At"},{value:"priority",label:"Priority"},{value:"status",label:"Status"}],Oa=[{value:"asc",label:"Ascending"},{value:"desc",label:"Descending"}];function Aa(e){return i`
7316
+ const Ea=[{value:"TICKET",label:"Ticket"},{value:"USER",label:"User"},{value:"ORGANIZATION",label:"Organization"},{value:"TICKET_COMMENT",label:"Ticket Comment"},{value:"SATISFACTION_RATING",label:"Satisfaction Rating"},{value:"GROUP",label:"Group"}],za=[{value:"CREATE",label:"Create"},{value:"READ",label:"Read"},{value:"UPDATE",label:"Update"},{value:"DELETE",label:"Delete"},{value:"LIST",label:"List"},{value:"SEARCH",label:"Search"}],Aa=[{value:"",label:"None"},{value:"low",label:"Low"},{value:"normal",label:"Normal"},{value:"high",label:"High"},{value:"urgent",label:"Urgent"}],Oa=[{value:"",label:"None"},{value:"new",label:"New"},{value:"open",label:"Open"},{value:"pending",label:"Pending"},{value:"hold",label:"Hold"},{value:"solved",label:"Solved"},{value:"closed",label:"Closed"}],Ia=[{value:"",label:"None"},{value:"question",label:"Question"},{value:"incident",label:"Incident"},{value:"problem",label:"Problem"},{value:"task",label:"Task"}],Pa=[{value:"",label:"Default"},{value:"created_at",label:"Created At"},{value:"updated_at",label:"Updated At"},{value:"priority",label:"Priority"},{value:"status",label:"Status"}],Na=[{value:"asc",label:"Ascending"},{value:"desc",label:"Descending"}];function Ra(e){return i`
7197
7317
  <div class="trigger-stats-row">
7198
7318
  <span class="trigger-stat">
7199
7319
  <nr-icon name="message-square" size="small"></nr-icon>
@@ -7211,7 +7331,7 @@ function(e){const t=Date.now()-new Date(e).getTime();return t<0?"just now":t<6e4
7211
7331
  </span>
7212
7332
  `:n}
7213
7333
  </div>
7214
- `}function Ia(e,t,a,o,s){var r,l;const c=!!(null==e?void 0:e.triggerId),d=function(e){switch(e){case W.CONNECTED:return{label:"Connected",cssClass:"trigger-status--connected"};case W.CONNECTING:return{label:"Connecting...",cssClass:"trigger-status--connecting"};case W.ERROR:return{label:"Error",cssClass:"trigger-status--error"};case W.PAUSED:return{label:"Paused",cssClass:"trigger-status--paused"};case W.DISCONNECTED:default:return{label:"Disconnected",cssClass:"trigger-status--disconnected"}}}(null==e?void 0:e.status),p=(null==e?void 0:e.status)===W.CONNECTED||(null==e?void 0:e.status)===W.CONNECTING,h=p&&null!=(null==e?void 0:e.messagesReceived),u=null!==(r=null==s?void 0:s.activateLabel)&&void 0!==r?r:"Activate Trigger";return i`
7334
+ `}function Da(e,t,a,o,s){var r,l;const c=!!(null==e?void 0:e.triggerId),d=function(e){switch(e){case W.CONNECTED:return{label:"Connected",cssClass:"trigger-status--connected"};case W.CONNECTING:return{label:"Connecting...",cssClass:"trigger-status--connecting"};case W.ERROR:return{label:"Error",cssClass:"trigger-status--error"};case W.PAUSED:return{label:"Paused",cssClass:"trigger-status--paused"};case W.DISCONNECTED:default:return{label:"Disconnected",cssClass:"trigger-status--disconnected"}}}(null==e?void 0:e.status),p=(null==e?void 0:e.status)===W.CONNECTED||(null==e?void 0:e.status)===W.CONNECTING,h=p&&null!=(null==e?void 0:e.messagesReceived),u=null!==(r=null==s?void 0:s.activateLabel)&&void 0!==r?r:"Activate Trigger";return i`
7215
7335
  <div class="config-section">
7216
7336
  <div class="config-section-header">
7217
7337
  <span class="config-section-title">
@@ -7233,7 +7353,7 @@ function(e){const t=Date.now()-new Date(e).getTime();return t<0?"just now":t<6e4
7233
7353
  <div class="trigger-status-reason">${e.stateReason}</div>
7234
7354
  `:n}
7235
7355
 
7236
- ${h&&e?Aa(e):n}
7356
+ ${h&&e?Ra(e):n}
7237
7357
 
7238
7358
  ${(null==e?void 0:e.inDevMode)?i`
7239
7359
  <div class="trigger-dev-mode-badge">
@@ -7309,19 +7429,19 @@ function(e){const t=Date.now()-new Date(e).getTime();return t<0?"just now":t<6e4
7309
7429
  * @license
7310
7430
  * Copyright 2024 Nuraly, Laabidi Aymen
7311
7431
  * SPDX-License-Identifier: MIT
7312
- */const Pa=[{value:"message",label:"Message"},{value:"edited_message",label:"Edited Message"},{value:"channel_post",label:"Channel Post"},{value:"edited_channel_post",label:"Edited Channel Post"},{value:"inline_query",label:"Inline Query"},{value:"chosen_inline_result",label:"Chosen Inline Result"},{value:"callback_query",label:"Callback Query"},{value:"shipping_query",label:"Shipping Query"},{value:"pre_checkout_query",label:"Pre-checkout Query"},{value:"poll",label:"Poll"},{value:"poll_answer",label:"Poll Answer"},{value:"my_chat_member",label:"My Chat Member"},{value:"chat_member",label:"Chat Member"}];
7432
+ */const _a=[{value:"message",label:"Message"},{value:"edited_message",label:"Edited Message"},{value:"channel_post",label:"Channel Post"},{value:"edited_channel_post",label:"Edited Channel Post"},{value:"inline_query",label:"Inline Query"},{value:"chosen_inline_result",label:"Chosen Inline Result"},{value:"callback_query",label:"Callback Query"},{value:"shipping_query",label:"Shipping Query"},{value:"pre_checkout_query",label:"Pre-checkout Query"},{value:"poll",label:"Poll"},{value:"poll_answer",label:"Poll Answer"},{value:"my_chat_member",label:"My Chat Member"},{value:"chat_member",label:"Chat Member"}];
7313
7433
  /**
7314
7434
  * @license
7315
7435
  * Copyright 2024 Nuraly, Laabidi Aymen
7316
7436
  * SPDX-License-Identifier: MIT
7317
7437
  */
7318
- const Na=[{value:"application/json",label:"JSON"},{value:"text/plain",label:"Text"},{value:"application/octet-stream",label:"Binary"}];
7438
+ const ja=[{value:"application/json",label:"JSON"},{value:"text/plain",label:"Text"},{value:"application/octet-stream",label:"Binary"}];
7319
7439
  /**
7320
7440
  * @license
7321
7441
  * Copyright 2024 Nuraly, Laabidi Aymen
7322
7442
  * SPDX-License-Identifier: MIT
7323
7443
  */
7324
- const Ra=[{value:"send_sms",label:"Send SMS"},{value:"make_call",label:"Make Voice Call"},{value:"send_whatsapp",label:"Send WhatsApp Message"},{value:"get_message",label:"Get Message Status"}],Da=[{value:"none",label:"None"},{value:"Enable",label:"Enable"},{value:"DetectMessageEnd",label:"Detect Message End"}];function _a(e,t,n,a){const o=(n||[]).filter(e=>e.keyPath.startsWith("twilio/"));return i`
7444
+ const La=[{value:"send_sms",label:"Send SMS"},{value:"make_call",label:"Make Voice Call"},{value:"send_whatsapp",label:"Send WhatsApp Message"},{value:"get_message",label:"Get Message Status"}],Fa=[{value:"none",label:"None"},{value:"Enable",label:"Enable"},{value:"DetectMessageEnd",label:"Detect Message End"}];function Ba(e,t,n,a){const o=(n||[]).filter(e=>e.keyPath.startsWith("twilio/"));return i`
7325
7445
  <div class="config-section">
7326
7446
  <div class="config-section-header">
7327
7447
  <span class="config-section-title">Credentials</span>
@@ -7346,7 +7466,7 @@ const Ra=[{value:"send_sms",label:"Send SMS"},{value:"make_call",label:"Make Voi
7346
7466
  * Copyright 2024 Nuraly, Laabidi Aymen
7347
7467
  * SPDX-License-Identifier: MIT
7348
7468
  */
7349
- const ja=[{value:"issue",label:"Issue"},{value:"merge_request",label:"Merge Request"},{value:"repository",label:"Repository"},{value:"pipeline",label:"Pipeline"},{value:"release",label:"Release"},{value:"user",label:"User"}],La=[{value:"create",label:"Create"},{value:"get",label:"Get"},{value:"getAll",label:"Get All"},{value:"update",label:"Update"},{value:"delete",label:"Delete"}];function Fa(e,t){const a=e,o=a.gitlabResource||"issue",s=a.gitlabOperation||"getAll";return i`
7469
+ const Ua=[{value:"issue",label:"Issue"},{value:"merge_request",label:"Merge Request"},{value:"repository",label:"Repository"},{value:"pipeline",label:"Pipeline"},{value:"release",label:"Release"},{value:"user",label:"User"}],Va=[{value:"create",label:"Create"},{value:"get",label:"Get"},{value:"getAll",label:"Get All"},{value:"update",label:"Update"},{value:"delete",label:"Delete"}];function Ha(e,t){const a=e,o=a.gitlabResource||"issue",s=a.gitlabOperation||"getAll";return i`
7350
7470
  <div class="config-section">
7351
7471
  <div class="config-section-header">
7352
7472
  <span class="config-section-title">Connection</span>
@@ -7384,7 +7504,7 @@ const ja=[{value:"issue",label:"Issue"},{value:"merge_request",label:"Merge Requ
7384
7504
  value=${o}
7385
7505
  @nr-change=${e=>t("gitlabResource",e.detail.value)}
7386
7506
  >
7387
- ${ja.map(e=>i`
7507
+ ${Ua.map(e=>i`
7388
7508
  <nr-option value=${e.value}>${e.label}</nr-option>
7389
7509
  `)}
7390
7510
  </nr-select>
@@ -7395,7 +7515,7 @@ const ja=[{value:"issue",label:"Issue"},{value:"merge_request",label:"Merge Requ
7395
7515
  value=${s}
7396
7516
  @nr-change=${e=>t("gitlabOperation",e.detail.value)}
7397
7517
  >
7398
- ${La.map(e=>i`
7518
+ ${Va.map(e=>i`
7399
7519
  <nr-option value=${e.value}>${e.label}</nr-option>
7400
7520
  `)}
7401
7521
  </nr-select>
@@ -7564,7 +7684,7 @@ const ja=[{value:"issue",label:"Issue"},{value:"merge_request",label:"Merge Requ
7564
7684
  * @license
7565
7685
  * Copyright 2024 Nuraly, Laabidi Aymen
7566
7686
  * SPDX-License-Identifier: MIT
7567
- */const Ba=[{label:"Streamable HTTP",value:"streamable_http"},{label:"SSE (Server-Sent Events)",value:"sse"}],Ua=[{label:"None",value:"none"},{label:"Bearer Token",value:"bearer"},{label:"API Key Header",value:"api_key"}];function Va(e,t,a){const o=!!(null==e?void 0:e.triggerId),s=function(e){switch(e){case W.CONNECTED:return{label:"Connected",cssClass:"trigger-status--connected"};case W.CONNECTING:return{label:"Connecting...",cssClass:"trigger-status--connecting"};case W.ERROR:return{label:"Error",cssClass:"trigger-status--error"};case W.PAUSED:return{label:"Paused",cssClass:"trigger-status--paused"};case W.DISCONNECTED:default:return{label:"Disconnected",cssClass:"trigger-status--disconnected"}}}(null==e?void 0:e.status),r=(null==e?void 0:e.status)===W.CONNECTED||(null==e?void 0:e.status)===W.CONNECTING;return i`
7687
+ */const qa=[{label:"Streamable HTTP",value:"streamable_http"},{label:"SSE (Server-Sent Events)",value:"sse"}],Wa=[{label:"None",value:"none"},{label:"Bearer Token",value:"bearer"},{label:"API Key Header",value:"api_key"}];function Ka(e,t,a){const o=!!(null==e?void 0:e.triggerId),s=function(e){switch(e){case W.CONNECTED:return{label:"Connected",cssClass:"trigger-status--connected"};case W.CONNECTING:return{label:"Connecting...",cssClass:"trigger-status--connecting"};case W.ERROR:return{label:"Error",cssClass:"trigger-status--error"};case W.PAUSED:return{label:"Paused",cssClass:"trigger-status--paused"};case W.DISCONNECTED:default:return{label:"Disconnected",cssClass:"trigger-status--disconnected"}}}(null==e?void 0:e.status),r=(null==e?void 0:e.status)===W.CONNECTED||(null==e?void 0:e.status)===W.CONNECTING;return i`
7568
7688
  <div class="config-section">
7569
7689
  <div class="config-section-header">
7570
7690
  <span class="config-section-title">
@@ -7627,7 +7747,7 @@ const ja=[{value:"issue",label:"Issue"},{value:"merge_request",label:"Merge Requ
7627
7747
  * Copyright 2024 Nuraly, Laabidi Aymen
7628
7748
  * SPDX-License-Identifier: MIT
7629
7749
  */
7630
- function Ha(e,t){const a=e.schema||[{name:"field1",type:"string",description:"",required:!0}],o=(e,i,n)=>{const o=a.map((t,a)=>a===e?Object.assign(Object.assign({},t),{[i]:n}):t);t("schema",o)};return i`
7750
+ function Ga(e,t){const a=e.schema||[{name:"field1",type:"string",description:"",required:!0}],o=(e,i,n)=>{const o=a.map((t,a)=>a===e?Object.assign(Object.assign({},t),{[i]:n}):t);t("schema",o)};return i`
7631
7751
  <div class="config-field">
7632
7752
  <label>Input Field</label>
7633
7753
  <nr-input
@@ -7756,31 +7876,31 @@ function Ha(e,t){const a=e.schema||[{name:"field1",type:"string",description:"",
7756
7876
  * @license
7757
7877
  * Copyright 2024 Nuraly, Laabidi Aymen
7758
7878
  * SPDX-License-Identifier: MIT
7759
- */const qa=[{value:"contact",label:"Contact"},{value:"deal",label:"Deal"},{value:"company",label:"Company"},{value:"ticket",label:"Ticket"},{value:"engagement",label:"Engagement"},{value:"product",label:"Product"},{value:"lineItem",label:"Line Item"}],Wa=[{value:"create",label:"Create"},{value:"get",label:"Get"},{value:"getAll",label:"Get All"},{value:"update",label:"Update"},{value:"delete",label:"Delete"},{value:"search",label:"Search"}],Ka=[{value:"EQ",label:"Equal to"},{value:"NEQ",label:"Not equal to"},{value:"LT",label:"Less than"},{value:"LTE",label:"Less than or equal"},{value:"GT",label:"Greater than"},{value:"GTE",label:"Greater than or equal"},{value:"CONTAINS_TOKEN",label:"Contains token"},{value:"NOT_CONTAINS_TOKEN",label:"Does not contain token"}];
7879
+ */const Ja=[{value:"contact",label:"Contact"},{value:"deal",label:"Deal"},{value:"company",label:"Company"},{value:"ticket",label:"Ticket"},{value:"engagement",label:"Engagement"},{value:"product",label:"Product"},{value:"lineItem",label:"Line Item"}],Ya=[{value:"create",label:"Create"},{value:"get",label:"Get"},{value:"getAll",label:"Get All"},{value:"update",label:"Update"},{value:"delete",label:"Delete"},{value:"search",label:"Search"}],Qa=[{value:"EQ",label:"Equal to"},{value:"NEQ",label:"Not equal to"},{value:"LT",label:"Less than"},{value:"LTE",label:"Less than or equal"},{value:"GT",label:"Greater than"},{value:"GTE",label:"Greater than or equal"},{value:"CONTAINS_TOKEN",label:"Contains token"},{value:"NOT_CONTAINS_TOKEN",label:"Does not contain token"}];
7760
7880
  /**
7761
7881
  * @license
7762
7882
  * Copyright 2024 Nuraly, Laabidi Aymen
7763
7883
  * SPDX-License-Identifier: MIT
7764
7884
  */
7765
- const Ga=[{value:"createIssue",label:"Create Issue"},{value:"getIssue",label:"Get Issue"},{value:"updateIssue",label:"Update Issue"},{value:"deleteIssue",label:"Delete Issue"},{value:"searchJql",label:"Search (JQL)"},{value:"transitionIssue",label:"Transition Issue"},{value:"addComment",label:"Add Comment"},{value:"listComments",label:"List Comments"},{value:"getChangelog",label:"Get Changelog"},{value:"listProjects",label:"List Projects"},{value:"addAttachment",label:"Add Attachment"},{value:"listAttachments",label:"List Attachments"},{value:"addWorklog",label:"Add Worklog"},{value:"listWorklogs",label:"List Worklogs"},{value:"getUser",label:"Get User"},{value:"searchUsers",label:"Search Users"}],Ja=[{value:"Task",label:"Task"},{value:"Bug",label:"Bug"},{value:"Story",label:"Story"},{value:"Epic",label:"Epic"},{value:"Sub-task",label:"Sub-task"}],Ya=[{value:"Highest",label:"Highest"},{value:"High",label:"High"},{value:"Medium",label:"Medium"},{value:"Low",label:"Low"},{value:"Lowest",label:"Lowest"}];
7885
+ const Za=[{value:"createIssue",label:"Create Issue"},{value:"getIssue",label:"Get Issue"},{value:"updateIssue",label:"Update Issue"},{value:"deleteIssue",label:"Delete Issue"},{value:"searchJql",label:"Search (JQL)"},{value:"transitionIssue",label:"Transition Issue"},{value:"addComment",label:"Add Comment"},{value:"listComments",label:"List Comments"},{value:"getChangelog",label:"Get Changelog"},{value:"listProjects",label:"List Projects"},{value:"addAttachment",label:"Add Attachment"},{value:"listAttachments",label:"List Attachments"},{value:"addWorklog",label:"Add Worklog"},{value:"listWorklogs",label:"List Worklogs"},{value:"getUser",label:"Get User"},{value:"searchUsers",label:"Search Users"}],Xa=[{value:"Task",label:"Task"},{value:"Bug",label:"Bug"},{value:"Story",label:"Story"},{value:"Epic",label:"Epic"},{value:"Sub-task",label:"Sub-task"}],eo=[{value:"Highest",label:"Highest"},{value:"High",label:"High"},{value:"Medium",label:"Medium"},{value:"Low",label:"Low"},{value:"Lowest",label:"Lowest"}];
7766
7886
  /**
7767
7887
  * @license
7768
7888
  * Copyright 2024 Nuraly, Laabidi Aymen
7769
7889
  * SPDX-License-Identifier: MIT
7770
7890
  */
7771
- const Qa=[{value:"search",label:"Search"},{value:"index",label:"Index"},{value:"get",label:"Get"},{value:"update",label:"Update"},{value:"delete",label:"Delete"},{value:"bulk",label:"Bulk"}],Za=[{value:"false",label:"false (default)"},{value:"true",label:"true"},{value:"wait_for",label:"wait_for"}];
7891
+ const to=[{value:"search",label:"Search"},{value:"index",label:"Index"},{value:"get",label:"Get"},{value:"update",label:"Update"},{value:"delete",label:"Delete"},{value:"bulk",label:"Bulk"}],io=[{value:"false",label:"false (default)"},{value:"true",label:"true"},{value:"wait_for",label:"wait_for"}];
7772
7892
  /**
7773
7893
  * @license
7774
7894
  * Copyright 2024 Nuraly, Laabidi Aymen
7775
7895
  * SPDX-License-Identifier: MIT
7776
7896
  */
7777
- const Xa=[{value:"invitee.created",label:"Invitee Created (meeting booked)"},{value:"invitee.canceled",label:"Invitee Canceled (meeting cancelled)"}],eo=[{value:"user",label:"User — only your events"},{value:"organization",label:"Organization — all members' events"}];
7897
+ const no=[{value:"invitee.created",label:"Invitee Created (meeting booked)"},{value:"invitee.canceled",label:"Invitee Canceled (meeting cancelled)"}],ao=[{value:"user",label:"User — only your events"},{value:"organization",label:"Organization — all members' events"}];
7778
7898
  /**
7779
7899
  * @license
7780
7900
  * Copyright 2024 Nuraly, Laabidi Aymen
7781
7901
  * SPDX-License-Identifier: MIT
7782
7902
  */
7783
- const to=[{value:"none",label:"None — No acknowledgment"},{value:"leader",label:"Leader — Leader broker only"},{value:"all",label:"All — All in-sync replicas"}],io=[{value:"none",label:"None"},{value:"gzip",label:"Gzip"},{value:"snappy",label:"Snappy"},{value:"lz4",label:"LZ4"}];function no(e){return i`
7903
+ const oo=[{value:"none",label:"None — No acknowledgment"},{value:"leader",label:"Leader — Leader broker only"},{value:"all",label:"All — All in-sync replicas"}],so=[{value:"none",label:"None"},{value:"gzip",label:"Gzip"},{value:"snappy",label:"Snappy"},{value:"lz4",label:"LZ4"}];function ro(e){return i`
7784
7904
  <div class="trigger-stats-row">
7785
7905
  <span class="trigger-stat">
7786
7906
  <nr-icon name="message-square" size="small"></nr-icon>
@@ -7792,7 +7912,7 @@ const to=[{value:"none",label:"None — No acknowledgment"},{value:"leader",labe
7792
7912
  </span>
7793
7913
  `:n}
7794
7914
  </div>
7795
- `}function ao(e,t,a,o){const s=!!(null==e?void 0:e.triggerId),r=function(e){switch(e){case W.CONNECTED:return{label:"Connected",cssClass:"trigger-status--connected"};case W.CONNECTING:return{label:"Connecting...",cssClass:"trigger-status--connecting"};case W.ERROR:return{label:"Error",cssClass:"trigger-status--error"};case W.PAUSED:return{label:"Paused",cssClass:"trigger-status--paused"};case W.DISCONNECTED:default:return{label:"Disconnected",cssClass:"trigger-status--disconnected"}}}(null==e?void 0:e.status),l=(null==e?void 0:e.status)===W.CONNECTED||(null==e?void 0:e.status)===W.CONNECTING,c=l&&null!=(null==e?void 0:e.messagesReceived);return i`
7915
+ `}function lo(e,t,a,o){const s=!!(null==e?void 0:e.triggerId),r=function(e){switch(e){case W.CONNECTED:return{label:"Connected",cssClass:"trigger-status--connected"};case W.CONNECTING:return{label:"Connecting...",cssClass:"trigger-status--connecting"};case W.ERROR:return{label:"Error",cssClass:"trigger-status--error"};case W.PAUSED:return{label:"Paused",cssClass:"trigger-status--paused"};case W.DISCONNECTED:default:return{label:"Disconnected",cssClass:"trigger-status--disconnected"}}}(null==e?void 0:e.status),l=(null==e?void 0:e.status)===W.CONNECTED||(null==e?void 0:e.status)===W.CONNECTING,c=l&&null!=(null==e?void 0:e.messagesReceived);return i`
7796
7916
  <div class="config-section">
7797
7917
  <div class="config-section-header">
7798
7918
  <span class="config-section-title">
@@ -7814,7 +7934,7 @@ const to=[{value:"none",label:"None — No acknowledgment"},{value:"leader",labe
7814
7934
  <div class="trigger-status-reason">${e.stateReason}</div>
7815
7935
  `:n}
7816
7936
 
7817
- ${c&&e?no(e):n}
7937
+ ${c&&e?ro(e):n}
7818
7938
 
7819
7939
  ${(null==e?void 0:e.inDevMode)?i`
7820
7940
  <div class="trigger-dev-mode-badge">
@@ -7869,7 +7989,7 @@ const to=[{value:"none",label:"None — No acknowledgment"},{value:"leader",labe
7869
7989
  </div>
7870
7990
  `:n}
7871
7991
  </div>
7872
- `}function oo(e,t,n,a){return i`
7992
+ `}function co(e,t,n,a){return i`
7873
7993
  <div class="config-section">
7874
7994
  <div class="config-section-header">
7875
7995
  <span class="config-section-title">Connection</span>
@@ -7946,7 +8066,66 @@ const to=[{value:"none",label:"None — No acknowledgment"},{value:"leader",labe
7946
8066
  * Copyright 2024 Nuraly, Laabidi Aymen
7947
8067
  * SPDX-License-Identifier: MIT
7948
8068
  */
7949
- var so=function(e,t,i,n){for(var a,o=arguments.length,s=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n,r=e.length-1;r>=0;r--)(a=e[r])&&(s=(o<3?a(s):o>3?a(t,i,s):a(t,i))||s);return o>3&&s&&Object.defineProperty(t,i,s),s},ro=function(e,t,i,n){return new(i||(i=Promise))(function(a,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function r(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?a(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(s,r)}l((n=n.apply(e,t||[])).next())})};let lo=class extends t{constructor(){super(...arguments),this.serverUrl="http://localhost:11434",this.value="",this.placeholder="Select or enter model name...",this.models=[],this.loading=!1,this.error=""}connectedCallback(){super.connectedCallback(),this.fetchModels()}updated(e){e.has("serverUrl")&&this.fetchModels()}fetchModels(){return ro(this,void 0,void 0,function*(){if(this.serverUrl){this.loading=!0,this.error="";try{const e=this.serverUrl.replace(/\/$/,""),t=yield fetch(`${e}/api/tags`,{method:"GET",headers:{Accept:"application/json"}});if(!t.ok)throw new Error(`Server returned ${t.status}`);const i=yield t.json();this.models=i.models||[]}catch(e){console.error("Failed to fetch Ollama models:",e),this.error=e.message||"Failed to connect to Ollama server",this.models=[]}this.loading=!1}})}handleSelectChange(e){var t;const i=(null===(t=e.detail)||void 0===t?void 0:t.value)||"";this.value=i,this.dispatchEvent(new CustomEvent("value-change",{detail:{value:i},bubbles:!0,composed:!0}))}handleInputChange(e){var t;const i=(null===(t=e.detail)||void 0===t?void 0:t.value)||"";this.value=i,this.dispatchEvent(new CustomEvent("value-change",{detail:{value:i},bubbles:!0,composed:!0}))}handleRefresh(){this.fetchModels()}formatSize(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:e<1073741824?`${(e/1048576).toFixed(1)} MB`:`${(e/1073741824).toFixed(1)} GB`}renderFooter(){return this.loading?i`
8069
+ const po=[{value:"UTC",label:"UTC"},{value:"America/New_York",label:"America/New_York (EST/EDT)"},{value:"America/Chicago",label:"America/Chicago (CST/CDT)"},{value:"America/Denver",label:"America/Denver (MST/MDT)"},{value:"America/Los_Angeles",label:"America/Los_Angeles (PST/PDT)"},{value:"Europe/London",label:"Europe/London (GMT/BST)"},{value:"Europe/Paris",label:"Europe/Paris (CET/CEST)"},{value:"Europe/Berlin",label:"Europe/Berlin (CET/CEST)"},{value:"Asia/Tokyo",label:"Asia/Tokyo (JST)"},{value:"Asia/Shanghai",label:"Asia/Shanghai (CST)"},{value:"Asia/Dubai",label:"Asia/Dubai (GST)"},{value:"Australia/Sydney",label:"Australia/Sydney (AEST/AEDT)"}],ho=[{label:"Every minute",value:"* * * * *"},{label:"Every 5 minutes",value:"*/5 * * * *"},{label:"Every 15 minutes",value:"*/15 * * * *"},{label:"Every 30 minutes",value:"*/30 * * * *"},{label:"Every hour",value:"0 * * * *"},{label:"Every 6 hours",value:"0 */6 * * *"},{label:"Every day at midnight",value:"0 0 * * *"},{label:"Every day at noon",value:"0 12 * * *"},{label:"Every Monday at 9am",value:"0 9 * * 1"},{label:"Every weekday at 9am",value:"0 9 * * 1-5"},{label:"First day of month",value:"0 0 1 * *"}];function uo(e,t,a){const o=!!(null==e?void 0:e.triggerId),s=function(e){switch(e){case W.CONNECTED:return{label:"Running",cssClass:"trigger-status--connected"};case W.CONNECTING:return{label:"Starting...",cssClass:"trigger-status--connecting"};case W.ERROR:return{label:"Error",cssClass:"trigger-status--error"};case W.PAUSED:return{label:"Paused",cssClass:"trigger-status--paused"};case W.DISCONNECTED:default:return{label:"Stopped",cssClass:"trigger-status--disconnected"}}}(null==e?void 0:e.status),r=(null==e?void 0:e.status)===W.CONNECTED||(null==e?void 0:e.status)===W.CONNECTING;return i`
8070
+ <div class="config-section">
8071
+ <div class="config-section-header">
8072
+ <span class="config-section-title">
8073
+ <nr-icon name="radio" size="small"></nr-icon>
8074
+ Scheduler Status
8075
+ </span>
8076
+ </div>
8077
+
8078
+ <div class="trigger-status-panel">
8079
+ <div class="trigger-status-row">
8080
+ <span class="trigger-status-dot ${s.cssClass}"></span>
8081
+ <span class="trigger-status-label">${s.label}</span>
8082
+ </div>
8083
+
8084
+ ${(null==e?void 0:e.stateReason)?i`
8085
+ <div class="trigger-status-reason">${e.stateReason}</div>
8086
+ `:n}
8087
+ </div>
8088
+
8089
+ ${t?i`
8090
+ <div class="trigger-actions">
8091
+ ${function(e,t,n,a,o){var s;if(!e)return i`
8092
+ <nr-button
8093
+ type="primary"
8094
+ size="small"
8095
+ .iconLeft=${"play"}
8096
+ @click=${()=>a.onCreateAndActivate("CRON",o)}
8097
+ >
8098
+ Activate Trigger
8099
+ </nr-button>
8100
+ `;const r=null!==(s=null==n?void 0:n.triggerId)&&void 0!==s?s:"";return t?i`
8101
+ <nr-button
8102
+ type="danger"
8103
+ size="small"
8104
+ .iconLeft=${"square"}
8105
+ @click=${()=>a.onDeactivate(r)}
8106
+ >
8107
+ Stop
8108
+ </nr-button>
8109
+ `:i`
8110
+ <nr-button
8111
+ type="primary"
8112
+ size="small"
8113
+ .iconLeft=${"play"}
8114
+ @click=${()=>a.onActivate(r)}
8115
+ >
8116
+ Start
8117
+ </nr-button>
8118
+ `}(o,r,e,t,a)}
8119
+ </div>
8120
+ `:n}
8121
+ </div>
8122
+ `}
8123
+ /**
8124
+ * @license
8125
+ * Copyright 2024 Nuraly, Laabidi Aymen
8126
+ * SPDX-License-Identifier: MIT
8127
+ */
8128
+ var bo=function(e,t,i,n){for(var a,o=arguments.length,s=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n,r=e.length-1;r>=0;r--)(a=e[r])&&(s=(o<3?a(s):o>3?a(t,i,s):a(t,i))||s);return o>3&&s&&Object.defineProperty(t,i,s),s},fo=function(e,t,i,n){return new(i||(i=Promise))(function(a,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function r(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?a(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(s,r)}l((n=n.apply(e,t||[])).next())})};let go=class extends t{constructor(){super(...arguments),this.serverUrl="http://localhost:11434",this.value="",this.placeholder="Select or enter model name...",this.models=[],this.loading=!1,this.error=""}connectedCallback(){super.connectedCallback(),this.fetchModels()}updated(e){e.has("serverUrl")&&this.fetchModels()}fetchModels(){return fo(this,void 0,void 0,function*(){if(this.serverUrl){this.loading=!0,this.error="";try{const e=this.serverUrl.replace(/\/$/,""),t=yield fetch(`${e}/api/tags`,{method:"GET",headers:{Accept:"application/json"}});if(!t.ok)throw new Error(`Server returned ${t.status}`);const i=yield t.json();this.models=i.models||[]}catch(e){console.error("Failed to fetch Ollama models:",e),this.error=e.message||"Failed to connect to Ollama server",this.models=[]}this.loading=!1}})}handleSelectChange(e){var t;const i=(null===(t=e.detail)||void 0===t?void 0:t.value)||"";this.value=i,this.dispatchEvent(new CustomEvent("value-change",{detail:{value:i},bubbles:!0,composed:!0}))}handleInputChange(e){var t;const i=(null===(t=e.detail)||void 0===t?void 0:t.value)||"";this.value=i,this.dispatchEvent(new CustomEvent("value-change",{detail:{value:i},bubbles:!0,composed:!0}))}handleRefresh(){this.fetchModels()}formatSize(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:e<1073741824?`${(e/1048576).toFixed(1)} MB`:`${(e/1073741824).toFixed(1)} GB`}renderFooter(){return this.loading?i`
7950
8129
  <div class="loading-indicator">
7951
8130
  <div class="spinner"></div>
7952
8131
  <span>Loading models...</span>
@@ -7996,7 +8175,7 @@ var so=function(e,t,i,n){for(var a,o=arguments.length,s=o<3?t:null===n?n=Object.
7996
8175
  </button>
7997
8176
  </div>
7998
8177
  `:n}
7999
- `}};lo.styles=e`
8178
+ `}};go.styles=e`
8000
8179
  :host {
8001
8180
  display: block;
8002
8181
  }
@@ -8080,18 +8259,18 @@ var so=function(e,t,i,n){for(var a,o=arguments.length,s=o<3?t:null===n?n=Object.
8080
8259
  font-size: 12px;
8081
8260
  color: var(--text-secondary, #6b7280);
8082
8261
  }
8083
- `,so([o({type:String})],lo.prototype,"serverUrl",void 0),so([o({type:String})],lo.prototype,"value",void 0),so([o({type:String})],lo.prototype,"placeholder",void 0),so([s()],lo.prototype,"models",void 0),so([s()],lo.prototype,"loading",void 0),so([s()],lo.prototype,"error",void 0),lo=so([r("nr-ollama-model-select")],lo);
8262
+ `,bo([o({type:String})],go.prototype,"serverUrl",void 0),bo([o({type:String})],go.prototype,"value",void 0),bo([o({type:String})],go.prototype,"placeholder",void 0),bo([s()],go.prototype,"models",void 0),bo([s()],go.prototype,"loading",void 0),bo([s()],go.prototype,"error",void 0),go=bo([r("nr-ollama-model-select")],go);
8084
8263
  /**
8085
8264
  * @license
8086
8265
  * Copyright 2024 Nuraly, Laabidi Aymen
8087
8266
  * SPDX-License-Identifier: MIT
8088
8267
  */
8089
- const co={id:"openai",label:"OpenAI",defaultModel:"gpt-4",modelPlaceholder:"gpt-4, gpt-4-turbo, gpt-3.5-turbo...",modelOptions:[{label:"GPT-4",value:"gpt-4"},{label:"GPT-4 Turbo",value:"gpt-4-turbo"},{label:"GPT-4o",value:"gpt-4o"},{label:"GPT-4o Mini",value:"gpt-4o-mini"},{label:"GPT-3.5 Turbo",value:"gpt-3.5-turbo"},{label:"O1",value:"o1"},{label:"O1 Mini",value:"o1-mini"},{label:"O1 Preview",value:"o1-preview"}],requiresApiKey:!0,requiresApiUrl:!1,apiKeyDescription:"Select or create an OpenAI API key",defaultMaxTokens:4096},po={id:"anthropic",label:"Anthropic",defaultModel:"claude-sonnet-4-20250514",modelPlaceholder:"claude-sonnet-4, claude-opus-4...",modelOptions:[{label:"Claude Sonnet 4",value:"claude-sonnet-4-20250514"},{label:"Claude Opus 4",value:"claude-opus-4-20250514"},{label:"Claude 3.5 Sonnet",value:"claude-3-5-sonnet-20241022"},{label:"Claude 3.5 Haiku",value:"claude-3-5-haiku-20241022"},{label:"Claude 3 Opus",value:"claude-3-opus-20240229"},{label:"Claude 3 Sonnet",value:"claude-3-sonnet-20240229"},{label:"Claude 3 Haiku",value:"claude-3-haiku-20240307"}],requiresApiKey:!0,requiresApiUrl:!1,apiKeyDescription:"Select or create an Anthropic API key",defaultMaxTokens:4096},ho={id:"gemini",label:"Google (Gemini)",defaultModel:"gemini-1.5-pro",modelPlaceholder:"gemini-1.5-pro, gemini-1.5-flash...",modelOptions:[{label:"Gemini 2.0 Flash",value:"gemini-2.0-flash"},{label:"Gemini 1.5 Pro",value:"gemini-1.5-pro"},{label:"Gemini 1.5 Flash",value:"gemini-1.5-flash"},{label:"Gemini 1.5 Flash-8B",value:"gemini-1.5-flash-8b"},{label:"Gemini 1.0 Pro",value:"gemini-1.0-pro"}],requiresApiKey:!0,requiresApiUrl:!1,apiKeyDescription:"Select or create a Google AI API key",defaultMaxTokens:8192},uo={id:"ollama",label:"Ollama",defaultModel:"",modelPlaceholder:"Select a model from your Ollama server...",modelOptions:[],requiresApiKey:!1,requiresApiUrl:!0,apiKeyDescription:"Optional - Ollama works without authentication by default",apiUrlDescription:"URL of your Ollama server (e.g., http://localhost:11434)",defaultMaxTokens:2048},bo={id:"local",label:"Local",defaultModel:"",modelPlaceholder:"Enter model name...",modelOptions:[],requiresApiKey:!1,requiresApiUrl:!0,apiKeyDescription:"Optional - depends on your local server configuration",apiUrlDescription:"URL of your local LLM server (e.g., http://localhost:8080)",defaultMaxTokens:2048},fo={openai:co,anthropic:po,gemini:ho,ollama:uo,local:bo},go=[{label:co.label,value:co.id},{label:po.label,value:po.id},{label:ho.label,value:ho.id},{label:uo.label,value:uo.id},{label:bo.label,value:bo.id}];
8268
+ const vo={id:"openai",label:"OpenAI",defaultModel:"gpt-4",modelPlaceholder:"gpt-4, gpt-4-turbo, gpt-3.5-turbo...",modelOptions:[{label:"GPT-4",value:"gpt-4"},{label:"GPT-4 Turbo",value:"gpt-4-turbo"},{label:"GPT-4o",value:"gpt-4o"},{label:"GPT-4o Mini",value:"gpt-4o-mini"},{label:"GPT-3.5 Turbo",value:"gpt-3.5-turbo"},{label:"O1",value:"o1"},{label:"O1 Mini",value:"o1-mini"},{label:"O1 Preview",value:"o1-preview"}],requiresApiKey:!0,requiresApiUrl:!1,apiKeyDescription:"Select or create an OpenAI API key",defaultMaxTokens:4096},mo={id:"anthropic",label:"Anthropic",defaultModel:"claude-sonnet-4-20250514",modelPlaceholder:"claude-sonnet-4, claude-opus-4...",modelOptions:[{label:"Claude Sonnet 4",value:"claude-sonnet-4-20250514"},{label:"Claude Opus 4",value:"claude-opus-4-20250514"},{label:"Claude 3.5 Sonnet",value:"claude-3-5-sonnet-20241022"},{label:"Claude 3.5 Haiku",value:"claude-3-5-haiku-20241022"},{label:"Claude 3 Opus",value:"claude-3-opus-20240229"},{label:"Claude 3 Sonnet",value:"claude-3-sonnet-20240229"},{label:"Claude 3 Haiku",value:"claude-3-haiku-20240307"}],requiresApiKey:!0,requiresApiUrl:!1,apiKeyDescription:"Select or create an Anthropic API key",defaultMaxTokens:4096},xo={id:"gemini",label:"Google (Gemini)",defaultModel:"gemini-1.5-pro",modelPlaceholder:"gemini-1.5-pro, gemini-1.5-flash...",modelOptions:[{label:"Gemini 2.0 Flash",value:"gemini-2.0-flash"},{label:"Gemini 1.5 Pro",value:"gemini-1.5-pro"},{label:"Gemini 1.5 Flash",value:"gemini-1.5-flash"},{label:"Gemini 1.5 Flash-8B",value:"gemini-1.5-flash-8b"},{label:"Gemini 1.0 Pro",value:"gemini-1.0-pro"}],requiresApiKey:!0,requiresApiUrl:!1,apiKeyDescription:"Select or create a Google AI API key",defaultMaxTokens:8192},yo={id:"deepseek",label:"DeepSeek",defaultModel:"deepseek-chat",modelPlaceholder:"deepseek-chat, deepseek-reasoner...",modelOptions:[{label:"DeepSeek-V3 (Chat)",value:"deepseek-chat"},{label:"DeepSeek-R1 (Reasoner)",value:"deepseek-reasoner"}],requiresApiKey:!0,requiresApiUrl:!1,apiKeyDescription:"Select or create a DeepSeek API key",defaultMaxTokens:4096},wo={id:"ollama",label:"Ollama",defaultModel:"",modelPlaceholder:"Select a model from your Ollama server...",modelOptions:[],requiresApiKey:!1,requiresApiUrl:!0,apiKeyDescription:"Optional - Ollama works without authentication by default",apiUrlDescription:"URL of your Ollama server (e.g., http://localhost:11434)",defaultMaxTokens:2048},$o={id:"local",label:"Local",defaultModel:"",modelPlaceholder:"Enter model name...",modelOptions:[],requiresApiKey:!1,requiresApiUrl:!0,apiKeyDescription:"Optional - depends on your local server configuration",apiUrlDescription:"URL of your local LLM server (e.g., http://localhost:8080)",defaultMaxTokens:2048},ko={openai:vo,anthropic:mo,gemini:xo,deepseek:yo,ollama:wo,local:$o},So=[{label:vo.label,value:vo.id},{label:mo.label,value:mo.id},{label:xo.label,value:xo.id},{label:yo.label,value:yo.id},{label:wo.label,value:wo.id},{label:$o.label,value:$o.id}];
8090
8269
  /**
8091
8270
  * @license
8092
8271
  * Copyright 2024 Nuraly, Laabidi Aymen
8093
8272
  * SPDX-License-Identifier: MIT
8094
- */function vo(e){return fo[e]||co}
8273
+ */function Co(e){return ko[e]||vo}
8095
8274
  /**
8096
8275
  * @license
8097
8276
  * Copyright 2024 Nuraly, Laabidi Aymen
@@ -8102,7 +8281,7 @@ const co={id:"openai",label:"OpenAI",defaultModel:"gpt-4",modelPlaceholder:"gpt-
8102
8281
  * Copyright 2024 Nuraly, Laabidi Aymen
8103
8282
  * SPDX-License-Identifier: MIT
8104
8283
  */
8105
- const mo=[{value:"message",label:"Message Count"},{value:"token",label:"Token Count"}];const xo=e`
8284
+ const To=[{value:"message",label:"Message Count"},{value:"token",label:"Token Count"}];const Mo=e`
8106
8285
  :host {
8107
8286
  display: inline-block;
8108
8287
  cursor: pointer;
@@ -8145,7 +8324,7 @@ const mo=[{value:"message",label:"Message Count"},{value:"token",label:"Token Co
8145
8324
  * Copyright 2023 Nuraly, Laabidi Aymen
8146
8325
  * SPDX-License-Identifier: MIT
8147
8326
  */
8148
- var yo=function(e,t,i,n){for(var a,o=arguments.length,s=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n,r=e.length-1;r>=0;r--)(a=e[r])&&(s=(o<3?a(s):o>3?a(t,i,s):a(t,i))||s);return o>3&&s&&Object.defineProperty(t,i,s),s};let wo=class extends t{constructor(){super(...arguments),this.color="#3498db",this.size="default",this.disabled=!1,this.showTransparencyGrid=!0,this.borderWidth=2,this.showBorder=!0}isValidColor(){try{return CSS.supports("color",this.color)}catch(e){return!1}}isTransparent(){return"transparent"===this.color||this.color.toLowerCase().includes("rgba")||this.color.toLowerCase().includes("hsla")}render(){const e={"color-holder-container":!0,"color-holder-container--disabled":this.disabled,"color-holder-container--invalid":!this.isValidColor(),"color-holder-container--transparent":this.isTransparent()&&this.showTransparencyGrid,[`color-holder-container--${this.size}`]:!0},t={backgroundColor:this.isValidColor()?this.color:"#ffffff",borderWidth:this.showBorder?`${this.borderWidth}px`:"0"};return i`
8327
+ var Eo=function(e,t,i,n){for(var a,o=arguments.length,s=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n,r=e.length-1;r>=0;r--)(a=e[r])&&(s=(o<3?a(s):o>3?a(t,i,s):a(t,i))||s);return o>3&&s&&Object.defineProperty(t,i,s),s};let zo=class extends t{constructor(){super(...arguments),this.color="#3498db",this.size="default",this.disabled=!1,this.showTransparencyGrid=!0,this.borderWidth=2,this.showBorder=!0}isValidColor(){try{return CSS.supports("color",this.color)}catch(e){return!1}}isTransparent(){return"transparent"===this.color||this.color.toLowerCase().includes("rgba")||this.color.toLowerCase().includes("hsla")}render(){const e={"color-holder-container":!0,"color-holder-container--disabled":this.disabled,"color-holder-container--invalid":!this.isValidColor(),"color-holder-container--transparent":this.isTransparent()&&this.showTransparencyGrid,[`color-holder-container--${this.size}`]:!0},t={backgroundColor:this.isValidColor()?this.color:"#ffffff",borderWidth:this.showBorder?`${this.borderWidth}px`:"0"};return i`
8149
8328
  <div
8150
8329
  class="${p(e)}"
8151
8330
  style="${c(t)}"
@@ -8154,7 +8333,7 @@ var yo=function(e,t,i,n){for(var a,o=arguments.length,s=o<3?t:null===n?n=Object.
8154
8333
  aria-label="Color swatch: ${this.color}"
8155
8334
  title="${this.color}"
8156
8335
  ></div>
8157
- `}};wo.styles=xo,wo.useShadowDom=!0,yo([o({type:String})],wo.prototype,"color",void 0),yo([o({type:String,reflect:!0})],wo.prototype,"size",void 0),yo([o({type:Boolean,reflect:!0})],wo.prototype,"disabled",void 0),yo([o({type:Boolean,attribute:"show-transparency-grid"})],wo.prototype,"showTransparencyGrid",void 0),yo([o({type:Number,attribute:"border-width"})],wo.prototype,"borderWidth",void 0),yo([o({type:Boolean,attribute:"show-border"})],wo.prototype,"showBorder",void 0),wo=yo([r("nr-colorholder-box")],wo);const $o=e`
8336
+ `}};zo.styles=Mo,zo.useShadowDom=!0,Eo([o({type:String})],zo.prototype,"color",void 0),Eo([o({type:String,reflect:!0})],zo.prototype,"size",void 0),Eo([o({type:Boolean,reflect:!0})],zo.prototype,"disabled",void 0),Eo([o({type:Boolean,attribute:"show-transparency-grid"})],zo.prototype,"showTransparencyGrid",void 0),Eo([o({type:Number,attribute:"border-width"})],zo.prototype,"borderWidth",void 0),Eo([o({type:Boolean,attribute:"show-border"})],zo.prototype,"showBorder",void 0),zo=Eo([r("nr-colorholder-box")],zo);const Ao=e`
8158
8337
  .default-color-sets-container {
8159
8338
  display: flex;
8160
8339
  flex-wrap: wrap;
@@ -8186,7 +8365,7 @@ var yo=function(e,t,i,n){for(var a,o=arguments.length,s=o<3?t:null===n?n=Object.
8186
8365
  * Copyright 2023 Nuraly, Laabidi Aymen
8187
8366
  * SPDX-License-Identifier: MIT
8188
8367
  */
8189
- var ko=function(e,t,i,n){for(var a,o=arguments.length,s=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n,r=e.length-1;r>=0;r--)(a=e[r])&&(s=(o<3?a(s):o>3?a(t,i,s):a(t,i))||s);return o>3&&s&&Object.defineProperty(t,i,s),s};let So=class extends t{constructor(){super(...arguments),this.defaultColorSets=[],this.size="default",this.columns=8}handleColorClick(e,t){if(t.stopPropagation(),!this.isValidColor(e))return void console.warn(`Invalid color: ${e}`);const i={value:e};this.dispatchEvent(new CustomEvent("color-click",{bubbles:!0,composed:!0,detail:i}))}isValidColor(e){try{return CSS.supports("color",e)}catch(e){return!1}}render(){return this.defaultColorSets&&0!==this.defaultColorSets.length?i`
8368
+ var Oo=function(e,t,i,n){for(var a,o=arguments.length,s=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n,r=e.length-1;r>=0;r--)(a=e[r])&&(s=(o<3?a(s):o>3?a(t,i,s):a(t,i))||s);return o>3&&s&&Object.defineProperty(t,i,s),s};let Io=class extends t{constructor(){super(...arguments),this.defaultColorSets=[],this.size="default",this.columns=8}handleColorClick(e,t){if(t.stopPropagation(),!this.isValidColor(e))return void console.warn(`Invalid color: ${e}`);const i={value:e};this.dispatchEvent(new CustomEvent("color-click",{bubbles:!0,composed:!0,detail:i}))}isValidColor(e){try{return CSS.supports("color",e)}catch(e){return!1}}render(){return this.defaultColorSets&&0!==this.defaultColorSets.length?i`
8190
8369
  <div
8191
8370
  class="default-color-sets-container"
8192
8371
  part="container"
@@ -8207,7 +8386,7 @@ var ko=function(e,t,i,n){for(var a,o=arguments.length,s=o<3?t:null===n?n=Object.
8207
8386
  ></nr-colorholder-box>
8208
8387
  `)}
8209
8388
  </div>
8210
- `:n}};So.styles=$o,So.useShadowDom=!0,ko([o({type:Array,attribute:"default-color-sets"})],So.prototype,"defaultColorSets",void 0),ko([o({type:String,reflect:!0})],So.prototype,"size",void 0),ko([o({type:Number,attribute:"columns"})],So.prototype,"columns",void 0),So=ko([r("nr-default-color-sets")],So);var Co=e`
8389
+ `:n}};Io.styles=Ao,Io.useShadowDom=!0,Oo([o({type:Array,attribute:"default-color-sets"})],Io.prototype,"defaultColorSets",void 0),Oo([o({type:String,reflect:!0})],Io.prototype,"size",void 0),Oo([o({type:Number,attribute:"columns"})],Io.prototype,"columns",void 0),Io=Oo([r("nr-default-color-sets")],Io);var Po=e`
8211
8390
  :host {
8212
8391
  display: inline-block;
8213
8392
  vertical-align: middle;
@@ -8283,12 +8462,12 @@ var ko=function(e,t,i,n){for(var a,o=arguments.length,s=o<3?t:null===n?n=Object.
8283
8462
  opacity: 1;
8284
8463
  visibility: visible;
8285
8464
  }
8286
- `;class To extends Ue{findElement(e){var t;return(null===(t=this._host.shadowRoot)||void 0===t?void 0:t.querySelector(e))||null}}class Mo extends To{constructor(){super(...arguments),this._isOpen=!1,this._position={top:0,left:0,width:0,placement:"bottom"},this._dropdownElement=null,this._triggerElement=null,this._scrollHandler=null,this._resizeHandler=null}get isOpen(){return this._isOpen}get position(){return Object.assign({},this._position)}hostConnected(){this.setupScrollAndResizeListeners()}hostDisconnected(){this.cleanup()}open(){try{this._isOpen||this.host.disabled||(this._isOpen=!0,this.host.show=!0,this.requestUpdate(),requestAnimationFrame(()=>{this.findElements(),this._dropdownElement&&this._dropdownElement.classList.remove("positioned"),requestAnimationFrame(()=>{this.calculatePosition(),this._dropdownElement&&this._dropdownElement.classList.add("positioned")})}),this.host&&"function"==typeof this.host.setupEventListeners&&setTimeout(()=>{var e,t;null===(t=(e=this.host).setupEventListeners)||void 0===t||t.call(e)},50),this.dispatchEvent(new CustomEvent("nr-colorpicker-open",{bubbles:!0,composed:!0})))}catch(e){this.handleError(e,"open")}}close(){var e,t;try{this._isOpen&&(this._isOpen=!1,this.host.show=!1,this.resetPosition(),this.requestUpdate(),this.host&&"function"==typeof this.host.removeEventListeners&&(null===(t=(e=this.host).removeEventListeners)||void 0===t||t.call(e)),this.dispatchEvent(new CustomEvent("nr-colorpicker-close",{bubbles:!0,composed:!0})))}catch(e){this.handleError(e,"close")}}toggle(){this._isOpen?this.close():this.open()}findElements(){this._dropdownElement=this.findElement(".dropdown-container"),this._triggerElement=this.findElement(".color-holder")}calculatePosition(){var e,t;try{if(this._dropdownElement&&this._triggerElement||this.findElements(),!this._dropdownElement||!this._triggerElement)return;const i=this._triggerElement.getBoundingClientRect(),n=this._dropdownElement.getBoundingClientRect(),a=(null===(e=window.visualViewport)||void 0===e?void 0:e.height)||window.innerHeight,o=(null===(t=window.visualViewport)||void 0===t?void 0:t.width)||window.innerWidth,s=a-i.bottom,r=i.top,l=o-i.left;let c,d,p="bottom";s>=n.height||s>r?(c=i.bottom,p="bottom"):(c=i.top-n.height,p="top"),d=l>=n.width?i.left:Math.max(0,o-n.width),this._position={top:c,left:d,width:Math.max(i.width,n.width),placement:p},this.applyPosition()}catch(e){this.handleError(e,"calculatePosition")}}applyPosition(){try{if(!this._dropdownElement)return;this._dropdownElement.style.position="fixed",this._dropdownElement.style.top=`${this._position.top}px`,this._dropdownElement.style.left=`${this._position.left}px`,this._dropdownElement.style.zIndex="9999",this._dropdownElement.classList.remove("placement-top","placement-bottom"),this._dropdownElement.classList.add(`placement-${this._position.placement}`),this._dropdownElement.classList.add("positioned")}catch(e){this.handleError(e,"applyPosition")}}resetPosition(){try{this._dropdownElement&&(this._dropdownElement.style.removeProperty("position"),this._dropdownElement.style.removeProperty("top"),this._dropdownElement.style.removeProperty("left"),this._dropdownElement.style.removeProperty("z-index"),this._dropdownElement.classList.remove("placement-top","placement-bottom","positioned"))}catch(e){this.handleError(e,"resetPosition")}}setupScrollAndResizeListeners(){this._scrollHandler=()=>{this._isOpen&&this.calculatePosition()},this._resizeHandler=()=>{this._isOpen&&this.calculatePosition()},document.addEventListener("scroll",this._scrollHandler,{passive:!0}),window.addEventListener("resize",this._resizeHandler)}cleanup(){this._scrollHandler&&(document.removeEventListener("scroll",this._scrollHandler),this._scrollHandler=null),this._resizeHandler&&(window.removeEventListener("resize",this._resizeHandler),this._resizeHandler=null)}}class zo extends To{constructor(){super(...arguments),this._outsideClickHandler=null,this._escapeHandler=null}setupEventListeners(){this._outsideClickHandler=this.handleOutsideClick.bind(this),document.addEventListener("click",this._outsideClickHandler,!0),this._escapeHandler=this.handleEscapeKey.bind(this),document.addEventListener("keydown",this._escapeHandler)}removeEventListeners(){this._outsideClickHandler&&(document.removeEventListener("click",this._outsideClickHandler,!0),this._outsideClickHandler=null),this._escapeHandler&&(document.removeEventListener("keydown",this._escapeHandler),this._escapeHandler=null)}handleTriggerClick(e){if(e.stopPropagation(),!this.host.disabled){const e=this.host.dropdownController;e&&e.toggle()}}handleOutsideClick(e){if(!e.composedPath().includes(this.host)){const e=this.host.dropdownController;e&&e.close()}}handleEscapeKey(e){if("Escape"===e.key&&this.host.show){e.preventDefault();const t=this.host.dropdownController;t&&t.close()}}handleColorChange(e){if(this.isValidColor(e)&&this.host.color!==e){const t=this.host.color;this.host.color=e,this.dispatchColorChangeEvent(e,t),this.requestUpdate()}}handleInputChange(e){const t=e.detail.value;t&&t!==this.host.color&&this.handleColorChange(t)}dispatchColorChangeEvent(e,t){const i={value:e,previousValue:t,isValid:this.isValidColor(e),color:e};this.dispatchEvent(new CustomEvent("nr-color-change",{bubbles:!0,composed:!0,detail:i})),this.dispatchEvent(new CustomEvent("hy-color-change",{bubbles:!0,composed:!0,detail:i})),this.dispatchEvent(new CustomEvent("color-changed",{bubbles:!0,composed:!0,detail:{value:e,color:e}}))}isValidColor(e){try{return CSS.supports("color",e)}catch(e){return!1}}}
8465
+ `;class No extends Ue{findElement(e){var t;return(null===(t=this._host.shadowRoot)||void 0===t?void 0:t.querySelector(e))||null}}class Ro extends No{constructor(){super(...arguments),this._isOpen=!1,this._position={top:0,left:0,width:0,placement:"bottom"},this._dropdownElement=null,this._triggerElement=null,this._scrollHandler=null,this._resizeHandler=null}get isOpen(){return this._isOpen}get position(){return Object.assign({},this._position)}hostConnected(){this.setupScrollAndResizeListeners()}hostDisconnected(){this.cleanup()}open(){try{this._isOpen||this.host.disabled||(this._isOpen=!0,this.host.show=!0,this.requestUpdate(),requestAnimationFrame(()=>{this.findElements(),this._dropdownElement&&this._dropdownElement.classList.remove("positioned"),requestAnimationFrame(()=>{this.calculatePosition(),this._dropdownElement&&this._dropdownElement.classList.add("positioned")})}),this.host&&"function"==typeof this.host.setupEventListeners&&setTimeout(()=>{var e,t;null===(t=(e=this.host).setupEventListeners)||void 0===t||t.call(e)},50),this.dispatchEvent(new CustomEvent("nr-colorpicker-open",{bubbles:!0,composed:!0})))}catch(e){this.handleError(e,"open")}}close(){var e,t;try{this._isOpen&&(this._isOpen=!1,this.host.show=!1,this.resetPosition(),this.requestUpdate(),this.host&&"function"==typeof this.host.removeEventListeners&&(null===(t=(e=this.host).removeEventListeners)||void 0===t||t.call(e)),this.dispatchEvent(new CustomEvent("nr-colorpicker-close",{bubbles:!0,composed:!0})))}catch(e){this.handleError(e,"close")}}toggle(){this._isOpen?this.close():this.open()}findElements(){this._dropdownElement=this.findElement(".dropdown-container"),this._triggerElement=this.findElement(".color-holder")}calculatePosition(){var e,t;try{if(this._dropdownElement&&this._triggerElement||this.findElements(),!this._dropdownElement||!this._triggerElement)return;const i=this._triggerElement.getBoundingClientRect(),n=this._dropdownElement.getBoundingClientRect(),a=(null===(e=window.visualViewport)||void 0===e?void 0:e.height)||window.innerHeight,o=(null===(t=window.visualViewport)||void 0===t?void 0:t.width)||window.innerWidth,s=a-i.bottom,r=i.top,l=o-i.left;let c,d,p="bottom";s>=n.height||s>r?(c=i.bottom,p="bottom"):(c=i.top-n.height,p="top"),d=l>=n.width?i.left:Math.max(0,o-n.width),this._position={top:c,left:d,width:Math.max(i.width,n.width),placement:p},this.applyPosition()}catch(e){this.handleError(e,"calculatePosition")}}applyPosition(){try{if(!this._dropdownElement)return;this._dropdownElement.style.position="fixed",this._dropdownElement.style.top=`${this._position.top}px`,this._dropdownElement.style.left=`${this._position.left}px`,this._dropdownElement.style.zIndex="9999",this._dropdownElement.classList.remove("placement-top","placement-bottom"),this._dropdownElement.classList.add(`placement-${this._position.placement}`),this._dropdownElement.classList.add("positioned")}catch(e){this.handleError(e,"applyPosition")}}resetPosition(){try{this._dropdownElement&&(this._dropdownElement.style.removeProperty("position"),this._dropdownElement.style.removeProperty("top"),this._dropdownElement.style.removeProperty("left"),this._dropdownElement.style.removeProperty("z-index"),this._dropdownElement.classList.remove("placement-top","placement-bottom","positioned"))}catch(e){this.handleError(e,"resetPosition")}}setupScrollAndResizeListeners(){this._scrollHandler=()=>{this._isOpen&&this.calculatePosition()},this._resizeHandler=()=>{this._isOpen&&this.calculatePosition()},document.addEventListener("scroll",this._scrollHandler,{passive:!0}),window.addEventListener("resize",this._resizeHandler)}cleanup(){this._scrollHandler&&(document.removeEventListener("scroll",this._scrollHandler),this._scrollHandler=null),this._resizeHandler&&(window.removeEventListener("resize",this._resizeHandler),this._resizeHandler=null)}}class Do extends No{constructor(){super(...arguments),this._outsideClickHandler=null,this._escapeHandler=null}setupEventListeners(){this._outsideClickHandler=this.handleOutsideClick.bind(this),document.addEventListener("click",this._outsideClickHandler,!0),this._escapeHandler=this.handleEscapeKey.bind(this),document.addEventListener("keydown",this._escapeHandler)}removeEventListeners(){this._outsideClickHandler&&(document.removeEventListener("click",this._outsideClickHandler,!0),this._outsideClickHandler=null),this._escapeHandler&&(document.removeEventListener("keydown",this._escapeHandler),this._escapeHandler=null)}handleTriggerClick(e){if(e.stopPropagation(),!this.host.disabled){const e=this.host.dropdownController;e&&e.toggle()}}handleOutsideClick(e){if(!e.composedPath().includes(this.host)){const e=this.host.dropdownController;e&&e.close()}}handleEscapeKey(e){if("Escape"===e.key&&this.host.show){e.preventDefault();const t=this.host.dropdownController;t&&t.close()}}handleColorChange(e){if(this.isValidColor(e)&&this.host.color!==e){const t=this.host.color;this.host.color=e,this.dispatchColorChangeEvent(e,t),this.requestUpdate()}}handleInputChange(e){const t=e.detail.value;t&&t!==this.host.color&&this.handleColorChange(t)}dispatchColorChangeEvent(e,t){const i={value:e,previousValue:t,isValid:this.isValidColor(e),color:e};this.dispatchEvent(new CustomEvent("nr-color-change",{bubbles:!0,composed:!0,detail:i})),this.dispatchEvent(new CustomEvent("hy-color-change",{bubbles:!0,composed:!0,detail:i})),this.dispatchEvent(new CustomEvent("color-changed",{bubbles:!0,composed:!0,detail:{value:e,color:e}}))}isValidColor(e){try{return CSS.supports("color",e)}catch(e){return!1}}}
8287
8466
  /**
8288
8467
  * @license
8289
8468
  * Copyright 2023 Nuraly, Laabidi Aymen
8290
8469
  * SPDX-License-Identifier: MIT
8291
- */var Eo=function(e,t,i,n){for(var a,o=arguments.length,s=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n,r=e.length-1;r>=0;r--)(a=e[r])&&(s=(o<3?a(s):o>3?a(t,i,s):a(t,i))||s);return o>3&&s&&Object.defineProperty(t,i,s),s};let Oo=class extends(we(t)){constructor(){super(),this.requiredComponents=["nr-input","nr-icon"],this.color="#3498db",this.show=!1,this.defaultColorSets=[],this.disabled=!1,this.size="default",this.trigger="click",this.placement="auto",this.animation="fade",this.closeOnSelect=!1,this.closeOnOutsideClick=!0,this.closeOnEscape=!0,this.showInput=!0,this.showCopyButton=!0,this.format="hex",this.inputPlaceholder="Enter color",this.label="",this.helperText="",this.isValidColor=!0,this.dropdownController=new Mo(this),this.eventController=new zo(this),this.handleTriggerClick=e=>{this.eventController.handleTriggerClick(e)},this.handleColorChanged=e=>{const t=e.detail.value;this.eventController.handleColorChange(t),this.closeOnSelect&&this.dropdownController.close()},this.handleInputChange=e=>{this.eventController.handleInputChange(e)},"undefined"!=typeof window&&Promise.resolve().then(function(){return pl})}connectedCallback(){super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback()}updated(e){super.updated(e),e.has("color")&&this.validateColor()}open(){this.dropdownController.open()}close(){this.dropdownController.close()}toggle(){this.dropdownController.toggle()}validateColor(){return this.isValidColor=this.eventController.isValidColor(this.color),this.isValidColor}setupEventListeners(){(this.closeOnOutsideClick||this.closeOnEscape)&&this.eventController.setupEventListeners()}removeEventListeners(){this.eventController.removeEventListeners()}render(){const e={"color-picker-container":!0,"color-picker-container--disabled":this.disabled,"color-picker-container--open":this.show,[`color-picker-container--${this.size}`]:!0};return i`
8470
+ */var _o=function(e,t,i,n){for(var a,o=arguments.length,s=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n,r=e.length-1;r>=0;r--)(a=e[r])&&(s=(o<3?a(s):o>3?a(t,i,s):a(t,i))||s);return o>3&&s&&Object.defineProperty(t,i,s),s};let jo=class extends(we(t)){constructor(){super(),this.requiredComponents=["nr-input","nr-icon"],this.color="#3498db",this.show=!1,this.defaultColorSets=[],this.disabled=!1,this.size="default",this.trigger="click",this.placement="auto",this.animation="fade",this.closeOnSelect=!1,this.closeOnOutsideClick=!0,this.closeOnEscape=!0,this.showInput=!0,this.showCopyButton=!0,this.format="hex",this.inputPlaceholder="Enter color",this.label="",this.helperText="",this.isValidColor=!0,this.dropdownController=new Ro(this),this.eventController=new Do(this),this.handleTriggerClick=e=>{this.eventController.handleTriggerClick(e)},this.handleColorChanged=e=>{const t=e.detail.value;this.eventController.handleColorChange(t),this.closeOnSelect&&this.dropdownController.close()},this.handleInputChange=e=>{this.eventController.handleInputChange(e)},"undefined"!=typeof window&&Promise.resolve().then(function(){return xl})}connectedCallback(){super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback()}updated(e){super.updated(e),e.has("color")&&this.validateColor()}open(){this.dropdownController.open()}close(){this.dropdownController.close()}toggle(){this.dropdownController.toggle()}validateColor(){return this.isValidColor=this.eventController.isValidColor(this.color),this.isValidColor}setupEventListeners(){(this.closeOnOutsideClick||this.closeOnEscape)&&this.eventController.setupEventListeners()}removeEventListeners(){this.eventController.removeEventListeners()}render(){const e={"color-picker-container":!0,"color-picker-container--disabled":this.disabled,"color-picker-container--open":this.show,[`color-picker-container--${this.size}`]:!0};return i`
8292
8471
  <div class="${p(e)}" data-theme="${this.currentTheme}">
8293
8472
  ${this.renderLabel()}
8294
8473
 
@@ -8360,13 +8539,13 @@ return function(e,t,a){if(!e)return n;const o=(null==a?void 0:a.cssClass)||"labe
8360
8539
  <div class="color-picker-helper-text">
8361
8540
  ${this.helperText}
8362
8541
  </div>
8363
- `:n}};Oo.useShadowDom=!0,Oo.styles=Co,Eo([o({type:String})],Oo.prototype,"color",void 0),Eo([o({type:Boolean,reflect:!0})],Oo.prototype,"show",void 0),Eo([o({type:Array,attribute:"default-color-sets"})],Oo.prototype,"defaultColorSets",void 0),Eo([o({type:Boolean,reflect:!0})],Oo.prototype,"disabled",void 0),Eo([o({type:String,reflect:!0})],Oo.prototype,"size",void 0),Eo([o({type:String,reflect:!0})],Oo.prototype,"trigger",void 0),Eo([o({type:String,reflect:!0})],Oo.prototype,"placement",void 0),Eo([o({type:String,reflect:!0})],Oo.prototype,"animation",void 0),Eo([o({type:Boolean,attribute:"close-on-select"})],Oo.prototype,"closeOnSelect",void 0),Eo([o({type:Boolean,attribute:"close-on-outside-click"})],Oo.prototype,"closeOnOutsideClick",void 0),Eo([o({type:Boolean,attribute:"close-on-escape"})],Oo.prototype,"closeOnEscape",void 0),Eo([o({type:Boolean,attribute:"show-input"})],Oo.prototype,"showInput",void 0),Eo([o({type:Boolean,attribute:"show-copy-button"})],Oo.prototype,"showCopyButton",void 0),Eo([o({type:String,reflect:!0})],Oo.prototype,"format",void 0),Eo([o({type:String,attribute:"input-placeholder"})],Oo.prototype,"inputPlaceholder",void 0),Eo([o({type:String})],Oo.prototype,"label",void 0),Eo([o({type:String,attribute:"helper-text"})],Oo.prototype,"helperText",void 0),Eo([s()],Oo.prototype,"isValidColor",void 0),Oo=Eo([r("nr-color-picker")],Oo);
8542
+ `:n}};jo.useShadowDom=!0,jo.styles=Po,_o([o({type:String})],jo.prototype,"color",void 0),_o([o({type:Boolean,reflect:!0})],jo.prototype,"show",void 0),_o([o({type:Array,attribute:"default-color-sets"})],jo.prototype,"defaultColorSets",void 0),_o([o({type:Boolean,reflect:!0})],jo.prototype,"disabled",void 0),_o([o({type:String,reflect:!0})],jo.prototype,"size",void 0),_o([o({type:String,reflect:!0})],jo.prototype,"trigger",void 0),_o([o({type:String,reflect:!0})],jo.prototype,"placement",void 0),_o([o({type:String,reflect:!0})],jo.prototype,"animation",void 0),_o([o({type:Boolean,attribute:"close-on-select"})],jo.prototype,"closeOnSelect",void 0),_o([o({type:Boolean,attribute:"close-on-outside-click"})],jo.prototype,"closeOnOutsideClick",void 0),_o([o({type:Boolean,attribute:"close-on-escape"})],jo.prototype,"closeOnEscape",void 0),_o([o({type:Boolean,attribute:"show-input"})],jo.prototype,"showInput",void 0),_o([o({type:Boolean,attribute:"show-copy-button"})],jo.prototype,"showCopyButton",void 0),_o([o({type:String,reflect:!0})],jo.prototype,"format",void 0),_o([o({type:String,attribute:"input-placeholder"})],jo.prototype,"inputPlaceholder",void 0),_o([o({type:String})],jo.prototype,"label",void 0),_o([o({type:String,attribute:"helper-text"})],jo.prototype,"helperText",void 0),_o([s()],jo.prototype,"isValidColor",void 0),jo=_o([r("nr-color-picker")],jo);
8364
8543
  /**
8365
8544
  * @license
8366
8545
  * Copyright 2024 Nuraly
8367
8546
  * SPDX-License-Identifier: MIT
8368
8547
  */
8369
- const Ao=e`
8548
+ const Lo=e`
8370
8549
  :host {
8371
8550
  display: block;
8372
8551
  width: 100%;
@@ -8526,13 +8705,13 @@ const Ao=e`
8526
8705
  * @license
8527
8706
  * Copyright 2024 Nuraly
8528
8707
  * SPDX-License-Identifier: MIT
8529
- */,Io="vs",Po="vs-dark",No="hc-black",Ro="hc-light",Do=e=>class extends e{constructor(){super(...arguments),this.handleSystemThemeChange=()=>{this.closest("[data-theme]")||document.documentElement.hasAttribute("data-theme")||this.requestUpdate()}}connectedCallback(){super.connectedCallback(),this.setupThemeObserver(),this.setupDesignSystemObserver(),this.setupSystemThemeListener()}disconnectedCallback(){var e,t,i;super.disconnectedCallback(),null===(e=this.themeObserver)||void 0===e||e.disconnect(),null===(t=this.designSystemObserver)||void 0===t||t.disconnect(),null===(i=this.mediaQuery)||void 0===i||i.removeEventListener("change",this.handleSystemThemeChange)}get currentTheme(){var e;const t=this.explicitTheme;return t||((null===(e=window.matchMedia)||void 0===e?void 0:e.call(window,"(prefers-color-scheme: dark)").matches)?"dark":"light")}get explicitTheme(){var e;return(null===(e=this.closest("[data-theme]"))||void 0===e?void 0:e.getAttribute("data-theme"))||document.documentElement.getAttribute("data-theme")||null}get currentDesignSystem(){var e;const t=(null===(e=this.closest("[design-system]"))||void 0===e?void 0:e.getAttribute("design-system"))||document.documentElement.getAttribute("design-system");return"carbon"===t?t:"default"}setupThemeObserver(){this.themeObserver=new MutationObserver(()=>{this.requestUpdate()}),this.themeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]})}setupDesignSystemObserver(){this.designSystemObserver=new MutationObserver(()=>{this.requestUpdate()}),this.designSystemObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["design-system"]})}setupSystemThemeListener(){window.matchMedia&&(this.mediaQuery=window.matchMedia("(prefers-color-scheme: dark)"),this.mediaQuery.addEventListener("change",this.handleSystemThemeChange))}};
8708
+ */,Fo="vs",Bo="vs-dark",Uo="hc-black",Vo="hc-light",Ho=e=>class extends e{constructor(){super(...arguments),this.handleSystemThemeChange=()=>{this.closest("[data-theme]")||document.documentElement.hasAttribute("data-theme")||this.requestUpdate()}}connectedCallback(){super.connectedCallback(),this.setupThemeObserver(),this.setupDesignSystemObserver(),this.setupSystemThemeListener()}disconnectedCallback(){var e,t,i;super.disconnectedCallback(),null===(e=this.themeObserver)||void 0===e||e.disconnect(),null===(t=this.designSystemObserver)||void 0===t||t.disconnect(),null===(i=this.mediaQuery)||void 0===i||i.removeEventListener("change",this.handleSystemThemeChange)}get currentTheme(){var e;const t=this.explicitTheme;return t||((null===(e=window.matchMedia)||void 0===e?void 0:e.call(window,"(prefers-color-scheme: dark)").matches)?"dark":"light")}get explicitTheme(){var e;return(null===(e=this.closest("[data-theme]"))||void 0===e?void 0:e.getAttribute("data-theme"))||document.documentElement.getAttribute("data-theme")||null}get currentDesignSystem(){var e;const t=(null===(e=this.closest("[design-system]"))||void 0===e?void 0:e.getAttribute("design-system"))||document.documentElement.getAttribute("design-system");return"carbon"===t?t:"default"}setupThemeObserver(){this.themeObserver=new MutationObserver(()=>{this.requestUpdate()}),this.themeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]})}setupDesignSystemObserver(){this.designSystemObserver=new MutationObserver(()=>{this.requestUpdate()}),this.designSystemObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["design-system"]})}setupSystemThemeListener(){window.matchMedia&&(this.mediaQuery=window.matchMedia("(prefers-color-scheme: dark)"),this.mediaQuery.addEventListener("change",this.handleSystemThemeChange))}};
8530
8709
  /**
8531
8710
  * @license
8532
8711
  * Copyright 2024 Nuraly
8533
8712
  * SPDX-License-Identifier: MIT
8534
8713
  */
8535
- var _o=function(e,t,i,n){for(var a,o=arguments.length,s=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n,r=e.length-1;r>=0;r--)(a=e[r])&&(s=(o<3?a(s):o>3?a(t,i,s):a(t,i))||s);return o>3&&s&&Object.defineProperty(t,i,s),s};y.registerLanguage("javascript",w),y.registerLanguage("typescript",$),y.registerLanguage("json",k),y.registerLanguage("html",S),y.registerLanguage("xml",S),y.registerLanguage("css",C),y.registerLanguage("markdown",T),y.registerLanguage("python",M),y.registerLanguage("sql",z);let jo=class extends(Do(t)){constructor(){super(...arguments),this.isEditorReady=!1,this.editorRef=v(),this.suppressChange=!1,this.readonly=!1,this.theme=Po,this.language="javascript",this.code="",this.lineNumbers=!0,this.fontSize=13,this.wordWrap=!1,this.tabSize=2}render(){const e=this.isDarkTheme();return i`
8714
+ var qo=function(e,t,i,n){for(var a,o=arguments.length,s=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n,r=e.length-1;r>=0;r--)(a=e[r])&&(s=(o<3?a(s):o>3?a(t,i,s):a(t,i))||s);return o>3&&s&&Object.defineProperty(t,i,s),s};y.registerLanguage("javascript",w),y.registerLanguage("typescript",$),y.registerLanguage("json",k),y.registerLanguage("html",S),y.registerLanguage("xml",S),y.registerLanguage("css",C),y.registerLanguage("markdown",T),y.registerLanguage("python",M),y.registerLanguage("sql",E);let Wo=class extends(Ho(t)){constructor(){super(...arguments),this.isEditorReady=!1,this.editorRef=v(),this.suppressChange=!1,this.readonly=!1,this.theme=Bo,this.language="javascript",this.code="",this.lineNumbers=!0,this.fontSize=13,this.wordWrap=!1,this.tabSize=2}render(){const e=this.isDarkTheme();return i`
8536
8715
  <div class="editor-container ${e?"dark":"light"}" part="editor-container">
8537
8716
  <div class="line-numbers-gutter" style="display: ${this.lineNumbers?"block":"none"}"></div>
8538
8717
  <code
@@ -8541,13 +8720,13 @@ var _o=function(e,t,i,n){for(var a,o=arguments.length,s=o<3?t:null===n?n=Object.
8541
8720
  style="font-size: ${this.fontSize}px; tab-size: ${this.tabSize}; white-space: ${this.wordWrap?"pre-wrap":"pre"};"
8542
8721
  ></code>
8543
8722
  </div>
8544
- `}getValue(){var e,t;return null!==(t=null===(e=this.editorRef.value)||void 0===e?void 0:e.textContent)&&void 0!==t?t:""}setValue(e){this.jar&&(this.suppressChange=!0,this.jar.updateCode(e),this.suppressChange=!1)}focus(){var e;null===(e=this.editorRef.value)||void 0===e||e.focus()}firstUpdated(){this.editorRef.value&&this.initializeEditor()}initializeEditor(){const e=this.editorRef.value;e.textContent=this.code;this.jar=x(e,e=>{const t=e.textContent||"",i=this.language||"plaintext";try{"plaintext"!==i&&y.getLanguage(i)?e.innerHTML=y.highlight(t,{language:i}).value:e.innerHTML=this.escapeHtml(t)}catch(i){e.innerHTML=this.escapeHtml(t)}},{tab:" ".repeat(this.tabSize),indentOn:/[({[]$/,addClosing:!0,catchTab:!0,preserveIdent:!0,history:!0}),this.isEditorReady=!0,this.jar.onUpdate(e=>{this.suppressChange||(this.code=e,this.updateLineNumbers(),this.emit("nr-change",{value:e}))}),e.addEventListener("keydown",e=>{this.readonly?e.preventDefault():this.emit("nr-keydown",this.createKeyEventDetail(e))}),e.addEventListener("keyup",e=>{this.emit("nr-keyup",this.createKeyEventDetail(e))}),e.addEventListener("focus",()=>this.emit("nr-focus")),e.addEventListener("blur",()=>this.emit("nr-blur")),this.readonly&&e.setAttribute("contenteditable","false"),this.updateLineNumbers(),this.emit("nr-ready",{editor:this.jar})}escapeHtml(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}updateLineNumbers(){var e,t,i;const n=null!==(t=null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector(".line-numbers-gutter"))&&void 0!==t?t:null===(i=this.renderRoot)||void 0===i?void 0:i.querySelector(".line-numbers-gutter");if(!n||!this.lineNumbers)return;const a=this.getValue().split("\n").length;n.innerHTML=Array.from({length:a},(e,t)=>`<div class="line-number">${t+1}</div>`).join("")}createKeyEventDetail(e){return{event:e,key:e.key,code:e.code,ctrlKey:e.ctrlKey,shiftKey:e.shiftKey,altKey:e.altKey,metaKey:e.metaKey}}emit(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0}))}isDarkTheme(){var e,t;return this.theme===Po||this.theme===No||this.theme!==Io&&this.theme!==Ro&&(null!==(t=null===(e=this.currentTheme)||void 0===e?void 0:e.includes("dark"))&&void 0!==t&&t)}updated(e){var t;if(super.updated(e),this.isEditorReady&&this.jar){if(e.has("code")&&this.code!==e.get("code")){const e=this.getValue();this.code!==e&&(this.setValue(this.code),this.updateLineNumbers())}e.has("readonly")&&(null===(t=this.editorRef.value)||void 0===t||t.setAttribute("contenteditable",this.readonly?"false":"true"))}}disconnectedCallback(){super.disconnectedCallback(),this.jar&&(this.jar.destroy(),this.jar=void 0),this.isEditorReady=!1}};jo.styles=Ao,jo.useShadowDom=!0,_o([o({type:Boolean,reflect:!0})],jo.prototype,"readonly",void 0),_o([o({type:String,reflect:!0})],jo.prototype,"theme",void 0),_o([o({type:String,reflect:!0})],jo.prototype,"language",void 0),_o([o({type:String})],jo.prototype,"code",void 0),_o([o({type:Boolean,attribute:"line-numbers"})],jo.prototype,"lineNumbers",void 0),_o([o({type:Number,attribute:"font-size"})],jo.prototype,"fontSize",void 0),_o([o({type:Boolean,attribute:"word-wrap"})],jo.prototype,"wordWrap",void 0),_o([o({type:Number,attribute:"tab-size"})],jo.prototype,"tabSize",void 0),jo=_o([r("nr-code-editor")],jo);
8723
+ `}getValue(){var e,t;return null!==(t=null===(e=this.editorRef.value)||void 0===e?void 0:e.textContent)&&void 0!==t?t:""}setValue(e){this.jar&&(this.suppressChange=!0,this.jar.updateCode(e),this.suppressChange=!1)}focus(){var e;null===(e=this.editorRef.value)||void 0===e||e.focus()}firstUpdated(){this.editorRef.value&&this.initializeEditor()}initializeEditor(){const e=this.editorRef.value;e.textContent=this.code;this.jar=x(e,e=>{const t=e.textContent||"",i=this.language||"plaintext";try{"plaintext"!==i&&y.getLanguage(i)?e.innerHTML=y.highlight(t,{language:i}).value:e.innerHTML=this.escapeHtml(t)}catch(i){e.innerHTML=this.escapeHtml(t)}},{tab:" ".repeat(this.tabSize),indentOn:/[({[]$/,addClosing:!0,catchTab:!0,preserveIdent:!0,history:!0}),this.isEditorReady=!0,this.jar.onUpdate(e=>{this.suppressChange||(this.code=e,this.updateLineNumbers(),this.emit("nr-change",{value:e}))}),e.addEventListener("keydown",e=>{this.readonly?e.preventDefault():this.emit("nr-keydown",this.createKeyEventDetail(e))}),e.addEventListener("keyup",e=>{this.emit("nr-keyup",this.createKeyEventDetail(e))}),e.addEventListener("focus",()=>this.emit("nr-focus")),e.addEventListener("blur",()=>this.emit("nr-blur")),this.readonly&&e.setAttribute("contenteditable","false"),this.updateLineNumbers(),this.emit("nr-ready",{editor:this.jar})}escapeHtml(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}updateLineNumbers(){var e,t,i;const n=null!==(t=null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector(".line-numbers-gutter"))&&void 0!==t?t:null===(i=this.renderRoot)||void 0===i?void 0:i.querySelector(".line-numbers-gutter");if(!n||!this.lineNumbers)return;const a=this.getValue().split("\n").length;n.innerHTML=Array.from({length:a},(e,t)=>`<div class="line-number">${t+1}</div>`).join("")}createKeyEventDetail(e){return{event:e,key:e.key,code:e.code,ctrlKey:e.ctrlKey,shiftKey:e.shiftKey,altKey:e.altKey,metaKey:e.metaKey}}emit(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0}))}isDarkTheme(){var e,t;return this.theme===Bo||this.theme===Uo||this.theme!==Fo&&this.theme!==Vo&&(null!==(t=null===(e=this.currentTheme)||void 0===e?void 0:e.includes("dark"))&&void 0!==t&&t)}updated(e){var t;if(super.updated(e),this.isEditorReady&&this.jar){if(e.has("code")&&this.code!==e.get("code")){const e=this.getValue();this.code!==e&&(this.setValue(this.code),this.updateLineNumbers())}e.has("readonly")&&(null===(t=this.editorRef.value)||void 0===t||t.setAttribute("contenteditable",this.readonly?"false":"true"))}}disconnectedCallback(){super.disconnectedCallback(),this.jar&&(this.jar.destroy(),this.jar=void 0),this.isEditorReady=!1}};Wo.styles=Lo,Wo.useShadowDom=!0,qo([o({type:Boolean,reflect:!0})],Wo.prototype,"readonly",void 0),qo([o({type:String,reflect:!0})],Wo.prototype,"theme",void 0),qo([o({type:String,reflect:!0})],Wo.prototype,"language",void 0),qo([o({type:String})],Wo.prototype,"code",void 0),qo([o({type:Boolean,attribute:"line-numbers"})],Wo.prototype,"lineNumbers",void 0),qo([o({type:Number,attribute:"font-size"})],Wo.prototype,"fontSize",void 0),qo([o({type:Boolean,attribute:"word-wrap"})],Wo.prototype,"wordWrap",void 0),qo([o({type:Number,attribute:"tab-size"})],Wo.prototype,"tabSize",void 0),Wo=qo([r("nr-code-editor")],Wo);
8545
8724
  /**
8546
8725
  * @license
8547
8726
  * Copyright 2024 Nuraly, Laabidi Aymen
8548
8727
  * SPDX-License-Identifier: MIT
8549
8728
  */
8550
- const Lo="graph TD\n A[Start] --\x3e B[End]";function Fo(e,t){return i`
8729
+ const Ko="graph TD\n A[Start] --\x3e B[End]";function Go(e,t){return i`
8551
8730
  <style>${Fn}</style>
8552
8731
  <div class="config-section">
8553
8732
  <div class="config-section-header">
@@ -8556,7 +8735,7 @@ const Lo="graph TD\n A[Start] --\x3e B[End]";function Fo(e,t){return i`
8556
8735
  </div>
8557
8736
  <div class="config-field">
8558
8737
  <label>Mermaid Code</label>
8559
- ${Bn({language:"markdown",code:e.textContent||Lo,onCodeChange:e=>t("textContent",e.detail.value),onFullscreen:()=>function(e,t){Un({modalId:"mermaid-code-modal",title:"Edit Mermaid Diagram",language:"markdown",initialCode:e.textContent||Lo,onCodeChange:e=>t("textContent",e)})}(e,t)})}
8738
+ ${Bn({language:"markdown",code:e.textContent||Ko,onCodeChange:e=>t("textContent",e.detail.value),onFullscreen:()=>function(e,t){Un({modalId:"mermaid-code-modal",title:"Edit Mermaid Diagram",language:"markdown",initialCode:e.textContent||Ko,onCodeChange:e=>t("textContent",e)})}(e,t)})}
8560
8739
  <span class="field-description">Supports flowcharts, sequence diagrams, class diagrams, and more.</span>
8561
8740
  </div>
8562
8741
  </div>
@@ -8571,7 +8750,7 @@ const Lo="graph TD\n A[Start] --\x3e B[End]";function Fo(e,t){return i`
8571
8750
  * Copyright 2024 Nuraly, Laabidi Aymen
8572
8751
  * SPDX-License-Identifier: MIT
8573
8752
  */
8574
- var Bo=function(e,t,i,n){for(var a,o=arguments.length,s=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n,r=e.length-1;r>=0;r--)(a=e[r])&&(s=(o<3?a(s):o>3?a(t,i,s):a(t,i))||s);return o>3&&s&&Object.defineProperty(t,i,s),s},Uo=function(e,t,i,n){return new(i||(i=Promise))(function(a,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function r(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?a(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(s,r)}l((n=n.apply(e,t||[])).next())})};let Vo=class extends t{constructor(){super(...arguments),this.selectedWorkflowId="",this._workflows=[],this._loading=!1,this._error=""}connectedCallback(){super.connectedCallback(),this._fetchWorkflows()}_fetchWorkflows(){return Uo(this,void 0,void 0,function*(){this._loading=!0,this._error="";try{const e=yield fetch("/api/v1/workflows");if(!e.ok)throw new Error(`Failed to load workflows (${e.status})`);const t=yield e.json();this._workflows=t.filter(e=>!e.isTemplate).map(e=>{var t;return{id:e.id,name:e.name,description:e.description,nodeCount:(null===(t=e.nodes)||void 0===t?void 0:t.length)||0}})}catch(e){this._error=e.message}finally{this._loading=!1}})}_handleSelect(e){return Uo(this,void 0,void 0,function*(){const t=e.target.value;if(t)try{const e=yield fetch(`/api/v1/workflows/${t}`);if(!e.ok)throw new Error("Failed to load workflow details");const i=yield e.json(),n=(i.nodes||[]).map(e=>({name:e.name,type:e.type}));this.dispatchEvent(new CustomEvent("workflow-select",{detail:{workflowId:i.id,workflowName:i.name,workflowSteps:n},bubbles:!0,composed:!0}))}catch(e){this._error=e.message}else this.dispatchEvent(new CustomEvent("workflow-select",{detail:{workflowId:"",workflowName:"",workflowSteps:[]},bubbles:!0,composed:!0}))})}render(){return this._loading?i`<div class="loading">Loading workflows...</div>`:this._error?i`
8753
+ var Jo=function(e,t,i,n){for(var a,o=arguments.length,s=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n,r=e.length-1;r>=0;r--)(a=e[r])&&(s=(o<3?a(s):o>3?a(t,i,s):a(t,i))||s);return o>3&&s&&Object.defineProperty(t,i,s),s},Yo=function(e,t,i,n){return new(i||(i=Promise))(function(a,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function r(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?a(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(s,r)}l((n=n.apply(e,t||[])).next())})};let Qo=class extends t{constructor(){super(...arguments),this.selectedWorkflowId="",this._workflows=[],this._loading=!1,this._error=""}connectedCallback(){super.connectedCallback(),this._fetchWorkflows()}_fetchWorkflows(){return Yo(this,void 0,void 0,function*(){this._loading=!0,this._error="";try{const e=yield fetch("/api/v1/workflows");if(!e.ok)throw new Error(`Failed to load workflows (${e.status})`);const t=yield e.json();this._workflows=t.filter(e=>!e.isTemplate).map(e=>{var t;return{id:e.id,name:e.name,description:e.description,nodeCount:(null===(t=e.nodes)||void 0===t?void 0:t.length)||0}})}catch(e){this._error=e.message}finally{this._loading=!1}})}_handleSelect(e){return Yo(this,void 0,void 0,function*(){const t=e.target.value;if(t)try{const e=yield fetch(`/api/v1/workflows/${t}`);if(!e.ok)throw new Error("Failed to load workflow details");const i=yield e.json(),n=(i.nodes||[]).map(e=>({name:e.name,type:e.type}));this.dispatchEvent(new CustomEvent("workflow-select",{detail:{workflowId:i.id,workflowName:i.name,workflowSteps:n},bubbles:!0,composed:!0}))}catch(e){this._error=e.message}else this.dispatchEvent(new CustomEvent("workflow-select",{detail:{workflowId:"",workflowName:"",workflowSteps:[]},bubbles:!0,composed:!0}))})}render(){return this._loading?i`<div class="loading">Loading workflows...</div>`:this._error?i`
8575
8754
  <div class="error-container">
8576
8755
  <span class="error">${this._error}</span>
8577
8756
  <button class="retry-btn" @click=${()=>this._fetchWorkflows()}>Retry</button>
@@ -8591,7 +8770,31 @@ var Bo=function(e,t,i,n){for(var a,o=arguments.length,s=o<3?t:null===n?n=Object.
8591
8770
  * Copyright 2024 Nuraly, Laabidi Aymen
8592
8771
  * SPDX-License-Identifier: MIT
8593
8772
  */
8594
- function Ho(e,t,a,o,s,r,l,c,d,p,h,u,b){switch(e){case B.HTTP_START:
8773
+ function Zo(e,t,a,o,s,r,l,c,d,p,h,u,b,f){switch(e){case B.START:
8774
+ /**
8775
+ * @license
8776
+ * Copyright 2024 Nuraly, Laabidi Aymen
8777
+ * SPDX-License-Identifier: MIT
8778
+ */
8779
+ return function(e){return i`
8780
+ <div class="config-section">
8781
+ <div class="config-section-header">
8782
+ <span class="config-section-title">Manual Trigger</span>
8783
+ <span class="config-section-desc">Run this workflow immediately for testing</span>
8784
+ </div>
8785
+ <div class="trigger-actions">
8786
+ <nr-button
8787
+ type="primary"
8788
+ size="small"
8789
+ .iconLeft=${"play"}
8790
+ ?disabled=${!e}
8791
+ @click=${()=>null==e?void 0:e()}
8792
+ >
8793
+ Start Now
8794
+ </nr-button>
8795
+ </div>
8796
+ </div>
8797
+ `}(f);case B.HTTP_START:
8595
8798
  /**
8596
8799
  * @license
8597
8800
  * Copyright 2024 Nuraly, Laabidi Aymen
@@ -8845,7 +9048,7 @@ return function(e,t,a,o,s){const r=a||"{workflowId}",l=e.httpPath||"/webhook",c=
8845
9048
  @nr-input=${e=>t("timeout",Number.parseInt(e.detail.value))}
8846
9049
  ></nr-input>
8847
9050
  </div>
8848
- `}(t,a,s,r);case B.FUNCTION:return Vn(t,a);case B.CONDITION:return Wn(t,a);case B.DELAY:return function(e,t){return i`
9051
+ `}(t,a,s,r);case B.FUNCTION:return Vn(t,a);case B.CONDITION:return Wn(t,a);case B.SWITCH:return Kn(t,a);case B.DELAY:return function(e,t){return i`
8849
9052
  <div class="config-field">
8850
9053
  <label>Duration</label>
8851
9054
  <nr-input
@@ -8867,7 +9070,72 @@ return function(e,t,a,o,s){const r=a||"{workflowId}",l=e.httpPath||"/webhook",c=
8867
9070
  * @license
8868
9071
  * Copyright 2024 Nuraly, Laabidi Aymen
8869
9072
  * SPDX-License-Identifier: MIT
8870
- */(t,a);case B.LOOP:return function(e,t){return i`
9073
+ */(t,a);case B.WAIT:return function(e,t){var n;return i`
9074
+ <div class="config-field">
9075
+ <label>Signal Name</label>
9076
+ <nr-input
9077
+ .value=${String(e.signalName||"")}
9078
+ placeholder="payment.received"
9079
+ @nr-input=${e=>t("signalName",e.detail.value)}
9080
+ ></nr-input>
9081
+ <small class="field-hint">Resume execution when this signal is dispatched</small>
9082
+ </div>
9083
+
9084
+ <div class="config-field">
9085
+ <label>Timeout</label>
9086
+ <nr-input
9087
+ type="number"
9088
+ .value=${String(null!==(n=e.timeout)&&void 0!==n?n:3e5)}
9089
+ min="0"
9090
+ @nr-input=${e=>t("timeout",Number.parseInt(e.detail.value)||0)}
9091
+ ></nr-input>
9092
+ </div>
9093
+
9094
+ <div class="config-field">
9095
+ <label>Unit</label>
9096
+ <nr-select
9097
+ .value=${e.timeoutUnit||"milliseconds"}
9098
+ .options=${[{label:"Milliseconds",value:"milliseconds"},{label:"Seconds",value:"seconds"},{label:"Minutes",value:"minutes"},{label:"Hours",value:"hours"}]}
9099
+ @nr-change=${e=>t("timeoutUnit",e.detail.value)}
9100
+ ></nr-select>
9101
+ <small class="field-hint">Routes to the Timeout port if the signal never arrives</small>
9102
+ </div>
9103
+
9104
+ <div class="config-field">
9105
+ <label>Output Variable</label>
9106
+ <nr-input
9107
+ .value=${String(e.outputVariable||"signalPayload")}
9108
+ placeholder="signalPayload"
9109
+ @nr-input=${e=>t("outputVariable",e.detail.value)}
9110
+ ></nr-input>
9111
+ <small class="field-hint">Variable name for the received signal payload</small>
9112
+ </div>
9113
+ `}(t,a);case B.LOOP:return function(e,t){return i`
9114
+ <details style=${"\n margin: 0 0 12px 0;\n padding: 8px 12px;\n background: var(--nuraly-color-info-background, #eff6ff);\n border: 1px solid var(--nuraly-color-info-border, #bfdbfe);\n border-radius: 6px;\n font-size: 12px;\n line-height: 1.5;\n color: var(--nuraly-color-text-secondary, #1e3a8a);\n"}>
9115
+ <summary style=${"\n cursor: pointer;\n user-select: none;\n font-weight: 600;\n display: flex;\n align-items: center;\n gap: 6px;\n list-style: none;\n"}>
9116
+ <nr-icon name="info" size="small"></nr-icon>
9117
+ How the Loop node works
9118
+ </summary>
9119
+ <div style=${"\n margin-top: 8px;\n display: flex;\n flex-direction: column;\n gap: 8px;\n"}>
9120
+ <p style="margin: 0;">
9121
+ Iterates over the array resolved from <code>arrayExpression</code> and runs
9122
+ the <strong>item</strong>-port subgraph once per element. Each iteration binds
9123
+ the current value to <code>\${variables.&lt;iteratorVariable&gt;}</code> and
9124
+ its position to <code>\${variables.&lt;iteratorVariable&gt;_index}</code>.
9125
+ </p>
9126
+ <p style="margin: 0;">
9127
+ Wire downstream nodes to the <strong>item</strong> port to run them per
9128
+ element, and to the <strong>done</strong> port for whatever should run after
9129
+ the loop finishes. A <strong>Break</strong> node anywhere in the item subgraph
9130
+ short-circuits the remaining iterations.
9131
+ </p>
9132
+ <pre style=${"\n margin: 0;\n padding: 8px 10px;\n background: rgba(15, 23, 42, 0.04);\n border: 1px solid rgba(15, 23, 42, 0.08);\n border-radius: 4px;\n font-family: ui-monospace, SFMono-Regular, Menlo, monospace;\n font-size: 11px;\n white-space: pre;\n overflow-x: auto;\n"}>${Jn}</pre>
9133
+ <button type="button" style=${"\n align-self: flex-start;\n padding: 4px 10px;\n font-size: 11px;\n background: white;\n border: 1px solid rgba(15, 23, 42, 0.15);\n border-radius: 4px;\n cursor: pointer;\n"} @click=${e=>Gn(this,void 0,void 0,function*(){const t=e.currentTarget,i=t.textContent;try{yield navigator.clipboard.writeText(Jn),t.textContent="Copied ✓"}catch(e){t.textContent="Copy failed"}setTimeout(()=>{t.textContent=i},1500)})}>
9134
+ Copy example
9135
+ </button>
9136
+ </div>
9137
+ </details>
9138
+
8871
9139
  <div class="config-field">
8872
9140
  <label>Array Expression</label>
8873
9141
  <nr-input
@@ -8930,12 +9198,7 @@ return function(e,t,a,o,s){const r=a||"{workflowId}",l=e.httpPath||"/webhook",c=
8930
9198
  ></nr-input>
8931
9199
  <small class="field-hint">Wait time between iterations (useful for API rate limits)</small>
8932
9200
  </div>
8933
- `}
8934
- /**
8935
- * @license
8936
- * Copyright 2024 Nuraly, Laabidi Aymen
8937
- * SPDX-License-Identifier: MIT
8938
- */(t,a);case B.TRANSFORM:return function(e,t){return i`
9201
+ `}(t,a);case B.TRY_CATCH:return Yn(t,a);case B.TRANSFORM:return function(e,t){return i`
8939
9202
  <div class="config-section">
8940
9203
  <div class="config-section-header">
8941
9204
  <span class="config-section-title">Transform</span>
@@ -9027,7 +9290,7 @@ return function(e,t,a,o,s){const r=a||"{workflowId}",l=e.httpPath||"/webhook",c=
9027
9290
  </div>
9028
9291
  <span class="field-description">Expr: \${input.field} or \${variables.name}</span>
9029
9292
  </div>
9030
- `}(t,a);case B.EMAIL:return Kn(t,a,s,r);case B.EMAIL_READER:return function(e,t,a,o){const s=e.provider||"imap",r=e.operation||"LIST",l="imap"===s,c="SEARCH"===r,d=["READ","MARK_READ","MARK_UNREAD","MOVE","DELETE"].includes(r),p="MOVE"===r,h=["LIST","SEARCH"].includes(r),u=["LIST","SEARCH"].includes(r),b=(a||[]).filter(e=>e.keyPath.startsWith("email_reader/"));return i`
9293
+ `}(t,a);case B.EMAIL:return Qn(t,a,s,r);case B.EMAIL_READER:return function(e,t,a,o){const s=e.provider||"imap",r=e.operation||"LIST",l="imap"===s,c="SEARCH"===r,d=["READ","MARK_READ","MARK_UNREAD","MOVE","DELETE"].includes(r),p="MOVE"===r,h=["LIST","SEARCH"].includes(r),u=["LIST","SEARCH"].includes(r),b=(a||[]).filter(e=>e.keyPath.startsWith("email_reader/"));return i`
9031
9294
  <!-- Provider Section -->
9032
9295
  <div class="config-section">
9033
9296
  <div class="config-section-header">
@@ -9039,7 +9302,7 @@ return function(e,t,a,o,s){const r=a||"{workflowId}",l=e.httpPath||"/webhook",c=
9039
9302
  <nr-select
9040
9303
  .value=${s}
9041
9304
  .options=${[{label:"IMAP (Generic)",value:"imap"},{label:"Gmail",value:"gmail"},{label:"Outlook / Office 365",value:"outlook"},{label:"Yahoo Mail",value:"yahoo"}]}
9042
- @nr-change=${e=>{const i=e.detail.value;t("provider",i);const n=Gn[i];n&&"imap"!==i&&(t("host",n.host),t("port",n.port),t("tls",n.tls))}}
9305
+ @nr-change=${e=>{const i=e.detail.value;t("provider",i);const n=Zn[i];n&&"imap"!==i&&(t("host",n.host),t("port",n.port),t("tls",n.tls))}}
9043
9306
  ></nr-select>
9044
9307
  </div>
9045
9308
 
@@ -9248,7 +9511,7 @@ return function(e,t,a,o,s){const r=a||"{workflowId}",l=e.httpPath||"/webhook",c=
9248
9511
  >
9249
9512
  </div>
9250
9513
  </div>
9251
- `}(t,a,s,r);case B.SENDGRID:return function(e,t,a,o){const s=(a||[]).filter(e=>e.keyPath.startsWith("sendgrid/")),r=e.resource||"mail",l=e.operation||"send_email",c="send_template"===l,d="mail"===r,p="contact"===r,h="list"===r,u="contact"===r?Qn:"list"===r?Zn:Yn;return i`
9514
+ `}(t,a,s,r);case B.SENDGRID:return function(e,t,a,o){const s=(a||[]).filter(e=>e.keyPath.startsWith("sendgrid/")),r=e.resource||"mail",l=e.operation||"send_email",c="send_template"===l,d="mail"===r,p="contact"===r,h="list"===r,u="contact"===r?ta:"list"===r?ia:ea;return i`
9252
9515
  <!-- Connection Section -->
9253
9516
  <div class="config-section">
9254
9517
  <div class="config-section-header">
@@ -9277,8 +9540,8 @@ return function(e,t,a,o,s){const r=a||"{workflowId}",l=e.httpPath||"/webhook",c=
9277
9540
  <label>Resource</label>
9278
9541
  <nr-select
9279
9542
  .value=${r}
9280
- .options=${Jn}
9281
- @nr-change=${e=>{t("resource",e.detail.value);const i="contact"===e.detail.value?Qn:"list"===e.detail.value?Zn:Yn;t("operation",i[0].value)}}
9543
+ .options=${Xn}
9544
+ @nr-change=${e=>{t("resource",e.detail.value);const i="contact"===e.detail.value?ta:"list"===e.detail.value?ia:ea;t("operation",i[0].value)}}
9282
9545
  ></nr-select>
9283
9546
  <span class="field-description">SendGrid resource to interact with</span>
9284
9547
  </div>
@@ -10095,6 +10358,66 @@ return function(e,t){return i`
10095
10358
  </div>
10096
10359
  </div>
10097
10360
  `}
10361
+ /**
10362
+ * @license
10363
+ * Copyright 2024 Nuraly, Laabidi Aymen
10364
+ * SPDX-License-Identifier: MIT
10365
+ */(t,a);case B.SOCIAL_POST:return function(e,t){return i`
10366
+ <div class="config-section">
10367
+ <div class="config-section-header">
10368
+ <span class="config-section-title">Agent</span>
10369
+ <span class="config-section-desc">Which agent will post to the feed</span>
10370
+ </div>
10371
+ <div class="config-field">
10372
+ <label>Agent ID</label>
10373
+ <nr-input
10374
+ value=${e.agentId||""}
10375
+ placeholder="Auto-detect from workflow owner"
10376
+ @nr-input=${e=>t("agentId",e.detail.value)}
10377
+ ></nr-input>
10378
+ <span class="field-description">Leave empty to auto-detect the agent linked to this workflow</span>
10379
+ </div>
10380
+ </div>
10381
+
10382
+ <div class="config-section">
10383
+ <div class="config-section-header">
10384
+ <span class="config-section-title">Content</span>
10385
+ <span class="config-section-desc">Post content to publish on the feed</span>
10386
+ </div>
10387
+ <div class="config-field">
10388
+ <label>Post Content</label>
10389
+ <nr-input
10390
+ value=${e.content||""}
10391
+ placeholder="\${variables.response}"
10392
+ @nr-input=${e=>t("content",e.detail.value)}
10393
+ ></nr-input>
10394
+ <span class="field-description">Use \${variables.name} to reference workflow data. Supports @mentions and #hashtags.</span>
10395
+ </div>
10396
+ </div>
10397
+
10398
+ <div class="config-section">
10399
+ <div class="config-section-header">
10400
+ <span class="config-section-title">Media (optional)</span>
10401
+ </div>
10402
+ <div class="config-field">
10403
+ <label>Media URL</label>
10404
+ <nr-input
10405
+ value=${e.mediaUrl||""}
10406
+ placeholder="https://example.com/image.png or \${variables.imageUrl}"
10407
+ @nr-input=${e=>t("mediaUrl",e.detail.value)}
10408
+ ></nr-input>
10409
+ <span class="field-description">URL to an image or video to attach</span>
10410
+ </div>
10411
+ <div class="config-field">
10412
+ <label>Media Type</label>
10413
+ <nr-select
10414
+ .value=${e.mediaType||""}
10415
+ .options=${[{label:"None",value:""},{label:"Image",value:"image"},{label:"Video",value:"video"}]}
10416
+ @nr-change=${e=>t("mediaType",e.detail.value)}
10417
+ ></nr-select>
10418
+ </div>
10419
+ </div>
10420
+ `}
10098
10421
  /**
10099
10422
  * @license
10100
10423
  * Copyright 2024 Nuraly, Laabidi Aymen
@@ -10431,7 +10754,7 @@ return function(e,t){return i`
10431
10754
  ></nr-input>
10432
10755
  <small class="field-hint">Variable to store crawl results (access via \${variables.crawlResult})</small>
10433
10756
  </div>
10434
- `}(t,a);case B.DOCUMENT_GENERATOR:return Xn(t,a);case B.FILE_STORAGE:return function(e,t,n,a){const o=e.provider||"local",s="s3"===o||"minio"===o,r=e.testFile,l=(n||[]).filter(e=>e.keyPath.startsWith("storage/"));return i`
10757
+ `}(t,a);case B.DOCUMENT_GENERATOR:return na(t,a);case B.FILE_STORAGE:return function(e,t,n,a){const o=e.provider||"local",s="s3"===o||"minio"===o,r=e.testFile,l=(n||[]).filter(e=>e.keyPath.startsWith("storage/"));return i`
10435
10758
  <div class="config-field">
10436
10759
  <label>Storage Provider</label>
10437
10760
  <nr-select
@@ -10526,7 +10849,7 @@ return function(e,t){return i`
10526
10849
  <nr-icon name="file" size="small"></nr-icon>
10527
10850
  <div class="test-file-meta">
10528
10851
  <span class="test-file-name">${r.filename}</span>
10529
- <span class="test-file-size">${sa(r.size)} • ${r.contentType||"unknown type"}</span>
10852
+ <span class="test-file-size">${da(r.size)} • ${r.contentType||"unknown type"}</span>
10530
10853
  </div>
10531
10854
  </div>
10532
10855
  <nr-button
@@ -10549,7 +10872,7 @@ return function(e,t){return i`
10549
10872
  `:i`
10550
10873
  <nr-file-upload
10551
10874
  tip="Drop file here or click to upload"
10552
- @file-select=${e=>oa(e,t)}
10875
+ @file-select=${e=>ca(e,t)}
10553
10876
  ></nr-file-upload>
10554
10877
  `}
10555
10878
  <small class="field-hint">Upload a file to use as test input when running the workflow</small>
@@ -11004,7 +11327,7 @@ return function(e,t){return i`
11004
11327
  <nr-icon name="file-text" size="small"></nr-icon>
11005
11328
  <div class="test-file-meta">
11006
11329
  <span class="test-file-name">${a.filename}</span>
11007
- <span class="test-file-size">${sa(a.size)} • ${a.contentType||"unknown type"}</span>
11330
+ <span class="test-file-size">${da(a.size)} • ${a.contentType||"unknown type"}</span>
11008
11331
  </div>
11009
11332
  </div>
11010
11333
  <nr-button variant="ghost" size="small"
@@ -11022,7 +11345,7 @@ return function(e,t){return i`
11022
11345
  <nr-file-upload
11023
11346
  accept=".txt,.md,.pdf,.docx,.html,.csv,.json,.xlsx"
11024
11347
  tip="Drop document here or click to upload"
11025
- @file-select=${e=>oa(e,t,"testDocument")}
11348
+ @file-select=${e=>ca(e,t,"testDocument")}
11026
11349
  ></nr-file-upload>
11027
11350
  `}
11028
11351
  <small class="field-hint">Upload a document to use as test input</small>
@@ -11472,7 +11795,7 @@ return function(e,t){return i`
11472
11795
  ></nr-input>
11473
11796
  <small class="field-hint">Variable to store the built context</small>
11474
11797
  </div>
11475
- `}(t,a);case B.GUARDRAIL:return ra(t,a);case B.GOOGLE_CALENDAR:return function(e,t){const n=e.googleCalendarOperation||"getAll",a="create"===n||"update"===n,o="getAll"===n,s="get"===n||"update"===n||"delete"===n;return i`
11798
+ `}(t,a);case B.GUARDRAIL:return pa(t,a);case B.GOOGLE_CALENDAR:return function(e,t){const n=e.googleCalendarOperation||"getAll",a="create"===n||"update"===n,o="getAll"===n,s="get"===n||"update"===n||"delete"===n;return i`
11476
11799
  <div class="config-section">
11477
11800
  <div class="config-section-header">
11478
11801
  <span class="config-section-title">Connection</span>
@@ -11510,7 +11833,7 @@ return function(e,t){return i`
11510
11833
  value=${n}
11511
11834
  @nr-change=${e=>t("googleCalendarOperation",e.detail.value)}
11512
11835
  >
11513
- ${la.map(e=>i`
11836
+ ${ha.map(e=>i`
11514
11837
  <nr-option value=${e.value}>${e.label}</nr-option>
11515
11838
  `)}
11516
11839
  </nr-select>
@@ -11672,7 +11995,7 @@ return function(e,t){return i`
11672
11995
  value=${e.apiVersion||"2025-01"}
11673
11996
  @nr-change=${e=>t("apiVersion",e.detail.value)}
11674
11997
  >
11675
- ${pa.map(e=>i`
11998
+ ${fa.map(e=>i`
11676
11999
  <nr-option value=${e.value}>${e.label}</nr-option>
11677
12000
  `)}
11678
12001
  </nr-select>
@@ -11691,7 +12014,7 @@ return function(e,t){return i`
11691
12014
  value=${e.resource||"ORDER"}
11692
12015
  @nr-change=${e=>t("resource",e.detail.value)}
11693
12016
  >
11694
- ${ca.map(e=>i`
12017
+ ${ua.map(e=>i`
11695
12018
  <nr-option value=${e.value}>${e.label}</nr-option>
11696
12019
  `)}
11697
12020
  </nr-select>
@@ -11702,7 +12025,7 @@ return function(e,t){return i`
11702
12025
  value=${r}
11703
12026
  @nr-change=${e=>t("operation",e.detail.value)}
11704
12027
  >
11705
- ${da.map(e=>i`
12028
+ ${ba.map(e=>i`
11706
12029
  <nr-option value=${e.value}>${e.label}</nr-option>
11707
12030
  `)}
11708
12031
  </nr-select>
@@ -11744,7 +12067,7 @@ return function(e,t){return i`
11744
12067
  value=${e.sortField||""}
11745
12068
  @nr-change=${e=>t("sortField",e.detail.value)}
11746
12069
  >
11747
- ${ha.map(e=>i`
12070
+ ${ga.map(e=>i`
11748
12071
  <nr-option value=${e.value}>${e.label}</nr-option>
11749
12072
  `)}
11750
12073
  </nr-select>
@@ -11756,7 +12079,7 @@ return function(e,t){return i`
11756
12079
  value=${e.sortOrder||"asc"}
11757
12080
  @nr-change=${e=>t("sortOrder",e.detail.value)}
11758
12081
  >
11759
- ${ua.map(e=>i`
12082
+ ${va.map(e=>i`
11760
12083
  <nr-option value=${e.value}>${e.label}</nr-option>
11761
12084
  `)}
11762
12085
  </nr-select>
@@ -11787,7 +12110,7 @@ return function(e,t){return i`
11787
12110
  value=${e.orderStatus||"any"}
11788
12111
  @nr-change=${e=>t("orderStatus",e.detail.value)}
11789
12112
  >
11790
- ${ba.map(e=>i`
12113
+ ${ma.map(e=>i`
11791
12114
  <nr-option value=${e.value}>${e.label}</nr-option>
11792
12115
  `)}
11793
12116
  </nr-select>
@@ -11799,7 +12122,7 @@ return function(e,t){return i`
11799
12122
  value=${e.financialStatus||"any"}
11800
12123
  @nr-change=${e=>t("financialStatus",e.detail.value)}
11801
12124
  >
11802
- ${fa.map(e=>i`
12125
+ ${xa.map(e=>i`
11803
12126
  <nr-option value=${e.value}>${e.label}</nr-option>
11804
12127
  `)}
11805
12128
  </nr-select>
@@ -11811,7 +12134,7 @@ return function(e,t){return i`
11811
12134
  value=${e.fulfillmentStatus||"any"}
11812
12135
  @nr-change=${e=>t("fulfillmentStatus",e.detail.value)}
11813
12136
  >
11814
- ${ga.map(e=>i`
12137
+ ${ya.map(e=>i`
11815
12138
  <nr-option value=${e.value}>${e.label}</nr-option>
11816
12139
  `)}
11817
12140
  </nr-select>
@@ -11845,7 +12168,7 @@ return function(e,t){return i`
11845
12168
  <span class="field-description">Variable name to store the Shopify response</span>
11846
12169
  </div>
11847
12170
  </div>
11848
- `}(t,a,s,r);case B.TELEGRAM_SEND:return function(e,t,a,o){const s=e.operation||"sendMessage",r=(a||[]).filter(e=>e.keyPath.startsWith("telegram/")),l="sendMessage"===s||"editMessageText"===s,c=wa.includes(s),d=$a.includes(s),p=ka.includes(s),h="editMessageText"===s||"deleteMessage"===s||"pinChatMessage"===s||"unpinChatMessage"===s,u="sendLocation"===s,b="answerCallbackQuery"===s,f="sendChatAction"===s,g="sendMediaGroup"===s;return i`
12171
+ `}(t,a,s,r);case B.TELEGRAM_SEND:return function(e,t,a,o){const s=e.operation||"sendMessage",r=(a||[]).filter(e=>e.keyPath.startsWith("telegram/")),l="sendMessage"===s||"editMessageText"===s,c=Ca.includes(s),d=Ta.includes(s),p=Ma.includes(s),h="editMessageText"===s||"deleteMessage"===s||"pinChatMessage"===s||"unpinChatMessage"===s,u="sendLocation"===s,b="answerCallbackQuery"===s,f="sendChatAction"===s,g="sendMediaGroup"===s;return i`
11849
12172
  <div class="config-section">
11850
12173
  <div class="config-section-header">
11851
12174
  <span class="config-section-title">Operation</span>
@@ -11857,7 +12180,7 @@ return function(e,t){return i`
11857
12180
  value=${s}
11858
12181
  @nr-change=${e=>t("operation",e.detail.value)}
11859
12182
  >
11860
- ${ma.map(e=>i`
12183
+ ${$a.map(e=>i`
11861
12184
  <nr-option value=${e.value}>${e.label}</nr-option>
11862
12185
  `)}
11863
12186
  </nr-select>
@@ -11915,7 +12238,7 @@ return function(e,t){return i`
11915
12238
  value=${e.parseMode||""}
11916
12239
  @nr-change=${e=>t("parseMode",e.detail.value)}
11917
12240
  >
11918
- ${va.map(e=>i`
12241
+ ${wa.map(e=>i`
11919
12242
  <nr-option value=${e.value}>${e.label}</nr-option>
11920
12243
  `)}
11921
12244
  </nr-select>
@@ -11965,7 +12288,7 @@ return function(e,t){return i`
11965
12288
  value=${e.parseMode||""}
11966
12289
  @nr-change=${e=>t("parseMode",e.detail.value)}
11967
12290
  >
11968
- ${va.map(e=>i`
12291
+ ${wa.map(e=>i`
11969
12292
  <nr-option value=${e.value}>${e.label}</nr-option>
11970
12293
  `)}
11971
12294
  </nr-select>
@@ -12081,7 +12404,7 @@ return function(e,t){return i`
12081
12404
  value=${e.chatAction||"typing"}
12082
12405
  @nr-change=${e=>t("chatAction",e.detail.value)}
12083
12406
  >
12084
- ${xa.map(e=>i`
12407
+ ${ka.map(e=>i`
12085
12408
  <nr-option value=${e.value}>${e.label}</nr-option>
12086
12409
  `)}
12087
12410
  </nr-select>
@@ -12145,7 +12468,7 @@ return function(e,t){return i`
12145
12468
  value=${e.reaction||""}
12146
12469
  @nr-change=${e=>t("reaction",e.detail.value)}
12147
12470
  >
12148
- ${ya.map(e=>i`
12471
+ ${Sa.map(e=>i`
12149
12472
  <nr-option value=${e.value}>${e.label}</nr-option>
12150
12473
  `)}
12151
12474
  </nr-select>
@@ -12201,7 +12524,7 @@ return function(e,t){return i`
12201
12524
  value=${r}
12202
12525
  @nr-change=${e=>t("zendeskResource",e.detail.value)}
12203
12526
  >
12204
- ${Sa.map(e=>i`
12527
+ ${Ea.map(e=>i`
12205
12528
  <nr-option value=${e.value}>${e.label}</nr-option>
12206
12529
  `)}
12207
12530
  </nr-select>
@@ -12212,7 +12535,7 @@ return function(e,t){return i`
12212
12535
  value=${l}
12213
12536
  @nr-change=${e=>t("zendeskOperation",e.detail.value)}
12214
12537
  >
12215
- ${Ca.map(e=>i`
12538
+ ${za.map(e=>i`
12216
12539
  <nr-option value=${e.value}>${e.label}</nr-option>
12217
12540
  `)}
12218
12541
  </nr-select>
@@ -12263,7 +12586,7 @@ return function(e,t){return i`
12263
12586
  value=${e.zendeskSortBy||""}
12264
12587
  @nr-change=${e=>t("zendeskSortBy",e.detail.value)}
12265
12588
  >
12266
- ${Ea.map(e=>i`
12589
+ ${Pa.map(e=>i`
12267
12590
  <nr-option value=${e.value}>${e.label}</nr-option>
12268
12591
  `)}
12269
12592
  </nr-select>
@@ -12274,7 +12597,7 @@ return function(e,t){return i`
12274
12597
  value=${e.zendeskSortOrder||"asc"}
12275
12598
  @nr-change=${e=>t("zendeskSortOrder",e.detail.value)}
12276
12599
  >
12277
- ${Oa.map(e=>i`
12600
+ ${Na.map(e=>i`
12278
12601
  <nr-option value=${e.value}>${e.label}</nr-option>
12279
12602
  `)}
12280
12603
  </nr-select>
@@ -12310,7 +12633,7 @@ return function(e,t){return i`
12310
12633
  value=${e.zendeskType||""}
12311
12634
  @nr-change=${e=>t("zendeskType",e.detail.value)}
12312
12635
  >
12313
- ${za.map(e=>i`
12636
+ ${Ia.map(e=>i`
12314
12637
  <nr-option value=${e.value}>${e.label}</nr-option>
12315
12638
  `)}
12316
12639
  </nr-select>
@@ -12322,7 +12645,7 @@ return function(e,t){return i`
12322
12645
  value=${e.zendeskPriority||""}
12323
12646
  @nr-change=${e=>t("zendeskPriority",e.detail.value)}
12324
12647
  >
12325
- ${Ta.map(e=>i`
12648
+ ${Aa.map(e=>i`
12326
12649
  <nr-option value=${e.value}>${e.label}</nr-option>
12327
12650
  `)}
12328
12651
  </nr-select>
@@ -12333,7 +12656,7 @@ return function(e,t){return i`
12333
12656
  value=${e.zendeskStatus||""}
12334
12657
  @nr-change=${e=>t("zendeskStatus",e.detail.value)}
12335
12658
  >
12336
- ${Ma.map(e=>i`
12659
+ ${Oa.map(e=>i`
12337
12660
  <nr-option value=${e.value}>${e.label}</nr-option>
12338
12661
  `)}
12339
12662
  </nr-select>
@@ -12430,7 +12753,7 @@ return function(e,t){return i`
12430
12753
  value=${e.twilioOperation||"send_sms"}
12431
12754
  @nr-change=${e=>t("twilioOperation",e.detail.value)}
12432
12755
  >
12433
- ${Ra.map(e=>i`
12756
+ ${La.map(e=>i`
12434
12757
  <nr-option value=${e.value}>${e.label}</nr-option>
12435
12758
  `)}
12436
12759
  </nr-select>
@@ -12438,7 +12761,7 @@ return function(e,t){return i`
12438
12761
  </div>
12439
12762
  </div>
12440
12763
 
12441
- ${_a(e,t,n,a)}
12764
+ ${Ba(e,t,n,a)}
12442
12765
 
12443
12766
  ${"get_message"===e.twilioOperation?i`
12444
12767
  <div class="config-section">
@@ -12517,7 +12840,7 @@ return function(e,t){return i`
12517
12840
  </div>
12518
12841
  `}
12519
12842
  `}(t,a,s,r);case B.TWILIO_VOICE:return function(e,t,n,a){const o=e.twilioTwimlSource||"url";return i`
12520
- ${_a(e,t,n,a)}
12843
+ ${Ba(e,t,n,a)}
12521
12844
 
12522
12845
  <div class="config-section">
12523
12846
  <div class="config-section-header">
@@ -12587,7 +12910,7 @@ return function(e,t){return i`
12587
12910
  value=${e.twilioMachineDetection||"none"}
12588
12911
  @nr-change=${e=>t("twilioMachineDetection",e.detail.value)}
12589
12912
  >
12590
- ${Da.map(e=>i`
12913
+ ${Fa.map(e=>i`
12591
12914
  <nr-option value=${e.value}>${e.label}</nr-option>
12592
12915
  `)}
12593
12916
  </nr-select>
@@ -12624,7 +12947,7 @@ return function(e,t){return i`
12624
12947
  </div>
12625
12948
  </div>
12626
12949
  `}(t,a,s,r);case B.TELEGRAM_BOT:return function(e,t,a,o,s,r){const l=e.mode||"polling",c=e.allowedUpdates||[],d=null==a?void 0:a.webhookUrl,p=(s||[]).filter(e=>e.keyPath.startsWith("telegram/"));return i`
12627
- ${Ia(a,o,"TELEGRAM_BOT",e,{activateLabel:"Activate Bot"})}
12950
+ ${Da(a,o,"TELEGRAM_BOT",e,{activateLabel:"Activate Bot"})}
12628
12951
 
12629
12952
  <div class="config-section">
12630
12953
  <div class="config-section-header">
@@ -12706,7 +13029,7 @@ return function(e,t){return i`
12706
13029
  </div>
12707
13030
  <div class="config-field">
12708
13031
  <div class="method-checkboxes">
12709
- ${Pa.map(e=>{const n=c.includes(e.value);return i`
13032
+ ${_a.map(e=>{const n=c.includes(e.value);return i`
12710
13033
  <label class="method-checkbox">
12711
13034
  <nr-checkbox
12712
13035
  .checked=${n}
@@ -12870,7 +13193,7 @@ return function(e,t){return i`
12870
13193
  </div>
12871
13194
  `:i``}
12872
13195
  `}(t,a);case B.RABBITMQ_TRIGGER:return function(e,t,n,a,o,s){var r;return i`
12873
- ${Ia(n,a,"RABBITMQ_TRIGGER",e)}
13196
+ ${Da(n,a,"RABBITMQ_TRIGGER",e)}
12874
13197
 
12875
13198
  <div class="config-section">
12876
13199
  <div class="config-section-header">
@@ -12943,7 +13266,7 @@ return function(e,t){return i`
12943
13266
  <label>Content Type</label>
12944
13267
  <nr-select
12945
13268
  .value=${e.contentType||"application/json"}
12946
- .options=${Na}
13269
+ .options=${ja}
12947
13270
  @nr-change=${e=>t("contentType",e.detail.value)}
12948
13271
  ></nr-select>
12949
13272
  <span class="field-description">Expected message content type for deserialization</span>
@@ -12961,7 +13284,7 @@ return function(e,t){return i`
12961
13284
  </div>
12962
13285
  </div>
12963
13286
  `}(t,a,p,h,s,r);case B.KAFKA:return function(e,t,n,a){return i`
12964
- ${oo(e,t,n,a)}
13287
+ ${co(e,t,n,a)}
12965
13288
 
12966
13289
  <div class="config-section">
12967
13290
  <div class="config-section-header">
@@ -13000,7 +13323,7 @@ return function(e,t){return i`
13000
13323
  <label>Acks</label>
13001
13324
  <nr-select
13002
13325
  .value=${e.kafkaAcks||"all"}
13003
- .options=${to}
13326
+ .options=${oo}
13004
13327
  @nr-change=${e=>t("kafkaAcks",e.detail.value)}
13005
13328
  ></nr-select>
13006
13329
  <span class="field-description">Acknowledgment level required from brokers</span>
@@ -13009,7 +13332,7 @@ return function(e,t){return i`
13009
13332
  <label>Compression</label>
13010
13333
  <nr-select
13011
13334
  .value=${e.kafkaCompressionType||"none"}
13012
- .options=${io}
13335
+ .options=${so}
13013
13336
  @nr-change=${e=>t("kafkaCompressionType",e.detail.value)}
13014
13337
  ></nr-select>
13015
13338
  <span class="field-description">Compression codec for message batches</span>
@@ -13031,9 +13354,9 @@ return function(e,t){return i`
13031
13354
  </div>
13032
13355
  </div>
13033
13356
  `}(t,a,s,r);case B.KAFKA_TRIGGER:return function(e,t,n,a,o,s){var r,l;return i`
13034
- ${ao(n,a,"KAFKA_TRIGGER",e)}
13357
+ ${lo(n,a,"KAFKA_TRIGGER",e)}
13035
13358
 
13036
- ${oo(e,t,o,s)}
13359
+ ${co(e,t,o,s)}
13037
13360
 
13038
13361
  <div class="config-section">
13039
13362
  <div class="config-section-header">
@@ -13104,13 +13427,55 @@ return function(e,t){return i`
13104
13427
  <span class="field-description">Variable name to store the consumed message</span>
13105
13428
  </div>
13106
13429
  </div>
13430
+ `}(t,a,p,h,s,r);case B.CRON:return function(e,t,n,a){const o=e.cronExpression||"0 * * * *",s=e.timezone||"UTC";return i`
13431
+ ${uo(n,a,e)}
13432
+
13433
+ <div class="config-section">
13434
+ <div class="config-section-header">
13435
+ <span class="config-section-title">Schedule</span>
13436
+ <span class="config-section-desc">Define when the workflow should run</span>
13437
+ </div>
13438
+
13439
+ <div class="config-field">
13440
+ <label>Preset</label>
13441
+ <nr-select
13442
+ .value=${""}
13443
+ placeholder="Pick a preset..."
13444
+ .options=${ho}
13445
+ @nr-change=${e=>{e.detail.value&&t("cronExpression",e.detail.value)}}
13446
+ ></nr-select>
13447
+ <span class="field-description">Select a common schedule or enter a custom expression below</span>
13448
+ </div>
13449
+
13450
+ <div class="config-field">
13451
+ <label>Cron Expression</label>
13452
+ <nr-input
13453
+ value=${o}
13454
+ placeholder="* * * * *"
13455
+ @nr-input=${e=>t("cronExpression",e.detail.value)}
13456
+ ></nr-input>
13457
+ <span class="field-description">
13458
+ Format: minute hour day month weekday — e.g. <code>0 9 * * 1-5</code> runs every weekday at 9am
13459
+ </span>
13460
+ </div>
13461
+
13462
+ <div class="config-field">
13463
+ <label>Timezone</label>
13464
+ <nr-select
13465
+ .value=${s}
13466
+ .options=${po}
13467
+ @nr-change=${e=>t("timezone",e.detail.value)}
13468
+ ></nr-select>
13469
+ <span class="field-description">Timezone used to interpret the cron expression</span>
13470
+ </div>
13471
+ </div>
13107
13472
  `}
13108
13473
  /**
13109
13474
  * @license
13110
13475
  * Copyright 2024 Nuraly, Laabidi Aymen
13111
13476
  * SPDX-License-Identifier: MIT
13112
- */(t,a,p,h,s,r);case B.GITLAB:return Fa(t,a);case B.MCP:return function(e,t,a,o,s,r){const l=e.transportType||"streamable_http",c=e.authType||"none",d=(s||[]).filter(e=>e.keyPath.startsWith("mcp/"));return i`
13113
- ${Va(a,o,e)}
13477
+ */(t,a,p,h);case B.GITLAB:return Ha(t,a);case B.MCP:return function(e,t,a,o,s,r){const l=e.transportType||"streamable_http",c=e.authType||"none",d=(s||[]).filter(e=>e.keyPath.startsWith("mcp/"));return i`
13478
+ ${Ka(a,o,e)}
13114
13479
 
13115
13480
  <div class="config-section">
13116
13481
  <div class="config-section-header">
@@ -13130,7 +13495,7 @@ return function(e,t){return i`
13130
13495
  <label>Transport Type</label>
13131
13496
  <nr-select
13132
13497
  .value=${l}
13133
- .options=${Ba}
13498
+ .options=${qa}
13134
13499
  @nr-change=${e=>t("transportType",e.detail.value)}
13135
13500
  ></nr-select>
13136
13501
  <span class="field-description">
@@ -13148,7 +13513,7 @@ return function(e,t){return i`
13148
13513
  <label>Auth Type</label>
13149
13514
  <nr-select
13150
13515
  .value=${c}
13151
- .options=${Ua}
13516
+ .options=${Wa}
13152
13517
  @nr-change=${e=>t("authType",e.detail.value)}
13153
13518
  ></nr-select>
13154
13519
  </div>
@@ -13193,7 +13558,7 @@ return function(e,t){return i`
13193
13558
  </span>
13194
13559
  </div>
13195
13560
  </div>
13196
- `}(t,a,p,h,s,r);case B.INFORMATION_EXTRACTOR:return Ha(t,a);case B.HUBSPOT:return function(e,t,n,a){var o,s;const r=e.hubspotResource||"contact",l=e.hubspotOperation||"getAll",c=e.hubspotFilterGroups||[],d=e.hubspotAssociations||[],p=(n||[]).filter(e=>e.keyPath.startsWith("hubspot/")),h=["get","getAll","search"].includes(l);return i`
13561
+ `}(t,a,p,h,s,r);case B.INFORMATION_EXTRACTOR:return Ga(t,a);case B.HUBSPOT:return function(e,t,n,a){var o,s;const r=e.hubspotResource||"contact",l=e.hubspotOperation||"getAll",c=e.hubspotFilterGroups||[],d=e.hubspotAssociations||[],p=(n||[]).filter(e=>e.keyPath.startsWith("hubspot/")),h=["get","getAll","search"].includes(l);return i`
13197
13562
  <div class="config-section">
13198
13563
  <div class="config-section-header">
13199
13564
  <span class="config-section-title">Authentication</span>
@@ -13224,7 +13589,7 @@ return function(e,t){return i`
13224
13589
  value=${r}
13225
13590
  @nr-change=${e=>t("hubspotResource",e.detail.value)}
13226
13591
  >
13227
- ${qa.map(e=>i`
13592
+ ${Ja.map(e=>i`
13228
13593
  <nr-option value=${e.value}>${e.label}</nr-option>
13229
13594
  `)}
13230
13595
  </nr-select>
@@ -13236,7 +13601,7 @@ return function(e,t){return i`
13236
13601
  value=${l}
13237
13602
  @nr-change=${e=>t("hubspotOperation",e.detail.value)}
13238
13603
  >
13239
- ${Wa.map(e=>i`
13604
+ ${Ya.map(e=>i`
13240
13605
  <nr-option value=${e.value}>${e.label}</nr-option>
13241
13606
  `)}
13242
13607
  </nr-select>
@@ -13325,7 +13690,7 @@ return function(e,t){return i`
13325
13690
  style="flex: 1;"
13326
13691
  @nr-change=${i=>{const o=[...c];o[n].filters[a]=Object.assign(Object.assign({},e),{operator:i.detail.value}),t("hubspotFilterGroups",o)}}
13327
13692
  >
13328
- ${Ka.map(e=>i`
13693
+ ${Qa.map(e=>i`
13329
13694
  <nr-option value=${e.value}>${e.label}</nr-option>
13330
13695
  `)}
13331
13696
  </nr-select>
@@ -13388,7 +13753,7 @@ return function(e,t){return i`
13388
13753
  style="flex: 1;"
13389
13754
  @nr-change=${i=>{const a=[...d];a[n]=Object.assign(Object.assign({},e),{toObjectType:i.detail.value}),t("hubspotAssociations",a)}}
13390
13755
  >
13391
- ${qa.map(e=>i`
13756
+ ${Ja.map(e=>i`
13392
13757
  <nr-option value=${e.value}>${e.label}</nr-option>
13393
13758
  `)}
13394
13759
  </nr-select>
@@ -13460,7 +13825,7 @@ return function(e,t){return i`
13460
13825
  value=${l}
13461
13826
  @nr-change=${e=>t("operation",e.detail.value)}
13462
13827
  >
13463
- ${Ga.map(e=>i`
13828
+ ${Za.map(e=>i`
13464
13829
  <nr-option value=${e.value}>${e.label}</nr-option>
13465
13830
  `)}
13466
13831
  </nr-select>
@@ -13508,7 +13873,7 @@ return function(e,t){return i`
13508
13873
  value=${e.issueType||"Task"}
13509
13874
  @nr-change=${e=>t("issueType",e.detail.value)}
13510
13875
  >
13511
- ${Ja.map(e=>i`
13876
+ ${Xa.map(e=>i`
13512
13877
  <nr-option value=${e.value}>${e.label}</nr-option>
13513
13878
  `)}
13514
13879
  </nr-select>
@@ -13547,7 +13912,7 @@ return function(e,t){return i`
13547
13912
  value=${e.priority||"Medium"}
13548
13913
  @nr-change=${e=>t("priority",e.detail.value)}
13549
13914
  >
13550
- ${Ya.map(e=>i`
13915
+ ${eo.map(e=>i`
13551
13916
  <nr-option value=${e.value}>${e.label}</nr-option>
13552
13917
  `)}
13553
13918
  </nr-select>
@@ -13856,7 +14221,7 @@ return function(e,t){return i`
13856
14221
  value=${r}
13857
14222
  @nr-change=${e=>t("elasticsearchOperation",e.detail.value)}
13858
14223
  >
13859
- ${Qa.map(e=>i`
14224
+ ${to.map(e=>i`
13860
14225
  <nr-option value=${e.value}>${e.label}</nr-option>
13861
14226
  `)}
13862
14227
  </nr-select>
@@ -13949,7 +14314,7 @@ return function(e,t){return i`
13949
14314
  value=${e.elasticsearchRefresh||"false"}
13950
14315
  @nr-change=${e=>t("elasticsearchRefresh",e.detail.value)}
13951
14316
  >
13952
- ${Za.map(e=>i`
14317
+ ${io.map(e=>i`
13953
14318
  <nr-option value=${e.value}>${e.label}</nr-option>
13954
14319
  `)}
13955
14320
  </nr-select>
@@ -13990,7 +14355,7 @@ return function(e,t){return i`
13990
14355
  </div>
13991
14356
  </div>
13992
14357
  `}(t,a,s,r);case B.CALENDLY_TRIGGER:return function(e,t,n,a,o,s){const r=e.events||["invitee.created"],l=(o||[]).filter(e=>e.keyPath.startsWith("calendly/"));return i`
13993
- ${Ia(n,a,"CALENDLY_TRIGGER",e,{activateLabel:"Activate Trigger"})}
14358
+ ${Da(n,a,"CALENDLY_TRIGGER",e,{activateLabel:"Activate Trigger"})}
13994
14359
 
13995
14360
  <div class="config-section">
13996
14361
  <div class="config-section-header">
@@ -14018,7 +14383,7 @@ return function(e,t){return i`
14018
14383
  </div>
14019
14384
  <div class="config-field">
14020
14385
  <div class="method-checkboxes">
14021
- ${Xa.map(e=>{const n=r.includes(e.value);return i`
14386
+ ${no.map(e=>{const n=r.includes(e.value);return i`
14022
14387
  <label class="method-checkbox">
14023
14388
  <nr-checkbox
14024
14389
  .checked=${n}
@@ -14040,7 +14405,7 @@ return function(e,t){return i`
14040
14405
  <label>Scope</label>
14041
14406
  <nr-select
14042
14407
  .value=${e.scope||"user"}
14043
- .options=${eo}
14408
+ .options=${ao}
14044
14409
  @nr-change=${e=>t("scope",e.detail.value)}
14045
14410
  ></nr-select>
14046
14411
  </div>
@@ -14174,13 +14539,13 @@ return function(e,t){const n=e.noteBackgroundColor||"#fef08a",a=e.noteTextColor|
14174
14539
  <span class="field-description">Maximum tool call loops before stopping</span>
14175
14540
  </div>
14176
14541
  </div>
14177
- `}(t,a);case U.LLM:return function(e,t,a,o){var s,r,l;const c=e.provider||"openai",d=vo(c),p=e.model||d.defaultModel,h=(a||[]).filter(e=>e.keyPath.startsWith(`${c}/`)),u=e.apiUrlPath||"",b=u&&(null===(s=(a||[]).find(e=>e.keyPath===u))||void 0===s?void 0:s.value)||"http://localhost:11434",f=e=>{o&&o(e.detail)};return i`
14542
+ `}(t,a);case U.LLM:return function(e,t,a,o){var s,r,l;const c=e.provider||"openai",d=Co(c),p=e.model||d.defaultModel,h=(a||[]).filter(e=>e.keyPath.startsWith(`${c}/`)),u=e.apiUrlPath||"",b=u&&(null===(s=(a||[]).find(e=>e.keyPath===u))||void 0===s?void 0:s.value)||"http://localhost:11434",f=e=>{o&&o(e.detail)};return i`
14178
14543
  <div class="config-field">
14179
14544
  <label>Provider</label>
14180
14545
  <nr-select
14181
14546
  .value=${c}
14182
- .options=${go}
14183
- @nr-change=${e=>{const i=e.detail.value,n=vo(i);t("provider",i),t("model",n.defaultModel),t("maxTokens",n.defaultMaxTokens)}}
14547
+ .options=${So}
14548
+ @nr-change=${e=>{const i=e.detail.value,n=Co(i);t("provider",i),t("model",n.defaultModel),t("maxTokens",n.defaultMaxTokens)}}
14184
14549
  ></nr-select>
14185
14550
  </div>
14186
14551
 
@@ -14292,7 +14657,7 @@ return function(e,t){const n=e.noteBackgroundColor||"#fef08a",a=e.noteTextColor|
14292
14657
  <label>Cutoff Mode</label>
14293
14658
  <nr-select
14294
14659
  .value=${n}
14295
- .options=${mo}
14660
+ .options=${To}
14296
14661
  @nr-change=${e=>t("cutoffMode",e.detail.value)}
14297
14662
  ></nr-select>
14298
14663
  <span class="field-description">How to limit the conversation context window</span>
@@ -14875,7 +15240,7 @@ return function(e,t){const n=e.noteBackgroundColor||"#fef08a",a=e.noteTextColor|
14875
15240
  </button>
14876
15241
  </div>
14877
15242
  </div>
14878
- `}(t,a);case H.MERMAID:return Fo(t,a);case H.ANCHOR:return function(e,t){const n=e.anchorLabel||"Anchor";return i`
15243
+ `}(t,a);case H.MERMAID:return Go(t,a);case H.ANCHOR:return function(e,t){const n=e.anchorLabel||"Anchor";return i`
14879
15244
  <div class="config-section">
14880
15245
  <div class="config-section-header">
14881
15246
  <span class="config-section-title">Anchor Settings</span>
@@ -14978,7 +15343,7 @@ return function(e,t){const a="string"==typeof e.workflowId?e.workflowId:"",o="st
14978
15343
  * @license
14979
15344
  * Copyright 2024 Nuraly, Laabidi Aymen
14980
15345
  * SPDX-License-Identifier: MIT
14981
- */function qo(e){const{node:t,position:a,callbacks:o,workflowId:s,workflow:r,dynamicVariables:l,loadingVariables:d,nodeExecution:p,executionId:h,kvEntries:u,onCreateKvEntry:b,applicationId:f,databaseProvider:g,triggerInfo:v,triggerActions:m}=e;if(!t||!a)return n;const x=Z.find(e=>e.type===t.type),y={left:`${a.x}px`,top:`${a.y}px`};return i`
15346
+ */function Xo(e){const{node:t,position:a,callbacks:o,workflowId:s,workflow:r,dynamicVariables:l,loadingVariables:d,nodeExecution:p,executionId:h,kvEntries:u,onCreateKvEntry:b,applicationId:f,databaseProvider:g,triggerInfo:v,triggerActions:m}=e;if(!t||!a)return n;const x=Z.find(e=>e.type===t.type),y={left:`${a.x}px`,top:`${a.y}px`};return i`
14982
15347
  <div class="config-panel" style=${c(y)}>
14983
15348
  <div class="config-panel-header">
14984
15349
  <div class="config-panel-title">
@@ -15019,7 +15384,7 @@ function(e,t){var n;return i`
15019
15384
  ></nr-input>
15020
15385
  </div>
15021
15386
  `}(t,o)}
15022
- ${Ho(t.type,t.configuration,o.onUpdateConfig,s,u,b,f,g,p,v,m,r,t.id)}
15387
+ ${Zo(t.type,t.configuration,o.onUpdateConfig,s,u,b,f,g,p,v,m,r,t.id,o.onRunWorkflow)}
15023
15388
  ${ae(t.type)&&t.type!==H.ANCHOR?function(e,t,a){const o=e.onClickAction||"none",s=e.onClickTargetAnchorId||"",r=a.filter(e=>e.type===H.ANCHOR);return i`
15024
15389
  <div class="config-section">
15025
15390
  <div class="config-section-header">
@@ -15167,7 +15532,7 @@ function(e,t){var n;return i`
15167
15532
  * @license
15168
15533
  * Copyright 2024 Nuraly, Laabidi Aymen
15169
15534
  * SPDX-License-Identifier: MIT
15170
- */function Wo(e,t){var i;if(!e.parentFrameId)return null;const n=t.find(t=>t.id===e.parentFrameId);if(!n)return null;return(null===(i=n.configuration)||void 0===i?void 0:i.frameCollapsed)?n:null}function Ko(e,t,i=0,n=1){const a=e.position.y+46,o=16*(i-(n-1)/2);return t?{x:e.position.x,y:a+o}:{x:e.position.x+180,y:a+o}}function Go(e,t,i,o,s,r){if(e._hiddenByFrame)return n;const l=t.find(t=>t.id===e.sourceNodeId),c=t.find(t=>t.id===e.targetNodeId);if(!l||!c)return n;const d=Wo(l,t),p=Wo(c,t);if(d&&p&&d.id===p.id)return n;let h,u;h=d?Ko(d,!1,0,1):r.getPortPosition(l,e.sourcePortId,!1),u=p?Ko(p,!0,0,1):r.getPortPosition(c,e.targetPortId,!0);const b=u.x-h.x,f=Math.min(.5*Math.abs(b),100),g=`M ${h.x} ${h.y} C ${h.x+f} ${h.y}, ${u.x-f} ${u.y}, ${u.x} ${u.y}`,v=i.has(e.id),m=o===e.id,x=function(e,t,i){if(e.status)return e.status;const n=null==t?void 0:t.status,a=null==i?void 0:i.status;if(n&&n!==K.IDLE){if(n===K.COMPLETED||n===K.FAILED){if(!a||a===K.IDLE||a===K.PENDING)return;return n===K.FAILED||a===K.FAILED?K.FAILED:K.COMPLETED}return n!==K.RUNNING||a!==K.PENDING&&a!==K.RUNNING?void 0:K.RUNNING}}(e,l,c),y=function(e,t,i,n){const a=(null==n?void 0:n.includes("light"))||"default"===n;return i===K.COMPLETED?"#22c55e":i===K.RUNNING?"#3b82f6":i===K.FAILED?"#ef4444":i===K.PENDING?"#f59e0b":e?"#3b82f6":t?"#60a5fa":a?"#9ca3af":"#6b7280"}(v,m,x,s),w=v||m||x?3:2,$=.5,k=Math.pow(.5,3)*h.x+3*Math.pow(.5,2)*$*(h.x+f)+1.5*Math.pow($,2)*(u.x-f)+Math.pow($,3)*u.x,S=Math.pow(.5,3)*h.y+3*Math.pow(.5,2)*$*h.y+1.5*Math.pow($,2)*u.y+Math.pow($,3)*u.y,C=.55,T=Math.pow(1-C,3)*h.x+3*Math.pow(1-C,2)*C*(h.x+f)+3*(1-C)*Math.pow(C,2)*(u.x-f)+Math.pow(C,3)*u.x,M=Math.pow(1-C,3)*h.y+3*Math.pow(1-C,2)*C*h.y+3*(1-C)*Math.pow(C,2)*u.y+Math.pow(C,3)*u.y,z=180*Math.atan2(M-S,T-k)/Math.PI;return a`
15535
+ */function es(e,t){var i;if(!e.parentFrameId)return null;const n=t.find(t=>t.id===e.parentFrameId);if(!n)return null;return(null===(i=n.configuration)||void 0===i?void 0:i.frameCollapsed)?n:null}function ts(e,t,i=0,n=1){const a=e.position.y+46,o=16*(i-(n-1)/2);return t?{x:e.position.x,y:a+o}:{x:e.position.x+180,y:a+o}}function is(e,t,i,o,s,r){if(e._hiddenByFrame)return n;const l=t.find(t=>t.id===e.sourceNodeId),c=t.find(t=>t.id===e.targetNodeId);if(!l||!c)return n;const d=es(l,t),p=es(c,t);if(d&&p&&d.id===p.id)return n;let h,u;h=d?ts(d,!1,0,1):r.getPortPosition(l,e.sourcePortId,!1),u=p?ts(p,!0,0,1):r.getPortPosition(c,e.targetPortId,!0);const b=u.x-h.x,f=Math.min(.5*Math.abs(b),100),g=`M ${h.x} ${h.y} C ${h.x+f} ${h.y}, ${u.x-f} ${u.y}, ${u.x} ${u.y}`,v=i.has(e.id),m=o===e.id,x=function(e,t,i){if(e.status)return e.status;const n=null==t?void 0:t.status,a=null==i?void 0:i.status;if(n&&n!==K.IDLE){if(n===K.COMPLETED||n===K.FAILED){if(!a||a===K.IDLE||a===K.PENDING)return;return n===K.FAILED||a===K.FAILED?K.FAILED:K.COMPLETED}return n!==K.RUNNING||a!==K.PENDING&&a!==K.RUNNING?void 0:K.RUNNING}}(e,l,c),y=function(e,t,i,n){const a=(null==n?void 0:n.includes("light"))||"default"===n;return i===K.COMPLETED?"#22c55e":i===K.RUNNING?"#3b82f6":i===K.FAILED?"#ef4444":i===K.PENDING?"#f59e0b":e?"#3b82f6":t?"#60a5fa":a?"#9ca3af":"#6b7280"}(v,m,x,s),w=v||m||x?3:2,$=.5,k=Math.pow(.5,3)*h.x+3*Math.pow(.5,2)*$*(h.x+f)+1.5*Math.pow($,2)*(u.x-f)+Math.pow($,3)*u.x,S=Math.pow(.5,3)*h.y+3*Math.pow(.5,2)*$*h.y+1.5*Math.pow($,2)*u.y+Math.pow($,3)*u.y,C=.55,T=Math.pow(1-C,3)*h.x+3*Math.pow(1-C,2)*C*(h.x+f)+3*(1-C)*Math.pow(C,2)*(u.x-f)+Math.pow(C,3)*u.x,M=Math.pow(1-C,3)*h.y+3*Math.pow(1-C,2)*C*h.y+3*(1-C)*Math.pow(C,2)*u.y+Math.pow(C,3)*u.y,E=180*Math.atan2(M-S,T-k)/Math.PI;return a`
15171
15536
  <g class="edge-group" data-edge-id=${e.id}>
15172
15537
  <!-- Invisible wider path for easier clicking -->
15173
15538
  <path
@@ -15190,7 +15555,7 @@ function(e,t){var n;return i`
15190
15555
  <polygon
15191
15556
  class="edge-arrow"
15192
15557
  points="${k+6},${S} ${k-6},${S-4} ${k-6},${S+4}"
15193
- transform="rotate(${z}, ${k}, ${S})"
15558
+ transform="rotate(${E}, ${k}, ${S})"
15194
15559
  style="pointer-events: none; fill: ${y}; transition: fill 0.15s ease;"
15195
15560
  />
15196
15561
  ${e.label?a`
@@ -15203,15 +15568,15 @@ function(e,t){var n;return i`
15203
15568
  >${e.label}</text>
15204
15569
  `:n}
15205
15570
  </g>
15206
- `}function Jo(e){const{edges:t,nodes:i,selectedEdgeIds:o,hoveredEdgeId:s,connectionState:r,currentTheme:l,callbacks:c}=e;return a`
15207
- ${t.map(e=>Go(e,i,o,s,l,c))}
15571
+ `}function ns(e){const{edges:t,nodes:i,selectedEdgeIds:o,hoveredEdgeId:s,connectionState:r,currentTheme:l,callbacks:c}=e;return a`
15572
+ ${t.map(e=>is(e,i,o,s,l,c))}
15208
15573
  ${function(e,t,i){if(!e)return n;const o=t.find(t=>t.id===e.sourceNodeId);if(!o)return n;const s=i(o,e.sourcePortId,e.sourceIsInput),r=e.mouseX,l=e.mouseY,c=r-s.x,d=Math.min(.5*Math.abs(c),100),p=e.sourceIsInput?`M ${r} ${l} C ${r+d} ${l}, ${s.x-d} ${s.y}, ${s.x} ${s.y}`:`M ${s.x} ${s.y} C ${s.x+d} ${s.y}, ${r-d} ${l}, ${r} ${l}`;return a`<path class="connection-line" d=${p} stroke="#3b82f6" stroke-width="2" stroke-dasharray="5" fill="none" />`}(r,i,c.getPortPosition)}
15209
15574
  `}
15210
15575
  /**
15211
15576
  * @license
15212
15577
  * Copyright 2024 Nuraly, Laabidi Aymen
15213
15578
  * SPDX-License-Identifier: MIT
15214
- */Vo.styles=e`
15579
+ */Qo.styles=e`
15215
15580
  :host {
15216
15581
  display: block;
15217
15582
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
@@ -15272,19 +15637,19 @@ function(e,t){var n;return i`
15272
15637
  color: #161616;
15273
15638
  border-color: #7c3aed;
15274
15639
  }
15275
- `,Bo([o({type:String})],Vo.prototype,"selectedWorkflowId",void 0),Bo([s()],Vo.prototype,"_workflows",void 0),Bo([s()],Vo.prototype,"_loading",void 0),Bo([s()],Vo.prototype,"_error",void 0),Vo=Bo([r("wb-workflow-selector")],Vo);const Yo=[{type:H.SHAPE_RECTANGLE,icon:"square",label:"Rectangle"},{type:H.SHAPE_CIRCLE,icon:"circle",label:"Circle"},{type:H.SHAPE_DIAMOND,icon:"diamond",label:"Diamond"},{type:H.SHAPE_TRIANGLE,icon:"triangle",label:"Triangle"},{type:H.SHAPE_ARROW,icon:"arrow-right",label:"Arrow"},{type:H.SHAPE_LINE,icon:"minus",label:"Line"},{type:H.SHAPE_STAR,icon:"star",label:"Star"},{type:H.SHAPE_HEXAGON,icon:"hexagon",label:"Hexagon"}];
15640
+ `,Jo([o({type:String})],Qo.prototype,"selectedWorkflowId",void 0),Jo([s()],Qo.prototype,"_workflows",void 0),Jo([s()],Qo.prototype,"_loading",void 0),Jo([s()],Qo.prototype,"_error",void 0),Qo=Jo([r("wb-workflow-selector")],Qo);const as=[{type:H.SHAPE_RECTANGLE,icon:"square",label:"Rectangle"},{type:H.SHAPE_CIRCLE,icon:"circle",label:"Circle"},{type:H.SHAPE_DIAMOND,icon:"diamond",label:"Diamond"},{type:H.SHAPE_TRIANGLE,icon:"triangle",label:"Triangle"},{type:H.SHAPE_ARROW,icon:"arrow-right",label:"Arrow"},{type:H.SHAPE_LINE,icon:"minus",label:"Line"},{type:H.SHAPE_STAR,icon:"star",label:"Star"},{type:H.SHAPE_HEXAGON,icon:"hexagon",label:"Hexagon"}];
15276
15641
  /**
15277
15642
  * @license
15278
15643
  * Copyright 2024 Nuraly, Laabidi Aymen
15279
15644
  * SPDX-License-Identifier: MIT
15280
15645
  */
15281
- function Qo(e){e.stopPropagation()}
15646
+ function os(e){e.stopPropagation()}
15282
15647
  /**
15283
15648
  * @license
15284
15649
  * Copyright 2024 Nuraly, Laabidi Aymen
15285
15650
  * SPDX-License-Identifier: MIT
15286
15651
  */
15287
- const Zo=400,Xo=300,es="rgba(99, 102, 241, 0.05)",ts="rgba(99, 102, 241, 0.3)",is="Group",ns="top-left",as="outside",os=180,ss=80,rs=200,ls=100,cs=200,ds=100,ps=50,hs=320,us=200,bs=200,fs=120,gs=400,vs=200,ms=1e4,xs=["TELEGRAM_BOT","SLACK_SOCKET","DISCORD_BOT","WHATSAPP_WEBHOOK","CUSTOM_WEBSOCKET","RABBITMQ_TRIGGER","CALENDLY_TRIGGER","KAFKA_TRIGGER"],ys=["#fef08a","#bbf7d0","#bfdbfe","#fecaca","#e9d5ff","#fed7aa","#ffffff","#f3f4f6"],ws=["#8b5cf6","#3b82f6","#ef4444","#22c55e","#f59e0b","#6b7280","#1a1a1a","#e5e7eb"],$s=["#1a1a1a","#374151","#713f12","#1e3a5f","#7f1d1d","#4c1d95","#ffffff"],ks=[{value:"Inter, sans-serif",label:"Inter"},{value:"Arial, sans-serif",label:"Arial"},{value:"Georgia, serif",label:"Georgia"},{value:"Courier New, monospace",label:"Courier New"},{value:"Comic Sans MS, cursive",label:"Comic Sans"},{value:"Verdana, sans-serif",label:"Verdana"}],Ss=[{value:"default",label:"Default"},{value:"dark",label:"Dark"},{value:"forest",label:"Forest"},{value:"neutral",label:"Neutral"},{value:"base",label:"Base"}];function Cs(e){const{frame:t,isSelected:n,editingFrameLabelId:a,callbacks:o}=e,s=t.configuration||{};if(s.frameCollapsed)return null;const r=s.frameWidth||400,l=s.frameHeight||300,d=s.frameBackgroundColor||es,p=s.frameBorderColor||ts,h=s.frameLabel||is,u=s.frameLabelPosition||ns,b=s.frameLabelPlacement||as,f=!1!==s.frameShowLabel,g={left:`${t.position.x}px`,top:`${t.position.y}px`,width:`${r}px`,height:`${l}px`,backgroundColor:d,borderColor:p};return i`
15652
+ const ss=400,rs=300,ls="rgba(99, 102, 241, 0.05)",cs="rgba(99, 102, 241, 0.3)",ds="Group",ps="top-left",hs="outside",us=180,bs=80,fs=200,gs=100,vs=200,ms=100,xs=50,ys=320,ws=200,$s=200,ks=120,Ss=400,Cs=200,Ts=1e4,Ms=["TELEGRAM_BOT","SLACK_SOCKET","DISCORD_BOT","WHATSAPP_WEBHOOK","CUSTOM_WEBSOCKET","RABBITMQ_TRIGGER","CALENDLY_TRIGGER","KAFKA_TRIGGER","CRON"],Es=["#fef08a","#bbf7d0","#bfdbfe","#fecaca","#e9d5ff","#fed7aa","#ffffff","#f3f4f6"],zs=["#8b5cf6","#3b82f6","#ef4444","#22c55e","#f59e0b","#6b7280","#1a1a1a","#e5e7eb"],As=["#1a1a1a","#374151","#713f12","#1e3a5f","#7f1d1d","#4c1d95","#ffffff"],Os=[{value:"Inter, sans-serif",label:"Inter"},{value:"Arial, sans-serif",label:"Arial"},{value:"Georgia, serif",label:"Georgia"},{value:"Courier New, monospace",label:"Courier New"},{value:"Comic Sans MS, cursive",label:"Comic Sans"},{value:"Verdana, sans-serif",label:"Verdana"}],Is=[{value:"default",label:"Default"},{value:"dark",label:"Dark"},{value:"forest",label:"Forest"},{value:"neutral",label:"Neutral"},{value:"base",label:"Base"}];function Ps(e){const{frame:t,isSelected:n,editingFrameLabelId:a,callbacks:o}=e,s=t.configuration||{};if(s.frameCollapsed)return null;const r=s.frameWidth||400,l=s.frameHeight||300,d=s.frameBackgroundColor||ls,p=s.frameBorderColor||cs,h=s.frameLabel||ds,u=s.frameLabelPosition||ps,b=s.frameLabelPlacement||hs,f=!1!==s.frameShowLabel,g={left:`${t.position.x}px`,top:`${t.position.y}px`,width:`${r}px`,height:`${l}px`,backgroundColor:d,borderColor:p};return i`
15288
15653
  <div
15289
15654
  class="frame-node ${n?"selected":""}"
15290
15655
  style=${c(g)}
@@ -15331,7 +15696,7 @@ function(e,t,n,a,o,s){const r=n===e.id?i`
15331
15696
  * @license
15332
15697
  * Copyright 2024 Nuraly, Laabidi Aymen
15333
15698
  * SPDX-License-Identifier: MIT
15334
- */function Ts(e){const{node:t,nodeScreenPosition:a,viewportZoom:o,activeColorPicker:s,shadowRoot:r,hostBoundingRect:l,callbacks:d}=e,p=t.configuration||{},h=function(e){return e.type===H.STICKY_NOTE||e.type===H.TEXT_BLOCK||e.type===H.VOTING}(t),u=function(e){return e.type!==H.DRAWING&&e.type!==H.SHAPE_LINE&&e.type!==H.SHAPE_ARROW&&e.type!==H.ANCHOR&&e.type!==H.WORKFLOW&&e.type!==H.DATABASE}(t),b=function(e){return e.type===H.MERMAID||e.type===H.SHAPE_RECTANGLE||e.type===H.IMAGE||e.type===H.FRAME||e.type===H.WORKFLOW||e.type===H.DATABASE}(t),f=(p.width||200)*o,g={left:`${a.x+f/2}px`,top:a.y-52+"px"};return i`
15699
+ */function Ns(e){const{node:t,nodeScreenPosition:a,viewportZoom:o,activeColorPicker:s,shadowRoot:r,hostBoundingRect:l,callbacks:d}=e,p=t.configuration||{},h=function(e){return e.type===H.STICKY_NOTE||e.type===H.TEXT_BLOCK||e.type===H.VOTING}(t),u=function(e){return e.type!==H.DRAWING&&e.type!==H.SHAPE_LINE&&e.type!==H.SHAPE_ARROW&&e.type!==H.ANCHOR&&e.type!==H.WORKFLOW&&e.type!==H.DATABASE}(t),b=function(e){return e.type===H.MERMAID||e.type===H.SHAPE_RECTANGLE||e.type===H.IMAGE||e.type===H.FRAME||e.type===H.WORKFLOW||e.type===H.DATABASE}(t),f=(p.width||200)*o,g={left:`${a.x+f/2}px`,top:a.y-52+"px"};return i`
15335
15700
  <div class="wb-floating-toolbar" style=${c(g)} @mousedown=${e=>e.stopPropagation()}>
15336
15701
  ${u?i`
15337
15702
  <div class="wb-toolbar-group">
@@ -15389,7 +15754,7 @@ function(e,t,n,a,o,s){const r=n===e.id?i`
15389
15754
  <label class="wb-toolbar-label">Font</label>
15390
15755
  <nr-select
15391
15756
  size="small"
15392
- .options=${[...ks]}
15757
+ .options=${[...Os]}
15393
15758
  .value=${p.fontFamily||"Inter, sans-serif"}
15394
15759
  placeholder="Font"
15395
15760
  style="width: 130px;"
@@ -15404,7 +15769,7 @@ function(e,t,n,a,o,s){const r=n===e.id?i`
15404
15769
  <label class="wb-toolbar-label">Theme</label>
15405
15770
  <nr-select
15406
15771
  size="small"
15407
- .options=${[...Ss]}
15772
+ .options=${[...Is]}
15408
15773
  .value=${p.mermaidTheme||"default"}
15409
15774
  placeholder="Theme"
15410
15775
  style="width: 110px;"
@@ -15420,7 +15785,7 @@ function(e,t,n,a,o,s){const r=n===e.id?i`
15420
15785
  </button>
15421
15786
  </div>
15422
15787
  </div>
15423
- ${(()=>{if(!s)return n;const e=null==r?void 0:r.querySelector(`.wb-color-trigger-${s}`);if(!e)return n;const a=e.getBoundingClientRect(),o={left:a.left-l.left+"px",top:a.bottom-l.top+6+"px"},{currentColor:h,presets:u,configKey:b}=function(e,t){return"fill"===e?{currentColor:t.backgroundColor||t.fillColor||"#fef08a",presets:ys,configKey:"backgroundColor"}:"border"===e?{currentColor:t.borderColor||"#8b5cf6",presets:ws,configKey:"borderColor"}:{currentColor:t.textColor||"#1a1a1a",presets:$s,configKey:"textColor"}}(s,p);return i`
15788
+ ${(()=>{if(!s)return n;const e=null==r?void 0:r.querySelector(`.wb-color-trigger-${s}`);if(!e)return n;const a=e.getBoundingClientRect(),o={left:a.left-l.left+"px",top:a.bottom-l.top+6+"px"},{currentColor:h,presets:u,configKey:b}=function(e,t){return"fill"===e?{currentColor:t.backgroundColor||t.fillColor||"#fef08a",presets:Es,configKey:"backgroundColor"}:"border"===e?{currentColor:t.borderColor||"#8b5cf6",presets:zs,configKey:"borderColor"}:{currentColor:t.textColor||"#1a1a1a",presets:As,configKey:"textColor"}}(s,p);return i`
15424
15789
  <div class="wb-color-picker-panel" style=${c(o)} @mousedown=${e=>e.stopPropagation()}>
15425
15790
  <div class="wb-picker-presets">
15426
15791
  ${u.map(e=>i`
@@ -15455,7 +15820,7 @@ function(e,t,n,a,o,s){const r=n===e.id?i`
15455
15820
  * @license
15456
15821
  * Copyright 2024 Nuraly, Laabidi Aymen
15457
15822
  * SPDX-License-Identifier: MIT
15458
- */var Ms=function(e,t,i,n){for(var a,o=arguments.length,s=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n,r=e.length-1;r>=0;r--)(a=e[r])&&(s=(o<3?a(s):o>3?a(t,i,s):a(t,i))||s);return o>3&&s&&Object.defineProperty(t,i,s),s},zs=function(e,t,i,n){return new(i||(i=Promise))(function(a,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function r(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?a(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(s,r)}l((n=n.apply(e,t||[])).next())})};class Es extends(we(t)){get workflow(){return this._workflow}set workflow(e){this.setWorkflow(e)}get undoProvider(){var e,t;return null!==(t=null===(e=this.undoController)||void 0===e?void 0:e.undoProvider)&&void 0!==t?t:null}set undoProvider(e){this.undoController&&(this.undoController.undoProvider=e)}constructor(){super(),this._workflow={id:"",name:"",nodes:[],edges:[]},this.readonly=!1,this.disabled=!1,this.showMinimap=!0,this.showToolbar=!0,this.showZoomControls=!0,this.showPalette=!1,this.canvasId="",this.collaborative=!1,this.viewport={zoom:1,panX:0,panY:0},this.mode=J.SELECT,this.selectedNodeIds=new Set,this.selectedEdgeIds=new Set,this.connectionState=null,this.dragState=null,this.contextMenu=null,this.isPanning=!1,this.panStart={x:0,y:0},this.hoveredEdgeId=null,this.marqueeState=null,this.lastMousePosition=null,this.editingFrameLabelId=null,this.editingNoteId=null,this.configuredNode=null,this.insertPanelNode=null,this.expandedCategories=new Set,this.showChatbotPanel=!1,this.chatbotUnreadCount=0,this.canvasChatbotController=null,this.noteResizeState=null,this.insertPanelColumns=[],this.insertPanelSchemaName="",this.handleGlobalMouseUp=e=>{if(this.disabled)return;const t=this.dragState,i=t?new Set(this.selectedNodeIds):null;if(this.dragController.stopDrag(),this.viewportController.stopPan(),this.connectionController.cancelConnection(),this.marqueeState&&this.marqueeController.endSelection(e.shiftKey),this.collaborative&&t&&i)for(const e of i){const t=this.workflow.nodes.find(t=>t.id===e);t&&this.collaborationController.broadcastOperation("MOVE",e,{x:t.position.x,y:t.position.y})}},this.handleGlobalMouseMove=e=>{if(!this.disabled){if(this.canvasWrapper){const t=this.canvasWrapper.getBoundingClientRect();this.lastMousePosition={x:(e.clientX-t.left-this.viewport.panX)/this.viewport.zoom,y:(e.clientY-t.top-this.viewport.panY)/this.viewport.zoom}}this.collaborative&&this.lastMousePosition&&this.collaborationController.broadcastCursorMove(this.lastMousePosition.x,this.lastMousePosition.y),this.onGlobalMouseMoveExtra(e)||(this.dragState&&this.dragController.handleDrag(e),this.isPanning&&this.viewportController.handlePanDrag(e),this.connectionState&&this.connectionController.updateConnectionPosition(e),this.marqueeState&&this.marqueeController.updateSelection(e))}},this.handleCanvasMouseDown=e=>{if(this.disabled)return;this.contextMenu=null,this.onCanvasMouseDownExtra(e);const t=e.target,i=t.classList.contains("canvas-grid")||t.classList.contains("canvas-wrapper");1===e.button?(e.preventDefault(),this.viewportController.startPan(e)):0===e.button&&i&&(e.preventDefault(),e.ctrlKey||e.metaKey||this.mode===J.PAN?(this.viewportController.startPan(e),e.shiftKey||this.selectionController.clearSelection()):this.marqueeController.startSelection(e,e.shiftKey))},this.handleCanvasContextMenu=e=>{if(e.preventDefault(),this.disabled)return;const t=this.selectedNodeIds.size>0?"node":"canvas";this.contextMenu={x:e.clientX,y:e.clientY,type:t}},this.handleCanvasDrop=e=>{var t;if(e.preventDefault(),this.disabled)return;const i=null===(t=e.dataTransfer)||void 0===t?void 0:t.getData("application/workflow-node-type");if(!i)return;const n=this.canvasWrapper.getBoundingClientRect(),a=(e.clientX-n.left-this.viewport.panX)/this.viewport.zoom,o=(e.clientY-n.top-this.viewport.panY)/this.viewport.zoom;this.addNode(i,{x:20*Math.round(a/20),y:20*Math.round(o/20)})},this.handleCanvasDragOver=e=>{this.disabled||(e.preventDefault(),e.dataTransfer.dropEffect="copy")},this.handleNoteResizeDrag=e=>{this.handleNoteResizeWithCoords(e.clientX,e.clientY)},this.stopNoteResize=()=>{if(!this.noteResizeState)return;const e=this.noteResizeState.nodeId;this.noteResizeState=null,document.removeEventListener("mousemove",this.handleNoteResizeDrag),document.removeEventListener("mouseup",this.stopNoteResize),this.onNoteResizeStopped(e),this.dispatchWorkflowChanged()};const e=this;this.viewportController=new wi(e),this.selectionController=new $i(e),this.connectionController=new ki(e),this.configController=new Ti(e),this.marqueeController=new Mi(this),this.clipboardController=new Ei(this),this.undoController=new Oi(e),this.frameController=new Ai(e),this.keyboardController=new Si(e,this.selectionController),this.keyboardController.setClipboardController(this.clipboardController),this.keyboardController.setUndoController(this.undoController),this.dragController=new Ci(e,this.viewportController),new Ni(e,this.viewportController,this.dragController,this.selectionController),this.selectionController.setUndoController(this.undoController),this.dragController.setUndoController(this.undoController),this.connectionController.setUndoController(this.undoController),this.configController.setUndoController(this.undoController),this.clipboardController.setUndoController(this.undoController),this.dragController.setFrameController(this.frameController),this.collaborationController=new Ii(e)}onCanvasMouseDownExtra(e){}onGlobalMouseMoveExtra(e){return!1}onNodeMouseDownExtra(e){}onConnected(){}onDisconnected(){}onNoteResizeStarted(e,t){}onNoteResizeStopped(e){}getNodesForRendering(){return this.workflow.nodes}isNodeInsideFrame(e,t,i,n,a){const o=this.getNodeDimensionsForContainment(e),s=e.position.x+o.width/2,r=e.position.y+o.height/2;return s>=t&&s<=n&&r>=i&&r<=a}computeFrameContainment(e){const t=e.filter(e=>de(e.type));for(const i of t){const t=i.configuration||{},n=t.frameWidth||400,a=t.frameHeight||300,o=i.position.x,s=i.position.y,r=o+n,l=s+a,c=t.frameCollapsed,d=[];for(const t of e)t.id===i.id||de(t.type)||this.shouldExcludeFromContainment(t)||this.isNodeInsideFrame(t,o,s,r,l)&&(d.push(t.id),t.parentFrameId=i.id,c&&(t.metadata=t.metadata||{},t.metadata._hiddenByFrame=!0));i.containedNodeIds=d}return e}connectedCallback(){const e=Object.create(null,{connectedCallback:{get:()=>super.connectedCallback}});return zs(this,void 0,void 0,function*(){e.connectedCallback.call(this),globalThis.addEventListener("mouseup",this.handleGlobalMouseUp),globalThis.addEventListener("mousemove",this.handleGlobalMouseMove),yield this.updateComplete,this.viewportController.updateTransform(),this.collaborative&&this.canvasId&&this.collaborationController.connect(this.canvasId,this.getCanvasType()),this.onConnected()})}disconnectedCallback(){super.disconnectedCallback(),globalThis.removeEventListener("mouseup",this.handleGlobalMouseUp),globalThis.removeEventListener("mousemove",this.handleGlobalMouseMove),this.onDisconnected()}willUpdate(e){super.willUpdate(e),this.collaborative&&e.has("selectedNodeIds")&&this.collaborationController.broadcastSelectionChange(Array.from(this.selectedNodeIds))}setWorkflow(e){const t=this._workflow;let i=this.normalizeNodes([...e.nodes]);i=this.computeFrameContainment(i),this._workflow=Object.assign(Object.assign({},e),{nodes:i}),this.requestUpdate("workflow",t),e.viewport&&(null==t?void 0:t.id)!==e.id&&(this.viewport=e.viewport,this.updateComplete.then(()=>{var e;null===(e=this.viewportController)||void 0===e||e.updateTransform()})),this.onWorkflowLoaded(e,t)}dispatchWorkflowChanged(){this.dispatchEvent(new CustomEvent("workflow-changed",{detail:{workflow:this.workflow},bubbles:!0,composed:!0}))}dispatchViewportChanged(){this.dispatchEvent(new CustomEvent("viewport-changed",{detail:{viewport:this.viewport},bubbles:!0,composed:!0}))}dispatchNodeSelected(e){this.dispatchEvent(new CustomEvent("node-selected",{detail:{node:e},bubbles:!0,composed:!0}))}dispatchNodeMoved(e,t){this.dispatchEvent(new CustomEvent("node-moved",{detail:{node:e,position:t},bubbles:!0,composed:!0}))}handleNodeMouseDown(e){if(this.disabled)return;this.contextMenu=null;const{node:t,event:i}=e.detail,n=this.selectedNodeIds.has(t.id);i.shiftKey?this.selectionController.selectNode(t.id,!0):n||(this.selectionController.clearSelection(),this.selectionController.selectNode(t.id,!1)),this.configuredNode&&(this.configuredNode=t),this.readonly||this.dragController.startDrag(t,i),this.dispatchNodeSelected(t),this.onNodeMouseDownExtra(t)}handleEdgeClick(e,t){this.disabled||(e.stopPropagation(),this.selectionController.selectEdge(t.id,e.shiftKey))}handlePortMouseDown(e){if(this.disabled||this.readonly)return;const{node:t,port:i,isInput:n,event:a}=e.detail;this.connectionController.startConnection(t,i,n,a)}handlePortMouseUp(e){if(this.disabled)return;const{node:t,port:i,isInput:n}=e.detail,a=this.workflow.edges.length;if(this.connectionController.completeConnection(t,i,n),this.collaborative&&this.workflow.edges.length>a){const e=this.workflow.edges[this.workflow.edges.length-1];e&&this.collaborationController.broadcastOperation("ADD_CONNECTOR",e.id,{edge:e})}}addNode(e,t){if(this.readonly)return;const i=se(e,t||{x:(400-this.viewport.panX)/this.viewport.zoom,y:(200-this.viewport.panY)/this.viewport.zoom});i&&(this.undoController.recordNodeAdded(i),de(e)?(this.workflow=Object.assign(Object.assign({},this.workflow),{nodes:[i,...this.workflow.nodes]}),this.frameController.updateFrameContainment(i)):(this.workflow=Object.assign(Object.assign({},this.workflow),{nodes:[...this.workflow.nodes,i]}),this.frameController.updateAllFrameContainments()),this.dispatchWorkflowChanged(),this.collaborative&&this.collaborationController.broadcastOperation("ADD",i.id,{node:i}))}getPortPosition(e,t,i){return this.connectionController.getPortPosition(e,t,i)}getFrameNodes(){return this.getNodesForRendering().filter(e=>de(e.type))}getVisibleNonFrameNodes(){return this.getNodesForRendering().filter(e=>{var t;return!de(e.type)&&!(null===(t=e.metadata)||void 0===t?void 0:t._hiddenByFrame)})}renderExpandedFrame(e){return Cs({frame:e,isSelected:this.selectedNodeIds.has(e.id),editingFrameLabelId:this.editingFrameLabelId,readonly:this.readonly,callbacks:{onFrameMouseDown:(e,t)=>this.handleFrameMouseDown(e,t),onFrameDblClick:(e,t)=>this.handleFrameDblClick(e,t),onFrameResize:(e,t,i)=>this.handleFrameResize(e,t,i),onStartEditingLabel:(e,t)=>this.startEditingFrameLabel(e,t),onLabelBlur:(e,t)=>this.handleFrameLabelBlur(e,t),onLabelKeydown:(e,t)=>this.handleFrameLabelKeydown(e,t)}})}handleFrameMouseDown(e,t){e.stopPropagation(),e.shiftKey||(this.selectedNodeIds.clear(),this.selectedEdgeIds.clear()),this.selectedNodeIds.add(t.id),this.handleNodeMouseDown({detail:{node:t,event:e}}),this.requestUpdate()}handleFrameDblClick(e,t){e.stopPropagation(),this.frameController.toggleCollapsed(t)}handleFrameResize(e,t,i){e.stopPropagation(),this.frameController.startResize(e,t,i)}startEditingFrameLabel(e,t){e.stopPropagation(),e.preventDefault(),this.readonly||(this.editingFrameLabelId=t.id,this.updateComplete.then(()=>{var e;const t=null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector(".frame-label-input, .collapsed-frame-title-input");t&&(t.focus(),t.select())}))}handleFrameLabelBlur(e,t){const i=e.target.value.trim()||is;this.saveFrameLabel(t,i),this.editingFrameLabelId=null}handleFrameLabelKeydown(e,t){if("Enter"===e.key){e.preventDefault();const i=e.target.value.trim()||is;this.saveFrameLabel(t,i),this.editingFrameLabelId=null}else"Escape"===e.key&&(e.preventDefault(),this.editingFrameLabelId=null)}saveFrameLabel(e,t){const i=this.workflow.nodes.map(i=>i.id===e.id?Object.assign(Object.assign({},i),{name:t,configuration:Object.assign(Object.assign({},i.configuration),{frameLabel:t})}):i);this.setWorkflow(Object.assign(Object.assign({},this.workflow),{nodes:i})),this.dispatchWorkflowChanged(),this.collaborative&&this.collaborationController.broadcastOperation("UPDATE",e.id,{frameLabel:t})}handleNoteContentChange(e){const{node:t,content:i}=e.detail,n=this.getNoteContentKey(t),a=this.workflow.nodes.map(e=>e.id===t.id?Object.assign(Object.assign({},e),{configuration:Object.assign(Object.assign({},e.configuration),{[n]:i})}):e);this.setWorkflow(Object.assign(Object.assign({},this.workflow),{nodes:a})),this.dispatchWorkflowChanged(),this.collaborative&&this.collaborationController.broadcastOperation("UPDATE_TEXT",t.id,{[n]:i})}handleNoteEditEnd(e){this.collaborative&&this.editingNoteId&&this.collaborationController.broadcastTypingStop(this.editingNoteId),this.editingNoteId=null}handleNoteResizeStart(e){const{node:t,event:i}=e.detail;this.startNoteResize(t,i)}startNoteResize(e,t){const i=e.configuration||{},n=this.getNoteSizeKeys(),a=this.getDefaultNoteSize();this.noteResizeState={nodeId:e.id,startX:t.clientX,startY:t.clientY,startWidth:i[n.widthKey]||a.width,startHeight:i[n.heightKey]||a.height},document.addEventListener("mousemove",this.handleNoteResizeDrag),document.addEventListener("mouseup",this.stopNoteResize),this.onNoteResizeStarted(e,t)}handleNoteResizeWithCoords(e,t){if(!this.noteResizeState)return;const{nodeId:i,startX:n,startY:a,startWidth:o,startHeight:s}=this.noteResizeState,r=this.workflow.nodes.find(e=>e.id===i);if(!r)return;const l=(e-n)/this.viewport.zoom,c=(t-a)/this.viewport.zoom,d=Math.max(100,o+l),p=Math.max(50,s+c),h=this.getNoteSizeKeys();r.configuration=Object.assign(Object.assign({},r.configuration),{[h.widthKey]:d,[h.heightKey]:p}),this.requestUpdate()}initCanvasChatbotController(){var e;null!==(e=this.canvasChatbotController)&&void 0!==e||(this.canvasChatbotController=new xi)}toggleChatbotPanel(){this.showChatbotPanel=!this.showChatbotPanel,this.showChatbotPanel&&(this.initCanvasChatbotController(),this.chatbotUnreadCount=0)}renderEdges(){return Jo({edges:this.workflow.edges,nodes:this.getNodesForRendering(),selectedEdgeIds:this.selectedEdgeIds,hoveredEdgeId:this.hoveredEdgeId,connectionState:this.connectionState,currentTheme:this.currentTheme,callbacks:{onEdgeClick:(e,t)=>this.handleEdgeClick(e,t),onEdgeHover:e=>this.connectionController.setHoveredEdge(e),getPortPosition:(e,t,i)=>this.getPortPosition(e,t,i)}})}renderToolbar(){return(e={showToolbar:this.showToolbar,mode:this.mode,showPalette:this.showPalette,canvasType:this.getCanvasType(),hasSelection:this.selectedNodeIds.size>0||this.selectedEdgeIds.size>0,hasSingleSelection:1===this.selectedNodeIds.size,readonly:this.readonly,canUndo:this.undoController.canUndo(),canRedo:this.undoController.canRedo(),undoTooltip:this.undoController.getUndoTooltip(),redoTooltip:this.undoController.getRedoTooltip(),showChatbot:this.showChatbotPanel,onToggleChatbot:()=>this.toggleChatbotPanel(),chatbotUnreadCount:this.chatbotUnreadCount,onModeChange:e=>{this.mode=e},onTogglePalette:()=>{this.showPalette=!this.showPalette},onZoomIn:()=>this.viewportController.zoomIn(),onZoomOut:()=>this.viewportController.zoomOut(),onResetView:()=>this.viewportController.resetView(),onOpenConfig:()=>this.selectionController.openConfigForSelected(),onDelete:()=>this.selectionController.deleteSelected(),onUndo:()=>this.undoController.performUndo(),onRedo:()=>this.undoController.performRedo()}).showToolbar?i`
15823
+ */var Rs=function(e,t,i,n){for(var a,o=arguments.length,s=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n,r=e.length-1;r>=0;r--)(a=e[r])&&(s=(o<3?a(s):o>3?a(t,i,s):a(t,i))||s);return o>3&&s&&Object.defineProperty(t,i,s),s},Ds=function(e,t,i,n){return new(i||(i=Promise))(function(a,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function r(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?a(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(s,r)}l((n=n.apply(e,t||[])).next())})};class _s extends(we(t)){get workflow(){return this._workflow}set workflow(e){this.setWorkflow(e)}get undoProvider(){var e,t;return null!==(t=null===(e=this.undoController)||void 0===e?void 0:e.undoProvider)&&void 0!==t?t:null}set undoProvider(e){this.undoController&&(this.undoController.undoProvider=e)}constructor(){super(),this._workflow={id:"",name:"",nodes:[],edges:[]},this.readonly=!1,this.disabled=!1,this.showMinimap=!0,this.showToolbar=!0,this.showZoomControls=!0,this.showPalette=!1,this.canvasId="",this.collaborative=!1,this.viewport={zoom:1,panX:0,panY:0},this.mode=J.SELECT,this.selectedNodeIds=new Set,this.selectedEdgeIds=new Set,this.connectionState=null,this.dragState=null,this.contextMenu=null,this.isPanning=!1,this.panStart={x:0,y:0},this.hoveredEdgeId=null,this.marqueeState=null,this.lastMousePosition=null,this.editingFrameLabelId=null,this.editingNoteId=null,this.configuredNode=null,this.insertPanelNode=null,this.expandedCategories=new Set,this.showChatbotPanel=!1,this.chatbotUnreadCount=0,this.canvasChatbotController=null,this.noteResizeState=null,this.insertPanelColumns=[],this.insertPanelSchemaName="",this.handleGlobalMouseUp=e=>{if(this.disabled)return;const t=this.dragState,i=t?new Set(this.selectedNodeIds):null;if(this.dragController.stopDrag(),this.viewportController.stopPan(),this.connectionController.cancelConnection(),this.marqueeState&&this.marqueeController.endSelection(e.shiftKey),this.collaborative&&t&&i)for(const e of i){const t=this.workflow.nodes.find(t=>t.id===e);t&&this.collaborationController.broadcastOperation("MOVE",e,{x:t.position.x,y:t.position.y})}},this.handleGlobalMouseMove=e=>{if(!this.disabled){if(this.canvasWrapper){const t=this.canvasWrapper.getBoundingClientRect();this.lastMousePosition={x:(e.clientX-t.left-this.viewport.panX)/this.viewport.zoom,y:(e.clientY-t.top-this.viewport.panY)/this.viewport.zoom}}this.collaborative&&this.lastMousePosition&&this.collaborationController.broadcastCursorMove(this.lastMousePosition.x,this.lastMousePosition.y),this.onGlobalMouseMoveExtra(e)||(this.dragState&&this.dragController.handleDrag(e),this.isPanning&&this.viewportController.handlePanDrag(e),this.connectionState&&this.connectionController.updateConnectionPosition(e),this.marqueeState&&this.marqueeController.updateSelection(e))}},this.handleCanvasMouseDown=e=>{if(this.disabled)return;this.contextMenu=null,this.onCanvasMouseDownExtra(e);const t=e.target,i=t.classList.contains("canvas-grid")||t.classList.contains("canvas-wrapper");1===e.button?(e.preventDefault(),this.viewportController.startPan(e)):0===e.button&&i&&(e.preventDefault(),e.ctrlKey||e.metaKey||this.mode===J.PAN?(this.viewportController.startPan(e),e.shiftKey||this.selectionController.clearSelection()):this.marqueeController.startSelection(e,e.shiftKey))},this.handleCanvasContextMenu=e=>{if(e.preventDefault(),this.disabled)return;const t=this.selectedNodeIds.size>0?"node":"canvas";this.contextMenu={x:e.clientX,y:e.clientY,type:t}},this.handleCanvasDrop=e=>{var t;if(e.preventDefault(),this.disabled)return;const i=null===(t=e.dataTransfer)||void 0===t?void 0:t.getData("application/workflow-node-type");if(!i)return;const n=this.canvasWrapper.getBoundingClientRect(),a=(e.clientX-n.left-this.viewport.panX)/this.viewport.zoom,o=(e.clientY-n.top-this.viewport.panY)/this.viewport.zoom;this.addNode(i,{x:20*Math.round(a/20),y:20*Math.round(o/20)})},this.handleCanvasDragOver=e=>{this.disabled||(e.preventDefault(),e.dataTransfer.dropEffect="copy")},this.handleNoteResizeDrag=e=>{this.handleNoteResizeWithCoords(e.clientX,e.clientY)},this.stopNoteResize=()=>{if(!this.noteResizeState)return;const e=this.noteResizeState.nodeId;this.noteResizeState=null,document.removeEventListener("mousemove",this.handleNoteResizeDrag),document.removeEventListener("mouseup",this.stopNoteResize),this.onNoteResizeStopped(e),this.dispatchWorkflowChanged()};const e=this;this.viewportController=new wi(e),this.selectionController=new $i(e),this.connectionController=new ki(e),this.configController=new Ti(e),this.marqueeController=new Mi(this),this.clipboardController=new zi(this),this.undoController=new Ai(e),this.frameController=new Oi(e),this.keyboardController=new Si(e,this.selectionController),this.keyboardController.setClipboardController(this.clipboardController),this.keyboardController.setUndoController(this.undoController),this.dragController=new Ci(e,this.viewportController),new Ni(e,this.viewportController,this.dragController,this.selectionController),this.selectionController.setUndoController(this.undoController),this.dragController.setUndoController(this.undoController),this.connectionController.setUndoController(this.undoController),this.configController.setUndoController(this.undoController),this.clipboardController.setUndoController(this.undoController),this.dragController.setFrameController(this.frameController),this.collaborationController=new Ii(e)}onCanvasMouseDownExtra(e){}onGlobalMouseMoveExtra(e){return!1}onNodeMouseDownExtra(e){}onConnected(){}onDisconnected(){}onNoteResizeStarted(e,t){}onNoteResizeStopped(e){}getNodesForRendering(){return this.workflow.nodes}isNodeInsideFrame(e,t,i,n,a){const o=this.getNodeDimensionsForContainment(e),s=e.position.x+o.width/2,r=e.position.y+o.height/2;return s>=t&&s<=n&&r>=i&&r<=a}computeFrameContainment(e){const t=e.filter(e=>de(e.type));for(const i of t){const t=i.configuration||{},n=t.frameWidth||400,a=t.frameHeight||300,o=i.position.x,s=i.position.y,r=o+n,l=s+a,c=t.frameCollapsed,d=[];for(const t of e)t.id===i.id||de(t.type)||this.shouldExcludeFromContainment(t)||this.isNodeInsideFrame(t,o,s,r,l)&&(d.push(t.id),t.parentFrameId=i.id,c&&(t.metadata=t.metadata||{},t.metadata._hiddenByFrame=!0));i.containedNodeIds=d}return e}connectedCallback(){const e=Object.create(null,{connectedCallback:{get:()=>super.connectedCallback}});return Ds(this,void 0,void 0,function*(){e.connectedCallback.call(this),globalThis.addEventListener("mouseup",this.handleGlobalMouseUp),globalThis.addEventListener("mousemove",this.handleGlobalMouseMove),yield this.updateComplete,this.viewportController.updateTransform(),this.collaborative&&this.canvasId&&this.collaborationController.connect(this.canvasId,this.getCanvasType()),this.onConnected()})}disconnectedCallback(){super.disconnectedCallback(),globalThis.removeEventListener("mouseup",this.handleGlobalMouseUp),globalThis.removeEventListener("mousemove",this.handleGlobalMouseMove),this.onDisconnected()}willUpdate(e){super.willUpdate(e),this.collaborative&&e.has("selectedNodeIds")&&this.collaborationController.broadcastSelectionChange(Array.from(this.selectedNodeIds))}setWorkflow(e){const t=this._workflow;let i=this.normalizeNodes([...e.nodes]);i=this.computeFrameContainment(i),this._workflow=Object.assign(Object.assign({},e),{nodes:i}),this.requestUpdate("workflow",t),e.viewport&&(null==t?void 0:t.id)!==e.id&&(this.viewport=e.viewport,this.updateComplete.then(()=>{var e;null===(e=this.viewportController)||void 0===e||e.updateTransform()})),this.onWorkflowLoaded(e,t)}dispatchWorkflowChanged(){this.dispatchEvent(new CustomEvent("workflow-changed",{detail:{workflow:this.workflow},bubbles:!0,composed:!0}))}dispatchViewportChanged(){this.dispatchEvent(new CustomEvent("viewport-changed",{detail:{viewport:this.viewport},bubbles:!0,composed:!0}))}dispatchNodeSelected(e){this.dispatchEvent(new CustomEvent("node-selected",{detail:{node:e},bubbles:!0,composed:!0}))}dispatchNodeMoved(e,t){this.dispatchEvent(new CustomEvent("node-moved",{detail:{node:e,position:t},bubbles:!0,composed:!0}))}handleNodeMouseDown(e){if(this.disabled)return;this.contextMenu=null;const{node:t,event:i}=e.detail,n=this.selectedNodeIds.has(t.id);i.shiftKey?this.selectionController.selectNode(t.id,!0):n||(this.selectionController.clearSelection(),this.selectionController.selectNode(t.id,!1)),this.configuredNode&&(this.configuredNode=t),this.readonly||this.dragController.startDrag(t,i),this.dispatchNodeSelected(t),this.onNodeMouseDownExtra(t)}handleEdgeClick(e,t){this.disabled||(e.stopPropagation(),this.selectionController.selectEdge(t.id,e.shiftKey))}handlePortMouseDown(e){if(this.disabled||this.readonly)return;const{node:t,port:i,isInput:n,event:a}=e.detail;this.connectionController.startConnection(t,i,n,a)}handlePortMouseUp(e){if(this.disabled)return;const{node:t,port:i,isInput:n}=e.detail,a=this.workflow.edges.length;if(this.connectionController.completeConnection(t,i,n),this.collaborative&&this.workflow.edges.length>a){const e=this.workflow.edges[this.workflow.edges.length-1];e&&this.collaborationController.broadcastOperation("ADD_CONNECTOR",e.id,{edge:e})}}addNode(e,t){if(this.readonly)return;const i=se(e,t||{x:(400-this.viewport.panX)/this.viewport.zoom,y:(200-this.viewport.panY)/this.viewport.zoom});i&&(this.undoController.recordNodeAdded(i),de(e)?(this.workflow=Object.assign(Object.assign({},this.workflow),{nodes:[i,...this.workflow.nodes]}),this.frameController.updateFrameContainment(i)):(this.workflow=Object.assign(Object.assign({},this.workflow),{nodes:[...this.workflow.nodes,i]}),this.frameController.updateAllFrameContainments()),this.dispatchWorkflowChanged(),this.collaborative&&this.collaborationController.broadcastOperation("ADD",i.id,{node:i}))}getPortPosition(e,t,i){return this.connectionController.getPortPosition(e,t,i)}getFrameNodes(){return this.getNodesForRendering().filter(e=>de(e.type))}getVisibleNonFrameNodes(){return this.getNodesForRendering().filter(e=>{var t;return!de(e.type)&&!(null===(t=e.metadata)||void 0===t?void 0:t._hiddenByFrame)})}renderExpandedFrame(e){return Ps({frame:e,isSelected:this.selectedNodeIds.has(e.id),editingFrameLabelId:this.editingFrameLabelId,readonly:this.readonly,callbacks:{onFrameMouseDown:(e,t)=>this.handleFrameMouseDown(e,t),onFrameDblClick:(e,t)=>this.handleFrameDblClick(e,t),onFrameResize:(e,t,i)=>this.handleFrameResize(e,t,i),onStartEditingLabel:(e,t)=>this.startEditingFrameLabel(e,t),onLabelBlur:(e,t)=>this.handleFrameLabelBlur(e,t),onLabelKeydown:(e,t)=>this.handleFrameLabelKeydown(e,t)}})}handleFrameMouseDown(e,t){e.stopPropagation(),e.shiftKey||(this.selectedNodeIds.clear(),this.selectedEdgeIds.clear()),this.selectedNodeIds.add(t.id),this.handleNodeMouseDown({detail:{node:t,event:e}}),this.requestUpdate()}handleFrameDblClick(e,t){e.stopPropagation(),this.frameController.toggleCollapsed(t)}handleFrameResize(e,t,i){e.stopPropagation(),this.frameController.startResize(e,t,i)}startEditingFrameLabel(e,t){e.stopPropagation(),e.preventDefault(),this.readonly||(this.editingFrameLabelId=t.id,this.updateComplete.then(()=>{var e;const t=null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector(".frame-label-input, .collapsed-frame-title-input");t&&(t.focus(),t.select())}))}handleFrameLabelBlur(e,t){const i=e.target.value.trim()||ds;this.saveFrameLabel(t,i),this.editingFrameLabelId=null}handleFrameLabelKeydown(e,t){if("Enter"===e.key){e.preventDefault();const i=e.target.value.trim()||ds;this.saveFrameLabel(t,i),this.editingFrameLabelId=null}else"Escape"===e.key&&(e.preventDefault(),this.editingFrameLabelId=null)}saveFrameLabel(e,t){const i=this.workflow.nodes.map(i=>i.id===e.id?Object.assign(Object.assign({},i),{name:t,configuration:Object.assign(Object.assign({},i.configuration),{frameLabel:t})}):i);this.setWorkflow(Object.assign(Object.assign({},this.workflow),{nodes:i})),this.dispatchWorkflowChanged(),this.collaborative&&this.collaborationController.broadcastOperation("UPDATE",e.id,{frameLabel:t})}handleNoteContentChange(e){const{node:t,content:i}=e.detail,n=this.getNoteContentKey(t),a=this.workflow.nodes.map(e=>e.id===t.id?Object.assign(Object.assign({},e),{configuration:Object.assign(Object.assign({},e.configuration),{[n]:i})}):e);this.setWorkflow(Object.assign(Object.assign({},this.workflow),{nodes:a})),this.dispatchWorkflowChanged(),this.collaborative&&this.collaborationController.broadcastOperation("UPDATE_TEXT",t.id,{[n]:i})}handleNoteEditEnd(e){this.collaborative&&this.editingNoteId&&this.collaborationController.broadcastTypingStop(this.editingNoteId),this.editingNoteId=null}handleNoteResizeStart(e){const{node:t,event:i}=e.detail;this.startNoteResize(t,i)}startNoteResize(e,t){const i=e.configuration||{},n=this.getNoteSizeKeys(),a=this.getDefaultNoteSize();this.noteResizeState={nodeId:e.id,startX:t.clientX,startY:t.clientY,startWidth:i[n.widthKey]||a.width,startHeight:i[n.heightKey]||a.height},document.addEventListener("mousemove",this.handleNoteResizeDrag),document.addEventListener("mouseup",this.stopNoteResize),this.onNoteResizeStarted(e,t)}handleNoteResizeWithCoords(e,t){if(!this.noteResizeState)return;const{nodeId:i,startX:n,startY:a,startWidth:o,startHeight:s}=this.noteResizeState,r=this.workflow.nodes.find(e=>e.id===i);if(!r)return;const l=(e-n)/this.viewport.zoom,c=(t-a)/this.viewport.zoom,d=Math.max(100,o+l),p=Math.max(50,s+c),h=this.getNoteSizeKeys();r.configuration=Object.assign(Object.assign({},r.configuration),{[h.widthKey]:d,[h.heightKey]:p}),this.requestUpdate()}initCanvasChatbotController(){var e;null!==(e=this.canvasChatbotController)&&void 0!==e||(this.canvasChatbotController=new xi)}toggleChatbotPanel(){this.showChatbotPanel=!this.showChatbotPanel,this.showChatbotPanel&&(this.initCanvasChatbotController(),this.chatbotUnreadCount=0)}renderEdges(){return ns({edges:this.workflow.edges,nodes:this.getNodesForRendering(),selectedEdgeIds:this.selectedEdgeIds,hoveredEdgeId:this.hoveredEdgeId,connectionState:this.connectionState,currentTheme:this.currentTheme,callbacks:{onEdgeClick:(e,t)=>this.handleEdgeClick(e,t),onEdgeHover:e=>this.connectionController.setHoveredEdge(e),getPortPosition:(e,t,i)=>this.getPortPosition(e,t,i)}})}renderToolbar(){return(e={showToolbar:this.showToolbar,mode:this.mode,showPalette:this.showPalette,canvasType:this.getCanvasType(),hasSelection:this.selectedNodeIds.size>0||this.selectedEdgeIds.size>0,hasSingleSelection:1===this.selectedNodeIds.size,readonly:this.readonly,canUndo:this.undoController.canUndo(),canRedo:this.undoController.canRedo(),undoTooltip:this.undoController.getUndoTooltip(),redoTooltip:this.undoController.getRedoTooltip(),showChatbot:this.showChatbotPanel,onToggleChatbot:()=>this.toggleChatbotPanel(),chatbotUnreadCount:this.chatbotUnreadCount,onModeChange:e=>{this.mode=e},onTogglePalette:()=>{this.showPalette=!this.showPalette},onZoomIn:()=>this.viewportController.zoomIn(),onZoomOut:()=>this.viewportController.zoomOut(),onResetView:()=>this.viewportController.resetView(),onOpenConfig:()=>this.selectionController.openConfigForSelected(),onDelete:()=>this.selectionController.deleteSelected(),onUndo:()=>this.undoController.performUndo(),onRedo:()=>this.undoController.performRedo()}).showToolbar?i`
15459
15824
  <div class="canvas-toolbar">
15460
15825
  <button
15461
15826
  class="toolbar-btn"
@@ -15667,12 +16032,12 @@ function(e){const{cursors:t,viewport:a,localUserId:o}=e,s=t.filter(e=>e.userId!=
15667
16032
  ${a?`${t.length} online`:"Reconnecting..."}
15668
16033
  </span>
15669
16034
  </div>
15670
- `}({users:this.collaborationController.getUsers(),connected:this.collaborationController.isConnected(),onUserClick:e=>this.handlePanToUser(e)}):n}renderConfigPanel(){return qo({node:this.configuredNode,position:this.configController.getPanelPosition(),callbacks:{onClose:()=>this.configController.closeConfig(),onUpdateName:e=>this.configController.updateName(e),onUpdateDescription:e=>this.configController.updateDescription(e),onUpdateConfig:(e,t)=>{this.configController.updateConfig(e,t),this.collaborative&&this.configuredNode&&this.collaborationController.broadcastOperation("UPDATE",this.configuredNode.id,{[e]:t})}},workflow:this.workflow})}renderChatbotPanel(){return e={isOpen:this.showChatbotPanel,controller:this.canvasChatbotController,unreadCount:this.chatbotUnreadCount,currentTheme:this.currentTheme},t={onClose:()=>this.toggleChatbotPanel()},e.isOpen?i`
16035
+ `}({users:this.collaborationController.getUsers(),connected:this.collaborationController.isConnected(),onUserClick:e=>this.handlePanToUser(e)}):n}renderConfigPanel(){return Xo({node:this.configuredNode,position:this.configController.getPanelPosition(),callbacks:{onClose:()=>this.configController.closeConfig(),onUpdateName:e=>this.configController.updateName(e),onUpdateDescription:e=>this.configController.updateDescription(e),onUpdateConfig:(e,t)=>{this.configController.updateConfig(e,t),this.collaborative&&this.configuredNode&&this.collaborationController.broadcastOperation("UPDATE",this.configuredNode.id,{[e]:t})}},workflow:this.workflow})}renderChatbotPanel(){return e={isOpen:this.showChatbotPanel,controller:this.canvasChatbotController,unreadCount:this.chatbotUnreadCount,currentTheme:this.currentTheme},t={onClose:()=>this.toggleChatbotPanel()},e.isOpen?i`
15671
16036
  <div class="chatbot-panel"
15672
16037
  data-theme=${e.currentTheme}
15673
- @mousedown=${Qo}
15674
- @touchstart=${Qo}
15675
- @pointerdown=${Qo}
16038
+ @mousedown=${os}
16039
+ @touchstart=${os}
16040
+ @pointerdown=${os}
15676
16041
  >
15677
16042
  <div class="chatbot-panel-header">
15678
16043
  <span class="chatbot-panel-title">
@@ -15695,7 +16060,7 @@ function(e){const{cursors:t,viewport:a,localUserId:o}=e,s=t.filter(e=>e.userId!=
15695
16060
  ></nr-chatbot>
15696
16061
  </div>
15697
16062
  </div>
15698
- `:n;var e,t}}Es.useShadowDom=!0,Ms([o({type:Object})],Es.prototype,"workflow",null),Ms([o({type:Boolean})],Es.prototype,"readonly",void 0),Ms([o({type:Boolean})],Es.prototype,"disabled",void 0),Ms([o({type:Boolean})],Es.prototype,"showMinimap",void 0),Ms([o({type:Boolean})],Es.prototype,"showToolbar",void 0),Ms([o({type:Boolean})],Es.prototype,"showZoomControls",void 0),Ms([o({type:Boolean})],Es.prototype,"showPalette",void 0),Ms([o({type:String,attribute:"canvas-id"})],Es.prototype,"canvasId",void 0),Ms([o({type:Boolean,attribute:"collaborative"})],Es.prototype,"collaborative",void 0),Ms([o({attribute:!1})],Es.prototype,"undoProvider",null),Ms([s()],Es.prototype,"viewport",void 0),Ms([s()],Es.prototype,"mode",void 0),Ms([s()],Es.prototype,"selectedNodeIds",void 0),Ms([s()],Es.prototype,"selectedEdgeIds",void 0),Ms([s()],Es.prototype,"connectionState",void 0),Ms([s()],Es.prototype,"dragState",void 0),Ms([s()],Es.prototype,"contextMenu",void 0),Ms([s()],Es.prototype,"isPanning",void 0),Ms([s()],Es.prototype,"panStart",void 0),Ms([s()],Es.prototype,"hoveredEdgeId",void 0),Ms([s()],Es.prototype,"marqueeState",void 0),Ms([s()],Es.prototype,"lastMousePosition",void 0),Ms([s()],Es.prototype,"editingFrameLabelId",void 0),Ms([s()],Es.prototype,"editingNoteId",void 0),Ms([s()],Es.prototype,"configuredNode",void 0),Ms([s()],Es.prototype,"insertPanelNode",void 0),Ms([s()],Es.prototype,"expandedCategories",void 0),Ms([s()],Es.prototype,"showChatbotPanel",void 0),Ms([s()],Es.prototype,"chatbotUnreadCount",void 0),Ms([l(".canvas-wrapper")],Es.prototype,"canvasWrapper",void 0),Ms([l(".canvas-viewport")],Es.prototype,"canvasViewport",void 0),Ms([l(".config-panel")],Es.prototype,"configPanel",void 0),Ms([l(".insert-panel")],Es.prototype,"insertPanel",void 0),Ms([o({attribute:!1})],Es.prototype,"insertPanelColumns",void 0),Ms([o({type:String})],Es.prototype,"insertPanelSchemaName",void 0);const Os=e`
16063
+ `:n;var e,t}}_s.useShadowDom=!0,Rs([o({type:Object})],_s.prototype,"workflow",null),Rs([o({type:Boolean})],_s.prototype,"readonly",void 0),Rs([o({type:Boolean})],_s.prototype,"disabled",void 0),Rs([o({type:Boolean})],_s.prototype,"showMinimap",void 0),Rs([o({type:Boolean})],_s.prototype,"showToolbar",void 0),Rs([o({type:Boolean})],_s.prototype,"showZoomControls",void 0),Rs([o({type:Boolean})],_s.prototype,"showPalette",void 0),Rs([o({type:String,attribute:"canvas-id"})],_s.prototype,"canvasId",void 0),Rs([o({type:Boolean,attribute:"collaborative"})],_s.prototype,"collaborative",void 0),Rs([o({attribute:!1})],_s.prototype,"undoProvider",null),Rs([s()],_s.prototype,"viewport",void 0),Rs([s()],_s.prototype,"mode",void 0),Rs([s()],_s.prototype,"selectedNodeIds",void 0),Rs([s()],_s.prototype,"selectedEdgeIds",void 0),Rs([s()],_s.prototype,"connectionState",void 0),Rs([s()],_s.prototype,"dragState",void 0),Rs([s()],_s.prototype,"contextMenu",void 0),Rs([s()],_s.prototype,"isPanning",void 0),Rs([s()],_s.prototype,"panStart",void 0),Rs([s()],_s.prototype,"hoveredEdgeId",void 0),Rs([s()],_s.prototype,"marqueeState",void 0),Rs([s()],_s.prototype,"lastMousePosition",void 0),Rs([s()],_s.prototype,"editingFrameLabelId",void 0),Rs([s()],_s.prototype,"editingNoteId",void 0),Rs([s()],_s.prototype,"configuredNode",void 0),Rs([s()],_s.prototype,"insertPanelNode",void 0),Rs([s()],_s.prototype,"expandedCategories",void 0),Rs([s()],_s.prototype,"showChatbotPanel",void 0),Rs([s()],_s.prototype,"chatbotUnreadCount",void 0),Rs([l(".canvas-wrapper")],_s.prototype,"canvasWrapper",void 0),Rs([l(".canvas-viewport")],_s.prototype,"canvasViewport",void 0),Rs([l(".config-panel")],_s.prototype,"configPanel",void 0),Rs([l(".insert-panel")],_s.prototype,"insertPanel",void 0),Rs([o({attribute:!1})],_s.prototype,"insertPanelColumns",void 0),Rs([o({type:String})],_s.prototype,"insertPanelSchemaName",void 0);const js=e`
15699
16064
  :host {
15700
16065
  display: block;
15701
16066
  position: absolute;
@@ -16741,7 +17106,7 @@ function(e){const{cursors:t,viewport:a,localUserId:o}=e,s=t.filter(e=>e.userId!=
16741
17106
  outline: 2px dashed var(--remote-selection-color, #3b82f6);
16742
17107
  outline-offset: 4px;
16743
17108
  }
16744
- `,As=e`
17109
+ `,Ls=e`
16745
17110
  :host {
16746
17111
  display: inline-block;
16747
17112
  vertical-align: middle;
@@ -17006,33 +17371,33 @@ function(e){const{cursors:t,viewport:a,localUserId:o}=e,s=t.filter(e=>e.userId!=
17006
17371
  :host([type="default"]) .ripple { background: rgba(0, 0, 0, 0.06); }
17007
17372
  :host([type="ghost"]) .ripple { background: rgba(124, 58, 237, 0.15); }
17008
17373
  :host([type="danger"]) .ripple { background: rgba(255, 255, 255, 0.3); }
17009
- `,Is=As,Ps="";
17374
+ `,Fs=Ls,Bs="";
17010
17375
  /**
17011
17376
  * @license
17012
17377
  * Copyright 2023 Nuraly, Laabidi Aymen
17013
17378
  * SPDX-License-Identifier: MIT
17014
17379
  */
17015
- class Ns extends Ue{}
17380
+ class Us extends Ue{}
17016
17381
  /**
17017
17382
  * @license
17018
17383
  * Copyright 2023 Nuraly, Laabidi Aymen
17019
17384
  * SPDX-License-Identifier: MIT
17020
- */class Rs extends Ns{createRipple(e){try{if(!this.host.ripple||this.host.disabled)return;const t=e.currentTarget,i=t.getBoundingClientRect(),n=2*Math.max(i.width,i.height),a=e.clientX-i.left-n/2,o=e.clientY-i.top-n/2,s=document.createElement("span");s.className="ripple",s.style.width=s.style.height=n+"px",s.style.left=a+"px",s.style.top=o+"px";t.querySelectorAll(".ripple").forEach(e=>e.remove()),t.appendChild(s),setTimeout(()=>{s.remove()},600)}catch(e){this.handleError(e,"createRipple")}}handleRippleClick(e){try{this.createRipple(e),this.dispatchEvent(new CustomEvent("button-click",{detail:{disabled:this.host.disabled,timestamp:Date.now(),coordinates:{x:e.clientX,y:e.clientY}},bubbles:!0,composed:!0}))}catch(e){this.handleError(e,"handleRippleClick")}}}
17385
+ */class Vs extends Us{createRipple(e){try{if(!this.host.ripple||this.host.disabled)return;const t=e.currentTarget,i=t.getBoundingClientRect(),n=2*Math.max(i.width,i.height),a=e.clientX-i.left-n/2,o=e.clientY-i.top-n/2,s=document.createElement("span");s.className="ripple",s.style.width=s.style.height=n+"px",s.style.left=a+"px",s.style.top=o+"px";t.querySelectorAll(".ripple").forEach(e=>e.remove()),t.appendChild(s),setTimeout(()=>{s.remove()},600)}catch(e){this.handleError(e,"createRipple")}}handleRippleClick(e){try{this.createRipple(e),this.dispatchEvent(new CustomEvent("button-click",{detail:{disabled:this.host.disabled,timestamp:Date.now(),coordinates:{x:e.clientX,y:e.clientY}},bubbles:!0,composed:!0}))}catch(e){this.handleError(e,"handleRippleClick")}}}
17021
17386
  /**
17022
17387
  * @license
17023
17388
  * Copyright 2023 Nuraly, Laabidi Aymen
17024
17389
  * SPDX-License-Identifier: MIT
17025
- */class Ds extends Ns{handleKeyboardActivation(e){try{if(this.host.disabled)return;this.isActivationKey(e)&&(e.preventDefault(),this.host.click(),this.dispatchEvent(new CustomEvent("keyboard-activation",{detail:{key:e.key,timestamp:Date.now(),target:this.host},bubbles:!0,composed:!0})))}catch(e){this.handleError(e,"handleKeyboardActivation")}}handleKeydown(e){try{if(this.host.disabled){if(!this.isReadonlyKeyAllowed(e))return void e.preventDefault()}this.handleKeyboardActivation(e)}catch(e){this.handleError(e,"handleKeydown")}}isActivationKey(e){return"Enter"===e.key||" "===e.key}isReadonlyKeyAllowed(e){return["Tab","Shift","Escape","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End"].includes(e.key)}}
17390
+ */class Hs extends Us{handleKeyboardActivation(e){try{if(this.host.disabled)return;this.isActivationKey(e)&&(e.preventDefault(),this.host.click(),this.dispatchEvent(new CustomEvent("keyboard-activation",{detail:{key:e.key,timestamp:Date.now(),target:this.host},bubbles:!0,composed:!0})))}catch(e){this.handleError(e,"handleKeyboardActivation")}}handleKeydown(e){try{if(this.host.disabled){if(!this.isReadonlyKeyAllowed(e))return void e.preventDefault()}this.handleKeyboardActivation(e)}catch(e){this.handleError(e,"handleKeydown")}}isActivationKey(e){return"Enter"===e.key||" "===e.key}isReadonlyKeyAllowed(e){return["Tab","Shift","Escape","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End"].includes(e.key)}}
17026
17391
  /**
17027
17392
  * @license
17028
17393
  * Copyright 2023 Nuraly, Laabidi Aymen
17029
17394
  * SPDX-License-Identifier: MIT
17030
- */class _s extends Ns{isLinkType(){return!!this.host.href}getElementTag(){return this.isLinkType()?"a":"button"}getLinkAttributes(){try{const e={};return this.isLinkType()?(e.href=this.host.href,this.host.target&&(e.target=this.host.target,"_blank"===this.host.target&&(e.rel="noopener noreferrer")),e.role="link"):e.role="button",e}catch(e){return this.handleError(e,"getLinkAttributes"),{role:"button"}}}handleLinkNavigation(e){try{this.isLinkType()&&this.dispatchEvent(new CustomEvent("link-navigation",{detail:{href:this.host.href,target:this.host.target,timestamp:Date.now(),originalEvent:e},bubbles:!0,composed:!0}))}catch(e){this.handleError(e,"handleLinkNavigation")}}}
17395
+ */class qs extends Us{isLinkType(){return!!this.host.href}getElementTag(){return this.isLinkType()?"a":"button"}getLinkAttributes(){try{const e={};return this.isLinkType()?(e.href=this.host.href,this.host.target&&(e.target=this.host.target,"_blank"===this.host.target&&(e.rel="noopener noreferrer")),e.role="link"):e.role="button",e}catch(e){return this.handleError(e,"getLinkAttributes"),{role:"button"}}}handleLinkNavigation(e){try{this.isLinkType()&&this.dispatchEvent(new CustomEvent("link-navigation",{detail:{href:this.host.href,target:this.host.target,timestamp:Date.now(),originalEvent:e},bubbles:!0,composed:!0}))}catch(e){this.handleError(e,"handleLinkNavigation")}}}
17031
17396
  /**
17032
17397
  * @license
17033
17398
  * Copyright 2023 Nuraly, Laabidi Aymen
17034
17399
  * SPDX-License-Identifier: MIT
17035
- */var js=function(e,t,i,n){for(var a,o=arguments.length,s=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n,r=e.length-1;r>=0;r--)(a=e[r])&&(s=(o<3?a(s):o>3?a(t,i,s):a(t,i))||s);return o>3&&s&&Object.defineProperty(t,i,s),s};let Ls=class extends(we(t)){constructor(){super(...arguments),this.disabled=!1,this.loading=!1,this.size=Ps,this.type="default",this.shape="default",this.block=!1,this.dashed=!1,this.icon=[],this.iconPosition="left",this.href=Ps,this.target=Ps,this.ripple=!0,this.buttonAriaLabel=Ps,this.ariaDescribedBy=Ps,this.htmlType=Ps,this.requiredComponents=["nr-icon"],this.rippleController=new Rs(this),this.keyboardController=new Ds(this),this.linkController=new _s(this)}connectedCallback(){super.connectedCallback(),this.validateDependencies()}getCommonAttributes(){return{"data-type":this.type,"data-shape":this.shape,"data-size":this.size||n,"data-state":this.loading?"loading":n,"data-block":this.block?"true":n,class:this.dashed?"button-dashed":"","aria-disabled":this.disabled?"true":"false","aria-label":this.buttonAriaLabel||n,"aria-describedby":this.ariaDescribedBy||n,tabindex:this.disabled?"-1":"0"}}renderIcon(e){if(!this.isComponentAvailable("nr-icon")){const t="string"==typeof e?e:e.name;return console.warn(`[nr-button] Icon component 'nr-icon' not available. Icon "${t}" will not render. Ensure the icon component is imported and registered.`),n}const t=()=>{switch(this.size){case"small":return"small";case"medium":default:return"medium";case"large":return"large"}};if("string"==typeof e){const n=t();return i`<nr-icon name=${e} size=${g(n)}></nr-icon>`}const{name:a,type:o="solid",size:s,color:r,alt:l}=e,c=s||t();return i`<nr-icon
17400
+ */var Ws=function(e,t,i,n){for(var a,o=arguments.length,s=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n,r=e.length-1;r>=0;r--)(a=e[r])&&(s=(o<3?a(s):o>3?a(t,i,s):a(t,i))||s);return o>3&&s&&Object.defineProperty(t,i,s),s};let Ks=class extends(we(t)){constructor(){super(...arguments),this.disabled=!1,this.loading=!1,this.size=Bs,this.type="default",this.shape="default",this.block=!1,this.dashed=!1,this.icon=[],this.iconPosition="left",this.href=Bs,this.target=Bs,this.ripple=!0,this.buttonAriaLabel=Bs,this.ariaDescribedBy=Bs,this.htmlType=Bs,this.requiredComponents=["nr-icon"],this.rippleController=new Vs(this),this.keyboardController=new Hs(this),this.linkController=new qs(this)}connectedCallback(){super.connectedCallback(),this.validateDependencies()}getCommonAttributes(){return{"data-type":this.type,"data-shape":this.shape,"data-size":this.size||n,"data-state":this.loading?"loading":n,"data-block":this.block?"true":n,class:this.dashed?"button-dashed":"","aria-disabled":this.disabled?"true":"false","aria-label":this.buttonAriaLabel||n,"aria-describedby":this.ariaDescribedBy||n,tabindex:this.disabled?"-1":"0"}}renderIcon(e){if(!this.isComponentAvailable("nr-icon")){const t="string"==typeof e?e:e.name;return console.warn(`[nr-button] Icon component 'nr-icon' not available. Icon "${t}" will not render. Ensure the icon component is imported and registered.`),n}const t=()=>{switch(this.size){case"small":return"small";case"medium":default:return"medium";case"large":return"large"}};if("string"==typeof e){const n=t();return i`<nr-icon name=${e} size=${g(n)}></nr-icon>`}const{name:a,type:o="solid",size:s,color:r,alt:l}=e,c=s||t();return i`<nr-icon
17036
17401
  name=${a}
17037
17402
  type=${o}
17038
17403
  alt=${l||""}
@@ -17087,13 +17452,13 @@ class Ns extends Ue{}
17087
17452
  >
17088
17453
  ${r}
17089
17454
  </button>
17090
- `}};Ls.styles=Is,Ls.useShadowDom=!0,js([o({type:Boolean})],Ls.prototype,"disabled",void 0),js([o({type:Boolean})],Ls.prototype,"loading",void 0),js([o({type:String})],Ls.prototype,"size",void 0),js([o({type:String,reflect:!0})],Ls.prototype,"type",void 0),js([o({type:String})],Ls.prototype,"shape",void 0),js([o({type:Boolean})],Ls.prototype,"block",void 0),js([o({type:Boolean})],Ls.prototype,"dashed",void 0),js([o({type:Array})],Ls.prototype,"icon",void 0),js([o({type:Object})],Ls.prototype,"iconLeft",void 0),js([o({type:Object})],Ls.prototype,"iconRight",void 0),js([o({type:Object})],Ls.prototype,"icons",void 0),js([o({reflect:!0})],Ls.prototype,"iconPosition",void 0),js([o({type:String})],Ls.prototype,"href",void 0),js([o({type:String})],Ls.prototype,"target",void 0),js([o({type:Boolean})],Ls.prototype,"ripple",void 0),js([o({type:String})],Ls.prototype,"buttonAriaLabel",void 0),js([o({type:String})],Ls.prototype,"ariaDescribedBy",void 0),js([o({type:String})],Ls.prototype,"htmlType",void 0),Ls=js([r("nr-button")],Ls);
17455
+ `}};Ks.styles=Fs,Ks.useShadowDom=!0,Ws([o({type:Boolean})],Ks.prototype,"disabled",void 0),Ws([o({type:Boolean})],Ks.prototype,"loading",void 0),Ws([o({type:String})],Ks.prototype,"size",void 0),Ws([o({type:String,reflect:!0})],Ks.prototype,"type",void 0),Ws([o({type:String})],Ks.prototype,"shape",void 0),Ws([o({type:Boolean})],Ks.prototype,"block",void 0),Ws([o({type:Boolean})],Ks.prototype,"dashed",void 0),Ws([o({type:Array})],Ks.prototype,"icon",void 0),Ws([o({type:Object})],Ks.prototype,"iconLeft",void 0),Ws([o({type:Object})],Ks.prototype,"iconRight",void 0),Ws([o({type:Object})],Ks.prototype,"icons",void 0),Ws([o({reflect:!0})],Ks.prototype,"iconPosition",void 0),Ws([o({type:String})],Ks.prototype,"href",void 0),Ws([o({type:String})],Ks.prototype,"target",void 0),Ws([o({type:Boolean})],Ks.prototype,"ripple",void 0),Ws([o({type:String})],Ks.prototype,"buttonAriaLabel",void 0),Ws([o({type:String})],Ks.prototype,"ariaDescribedBy",void 0),Ws([o({type:String})],Ks.prototype,"htmlType",void 0),Ks=Ws([r("nr-button")],Ks);
17091
17456
  /**
17092
17457
  * @license
17093
17458
  * Copyright 2024 Nuraly, Laabidi Aymen
17094
17459
  * SPDX-License-Identifier: MIT
17095
17460
  */
17096
- var Fs=function(e,t,i,n){for(var a,o=arguments.length,s=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n,r=e.length-1;r>=0;r--)(a=e[r])&&(s=(o<3?a(s):o>3?a(t,i,s):a(t,i))||s);return o>3&&s&&Object.defineProperty(t,i,s),s};let Bs=class extends(we(t)){constructor(){super(...arguments),this.selected=!1,this.dragging=!1,this.connectingPortId=null,this.editing=!1,this.remoteSelection=null,this.remoteTyping=null,this.hoveredPort=null}updated(e){var t;if(super.updated(e),e.has("editing")&&this.editing){const e=null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector(".note-textarea");e&&e.focus()}}getNodeColor(){var e;return(null===(e=this.node.metadata)||void 0===e?void 0:e.color)||Y[this.node.type]||"#3b82f6"}getNodeIcon(){var e;return(null===(e=this.node.metadata)||void 0===e?void 0:e.icon)||Q[this.node.type]||"box"}handleNodeMouseDown(e){e.target.classList.contains("port")||(e.stopPropagation(),this.dispatchEvent(new CustomEvent("node-mousedown",{detail:{node:this.node,event:e},bubbles:!0,composed:!0})))}handleNodeDblClick(e){e.stopPropagation(),this.dispatchEvent(new CustomEvent("node-dblclick",{detail:{node:this.node},bubbles:!0,composed:!0}))}handleInsertClick(e){e.stopPropagation(),this.dispatchEvent(new CustomEvent("node-insert-row",{detail:{node:this.node},bubbles:!0,composed:!0}))}handlePreviewClick(e){e.stopPropagation(),e.preventDefault(),this.dispatchEvent(new CustomEvent("node-preview",{detail:{node:this.node},bubbles:!0,composed:!0}))}isChatbotNode(){return this.node.type===B.CHATBOT||this.node.type===B.CHAT_START}hasPreviewPanel(){return this.isChatbotNode()||this.node.type===B.HTTP_START}isStartNode(){return this.node.type===B.START}isDbTableNode(){return this.node.type===V.TABLE}isUiTableNode(){return this.node.type===B.UI_TABLE}isNoteNode(){return pe(this.node.type)}getNoteFontSize(){var e;switch((null===(e=this.node.configuration)||void 0===e?void 0:e.noteFontSize)||"medium"){case"small":return"12px";case"large":return"16px";default:return"14px"}}renderNoteNode(){const e=this.node.configuration||{},t=e.noteBackgroundColor||"#fef08a",a=e.noteTextColor||"#713f12",o=e.noteContent||"Add your note here...",s=e.noteShowBorder||!1,r=e.noteWidth||200,l=e.noteHeight||100,d={"node-container":!0,"note-node":!0,selected:this.selected,dragging:this.dragging,editing:this.editing},h={"--note-bg":t,"--note-text":a,left:`${this.node.position.x}px`,top:`${this.node.position.y}px`},u={backgroundColor:t,color:a,fontSize:this.getNoteFontSize(),border:s?`1px solid ${a}30`:"none",width:`${r}px`,minHeight:`${l}px`};return i`
17461
+ var Gs=function(e,t,i,n){for(var a,o=arguments.length,s=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n,r=e.length-1;r>=0;r--)(a=e[r])&&(s=(o<3?a(s):o>3?a(t,i,s):a(t,i))||s);return o>3&&s&&Object.defineProperty(t,i,s),s};let Js=class extends(we(t)){constructor(){super(...arguments),this.selected=!1,this.dragging=!1,this.connectingPortId=null,this.editing=!1,this.remoteSelection=null,this.remoteTyping=null,this.hoveredPort=null}updated(e){var t;if(super.updated(e),e.has("editing")&&this.editing){const e=null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector(".note-textarea");e&&e.focus()}}getNodeColor(){var e;return(null===(e=this.node.metadata)||void 0===e?void 0:e.color)||Y[this.node.type]||"#3b82f6"}getNodeIcon(){var e;return(null===(e=this.node.metadata)||void 0===e?void 0:e.icon)||Q[this.node.type]||"box"}handleNodeMouseDown(e){e.target.classList.contains("port")||(e.stopPropagation(),this.dispatchEvent(new CustomEvent("node-mousedown",{detail:{node:this.node,event:e},bubbles:!0,composed:!0})))}handleNodeDblClick(e){e.stopPropagation(),this.dispatchEvent(new CustomEvent("node-dblclick",{detail:{node:this.node},bubbles:!0,composed:!0}))}handleInsertClick(e){e.stopPropagation(),this.dispatchEvent(new CustomEvent("node-insert-row",{detail:{node:this.node},bubbles:!0,composed:!0}))}handlePreviewClick(e){e.stopPropagation(),e.preventDefault(),this.dispatchEvent(new CustomEvent("node-preview",{detail:{node:this.node},bubbles:!0,composed:!0}))}isChatbotNode(){return this.node.type===B.CHATBOT||this.node.type===B.CHAT_START}hasPreviewPanel(){return this.isChatbotNode()||this.node.type===B.HTTP_START}isStartNode(){return this.node.type===B.START}isDbTableNode(){return this.node.type===V.TABLE}isUiTableNode(){return this.node.type===B.UI_TABLE}isNoteNode(){return pe(this.node.type)}getNoteFontSize(){var e;switch((null===(e=this.node.configuration)||void 0===e?void 0:e.noteFontSize)||"medium"){case"small":return"12px";case"large":return"16px";default:return"14px"}}renderNoteNode(){const e=this.node.configuration||{},t=e.noteBackgroundColor||"#fef08a",a=e.noteTextColor||"#713f12",o=e.noteContent||"Add your note here...",s=e.noteShowBorder||!1,r=e.noteWidth||200,l=e.noteHeight||100,d={"node-container":!0,"note-node":!0,selected:this.selected,dragging:this.dragging,editing:this.editing},h={"--note-bg":t,"--note-text":a,left:`${this.node.position.x}px`,top:`${this.node.position.y}px`},u={backgroundColor:t,color:a,fontSize:this.getNoteFontSize(),border:s?`1px solid ${a}30`:"none",width:`${r}px`,minHeight:`${l}px`};return i`
17097
17462
  <div
17098
17463
  class=${p(d)}
17099
17464
  style=${c(h)}
@@ -17365,13 +17730,13 @@ var Fs=function(e,t,i,n){for(var a,o=arguments.length,s=o<3?t:null===n?n=Object.
17365
17730
  ${null===(a=this.node.ports.configs)||void 0===a?void 0:a.map((e,t)=>this.renderConfigPort(e,t,this.node.ports.configs.length))}
17366
17731
  </div>
17367
17732
  </div>
17368
- `;return this.wrapWithRemoteOverlays(f)}};Bs.useShadowDom=!0,Bs.styles=[Os,As],Fs([o({type:Object})],Bs.prototype,"node",void 0),Fs([o({type:Boolean})],Bs.prototype,"selected",void 0),Fs([o({type:Boolean})],Bs.prototype,"dragging",void 0),Fs([o({type:String})],Bs.prototype,"connectingPortId",void 0),Fs([o({type:Boolean})],Bs.prototype,"editing",void 0),Fs([o({type:Object})],Bs.prototype,"remoteSelection",void 0),Fs([o({type:Object})],Bs.prototype,"remoteTyping",void 0),Fs([s()],Bs.prototype,"hoveredPort",void 0),Bs=Fs([r("workflow-node")],Bs);
17733
+ `;return this.wrapWithRemoteOverlays(f)}};Js.useShadowDom=!0,Js.styles=[js,Ls],Gs([o({type:Object})],Js.prototype,"node",void 0),Gs([o({type:Boolean})],Js.prototype,"selected",void 0),Gs([o({type:Boolean})],Js.prototype,"dragging",void 0),Gs([o({type:String})],Js.prototype,"connectingPortId",void 0),Gs([o({type:Boolean})],Js.prototype,"editing",void 0),Gs([o({type:Object})],Js.prototype,"remoteSelection",void 0),Gs([o({type:Object})],Js.prototype,"remoteTyping",void 0),Gs([s()],Js.prototype,"hoveredPort",void 0),Js=Gs([r("workflow-node")],Js);
17369
17734
  /**
17370
17735
  * @license
17371
17736
  * Copyright 2024 Nuraly, Laabidi Aymen
17372
17737
  * SPDX-License-Identifier: MIT
17373
17738
  */
17374
- const Us=e`
17739
+ const Ys=e`
17375
17740
  /* ========================================
17376
17741
  * CHATBOT PANEL (AI Assistant side panel)
17377
17742
  * ======================================== */
@@ -17539,7 +17904,7 @@ const Us=e`
17539
17904
  width: 100%;
17540
17905
  }
17541
17906
  }
17542
- `,Vs=[e`
17907
+ `,Qs=[e`
17543
17908
  :host {
17544
17909
  display: block;
17545
17910
  width: 100%;
@@ -20551,7 +20916,7 @@ const Us=e`
20551
20916
  white-space: nowrap;
20552
20917
  }
20553
20918
 
20554
- `,Us],Hs=e`
20919
+ `,Ys],Zs=e`
20555
20920
  :host {
20556
20921
  width: fit-content;
20557
20922
  display: block;
@@ -20941,7 +21306,7 @@ const Us=e`
20941
21306
  .wrapper:focus,
20942
21307
  .wrapper:focus-within { outline: 3px solid; }
20943
21308
  }
20944
- `,qs=e`
21309
+ `,Xs=e`
20945
21310
  :host {
20946
21311
  display: flex;
20947
21312
  align-items: center;
@@ -21085,7 +21450,7 @@ const Us=e`
21085
21450
  :host([checked]) input:after,
21086
21451
  :host([indeterminate]) input:after { font-weight: 900; }
21087
21452
  }
21088
- `,Ws=e`
21453
+ `,er=e`
21089
21454
  :host {
21090
21455
  display: block;
21091
21456
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
@@ -21226,7 +21591,7 @@ const Us=e`
21226
21591
  .alert { padding: 0.5rem 0.75rem; }
21227
21592
  .alert--with-description { padding: 0.75rem 1rem; }
21228
21593
  }
21229
- `,Ks=e`
21594
+ `,tr=e`
21230
21595
  :host {
21231
21596
  display: block;
21232
21597
  color: var(--nr-text, #161616);
@@ -21286,7 +21651,7 @@ const Us=e`
21286
21651
  * @license
21287
21652
  * Copyright 2023 Nuraly, Laabidi Aymen
21288
21653
  * SPDX-License-Identifier: MIT
21289
- */,Gs=e`
21654
+ */,ir=e`
21290
21655
  :host {
21291
21656
  display: inline-flex;
21292
21657
  align-items: center;
@@ -21380,7 +21745,7 @@ const Us=e`
21380
21745
  :host([size="large"]) .radio-label { font-size: 16px; }
21381
21746
 
21382
21747
  :host([disabled]) .radio-label { color: #bfbfbf; }
21383
- `;var Js,Ys,Qs,Zs,Xs,er,tr,ir,nr;!function(e){e.Default="default",e.Inline="inline",e.Button="button",e.Slot="slot"}(Js||(Js={})),function(e){e.Default="default",e.Warning="warning",e.Error="error",e.Success="success"}(Ys||(Ys={})),function(e){e.Small="small",e.Medium="medium",e.Large="large"}(Qs||(Qs={})),function(e){e.Small="small",e.Medium="medium",e.Large="large"}(Zs||(Zs={})),function(e){e.Horizontal="horizontal",e.Vertical="vertical"}(Xs||(Xs={})),function(e){e.Default="default",e.Solid="solid",e.Outline="outline",e.Borderless="borderless"}(er||(er={})),function(e){e.Bottom="bottom",e.Top="top",e.Auto="auto"}(tr||(tr={})),function(e){e.None="none",e.StartsWith="starts-with",e.Contains="contains",e.Fuzzy="fuzzy"}(ir||(ir={}));class ar extends Ue{}class or extends ar{constructor(){super(...arguments),this._selectedOptions=[],this._initialized=!1}getSelectedOptions(){return[...this._selectedOptions]}getSelectedOption(){return this._selectedOptions[0]}selectOption(e){try{if(this.isOptionDisabled(e))return;const t=this.host.multiple,i=this.getCurrentValue();t?this.isOptionSelected(e)||(this._selectedOptions=[...this._selectedOptions,e],this.updateHostValue(),this.dispatchChangeEvent(i)):(this.isOptionSelected(e)?this._selectedOptions=[]:this._selectedOptions=[e],this.updateHostValue(),this.dispatchChangeEvent(i)),this.requestUpdate()}catch(e){this.handleError(e,"selectOption")}}unselectOption(e){try{if(this.isOptionSelected(e)){const t=this.getCurrentValue();this._selectedOptions=this._selectedOptions.filter(t=>t.value!==e.value),this.updateHostValue(),this.dispatchChangeEvent(t),this.requestUpdate()}}catch(e){this.handleError(e,"unselectOption")}}clearSelection(){try{if(this._selectedOptions.length>0){const e=this.getCurrentValue();this._selectedOptions=[],this.updateHostValue(),this.dispatchChangeEvent(e),this.requestUpdate()}}catch(e){this.handleError(e,"clearSelection")}}isOptionSelected(e){return this._selectedOptions.some(t=>t.value===e.value)}isOptionDisabled(e){return Boolean(e.disabled)||this.host.disabled}toggleOption(e){this.isOptionSelected(e)?this.unselectOption(e):this.selectOption(e)}initializeFromValue(){try{if(this._initialized)return;const e=this.host.value;if(!e||Array.isArray(e)&&0===e.length)return;const t=Array.isArray(e)?e:[e],i=this.host.options.filter(e=>t.includes(e.value));i.length>0&&(this._selectedOptions=this.host.multiple?i:[i[0]],this.requestUpdate()),this._initialized=!0}catch(e){this.handleError(e,"initializeFromValue")}}updateHostValue(){var e;const t=this.host.multiple?this._selectedOptions.map(e=>e.value):(null===(e=this._selectedOptions[0])||void 0===e?void 0:e.value)||"",i=this.host.value;let n=!1;if(this.host.multiple){const e=Array.isArray(i)?i:[],a=Array.isArray(t)?t:[];n=e.length===a.length&&e.every((e,t)=>e===a[t])}else n=i===t;n||(this.host.value=t)}getCurrentValue(){var e;return this.host.multiple?this._selectedOptions.map(e=>e.value):(null===(e=this._selectedOptions[0])||void 0===e?void 0:e.value)||""}dispatchChangeEvent(e){const t={value:this.getCurrentValue(),selectedOptions:this.getSelectedOptions(),previousValue:e};this.dispatchEvent(new CustomEvent("nr-change",{detail:t,bubbles:!0,composed:!0}))}hostUpdated(){this.syncWithHostOptions()}syncWithHostOptions(){try{this._selectedOptions=this._selectedOptions.filter(e=>this.host.options.some(t=>t.value===e.value)),this._selectedOptions=this._selectedOptions.map(e=>this.host.options.find(t=>t.value===e.value)||e),this.updateHostValue()}catch(e){this.handleError(e,"syncWithHostOptions")}}}class sr extends ar{constructor(e,t,i){super(e),this.selectionController=t,this.dropdownController=i,this._focusedIndex=-1,this._hasKeyboardNavigated=!1}handleKeyDown(e){try{const t=this.isSearchInputFocused();switch(e.key){case"ArrowDown":e.preventDefault(),this.dropdownController.isOpen?this.navigateNext():this.openDropdown();break;case"ArrowUp":e.preventDefault(),this.dropdownController.isOpen?this.navigatePrevious():this.openDropdown();break;case"Enter":this.dropdownController.isOpen?t&&this._focusedIndex>=0?(e.preventDefault(),this.selectFocused()):t||(e.preventDefault(),this.selectFocused()):(e.preventDefault(),this.openDropdown());break;case" ":t||(e.preventDefault(),this.dropdownController.isOpen?this.selectFocused():this.openDropdown());break;case"Escape":e.preventDefault(),this.closeDropdown();break;case"Tab":this.closeDropdown();break;case"Home":this.dropdownController.isOpen&&(e.preventDefault(),this.setFocusedIndex(0));break;case"End":this.dropdownController.isOpen&&(e.preventDefault(),this.setFocusedIndex(this.host.options.length-1));break;default:1===e.key.length&&/[a-zA-Z0-9]/.test(e.key)&&this.handleAlphanumericKey(e.key.toLowerCase())}}catch(e){this.handleError(e,"handleKeyDown")}}navigateNext(){try{const e=this.getNavigableOptions();if(0===e.length)return;if(this.isSearchInputFocused()&&(this._focusedIndex<0||!this._hasKeyboardNavigated))return this._hasKeyboardNavigated=!0,void this.setFocusedIndex(0);let t=this._focusedIndex+1;t>=e.length&&(t=0),this.setFocusedIndex(t)}catch(e){this.handleError(e,"navigateNext")}}navigatePrevious(){try{const e=this.getNavigableOptions();if(0===e.length)return;if(this.isSearchInputFocused()&&(this._focusedIndex<0||!this._hasKeyboardNavigated))return this._hasKeyboardNavigated=!0,void this.setFocusedIndex(e.length-1);let t=this._focusedIndex-1;t<0&&(t=e.length-1),this.setFocusedIndex(t)}catch(e){this.handleError(e,"navigatePrevious")}}selectFocused(){try{const e=this.getNavigableOptions()[this._focusedIndex];e&&!this.selectionController.isOptionDisabled(e)&&(this.selectionController.selectOption(e),this.host.multiple||this.closeDropdown())}catch(e){this.handleError(e,"selectFocused")}}openDropdown(){try{this.dropdownController.open(),this._hasKeyboardNavigated=!1,this._focusedIndex=-1}catch(e){this.handleError(e,"openDropdown")}}closeDropdown(){try{this.dropdownController.close(),this._focusedIndex=-1,this._hasKeyboardNavigated=!1}catch(e){this.handleError(e,"closeDropdown")}}setFocusedIndex(e){try{const t=this.getNavigableOptions();e>=0&&e<t.length&&(this._focusedIndex=e,this.dispatchFocusEvent(t[e],e),this.requestUpdate(),this.scrollToFocusedOption(e))}catch(e){this.handleError(e,"setFocusedIndex")}}scrollToFocusedOption(e){var t;try{const i=this.host,n=null===(t=i.querySelector)||void 0===t?void 0:t.call(i,".options");if(!n)return;setTimeout(()=>{const t=n.querySelector(".option.focused");if(t)t.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"});else{const t=40,i=n.clientHeight,a=n.scrollTop,o=e*t,s=o+t,r=a+i;o<a?n.scrollTo({top:o,behavior:"smooth"}):s>r&&n.scrollTo({top:s-i,behavior:"smooth"})}},10)}catch(e){console.warn("Failed to scroll to focused option:",e)}}get focusedIndex(){return this._focusedIndex}get focusedOption(){return this.getNavigableOptions()[this._focusedIndex]}handleAlphanumericKey(e){try{const t=this.getNavigableOptions(),i=this._focusedIndex+1;for(let n=0;n<t.length;n++){const a=(i+n)%t.length;if(t[a].label.toLowerCase().startsWith(e)){this.setFocusedIndex(a),this.dropdownController.isOpen||this.openDropdown();break}}}catch(e){this.handleError(e,"handleAlphanumericKey")}}getNavigableOptions(){const e=this.host;if(!e.options||!Array.isArray(e.options))return[];let t=e.options;return e.searchable&&e.searchQuery&&"function"==typeof e.getFilteredOptions&&(t=e.getFilteredOptions()),t.filter(e=>!e.disabled)}dispatchFocusEvent(e,t){const i={focusedOption:e,focusedIndex:t};this.dispatchEvent(new CustomEvent("nr-select-focus",{detail:i,bubbles:!0,composed:!0}))}isSearchInputFocused(){var e;try{const t=this.host;if(!t.searchable)return!1;const i=null===(e=t.querySelector)||void 0===e?void 0:e.call(t,".search-input");return!!i&&(document.activeElement===i||i.contains(document.activeElement))}catch(e){return!1}}hostUpdated(){this.dropdownController.isOpen||-1===this._focusedIndex||(this._focusedIndex=-1)}}function rr(e){if(e.parentElement)return e.parentElement;const t=e.getRootNode();return t instanceof ShadowRoot?t.host:null}function lr(e,t,i={}){var n,a;const{offset:o=4,viewportMargin:s=8}=i,r=e.getBoundingClientRect(),l=t.getBoundingClientRect(),c=(null===(n=window.visualViewport)||void 0===n?void 0:n.height)||window.innerHeight,d=(null===(a=window.visualViewport)||void 0===a?void 0:a.width)||window.innerWidth,p=function(e){let t=e;for(;t;){const e=rr(t);if(!e||e===document.body||e===document.documentElement)break;if(e instanceof HTMLElement){const t=getComputedStyle(e),i=t.transform,n=t.willChange,a=t.filter,o=t.perspective,s=t.contain;if(i&&"none"!==i||o&&"none"!==o||a&&"none"!==a||"transform"===n||"perspective"===n||"filter"===n||s&&s.includes("paint"))return e}t=e}return null}(t);let h={top:0,left:0};if(p){const e=p.getBoundingClientRect();h={top:e.top,left:e.left}}const u=c-r.bottom,b=r.top,f=l.height||200,g=function(e,t,i){return i>=e?"bottom":t>=e||t>i?"top":"bottom"}(f,b,u);let v;v="bottom"===g?r.bottom+o:r.top-f-o;let m=r.left;const x=r.width;return m=Math.max(s,Math.min(m,d-x-s)),v=Math.max(s,Math.min(v,c-f-s)),p&&(v-=h.top,m-=h.left),{top:v,left:m,width:r.width,placement:g}}function cr(e,t,i,n={}){var a;const{viewportMargin:o=8,maxHeight:s}=n,r=(null===(a=window.visualViewport)||void 0===a?void 0:a.height)||window.innerHeight,l=t.getBoundingClientRect(),c=e.scrollHeight;let d;d="bottom"===i?r-l.bottom-o-2:l.top-o-2,s?(e.style.maxHeight=s,e.style.overflowY="auto"):c>d?(e.style.maxHeight=`${d}px`,e.style.overflowY="auto"):(e.style.maxHeight=`${c}px`,e.style.overflowY="auto")}class dr extends ar{constructor(){super(...arguments),this._isOpen=!1,this._position={top:0,left:0,width:0,placement:"bottom"},this._dropdownElement=null,this._triggerElement=null,this.handleResize=()=>{this._isOpen&&this.calculatePosition()},this.handleScroll=()=>{this._isOpen&&this._triggerElement&&(!function(e){var t;const i=e.getBoundingClientRect(),n=(null===(t=window.visualViewport)||void 0===t?void 0:t.height)||window.innerHeight;return i.bottom>=0&&i.top<=n}(this._triggerElement)?this.close():this.calculatePosition())}}get isOpen(){return this._isOpen}get position(){return Object.assign({},this._position)}open(){try{this._isOpen||(this._isOpen=!0,this.host.show=!0,this.requestUpdate(),this.findElements(),setTimeout(()=>{this.calculatePosition()},10),this.host&&"function"==typeof this.host.setupEventListeners&&setTimeout(()=>{this.host.setupEventListeners()},50),this.focusSearchInput(),this.dispatchEvent(new CustomEvent("nr-dropdown-open",{bubbles:!0,composed:!0})))}catch(e){this.handleError(e,"open")}}close(){try{this._isOpen&&(this._isOpen=!1,this.host.show=!1,this.resetPosition(),this.requestUpdate(),this.host&&"function"==typeof this.host.removeEventListeners&&this.host.removeEventListeners(),this.dispatchEvent(new CustomEvent("nr-dropdown-close",{bubbles:!0,composed:!0})))}catch(e){this.handleError(e,"close")}}toggle(){this._isOpen?this.close():this.open()}focusSearchInput(){try{const e=this.host;e&&e.searchable&&setTimeout(()=>{var t;const i=null===(t=e.querySelector)||void 0===t?void 0:t.call(e,".search-input");i&&"function"==typeof i.focus&&i.focus()},100)}catch(e){console.warn("Failed to focus search input:",e)}}calculatePosition(){try{if(this._dropdownElement&&this._triggerElement||this.findElements(),!this._dropdownElement||!this._triggerElement)return;const e=lr(this._triggerElement,this._dropdownElement,{offset:4,viewportMargin:8});this._position=e,this.applyPosition()}catch(e){this.handleError(e,"calculatePosition")}}resetPosition(){try{if(this._dropdownElement){e=this._dropdownElement,["position","top","left","right","bottom","width","min-width","max-height","min-height","height","overflow-y","transform","display","opacity","visibility","z-index"].forEach(t=>e.style.removeProperty(t)),e.classList.remove("placement-top","placement-bottom");this.host.maxHeight||this._dropdownElement.style.removeProperty("max-height")}}catch(e){this.handleError(e,"resetPosition")}var e}setElements(e,t){this._dropdownElement=e,this._triggerElement=t}findElements(){try{const e=this._host;if(e.optionsElement&&e.wrapper)return this._dropdownElement=e.optionsElement,void(this._triggerElement=e.wrapper);e.querySelector&&(this._dropdownElement=e.querySelector(".options"),this._triggerElement=e.querySelector(".wrapper"))}catch(e){this.handleError(e,"findElements")}}applyPosition(){var e;try{if(!this._dropdownElement||!this._triggerElement)return;const t=this.host.maxHeight,i=null===(e=getComputedStyle(this._dropdownElement).getPropertyValue("--nuraly-select-local-dropdown-max-height"))||void 0===e?void 0:e.trim(),n="auto"===i||!t&&"auto"===i;!function(e,t,i="9999"){e.style.position="fixed",e.style.top=`${t.top}px`,e.style.left=`${t.left}px`,e.style.removeProperty("right"),e.style.removeProperty("bottom"),e.style.minWidth=`${t.width}px`,e.style.removeProperty("width"),e.style.zIndex=i,e.style.height="auto",e.style.minHeight="auto",e.classList.remove("placement-top","placement-bottom"),e.classList.add(`placement-${t.placement}`)}(this._dropdownElement,this._position,"9999"),t||n||(this._dropdownElement.style.maxHeight="none"),t?cr(this._dropdownElement,this._triggerElement,this._position.placement,{viewportMargin:10,maxHeight:t}):n?(this._dropdownElement.style.removeProperty("max-height"),this._dropdownElement.style.overflowY="visible"):cr(this._dropdownElement,this._triggerElement,this._position.placement,{viewportMargin:10})}catch(e){this.handleError(e,"applyPosition")}}getAvailableSpace(){var e,t;if(!this._triggerElement)return{above:0,below:0,left:0,right:0};const i=this._triggerElement.getBoundingClientRect(),n=(null===(e=window.visualViewport)||void 0===e?void 0:e.height)||window.innerHeight,a=(null===(t=window.visualViewport)||void 0===t?void 0:t.width)||window.innerWidth;return{above:i.top,below:n-i.bottom,left:i.left,right:a-i.right}}hostConnected(){window.addEventListener("resize",this.handleResize),window.addEventListener("scroll",this.handleScroll,!0)}hostDisconnected(){window.removeEventListener("resize",this.handleResize),window.removeEventListener("scroll",this.handleScroll,!0)}}class pr extends ar{constructor(){super(...arguments),this._focusedIndex=-1,this._hasFocus=!1}get focusedIndex(){return this._focusedIndex}getFocusedOption(){if(this._focusedIndex>=0&&this._focusedIndex<this.host.options.length)return this.host.options[this._focusedIndex]}get hasFocus(){return this._hasFocus}setFocusedOption(e){try{e>=0&&e<this.host.options.length&&(this._focusedIndex=e,this.requestUpdate(),this.dispatchEvent(new CustomEvent("nr-focus-change",{detail:{focusedIndex:e,focusedOption:this.getFocusedOption()},bubbles:!0,composed:!0})))}catch(e){this.handleError(e,"setFocusedOption")}}focus(){var e;try{const t=this._host,i=null===(e=t.querySelector)||void 0===e?void 0:e.call(t,".wrapper");i&&(i.focus(),this._hasFocus=!0,this.requestUpdate(),this.dispatchEvent(new CustomEvent("nr-focus",{bubbles:!0,composed:!0})))}catch(e){this.handleError(e,"focus")}}blur(){var e;try{const t=this._host,i=null===(e=t.querySelector)||void 0===e?void 0:e.call(t,".wrapper");i&&i.blur(),this._hasFocus=!1,this._focusedIndex=-1,this.requestUpdate(),this.dispatchEvent(new CustomEvent("nr-blur",{bubbles:!0,composed:!0}))}catch(e){this.handleError(e,"blur")}}focusNext(){try{const e=this.getNextFocusableIndex(this._focusedIndex);-1!==e&&this.setFocusedOption(e)}catch(e){this.handleError(e,"focusNext")}}focusPrevious(){try{const e=this.getPreviousFocusableIndex(this._focusedIndex);-1!==e&&this.setFocusedOption(e)}catch(e){this.handleError(e,"focusPrevious")}}focusFirst(){try{const e=this.getNextFocusableIndex(-1);-1!==e&&this.setFocusedOption(e)}catch(e){this.handleError(e,"focusFirst")}}focusLast(){try{const e=this.getPreviousFocusableIndex(this.host.options.length);-1!==e&&this.setFocusedOption(e)}catch(e){this.handleError(e,"focusLast")}}clearFocus(){this._focusedIndex=-1,this._hasFocus=!1,this.requestUpdate()}handleFocus(){this._hasFocus=!0,this.requestUpdate()}handleBlur(){this._hasFocus=!1,this._focusedIndex=-1,this.requestUpdate()}getNextFocusableIndex(e){const t=this.host.options;for(let i=e+1;i<t.length;i++)if(!t[i].disabled)return i;for(let i=0;i<=e;i++)if(!t[i].disabled)return i;return-1}getPreviousFocusableIndex(e){const t=this.host.options;for(let i=e-1;i>=0;i--)if(!t[i].disabled)return i;for(let i=t.length-1;i>=e;i--)if(!t[i].disabled)return i;return-1}findOptionIndex(e){return this.host.options.findIndex(t=>t.value===e)}focusOptionByValue(e){const t=this.findOptionIndex(e);-1!==t&&this.setFocusedOption(t)}}!function(e){e.Valid="valid",e.Invalid="invalid",e.Pending="pending",e.Pristine="pristine"}(nr||(nr={}));class hr extends Ve{constructor(e,t){super(e),this.selectionController=t}get validationState(){return this._validationState}validate(){try{this._validationState=nr.Pending;const e=this.selectionController.getSelectedOptions().length>0;return this.host.required&&!e?(this.setValidationResult(!1,"This field is required",nr.Invalid),!1):(this.setValidationResult(!0,"",nr.Valid),!0)}catch(e){return this.handleError(e,"validate"),this.setValidationResult(!1,"Validation error occurred",nr.Invalid),!1}}reset(){try{this._isValid=!0,this._validationMessage="",this._validationState=nr.Pristine,this.requestUpdate(),this.dispatchValidationEvent()}catch(e){this.handleError(e,"reset")}}getFormData(){var e;try{const t=this._host,i=t.name||t.getAttribute("name")||"select",n=this.selectionController.getSelectedOptions();return this.host.multiple?{[i]:n.map(e=>e.value)}:{[i]:(null===(e=n[0])||void 0===e?void 0:e.value)||""}}catch(e){return this.handleError(e,"getFormData"),{}}}reportValidity(){var e;const t=this.validate();if(!t){const t=this._host,i=null===(e=t.querySelector)||void 0===e?void 0:e.call(t,".wrapper");i&&i.focus()}return t}setCustomValidity(e){try{e?this.setValidationResult(!1,e,nr.Invalid):this.validate()}catch(e){this.handleError(e,"setCustomValidity")}}validateOnChange(){this._validationState!==nr.Pristine&&this.validate()}validateOnBlur(){this._validationState===nr.Pristine&&(this._validationState=nr.Pending),this.validate()}setValidationResult(e,t,i){const n=this._isValid!==e||this._validationMessage!==t||this._validationState!==i;this._isValid=e,this._validationMessage=t,this._validationState=i,n&&(this.requestUpdate(),this.dispatchValidationEvent())}dispatchValidationEvent(){const e={isValid:this._isValid,validationMessage:this._validationMessage,validationState:this._validationState};this.dispatchEvent(new CustomEvent("nr-validation",{detail:e,bubbles:!0,composed:!0}))}hostUpdated(){this.validateOnChange()}getValidationClasses(){return{valid:this._isValid&&this._validationState===nr.Valid,invalid:!this._isValid&&this._validationState===nr.Invalid,pending:this._validationState===nr.Pending,pristine:this._validationState===nr.Pristine}}getAriaAttributes(){const e={};return this.host.required&&(e["aria-required"]="true"),this._isValid||(e["aria-invalid"]="true",this._validationMessage&&(e["aria-describedby"]="validation-message")),e}}class ur extends ar{constructor(){super(...arguments),this._searchQuery="",this.handleSearchInput=e=>{this.setSearchQuery(e.detail.value||"")},this.handleSearchClear=()=>{this.clearSearch()},this.handleSearchKeyDown=e=>{if(["ArrowDown","ArrowUp","Enter","Home","End"].includes(e.key)){const t=this.host.keyboardController;return void(t&&t.handleKeyDown(e))}e.stopPropagation(),"Escape"===e.key&&(this.host.closeDropdown(),this.host.focus())}}get searchQuery(){return this._searchQuery}get hasSearch(){return""!==this._searchQuery.trim()}setSearchQuery(e){this._searchQuery=e,this.host.searchQuery=e,this.host.requestUpdate()}search(e){this.setSearchQuery(e)}clearSearch(){this.setSearchQuery("")}getFilteredOptions(e){if(!this.host.searchable||!this._searchQuery.trim())return e;const t=this._searchQuery.toLowerCase().trim();return e.filter(e=>e.label.toLowerCase().includes(t)||e.value.toLowerCase().includes(t)||e.description&&e.description.toLowerCase().includes(t))}renderSearchInput(){return this.host.searchable?i`
21748
+ `;var nr,ar,or,sr,rr,lr,cr,dr,pr;!function(e){e.Default="default",e.Inline="inline",e.Button="button",e.Slot="slot"}(nr||(nr={})),function(e){e.Default="default",e.Warning="warning",e.Error="error",e.Success="success"}(ar||(ar={})),function(e){e.Small="small",e.Medium="medium",e.Large="large"}(or||(or={})),function(e){e.Small="small",e.Medium="medium",e.Large="large"}(sr||(sr={})),function(e){e.Horizontal="horizontal",e.Vertical="vertical"}(rr||(rr={})),function(e){e.Default="default",e.Solid="solid",e.Outline="outline",e.Borderless="borderless"}(lr||(lr={})),function(e){e.Bottom="bottom",e.Top="top",e.Auto="auto"}(cr||(cr={})),function(e){e.None="none",e.StartsWith="starts-with",e.Contains="contains",e.Fuzzy="fuzzy"}(dr||(dr={}));class hr extends Ue{}class ur extends hr{constructor(){super(...arguments),this._selectedOptions=[],this._initialized=!1}getSelectedOptions(){return[...this._selectedOptions]}getSelectedOption(){return this._selectedOptions[0]}selectOption(e){try{if(this.isOptionDisabled(e))return;const t=this.host.multiple,i=this.getCurrentValue();t?this.isOptionSelected(e)||(this._selectedOptions=[...this._selectedOptions,e],this.updateHostValue(),this.dispatchChangeEvent(i)):(this.isOptionSelected(e)?this._selectedOptions=[]:this._selectedOptions=[e],this.updateHostValue(),this.dispatchChangeEvent(i)),this.requestUpdate()}catch(e){this.handleError(e,"selectOption")}}unselectOption(e){try{if(this.isOptionSelected(e)){const t=this.getCurrentValue();this._selectedOptions=this._selectedOptions.filter(t=>t.value!==e.value),this.updateHostValue(),this.dispatchChangeEvent(t),this.requestUpdate()}}catch(e){this.handleError(e,"unselectOption")}}clearSelection(){try{if(this._selectedOptions.length>0){const e=this.getCurrentValue();this._selectedOptions=[],this.updateHostValue(),this.dispatchChangeEvent(e),this.requestUpdate()}}catch(e){this.handleError(e,"clearSelection")}}isOptionSelected(e){return this._selectedOptions.some(t=>t.value===e.value)}isOptionDisabled(e){return Boolean(e.disabled)||this.host.disabled}toggleOption(e){this.isOptionSelected(e)?this.unselectOption(e):this.selectOption(e)}initializeFromValue(){try{if(this._initialized)return;const e=this.host.value;if(!e||Array.isArray(e)&&0===e.length)return;const t=Array.isArray(e)?e:[e],i=this.host.options.filter(e=>t.includes(e.value));i.length>0&&(this._selectedOptions=this.host.multiple?i:[i[0]],this.requestUpdate()),this._initialized=!0}catch(e){this.handleError(e,"initializeFromValue")}}updateHostValue(){var e;const t=this.host.multiple?this._selectedOptions.map(e=>e.value):(null===(e=this._selectedOptions[0])||void 0===e?void 0:e.value)||"",i=this.host.value;let n=!1;if(this.host.multiple){const e=Array.isArray(i)?i:[],a=Array.isArray(t)?t:[];n=e.length===a.length&&e.every((e,t)=>e===a[t])}else n=i===t;n||(this.host.value=t)}getCurrentValue(){var e;return this.host.multiple?this._selectedOptions.map(e=>e.value):(null===(e=this._selectedOptions[0])||void 0===e?void 0:e.value)||""}dispatchChangeEvent(e){const t={value:this.getCurrentValue(),selectedOptions:this.getSelectedOptions(),previousValue:e};this.dispatchEvent(new CustomEvent("nr-change",{detail:t,bubbles:!0,composed:!0}))}hostUpdated(){this.syncWithHostOptions()}syncWithHostOptions(){try{this._selectedOptions=this._selectedOptions.filter(e=>this.host.options.some(t=>t.value===e.value)),this._selectedOptions=this._selectedOptions.map(e=>this.host.options.find(t=>t.value===e.value)||e),this.updateHostValue()}catch(e){this.handleError(e,"syncWithHostOptions")}}}class br extends hr{constructor(e,t,i){super(e),this.selectionController=t,this.dropdownController=i,this._focusedIndex=-1,this._hasKeyboardNavigated=!1}handleKeyDown(e){try{const t=this.isSearchInputFocused();switch(e.key){case"ArrowDown":e.preventDefault(),this.dropdownController.isOpen?this.navigateNext():this.openDropdown();break;case"ArrowUp":e.preventDefault(),this.dropdownController.isOpen?this.navigatePrevious():this.openDropdown();break;case"Enter":this.dropdownController.isOpen?t&&this._focusedIndex>=0?(e.preventDefault(),this.selectFocused()):t||(e.preventDefault(),this.selectFocused()):(e.preventDefault(),this.openDropdown());break;case" ":t||(e.preventDefault(),this.dropdownController.isOpen?this.selectFocused():this.openDropdown());break;case"Escape":e.preventDefault(),this.closeDropdown();break;case"Tab":this.closeDropdown();break;case"Home":this.dropdownController.isOpen&&(e.preventDefault(),this.setFocusedIndex(0));break;case"End":this.dropdownController.isOpen&&(e.preventDefault(),this.setFocusedIndex(this.host.options.length-1));break;default:1===e.key.length&&/[a-zA-Z0-9]/.test(e.key)&&this.handleAlphanumericKey(e.key.toLowerCase())}}catch(e){this.handleError(e,"handleKeyDown")}}navigateNext(){try{const e=this.getNavigableOptions();if(0===e.length)return;if(this.isSearchInputFocused()&&(this._focusedIndex<0||!this._hasKeyboardNavigated))return this._hasKeyboardNavigated=!0,void this.setFocusedIndex(0);let t=this._focusedIndex+1;t>=e.length&&(t=0),this.setFocusedIndex(t)}catch(e){this.handleError(e,"navigateNext")}}navigatePrevious(){try{const e=this.getNavigableOptions();if(0===e.length)return;if(this.isSearchInputFocused()&&(this._focusedIndex<0||!this._hasKeyboardNavigated))return this._hasKeyboardNavigated=!0,void this.setFocusedIndex(e.length-1);let t=this._focusedIndex-1;t<0&&(t=e.length-1),this.setFocusedIndex(t)}catch(e){this.handleError(e,"navigatePrevious")}}selectFocused(){try{const e=this.getNavigableOptions()[this._focusedIndex];e&&!this.selectionController.isOptionDisabled(e)&&(this.selectionController.selectOption(e),this.host.multiple||this.closeDropdown())}catch(e){this.handleError(e,"selectFocused")}}openDropdown(){try{this.dropdownController.open(),this._hasKeyboardNavigated=!1,this._focusedIndex=-1}catch(e){this.handleError(e,"openDropdown")}}closeDropdown(){try{this.dropdownController.close(),this._focusedIndex=-1,this._hasKeyboardNavigated=!1}catch(e){this.handleError(e,"closeDropdown")}}setFocusedIndex(e){try{const t=this.getNavigableOptions();e>=0&&e<t.length&&(this._focusedIndex=e,this.dispatchFocusEvent(t[e],e),this.requestUpdate(),this.scrollToFocusedOption(e))}catch(e){this.handleError(e,"setFocusedIndex")}}scrollToFocusedOption(e){var t;try{const i=this.host,n=null===(t=i.querySelector)||void 0===t?void 0:t.call(i,".options");if(!n)return;setTimeout(()=>{const t=n.querySelector(".option.focused");if(t)t.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"});else{const t=40,i=n.clientHeight,a=n.scrollTop,o=e*t,s=o+t,r=a+i;o<a?n.scrollTo({top:o,behavior:"smooth"}):s>r&&n.scrollTo({top:s-i,behavior:"smooth"})}},10)}catch(e){console.warn("Failed to scroll to focused option:",e)}}get focusedIndex(){return this._focusedIndex}get focusedOption(){return this.getNavigableOptions()[this._focusedIndex]}handleAlphanumericKey(e){try{const t=this.getNavigableOptions(),i=this._focusedIndex+1;for(let n=0;n<t.length;n++){const a=(i+n)%t.length;if(t[a].label.toLowerCase().startsWith(e)){this.setFocusedIndex(a),this.dropdownController.isOpen||this.openDropdown();break}}}catch(e){this.handleError(e,"handleAlphanumericKey")}}getNavigableOptions(){const e=this.host;if(!e.options||!Array.isArray(e.options))return[];let t=e.options;return e.searchable&&e.searchQuery&&"function"==typeof e.getFilteredOptions&&(t=e.getFilteredOptions()),t.filter(e=>!e.disabled)}dispatchFocusEvent(e,t){const i={focusedOption:e,focusedIndex:t};this.dispatchEvent(new CustomEvent("nr-select-focus",{detail:i,bubbles:!0,composed:!0}))}isSearchInputFocused(){var e;try{const t=this.host;if(!t.searchable)return!1;const i=null===(e=t.querySelector)||void 0===e?void 0:e.call(t,".search-input");return!!i&&(document.activeElement===i||i.contains(document.activeElement))}catch(e){return!1}}hostUpdated(){this.dropdownController.isOpen||-1===this._focusedIndex||(this._focusedIndex=-1)}}function fr(e){if(e.parentElement)return e.parentElement;const t=e.getRootNode();return t instanceof ShadowRoot?t.host:null}function gr(e,t,i={}){var n,a;const{offset:o=4,viewportMargin:s=8}=i,r=e.getBoundingClientRect(),l=t.getBoundingClientRect(),c=(null===(n=window.visualViewport)||void 0===n?void 0:n.height)||window.innerHeight,d=(null===(a=window.visualViewport)||void 0===a?void 0:a.width)||window.innerWidth,p=function(e){let t=e;for(;t;){const e=fr(t);if(!e||e===document.body||e===document.documentElement)break;if(e instanceof HTMLElement){const t=getComputedStyle(e),i=t.transform,n=t.willChange,a=t.filter,o=t.perspective,s=t.contain;if(i&&"none"!==i||o&&"none"!==o||a&&"none"!==a||"transform"===n||"perspective"===n||"filter"===n||s&&s.includes("paint"))return e}t=e}return null}(t);let h={top:0,left:0};if(p){const e=p.getBoundingClientRect();h={top:e.top,left:e.left}}const u=c-r.bottom,b=r.top,f=l.height||200,g=function(e,t,i){return i>=e?"bottom":t>=e||t>i?"top":"bottom"}(f,b,u);let v;v="bottom"===g?r.bottom+o:r.top-f-o;let m=r.left;const x=r.width;return m=Math.max(s,Math.min(m,d-x-s)),v=Math.max(s,Math.min(v,c-f-s)),p&&(v-=h.top,m-=h.left),{top:v,left:m,width:r.width,placement:g}}function vr(e,t,i,n={}){var a;const{viewportMargin:o=8,maxHeight:s}=n,r=(null===(a=window.visualViewport)||void 0===a?void 0:a.height)||window.innerHeight,l=t.getBoundingClientRect(),c=e.scrollHeight;let d;d="bottom"===i?r-l.bottom-o-2:l.top-o-2,s?(e.style.maxHeight=s,e.style.overflowY="auto"):c>d?(e.style.maxHeight=`${d}px`,e.style.overflowY="auto"):(e.style.maxHeight=`${c}px`,e.style.overflowY="auto")}class mr extends hr{constructor(){super(...arguments),this._isOpen=!1,this._position={top:0,left:0,width:0,placement:"bottom"},this._dropdownElement=null,this._triggerElement=null,this.handleResize=()=>{this._isOpen&&this.calculatePosition()},this.handleScroll=()=>{this._isOpen&&this._triggerElement&&(!function(e){var t;const i=e.getBoundingClientRect(),n=(null===(t=window.visualViewport)||void 0===t?void 0:t.height)||window.innerHeight;return i.bottom>=0&&i.top<=n}(this._triggerElement)?this.close():this.calculatePosition())}}get isOpen(){return this._isOpen}get position(){return Object.assign({},this._position)}open(){try{this._isOpen||(this._isOpen=!0,this.host.show=!0,this.requestUpdate(),this.findElements(),setTimeout(()=>{this.calculatePosition()},10),this.host&&"function"==typeof this.host.setupEventListeners&&setTimeout(()=>{this.host.setupEventListeners()},50),this.focusSearchInput(),this.dispatchEvent(new CustomEvent("nr-dropdown-open",{bubbles:!0,composed:!0})))}catch(e){this.handleError(e,"open")}}close(){try{this._isOpen&&(this._isOpen=!1,this.host.show=!1,this.resetPosition(),this.requestUpdate(),this.host&&"function"==typeof this.host.removeEventListeners&&this.host.removeEventListeners(),this.dispatchEvent(new CustomEvent("nr-dropdown-close",{bubbles:!0,composed:!0})))}catch(e){this.handleError(e,"close")}}toggle(){this._isOpen?this.close():this.open()}focusSearchInput(){try{const e=this.host;e&&e.searchable&&setTimeout(()=>{var t;const i=null===(t=e.querySelector)||void 0===t?void 0:t.call(e,".search-input");i&&"function"==typeof i.focus&&i.focus()},100)}catch(e){console.warn("Failed to focus search input:",e)}}calculatePosition(){try{if(this._dropdownElement&&this._triggerElement||this.findElements(),!this._dropdownElement||!this._triggerElement)return;const e=gr(this._triggerElement,this._dropdownElement,{offset:4,viewportMargin:8});this._position=e,this.applyPosition()}catch(e){this.handleError(e,"calculatePosition")}}resetPosition(){try{if(this._dropdownElement){e=this._dropdownElement,["position","top","left","right","bottom","width","min-width","max-height","min-height","height","overflow-y","transform","display","opacity","visibility","z-index"].forEach(t=>e.style.removeProperty(t)),e.classList.remove("placement-top","placement-bottom");this.host.maxHeight||this._dropdownElement.style.removeProperty("max-height")}}catch(e){this.handleError(e,"resetPosition")}var e}setElements(e,t){this._dropdownElement=e,this._triggerElement=t}findElements(){try{const e=this._host;if(e.optionsElement&&e.wrapper)return this._dropdownElement=e.optionsElement,void(this._triggerElement=e.wrapper);e.querySelector&&(this._dropdownElement=e.querySelector(".options"),this._triggerElement=e.querySelector(".wrapper"))}catch(e){this.handleError(e,"findElements")}}applyPosition(){var e;try{if(!this._dropdownElement||!this._triggerElement)return;const t=this.host.maxHeight,i=null===(e=getComputedStyle(this._dropdownElement).getPropertyValue("--nuraly-select-local-dropdown-max-height"))||void 0===e?void 0:e.trim(),n="auto"===i||!t&&"auto"===i;!function(e,t,i="9999"){e.style.position="fixed",e.style.top=`${t.top}px`,e.style.left=`${t.left}px`,e.style.removeProperty("right"),e.style.removeProperty("bottom"),e.style.minWidth=`${t.width}px`,e.style.removeProperty("width"),e.style.zIndex=i,e.style.height="auto",e.style.minHeight="auto",e.classList.remove("placement-top","placement-bottom"),e.classList.add(`placement-${t.placement}`)}(this._dropdownElement,this._position,"9999"),t||n||(this._dropdownElement.style.maxHeight="none"),t?vr(this._dropdownElement,this._triggerElement,this._position.placement,{viewportMargin:10,maxHeight:t}):n?(this._dropdownElement.style.removeProperty("max-height"),this._dropdownElement.style.overflowY="visible"):vr(this._dropdownElement,this._triggerElement,this._position.placement,{viewportMargin:10})}catch(e){this.handleError(e,"applyPosition")}}getAvailableSpace(){var e,t;if(!this._triggerElement)return{above:0,below:0,left:0,right:0};const i=this._triggerElement.getBoundingClientRect(),n=(null===(e=window.visualViewport)||void 0===e?void 0:e.height)||window.innerHeight,a=(null===(t=window.visualViewport)||void 0===t?void 0:t.width)||window.innerWidth;return{above:i.top,below:n-i.bottom,left:i.left,right:a-i.right}}hostConnected(){window.addEventListener("resize",this.handleResize),window.addEventListener("scroll",this.handleScroll,!0)}hostDisconnected(){window.removeEventListener("resize",this.handleResize),window.removeEventListener("scroll",this.handleScroll,!0)}}class xr extends hr{constructor(){super(...arguments),this._focusedIndex=-1,this._hasFocus=!1}get focusedIndex(){return this._focusedIndex}getFocusedOption(){if(this._focusedIndex>=0&&this._focusedIndex<this.host.options.length)return this.host.options[this._focusedIndex]}get hasFocus(){return this._hasFocus}setFocusedOption(e){try{e>=0&&e<this.host.options.length&&(this._focusedIndex=e,this.requestUpdate(),this.dispatchEvent(new CustomEvent("nr-focus-change",{detail:{focusedIndex:e,focusedOption:this.getFocusedOption()},bubbles:!0,composed:!0})))}catch(e){this.handleError(e,"setFocusedOption")}}focus(){var e;try{const t=this._host,i=null===(e=t.querySelector)||void 0===e?void 0:e.call(t,".wrapper");i&&(i.focus(),this._hasFocus=!0,this.requestUpdate(),this.dispatchEvent(new CustomEvent("nr-focus",{bubbles:!0,composed:!0})))}catch(e){this.handleError(e,"focus")}}blur(){var e;try{const t=this._host,i=null===(e=t.querySelector)||void 0===e?void 0:e.call(t,".wrapper");i&&i.blur(),this._hasFocus=!1,this._focusedIndex=-1,this.requestUpdate(),this.dispatchEvent(new CustomEvent("nr-blur",{bubbles:!0,composed:!0}))}catch(e){this.handleError(e,"blur")}}focusNext(){try{const e=this.getNextFocusableIndex(this._focusedIndex);-1!==e&&this.setFocusedOption(e)}catch(e){this.handleError(e,"focusNext")}}focusPrevious(){try{const e=this.getPreviousFocusableIndex(this._focusedIndex);-1!==e&&this.setFocusedOption(e)}catch(e){this.handleError(e,"focusPrevious")}}focusFirst(){try{const e=this.getNextFocusableIndex(-1);-1!==e&&this.setFocusedOption(e)}catch(e){this.handleError(e,"focusFirst")}}focusLast(){try{const e=this.getPreviousFocusableIndex(this.host.options.length);-1!==e&&this.setFocusedOption(e)}catch(e){this.handleError(e,"focusLast")}}clearFocus(){this._focusedIndex=-1,this._hasFocus=!1,this.requestUpdate()}handleFocus(){this._hasFocus=!0,this.requestUpdate()}handleBlur(){this._hasFocus=!1,this._focusedIndex=-1,this.requestUpdate()}getNextFocusableIndex(e){const t=this.host.options;for(let i=e+1;i<t.length;i++)if(!t[i].disabled)return i;for(let i=0;i<=e;i++)if(!t[i].disabled)return i;return-1}getPreviousFocusableIndex(e){const t=this.host.options;for(let i=e-1;i>=0;i--)if(!t[i].disabled)return i;for(let i=t.length-1;i>=e;i--)if(!t[i].disabled)return i;return-1}findOptionIndex(e){return this.host.options.findIndex(t=>t.value===e)}focusOptionByValue(e){const t=this.findOptionIndex(e);-1!==t&&this.setFocusedOption(t)}}!function(e){e.Valid="valid",e.Invalid="invalid",e.Pending="pending",e.Pristine="pristine"}(pr||(pr={}));class yr extends Ve{constructor(e,t){super(e),this.selectionController=t}get validationState(){return this._validationState}validate(){try{this._validationState=pr.Pending;const e=this.selectionController.getSelectedOptions().length>0;return this.host.required&&!e?(this.setValidationResult(!1,"This field is required",pr.Invalid),!1):(this.setValidationResult(!0,"",pr.Valid),!0)}catch(e){return this.handleError(e,"validate"),this.setValidationResult(!1,"Validation error occurred",pr.Invalid),!1}}reset(){try{this._isValid=!0,this._validationMessage="",this._validationState=pr.Pristine,this.requestUpdate(),this.dispatchValidationEvent()}catch(e){this.handleError(e,"reset")}}getFormData(){var e;try{const t=this._host,i=t.name||t.getAttribute("name")||"select",n=this.selectionController.getSelectedOptions();return this.host.multiple?{[i]:n.map(e=>e.value)}:{[i]:(null===(e=n[0])||void 0===e?void 0:e.value)||""}}catch(e){return this.handleError(e,"getFormData"),{}}}reportValidity(){var e;const t=this.validate();if(!t){const t=this._host,i=null===(e=t.querySelector)||void 0===e?void 0:e.call(t,".wrapper");i&&i.focus()}return t}setCustomValidity(e){try{e?this.setValidationResult(!1,e,pr.Invalid):this.validate()}catch(e){this.handleError(e,"setCustomValidity")}}validateOnChange(){this._validationState!==pr.Pristine&&this.validate()}validateOnBlur(){this._validationState===pr.Pristine&&(this._validationState=pr.Pending),this.validate()}setValidationResult(e,t,i){const n=this._isValid!==e||this._validationMessage!==t||this._validationState!==i;this._isValid=e,this._validationMessage=t,this._validationState=i,n&&(this.requestUpdate(),this.dispatchValidationEvent())}dispatchValidationEvent(){const e={isValid:this._isValid,validationMessage:this._validationMessage,validationState:this._validationState};this.dispatchEvent(new CustomEvent("nr-validation",{detail:e,bubbles:!0,composed:!0}))}hostUpdated(){this.validateOnChange()}getValidationClasses(){return{valid:this._isValid&&this._validationState===pr.Valid,invalid:!this._isValid&&this._validationState===pr.Invalid,pending:this._validationState===pr.Pending,pristine:this._validationState===pr.Pristine}}getAriaAttributes(){const e={};return this.host.required&&(e["aria-required"]="true"),this._isValid||(e["aria-invalid"]="true",this._validationMessage&&(e["aria-describedby"]="validation-message")),e}}class wr extends hr{constructor(){super(...arguments),this._searchQuery="",this.handleSearchInput=e=>{this.setSearchQuery(e.detail.value||"")},this.handleSearchClear=()=>{this.clearSearch()},this.handleSearchKeyDown=e=>{if(["ArrowDown","ArrowUp","Enter","Home","End"].includes(e.key)){const t=this.host.keyboardController;return void(t&&t.handleKeyDown(e))}e.stopPropagation(),"Escape"===e.key&&(this.host.closeDropdown(),this.host.focus())}}get searchQuery(){return this._searchQuery}get hasSearch(){return""!==this._searchQuery.trim()}setSearchQuery(e){this._searchQuery=e,this.host.searchQuery=e,this.host.requestUpdate()}search(e){this.setSearchQuery(e)}clearSearch(){this.setSearchQuery("")}getFilteredOptions(e){if(!this.host.searchable||!this._searchQuery.trim())return e;const t=this._searchQuery.toLowerCase().trim();return e.filter(e=>e.label.toLowerCase().includes(t)||e.value.toLowerCase().includes(t)||e.description&&e.description.toLowerCase().includes(t))}renderSearchInput(){return this.host.searchable?i`
21384
21749
  <div class="search-container">
21385
21750
  <nr-input
21386
21751
  type="text"
@@ -21412,12 +21777,12 @@ const Us=e`
21412
21777
  <span class="no-options-text">No results found for "${this._searchQuery}"</span>
21413
21778
  </div>
21414
21779
  </div>
21415
- `}hasNoResults(e){return this.host.searchable&&""!==this._searchQuery.trim()&&0===this.getFilteredOptions(e).length}getCurrentQuery(){return this.host.searchQuery||this._searchQuery}hostUpdated(){super.hostUpdated(),this.host.searchQuery!==this._searchQuery&&(this._searchQuery=this.host.searchQuery)}hostConnected(){super.hostConnected(),this._searchQuery=""}}class br extends ar{constructor(){super(...arguments),this.handleTriggerClick=e=>{this.host.disabled||(e.preventDefault(),e.stopPropagation(),this.host.toggleDropdown())},this.handleOptionClick=(e,t)=>{e.stopPropagation(),t.disabled||(this.host.multiple?this.host.toggleOption(t):(this.host.selectOption(t),this.host.closeDropdown()))},this.handleTagRemove=(e,t)=>{e.stopPropagation(),this.host.unselectOption(t)},this.handleClearAll=e=>{e.stopPropagation(),this.host.clearSelection()},this.handleKeyDown=e=>{const t=this.host.keyboardController;t&&t.handleKeyDown(e)},this.handleFocus=()=>{const e=this.host.focusController;e&&e.handleFocus()},this.handleBlur=()=>{const e=this.host.focusController;e&&e.handleBlur()},this.handleWindowClick=e=>{e.composedPath().includes(this.host)||this.host.closeDropdown()}}setupEventListeners(){window.addEventListener("click",this.handleWindowClick)}removeEventListeners(){window.removeEventListener("click",this.handleWindowClick)}hostDisconnected(){super.hostDisconnected(),this.removeEventListeners()}}
21780
+ `}hasNoResults(e){return this.host.searchable&&""!==this._searchQuery.trim()&&0===this.getFilteredOptions(e).length}getCurrentQuery(){return this.host.searchQuery||this._searchQuery}hostUpdated(){super.hostUpdated(),this.host.searchQuery!==this._searchQuery&&(this._searchQuery=this.host.searchQuery)}hostConnected(){super.hostConnected(),this._searchQuery=""}}class $r extends hr{constructor(){super(...arguments),this.handleTriggerClick=e=>{this.host.disabled||(e.preventDefault(),e.stopPropagation(),this.host.toggleDropdown())},this.handleOptionClick=(e,t)=>{e.stopPropagation(),t.disabled||(this.host.multiple?this.host.toggleOption(t):(this.host.selectOption(t),this.host.closeDropdown()))},this.handleTagRemove=(e,t)=>{e.stopPropagation(),this.host.unselectOption(t)},this.handleClearAll=e=>{e.stopPropagation(),this.host.clearSelection()},this.handleKeyDown=e=>{const t=this.host.keyboardController;t&&t.handleKeyDown(e)},this.handleFocus=()=>{const e=this.host.focusController;e&&e.handleFocus()},this.handleBlur=()=>{const e=this.host.focusController;e&&e.handleBlur()},this.handleWindowClick=e=>{e.composedPath().includes(this.host)||this.host.closeDropdown()}}setupEventListeners(){window.addEventListener("click",this.handleWindowClick)}removeEventListeners(){window.removeEventListener("click",this.handleWindowClick)}hostDisconnected(){super.hostDisconnected(),this.removeEventListeners()}}
21416
21781
  /**
21417
21782
  * @license
21418
21783
  * Copyright 2023 Nuraly, Laabidi Aymen
21419
21784
  * SPDX-License-Identifier: MIT
21420
- */var fr=function(e,t,i,n){for(var a,o=arguments.length,s=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n,r=e.length-1;r>=0;r--)(a=e[r])&&(s=(o<3?a(s):o>3?a(t,i,s):a(t,i))||s);return o>3&&s&&Object.defineProperty(t,i,s),s};let gr=class extends(we(t)){constructor(){super(...arguments),this.requiredComponents=["nr-input","nr-icon"],this.options=[],this.placeholder="Select an option",this.disabled=!1,this.type=Js.Default,this.multiple=!1,this.show=!1,this.status=Ys.Default,this.size=Qs.Medium,this.required=!1,this.name="",this.value="",this.noOptionsMessage="No options available",this.noOptionsIcon="info",this.searchable=!1,this.clearable=!1,this.searchPlaceholder="Search options...",this.searchQuery="",this.useCustomSelectedDisplay=!1,this.maxHeight="",this.block=!1,this.selectionController=new or(this),this.dropdownController=new dr(this),this.keyboardController=new sr(this,this.selectionController,this.dropdownController),this.focusController=new pr(this),this.validationController=new hr(this,this.selectionController),this.searchController=new ur(this),this.eventController=new br(this),this.handleTriggerClick=e=>{this.eventController.handleTriggerClick(e)},this.handleOptionClick=(e,t)=>{this.eventController.handleOptionClick(e,t)},this.handleTagRemove=(e,t)=>{this.eventController.handleTagRemove(e,t)},this.handleClearAll=e=>{this.eventController.handleClearAll(e)},this.handleKeyDown=e=>{this.eventController.handleKeyDown(e)},this.handleFocus=()=>{this.eventController.handleFocus()},this.handleBlur=()=>{this.eventController.handleBlur()}}get optionsElement(){return this.renderRoot.querySelector(".options")}get wrapper(){return this.renderRoot.querySelector(".wrapper")}get searchInput(){return this.renderRoot.querySelector(".search-input")}connectedCallback(){super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback()}willUpdate(e){super.willUpdate(e),(e.has("options")||e.has("value"))&&this.options.length>0&&this.value&&(Array.isArray(this.value)?this.value.length>0:""!==this.value)&&(this.selectionController._initialized=!1,this.selectionController.initializeFromValue())}firstUpdated(e){super.firstUpdated(e),this.optionsElement&&this.wrapper?this.dropdownController.setElements(this.optionsElement,this.wrapper):setTimeout(()=>{this.optionsElement&&this.wrapper&&this.dropdownController.setElements(this.optionsElement,this.wrapper)},100),this.value&&(Array.isArray(this.value)?this.value.length>0:""!==this.value)&&this.selectionController.initializeFromValue()}get selectedOptions(){return this.selectionController.getSelectedOptions()}get selectedOption(){return this.selectionController.getSelectedOption()}selectOption(e){this.selectionController.selectOption(e)}unselectOption(e){this.selectionController.unselectOption(e)}toggleOption(e){this.selectionController.toggleOption(e)}clearSelection(){this.selectionController.clearSelection()}isOptionSelected(e){return this.selectionController.isOptionSelected(e)}toggleDropdown(){this.dropdownController.toggle()}openDropdown(){this.dropdownController.open()}closeDropdown(){this.dropdownController.close()}focus(){this.focusController.focus()}blur(){this.focusController.blur()}validate(){return this.validationController.validate()}checkValidity(){return this.validationController.checkValidity()}reportValidity(){return this.validationController.reportValidity()}setCustomValidity(e){this.validationController.setCustomValidity(e)}getValidationStatus(){return{isValid:this.validationController.checkValidity(),validationMessage:this.validationController.validationMessage||""}}get validationMessage(){return this.validationController.validationMessage||""}clearValidation(){this.validationController.setCustomValidity(""),this.status=Ys.Default}searchOptions(e){this.searchController.search(e)}clearSearch(){this.searchController.clearSearch()}getSearchFilteredOptions(){return this.searchController.getFilteredOptions(this.options)}getCurrentSearchQuery(){return this.searchController.searchQuery}getSelectedOptions(){return this.selectedOptions}setupGlobalEventListeners(){this.eventController.setupEventListeners()}removeGlobalEventListeners(){this.eventController.removeEventListeners()}getFilteredOptions(){return this.searchController.getFilteredOptions(this.options)}setupEventListeners(){this.eventController.setupEventListeners()}removeEventListeners(){this.eventController.removeEventListeners()}render(){return i`${E(this.type,[[Js.Default,()=>this.renderDefault()],[Js.Inline,()=>this.renderInline()],[Js.Button,()=>this.renderButton()],[Js.Slot,()=>this.renderSlot()]])}`}renderDefault(){const e=this.selectedOptions,t=this.validationController.getValidationClasses();return i`
21785
+ */var kr=function(e,t,i,n){for(var a,o=arguments.length,s=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n,r=e.length-1;r>=0;r--)(a=e[r])&&(s=(o<3?a(s):o>3?a(t,i,s):a(t,i))||s);return o>3&&s&&Object.defineProperty(t,i,s),s};let Sr=class extends(we(t)){constructor(){super(...arguments),this.requiredComponents=["nr-input","nr-icon"],this.options=[],this.placeholder="Select an option",this.disabled=!1,this.type=nr.Default,this.multiple=!1,this.show=!1,this.status=ar.Default,this.size=or.Medium,this.required=!1,this.name="",this.value="",this.noOptionsMessage="No options available",this.noOptionsIcon="info",this.searchable=!1,this.clearable=!1,this.searchPlaceholder="Search options...",this.searchQuery="",this.useCustomSelectedDisplay=!1,this.maxHeight="",this.block=!1,this.selectionController=new ur(this),this.dropdownController=new mr(this),this.keyboardController=new br(this,this.selectionController,this.dropdownController),this.focusController=new xr(this),this.validationController=new yr(this,this.selectionController),this.searchController=new wr(this),this.eventController=new $r(this),this.handleTriggerClick=e=>{this.eventController.handleTriggerClick(e)},this.handleOptionClick=(e,t)=>{this.eventController.handleOptionClick(e,t)},this.handleTagRemove=(e,t)=>{this.eventController.handleTagRemove(e,t)},this.handleClearAll=e=>{this.eventController.handleClearAll(e)},this.handleKeyDown=e=>{this.eventController.handleKeyDown(e)},this.handleFocus=()=>{this.eventController.handleFocus()},this.handleBlur=()=>{this.eventController.handleBlur()}}get optionsElement(){return this.renderRoot.querySelector(".options")}get wrapper(){return this.renderRoot.querySelector(".wrapper")}get searchInput(){return this.renderRoot.querySelector(".search-input")}connectedCallback(){super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback()}willUpdate(e){super.willUpdate(e),(e.has("options")||e.has("value"))&&this.options.length>0&&this.value&&(Array.isArray(this.value)?this.value.length>0:""!==this.value)&&(this.selectionController._initialized=!1,this.selectionController.initializeFromValue())}firstUpdated(e){super.firstUpdated(e),this.optionsElement&&this.wrapper?this.dropdownController.setElements(this.optionsElement,this.wrapper):setTimeout(()=>{this.optionsElement&&this.wrapper&&this.dropdownController.setElements(this.optionsElement,this.wrapper)},100),this.value&&(Array.isArray(this.value)?this.value.length>0:""!==this.value)&&this.selectionController.initializeFromValue()}get selectedOptions(){return this.selectionController.getSelectedOptions()}get selectedOption(){return this.selectionController.getSelectedOption()}selectOption(e){this.selectionController.selectOption(e)}unselectOption(e){this.selectionController.unselectOption(e)}toggleOption(e){this.selectionController.toggleOption(e)}clearSelection(){this.selectionController.clearSelection()}isOptionSelected(e){return this.selectionController.isOptionSelected(e)}toggleDropdown(){this.dropdownController.toggle()}openDropdown(){this.dropdownController.open()}closeDropdown(){this.dropdownController.close()}focus(){this.focusController.focus()}blur(){this.focusController.blur()}validate(){return this.validationController.validate()}checkValidity(){return this.validationController.checkValidity()}reportValidity(){return this.validationController.reportValidity()}setCustomValidity(e){this.validationController.setCustomValidity(e)}getValidationStatus(){return{isValid:this.validationController.checkValidity(),validationMessage:this.validationController.validationMessage||""}}get validationMessage(){return this.validationController.validationMessage||""}clearValidation(){this.validationController.setCustomValidity(""),this.status=ar.Default}searchOptions(e){this.searchController.search(e)}clearSearch(){this.searchController.clearSearch()}getSearchFilteredOptions(){return this.searchController.getFilteredOptions(this.options)}getCurrentSearchQuery(){return this.searchController.searchQuery}getSelectedOptions(){return this.selectedOptions}setupGlobalEventListeners(){this.eventController.setupEventListeners()}removeGlobalEventListeners(){this.eventController.removeEventListeners()}getFilteredOptions(){return this.searchController.getFilteredOptions(this.options)}setupEventListeners(){this.eventController.setupEventListeners()}removeEventListeners(){this.eventController.removeEventListeners()}render(){return i`${z(this.type,[[nr.Default,()=>this.renderDefault()],[nr.Inline,()=>this.renderInline()],[nr.Button,()=>this.renderButton()],[nr.Slot,()=>this.renderSlot()]])}`}renderDefault(){const e=this.selectedOptions,t=this.validationController.getValidationClasses();return i`
21421
21786
  <slot name="label"></slot>
21422
21787
  <div
21423
21788
  class="${p(Object.assign({wrapper:!0},t))}"
@@ -21516,7 +21881,7 @@ const Us=e`
21516
21881
  aria-label="Remove ${e.label}"
21517
21882
  ></nr-icon>
21518
21883
  </span>
21519
- `):i`${e[0].label}`}renderStatusIcon(){switch(this.status){case Ys.Warning:return i`<nr-icon name="alert-triangle" size="${this.size}" class="status-icon warning"></nr-icon>`;case Ys.Error:return i`<nr-icon name="alert-circle" size="${this.size}" class="status-icon error"></nr-icon>`;case Ys.Success:return i`<nr-icon name="circle-check" size="${this.size}" class="status-icon success"></nr-icon>`;default:return n}}renderClearButton(e){return!this.clearable||0===e.length||this.disabled?n:i`
21884
+ `):i`${e[0].label}`}renderStatusIcon(){switch(this.status){case ar.Warning:return i`<nr-icon name="alert-triangle" size="${this.size}" class="status-icon warning"></nr-icon>`;case ar.Error:return i`<nr-icon name="alert-circle" size="${this.size}" class="status-icon error"></nr-icon>`;case ar.Success:return i`<nr-icon name="circle-check" size="${this.size}" class="status-icon success"></nr-icon>`;default:return n}}renderClearButton(e){return!this.clearable||0===e.length||this.disabled?n:i`
21520
21885
  <nr-icon
21521
21886
  part="clear"
21522
21887
  name="x"
@@ -21570,18 +21935,18 @@ const Us=e`
21570
21935
  <div class="${a} ${o}" id="${s}" role="alert" aria-live="polite">
21571
21936
  ${e}
21572
21937
  </div>
21573
- `}(this.validationController.validationMessage,{statusClass:this.status})}};gr.styles=Hs,gr.useShadowDom=!0,fr([o({type:Array})],gr.prototype,"options",void 0),fr([o({type:String})],gr.prototype,"placeholder",void 0),fr([o({type:Boolean,reflect:!0})],gr.prototype,"disabled",void 0),fr([o({type:String,reflect:!0})],gr.prototype,"type",void 0),fr([o({type:Boolean,attribute:"multiple"})],gr.prototype,"multiple",void 0),fr([o({type:Boolean,reflect:!0})],gr.prototype,"show",void 0),fr([o({type:String,reflect:!0})],gr.prototype,"status",void 0),fr([o({type:String,reflect:!0})],gr.prototype,"size",void 0),fr([o({type:Boolean,reflect:!0})],gr.prototype,"required",void 0),fr([o({type:String})],gr.prototype,"name",void 0),fr([o()],gr.prototype,"value",void 0),fr([o({type:String,attribute:"no-options-message"})],gr.prototype,"noOptionsMessage",void 0),fr([o({type:String,attribute:"no-options-icon"})],gr.prototype,"noOptionsIcon",void 0),fr([o({type:Boolean,reflect:!0})],gr.prototype,"searchable",void 0),fr([o({type:Boolean,reflect:!0})],gr.prototype,"clearable",void 0),fr([o({type:String,attribute:"search-placeholder"})],gr.prototype,"searchPlaceholder",void 0),fr([o({type:String})],gr.prototype,"searchQuery",void 0),fr([o({type:Boolean,attribute:"use-custom-selected-display"})],gr.prototype,"useCustomSelectedDisplay",void 0),fr([o({type:String,attribute:"max-height"})],gr.prototype,"maxHeight",void 0),fr([o({type:Boolean,reflect:!0})],gr.prototype,"block",void 0),gr=fr([r("nr-select")],gr);
21938
+ `}(this.validationController.validationMessage,{statusClass:this.status})}};Sr.styles=Zs,Sr.useShadowDom=!0,kr([o({type:Array})],Sr.prototype,"options",void 0),kr([o({type:String})],Sr.prototype,"placeholder",void 0),kr([o({type:Boolean,reflect:!0})],Sr.prototype,"disabled",void 0),kr([o({type:String,reflect:!0})],Sr.prototype,"type",void 0),kr([o({type:Boolean,attribute:"multiple"})],Sr.prototype,"multiple",void 0),kr([o({type:Boolean,reflect:!0})],Sr.prototype,"show",void 0),kr([o({type:String,reflect:!0})],Sr.prototype,"status",void 0),kr([o({type:String,reflect:!0})],Sr.prototype,"size",void 0),kr([o({type:Boolean,reflect:!0})],Sr.prototype,"required",void 0),kr([o({type:String})],Sr.prototype,"name",void 0),kr([o()],Sr.prototype,"value",void 0),kr([o({type:String,attribute:"no-options-message"})],Sr.prototype,"noOptionsMessage",void 0),kr([o({type:String,attribute:"no-options-icon"})],Sr.prototype,"noOptionsIcon",void 0),kr([o({type:Boolean,reflect:!0})],Sr.prototype,"searchable",void 0),kr([o({type:Boolean,reflect:!0})],Sr.prototype,"clearable",void 0),kr([o({type:String,attribute:"search-placeholder"})],Sr.prototype,"searchPlaceholder",void 0),kr([o({type:String})],Sr.prototype,"searchQuery",void 0),kr([o({type:Boolean,attribute:"use-custom-selected-display"})],Sr.prototype,"useCustomSelectedDisplay",void 0),kr([o({type:String,attribute:"max-height"})],Sr.prototype,"maxHeight",void 0),kr([o({type:Boolean,reflect:!0})],Sr.prototype,"block",void 0),Sr=kr([r("nr-select")],Sr);
21574
21939
  /**
21575
21940
  * @license
21576
21941
  * Copyright 2024 Nuraly, Laabidi Aymen
21577
21942
  * SPDX-License-Identifier: MIT
21578
21943
  */
21579
- var vr=function(e,t,i,n){return new(i||(i=Promise))(function(a,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function r(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?a(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(s,r)}l((n=n.apply(e,t||[])).next())})},mr=function(e){return this instanceof mr?(this.v=e,this):new mr(e)},xr=function(e,t,i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n,a=i.apply(e,t||[]),o=[];return n=Object.create(("function"==typeof AsyncIterator?AsyncIterator:Object).prototype),s("next"),s("throw"),s("return",function(e){return function(t){return Promise.resolve(t).then(e,c)}}),n[Symbol.asyncIterator]=function(){return this},n;function s(e,t){a[e]&&(n[e]=function(t){return new Promise(function(i,n){o.push([e,t,i,n])>1||r(e,t)})},t&&(n[e]=t(n[e])))}function r(e,t){try{(i=a[e](t)).value instanceof mr?Promise.resolve(i.value.v).then(l,c):d(o[0][2],i)}catch(e){d(o[0][3],e)}var i}function l(e){r("next",e)}function c(e){r("throw",e)}function d(e,t){e(t),o.shift(),o.length&&r(o[0][0],o[0][1])}};class yr{constructor(){this.id="workflow-socket",this.name="Workflow Socket Provider",this.capabilities={streaming:!0,fileUpload:!0,modules:!0,functions:!1},this.socket=null,this.config=null,this.connected=!1,this.sessionId=`session_${Date.now()}_${Math.random().toString(36).substring(2,11)}`,this.activeExecutions=new Map}connect(e){return vr(this,void 0,void 0,function*(){if(!e.workflowId)throw new Error("Workflow ID is required");this.config=Object.assign({socketUrl:e.socketUrl||("undefined"!=typeof window?window.location.origin:"http://localhost:8000"),socketPath:e.socketPath||"/__nk_socketio/",triggerEndpoint:e.triggerEndpoint||"/api/v1/workflows/{workflowId}/trigger/chat",responseTimeout:e.responseTimeout||6e4},e);const t=`${this.config.socketUrl}/nk/apps/workflows/socket`;return this.socket=b(t,{path:this.config.socketPath,query:{o:JSON.stringify({workflowId:this.config.workflowId})},transports:["websocket","polling"],autoConnect:!0,reconnection:!0,reconnectionAttempts:5}),new Promise((e,t)=>{const i=setTimeout(()=>{t(new Error("Socket connection timeout"))},1e4);this.socket.on("connect",()=>{clearTimeout(i),this.connected=!0,console.log("[WorkflowSocketProvider] Connected:",this.socket.id),this.subscribeToWorkflow(this.config.workflowId),e()}),this.socket.on("connect_error",e=>{clearTimeout(i),console.error("[WorkflowSocketProvider] Connection error:",e),t(e)}),this.socket.on("disconnect",e=>{this.connected=!1,console.log("[WorkflowSocketProvider] Disconnected:",e)}),this.setupEventListeners()})})}subscribeToWorkflow(e){this.socket&&(this.socket.emit("nk:subscribe:workflow",{workflowId:e}),console.log("[WorkflowSocketProvider] Subscribed to workflow:",e))}subscribeToExecution(e){this.socket&&(this.socket.emit("nk:subscribe:execution",{executionId:e}),console.log("[WorkflowSocketProvider] Subscribed to execution:",e))}setupEventListeners(){this.socket&&(this.socket.onAny((e,...t)=>{console.log("[WorkflowSocketProvider] RAW event:",e,t[0])}),this.socket.on("nk:data",e=>{(null==e?void 0:e.event)&&e.data&&this._handleEvent(e.event,e.data)}),this.socket.on("execution:chat-message",e=>this._handleEvent("execution:chat-message",e)),this.socket.on("execution:started",e=>this._handleEvent("execution:started",e)),this.socket.on("execution:completed",e=>this._handleEvent("execution:completed",e)),this.socket.on("execution:failed",e=>this._handleEvent("execution:failed",e)),this.socket.on("execution:node-started",e=>this._handleEvent("execution:node-started",e)),this.socket.on("execution:node-completed",e=>this._handleEvent("execution:node-completed",e)))}_handleEvent(e,t){var i,n,a,o,s;switch(e){case"execution:chat-message":{const e=t.executionId,a=t.message;if(console.log("[WorkflowSocketProvider] Chat message received:",e,a),!e||!a)return;const o=this.activeExecutions.get(e);if(!o)return void(null===(n=null===(i=this.config)||void 0===i?void 0:i.onMessage)||void 0===n||n.call(i,a));o.completed||o.messages.push(a);break}case"execution:started":console.log("[WorkflowSocketProvider] Execution started (event):",t.executionId);break;case"execution:completed":{const e=t.executionId;if(console.log("[WorkflowSocketProvider] Execution completed:",e),!e)return;const i=this.activeExecutions.get(e);if(!i||i.completed)return;i.completed=!0;let n="";if(null===(a=this.config)||void 0===a?void 0:a.extractResponse)n=this.config.extractResponse(t);else if(i.messages.length>0)n=i.messages.join("\n\n");else if(t.outputData)try{const e="string"==typeof t.outputData?JSON.parse(t.outputData):t.outputData;n=e.response||e.message||e.result||JSON.stringify(e)}catch(e){n=t.outputData}i.resolve(n||"Workflow completed"),this.activeExecutions.delete(e);break}case"execution:failed":{const e=t.executionId,i=t.errorMessage||t.error||"Workflow execution failed";if(console.error("[WorkflowSocketProvider] Execution failed:",e,i),!e)return;const n=this.activeExecutions.get(e);if(!n||n.completed)return;n.completed=!0,n.reject(new Error(i)),this.activeExecutions.delete(e);break}case"execution:node-started":console.log("[WorkflowSocketProvider] Node started:",t.nodeName),t.nodeName&&(null===(o=this.onNodeStarted)||void 0===o||o.call(this,t.nodeName));break;case"execution:node-completed":console.log("[WorkflowSocketProvider] Node completed:",t.nodeName),t.nodeName&&(null===(s=this.onNodeCompleted)||void 0===s||s.call(this,t.nodeName))}}disconnect(){return vr(this,void 0,void 0,function*(){var e;this.socket&&((null===(e=this.config)||void 0===e?void 0:e.workflowId)&&this.socket.emit("nk:unsubscribe:workflow",{workflowId:this.config.workflowId}),this.socket.disconnect(),this.socket=null),this.connected=!1,this.activeExecutions.clear(),console.log("[WorkflowSocketProvider] Disconnected")})}isConnected(){var e;return this.connected&&!0===(null===(e=this.socket)||void 0===e?void 0:e.connected)}sendMessage(e,t){return xr(this,arguments,function*(){var i,n;if(!this.connected||!this.socket||!this.config)return yield yield mr(this.formatError("Not Connected","Socket is not connected. Please check your connection.")),yield mr(void 0);try{const a=this.buildInput(e,t),o=this.config.triggerEndpoint.replace("{workflowId}",this.config.workflowId),s=`${this.config.socketUrl}${o}`;console.log("[WorkflowSocketProvider] Triggering workflow:",s,a);const r=yield mr(fetch(s,{method:"POST",headers:Object.assign({"Content-Type":"application/json"},this.config.headers),body:JSON.stringify(a)}));if(!r.ok){const e=yield mr(r.text().catch(()=>r.statusText));return yield yield mr(this.formatError(`${r.status} ${r.statusText}`,e)),yield mr(void 0)}const l=r.headers.get("X-Execution-Id")||(null===(i=yield mr(r.json().catch(()=>({}))))||void 0===i?void 0:i.executionId);if(!l)return yield yield mr(this.formatError("Execution Error","No execution ID received from server")),yield mr(void 0);console.log("[WorkflowSocketProvider] Execution started:",l),(null===(n=this.config)||void 0===n?void 0:n.onExecutionStart)&&this.config.onExecutionStart(l,this.config.workflowId),this.subscribeToExecution(l);const c=new Promise((e,t)=>{this.activeExecutions.set(l,{messages:[],resolve:e,reject:t,completed:!1}),setTimeout(()=>{const i=this.activeExecutions.get(l);i&&!i.completed&&(i.completed=!0,i.messages.length>0?e(i.messages.join("\n\n")):t(new Error("Execution timeout")),this.activeExecutions.delete(l))},this.config.responseTimeout)}),d=this.activeExecutions.get(l);let p=0;const h=setInterval(()=>{d.messages.length>p&&(p=d.messages.length)},100);try{for(;!d.completed;){if(d.messages.length>0){const e=d.messages.join("\n\n");yield yield mr(e)}yield mr(new Promise(e=>setTimeout(e,200)))}clearInterval(h);const e=yield mr(c);yield yield mr(e)}catch(e){throw clearInterval(h),e}}catch(e){const t=e instanceof Error?e.message:String(e);yield yield mr(this.formatError("Workflow Error",t)),this.onError(e instanceof Error?e:new Error(String(e)))}})}buildInput(e,t){var i,n,a;if(null===(i=this.config)||void 0===i?void 0:i.buildInput)return this.config.buildInput(e,t);console.log("[WorkflowSocketProvider] buildInput context.uploadedFiles:",t.uploadedFiles);const o=(null===(n=t.currentThread)||void 0===n?void 0:n.id)||this.sessionId,s={message:e,threadId:o,modules:t.selectedModules,metadata:t.metadata,files:(null===(a=t.uploadedFiles)||void 0===a?void 0:a.map(e=>{var t;return{id:e.id,name:e.name,type:e.type,mimeType:e.mimeType,url:e.url,base64:null===(t=e.metadata)||void 0===t?void 0:t.base64}}))||[]};return console.log("[WorkflowSocketProvider] buildInput threadId:",o,"files count:",s.files.length),s}setWorkflowId(e){this.config&&(this.socket&&this.config.workflowId&&this.socket.emit("nk:unsubscribe:workflow",{workflowId:this.config.workflowId}),this.config.workflowId=e,this.socket&&this.connected&&this.subscribeToWorkflow(e))}getSocket(){return this.socket}uploadFile(e){return vr(this,void 0,void 0,function*(){const t=`file-${Date.now()}-${Math.random().toString(36).substring(2,9)}`,i=URL.createObjectURL(e),n=yield this.fileToBase64(e),a=e.type||"application/octet-stream",o=this.determineFileType(a);return console.log(`[WorkflowSocketProvider] File prepared: ${e.name} (${e.size} bytes)`),{id:t,name:e.name,size:e.size,type:o,mimeType:a,url:i,previewUrl:o===Ot.Image?i:void 0,uploadProgress:100,metadata:{provider:"workflow-socket",uploadedAt:(new Date).toISOString(),base64:n}}})}fileToBase64(e){return new Promise((t,i)=>{const n=new FileReader;n.onload=()=>{const e=n.result,i=e.split(",")[1]||e;t(i)},n.onerror=i,n.readAsDataURL(e)})}determineFileType(e){return e.startsWith("image/")?Ot.Image:e.startsWith("video/")?Ot.Video:e.startsWith("audio/")?Ot.Audio:e.startsWith("application/pdf")||e.includes("document")||e.startsWith("text/")?Ot.Document:e.includes("zip")||e.includes("rar")||e.includes("tar")?Ot.Archive:e.includes("javascript")||e.includes("json")||e.includes("xml")?Ot.Code:Ot.Unknown}formatError(e,t){return`[ERROR_START][ERROR_TITLE_START]${e}[ERROR_TITLE_END]${t}[ERROR_END]`}onError(e){console.error("[WorkflowSocketProvider] Error:",e)}}
21944
+ var Cr=function(e,t,i,n){return new(i||(i=Promise))(function(a,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function r(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?a(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(s,r)}l((n=n.apply(e,t||[])).next())})},Tr=function(e){return this instanceof Tr?(this.v=e,this):new Tr(e)},Mr=function(e,t,i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n,a=i.apply(e,t||[]),o=[];return n=Object.create(("function"==typeof AsyncIterator?AsyncIterator:Object).prototype),s("next"),s("throw"),s("return",function(e){return function(t){return Promise.resolve(t).then(e,c)}}),n[Symbol.asyncIterator]=function(){return this},n;function s(e,t){a[e]&&(n[e]=function(t){return new Promise(function(i,n){o.push([e,t,i,n])>1||r(e,t)})},t&&(n[e]=t(n[e])))}function r(e,t){try{(i=a[e](t)).value instanceof Tr?Promise.resolve(i.value.v).then(l,c):d(o[0][2],i)}catch(e){d(o[0][3],e)}var i}function l(e){r("next",e)}function c(e){r("throw",e)}function d(e,t){e(t),o.shift(),o.length&&r(o[0][0],o[0][1])}};class Er{constructor(){this.id="workflow-socket",this.name="Workflow Socket Provider",this.capabilities={streaming:!0,fileUpload:!0,modules:!0,functions:!1},this.socket=null,this.config=null,this.connected=!1,this.sessionId=`session_${Date.now()}_${Math.random().toString(36).substring(2,11)}`,this.activeExecutions=new Map}connect(e){return Cr(this,void 0,void 0,function*(){if(!e.workflowId)throw new Error("Workflow ID is required");this.config=Object.assign({socketUrl:e.socketUrl||("undefined"!=typeof window?window.location.origin:"http://localhost:8000"),socketPath:e.socketPath||"/__nk_socketio/",triggerEndpoint:e.triggerEndpoint||"/api/v1/workflows/{workflowId}/trigger/chat",responseTimeout:e.responseTimeout||6e4},e);const t=`${this.config.socketUrl}/nk/apps/workflows/:workflowId`;return this.socket=b(t,{path:this.config.socketPath,query:{o:JSON.stringify({workflowId:this.config.workflowId})},transports:["websocket","polling"],autoConnect:!0,reconnection:!0,reconnectionAttempts:5}),new Promise((e,t)=>{const i=setTimeout(()=>{t(new Error("Socket connection timeout"))},1e4);this.socket.on("connect",()=>{clearTimeout(i),this.connected=!0,console.log("[WorkflowSocketProvider] Connected:",this.socket.id),this.subscribeToWorkflow(this.config.workflowId),e()}),this.socket.on("connect_error",e=>{clearTimeout(i),console.error("[WorkflowSocketProvider] Connection error:",e),t(e)}),this.socket.on("disconnect",e=>{this.connected=!1,console.log("[WorkflowSocketProvider] Disconnected:",e)}),this.setupEventListeners()})})}subscribeToWorkflow(e){this.socket&&(this.socket.emit("nk:subscribe:workflow",{workflowId:e}),console.log("[WorkflowSocketProvider] Subscribed to workflow:",e))}subscribeToExecution(e){this.socket&&(this.socket.emit("nk:subscribe:execution",{executionId:e}),console.log("[WorkflowSocketProvider] Subscribed to execution:",e))}setupEventListeners(){this.socket&&(this.socket.onAny((e,...t)=>{console.log("[WorkflowSocketProvider] RAW event:",e,t[0])}),this.socket.on("nk:data",e=>{(null==e?void 0:e.event)&&e.data&&this._handleEvent(e.event,e.data)}),this.socket.on("execution:chat-message",e=>this._handleEvent("execution:chat-message",e)),this.socket.on("execution:started",e=>this._handleEvent("execution:started",e)),this.socket.on("execution:completed",e=>this._handleEvent("execution:completed",e)),this.socket.on("execution:failed",e=>this._handleEvent("execution:failed",e)),this.socket.on("execution:node-started",e=>this._handleEvent("execution:node-started",e)),this.socket.on("execution:node-completed",e=>this._handleEvent("execution:node-completed",e)))}_handleEvent(e,t){var i,n,a,o,s;switch(e){case"execution:chat-message":{const e=t.executionId,a=t.message;if(console.log("[WorkflowSocketProvider] Chat message received:",e,a),!e||!a)return;const o=this.activeExecutions.get(e);if(!o)return void(null===(n=null===(i=this.config)||void 0===i?void 0:i.onMessage)||void 0===n||n.call(i,a));o.completed||o.messages.push(a);break}case"execution:started":console.log("[WorkflowSocketProvider] Execution started (event):",t.executionId);break;case"execution:completed":{const e=t.executionId;if(console.log("[WorkflowSocketProvider] Execution completed:",e),!e)return;const i=this.activeExecutions.get(e);if(!i||i.completed)return;i.completed=!0;let n="";if(null===(a=this.config)||void 0===a?void 0:a.extractResponse)n=this.config.extractResponse(t);else if(i.messages.length>0)n=i.messages.join("\n\n");else if(t.outputData)try{const e="string"==typeof t.outputData?JSON.parse(t.outputData):t.outputData;n=e.response||e.message||e.result||JSON.stringify(e)}catch(e){n=t.outputData}i.resolve(n||"Workflow completed"),this.activeExecutions.delete(e);break}case"execution:failed":{const e=t.executionId,i=t.errorMessage||t.error||"Workflow execution failed";if(console.error("[WorkflowSocketProvider] Execution failed:",e,i),!e)return;const n=this.activeExecutions.get(e);if(!n||n.completed)return;n.completed=!0,n.reject(new Error(i)),this.activeExecutions.delete(e);break}case"execution:node-started":console.log("[WorkflowSocketProvider] Node started:",t.nodeName),t.nodeName&&(null===(o=this.onNodeStarted)||void 0===o||o.call(this,t.nodeName));break;case"execution:node-completed":console.log("[WorkflowSocketProvider] Node completed:",t.nodeName),t.nodeName&&(null===(s=this.onNodeCompleted)||void 0===s||s.call(this,t.nodeName))}}disconnect(){return Cr(this,void 0,void 0,function*(){var e;this.socket&&((null===(e=this.config)||void 0===e?void 0:e.workflowId)&&this.socket.emit("nk:unsubscribe:workflow",{workflowId:this.config.workflowId}),this.socket.disconnect(),this.socket=null),this.connected=!1,this.activeExecutions.clear(),console.log("[WorkflowSocketProvider] Disconnected")})}isConnected(){var e;return this.connected&&!0===(null===(e=this.socket)||void 0===e?void 0:e.connected)}sendMessage(e,t){return Mr(this,arguments,function*(){var i,n;if(!this.connected||!this.socket||!this.config)return yield yield Tr(this.formatError("Not Connected","Socket is not connected. Please check your connection.")),yield Tr(void 0);try{const a=this.buildInput(e,t),o=this.config.triggerEndpoint.replace("{workflowId}",this.config.workflowId),s=`${this.config.socketUrl}${o}`;console.log("[WorkflowSocketProvider] Triggering workflow:",s,a);const r=yield Tr(fetch(s,{method:"POST",headers:Object.assign({"Content-Type":"application/json"},this.config.headers),body:JSON.stringify(a)}));if(!r.ok){const e=yield Tr(r.text().catch(()=>r.statusText));return yield yield Tr(this.formatError(`${r.status} ${r.statusText}`,e)),yield Tr(void 0)}const l=r.headers.get("X-Execution-Id")||(null===(i=yield Tr(r.json().catch(()=>({}))))||void 0===i?void 0:i.executionId);if(!l)return yield yield Tr(this.formatError("Execution Error","No execution ID received from server")),yield Tr(void 0);console.log("[WorkflowSocketProvider] Execution started:",l),(null===(n=this.config)||void 0===n?void 0:n.onExecutionStart)&&this.config.onExecutionStart(l,this.config.workflowId),this.subscribeToExecution(l);const c=new Promise((e,t)=>{this.activeExecutions.set(l,{messages:[],resolve:e,reject:t,completed:!1}),setTimeout(()=>{const i=this.activeExecutions.get(l);i&&!i.completed&&(i.completed=!0,i.messages.length>0?e(i.messages.join("\n\n")):t(new Error("Execution timeout")),this.activeExecutions.delete(l))},this.config.responseTimeout)}),d=this.activeExecutions.get(l);let p=0;const h=setInterval(()=>{d.messages.length>p&&(p=d.messages.length)},100);try{for(;!d.completed;){if(d.messages.length>0){const e=d.messages.join("\n\n");yield yield Tr(e)}yield Tr(new Promise(e=>setTimeout(e,200)))}clearInterval(h);const e=yield Tr(c);yield yield Tr(e)}catch(e){throw clearInterval(h),e}}catch(e){const t=e instanceof Error?e.message:String(e);yield yield Tr(this.formatError("Workflow Error",t)),this.onError(e instanceof Error?e:new Error(String(e)))}})}buildInput(e,t){var i,n,a;if(null===(i=this.config)||void 0===i?void 0:i.buildInput)return this.config.buildInput(e,t);console.log("[WorkflowSocketProvider] buildInput context.uploadedFiles:",t.uploadedFiles);const o=(null===(n=t.currentThread)||void 0===n?void 0:n.id)||this.sessionId,s={message:e,threadId:o,modules:t.selectedModules,metadata:t.metadata,files:(null===(a=t.uploadedFiles)||void 0===a?void 0:a.map(e=>{var t;return{id:e.id,name:e.name,type:e.type,mimeType:e.mimeType,url:e.url,base64:null===(t=e.metadata)||void 0===t?void 0:t.base64}}))||[]};return console.log("[WorkflowSocketProvider] buildInput threadId:",o,"files count:",s.files.length),s}setWorkflowId(e){this.config&&(this.socket&&this.config.workflowId&&this.socket.emit("nk:unsubscribe:workflow",{workflowId:this.config.workflowId}),this.config.workflowId=e,this.socket&&this.connected&&this.subscribeToWorkflow(e))}getSocket(){return this.socket}uploadFile(e){return Cr(this,void 0,void 0,function*(){const t=`file-${Date.now()}-${Math.random().toString(36).substring(2,9)}`,i=URL.createObjectURL(e),n=yield this.fileToBase64(e),a=e.type||"application/octet-stream",o=this.determineFileType(a);return console.log(`[WorkflowSocketProvider] File prepared: ${e.name} (${e.size} bytes)`),{id:t,name:e.name,size:e.size,type:o,mimeType:a,url:i,previewUrl:o===At.Image?i:void 0,uploadProgress:100,metadata:{provider:"workflow-socket",uploadedAt:(new Date).toISOString(),base64:n}}})}fileToBase64(e){return new Promise((t,i)=>{const n=new FileReader;n.onload=()=>{const e=n.result,i=e.split(",")[1]||e;t(i)},n.onerror=i,n.readAsDataURL(e)})}determineFileType(e){return e.startsWith("image/")?At.Image:e.startsWith("video/")?At.Video:e.startsWith("audio/")?At.Audio:e.startsWith("application/pdf")||e.includes("document")||e.startsWith("text/")?At.Document:e.includes("zip")||e.includes("rar")||e.includes("tar")?At.Archive:e.includes("javascript")||e.includes("json")||e.includes("xml")?At.Code:At.Unknown}formatError(e,t){return`[ERROR_START][ERROR_TITLE_START]${e}[ERROR_TITLE_END]${t}[ERROR_END]`}onError(e){console.error("[WorkflowSocketProvider] Error:",e)}}
21580
21945
  /**
21581
21946
  * @license
21582
21947
  * Copyright 2024 Nuraly, Laabidi Aymen
21583
21948
  * SPDX-License-Identifier: MIT
21584
- */var wr=function(e,t,i,n){for(var a,o=arguments.length,s=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n,r=e.length-1;r>=0;r--)(a=e[r])&&(s=(o<3?a(s):o>3?a(t,i,s):a(t,i))||s);return o>3&&s&&Object.defineProperty(t,i,s),s},$r=function(e,t,i,n){return new(i||(i=Promise))(function(a,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function r(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?a(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(s,r)}l((n=n.apply(e,t||[])).next())})};let kr=class extends Es{get executionId(){return this.currentExecutionId}set executionId(e){const t=this.currentExecutionId;this.currentExecutionId=e,this.requestUpdate("executionId",t),e&&e!==t?this.fetchExecutionData(e):e||this.nodeExecutionData.clear()}normalizeNodes(e){return e.map(e=>Object.assign(Object.assign({},e),{status:e.status?e.status.toUpperCase():void 0}))}getNodeDimensionsForContainment(e){return{width:180,height:80}}shouldExcludeFromContainment(e){return e.type===B.NOTE}onWorkflowLoaded(e,t){if(!t||t.id!==e.id){const t=e.nodes.find(e=>{var t;return e.type===B.CHAT_START&&!0===(null===(t=e.configuration)||void 0===t?void 0:t.alwaysOpenPlan)});t&&this.previewNodeId!==t.id&&this.updateComplete.then(()=>{this.handleNodePreview({detail:{node:t}})})}}getNoteContentKey(e){return"noteContent"}getNoteSizeKeys(){return{widthKey:"noteWidth",heightKey:"noteHeight"}}getDefaultNoteSize(){return{width:200,height:100}}getCanvasType(){return this.canvasType}onNodeMouseDownExtra(e){var t;e.type===B.CHAT_START&&!0===(null===(t=e.configuration)||void 0===t?void 0:t.alwaysOpenPlan)&&this.previewNodeId!==e.id&&this.handleNodePreview({detail:{node:e}})}onConnected(){this.addEventListener("test-workflow-request",this.handleTestWorkflowRequest),this.startTriggerPollingIfNeeded()}onDisconnected(){this.removeEventListener("test-workflow-request",this.handleTestWorkflowRequest),this.cleanupChatPreview(),this.stopTriggerPolling(),this._cleanupPaletteTouchDrag()}willUpdate(e){super.willUpdate(e),e.has("workflow")&&this.startTriggerPollingIfNeeded()}getNodesForRendering(){return this.getNodesWithStatuses()}getNodesWithStatuses(){const e=Object.keys(this.nodeStatuses).length>0;return this.workflow.nodes.map(t=>{const i=this.agentActivity[t.id],n=Object.assign(Object.assign({},t),{agentActivity:(null==i?void 0:i.active)?i:void 0});return this.nodeStatuses[t.id]?Object.assign(Object.assign({},n),{status:this.nodeStatuses[t.id].toUpperCase()}):e?Object.assign(Object.assign({},n),{status:void 0}):n})}hasPersistentTriggerNodes(){return this.workflow.nodes.some(e=>ue(e.type))}startTriggerPollingIfNeeded(){this.hasPersistentTriggerNodes()&&!this.triggerPollingInterval?(this.fetchTriggerStatuses(),this.triggerPollingInterval=setInterval(()=>this.fetchTriggerStatuses(),1e4)):!this.hasPersistentTriggerNodes()&&this.triggerPollingInterval&&this.stopTriggerPolling()}stopTriggerPolling(){this.triggerPollingInterval&&(clearInterval(this.triggerPollingInterval),this.triggerPollingInterval=null)}fetchTriggerStatuses(){return $r(this,void 0,void 0,function*(){if(this.workflow.id)try{const e=yield fetch(`/api/v1/workflows/${this.workflow.id}/trigger-defs`);if(!e.ok)return;const t=yield e.json(),i=new Set(["TELEGRAM_BOT","SLACK_SOCKET","DISCORD_BOT","WHATSAPP_WEBHOOK","CUSTOM_WEBSOCKET"]),n=t.filter(e=>i.has(e.type)).map(e=>$r(this,void 0,void 0,function*(){try{const t=yield fetch(`/api/v1/triggers/${e.id}/status`);if(!t.ok)return{trigger:e,status:null};const i=yield t.json();return{trigger:e,status:i}}catch(t){return{trigger:e,status:null}}})),a=yield Promise.all(n),o=new Map;for(const e of a){const{trigger:t,status:i}=e,n=this.workflow.nodes.find(e=>e.type===t.type);n&&o.set(n.id,{triggerId:t.id,connectionState:(null==i?void 0:i.connectionState)||"DISCONNECTED",health:null==i?void 0:i.health,messagesReceived:null==i?void 0:i.messagesReceived,lastMessageAt:null==i?void 0:i.lastMessageAt,stateReason:null==i?void 0:i.stateReason,webhookUrl:t.webhookUrl,inDevMode:null==i?void 0:i.inDevMode})}this.triggerStatuses=o,this.requestUpdate()}catch(e){}})}activateTrigger(e){return $r(this,void 0,void 0,function*(){try{yield fetch(`/api/v1/triggers/${e}/activate`,{method:"POST"})}catch(e){}yield this.fetchTriggerStatuses()})}deactivateTrigger(e){return $r(this,void 0,void 0,function*(){try{yield fetch(`/api/v1/triggers/${e}/deactivate`,{method:"POST"})}catch(e){}yield this.fetchTriggerStatuses()})}createAndActivateTrigger(e,t){return $r(this,void 0,void 0,function*(){var i;if(null===(i=this.workflow)||void 0===i?void 0:i.id)try{const i=yield fetch(`/api/v1/workflows/${this.workflow.id}/trigger-defs`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:`${e} trigger`,type:e,configuration:JSON.stringify(t)})});if(!i.ok)return;const n=yield i.json();try{yield fetch(`/api/v1/triggers/${n.id}/activate`,{method:"POST"})}catch(e){}return yield this.fetchTriggerStatuses(),n.id}catch(e){return void(yield this.fetchTriggerStatuses())}})}toggleDevMode(e,t){return $r(this,void 0,void 0,function*(){try{yield fetch(`/api/v1/triggers/${e}/dev-mode`,{method:t?"POST":"DELETE"})}catch(e){}yield this.fetchTriggerStatuses()})}handleNodePreview(e){return $r(this,void 0,void 0,function*(){var t;const{node:i}=e.detail;this.previewNodeId===i.id?this.closePreviewPanel():(yield this.cleanupChatPreview(),this.previewNodeId=i.id,i.type===B.CHAT_START&&(null===(t=this.workflow)||void 0===t?void 0:t.id)&&(yield this.initializeChatPreview(this.workflow.id,i.configuration)))})}initializeChatPreview(e,t){return $r(this,void 0,void 0,function*(){try{this.chatPreviewProvider=new yr,yield this.connectChatPreviewSocket(e),this.setupExecutionSocketListeners(),this.createChatPreviewController(t),console.log("[Canvas] Chat preview initialized for workflow:",e)}catch(e){console.error("[Canvas] Failed to initialize chat preview:",e),this.chatPreviewController=null,this.chatPreviewProvider=null}})}connectChatPreviewSocket(e){return $r(this,void 0,void 0,function*(){const t="undefined"!=typeof window?window.location.origin:"http://localhost:8000";yield this.chatPreviewProvider.connect({workflowId:e,socketUrl:t,socketPath:"/__nk_socketio/",triggerEndpoint:"/api/v1/workflows/{workflowId}/trigger/chat",responseTimeout:6e4,onExecutionStart:e=>{this.currentExecutionId=e,this.nodeStatuses={},this.nodeExecutionData.clear(),this.requestUpdate()},onMessage:e=>{this.chatPreviewController&&this.chatPreviewController.addMessage({id:`bot-${Date.now()}`,sender:Ct.Bot,text:e,timestamp:(new Date).toISOString()})}})})}setupExecutionSocketListeners(){const e=this.chatPreviewProvider.getSocket();e&&(e.on("execution:started",e=>{var t;const i=(null===(t=e.data)||void 0===t?void 0:t.executionId)||e.executionId;i&&(this.currentExecutionId=i,this.nodeExecutionData.clear()),this.nodeStatuses={}}),e.on("execution:node-started",e=>{var t;const i=(null===(t=e.data)||void 0===t?void 0:t.nodeId)||e.nodeId,n=e.data||e;i&&(this.nodeStatuses=Object.assign(Object.assign({},this.nodeStatuses),{[i]:"RUNNING"}),this.nodeExecutionData.set(i,{id:n.nodeExecutionId||i,nodeId:i,status:"running",inputData:n.inputData,startedAt:n.startedAt||(new Date).toISOString()}),this.requestUpdate())}),e.on("execution:node-completed",e=>{var t;const i=(null===(t=e.data)||void 0===t?void 0:t.nodeId)||e.nodeId,n=e.data||e;if(i){this.nodeStatuses=Object.assign(Object.assign({},this.nodeStatuses),{[i]:"COMPLETED"});const e=this.nodeExecutionData.get(i)||{id:i,nodeId:i,status:"completed"};this.nodeExecutionData.set(i,Object.assign(Object.assign({},e),{status:"completed",outputData:n.outputData,completedAt:n.completedAt||(new Date).toISOString(),durationMs:n.durationMs})),this.requestUpdate()}}),e.on("execution:node-failed",e=>{var t;const i=(null===(t=e.data)||void 0===t?void 0:t.nodeId)||e.nodeId,n=e.data||e;if(i){this.nodeStatuses=Object.assign(Object.assign({},this.nodeStatuses),{[i]:"FAILED"});const e=this.nodeExecutionData.get(i)||{id:i,nodeId:i,status:"failed"};this.nodeExecutionData.set(i,Object.assign(Object.assign({},e),{status:"failed",errorMessage:n.errorMessage||n.error,completedAt:n.completedAt||(new Date).toISOString(),durationMs:n.durationMs})),this.requestUpdate()}}))}createChatPreviewController(e){const t=!0===(null==e?void 0:e.enableFileUpload);console.log("[Canvas] Creating chat controller with config:",{enableFileUpload:t,nodeConfig:e}),this.chatPreviewController=new xi({provider:this.chatPreviewProvider,enableFileUpload:t,ui:{onStateChange:()=>{this.requestUpdate()}}})}cleanupChatPreview(){return $r(this,void 0,void 0,function*(){if(this.chatPreviewProvider){try{yield this.chatPreviewProvider.disconnect()}catch(e){console.error("[Canvas] Error disconnecting chat preview:",e)}this.chatPreviewProvider=null}this.chatPreviewController=null})}sendHttpPreviewRequest(){return $r(this,void 0,void 0,function*(){var e;if(this.getPreviewNode()&&(null===(e=this.workflow)||void 0===e?void 0:e.id)){this.httpPreviewLoading=!0,this.httpPreviewError="",this.httpPreviewResponse="",this.nodeStatuses={};try{let e;try{e=JSON.parse(this.httpPreviewBody)}catch(e){throw new Error("Invalid JSON in request body")}const t=`${"undefined"!=typeof window?window.location.origin:"http://localhost:8000"}/api/v1/workflows/${this.workflow.id}/trigger/http`;console.log("[Canvas] Sending HTTP preview request:",t,e);const i=yield fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),n=i.headers.get("X-Execution-Id");let a;try{a=yield i.json()}catch(e){a=yield i.text()}if(!i.ok)throw new Error(a.message||a||`HTTP ${i.status}`);this.httpPreviewResponse=JSON.stringify({status:i.status,executionId:n,data:a},null,2),n&&(this.currentExecutionId=n,this.fetchExecutionData(n))}catch(e){console.error("[Canvas] HTTP preview error:",e),this.httpPreviewError=e instanceof Error?e.message:String(e)}finally{this.httpPreviewLoading=!1}}})}resetHttpPreview(){this.httpPreviewBody="{\n \n}",this.httpPreviewResponse="",this.httpPreviewError="",this.httpPreviewLoading=!1}closePreviewPanel(){this.previewNodeId=null,this.cleanupChatPreview(),this.resetHttpPreview()}handleNodeTrigger(e){const{node:t}=e.detail;if(ue(t.type)){const e=this.triggerStatuses.get(t.id);if(e){e.connectionState===W.CONNECTED||e.connectionState===W.CONNECTING?this.deactivateTrigger(e.triggerId):this.activateTrigger(e.triggerId)}return void this.dispatchEvent(new CustomEvent("trigger-toggle",{detail:{node:t,triggerStatus:e},bubbles:!0,composed:!0}))}console.log("[Canvas] Node trigger clicked:",t.name,t.type),this.dispatchEvent(new CustomEvent("workflow-trigger",{detail:{node:t},bubbles:!0,composed:!0}))}handleNodeDblClick(e){return $r(this,void 0,void 0,function*(){var t;if(this.disabled)return;const{node:i}=e.detail;if(i.type===B.NOTE){if(this.readonly)return;return this.editingNoteId=i.id,this.collaborative&&this.collaborationController.broadcastTypingStart(i.id),void this.updateComplete.then(()=>{var e,t;const n=null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector(`workflow-node[data-node-id="${i.id}"]`),a=null===(t=null==n?void 0:n.shadowRoot)||void 0===t?void 0:t.querySelector(".note-textarea");a&&(a.focus(),a.select())})}if(this.configuredNode=i,this.loadingVariables=!0,this.dynamicVariables=[],null===(t=this.workflow)||void 0===t?void 0:t.id){try{const e=yield qi(this.workflow,i.id,"");this.dynamicVariables=e}catch(e){console.warn("[WorkflowCanvas] Failed to fetch dynamic variables:",e)}const e=Object.keys(this.nodeStatuses).length>0,t=this.nodeExecutionData.size>0;if(e&&!t&&!this.currentExecutionId)try{const e=yield fetch(`/api/v1/workflows/${this.workflow.id}/latest-execution`);if(e.ok){const t=yield e.json();(null==t?void 0:t.id)&&(this.currentExecutionId=t.id,yield this.fetchExecutionData(t.id))}}catch(e){console.warn("[WorkflowCanvas] Failed to fetch latest execution:",e)}}this.loadingVariables=!1,this.dispatchEvent(new CustomEvent("node-configured",{detail:{node:i},bubbles:!0,composed:!0}))})}handleNoteSettings(e){const{node:t}=e.detail;this.configuredNode=t}setExecutionId(e){this.currentExecutionId=e,e||(this.nodeExecutionData.clear(),this.requestUpdate())}updateNodeExecution(e){this.nodeExecutionData.set(e.nodeId,e),this.requestUpdate()}clearExecutionData(){this.currentExecutionId=null,this.nodeExecutionData.clear(),this.requestUpdate()}fetchExecutionData(e){return $r(this,void 0,void 0,function*(){var t;if(e)try{const i=yield fetch(`/api/v1/workflows/${null===(t=this.workflow)||void 0===t?void 0:t.id}/executions/${e}/nodes`);if(!i.ok){const t=yield fetch(`/api/v1/executions/${e}/nodes`);if(!t.ok)return void console.warn("[WorkflowCanvas] Failed to fetch node executions");const i=yield t.json();return void this.processNodeExecutions(i)}const n=yield i.json();this.processNodeExecutions(n)}catch(e){console.warn("[WorkflowCanvas] Failed to fetch execution data:",e)}})}processNodeExecutions(e){var t;this.nodeExecutionData.clear();for(const i of e){let e=i.inputData,n=i.outputData;try{"string"==typeof e&&(e=JSON.parse(e))}catch(e){}try{"string"==typeof n&&(n=JSON.parse(n))}catch(e){}this.nodeExecutionData.set(i.nodeId,{id:i.id,nodeId:i.nodeId,status:null===(t=i.status)||void 0===t?void 0:t.toLowerCase(),inputData:e,outputData:n,errorMessage:i.errorMessage,startedAt:i.startedAt,completedAt:i.completedAt,durationMs:i.durationMs})}this.requestUpdate()}handleRetryNode(e){return $r(this,void 0,void 0,function*(){var t;if(this.currentExecutionId&&(null===(t=this.workflow)||void 0===t?void 0:t.id))try{const t=yield fetch(`/api/v1/workflows/${this.workflow.id}/executions/${this.currentExecutionId}/nodes/${e}/retry`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!t.ok)throw new Error(`Retry failed: ${t.statusText}`);this.dispatchEvent(new CustomEvent("node-retry",{detail:{executionId:this.currentExecutionId,nodeId:e},bubbles:!0,composed:!0}))}catch(e){console.error("[WorkflowCanvas] Failed to retry node:",e)}})}handleTableResizeStart(e){const{node:t,event:i}=e.detail;this.startTableResize(t,i)}startTableResize(e,t){const i=e.configuration||{};this.tableResizeState={nodeId:e.id,startX:t.clientX,startY:t.clientY,startWidth:i.tableWidth||320,startHeight:i.tableHeight||200},document.addEventListener("mousemove",this.handleTableResizeDrag),document.addEventListener("mouseup",this.stopTableResize)}handlePaletteItemDrag(e,t){var i;null===(i=e.dataTransfer)||void 0===i||i.setData("application/workflow-node-type",t)}_cleanupPaletteTouchDrag(){document.removeEventListener("touchmove",this._handlePaletteTouchMove),document.removeEventListener("touchend",this._handlePaletteTouchEnd),document.removeEventListener("touchcancel",this._handlePaletteTouchEnd),this._touchDragGhost&&(this._touchDragGhost.remove(),this._touchDragGhost=null),this._touchDragType=null}handlePaletteItemTouchStart(e,t){if(1!==e.touches.length)return;e.preventDefault(),this._touchDragType=t;const i=e.touches[0],n=document.createElement("div"),a=Z.find(e=>e.type===t);n.textContent=(null==a?void 0:a.name)||t,Object.assign(n.style,{position:"fixed",left:i.clientX-40+"px",top:i.clientY-20+"px",padding:"8px 16px",background:(null==a?void 0:a.color)||"#6366f1",color:"white",borderRadius:"8px",fontSize:"13px",fontWeight:"500",pointerEvents:"none",zIndex:"10000",opacity:"0.9",boxShadow:"0 4px 12px rgba(0,0,0,0.3)",whiteSpace:"nowrap"}),document.body.appendChild(n),this._touchDragGhost=n,document.addEventListener("touchmove",this._handlePaletteTouchMove,{passive:!1}),document.addEventListener("touchend",this._handlePaletteTouchEnd),document.addEventListener("touchcancel",this._handlePaletteTouchEnd)}toggleCategory(e){this.expandedCategories.has(e)?this.expandedCategories.delete(e):this.expandedCategories.add(e),this.expandedCategories=new Set(this.expandedCategories)}getPreviewNode(){return this.previewNodeId&&this.workflow.nodes.find(e=>e.id===this.previewNodeId)||null}getPreviewPanelPosition(){const e=this.getPreviewNode();if(!e)return null;return{x:(e.position.x-340-20)*this.viewport.zoom+this.viewport.panX,y:e.position.y*this.viewport.zoom+this.viewport.panY}}getAggregatedFrameStatus(e){if(0===e.length)return K.IDLE;let t=!1,i=!1,n=!1,a=!1;for(const o of e){switch(o.status||K.IDLE){case K.RUNNING:t=!0;break;case K.FAILED:i=!0;break;case K.PENDING:case K.WAITING:n=!0;break;case K.COMPLETED:a=!0}}return t?K.RUNNING:i?K.FAILED:n?K.PENDING:a?K.COMPLETED:K.IDLE}renderCollapsedFrame(e){const t=e.configuration||{};if(!t.frameCollapsed)return null;const n=t.frameLabel||is,a=t.frameBorderColor||"rgba(99, 102, 241, 0.3)",o=this.selectedNodeIds.has(e.id),s=this.frameController.getContainedNodes(e),r=this.frameController.getContainedNodePreviews(e,5),l=s.length-5,d=this.frameController.getAggregatedPorts(e),p=this.getAggregatedFrameStatus(s),h={left:`${e.position.x}px`,top:`${e.position.y}px`,"--node-color":a.replace("0.3)","1)").replace("rgba","rgb").split(",").slice(0,3).join(",")+")"},u=0===s.length?"Empty group":`Contains:\n${s.map(e=>`• ${e.name}`).join("\n")}\n\nDouble-click to expand`,b=p!==K.IDLE?`status-${p.toLowerCase()}`:"";return i`
21949
+ */var zr=function(e,t,i,n){for(var a,o=arguments.length,s=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n,r=e.length-1;r>=0;r--)(a=e[r])&&(s=(o<3?a(s):o>3?a(t,i,s):a(t,i))||s);return o>3&&s&&Object.defineProperty(t,i,s),s},Ar=function(e,t,i,n){return new(i||(i=Promise))(function(a,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function r(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?a(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(s,r)}l((n=n.apply(e,t||[])).next())})};let Or=class extends _s{get executionId(){return this.currentExecutionId}set executionId(e){const t=this.currentExecutionId;this.currentExecutionId=e,this.requestUpdate("executionId",t),e&&e!==t?this.fetchExecutionData(e):e||this.nodeExecutionData.clear()}normalizeNodes(e){return e.map(e=>Object.assign(Object.assign({},e),{status:e.status?e.status.toUpperCase():void 0}))}getNodeDimensionsForContainment(e){return{width:180,height:80}}shouldExcludeFromContainment(e){return e.type===B.NOTE}onWorkflowLoaded(e,t){if(!t||t.id!==e.id){const t=e.nodes.find(e=>{var t;return e.type===B.CHAT_START&&!0===(null===(t=e.configuration)||void 0===t?void 0:t.alwaysOpenPlan)});t&&this.previewNodeId!==t.id&&this.updateComplete.then(()=>{this.handleNodePreview({detail:{node:t}})})}}getNoteContentKey(e){return"noteContent"}getNoteSizeKeys(){return{widthKey:"noteWidth",heightKey:"noteHeight"}}getDefaultNoteSize(){return{width:200,height:100}}getCanvasType(){return this.canvasType}onNodeMouseDownExtra(e){var t;e.type===B.CHAT_START&&!0===(null===(t=e.configuration)||void 0===t?void 0:t.alwaysOpenPlan)&&this.previewNodeId!==e.id&&this.handleNodePreview({detail:{node:e}})}onConnected(){this.addEventListener("test-workflow-request",this.handleTestWorkflowRequest),this.startTriggerPollingIfNeeded()}onDisconnected(){this.removeEventListener("test-workflow-request",this.handleTestWorkflowRequest),this.cleanupChatPreview(),this.stopTriggerPolling(),this._cleanupPaletteTouchDrag()}willUpdate(e){super.willUpdate(e),e.has("workflow")&&this.startTriggerPollingIfNeeded(),(e.has("workflow")||e.has("listenToExecutionEvents"))&&this.ensureExecutionSocket()}getNodesForRendering(){return this.getNodesWithStatuses()}getNodesWithStatuses(){const e=Object.keys(this.nodeStatuses).length>0;return this.workflow.nodes.map(t=>{const i=this.agentActivity[t.id],n=Object.assign(Object.assign({},t),{agentActivity:(null==i?void 0:i.active)?i:void 0});return this.nodeStatuses[t.id]?Object.assign(Object.assign({},n),{status:this.nodeStatuses[t.id].toUpperCase()}):e?Object.assign(Object.assign({},n),{status:void 0}):n})}hasPersistentTriggerNodes(){return this.workflow.nodes.some(e=>ue(e.type))}startTriggerPollingIfNeeded(){this.hasPersistentTriggerNodes()&&!this.triggerPollingInterval?(this.fetchTriggerStatuses(),this.triggerPollingInterval=setInterval(()=>this.fetchTriggerStatuses(),1e4)):!this.hasPersistentTriggerNodes()&&this.triggerPollingInterval&&this.stopTriggerPolling()}stopTriggerPolling(){this.triggerPollingInterval&&(clearInterval(this.triggerPollingInterval),this.triggerPollingInterval=null)}fetchTriggerStatuses(){return Ar(this,void 0,void 0,function*(){if(this.workflow.id)try{const e=yield fetch(`/api/v1/workflows/${this.workflow.id}/trigger-defs`);if(!e.ok)return;const t=yield e.json(),i=new Set(["TELEGRAM_BOT","SLACK_SOCKET","DISCORD_BOT","WHATSAPP_WEBHOOK","CUSTOM_WEBSOCKET","RABBITMQ_TRIGGER","CRON"]),n=t.filter(e=>i.has(e.type)).map(e=>Ar(this,void 0,void 0,function*(){try{const t=yield fetch(`/api/v1/triggers/${e.id}/status`);if(!t.ok)return{trigger:e,status:null};const i=yield t.json();return{trigger:e,status:i}}catch(t){return{trigger:e,status:null}}})),a=yield Promise.all(n),o=new Map;for(const e of a){const{trigger:t,status:i}=e,n=this.workflow.nodes.find(e=>e.type===t.type);n&&o.set(n.id,{triggerId:t.id,connectionState:(null==i?void 0:i.connectionState)||"DISCONNECTED",health:null==i?void 0:i.health,messagesReceived:null==i?void 0:i.messagesReceived,lastMessageAt:null==i?void 0:i.lastMessageAt,stateReason:null==i?void 0:i.stateReason,webhookUrl:t.webhookUrl,inDevMode:null==i?void 0:i.inDevMode})}this.triggerStatuses=o,this.requestUpdate()}catch(e){}})}activateTrigger(e){return Ar(this,void 0,void 0,function*(){try{yield fetch(`/api/v1/triggers/${e}/activate`,{method:"POST"})}catch(e){}yield this.fetchTriggerStatuses()})}deactivateTrigger(e){return Ar(this,void 0,void 0,function*(){try{yield fetch(`/api/v1/triggers/${e}/deactivate`,{method:"POST"})}catch(e){}yield this.fetchTriggerStatuses()})}createAndActivateTrigger(e,t){return Ar(this,void 0,void 0,function*(){var i;if(null===(i=this.workflow)||void 0===i?void 0:i.id)try{const i=yield fetch(`/api/v1/workflows/${this.workflow.id}/trigger-defs`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:`${e} trigger`,type:e,configuration:JSON.stringify(t)})});if(!i.ok)return;const n=yield i.json();try{yield fetch(`/api/v1/triggers/${n.id}/activate`,{method:"POST"})}catch(e){}return yield this.fetchTriggerStatuses(),n.id}catch(e){return void(yield this.fetchTriggerStatuses())}})}toggleDevMode(e,t){return Ar(this,void 0,void 0,function*(){try{yield fetch(`/api/v1/triggers/${e}/dev-mode`,{method:t?"POST":"DELETE"})}catch(e){}yield this.fetchTriggerStatuses()})}handleNodePreview(e){return Ar(this,void 0,void 0,function*(){var t;const{node:i}=e.detail;this.previewNodeId===i.id?this.closePreviewPanel():(yield this.cleanupChatPreview(),this.previewNodeId=i.id,i.type===B.CHAT_START&&(null===(t=this.workflow)||void 0===t?void 0:t.id)?yield this.initializeChatPreview(this.workflow.id,i.configuration):yield this.ensureExecutionSocket())})}ensureExecutionSocket(){return Ar(this,void 0,void 0,function*(){var e;if(!this.chatPreviewProvider&&this.listenToExecutionEvents&&(null===(e=this.workflow)||void 0===e?void 0:e.id))try{this.chatPreviewProvider=new Er,yield this.connectChatPreviewSocket(this.workflow.id),this.setupExecutionSocketListeners(),console.log("[Canvas] Execution socket initialized for workflow:",this.workflow.id)}catch(e){console.error("[Canvas] Failed to initialize execution socket:",e),this.chatPreviewProvider=null}})}initializeChatPreview(e,t){return Ar(this,void 0,void 0,function*(){try{this.chatPreviewProvider=new Er,yield this.connectChatPreviewSocket(e),this.setupExecutionSocketListeners(),this.createChatPreviewController(t),console.log("[Canvas] Chat preview initialized for workflow:",e)}catch(e){console.error("[Canvas] Failed to initialize chat preview:",e),this.chatPreviewController=null,this.chatPreviewProvider=null}})}connectChatPreviewSocket(e){return Ar(this,void 0,void 0,function*(){const t="undefined"!=typeof window?window.location.origin:"http://localhost:8000";yield this.chatPreviewProvider.connect({workflowId:e,socketUrl:t,socketPath:"/__nk_socketio/",triggerEndpoint:"/api/v1/workflows/{workflowId}/trigger/chat",responseTimeout:6e4,onExecutionStart:e=>{this.currentExecutionId=e,this.nodeStatuses={},this.nodeExecutionData.clear(),this.requestUpdate()},onMessage:e=>{this.chatPreviewController&&this.chatPreviewController.addMessage({id:`bot-${Date.now()}`,sender:Ct.Bot,text:e,timestamp:(new Date).toISOString()})}})})}setupExecutionSocketListeners(){const e=this.chatPreviewProvider.getSocket();e&&(e.on("execution:started",e=>{var t;const i=(null===(t=e.data)||void 0===t?void 0:t.executionId)||e.executionId;i&&(this.currentExecutionId=i,this.nodeExecutionData.clear()),this.nodeStatuses={}}),e.on("execution:node-started",e=>{var t;const i=(null===(t=e.data)||void 0===t?void 0:t.nodeId)||e.nodeId,n=e.data||e;i&&(this.nodeStatuses=Object.assign(Object.assign({},this.nodeStatuses),{[i]:"RUNNING"}),this.nodeExecutionData.set(i,{id:n.nodeExecutionId||i,nodeId:i,status:"running",inputData:n.inputData,startedAt:n.startedAt||(new Date).toISOString()}),this.requestUpdate())}),e.on("execution:node-completed",e=>{var t;const i=(null===(t=e.data)||void 0===t?void 0:t.nodeId)||e.nodeId,n=e.data||e;if(i){this.nodeStatuses=Object.assign(Object.assign({},this.nodeStatuses),{[i]:"COMPLETED"});const e=this.nodeExecutionData.get(i)||{id:i,nodeId:i,status:"completed"};this.nodeExecutionData.set(i,Object.assign(Object.assign({},e),{status:"completed",outputData:n.outputData,completedAt:n.completedAt||(new Date).toISOString(),durationMs:n.durationMs})),this.requestUpdate()}}),e.on("execution:node-failed",e=>{var t;const i=(null===(t=e.data)||void 0===t?void 0:t.nodeId)||e.nodeId,n=e.data||e;if(i){this.nodeStatuses=Object.assign(Object.assign({},this.nodeStatuses),{[i]:"FAILED"});const e=this.nodeExecutionData.get(i)||{id:i,nodeId:i,status:"failed"};this.nodeExecutionData.set(i,Object.assign(Object.assign({},e),{status:"failed",errorMessage:n.errorMessage||n.error,completedAt:n.completedAt||(new Date).toISOString(),durationMs:n.durationMs})),this.requestUpdate()}}))}createChatPreviewController(e){const t=!0===(null==e?void 0:e.enableFileUpload);console.log("[Canvas] Creating chat controller with config:",{enableFileUpload:t,nodeConfig:e}),this.chatPreviewController=new xi({provider:this.chatPreviewProvider,enableFileUpload:t,ui:{onStateChange:()=>{this.requestUpdate()}}})}cleanupChatPreview(){return Ar(this,void 0,void 0,function*(){if(this.chatPreviewProvider){try{yield this.chatPreviewProvider.disconnect()}catch(e){console.error("[Canvas] Error disconnecting chat preview:",e)}this.chatPreviewProvider=null}this.chatPreviewController=null})}sendHttpPreviewRequest(){return Ar(this,void 0,void 0,function*(){var e;if(this.getPreviewNode()&&(null===(e=this.workflow)||void 0===e?void 0:e.id)){this.httpPreviewLoading=!0,this.httpPreviewError="",this.httpPreviewResponse="",this.nodeStatuses={};try{let e;try{e=JSON.parse(this.httpPreviewBody)}catch(e){throw new Error("Invalid JSON in request body")}const t=`${"undefined"!=typeof window?window.location.origin:"http://localhost:8000"}/api/v1/workflows/${this.workflow.id}/trigger/http`;console.log("[Canvas] Sending HTTP preview request:",t,e);const i=yield fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),n=i.headers.get("X-Execution-Id");let a;try{a=yield i.json()}catch(e){a=yield i.text()}if(!i.ok)throw new Error(a.message||a||`HTTP ${i.status}`);this.httpPreviewResponse=JSON.stringify({status:i.status,executionId:n,data:a},null,2),n&&(this.currentExecutionId=n,this.fetchExecutionData(n))}catch(e){console.error("[Canvas] HTTP preview error:",e),this.httpPreviewError=e instanceof Error?e.message:String(e)}finally{this.httpPreviewLoading=!1}}})}resetHttpPreview(){this.httpPreviewBody="{\n \n}",this.httpPreviewResponse="",this.httpPreviewError="",this.httpPreviewLoading=!1}closePreviewPanel(){this.previewNodeId=null,this.cleanupChatPreview().then(()=>this.ensureExecutionSocket()),this.resetHttpPreview()}handleNodeTrigger(e){const{node:t}=e.detail;if(ue(t.type)){const e=this.triggerStatuses.get(t.id);if(e){e.connectionState===W.CONNECTED||e.connectionState===W.CONNECTING?this.deactivateTrigger(e.triggerId):this.activateTrigger(e.triggerId)}return void this.dispatchEvent(new CustomEvent("trigger-toggle",{detail:{node:t,triggerStatus:e},bubbles:!0,composed:!0}))}console.log("[Canvas] Node trigger clicked:",t.name,t.type),t.type!==B.START?this.dispatchEvent(new CustomEvent("workflow-trigger",{detail:{node:t},bubbles:!0,composed:!0})):this.dispatchEvent(new CustomEvent("workflow-run",{bubbles:!0,composed:!0}))}handleNodeDblClick(e){return Ar(this,void 0,void 0,function*(){var t;if(this.disabled)return;const{node:i}=e.detail;if(i.type===B.NOTE){if(this.readonly)return;return this.editingNoteId=i.id,this.collaborative&&this.collaborationController.broadcastTypingStart(i.id),void this.updateComplete.then(()=>{var e,t;const n=null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector(`workflow-node[data-node-id="${i.id}"]`),a=null===(t=null==n?void 0:n.shadowRoot)||void 0===t?void 0:t.querySelector(".note-textarea");a&&(a.focus(),a.select())})}if(this.configuredNode=i,this.loadingVariables=!0,this.dynamicVariables=[],null===(t=this.workflow)||void 0===t?void 0:t.id){try{const e=yield qi(this.workflow,i.id,"");this.dynamicVariables=e}catch(e){console.warn("[WorkflowCanvas] Failed to fetch dynamic variables:",e)}const e=Object.keys(this.nodeStatuses).length>0,t=this.nodeExecutionData.size>0;if(e&&!t&&!this.currentExecutionId)try{const e=yield fetch(`/api/v1/workflows/${this.workflow.id}/latest-execution`);if(e.ok){const t=yield e.json();(null==t?void 0:t.id)&&(this.currentExecutionId=t.id,yield this.fetchExecutionData(t.id))}}catch(e){console.warn("[WorkflowCanvas] Failed to fetch latest execution:",e)}}this.loadingVariables=!1,this.dispatchEvent(new CustomEvent("node-configured",{detail:{node:i},bubbles:!0,composed:!0}))})}handleNoteSettings(e){const{node:t}=e.detail;this.configuredNode=t}setExecutionId(e){this.currentExecutionId=e,e||(this.nodeExecutionData.clear(),this.requestUpdate())}updateNodeExecution(e){this.nodeExecutionData.set(e.nodeId,e),this.requestUpdate()}clearExecutionData(){this.currentExecutionId=null,this.nodeExecutionData.clear(),this.requestUpdate()}fetchExecutionData(e){return Ar(this,void 0,void 0,function*(){var t;if(e)try{const i=yield fetch(`/api/v1/workflows/${null===(t=this.workflow)||void 0===t?void 0:t.id}/executions/${e}/nodes`);if(!i.ok){const t=yield fetch(`/api/v1/executions/${e}/nodes`);if(!t.ok)return void console.warn("[WorkflowCanvas] Failed to fetch node executions");const i=yield t.json();return void this.processNodeExecutions(i)}const n=yield i.json();this.processNodeExecutions(n)}catch(e){console.warn("[WorkflowCanvas] Failed to fetch execution data:",e)}})}processNodeExecutions(e){var t;this.nodeExecutionData.clear();for(const i of e){let e=i.inputData,n=i.outputData;try{"string"==typeof e&&(e=JSON.parse(e))}catch(e){}try{"string"==typeof n&&(n=JSON.parse(n))}catch(e){}this.nodeExecutionData.set(i.nodeId,{id:i.id,nodeId:i.nodeId,status:null===(t=i.status)||void 0===t?void 0:t.toLowerCase(),inputData:e,outputData:n,errorMessage:i.errorMessage,startedAt:i.startedAt,completedAt:i.completedAt,durationMs:i.durationMs})}this.requestUpdate()}handleRetryNode(e){return Ar(this,void 0,void 0,function*(){var t;if(this.currentExecutionId&&(null===(t=this.workflow)||void 0===t?void 0:t.id))try{const t=yield fetch(`/api/v1/workflows/${this.workflow.id}/executions/${this.currentExecutionId}/nodes/${e}/retry`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!t.ok)throw new Error(`Retry failed: ${t.statusText}`);this.dispatchEvent(new CustomEvent("node-retry",{detail:{executionId:this.currentExecutionId,nodeId:e},bubbles:!0,composed:!0}))}catch(e){console.error("[WorkflowCanvas] Failed to retry node:",e)}})}handleTableResizeStart(e){const{node:t,event:i}=e.detail;this.startTableResize(t,i)}startTableResize(e,t){const i=e.configuration||{};this.tableResizeState={nodeId:e.id,startX:t.clientX,startY:t.clientY,startWidth:i.tableWidth||320,startHeight:i.tableHeight||200},document.addEventListener("mousemove",this.handleTableResizeDrag),document.addEventListener("mouseup",this.stopTableResize)}handlePaletteItemDrag(e,t){var i;null===(i=e.dataTransfer)||void 0===i||i.setData("application/workflow-node-type",t)}_cleanupPaletteTouchDrag(){document.removeEventListener("touchmove",this._handlePaletteTouchMove),document.removeEventListener("touchend",this._handlePaletteTouchEnd),document.removeEventListener("touchcancel",this._handlePaletteTouchEnd),this._touchDragGhost&&(this._touchDragGhost.remove(),this._touchDragGhost=null),this._touchDragType=null}handlePaletteItemTouchStart(e,t){if(1!==e.touches.length)return;e.preventDefault(),this._touchDragType=t;const i=e.touches[0],n=document.createElement("div"),a=Z.find(e=>e.type===t);n.textContent=(null==a?void 0:a.name)||t,Object.assign(n.style,{position:"fixed",left:i.clientX-40+"px",top:i.clientY-20+"px",padding:"8px 16px",background:(null==a?void 0:a.color)||"#6366f1",color:"white",borderRadius:"8px",fontSize:"13px",fontWeight:"500",pointerEvents:"none",zIndex:"10000",opacity:"0.9",boxShadow:"0 4px 12px rgba(0,0,0,0.3)",whiteSpace:"nowrap"}),document.body.appendChild(n),this._touchDragGhost=n,document.addEventListener("touchmove",this._handlePaletteTouchMove,{passive:!1}),document.addEventListener("touchend",this._handlePaletteTouchEnd),document.addEventListener("touchcancel",this._handlePaletteTouchEnd)}toggleCategory(e){this.expandedCategories.has(e)?this.expandedCategories.delete(e):this.expandedCategories.add(e),this.expandedCategories=new Set(this.expandedCategories)}getPreviewNode(){return this.previewNodeId&&this.workflow.nodes.find(e=>e.id===this.previewNodeId)||null}getPreviewPanelPosition(){const e=this.getPreviewNode();if(!e)return null;return{x:(e.position.x-340-20)*this.viewport.zoom+this.viewport.panX,y:e.position.y*this.viewport.zoom+this.viewport.panY}}getAggregatedFrameStatus(e){if(0===e.length)return K.IDLE;let t=!1,i=!1,n=!1,a=!1;for(const o of e){switch(o.status||K.IDLE){case K.RUNNING:t=!0;break;case K.FAILED:i=!0;break;case K.PENDING:case K.WAITING:n=!0;break;case K.COMPLETED:a=!0}}return t?K.RUNNING:i?K.FAILED:n?K.PENDING:a?K.COMPLETED:K.IDLE}renderCollapsedFrame(e){const t=e.configuration||{};if(!t.frameCollapsed)return null;const n=t.frameLabel||ds,a=t.frameBorderColor||"rgba(99, 102, 241, 0.3)",o=this.selectedNodeIds.has(e.id),s=this.frameController.getContainedNodes(e),r=this.frameController.getContainedNodePreviews(e,5),l=s.length-5,d=this.frameController.getAggregatedPorts(e),p=this.getAggregatedFrameStatus(s),h={left:`${e.position.x}px`,top:`${e.position.y}px`,"--node-color":a.replace("0.3)","1)").replace("rgba","rgb").split(",").slice(0,3).join(",")+")"},u=0===s.length?"Empty group":`Contains:\n${s.map(e=>`• ${e.name}`).join("\n")}\n\nDouble-click to expand`,b=p!==K.IDLE?`status-${p.toLowerCase()}`:"";return i`
21585
21950
  <div
21586
21951
  class="collapsed-frame-node ${o?"selected":""} ${b}"
21587
21952
  style=${c(h)}
@@ -21727,7 +22092,7 @@ var vr=function(e,t,i,n){return new(i||(i=Promise))(function(a,o){function s(e){
21727
22092
  `)}
21728
22093
  </div>
21729
22094
  </div>
21730
- `}({showPalette:this.showPalette,expandedCategories:this.expandedCategories,canvasType:this.canvasType,searchTerm:this.paletteSearchTerm,onClose:()=>{this.showPalette=!1,this.paletteSearchTerm=""},onToggleCategory:e=>this.toggleCategory(e),onNodeDragStart:(e,t)=>this.handlePaletteItemDrag(e,t),onNodeTouchStart:(e,t)=>this.handlePaletteItemTouchStart(e,t),onNodeDoubleClick:e=>this.addNode(e),onSearchChange:e=>{this.paletteSearchTerm=e}})}renderConfigPanel(){var e,t,i;const n=null===(e=this.configuredNode)||void 0===e?void 0:e.id,a=n?this.nodeExecutionData.get(n):void 0;let o,s;if(n&&this.configuredNode&&ue(this.configuredNode.type)){const e=this.triggerStatuses.get(n);o={triggerId:null==e?void 0:e.triggerId,status:null==e?void 0:e.connectionState,health:null==e?void 0:e.health,messagesReceived:null==e?void 0:e.messagesReceived,lastMessageAt:null==e?void 0:e.lastMessageAt,stateReason:null==e?void 0:e.stateReason,webhookUrl:null==e?void 0:e.webhookUrl,inDevMode:null==e?void 0:e.inDevMode},s={onActivate:e=>{this.activateTrigger(e)},onDeactivate:e=>{this.deactivateTrigger(e)},onCreateAndActivate:(e,t)=>this.createAndActivateTrigger(e,t),onToggleDevMode:(e,t)=>{this.toggleDevMode(e,t)}}}return qo({node:this.configuredNode,position:this.configController.getPanelPosition(),callbacks:{onClose:()=>this.configController.closeConfig(),onUpdateName:e=>this.configController.updateName(e),onUpdateDescription:e=>this.configController.updateDescription(e),onUpdateConfig:(e,t)=>{var i,n;this.configController.updateConfig(e,t),this.chatPreviewController&&(null===(i=this.configuredNode)||void 0===i?void 0:i.id)===this.previewNodeId&&(null===(n=this.configuredNode)||void 0===n?void 0:n.type)===B.CHAT_START&&"enableFileUpload"===e&&this.chatPreviewController.updateConfig({enableFileUpload:!0===t})},onRetryNode:this.currentExecutionId?e=>{this.handleRetryNode(e)}:void 0},workflowId:null===(t=this.workflow)||void 0===t?void 0:t.id,workflow:this.workflow,dynamicVariables:this.dynamicVariables,loadingVariables:this.loadingVariables,nodeExecution:a,executionId:null!==(i=this.currentExecutionId)&&void 0!==i?i:void 0,kvEntries:this.kvEntries,onCreateKvEntry:this.onCreateKvEntry,applicationId:this.applicationId,databaseProvider:this.databaseProvider,triggerInfo:o,triggerActions:s})}renderDisabledOverlay(){return this.disabled?i`
22095
+ `}({showPalette:this.showPalette,expandedCategories:this.expandedCategories,canvasType:this.canvasType,searchTerm:this.paletteSearchTerm,onClose:()=>{this.showPalette=!1,this.paletteSearchTerm=""},onToggleCategory:e=>this.toggleCategory(e),onNodeDragStart:(e,t)=>this.handlePaletteItemDrag(e,t),onNodeTouchStart:(e,t)=>this.handlePaletteItemTouchStart(e,t),onNodeDoubleClick:e=>this.addNode(e),onSearchChange:e=>{this.paletteSearchTerm=e}})}renderConfigPanel(){var e,t,i;const n=null===(e=this.configuredNode)||void 0===e?void 0:e.id,a=n?this.nodeExecutionData.get(n):void 0;let o,s;if(n&&this.configuredNode&&ue(this.configuredNode.type)){const e=this.triggerStatuses.get(n);o={triggerId:null==e?void 0:e.triggerId,status:null==e?void 0:e.connectionState,health:null==e?void 0:e.health,messagesReceived:null==e?void 0:e.messagesReceived,lastMessageAt:null==e?void 0:e.lastMessageAt,stateReason:null==e?void 0:e.stateReason,webhookUrl:null==e?void 0:e.webhookUrl,inDevMode:null==e?void 0:e.inDevMode},s={onActivate:e=>{this.activateTrigger(e)},onDeactivate:e=>{this.deactivateTrigger(e)},onCreateAndActivate:(e,t)=>this.createAndActivateTrigger(e,t),onToggleDevMode:(e,t)=>{this.toggleDevMode(e,t)}}}return Xo({node:this.configuredNode,position:this.configController.getPanelPosition(),callbacks:{onClose:()=>this.configController.closeConfig(),onUpdateName:e=>this.configController.updateName(e),onUpdateDescription:e=>this.configController.updateDescription(e),onUpdateConfig:(e,t)=>{var i,n;this.configController.updateConfig(e,t),this.chatPreviewController&&(null===(i=this.configuredNode)||void 0===i?void 0:i.id)===this.previewNodeId&&(null===(n=this.configuredNode)||void 0===n?void 0:n.type)===B.CHAT_START&&"enableFileUpload"===e&&this.chatPreviewController.updateConfig({enableFileUpload:!0===t})},onRetryNode:this.currentExecutionId?e=>{this.handleRetryNode(e)}:void 0,onRunWorkflow:()=>{this.dispatchEvent(new CustomEvent("workflow-run",{bubbles:!0,composed:!0}))}},workflowId:null===(t=this.workflow)||void 0===t?void 0:t.id,workflow:this.workflow,dynamicVariables:this.dynamicVariables,loadingVariables:this.loadingVariables,nodeExecution:a,executionId:null!==(i=this.currentExecutionId)&&void 0!==i?i:void 0,kvEntries:this.kvEntries,onCreateKvEntry:this.onCreateKvEntry,applicationId:this.applicationId,databaseProvider:this.databaseProvider,triggerInfo:o,triggerActions:s})}renderDisabledOverlay(){return this.disabled?i`
21731
22096
  <div
21732
22097
  class="disabled-overlay ${this.isHoveringDisabledOverlay?"hovering":""}"
21733
22098
  @dblclick=${this.handleDisabledOverlayDblClick}
@@ -21919,7 +22284,7 @@ var vr=function(e,t,i,n){return new(i||(i=Promise))(function(a,o){function s(e){
21919
22284
  ${this.renderContextMenu()}
21920
22285
  </div>
21921
22286
  ${this.renderChatbotPanel()}
21922
- `}};kr.useShadowDom=!0,kr.styles=[Vs,As,Hs,qs,Ws,Ks,Gs,Ee,Wi],wr([o({type:String})],kr.prototype,"canvasType",void 0),wr([o({type:Object})],kr.prototype,"nodeStatuses",void 0),wr([o({type:Object})],kr.prototype,"agentActivity",void 0),wr([o({type:Boolean})],kr.prototype,"listenToExecutionEvents",void 0),wr([o({type:String})],kr.prototype,"executionId",null),wr([o({attribute:!1})],kr.prototype,"databaseProvider",void 0),wr([o({type:String})],kr.prototype,"applicationId",void 0),wr([o({attribute:!1})],kr.prototype,"kvEntries",void 0),wr([o({attribute:!1})],kr.prototype,"onCreateKvEntry",void 0),wr([s()],kr.prototype,"paletteSearchTerm",void 0),wr([s()],kr.prototype,"previewNodeId",void 0),wr([s()],kr.prototype,"isHoveringDisabledOverlay",void 0),wr([s()],kr.prototype,"httpPreviewBody",void 0),wr([s()],kr.prototype,"httpPreviewResponse",void 0),wr([s()],kr.prototype,"httpPreviewLoading",void 0),wr([s()],kr.prototype,"httpPreviewError",void 0),wr([s()],kr.prototype,"dynamicVariables",void 0),wr([s()],kr.prototype,"loadingVariables",void 0),wr([s()],kr.prototype,"nodeExecutionData",void 0),wr([s()],kr.prototype,"currentExecutionId",void 0),kr=wr([r("workflow-canvas")],kr);const Sr=e`
22287
+ `}};Or.useShadowDom=!0,Or.styles=[Qs,Ls,Zs,Xs,er,tr,ir,ze,Wi],zr([o({type:String})],Or.prototype,"canvasType",void 0),zr([o({type:Object})],Or.prototype,"nodeStatuses",void 0),zr([o({type:Object})],Or.prototype,"agentActivity",void 0),zr([o({type:Boolean})],Or.prototype,"listenToExecutionEvents",void 0),zr([o({type:String})],Or.prototype,"executionId",null),zr([o({attribute:!1})],Or.prototype,"databaseProvider",void 0),zr([o({type:String})],Or.prototype,"applicationId",void 0),zr([o({attribute:!1})],Or.prototype,"kvEntries",void 0),zr([o({attribute:!1})],Or.prototype,"onCreateKvEntry",void 0),zr([s()],Or.prototype,"paletteSearchTerm",void 0),zr([s()],Or.prototype,"previewNodeId",void 0),zr([s()],Or.prototype,"isHoveringDisabledOverlay",void 0),zr([s()],Or.prototype,"httpPreviewBody",void 0),zr([s()],Or.prototype,"httpPreviewResponse",void 0),zr([s()],Or.prototype,"httpPreviewLoading",void 0),zr([s()],Or.prototype,"httpPreviewError",void 0),zr([s()],Or.prototype,"dynamicVariables",void 0),zr([s()],Or.prototype,"loadingVariables",void 0),zr([s()],Or.prototype,"nodeExecutionData",void 0),zr([s()],Or.prototype,"currentExecutionId",void 0),Or=zr([r("workflow-canvas")],Or);const Ir=e`
21923
22288
  :host {
21924
22289
  display: block;
21925
22290
  position: absolute;
@@ -22692,7 +23057,7 @@ var vr=function(e,t,i,n){return new(i||(i=Promise))(function(a,o){function s(e){
22692
23057
  * Copyright 2024 Nuraly, Laabidi Aymen
22693
23058
  * SPDX-License-Identifier: MIT
22694
23059
  */
22695
- var Cr,Tr=function(e,t,i,n){for(var a,o=arguments.length,s=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n,r=e.length-1;r>=0;r--)(a=e[r])&&(s=(o<3?a(s):o>3?a(t,i,s):a(t,i))||s);return o>3&&s&&Object.defineProperty(t,i,s),s},Mr=function(e,t,i,n){return new(i||(i=Promise))(function(a,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function r(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?a(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(s,r)}l((n=n.apply(e,t||[])).next())})};let zr=Cr=class extends(we(t)){constructor(){super(...arguments),this.selected=!1,this.dragging=!1,this.connectingPortId=null,this.editing=!1,this.remoteSelection=null,this.remoteTyping=null,this.actionTargetLabel="",this._mermaidSvg="",this._mermaidError="",this._lastMermaidDef="",this._lastMermaidTheme="",this._mouseDownPos=null,this._trackMouseDown=e=>{this._mouseDownPos={x:e.clientX,y:e.clientY}},this._handleHostClick=e=>{if(this._mouseDownPos){const t=e.clientX-this._mouseDownPos.x,i=e.clientY-this._mouseDownPos.y;if(Math.abs(t)>Cr.CLICK_THRESHOLD||Math.abs(i)>Cr.CLICK_THRESHOLD)return void(this._mouseDownPos=null)}this._mouseDownPos=null,e.stopPropagation(),this.dispatchEvent(new CustomEvent("node-click",{detail:{node:this.node,event:e},bubbles:!0,composed:!0}))}}connectedCallback(){super.connectedCallback(),this.addEventListener("mousedown",this._trackMouseDown),this.addEventListener("click",this._handleHostClick)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("mousedown",this._trackMouseDown),this.removeEventListener("click",this._handleHostClick)}_handleActionBadgeMouseDown(e){e.stopPropagation(),e.stopImmediatePropagation()}_handleActionBadgeClick(e){e.stopPropagation(),e.stopImmediatePropagation(),this.dispatchEvent(new CustomEvent("node-action-trigger",{detail:{node:this.node,event:e},bubbles:!0,composed:!0}))}_handleActionBadgeTouchEnd(e){e.stopPropagation(),e.stopImmediatePropagation(),e.preventDefault(),this.dispatchEvent(new CustomEvent("node-action-trigger",{detail:{node:this.node,event:e},bubbles:!0,composed:!0}))}updated(e){var t,i,n,a;if(super.updated(e),e.has("editing")&&this.editing){const e=null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector(".wb-textarea");e&&e.focus()}if(e.has("node")&&(null===(i=this.node)||void 0===i?void 0:i.type)===H.MERMAID){const e=(null===(n=this.node.configuration)||void 0===n?void 0:n.textContent)||"",t=(null===(a=this.node.configuration)||void 0===a?void 0:a.mermaidTheme)||"default";!e||e===this._lastMermaidDef&&t===this._lastMermaidTheme||(this._lastMermaidDef=e,this._lastMermaidTheme=t,this._renderMermaid(e,t))}}_renderMermaid(e){return Mr(this,arguments,void 0,function*(e,t="default"){const{default:i}=yield import("mermaid");i.initialize({startOnLoad:!1,theme:t});try{const{svg:t}=yield i.render(`mermaid-${this.node.id.replaceAll(/[^a-zA-Z0-9]/g,"")}`,e);this._mermaidSvg=t,this._mermaidError=""}catch(e){this._mermaidError=e instanceof Error?e.message:"Invalid Mermaid syntax",this._mermaidSvg=""}})}handleNodeMouseDown(e){e.target.classList.contains("port")||(e.stopPropagation(),this.dispatchEvent(new CustomEvent("node-mousedown",{detail:{node:this.node,event:e},bubbles:!0,composed:!0})))}handleNodeDblClick(e){e.stopPropagation(),this.dispatchEvent(new CustomEvent("node-dblclick",{detail:{node:this.node},bubbles:!0,composed:!0}))}handleWbTextBlur(e){const t=e.target;this.dispatchEvent(new CustomEvent("note-content-change",{detail:{node:this.node,content:t.value},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("note-edit-end",{detail:{node:this.node},bubbles:!0,composed:!0}))}handleWbTextKeydown(e){"Escape"===e.key&&(e.preventDefault(),this.dispatchEvent(new CustomEvent("note-edit-end",{detail:{node:this.node},bubbles:!0,composed:!0})))}handleWbResizeStart(e){e.stopPropagation(),e.preventDefault(),this.dispatchEvent(new CustomEvent("note-resize-start",{detail:{node:this.node,event:e},bubbles:!0,composed:!0}))}renderWbStickyNote(e,t,a){const o=a.textContent||"Add note...",s=a.backgroundColor||"#fef08a",r=a.textColor||"#713f12";return i`
23060
+ var Pr,Nr=function(e,t,i,n){for(var a,o=arguments.length,s=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n,r=e.length-1;r>=0;r--)(a=e[r])&&(s=(o<3?a(s):o>3?a(t,i,s):a(t,i))||s);return o>3&&s&&Object.defineProperty(t,i,s),s},Rr=function(e,t,i,n){return new(i||(i=Promise))(function(a,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function r(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?a(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(s,r)}l((n=n.apply(e,t||[])).next())})};let Dr=Pr=class extends(we(t)){constructor(){super(...arguments),this.selected=!1,this.dragging=!1,this.connectingPortId=null,this.editing=!1,this.remoteSelection=null,this.remoteTyping=null,this.actionTargetLabel="",this._mermaidSvg="",this._mermaidError="",this._lastMermaidDef="",this._lastMermaidTheme="",this._mouseDownPos=null,this._trackMouseDown=e=>{this._mouseDownPos={x:e.clientX,y:e.clientY}},this._handleHostClick=e=>{if(this._mouseDownPos){const t=e.clientX-this._mouseDownPos.x,i=e.clientY-this._mouseDownPos.y;if(Math.abs(t)>Pr.CLICK_THRESHOLD||Math.abs(i)>Pr.CLICK_THRESHOLD)return void(this._mouseDownPos=null)}this._mouseDownPos=null,e.stopPropagation(),this.dispatchEvent(new CustomEvent("node-click",{detail:{node:this.node,event:e},bubbles:!0,composed:!0}))}}connectedCallback(){super.connectedCallback(),this.addEventListener("mousedown",this._trackMouseDown),this.addEventListener("click",this._handleHostClick)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("mousedown",this._trackMouseDown),this.removeEventListener("click",this._handleHostClick)}_handleActionBadgeMouseDown(e){e.stopPropagation(),e.stopImmediatePropagation()}_handleActionBadgeClick(e){e.stopPropagation(),e.stopImmediatePropagation(),this.dispatchEvent(new CustomEvent("node-action-trigger",{detail:{node:this.node,event:e},bubbles:!0,composed:!0}))}_handleActionBadgeTouchEnd(e){e.stopPropagation(),e.stopImmediatePropagation(),e.preventDefault(),this.dispatchEvent(new CustomEvent("node-action-trigger",{detail:{node:this.node,event:e},bubbles:!0,composed:!0}))}updated(e){var t,i,n,a;if(super.updated(e),e.has("editing")&&this.editing){const e=null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector(".wb-textarea");e&&e.focus()}if(e.has("node")&&(null===(i=this.node)||void 0===i?void 0:i.type)===H.MERMAID){const e=(null===(n=this.node.configuration)||void 0===n?void 0:n.textContent)||"",t=(null===(a=this.node.configuration)||void 0===a?void 0:a.mermaidTheme)||"default";!e||e===this._lastMermaidDef&&t===this._lastMermaidTheme||(this._lastMermaidDef=e,this._lastMermaidTheme=t,this._renderMermaid(e,t))}}_renderMermaid(e){return Rr(this,arguments,void 0,function*(e,t="default"){const{default:i}=yield import("mermaid");i.initialize({startOnLoad:!1,theme:t});try{const{svg:t}=yield i.render(`mermaid-${this.node.id.replaceAll(/[^a-zA-Z0-9]/g,"")}`,e);this._mermaidSvg=t,this._mermaidError=""}catch(e){this._mermaidError=e instanceof Error?e.message:"Invalid Mermaid syntax",this._mermaidSvg=""}})}handleNodeMouseDown(e){e.target.classList.contains("port")||(e.stopPropagation(),this.dispatchEvent(new CustomEvent("node-mousedown",{detail:{node:this.node,event:e},bubbles:!0,composed:!0})))}handleNodeDblClick(e){e.stopPropagation(),this.dispatchEvent(new CustomEvent("node-dblclick",{detail:{node:this.node},bubbles:!0,composed:!0}))}handleWbTextBlur(e){const t=e.target;this.dispatchEvent(new CustomEvent("note-content-change",{detail:{node:this.node,content:t.value},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("note-edit-end",{detail:{node:this.node},bubbles:!0,composed:!0}))}handleWbTextKeydown(e){"Escape"===e.key&&(e.preventDefault(),this.dispatchEvent(new CustomEvent("note-edit-end",{detail:{node:this.node},bubbles:!0,composed:!0})))}handleWbResizeStart(e){e.stopPropagation(),e.preventDefault(),this.dispatchEvent(new CustomEvent("note-resize-start",{detail:{node:this.node,event:e},bubbles:!0,composed:!0}))}renderWbStickyNote(e,t,a){const o=a.textContent||"Add note...",s=a.backgroundColor||"#fef08a",r=a.textColor||"#713f12";return i`
22696
23061
  <div
22697
23062
  class=${p(Object.assign(Object.assign({},e),{"wb-sticky-note":!0}))}
22698
23063
  style=${c(t)}
@@ -22981,7 +23346,7 @@ var Cr,Tr=function(e,t,i,n){for(var a,o=arguments.length,s=o<3?t:null===n?n=Obje
22981
23346
  ${this.renderRemoteOverlays()}
22982
23347
  </div>
22983
23348
  ${y?this.renderActionIndicator():n}
22984
- `:y?i`${x}${this.renderActionIndicator()}`:x}};zr.useShadowDom=!0,zr.styles=Sr,zr.CLICK_THRESHOLD=5,Tr([o({type:Object})],zr.prototype,"node",void 0),Tr([o({type:Boolean})],zr.prototype,"selected",void 0),Tr([o({type:Boolean})],zr.prototype,"dragging",void 0),Tr([o({type:String})],zr.prototype,"connectingPortId",void 0),Tr([o({type:Boolean})],zr.prototype,"editing",void 0),Tr([o({type:Object})],zr.prototype,"remoteSelection",void 0),Tr([o({type:Object})],zr.prototype,"remoteTyping",void 0),Tr([o({type:String})],zr.prototype,"actionTargetLabel",void 0),Tr([s()],zr.prototype,"_mermaidSvg",void 0),Tr([s()],zr.prototype,"_mermaidError",void 0),zr=Cr=Tr([r("whiteboard-node")],zr);const Er=[e`
23349
+ `:y?i`${x}${this.renderActionIndicator()}`:x}};Dr.useShadowDom=!0,Dr.styles=Ir,Dr.CLICK_THRESHOLD=5,Nr([o({type:Object})],Dr.prototype,"node",void 0),Nr([o({type:Boolean})],Dr.prototype,"selected",void 0),Nr([o({type:Boolean})],Dr.prototype,"dragging",void 0),Nr([o({type:String})],Dr.prototype,"connectingPortId",void 0),Nr([o({type:Boolean})],Dr.prototype,"editing",void 0),Nr([o({type:Object})],Dr.prototype,"remoteSelection",void 0),Nr([o({type:Object})],Dr.prototype,"remoteTyping",void 0),Nr([o({type:String})],Dr.prototype,"actionTargetLabel",void 0),Nr([s()],Dr.prototype,"_mermaidSvg",void 0),Nr([s()],Dr.prototype,"_mermaidError",void 0),Dr=Pr=Nr([r("whiteboard-node")],Dr);const _r=[e`
22985
23350
  :host {
22986
23351
  display: block;
22987
23352
  width: 100%;
@@ -24004,13 +24369,13 @@ var Cr,Tr=function(e,t,i,n){for(var a,o=arguments.length,s=o<3?t:null===n?n=Obje
24004
24369
  }
24005
24370
  }
24006
24371
 
24007
- `,Us];
24372
+ `,Ys];
24008
24373
  /**
24009
24374
  * @license
24010
24375
  * Copyright 2024 Nuraly, Laabidi Aymen
24011
24376
  * SPDX-License-Identifier: MIT
24012
24377
  */
24013
- var Or=function(e,t,i,n){for(var a,o=arguments.length,s=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n,r=e.length-1;r>=0;r--)(a=e[r])&&(s=(o<3?a(s):o>3?a(t,i,s):a(t,i))||s);return o>3&&s&&Object.defineProperty(t,i,s),s};let Ar=class extends Es{constructor(){super(...arguments),this._wbActiveColorPicker=null,this.wbShapesFlyoutOpen=!1,this.handleNoteResizeTouchDrag=e=>{e.preventDefault(),e.touches.length>0&&this.handleNoteResizeWithCoords(e.touches[0].clientX,e.touches[0].clientY)},this.stopNoteResizeTouch=()=>{this.stopNoteResize()}}normalizeNodes(e){for(const t of e)t.metadata&&delete t.metadata._hiddenByFrame;return e}getNodeDimensionsForContainment(e){const t=e.configuration||{};return{width:t.width||cs,height:t.height||cs}}shouldExcludeFromContainment(e){return!1}onWorkflowLoaded(e,t){}getNoteContentKey(e){return e.type===H.ANCHOR?"anchorLabel":"textContent"}getNoteSizeKeys(){return{widthKey:"width",heightKey:"height"}}getDefaultNoteSize(){return{width:cs,height:cs}}getCanvasType(){return q.WHITEBOARD}onCanvasMouseDownExtra(e){this._wbActiveColorPicker&&(this._wbActiveColorPicker=null),this.wbShapesFlyoutOpen&&(this.wbShapesFlyoutOpen=!1)}onGlobalMouseMoveExtra(e){return!!this.noteResizeState&&(this.handleNoteResizeDrag(e),!0)}onNoteResizeStarted(e,t){document.addEventListener("touchmove",this.handleNoteResizeTouchDrag,{passive:!1}),document.addEventListener("touchend",this.stopNoteResizeTouch)}onNoteResizeStopped(e){if(document.removeEventListener("touchmove",this.handleNoteResizeTouchDrag),document.removeEventListener("touchend",this.stopNoteResizeTouch),this.collaborative&&e){const t=this.workflow.nodes.find(t=>t.id===e);if(t){const i=t.configuration||{};this.collaborationController.broadcastOperation("RESIZE",e,{width:i.width||cs,height:i.height||cs})}}}handleNodeDblClick(e){if(this.disabled)return;const{node:t}=e.detail;if(t.type===H.STICKY_NOTE||t.type===H.TEXT_BLOCK||t.type===H.ANCHOR){if(this.readonly)return;return this.editingNoteId=t.id,this.collaborative&&this.collaborationController.broadcastTypingStart(t.id),void this.updateComplete.then(()=>{var e,i,n;const a=null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector(`whiteboard-node[data-node-id="${t.id}"]`),o=(null===(i=null==a?void 0:a.shadowRoot)||void 0===i?void 0:i.querySelector(".wb-textarea"))||(null===(n=null==a?void 0:a.shadowRoot)||void 0===n?void 0:n.querySelector(".wb-anchor-input"));o&&(o.focus(),o.select())})}ae(t.type)&&(this.configuredNode=t)}executeNodeAction(e){var t,i,n;if("pan-to-anchor"===(null===(t=e.configuration)||void 0===t?void 0:t.onClickAction)){const t=null===(i=e.configuration)||void 0===i?void 0:i.onClickTargetAnchorId;if(!t)return;const a=null===(n=this.workflow)||void 0===n?void 0:n.nodes.find(e=>e.id===t);a&&this.viewportController.panToPosition(a.position.x,a.position.y)}}handleNodeClickAction(e){this.disabled||this.executeNodeAction(e.detail.node)}getActionTargetLabel(e){var t,i,n;const a=null===(t=e.configuration)||void 0===t?void 0:t.onClickTargetAnchorId;if(!a)return"";const o=null===(i=this.workflow)||void 0===i?void 0:i.nodes.find(e=>e.id===a);return(null===(n=null==o?void 0:o.configuration)||void 0===n?void 0:n.anchorLabel)||"Anchor"}handleNodeActionTrigger(e){this.disabled||this.executeNodeAction(e.detail.node)}renderWbSidebar(){return(e={mode:this.mode,readonly:this.readonly,shapesFlyoutOpen:this.wbShapesFlyoutOpen,onModeChange:e=>{this.mode=e},onAddNode:e=>{this.addNode(e),this.wbShapesFlyoutOpen=!1},onToggleShapesFlyout:()=>{this.wbShapesFlyoutOpen=!this.wbShapesFlyoutOpen}}).readonly?n:i`
24378
+ var jr=function(e,t,i,n){for(var a,o=arguments.length,s=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n,r=e.length-1;r>=0;r--)(a=e[r])&&(s=(o<3?a(s):o>3?a(t,i,s):a(t,i))||s);return o>3&&s&&Object.defineProperty(t,i,s),s};let Lr=class extends _s{constructor(){super(...arguments),this._wbActiveColorPicker=null,this.wbShapesFlyoutOpen=!1,this.handleNoteResizeTouchDrag=e=>{e.preventDefault(),e.touches.length>0&&this.handleNoteResizeWithCoords(e.touches[0].clientX,e.touches[0].clientY)},this.stopNoteResizeTouch=()=>{this.stopNoteResize()}}normalizeNodes(e){for(const t of e)t.metadata&&delete t.metadata._hiddenByFrame;return e}getNodeDimensionsForContainment(e){const t=e.configuration||{};return{width:t.width||vs,height:t.height||vs}}shouldExcludeFromContainment(e){return!1}onWorkflowLoaded(e,t){}getNoteContentKey(e){return e.type===H.ANCHOR?"anchorLabel":"textContent"}getNoteSizeKeys(){return{widthKey:"width",heightKey:"height"}}getDefaultNoteSize(){return{width:vs,height:vs}}getCanvasType(){return q.WHITEBOARD}onCanvasMouseDownExtra(e){this._wbActiveColorPicker&&(this._wbActiveColorPicker=null),this.wbShapesFlyoutOpen&&(this.wbShapesFlyoutOpen=!1)}onGlobalMouseMoveExtra(e){return!!this.noteResizeState&&(this.handleNoteResizeDrag(e),!0)}onNoteResizeStarted(e,t){document.addEventListener("touchmove",this.handleNoteResizeTouchDrag,{passive:!1}),document.addEventListener("touchend",this.stopNoteResizeTouch)}onNoteResizeStopped(e){if(document.removeEventListener("touchmove",this.handleNoteResizeTouchDrag),document.removeEventListener("touchend",this.stopNoteResizeTouch),this.collaborative&&e){const t=this.workflow.nodes.find(t=>t.id===e);if(t){const i=t.configuration||{};this.collaborationController.broadcastOperation("RESIZE",e,{width:i.width||vs,height:i.height||vs})}}}handleNodeDblClick(e){if(this.disabled)return;const{node:t}=e.detail;if(t.type===H.STICKY_NOTE||t.type===H.TEXT_BLOCK||t.type===H.ANCHOR){if(this.readonly)return;return this.editingNoteId=t.id,this.collaborative&&this.collaborationController.broadcastTypingStart(t.id),void this.updateComplete.then(()=>{var e,i,n;const a=null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector(`whiteboard-node[data-node-id="${t.id}"]`),o=(null===(i=null==a?void 0:a.shadowRoot)||void 0===i?void 0:i.querySelector(".wb-textarea"))||(null===(n=null==a?void 0:a.shadowRoot)||void 0===n?void 0:n.querySelector(".wb-anchor-input"));o&&(o.focus(),o.select())})}ae(t.type)&&(this.configuredNode=t)}executeNodeAction(e){var t,i,n;if("pan-to-anchor"===(null===(t=e.configuration)||void 0===t?void 0:t.onClickAction)){const t=null===(i=e.configuration)||void 0===i?void 0:i.onClickTargetAnchorId;if(!t)return;const a=null===(n=this.workflow)||void 0===n?void 0:n.nodes.find(e=>e.id===t);a&&this.viewportController.panToPosition(a.position.x,a.position.y)}}handleNodeClickAction(e){this.disabled||this.executeNodeAction(e.detail.node)}getActionTargetLabel(e){var t,i,n;const a=null===(t=e.configuration)||void 0===t?void 0:t.onClickTargetAnchorId;if(!a)return"";const o=null===(i=this.workflow)||void 0===i?void 0:i.nodes.find(e=>e.id===a);return(null===(n=null==o?void 0:o.configuration)||void 0===n?void 0:n.anchorLabel)||"Anchor"}handleNodeActionTrigger(e){this.disabled||this.executeNodeAction(e.detail.node)}renderWbSidebar(){return(e={mode:this.mode,readonly:this.readonly,shapesFlyoutOpen:this.wbShapesFlyoutOpen,onModeChange:e=>{this.mode=e},onAddNode:e=>{this.addNode(e),this.wbShapesFlyoutOpen=!1},onToggleShapesFlyout:()=>{this.wbShapesFlyoutOpen=!this.wbShapesFlyoutOpen}}).readonly?n:i`
24014
24379
  <div class="wb-sidebar" @mousedown=${e=>e.stopPropagation()}>
24015
24380
  <!-- Mode tools -->
24016
24381
  <button
@@ -24057,7 +24422,7 @@ var Or=function(e,t,i,n){for(var a,o=arguments.length,s=o<3?t:null===n?n=Object.
24057
24422
  </button>
24058
24423
  ${e.shapesFlyoutOpen?i`
24059
24424
  <div class="wb-shapes-flyout">
24060
- ${Yo.map(t=>i`
24425
+ ${as.map(t=>i`
24061
24426
  <button
24062
24427
  class="wb-shapes-flyout-btn"
24063
24428
  @click=${()=>e.onAddNode(t.type)}
@@ -24136,7 +24501,7 @@ var Or=function(e,t,i,n){for(var a,o=arguments.length,s=o<3?t:null===n?n=Object.
24136
24501
  <nr-icon name="anchor" size="small"></nr-icon>
24137
24502
  </button>
24138
24503
  </div>
24139
- `;var e}getSelectedWhiteboardNode(){var e;if(1!==this.selectedNodeIds.size)return null;const t=Array.from(this.selectedNodeIds)[0],i=null===(e=this.workflow)||void 0===e?void 0:e.nodes.find(e=>e.id===t);return i&&ae(i.type)?i:null}getNodeScreenPosition(e){const t=(e.configuration||{}).width||cs;return{x:(e.position.x+t/2)*this.viewport.zoom+this.viewport.panX,y:e.position.y*this.viewport.zoom+this.viewport.panY}}handleWbToolbarAction(e,t,i){const n=this.workflow.nodes.map(n=>n.id===e?Object.assign(Object.assign({},n),{configuration:Object.assign(Object.assign({},n.configuration),{[t]:i})}):n);this.setWorkflow(Object.assign(Object.assign({},this.workflow),{nodes:n})),this.dispatchWorkflowChanged(),this.collaborative&&this.collaborationController.broadcastOperation("UPDATE",e,{[t]:i})}handleWbDeleteNode(e){if(this.collaborative){const e=Array.from(this.selectedNodeIds),t=Array.from(this.selectedEdgeIds);this.selectionController.deleteSelected();for(const t of e)this.collaborationController.broadcastOperation("DELETE",t,{});for(const e of t)this.collaborationController.broadcastOperation("DELETE_CONNECTOR",e,{})}else this.selectionController.deleteSelected()}_handleWbColorHolderClick(e,t){t.stopPropagation(),this._wbActiveColorPicker=this._wbActiveColorPicker===e?null:e}renderWbFloatingToolbar(){const e=this.getSelectedWhiteboardNode();return!e||this.readonly||this.editingNoteId?(this._wbActiveColorPicker&&(this._wbActiveColorPicker=null),n):Ts({node:e,nodeScreenPosition:this.getNodeScreenPosition(e),viewportZoom:this.viewport.zoom,activeColorPicker:this._wbActiveColorPicker,shadowRoot:this.shadowRoot,hostBoundingRect:this.getBoundingClientRect(),callbacks:{onToolbarAction:(e,t,i)=>this.handleWbToolbarAction(e,t,i),onDeleteNode:e=>this.handleWbDeleteNode(e),onColorHolderClick:(e,t)=>this._handleWbColorHolderClick(e,t)}})}render(){return i`
24504
+ `;var e}getSelectedWhiteboardNode(){var e;if(1!==this.selectedNodeIds.size)return null;const t=Array.from(this.selectedNodeIds)[0],i=null===(e=this.workflow)||void 0===e?void 0:e.nodes.find(e=>e.id===t);return i&&ae(i.type)?i:null}getNodeScreenPosition(e){const t=(e.configuration||{}).width||vs;return{x:(e.position.x+t/2)*this.viewport.zoom+this.viewport.panX,y:e.position.y*this.viewport.zoom+this.viewport.panY}}handleWbToolbarAction(e,t,i){const n=this.workflow.nodes.map(n=>n.id===e?Object.assign(Object.assign({},n),{configuration:Object.assign(Object.assign({},n.configuration),{[t]:i})}):n);this.setWorkflow(Object.assign(Object.assign({},this.workflow),{nodes:n})),this.dispatchWorkflowChanged(),this.collaborative&&this.collaborationController.broadcastOperation("UPDATE",e,{[t]:i})}handleWbDeleteNode(e){if(this.collaborative){const e=Array.from(this.selectedNodeIds),t=Array.from(this.selectedEdgeIds);this.selectionController.deleteSelected();for(const t of e)this.collaborationController.broadcastOperation("DELETE",t,{});for(const e of t)this.collaborationController.broadcastOperation("DELETE_CONNECTOR",e,{})}else this.selectionController.deleteSelected()}_handleWbColorHolderClick(e,t){t.stopPropagation(),this._wbActiveColorPicker=this._wbActiveColorPicker===e?null:e}renderWbFloatingToolbar(){const e=this.getSelectedWhiteboardNode();return!e||this.readonly||this.editingNoteId?(this._wbActiveColorPicker&&(this._wbActiveColorPicker=null),n):Ns({node:e,nodeScreenPosition:this.getNodeScreenPosition(e),viewportZoom:this.viewport.zoom,activeColorPicker:this._wbActiveColorPicker,shadowRoot:this.shadowRoot,hostBoundingRect:this.getBoundingClientRect(),callbacks:{onToolbarAction:(e,t,i)=>this.handleWbToolbarAction(e,t,i),onDeleteNode:e=>this.handleWbDeleteNode(e),onColorHolderClick:(e,t)=>this._handleWbColorHolderClick(e,t)}})}render(){return i`
24140
24505
  <div
24141
24506
  class="canvas-wrapper"
24142
24507
  data-theme=${this.currentTheme}
@@ -24198,7 +24563,7 @@ var Or=function(e,t,i,n){for(var a,o=arguments.length,s=o<3?t:null===n?n=Object.
24198
24563
  ${this.renderContextMenu()}
24199
24564
  </div>
24200
24565
  ${this.renderChatbotPanel()}
24201
- `}};Ar.useShadowDom=!0,Ar.styles=[Er,Ee,Wi,As,Hs,qs,Ws,Gs],Or([s()],Ar.prototype,"_wbActiveColorPicker",void 0),Or([s()],Ar.prototype,"wbShapesFlyoutOpen",void 0),Ar=Or([r("whiteboard-canvas")],Ar);
24566
+ `}};Lr.useShadowDom=!0,Lr.styles=[_r,ze,Wi,Ls,Zs,Xs,er,ir],jr([s()],Lr.prototype,"_wbActiveColorPicker",void 0),jr([s()],Lr.prototype,"wbShapesFlyoutOpen",void 0),Lr=jr([r("whiteboard-canvas")],Lr);
24202
24567
  /**
24203
24568
  * @license
24204
24569
  * Copyright 2024 Nuraly, Laabidi Aymen
@@ -24212,4 +24577,4 @@ var Or=function(e,t,i,n){for(var a,o=arguments.length,s=o<3?t:null===n?n=Object.
24212
24577
  * input blob → AudioContext.decodeAudioData → BufferSource → MediaStreamDestination
24213
24578
  * → MediaRecorder(ogg/opus, 32 kbps) → output blob
24214
24579
  */
24215
- var Ir=function(e,t,i,n){return new(i||(i=Promise))(function(a,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function r(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?a(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(s,r)}l((n=n.apply(e,t||[])).next())})};const Pr="audio/ogg;codecs=opus";function Nr(){try{return"undefined"!=typeof MediaRecorder&&MediaRecorder.isTypeSupported(Pr)}catch(e){return!1}}var Rr=Object.freeze({__proto__:null,canEncodeOgg:Nr,compressToOpus:function(e,t){return Ir(this,void 0,void 0,function*(){if(!Nr()){const i=t.includes("mp4")?"mp4":t.includes("aac")?"aac":"webm";return{blob:e,mimeType:t,ext:i}}const i=yield e.arrayBuffer(),n=new AudioContext;let a;try{a=yield n.decodeAudioData(i)}finally{n.close().catch(()=>{})}const o=new AudioContext({sampleRate:a.sampleRate}),s=o.createMediaStreamDestination(),r=new MediaRecorder(s.stream,{mimeType:Pr,audioBitsPerSecond:32e3}),l=[];r.ondataavailable=e=>{e.data.size>0&&l.push(e.data)};const c=new Promise((e,t)=>{r.onstop=()=>e(),r.onerror=e=>{var i;return t(null!==(i=e.error)&&void 0!==i?i:new Error("MediaRecorder error"))}});r.start(100);const d=o.createBufferSource();return d.buffer=a,d.connect(s),d.onended=()=>{setTimeout(()=>{"recording"===r.state&&r.stop()},120)},d.start(0),yield c,o.close().catch(()=>{}),{blob:new Blob(l,{type:Pr}),mimeType:Pr,ext:"ogg"}})}});const Dr=(e,t=0,i=1)=>e>i?i:e<t?t:e,_r=(e,t=0,i=Math.pow(10,t))=>Math.round(i*e)/i,jr=e=>("#"===e[0]&&(e=e.substring(1)),e.length<6?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:4===e.length?_r(parseInt(e[3]+e[3],16)/255,2):1}:{r:parseInt(e.substring(0,2),16),g:parseInt(e.substring(2,4),16),b:parseInt(e.substring(4,6),16),a:8===e.length?_r(parseInt(e.substring(6,8),16)/255,2):1}),Lr=e=>{const{h:t,s:i,l:n}=(({h:e,s:t,v:i,a:n})=>{const a=(200-t)*i/100;return{h:_r(e),s:_r(a>0&&a<200?t*i/100/(a<=100?a:200-a)*100:0),l:_r(a/2),a:_r(n,2)}})(e);return`hsl(${t}, ${i}%, ${n}%)`},Fr=({h:e,s:t,v:i,a:n})=>{e=e/360*6,t/=100,i/=100;const a=Math.floor(e),o=i*(1-t),s=i*(1-(e-a)*t),r=i*(1-(1-e+a)*t),l=a%6;return{r:_r(255*[i,s,o,o,r,i][l]),g:_r(255*[r,i,i,s,o,o][l]),b:_r(255*[o,o,r,i,i,s][l]),a:_r(n,2)}},Br=e=>{const t=e.toString(16);return t.length<2?"0"+t:t},Ur=({r:e,g:t,b:i,a:n})=>{const a=n<1?Br(_r(255*n)):"";return"#"+Br(e)+Br(t)+Br(i)+a},Vr=({r:e,g:t,b:i,a:n})=>{const a=Math.max(e,t,i),o=a-Math.min(e,t,i),s=o?a===e?(t-i)/o:a===t?2+(i-e)/o:4+(e-t)/o:0;return{h:_r(60*(s<0?s+6:s)),s:_r(a?o/a*100:0),v:_r(a/255*100),a:n}},Hr=(e,t)=>{if(e===t)return!0;for(const i in e)if(e[i]!==t[i])return!1;return!0},qr={},Wr=e=>{let t=qr[e];return t||(t=document.createElement("template"),t.innerHTML=e,qr[e]=t),t},Kr=(e,t,i)=>{e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:i}))};let Gr=!1;const Jr=e=>"touches"in e,Yr=(e,t)=>{const i=Jr(t)?t.touches[0]:t,n=e.el.getBoundingClientRect();Kr(e.el,"move",e.getMove({x:Dr((i.pageX-(n.left+window.pageXOffset))/n.width),y:Dr((i.pageY-(n.top+window.pageYOffset))/n.height)}))};class Qr{constructor(e,t,i,n){const a=Wr(`<div role="slider" tabindex="0" part="${t}" ${i}><div part="${t}-pointer"></div></div>`);e.appendChild(a.content.cloneNode(!0));const o=e.querySelector(`[part=${t}]`);o.addEventListener("mousedown",this),o.addEventListener("touchstart",this),o.addEventListener("keydown",this),this.el=o,this.xy=n,this.nodes=[o.firstChild,o]}set dragging(e){const t=e?document.addEventListener:document.removeEventListener;t(Gr?"touchmove":"mousemove",this),t(Gr?"touchend":"mouseup",this)}handleEvent(e){switch(e.type){case"mousedown":case"touchstart":if(e.preventDefault(),!(e=>!(Gr&&!Jr(e)||(Gr||(Gr=Jr(e)),0)))(e)||!Gr&&0!=e.button)return;this.el.focus(),Yr(this,e),this.dragging=!0;break;case"mousemove":case"touchmove":e.preventDefault(),Yr(this,e);break;case"mouseup":case"touchend":this.dragging=!1;break;case"keydown":((e,t)=>{const i=t.keyCode;i>40||e.xy&&i<37||i<33||(t.preventDefault(),Kr(e.el,"move",e.getMove({x:39===i?.01:37===i?-.01:34===i?.05:33===i?-.05:35===i?1:36===i?-1:0,y:40===i?.01:38===i?-.01:0},!0)))})(this,e)}}style(e){e.forEach((e,t)=>{for(const i in e)this.nodes[t].style.setProperty(i,e[i])})}}class Zr extends Qr{constructor(e){super(e,"hue",'aria-label="Hue" aria-valuemin="0" aria-valuemax="360"',!1)}update({h:e}){this.h=e,this.style([{left:e/360*100+"%",color:Lr({h:e,s:100,v:100,a:1})}]),this.el.setAttribute("aria-valuenow",`${_r(e)}`)}getMove(e,t){return{h:t?Dr(this.h+360*e.x,0,360):360*e.x}}}class Xr extends Qr{constructor(e){super(e,"saturation",'aria-label="Color"',!0)}update(e){this.hsva=e,this.style([{top:100-e.v+"%",left:`${e.s}%`,color:Lr(e)},{"background-color":Lr({h:e.h,s:100,v:100,a:1})}]),this.el.setAttribute("aria-valuetext",`Saturation ${_r(e.s)}%, Brightness ${_r(e.v)}%`)}getMove(e,t){return{s:t?Dr(this.hsva.s+100*e.x,0,100):100*e.x,v:t?Dr(this.hsva.v-100*e.y,0,100):Math.round(100-100*e.y)}}}const el=Symbol("same"),tl=Symbol("color"),il=Symbol("hsva"),nl=Symbol("update"),al=Symbol("parts"),ol=Symbol("css"),sl=Symbol("sliders");class rl extends HTMLElement{static get observedAttributes(){return["color"]}get[ol](){return[':host{display:flex;flex-direction:column;position:relative;width:200px;height:200px;user-select:none;-webkit-user-select:none;cursor:default}:host([hidden]){display:none!important}[role=slider]{position:relative;touch-action:none;user-select:none;-webkit-user-select:none;outline:0}[role=slider]:last-child{border-radius:0 0 8px 8px}[part$=pointer]{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;display:flex;place-content:center center;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}[part$=pointer]::after{content:"";width:100%;height:100%;border-radius:inherit;background-color:currentColor}[role=slider]:focus [part$=pointer]{transform:translate(-50%,-50%) scale(1.1)}',"[part=hue]{flex:0 0 24px;background:linear-gradient(to right,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red 100%)}[part=hue-pointer]{top:50%;z-index:2}","[part=saturation]{flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(to top,#000,transparent),linear-gradient(to right,#fff,rgba(255,255,255,0));box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}[part=saturation-pointer]{z-index:3}"]}get[sl](){return[Xr,Zr]}get color(){return this[tl]}set color(e){if(!this[el](e)){const t=this.colorModel.toHsva(e);this[nl](t),this[tl]=e}}constructor(){super();const e=Wr(`<style>${this[ol].join("")}</style>`),t=this.attachShadow({mode:"open"});t.appendChild(e.content.cloneNode(!0)),t.addEventListener("move",this),this[al]=this[sl].map(e=>new e(t))}connectedCallback(){if(this.hasOwnProperty("color")){const e=this.color;delete this.color,this.color=e}else this.color||(this.color=this.colorModel.defaultColor)}attributeChangedCallback(e,t,i){const n=this.colorModel.fromAttr(i);this[el](n)||(this.color=n)}handleEvent(e){const t=this[il],i={...t,...e.detail};let n;this[nl](i),Hr(i,t)||this[el](n=this.colorModel.fromHsva(i))||(this[tl]=n,Kr(this,"color-changed",{value:n}))}[el](e){return this.color&&this.colorModel.equal(e,this.color)}[nl](e){this[il]=e,this[al].forEach(t=>t.update(e))}}const ll={defaultColor:"#000",toHsva:e=>Vr(jr(e)),fromHsva:({h:e,s:t,v:i})=>Ur(Fr({h:e,s:t,v:i,a:1})),equal:(e,t)=>e.toLowerCase()===t.toLowerCase()||Hr(jr(e),jr(t)),fromAttr:e=>e};class cl extends rl{get colorModel(){return ll}}class dl extends cl{}customElements.define("hex-color-picker",dl);var pl=Object.freeze({__proto__:null,HexColorPicker:dl});export{U as AgentNodeType,ws as BORDER_COLOR_PRESETS,Es as BaseCanvasElement,kn as CHATBOT_TRIGGER_EVENTS,J as CanvasMode,q as CanvasType,In as ChatbotPreviewComponent,zn as ChatbotSizeSelectComponent,$n as ChatbotTriggerEvent,En as ChatbotVariantSelectComponent,j as DATA_NODE_SECTIONS,_ as DATA_OPERATIONS,Sn as DEFAULT_CHATBOT_TRIGGER_CONFIG,D as DEFAULT_DATA_NODE_CONFIG,I as DataOperation,_ as DataOperations,cn as DataSourceSelectComponent,V as DbDesignerNodeType,dn as EntitySelectComponent,K as ExecutionStatus,sn as ExpressionInputComponent,ys as FILL_COLOR_PRESETS,N as FILTER_OPERATORS,ks as FONT_FAMILY_OPTIONS,le as FRAME_COLOR_PRESETS,es as FRAME_DEFAULT_BG_COLOR,ts as FRAME_DEFAULT_BORDER_COLOR,Xo as FRAME_DEFAULT_HEIGHT,is as FRAME_DEFAULT_LABEL,as as FRAME_DEFAULT_LABEL_PLACEMENT,ns as FRAME_DEFAULT_LABEL_POSITION,Zo as FRAME_DEFAULT_WIDTH,On as FeatureToggleComponent,bn as FieldMapperComponent,hn as FieldMultiSelectComponent,pn as FieldSelectComponent,un as FilterBuilderComponent,P as FilterOperator,Pn as LoadingTypeSelectComponent,Ss as MERMAID_THEME_OPTIONS,X as NODE_CATEGORIES,Y as NODE_COLORS,Q as NODE_ICONS,Z as NODE_TEMPLATES,re as NOTE_COLOR_PRESETS,ps as NOTE_MIN_HEIGHT,ds as NOTE_MIN_WIDTH,ln as OperationSelectComponent,he as PERSISTENT_TRIGGER_TYPES,xs as PERSISTENT_TRIGGER_TYPE_NAMES,G as PortType,fn as SortBuilderComponent,An as SuggestionListComponent,us as TABLE_DEFAULT_HEIGHT,hs as TABLE_DEFAULT_WIDTH,fs as TABLE_MIN_HEIGHT,bs as TABLE_MIN_WIDTH,$s as TEXT_COLOR_PRESETS,ms as TRIGGER_POLL_INTERVAL_MS,W as TriggerConnectionState,Mn as TriggerEventSelectComponent,gs as VIEWPORT_ADD_NODE_OFFSET_X,vs as VIEWPORT_ADD_NODE_OFFSET_Y,rn as VariableNameInputComponent,cs as WHITEBOARD_NODE_DEFAULT_SIZE,ss as WORKFLOW_NODE_HEIGHT,os as WORKFLOW_NODE_WIDTH,ls as WORKFLOW_NOTE_DEFAULT_HEIGHT,rs as WORKFLOW_NOTE_DEFAULT_WIDTH,Ar as WhiteboardCanvasElement,zr as WhiteboardNodeElement,H as WhiteboardNodeType,kr as WorkflowCanvasElement,Bs as WorkflowNodeElement,B as WorkflowNodeType,wn as chatbotTriggerFieldStyles,se as createNodeFromTemplate,an as dataNodeFieldStyles,oe as getCategoriesForCanvasType,ee as getNodeTemplate,te as isAgentNode,ce as isAnnotationNode,ne as isDbDesignerNode,de as isFrameNode,pe as isNoteNode,ue as isPersistentTriggerNode,ae as isWhiteboardNode,ie as isWorkflowNode,L as shouldShowSection,Cn as validateChatbotTriggerConfig,F as validateDataNodeConfig};
24580
+ var Fr=function(e,t,i,n){return new(i||(i=Promise))(function(a,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function r(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?a(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(s,r)}l((n=n.apply(e,t||[])).next())})};const Br="audio/ogg;codecs=opus";function Ur(){try{return"undefined"!=typeof MediaRecorder&&MediaRecorder.isTypeSupported(Br)}catch(e){return!1}}var Vr=Object.freeze({__proto__:null,canEncodeOgg:Ur,compressToOpus:function(e,t){return Fr(this,void 0,void 0,function*(){if(!Ur()){const i=t.includes("mp4")?"mp4":t.includes("aac")?"aac":"webm";return{blob:e,mimeType:t,ext:i}}const i=yield e.arrayBuffer(),n=new AudioContext;let a;try{a=yield n.decodeAudioData(i)}finally{n.close().catch(()=>{})}const o=new AudioContext({sampleRate:a.sampleRate}),s=o.createMediaStreamDestination(),r=new MediaRecorder(s.stream,{mimeType:Br,audioBitsPerSecond:32e3}),l=[];r.ondataavailable=e=>{e.data.size>0&&l.push(e.data)};const c=new Promise((e,t)=>{r.onstop=()=>e(),r.onerror=e=>{var i;return t(null!==(i=e.error)&&void 0!==i?i:new Error("MediaRecorder error"))}});r.start(100);const d=o.createBufferSource();return d.buffer=a,d.connect(s),d.onended=()=>{setTimeout(()=>{"recording"===r.state&&r.stop()},120)},d.start(0),yield c,o.close().catch(()=>{}),{blob:new Blob(l,{type:Br}),mimeType:Br,ext:"ogg"}})}});const Hr=(e,t=0,i=1)=>e>i?i:e<t?t:e,qr=(e,t=0,i=Math.pow(10,t))=>Math.round(i*e)/i,Wr=e=>("#"===e[0]&&(e=e.substring(1)),e.length<6?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:4===e.length?qr(parseInt(e[3]+e[3],16)/255,2):1}:{r:parseInt(e.substring(0,2),16),g:parseInt(e.substring(2,4),16),b:parseInt(e.substring(4,6),16),a:8===e.length?qr(parseInt(e.substring(6,8),16)/255,2):1}),Kr=e=>{const{h:t,s:i,l:n}=(({h:e,s:t,v:i,a:n})=>{const a=(200-t)*i/100;return{h:qr(e),s:qr(a>0&&a<200?t*i/100/(a<=100?a:200-a)*100:0),l:qr(a/2),a:qr(n,2)}})(e);return`hsl(${t}, ${i}%, ${n}%)`},Gr=({h:e,s:t,v:i,a:n})=>{e=e/360*6,t/=100,i/=100;const a=Math.floor(e),o=i*(1-t),s=i*(1-(e-a)*t),r=i*(1-(1-e+a)*t),l=a%6;return{r:qr(255*[i,s,o,o,r,i][l]),g:qr(255*[r,i,i,s,o,o][l]),b:qr(255*[o,o,r,i,i,s][l]),a:qr(n,2)}},Jr=e=>{const t=e.toString(16);return t.length<2?"0"+t:t},Yr=({r:e,g:t,b:i,a:n})=>{const a=n<1?Jr(qr(255*n)):"";return"#"+Jr(e)+Jr(t)+Jr(i)+a},Qr=({r:e,g:t,b:i,a:n})=>{const a=Math.max(e,t,i),o=a-Math.min(e,t,i),s=o?a===e?(t-i)/o:a===t?2+(i-e)/o:4+(e-t)/o:0;return{h:qr(60*(s<0?s+6:s)),s:qr(a?o/a*100:0),v:qr(a/255*100),a:n}},Zr=(e,t)=>{if(e===t)return!0;for(const i in e)if(e[i]!==t[i])return!1;return!0},Xr={},el=e=>{let t=Xr[e];return t||(t=document.createElement("template"),t.innerHTML=e,Xr[e]=t),t},tl=(e,t,i)=>{e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:i}))};let il=!1;const nl=e=>"touches"in e,al=(e,t)=>{const i=nl(t)?t.touches[0]:t,n=e.el.getBoundingClientRect();tl(e.el,"move",e.getMove({x:Hr((i.pageX-(n.left+window.pageXOffset))/n.width),y:Hr((i.pageY-(n.top+window.pageYOffset))/n.height)}))};class ol{constructor(e,t,i,n){const a=el(`<div role="slider" tabindex="0" part="${t}" ${i}><div part="${t}-pointer"></div></div>`);e.appendChild(a.content.cloneNode(!0));const o=e.querySelector(`[part=${t}]`);o.addEventListener("mousedown",this),o.addEventListener("touchstart",this),o.addEventListener("keydown",this),this.el=o,this.xy=n,this.nodes=[o.firstChild,o]}set dragging(e){const t=e?document.addEventListener:document.removeEventListener;t(il?"touchmove":"mousemove",this),t(il?"touchend":"mouseup",this)}handleEvent(e){switch(e.type){case"mousedown":case"touchstart":if(e.preventDefault(),!(e=>!(il&&!nl(e)||(il||(il=nl(e)),0)))(e)||!il&&0!=e.button)return;this.el.focus(),al(this,e),this.dragging=!0;break;case"mousemove":case"touchmove":e.preventDefault(),al(this,e);break;case"mouseup":case"touchend":this.dragging=!1;break;case"keydown":((e,t)=>{const i=t.keyCode;i>40||e.xy&&i<37||i<33||(t.preventDefault(),tl(e.el,"move",e.getMove({x:39===i?.01:37===i?-.01:34===i?.05:33===i?-.05:35===i?1:36===i?-1:0,y:40===i?.01:38===i?-.01:0},!0)))})(this,e)}}style(e){e.forEach((e,t)=>{for(const i in e)this.nodes[t].style.setProperty(i,e[i])})}}class sl extends ol{constructor(e){super(e,"hue",'aria-label="Hue" aria-valuemin="0" aria-valuemax="360"',!1)}update({h:e}){this.h=e,this.style([{left:e/360*100+"%",color:Kr({h:e,s:100,v:100,a:1})}]),this.el.setAttribute("aria-valuenow",`${qr(e)}`)}getMove(e,t){return{h:t?Hr(this.h+360*e.x,0,360):360*e.x}}}class rl extends ol{constructor(e){super(e,"saturation",'aria-label="Color"',!0)}update(e){this.hsva=e,this.style([{top:100-e.v+"%",left:`${e.s}%`,color:Kr(e)},{"background-color":Kr({h:e.h,s:100,v:100,a:1})}]),this.el.setAttribute("aria-valuetext",`Saturation ${qr(e.s)}%, Brightness ${qr(e.v)}%`)}getMove(e,t){return{s:t?Hr(this.hsva.s+100*e.x,0,100):100*e.x,v:t?Hr(this.hsva.v-100*e.y,0,100):Math.round(100-100*e.y)}}}const ll=Symbol("same"),cl=Symbol("color"),dl=Symbol("hsva"),pl=Symbol("update"),hl=Symbol("parts"),ul=Symbol("css"),bl=Symbol("sliders");class fl extends HTMLElement{static get observedAttributes(){return["color"]}get[ul](){return[':host{display:flex;flex-direction:column;position:relative;width:200px;height:200px;user-select:none;-webkit-user-select:none;cursor:default}:host([hidden]){display:none!important}[role=slider]{position:relative;touch-action:none;user-select:none;-webkit-user-select:none;outline:0}[role=slider]:last-child{border-radius:0 0 8px 8px}[part$=pointer]{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;display:flex;place-content:center center;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}[part$=pointer]::after{content:"";width:100%;height:100%;border-radius:inherit;background-color:currentColor}[role=slider]:focus [part$=pointer]{transform:translate(-50%,-50%) scale(1.1)}',"[part=hue]{flex:0 0 24px;background:linear-gradient(to right,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red 100%)}[part=hue-pointer]{top:50%;z-index:2}","[part=saturation]{flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(to top,#000,transparent),linear-gradient(to right,#fff,rgba(255,255,255,0));box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}[part=saturation-pointer]{z-index:3}"]}get[bl](){return[rl,sl]}get color(){return this[cl]}set color(e){if(!this[ll](e)){const t=this.colorModel.toHsva(e);this[pl](t),this[cl]=e}}constructor(){super();const e=el(`<style>${this[ul].join("")}</style>`),t=this.attachShadow({mode:"open"});t.appendChild(e.content.cloneNode(!0)),t.addEventListener("move",this),this[hl]=this[bl].map(e=>new e(t))}connectedCallback(){if(this.hasOwnProperty("color")){const e=this.color;delete this.color,this.color=e}else this.color||(this.color=this.colorModel.defaultColor)}attributeChangedCallback(e,t,i){const n=this.colorModel.fromAttr(i);this[ll](n)||(this.color=n)}handleEvent(e){const t=this[dl],i={...t,...e.detail};let n;this[pl](i),Zr(i,t)||this[ll](n=this.colorModel.fromHsva(i))||(this[cl]=n,tl(this,"color-changed",{value:n}))}[ll](e){return this.color&&this.colorModel.equal(e,this.color)}[pl](e){this[dl]=e,this[hl].forEach(t=>t.update(e))}}const gl={defaultColor:"#000",toHsva:e=>Qr(Wr(e)),fromHsva:({h:e,s:t,v:i})=>Yr(Gr({h:e,s:t,v:i,a:1})),equal:(e,t)=>e.toLowerCase()===t.toLowerCase()||Zr(Wr(e),Wr(t)),fromAttr:e=>e};class vl extends fl{get colorModel(){return gl}}class ml extends vl{}customElements.define("hex-color-picker",ml);var xl=Object.freeze({__proto__:null,HexColorPicker:ml});export{U as AgentNodeType,zs as BORDER_COLOR_PRESETS,_s as BaseCanvasElement,kn as CHATBOT_TRIGGER_EVENTS,J as CanvasMode,q as CanvasType,In as ChatbotPreviewComponent,En as ChatbotSizeSelectComponent,$n as ChatbotTriggerEvent,zn as ChatbotVariantSelectComponent,j as DATA_NODE_SECTIONS,_ as DATA_OPERATIONS,Sn as DEFAULT_CHATBOT_TRIGGER_CONFIG,D as DEFAULT_DATA_NODE_CONFIG,I as DataOperation,_ as DataOperations,cn as DataSourceSelectComponent,V as DbDesignerNodeType,dn as EntitySelectComponent,K as ExecutionStatus,sn as ExpressionInputComponent,Es as FILL_COLOR_PRESETS,N as FILTER_OPERATORS,Os as FONT_FAMILY_OPTIONS,le as FRAME_COLOR_PRESETS,ls as FRAME_DEFAULT_BG_COLOR,cs as FRAME_DEFAULT_BORDER_COLOR,rs as FRAME_DEFAULT_HEIGHT,ds as FRAME_DEFAULT_LABEL,hs as FRAME_DEFAULT_LABEL_PLACEMENT,ps as FRAME_DEFAULT_LABEL_POSITION,ss as FRAME_DEFAULT_WIDTH,An as FeatureToggleComponent,bn as FieldMapperComponent,hn as FieldMultiSelectComponent,pn as FieldSelectComponent,un as FilterBuilderComponent,P as FilterOperator,Pn as LoadingTypeSelectComponent,Is as MERMAID_THEME_OPTIONS,X as NODE_CATEGORIES,Y as NODE_COLORS,Q as NODE_ICONS,Z as NODE_TEMPLATES,re as NOTE_COLOR_PRESETS,xs as NOTE_MIN_HEIGHT,ms as NOTE_MIN_WIDTH,ln as OperationSelectComponent,he as PERSISTENT_TRIGGER_TYPES,Ms as PERSISTENT_TRIGGER_TYPE_NAMES,G as PortType,fn as SortBuilderComponent,On as SuggestionListComponent,ws as TABLE_DEFAULT_HEIGHT,ys as TABLE_DEFAULT_WIDTH,ks as TABLE_MIN_HEIGHT,$s as TABLE_MIN_WIDTH,As as TEXT_COLOR_PRESETS,Ts as TRIGGER_POLL_INTERVAL_MS,W as TriggerConnectionState,Mn as TriggerEventSelectComponent,Ss as VIEWPORT_ADD_NODE_OFFSET_X,Cs as VIEWPORT_ADD_NODE_OFFSET_Y,rn as VariableNameInputComponent,vs as WHITEBOARD_NODE_DEFAULT_SIZE,bs as WORKFLOW_NODE_HEIGHT,us as WORKFLOW_NODE_WIDTH,gs as WORKFLOW_NOTE_DEFAULT_HEIGHT,fs as WORKFLOW_NOTE_DEFAULT_WIDTH,Lr as WhiteboardCanvasElement,Dr as WhiteboardNodeElement,H as WhiteboardNodeType,Or as WorkflowCanvasElement,Js as WorkflowNodeElement,B as WorkflowNodeType,wn as chatbotTriggerFieldStyles,se as createNodeFromTemplate,an as dataNodeFieldStyles,oe as getCategoriesForCanvasType,ee as getNodeTemplate,te as isAgentNode,ce as isAnnotationNode,ne as isDbDesignerNode,de as isFrameNode,pe as isNoteNode,ue as isPersistentTriggerNode,ae as isWhiteboardNode,ie as isWorkflowNode,L as shouldShowSection,Cn as validateChatbotTriggerConfig,F as validateDataNodeConfig};