@nuraly/lumenui 0.3.9 → 0.5.0
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.
- package/dist/nuralyui.bundle.js +633 -634
- package/dist/nuralyui.bundle.js.gz +0 -0
- package/dist/src/components/canvas/bundle.js +409 -410
- package/dist/src/components/canvas/bundle.js.gz +0 -0
- package/dist/src/components/chatbot/bundle.js +146 -147
- package/dist/src/components/chatbot/bundle.js.gz +0 -0
- package/dist/src/components/chatbot/chatbot.component.d.ts +14 -1
- package/dist/src/components/chatbot/chatbot.component.js +165 -8
- package/dist/src/components/chatbot/chatbot.style.js +6 -9
- package/dist/src/components/chatbot/chatbot.types.d.ts +94 -0
- package/dist/src/components/chatbot/templates/artifact-panel.template.d.ts +2 -1
- package/dist/src/components/chatbot/templates/artifact-panel.template.js +4 -5
- package/dist/src/components/chatbot/templates/chatbot-main.template.d.ts +3 -1
- package/dist/src/components/chatbot/templates/chatbot-main.template.js +15 -10
- package/dist/src/components/chatbot/templates/file-upload-area.template.d.ts +5 -6
- package/dist/src/components/chatbot/templates/file-upload-area.template.js +4 -11
- package/dist/src/components/chatbot/templates/input-box.template.d.ts +2 -1
- package/dist/src/components/chatbot/templates/input-box.template.js +25 -26
- package/dist/src/components/chatbot/templates/message.template.d.ts +4 -4
- package/dist/src/components/chatbot/templates/message.template.js +11 -12
- package/dist/src/components/chatbot/templates/suggestion.template.d.ts +3 -9
- package/dist/src/components/chatbot/templates/suggestion.template.js +6 -13
- package/dist/src/components/chatbot/templates/thread-sidebar.template.d.ts +2 -1
- package/dist/src/components/chatbot/templates/thread-sidebar.template.js +11 -12
- package/dist/src/components/chatbot/templates/url-modal.template.d.ts +2 -3
- package/dist/src/components/chatbot/templates/url-modal.template.js +24 -28
- package/dist/src/components/icon/bundle.js +10 -10
- package/dist/src/components/icon/bundle.js.gz +0 -0
- package/dist/src/components/icon/icon-paths.js +1 -0
- package/dist/src/components/iconpicker/bundle.js +1 -1
- package/dist/src/components/iconpicker/bundle.js.gz +0 -0
- package/dist/src/components/panel/bundle.js +1 -1
- package/dist/src/components/panel/bundle.js.gz +0 -0
- package/dist/src/components/tabs/bundle.js +1 -1
- package/dist/src/components/tabs/bundle.js.gz +0 -0
- package/package.json +1 -1
- package/packages/common/dist/VERSIONS.md +1 -1
|
@@ -238,7 +238,7 @@ const we=e=>{class t extends e{constructor(){super(...arguments),this.t=null}cre
|
|
|
238
238
|
.svg-icon.clickable:hover,
|
|
239
239
|
.svg-icon.clickable:active { transform: none; }
|
|
240
240
|
}
|
|
241
|
-
`],Ce={activity:'<path d="M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2"/>',"alert-circle":'<circle cx="12" cy="12" r="10"/><line x1="12" x2="12" y1="8" y2="12"/><line x1="12" x2="12.01" y1="16" y2="16"/>',"alert-triangle":'<path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"/><path d="M12 9v4"/><path d="M12 17h.01"/>',anchor:'<path d="M12 22V8"/><path d="M5 12H2a10 10 0 0 0 20 0h-3"/><circle cx="12" cy="5" r="3"/>',"arrow-down":'<path d="M12 5v14"/><path d="m19 12-7 7-7-7"/>',"arrow-up":'<path d="m5 12 7-7 7 7"/><path d="M12 19V5"/>',"arrow-up-down":'<path d="m21 16-4 4-4-4"/><path d="M17 20V4"/><path d="m3 8 4-4 4 4"/><path d="M7 4v16"/>',bell:'<path d="M10.268 21a2 2 0 0 0 3.464 0"/><path d="M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326"/>',box:'<path d="M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z"/><path d="m3.3 7 8.7 5 8.7-5"/><path d="M12 22V12"/>',braces:'<path d="M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1"/><path d="M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1"/>',building:'<path d="M12 10h.01"/><path d="M12 14h.01"/><path d="M12 6h.01"/><path d="M16 10h.01"/><path d="M16 14h.01"/><path d="M16 6h.01"/><path d="M8 10h.01"/><path d="M8 14h.01"/><path d="M8 6h.01"/><path d="M9 22v-3a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v3"/><rect x="4" y="2" width="16" height="20" rx="2"/>',calendar:'<path d="M8 2v4"/><path d="M16 2v4"/><rect width="18" height="18" x="3" y="4" rx="2"/><path d="M3 10h18"/>',check:'<path d="M20 6 9 17l-5-5"/>',"check-square":'<path d="M21 10.656V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.344"/><path d="m9 11 3 3L22 4"/>',"chevron-down":'<path d="m6 9 6 6 6-6"/>',"chevron-left":'<path d="m15 18-6-6 6-6"/>',"chevron-right":'<path d="m9 18 6-6-6-6"/>',"chevron-up":'<path d="m18 15-6-6-6 6"/>',"circle-check":'<circle cx="12" cy="12" r="10"/><path d="m9 12 2 2 4-4"/>',"circle-question":'<circle cx="12" cy="12" r="10"/><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"/><path d="M12 17h.01"/>',clipboard:'<rect width="8" height="4" x="8" y="2" rx="1" ry="1"/><path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"/>',"clipboard-list":'<rect width="8" height="4" x="8" y="2" rx="1" ry="1"/><path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"/><path d="M12 11h4"/><path d="M12 16h4"/><path d="M8 11h.01"/><path d="M8 16h.01"/>',code:'<path d="m16 18 6-6-6-6"/><path d="m8 6-6 6 6 6"/>',copy:'<rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/>',cpu:'<path d="M12 20v2"/><path d="M12 2v2"/><path d="M17 20v2"/><path d="M17 2v2"/><path d="M2 12h2"/><path d="M2 17h2"/><path d="M2 7h2"/><path d="M20 12h2"/><path d="M20 17h2"/><path d="M20 7h2"/><path d="M7 20v2"/><path d="M7 2v2"/><rect x="4" y="4" width="16" height="16" rx="2"/><rect x="8" y="8" width="8" height="8" rx="1"/>',"credit-card":'<rect width="20" height="14" x="2" y="5" rx="2"/><line x1="2" x2="22" y1="10" y2="10"/>',cube:'<path d="M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z"/><path d="m3.3 7 8.7 5 8.7-5"/><path d="M12 22V12"/>',database:'<ellipse cx="12" cy="5" rx="9" ry="3"/><path d="M3 5V19A9 3 0 0 0 21 19V5"/><path d="M3 12A9 3 0 0 0 21 12"/>',document:'<path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 9H8"/><path d="M16 13H8"/><path d="M16 17H8"/>',download:'<path d="M12 15V3"/><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><path d="m7 10 5 5 5-5"/>',edit:'<path d="M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/><path d="M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z"/>',"exclamation-circle":'<circle cx="12" cy="12" r="10"/><line x1="12" x2="12" y1="8" y2="12"/><line x1="12" x2="12.01" y1="16" y2="16"/>',"external-link":'<path d="M15 3h6v6"/><path d="M10 14 21 3"/><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/>',file:'<path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/>',"file-text":'<path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 9H8"/><path d="M16 13H8"/><path d="M16 17H8"/>',filter:'<path d="M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z"/>',folder:'<path d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"/>',"folder-plus":'<path d="M12 10v6"/><path d="M9 13h6"/><path d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"/>',frame:'<line x1="22" x2="2" y1="6" y2="6"/><line x1="22" x2="2" y1="18" y2="18"/><line x1="6" x2="6" y1="2" y2="22"/><line x1="18" x2="18" y1="2" y2="22"/>',"git-branch":'<line x1="6" x2="6" y1="3" y2="15"/><circle cx="18" cy="6" r="3"/><circle cx="6" cy="18" r="3"/><path d="M18 9a9 9 0 0 1-9 9"/>',globe:'<circle cx="12" cy="12" r="10"/><path d="M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"/><path d="M2 12h20"/>',"grip-vertical":'<circle cx="9" cy="12" r="1"/><circle cx="9" cy="5" r="1"/><circle cx="9" cy="19" r="1"/><circle cx="15" cy="12" r="1"/><circle cx="15" cy="5" r="1"/><circle cx="15" cy="19" r="1"/>',hand:'<path d="M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2"/><path d="M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2"/><path d="M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8"/><path d="M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15"/>',heart:'<path d="M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5"/>',help:'<circle cx="12" cy="12" r="10"/><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"/><path d="M12 17h.01"/>',home:'<path d="M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8"/><path d="M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/>',image:'<rect width="18" height="18" x="3" y="3" rx="2" ry="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"/>',info:'<circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/>',key:'<path d="m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4"/><path d="m21 2-9.6 9.6"/><circle cx="7.5" cy="15.5" r="5.5"/>',layers:'<path d="M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z"/><path d="M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12"/><path d="M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17"/>',"layout-sidebar":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M9 3v18"/>',loader:'<path d="M12 2v4"/><path d="m16.2 7.8 2.9-2.9"/><path d="M18 12h4"/><path d="m16.2 16.2 2.9 2.9"/><path d="M12 18v4"/><path d="m4.9 19.1 2.9-2.9"/><path d="M2 12h4"/><path d="m4.9 4.9 2.9 2.9"/>',"log-in":'<path d="m10 17 5-5-5-5"/><path d="M15 12H3"/><path d="M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4"/>',"log-out":'<path d="m16 17 5-5-5-5"/><path d="M21 12H9"/><path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"/>',logout:'<path d="m16 17 5-5-5-5"/><path d="M21 12H9"/><path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"/>',mail:'<path d="m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7"/><rect x="2" y="4" width="20" height="16" rx="2"/>',"panel-left":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M9 3v18"/>',"square-pen":'<path d="M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/><path d="M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z"/>',maximize:'<path d="M8 3H5a2 2 0 0 0-2 2v3"/><path d="M21 8V5a2 2 0 0 0-2-2h-3"/><path d="M3 16v3a2 2 0 0 0 2 2h3"/><path d="M16 21h3a2 2 0 0 0 2-2v-3"/>',"maximize-2":'<path d="M15 3h6v6"/><path d="m21 3-7 7"/><path d="m3 21 7-7"/><path d="M9 21H3v-6"/>',menu:'<path d="M4 5h16"/><path d="M4 12h16"/><path d="M4 19h16"/>',"message-circle":'<path d="M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719"/>',"message-square":'<path d="M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z"/>',minimize:'<path d="M8 3v3a2 2 0 0 1-2 2H3"/><path d="M21 8h-3a2 2 0 0 1-2-2V3"/><path d="M3 16h3a2 2 0 0 1 2 2v3"/><path d="M16 21v-3a2 2 0 0 1 2-2h3"/>',minus:'<path d="M5 12h14"/>',"more-vertical":'<circle cx="12" cy="12" r="1"/><circle cx="12" cy="5" r="1"/><circle cx="12" cy="19" r="1"/>',"mouse-pointer":'<path d="M12.586 12.586 19 19"/><path d="M3.688 3.037a.497.497 0 0 0-.651.651l6.5 15.999a.501.501 0 0 0 .947-.062l1.569-6.083a2 2 0 0 1 1.448-1.479l6.124-1.579a.5.5 0 0 0 .063-.947z"/>',"mouse-pointer-click":'<path d="M14 4.1 12 6"/><path d="m5.1 8-2.9-.8"/><path d="m6 12-1.9 2"/><path d="M7.2 2.2 8 5.1"/><path d="M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z"/>',navigation:'<polygon points="3 11 22 2 13 21 11 13 3 11"/>',notification:'<path d="M10.268 21a2 2 0 0 0 3.464 0"/><path d="M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326"/>',"pen-tool":'<path d="M15.707 21.293a1 1 0 0 1-1.414 0l-1.586-1.586a1 1 0 0 1 0-1.414l5.586-5.586a1 1 0 0 1 1.414 0l1.586 1.586a1 1 0 0 1 0 1.414z"/><path d="m18 13-1.375-6.874a1 1 0 0 0-.746-.776L3.235 2.028a1 1 0 0 0-1.207 1.207L5.35 15.879a1 1 0 0 0 .776.746L13 18"/><path d="m2.3 2.3 7.286 7.286"/><circle cx="11" cy="11" r="2"/>',phone:'<path d="M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384"/>',play:'<path d="M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z"/>',plus:'<path d="M5 12h14"/><path d="M12 5v14"/>',radio:'<path d="M16.247 7.761a6 6 0 0 1 0 8.478"/><path d="M19.075 4.933a10 10 0 0 1 0 14.134"/><path d="M4.925 19.067a10 10 0 0 1 0-14.134"/><path d="M7.753 16.239a6 6 0 0 1 0-8.478"/><circle cx="12" cy="12" r="2"/>',"redo-2":'<path d="m15 14 5-5-5-5"/><path d="M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13"/>',"refresh-cw":'<path d="M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"/><path d="M21 3v5h-5"/><path d="M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"/><path d="M8 16H3v5"/>',scissors:'<circle cx="6" cy="6" r="3"/><path d="M8.12 8.12 12 12"/><path d="M20 4 8.12 15.88"/><circle cx="6" cy="18" r="3"/><path d="M14.8 14.8 20 20"/>',search:'<path d="m21 21-4.34-4.34"/><circle cx="11" cy="11" r="8"/>',"search-x":'<path d="m13.5 8.5-5 5"/><path d="m8.5 8.5 5 5"/><circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/>',send:'<path d="M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z"/><path d="m21.854 2.147-10.94 10.939"/>',settings:'<path d="M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915"/><circle cx="12" cy="12" r="3"/>',share:'<path d="M12 2v13"/><path d="m16 6-4-4-4 4"/><path d="M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8"/>',"shield-check":'<path d="M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"/><path d="m9 12 2 2 4-4"/>',spinner:'<path d="M12 2v4"/><path d="m16.2 7.8 2.9-2.9"/><path d="M18 12h4"/><path d="m16.2 16.2 2.9 2.9"/><path d="M12 18v4"/><path d="m4.9 19.1 2.9-2.9"/><path d="M2 12h4"/><path d="m4.9 4.9 2.9 2.9"/>',square:'<rect width="18" height="18" x="3" y="3" rx="2"/>',star:'<path d="M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z"/>',"sticky-note":'<path d="M21 9a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 15 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2z"/><path d="M15 3v5a1 1 0 0 0 1 1h5"/>',table:'<path d="M12 3v18"/><rect width="18" height="18" x="3" y="3" rx="2"/><path d="M3 9h18"/><path d="M3 15h18"/>',"thumbs-up":'<path d="M7 10v12"/><path d="M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z"/>',tool:'<path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z"/>',trash:'<path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"/><path d="M3 6h18"/><path d="M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/>',"trash-2":'<path d="M10 11v6"/><path d="M14 11v6"/><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"/><path d="M3 6h18"/><path d="M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/>',"trending-up":'<path d="M16 7h6v6"/><path d="m22 7-8.5 8.5-5-5L2 17"/>',type:'<path d="M12 4v16"/><path d="M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2"/><path d="M9 20h6"/>',user:'<path d="M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"/><circle cx="12" cy="7" r="4"/>',"user-check":'<path d="m16 11 2 2 4-4"/><path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"/><circle cx="9" cy="7" r="4"/>',users:'<path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"/><path d="M16 3.128a4 4 0 0 1 0 7.744"/><path d="M22 21v-2a4 4 0 0 0-3-3.87"/><circle cx="9" cy="7" r="4"/>',"window-maximize":'<rect x="2" y="4" width="20" height="16" rx="2"/><path d="M2 9h20"/>',warning:'<path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"/><path d="M12 9v4"/><path d="M12 17h.01"/>',x:'<path d="M18 6 6 18"/><path d="m6 6 12 12"/>',zap:'<path d="M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z"/>',"zoom-in":'<circle cx="11" cy="11" r="8"/><line x1="21" x2="16.65" y1="21" y2="16.65"/><line x1="11" x2="11" y1="8" y2="14"/><line x1="8" x2="14" y1="11" y2="11"/>',"zoom-out":'<circle cx="11" cy="11" r="8"/><line x1="21" x2="16.65" y1="21" y2="16.65"/><line x1="8" x2="14" y1="11" y2="11"/>',history:'<path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"/><path d="M3 3v5h5"/><path d="M12 7v5l4 2"/>',"arrow-right":'<path d="M5 12h14"/><path d="m12 5 7 7-7 7"/>',brain:'<path d="M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z"/><path d="M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z"/><path d="M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4"/><path d="M17.599 6.5a3 3 0 0 0 .399-1.375"/><path d="M6.003 5.125A3 3 0 0 0 6.401 6.5"/><path d="M3.477 10.896a4 4 0 0 1 .585-.396"/><path d="M19.938 10.5a4 4 0 0 1 .585.396"/><path d="M6 18a4 4 0 0 1-1.967-.516"/><path d="M19.967 17.484A4 4 0 0 1 18 18"/>',bug:'<path d="m8 2 1.88 1.88"/><path d="M14.12 3.88 16 2"/><path d="M9 7.13v-1a3.003 3.003 0 1 1 6 0v1"/><path d="M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6"/><path d="M12 20v-9"/><path d="M6.53 9C4.6 8.8 3 7.1 3 5"/><path d="M6 13H2"/><path d="M3 21c0-2.1 1.7-3.9 3.8-4"/><path d="M20.97 5c0 2.1-1.6 3.8-3.5 4"/><path d="M22 13h-4"/><path d="M17.2 17c2.1.1 3.8 1.9 3.8 4"/>',circle:'<circle cx="12" cy="12" r="10"/>',clock:'<circle cx="12" cy="12" r="10"/><polyline points="12 6 12 12 16 14"/>',cloud:'<path d="M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z"/>',diamond:'<path d="M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41l-7.59-7.59a2.41 2.41 0 0 0-3.41 0Z"/>',eye:'<path d="M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"/><circle cx="12" cy="12" r="3"/>',"file-minus":'<path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/><path d="M9 15h6"/>',"gamepad-2":'<line x1="6" x2="10" y1="11" y2="11"/><line x1="8" x2="8" y1="9" y2="13"/><line x1="15" x2="15.01" y1="12" y2="12"/><line x1="18" x2="18.01" y1="10" y2="10"/><path d="M17.32 5H6.68a4 4 0 0 0-3.978 3.59c-.006.052-.01.101-.017.152C2.604 9.416 2 14.456 2 16a3 3 0 0 0 3 3c1 0 1.5-.5 2-1l1.414-1.414A2 2 0 0 1 9.828 16h4.344a2 2 0 0 1 1.414.586L17 18c.5.5 1 1 2 1a3 3 0 0 0 3-3c0-1.545-.604-6.584-.685-7.258-.007-.05-.011-.1-.017-.151A4 4 0 0 0 17.32 5z"/>',"git-merge":'<circle cx="18" cy="18" r="3"/><circle cx="6" cy="6" r="3"/><path d="M6 21V9a9 9 0 0 0 9 9"/>',"git-pull-request":'<circle cx="18" cy="18" r="3"/><circle cx="6" cy="6" r="3"/><path d="M13 6h3a2 2 0 0 1 2 2v7"/><path d="M6 9v12"/>',"hard-drive":'<line x1="22" x2="2" y1="12" y2="12"/><path d="M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z"/><line x1="6" x2="6.01" y1="16" y2="16"/><line x1="10" x2="10.01" y1="16" y2="16"/>',hash:'<line x1="4" x2="20" y1="9" y2="9"/><line x1="4" x2="20" y1="15" y2="15"/><line x1="10" x2="8" y1="3" y2="21"/><line x1="16" x2="14" y1="3" y2="21"/>',hexagon:'<path d="M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"/>',inbox:'<polyline points="22 12 16 12 14 15 10 15 8 12 2 12"/><path d="M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z"/>',link:'<path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/>',list:'<path d="M3 12h.01"/><path d="M3 18h.01"/><path d="M3 6h.01"/><path d="M8 12h13"/><path d="M8 18h13"/><path d="M8 6h13"/>',"mail-open":'<path d="M21.2 8.4c.5.38.8.97.8 1.6v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V10a2 2 0 0 1 .8-1.6l8-6a2 2 0 0 1 2.4 0l8 6Z"/><path d="m22 10-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 10"/>',"message-square-share":'<path d="M21 12v3a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h7"/><path d="M16 3h5v5"/><path d="m16 8 5-5"/>',plug:'<path d="M12 22v-5"/><path d="M9 8V2"/><path d="M15 8V2"/><path d="M18 8v5a6 6 0 0 1-6 6 6 6 0 0 1-6-6V8Z"/>',repeat:'<path d="m17 2 4 4-4 4"/><path d="M3 11v-1a4 4 0 0 1 4-4h14"/><path d="m7 22-4-4 4-4"/><path d="M21 13v1a4 4 0 0 1-4 4H3"/>',scan:'<path d="M3 7V5a2 2 0 0 1 2-2h2"/><path d="M17 3h2a2 2 0 0 1 2 2v2"/><path d="M21 17v2a2 2 0 0 1-2 2h-2"/><path d="M7 21H5a2 2 0 0 1-2-2v-2"/>',shield:'<path d="M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"/>',"shopping-cart":'<circle cx="8" cy="21" r="1"/><circle cx="19" cy="21" r="1"/><path d="M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12"/>',shuffle:'<path d="M2 18h1.4c1.3 0 2.5-.6 3.3-1.7l6.1-8.6c.7-1.1 2-1.7 3.3-1.7H22"/><path d="m18 2 4 4-4 4"/><path d="M2 6h1.9c1.5 0 2.9.9 3.6 2.2"/><path d="M22 18h-5.9c-1.3 0-2.6-.7-3.3-1.8l-.5-.8"/><path d="m18 14 4 4-4 4"/>',smile:'<circle cx="12" cy="12" r="10"/><path d="M8 14s1.5 2 4 2 4-2 4-2"/><line x1="9" x2="9.01" y1="9" y2="9"/><line x1="15" x2="15.01" y1="9" y2="9"/>',"smile-plus":'<path d="M22 11v1a10 10 0 1 1-9-10"/><path d="M8 14s1.5 2 4 2 4-2 4-2"/><line x1="9" x2="9.01" y1="9" y2="9"/><line x1="15" x2="15.01" y1="9" y2="9"/><path d="M16 5h6"/><path d="M19 2v6"/>',stop:'<rect x="6" y="6" width="12" height="12" rx="1"/>',terminal:'<polyline points="4 17 10 11 4 5"/><line x1="12" x2="20" y1="19" y2="19"/>',ticket:'<path d="M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z"/><path d="M13 5v2"/><path d="M13 17v2"/><path d="M13 11v2"/>',triangle:'<path d="M13.73 4a2 2 0 0 0-3.46 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z"/>',"undo-2":'<path d="M9 14 4 9l5-5"/><path d="M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11"/>',upload:'<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="17 8 12 3 7 8"/><line x1="12" x2="12" y1="3" y2="15"/>',"circle-stop":'<circle cx="12" cy="12" r="10"/><rect x="9" y="9" width="6" height="6" rx="1"/>',"git-fork":'<circle cx="12" cy="18" r="3"/><circle cx="6" cy="6" r="3"/><circle cx="18" cy="6" r="3"/><path d="M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9"/><path d="M12 12v3"/>',hourglass:'<path d="M5 22h14"/><path d="M5 2h14"/><path d="M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22"/><path d="M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2"/>',merge:'<path d="m8 6 4-4 4 4"/><path d="M12 2v10.3a4 4 0 0 1-1.172 2.872L4 22"/><path d="m20 22-5-5"/>',"shield-alert":'<path d="M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"/><path d="M12 8v4"/><path d="M12 16h.01"/>',timer:'<line x1="10" x2="14" y1="2" y2="2"/><line x1="12" x2="15" y1="14" y2="11"/><circle cx="12" cy="14" r="8"/>',add:'<path d="M5 12h14"/><path d="M12 5v14"/>',"check-circle":'<circle cx="12" cy="12" r="10"/><path d="m9 12 2 2 4-4"/>',"close-circle":'<circle cx="12" cy="12" r="10"/><path d="m15 9-6 6"/><path d="m9 9 6 6"/>',"info-circle":'<circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/>',"question-circle":'<circle cx="12" cy="12" r="10"/><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"/><path d="M12 17h.01"/>'};
|
|
241
|
+
`],Ce={activity:'<path d="M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2"/>',"alert-circle":'<circle cx="12" cy="12" r="10"/><line x1="12" x2="12" y1="8" y2="12"/><line x1="12" x2="12.01" y1="16" y2="16"/>',"alert-triangle":'<path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"/><path d="M12 9v4"/><path d="M12 17h.01"/>',anchor:'<path d="M12 22V8"/><path d="M5 12H2a10 10 0 0 0 20 0h-3"/><circle cx="12" cy="5" r="3"/>',"arrow-down":'<path d="M12 5v14"/><path d="m19 12-7 7-7-7"/>',"arrow-up":'<path d="m5 12 7-7 7 7"/><path d="M12 19V5"/>',"arrow-up-down":'<path d="m21 16-4 4-4-4"/><path d="M17 20V4"/><path d="m3 8 4-4 4 4"/><path d="M7 4v16"/>',bell:'<path d="M10.268 21a2 2 0 0 0 3.464 0"/><path d="M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326"/>',box:'<path d="M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z"/><path d="m3.3 7 8.7 5 8.7-5"/><path d="M12 22V12"/>',braces:'<path d="M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1"/><path d="M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1"/>',building:'<path d="M12 10h.01"/><path d="M12 14h.01"/><path d="M12 6h.01"/><path d="M16 10h.01"/><path d="M16 14h.01"/><path d="M16 6h.01"/><path d="M8 10h.01"/><path d="M8 14h.01"/><path d="M8 6h.01"/><path d="M9 22v-3a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v3"/><rect x="4" y="2" width="16" height="20" rx="2"/>',calendar:'<path d="M8 2v4"/><path d="M16 2v4"/><rect width="18" height="18" x="3" y="4" rx="2"/><path d="M3 10h18"/>',check:'<path d="M20 6 9 17l-5-5"/>',"check-square":'<path d="M21 10.656V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.344"/><path d="m9 11 3 3L22 4"/>',"chevron-down":'<path d="m6 9 6 6 6-6"/>',"chevron-left":'<path d="m15 18-6-6 6-6"/>',"chevron-right":'<path d="m9 18 6-6-6-6"/>',"chevron-up":'<path d="m18 15-6-6-6 6"/>',"circle-check":'<circle cx="12" cy="12" r="10"/><path d="m9 12 2 2 4-4"/>',"circle-question":'<circle cx="12" cy="12" r="10"/><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"/><path d="M12 17h.01"/>',clipboard:'<rect width="8" height="4" x="8" y="2" rx="1" ry="1"/><path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"/>',"clipboard-list":'<rect width="8" height="4" x="8" y="2" rx="1" ry="1"/><path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"/><path d="M12 11h4"/><path d="M12 16h4"/><path d="M8 11h.01"/><path d="M8 16h.01"/>',code:'<path d="m16 18 6-6-6-6"/><path d="m8 6-6 6 6 6"/>',copy:'<rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/>',cpu:'<path d="M12 20v2"/><path d="M12 2v2"/><path d="M17 20v2"/><path d="M17 2v2"/><path d="M2 12h2"/><path d="M2 17h2"/><path d="M2 7h2"/><path d="M20 12h2"/><path d="M20 17h2"/><path d="M20 7h2"/><path d="M7 20v2"/><path d="M7 2v2"/><rect x="4" y="4" width="16" height="16" rx="2"/><rect x="8" y="8" width="8" height="8" rx="1"/>',"credit-card":'<rect width="20" height="14" x="2" y="5" rx="2"/><line x1="2" x2="22" y1="10" y2="10"/>',cube:'<path d="M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z"/><path d="m3.3 7 8.7 5 8.7-5"/><path d="M12 22V12"/>',database:'<ellipse cx="12" cy="5" rx="9" ry="3"/><path d="M3 5V19A9 3 0 0 0 21 19V5"/><path d="M3 12A9 3 0 0 0 21 12"/>',document:'<path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 9H8"/><path d="M16 13H8"/><path d="M16 17H8"/>',download:'<path d="M12 15V3"/><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><path d="m7 10 5 5 5-5"/>',edit:'<path d="M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/><path d="M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z"/>',"exclamation-circle":'<circle cx="12" cy="12" r="10"/><line x1="12" x2="12" y1="8" y2="12"/><line x1="12" x2="12.01" y1="16" y2="16"/>',"external-link":'<path d="M15 3h6v6"/><path d="M10 14 21 3"/><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/>',file:'<path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/>',"file-text":'<path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 9H8"/><path d="M16 13H8"/><path d="M16 17H8"/>',filter:'<path d="M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z"/>',folder:'<path d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"/>',"folder-plus":'<path d="M12 10v6"/><path d="M9 13h6"/><path d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"/>',frame:'<line x1="22" x2="2" y1="6" y2="6"/><line x1="22" x2="2" y1="18" y2="18"/><line x1="6" x2="6" y1="2" y2="22"/><line x1="18" x2="18" y1="2" y2="22"/>',"git-branch":'<line x1="6" x2="6" y1="3" y2="15"/><circle cx="18" cy="6" r="3"/><circle cx="6" cy="18" r="3"/><path d="M18 9a9 9 0 0 1-9 9"/>',globe:'<circle cx="12" cy="12" r="10"/><path d="M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"/><path d="M2 12h20"/>',"grip-vertical":'<circle cx="9" cy="12" r="1"/><circle cx="9" cy="5" r="1"/><circle cx="9" cy="19" r="1"/><circle cx="15" cy="12" r="1"/><circle cx="15" cy="5" r="1"/><circle cx="15" cy="19" r="1"/>',hand:'<path d="M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2"/><path d="M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2"/><path d="M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8"/><path d="M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15"/>',heart:'<path d="M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5"/>',help:'<circle cx="12" cy="12" r="10"/><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"/><path d="M12 17h.01"/>',home:'<path d="M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8"/><path d="M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/>',image:'<rect width="18" height="18" x="3" y="3" rx="2" ry="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"/>',info:'<circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/>',key:'<path d="m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4"/><path d="m21 2-9.6 9.6"/><circle cx="7.5" cy="15.5" r="5.5"/>',layers:'<path d="M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z"/><path d="M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12"/><path d="M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17"/>',"layout-sidebar":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M9 3v18"/>',loader:'<path d="M12 2v4"/><path d="m16.2 7.8 2.9-2.9"/><path d="M18 12h4"/><path d="m16.2 16.2 2.9 2.9"/><path d="M12 18v4"/><path d="m4.9 19.1 2.9-2.9"/><path d="M2 12h4"/><path d="m4.9 4.9 2.9 2.9"/>',"log-in":'<path d="m10 17 5-5-5-5"/><path d="M15 12H3"/><path d="M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4"/>',"log-out":'<path d="m16 17 5-5-5-5"/><path d="M21 12H9"/><path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"/>',logout:'<path d="m16 17 5-5-5-5"/><path d="M21 12H9"/><path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"/>',mail:'<path d="m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7"/><rect x="2" y="4" width="20" height="16" rx="2"/>',"panel-left":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M9 3v18"/>',"square-pen":'<path d="M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/><path d="M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z"/>',maximize:'<path d="M8 3H5a2 2 0 0 0-2 2v3"/><path d="M21 8V5a2 2 0 0 0-2-2h-3"/><path d="M3 16v3a2 2 0 0 0 2 2h3"/><path d="M16 21h3a2 2 0 0 0 2-2v-3"/>',"maximize-2":'<path d="M15 3h6v6"/><path d="m21 3-7 7"/><path d="m3 21 7-7"/><path d="M9 21H3v-6"/>',menu:'<path d="M4 5h16"/><path d="M4 12h16"/><path d="M4 19h16"/>',"message-circle":'<path d="M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719"/>',"message-square":'<path d="M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z"/>',minimize:'<path d="M8 3v3a2 2 0 0 1-2 2H3"/><path d="M21 8h-3a2 2 0 0 1-2-2V3"/><path d="M3 16h3a2 2 0 0 1 2 2v3"/><path d="M16 21v-3a2 2 0 0 1 2-2h3"/>',minus:'<path d="M5 12h14"/>',"more-vertical":'<circle cx="12" cy="12" r="1"/><circle cx="12" cy="5" r="1"/><circle cx="12" cy="19" r="1"/>',"mouse-pointer":'<path d="M12.586 12.586 19 19"/><path d="M3.688 3.037a.497.497 0 0 0-.651.651l6.5 15.999a.501.501 0 0 0 .947-.062l1.569-6.083a2 2 0 0 1 1.448-1.479l6.124-1.579a.5.5 0 0 0 .063-.947z"/>',"mouse-pointer-click":'<path d="M14 4.1 12 6"/><path d="m5.1 8-2.9-.8"/><path d="m6 12-1.9 2"/><path d="M7.2 2.2 8 5.1"/><path d="M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z"/>',navigation:'<polygon points="3 11 22 2 13 21 11 13 3 11"/>',notification:'<path d="M10.268 21a2 2 0 0 0 3.464 0"/><path d="M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326"/>',"pen-tool":'<path d="M15.707 21.293a1 1 0 0 1-1.414 0l-1.586-1.586a1 1 0 0 1 0-1.414l5.586-5.586a1 1 0 0 1 1.414 0l1.586 1.586a1 1 0 0 1 0 1.414z"/><path d="m18 13-1.375-6.874a1 1 0 0 0-.746-.776L3.235 2.028a1 1 0 0 0-1.207 1.207L5.35 15.879a1 1 0 0 0 .776.746L13 18"/><path d="m2.3 2.3 7.286 7.286"/><circle cx="11" cy="11" r="2"/>',phone:'<path d="M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384"/>',play:'<path d="M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z"/>',plus:'<path d="M5 12h14"/><path d="M12 5v14"/>',radio:'<path d="M16.247 7.761a6 6 0 0 1 0 8.478"/><path d="M19.075 4.933a10 10 0 0 1 0 14.134"/><path d="M4.925 19.067a10 10 0 0 1 0-14.134"/><path d="M7.753 16.239a6 6 0 0 1 0-8.478"/><circle cx="12" cy="12" r="2"/>',"redo-2":'<path d="m15 14 5-5-5-5"/><path d="M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13"/>',"refresh-cw":'<path d="M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"/><path d="M21 3v5h-5"/><path d="M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"/><path d="M8 16H3v5"/>',scissors:'<circle cx="6" cy="6" r="3"/><path d="M8.12 8.12 12 12"/><path d="M20 4 8.12 15.88"/><circle cx="6" cy="18" r="3"/><path d="M14.8 14.8 20 20"/>',search:'<path d="m21 21-4.34-4.34"/><circle cx="11" cy="11" r="8"/>',"search-x":'<path d="m13.5 8.5-5 5"/><path d="m8.5 8.5 5 5"/><circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/>',send:'<path d="M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z"/><path d="m21.854 2.147-10.94 10.939"/>',settings:'<path d="M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915"/><circle cx="12" cy="12" r="3"/>',share:'<path d="M12 2v13"/><path d="m16 6-4-4-4 4"/><path d="M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8"/>',"shield-check":'<path d="M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"/><path d="m9 12 2 2 4-4"/>',spinner:'<path d="M12 2v4"/><path d="m16.2 7.8 2.9-2.9"/><path d="M18 12h4"/><path d="m16.2 16.2 2.9 2.9"/><path d="M12 18v4"/><path d="m4.9 19.1 2.9-2.9"/><path d="M2 12h4"/><path d="m4.9 4.9 2.9 2.9"/>',square:'<rect width="18" height="18" x="3" y="3" rx="2"/>',star:'<path d="M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z"/>',"sticky-note":'<path d="M21 9a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 15 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2z"/><path d="M15 3v5a1 1 0 0 0 1 1h5"/>',table:'<path d="M12 3v18"/><rect width="18" height="18" x="3" y="3" rx="2"/><path d="M3 9h18"/><path d="M3 15h18"/>',"thumbs-up":'<path d="M7 10v12"/><path d="M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z"/>',tool:'<path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z"/>',trash:'<path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"/><path d="M3 6h18"/><path d="M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/>',"trash-2":'<path d="M10 11v6"/><path d="M14 11v6"/><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"/><path d="M3 6h18"/><path d="M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/>',"trending-up":'<path d="M16 7h6v6"/><path d="m22 7-8.5 8.5-5-5L2 17"/>',type:'<path d="M12 4v16"/><path d="M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2"/><path d="M9 20h6"/>',user:'<path d="M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"/><circle cx="12" cy="7" r="4"/>',"user-check":'<path d="m16 11 2 2 4-4"/><path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"/><circle cx="9" cy="7" r="4"/>',users:'<path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"/><path d="M16 3.128a4 4 0 0 1 0 7.744"/><path d="M22 21v-2a4 4 0 0 0-3-3.87"/><circle cx="9" cy="7" r="4"/>',"window-maximize":'<rect x="2" y="4" width="20" height="16" rx="2"/><path d="M2 9h20"/>',warning:'<path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"/><path d="M12 9v4"/><path d="M12 17h.01"/>',x:'<path d="M18 6 6 18"/><path d="m6 6 12 12"/>',zap:'<path d="M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z"/>',"zoom-in":'<circle cx="11" cy="11" r="8"/><line x1="21" x2="16.65" y1="21" y2="16.65"/><line x1="11" x2="11" y1="8" y2="14"/><line x1="8" x2="14" y1="11" y2="11"/>',"zoom-out":'<circle cx="11" cy="11" r="8"/><line x1="21" x2="16.65" y1="21" y2="16.65"/><line x1="8" x2="14" y1="11" y2="11"/>',history:'<path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"/><path d="M3 3v5h5"/><path d="M12 7v5l4 2"/>',"arrow-right":'<path d="M5 12h14"/><path d="m12 5 7 7-7 7"/>',brain:'<path d="M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z"/><path d="M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z"/><path d="M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4"/><path d="M17.599 6.5a3 3 0 0 0 .399-1.375"/><path d="M6.003 5.125A3 3 0 0 0 6.401 6.5"/><path d="M3.477 10.896a4 4 0 0 1 .585-.396"/><path d="M19.938 10.5a4 4 0 0 1 .585.396"/><path d="M6 18a4 4 0 0 1-1.967-.516"/><path d="M19.967 17.484A4 4 0 0 1 18 18"/>',bug:'<path d="m8 2 1.88 1.88"/><path d="M14.12 3.88 16 2"/><path d="M9 7.13v-1a3.003 3.003 0 1 1 6 0v1"/><path d="M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6"/><path d="M12 20v-9"/><path d="M6.53 9C4.6 8.8 3 7.1 3 5"/><path d="M6 13H2"/><path d="M3 21c0-2.1 1.7-3.9 3.8-4"/><path d="M20.97 5c0 2.1-1.6 3.8-3.5 4"/><path d="M22 13h-4"/><path d="M17.2 17c2.1.1 3.8 1.9 3.8 4"/>',circle:'<circle cx="12" cy="12" r="10"/>',clock:'<circle cx="12" cy="12" r="10"/><polyline points="12 6 12 12 16 14"/>',cloud:'<path d="M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z"/>',diamond:'<path d="M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41l-7.59-7.59a2.41 2.41 0 0 0-3.41 0Z"/>',eye:'<path d="M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"/><circle cx="12" cy="12" r="3"/>',"file-minus":'<path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/><path d="M9 15h6"/>',"gamepad-2":'<line x1="6" x2="10" y1="11" y2="11"/><line x1="8" x2="8" y1="9" y2="13"/><line x1="15" x2="15.01" y1="12" y2="12"/><line x1="18" x2="18.01" y1="10" y2="10"/><path d="M17.32 5H6.68a4 4 0 0 0-3.978 3.59c-.006.052-.01.101-.017.152C2.604 9.416 2 14.456 2 16a3 3 0 0 0 3 3c1 0 1.5-.5 2-1l1.414-1.414A2 2 0 0 1 9.828 16h4.344a2 2 0 0 1 1.414.586L17 18c.5.5 1 1 2 1a3 3 0 0 0 3-3c0-1.545-.604-6.584-.685-7.258-.007-.05-.011-.1-.017-.151A4 4 0 0 0 17.32 5z"/>',"git-merge":'<circle cx="18" cy="18" r="3"/><circle cx="6" cy="6" r="3"/><path d="M6 21V9a9 9 0 0 0 9 9"/>',"git-pull-request":'<circle cx="18" cy="18" r="3"/><circle cx="6" cy="6" r="3"/><path d="M13 6h3a2 2 0 0 1 2 2v7"/><path d="M6 9v12"/>',"hard-drive":'<line x1="22" x2="2" y1="12" y2="12"/><path d="M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z"/><line x1="6" x2="6.01" y1="16" y2="16"/><line x1="10" x2="10.01" y1="16" y2="16"/>',hash:'<line x1="4" x2="20" y1="9" y2="9"/><line x1="4" x2="20" y1="15" y2="15"/><line x1="10" x2="8" y1="3" y2="21"/><line x1="16" x2="14" y1="3" y2="21"/>',hexagon:'<path d="M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"/>',inbox:'<polyline points="22 12 16 12 14 15 10 15 8 12 2 12"/><path d="M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z"/>',link:'<path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/>',list:'<path d="M3 12h.01"/><path d="M3 18h.01"/><path d="M3 6h.01"/><path d="M8 12h13"/><path d="M8 18h13"/><path d="M8 6h13"/>',"mail-open":'<path d="M21.2 8.4c.5.38.8.97.8 1.6v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V10a2 2 0 0 1 .8-1.6l8-6a2 2 0 0 1 2.4 0l8 6Z"/><path d="m22 10-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 10"/>',"message-square-share":'<path d="M21 12v3a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h7"/><path d="M16 3h5v5"/><path d="m16 8 5-5"/>',paperclip:'<path d="M13.234 20.252 21 12.3"/><path d="m16 6-8.414 8.586a2 2 0 0 0 0 2.828 2 2 0 0 0 2.828 0l8.414-8.586a4 4 0 0 0 0-5.656 4 4 0 0 0-5.656 0l-8.415 8.585a6 6 0 1 0 8.486 8.486"/>',plug:'<path d="M12 22v-5"/><path d="M9 8V2"/><path d="M15 8V2"/><path d="M18 8v5a6 6 0 0 1-6 6 6 6 0 0 1-6-6V8Z"/>',repeat:'<path d="m17 2 4 4-4 4"/><path d="M3 11v-1a4 4 0 0 1 4-4h14"/><path d="m7 22-4-4 4-4"/><path d="M21 13v1a4 4 0 0 1-4 4H3"/>',scan:'<path d="M3 7V5a2 2 0 0 1 2-2h2"/><path d="M17 3h2a2 2 0 0 1 2 2v2"/><path d="M21 17v2a2 2 0 0 1-2 2h-2"/><path d="M7 21H5a2 2 0 0 1-2-2v-2"/>',shield:'<path d="M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"/>',"shopping-cart":'<circle cx="8" cy="21" r="1"/><circle cx="19" cy="21" r="1"/><path d="M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12"/>',shuffle:'<path d="M2 18h1.4c1.3 0 2.5-.6 3.3-1.7l6.1-8.6c.7-1.1 2-1.7 3.3-1.7H22"/><path d="m18 2 4 4-4 4"/><path d="M2 6h1.9c1.5 0 2.9.9 3.6 2.2"/><path d="M22 18h-5.9c-1.3 0-2.6-.7-3.3-1.8l-.5-.8"/><path d="m18 14 4 4-4 4"/>',smile:'<circle cx="12" cy="12" r="10"/><path d="M8 14s1.5 2 4 2 4-2 4-2"/><line x1="9" x2="9.01" y1="9" y2="9"/><line x1="15" x2="15.01" y1="9" y2="9"/>',"smile-plus":'<path d="M22 11v1a10 10 0 1 1-9-10"/><path d="M8 14s1.5 2 4 2 4-2 4-2"/><line x1="9" x2="9.01" y1="9" y2="9"/><line x1="15" x2="15.01" y1="9" y2="9"/><path d="M16 5h6"/><path d="M19 2v6"/>',stop:'<rect x="6" y="6" width="12" height="12" rx="1"/>',terminal:'<polyline points="4 17 10 11 4 5"/><line x1="12" x2="20" y1="19" y2="19"/>',ticket:'<path d="M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z"/><path d="M13 5v2"/><path d="M13 17v2"/><path d="M13 11v2"/>',triangle:'<path d="M13.73 4a2 2 0 0 0-3.46 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z"/>',"undo-2":'<path d="M9 14 4 9l5-5"/><path d="M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11"/>',upload:'<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="17 8 12 3 7 8"/><line x1="12" x2="12" y1="3" y2="15"/>',"circle-stop":'<circle cx="12" cy="12" r="10"/><rect x="9" y="9" width="6" height="6" rx="1"/>',"git-fork":'<circle cx="12" cy="18" r="3"/><circle cx="6" cy="6" r="3"/><circle cx="18" cy="6" r="3"/><path d="M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9"/><path d="M12 12v3"/>',hourglass:'<path d="M5 22h14"/><path d="M5 2h14"/><path d="M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22"/><path d="M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2"/>',merge:'<path d="m8 6 4-4 4 4"/><path d="M12 2v10.3a4 4 0 0 1-1.172 2.872L4 22"/><path d="m20 22-5-5"/>',"shield-alert":'<path d="M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"/><path d="M12 8v4"/><path d="M12 16h.01"/>',timer:'<line x1="10" x2="14" y1="2" y2="2"/><line x1="12" x2="15" y1="14" y2="11"/><circle cx="12" cy="14" r="8"/>',add:'<path d="M5 12h14"/><path d="M12 5v14"/>',"check-circle":'<circle cx="12" cy="12" r="10"/><path d="m9 12 2 2 4-4"/>',"close-circle":'<circle cx="12" cy="12" r="10"/><path d="m15 9-6 6"/><path d="m9 9 6 6"/>',"info-circle":'<circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/>',"question-circle":'<circle cx="12" cy="12" r="10"/><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"/><path d="M12 17h.01"/>'};
|
|
242
242
|
/**
|
|
243
243
|
* @license
|
|
244
244
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
@@ -1054,6 +1054,7 @@ class lt{constructor(){this.settled=!1,this.promise=new Promise((e,t)=>{this._re
|
|
|
1054
1054
|
flex: 1;
|
|
1055
1055
|
min-height: 0;
|
|
1056
1056
|
min-width: 300px;
|
|
1057
|
+
position: relative;
|
|
1057
1058
|
}
|
|
1058
1059
|
|
|
1059
1060
|
.chatbot-container--with-sidebar,
|
|
@@ -1874,7 +1875,9 @@ class lt{constructor(){this.settled=!1,this.promise=new Promise((e,t)=>{this._re
|
|
|
1874
1875
|
}
|
|
1875
1876
|
|
|
1876
1877
|
.file-upload-area {
|
|
1877
|
-
display:
|
|
1878
|
+
display: flex;
|
|
1879
|
+
align-items: center;
|
|
1880
|
+
justify-content: center;
|
|
1878
1881
|
position: absolute;
|
|
1879
1882
|
top: 0;
|
|
1880
1883
|
left: 0;
|
|
@@ -1884,16 +1887,10 @@ class lt{constructor(){this.settled=!1,this.promise=new Promise((e,t)=>{this._re
|
|
|
1884
1887
|
border: 0.25rem dashed var(--chatbot-user-message-bg);
|
|
1885
1888
|
border-radius: var(--chatbot-radius);
|
|
1886
1889
|
z-index: 10;
|
|
1890
|
+
pointer-events: auto;
|
|
1887
1891
|
}
|
|
1888
1892
|
|
|
1889
|
-
.file-upload-area--
|
|
1890
|
-
display: flex;
|
|
1891
|
-
align-items: center;
|
|
1892
|
-
justify-content: center;
|
|
1893
|
-
}
|
|
1894
|
-
|
|
1895
|
-
.file-upload-area--drag-over {
|
|
1896
|
-
background-color: rgba(15, 98, 254, 0.1);
|
|
1893
|
+
.file-upload-area--dragging {
|
|
1897
1894
|
border-color: var(--chatbot-user-message-bg);
|
|
1898
1895
|
}
|
|
1899
1896
|
|
|
@@ -2949,15 +2946,15 @@ class lt{constructor(){this.settled=!1,this.promise=new Promise((e,t)=>{this._re
|
|
|
2949
2946
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
2950
2947
|
* SPDX-License-Identifier: MIT
|
|
2951
2948
|
*/
|
|
2952
|
-
function _t(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)}It.Image,It.Audio,It.Video,It.Document,It.Document,It.Document,It.Document,It.Archive,It.Archive,It.Code,It.Code,It.Code;const Rt={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 Nt(e){return e.startsWith("image/")}function Dt(e,t){const i=e.lastIndexOf(".");if(i>=0&&i<e.length-1)return e.slice(i+1).toUpperCase().slice(0,4);if(t){const e=t.indexOf("/");if(e>=0)return t.slice(e+1).toUpperCase().slice(0,4)}return"FILE"}function Lt(e,t){var
|
|
2949
|
+
function _t(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)}It.Image,It.Audio,It.Video,It.Document,It.Document,It.Document,It.Document,It.Archive,It.Archive,It.Code,It.Code,It.Code;const Rt={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 Nt(e){return e.startsWith("image/")}function Dt(e,t){const i=e.lastIndexOf(".");if(i>=0&&i<e.length-1)return e.slice(i+1).toUpperCase().slice(0,4);if(t){const e=t.indexOf("/");if(e>=0)return t.slice(e+1).toUpperCase().slice(0,4)}return"FILE"}function Lt(e,t,a){var o,s,r,l,c,d,p,b;const f=null===(o=e.text)||void 0===o?void 0:o.includes("[ERROR_START]"),v={error:!!e.error||f,introduction:!!e.introduction,[e.sender]:!0};return i`
|
|
2953
2950
|
<div
|
|
2954
|
-
class="message ${h(
|
|
2951
|
+
class="message ${h(v)}"
|
|
2955
2952
|
part="message"
|
|
2956
2953
|
data-sender="${e.sender}"
|
|
2957
2954
|
data-id="${e.id}"
|
|
2958
2955
|
>
|
|
2959
2956
|
<div class="message__content" part="message-content">
|
|
2960
|
-
${
|
|
2957
|
+
${f?
|
|
2961
2958
|
/**
|
|
2962
2959
|
* @license
|
|
2963
2960
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
@@ -2968,10 +2965,10 @@ function(e){const t=e.match(/\[ERROR_START\]\[ERROR_TITLE_START\]([\s\S]*?)\[ERR
|
|
|
2968
2965
|
${e?i`<div class="message__error-title" part="message-error-title">${e}</div>`:""}
|
|
2969
2966
|
<div class="message__error-description" part="message-error-description">${n}</div>
|
|
2970
2967
|
</div>
|
|
2971
|
-
`}return i`${e}`}(null!==(
|
|
2968
|
+
`}return i`${e}`}(null!==(r=null===(s=e.text)||void 0===s?void 0:s.trim())&&void 0!==r?r:""):(null===(l=null==e?void 0:e.metadata)||void 0===l?void 0:l.renderAsHtml)?u(null!==(d=null===(c=e.text)||void 0===c?void 0:c.trim())&&void 0!==d?d:""):u((null!==(b=null===(p=e.text)||void 0===p?void 0:p.trim())&&void 0!==b?b:"").replaceAll("\n","<br>"))}
|
|
2972
2969
|
</div>
|
|
2973
2970
|
${e.files&&e.files.length>0?i`
|
|
2974
|
-
<div class="message__attachments" part="message-attachments" role="list" aria-label="${
|
|
2971
|
+
<div class="message__attachments" part="message-attachments" role="list" aria-label="${a.messages.attachedFilesLabel}">
|
|
2975
2972
|
${e.files.map(e=>i`
|
|
2976
2973
|
<nr-dropdown
|
|
2977
2974
|
trigger="hover"
|
|
@@ -3034,8 +3031,8 @@ function(e){const t=e.match(/\[ERROR_START\]\[ERROR_TITLE_START\]([\s\S]*?)\[ERR
|
|
|
3034
3031
|
class="message__copy"
|
|
3035
3032
|
@click=${()=>t.onCopy(e)}
|
|
3036
3033
|
@keydown=${i=>t.onCopyKeydown(i,e)}
|
|
3037
|
-
title="${
|
|
3038
|
-
aria-label="${
|
|
3034
|
+
title="${a.messages.copyMessageLabel}"
|
|
3035
|
+
aria-label="${a.messages.copyMessageLabel}"
|
|
3039
3036
|
role="button"
|
|
3040
3037
|
tabindex="0"
|
|
3041
3038
|
></nr-icon>
|
|
@@ -3048,23 +3045,23 @@ function(e){const t=e.match(/\[ERROR_START\]\[ERROR_TITLE_START\]([\s\S]*?)\[ERR
|
|
|
3048
3045
|
part="retry-button"
|
|
3049
3046
|
@click=${()=>t.onRetry(e)}
|
|
3050
3047
|
@keydown=${t.onRetryKeydown}
|
|
3051
|
-
aria-label="${
|
|
3048
|
+
aria-label="${a.messages.retryMessageLabel}"
|
|
3052
3049
|
>
|
|
3053
|
-
${
|
|
3050
|
+
${a.messages.retryButton}
|
|
3054
3051
|
</nr-button>`:n}
|
|
3055
3052
|
</div>
|
|
3056
|
-
`}function jt(e,t,a,o){return i`
|
|
3053
|
+
`}function jt(e,t,a,o,s){return i`
|
|
3057
3054
|
<div class="messages" part="messages">
|
|
3058
|
-
${0===e.length?i`
|
|
3055
|
+
${0===e.length?function(e){return i`
|
|
3059
3056
|
<div class="empty-state" part="empty-state">
|
|
3060
3057
|
<slot name="empty-state">
|
|
3061
3058
|
<div class="empty-state__content">
|
|
3062
|
-
${
|
|
3059
|
+
${e.messages.startConversationLabel}
|
|
3063
3060
|
</div>
|
|
3064
3061
|
</slot>
|
|
3065
3062
|
</div>
|
|
3066
|
-
|
|
3067
|
-
${e.map(e=>Lt(e,o))}
|
|
3063
|
+
`}(s):n}
|
|
3064
|
+
${e.map(e=>Lt(e,o,s))}
|
|
3068
3065
|
${t}
|
|
3069
3066
|
${a}
|
|
3070
3067
|
</div>
|
|
@@ -3073,29 +3070,29 @@ function(e){const t=e.match(/\[ERROR_START\]\[ERROR_TITLE_START\]([\s\S]*?)\[ERR
|
|
|
3073
3070
|
* @license
|
|
3074
3071
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
3075
3072
|
* SPDX-License-Identifier: MIT
|
|
3076
|
-
*/function Ft(e,t,a){return t.length>0?i`
|
|
3073
|
+
*/function Ft(e,t,a,o){return t.length>0?i`
|
|
3077
3074
|
<div class="suggestion-container" part="suggestions">
|
|
3078
|
-
${t.map(e=>function(e,t){return i`
|
|
3079
|
-
<div
|
|
3080
|
-
class="suggestion ${h({"suggestion--disabled":!1===e.enabled})}"
|
|
3075
|
+
${t.map(e=>function(e,t,n){return i`
|
|
3076
|
+
<div
|
|
3077
|
+
class="suggestion ${h({"suggestion--disabled":!1===e.enabled})}"
|
|
3081
3078
|
part="suggestion"
|
|
3082
3079
|
role="button"
|
|
3083
3080
|
tabindex="0"
|
|
3084
3081
|
@click=${()=>t.onClick(e)}
|
|
3085
3082
|
@keydown=${t.onKeydown}
|
|
3086
3083
|
data-id="${e.id}"
|
|
3087
|
-
aria-label="${
|
|
3084
|
+
aria-label="${n.messages.suggestionPrefix}${e.text}"
|
|
3088
3085
|
>
|
|
3089
3086
|
${e.text}
|
|
3090
3087
|
</div>
|
|
3091
|
-
`}(e,a))}
|
|
3088
|
+
`}(e,a,o))}
|
|
3092
3089
|
</div>
|
|
3093
3090
|
`:n}
|
|
3094
3091
|
/**
|
|
3095
3092
|
* @license
|
|
3096
3093
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
3097
3094
|
* SPDX-License-Identifier: MIT
|
|
3098
|
-
*/function Bt(e,t,n){const
|
|
3095
|
+
*/function Bt(e,t,n,a){const o=(e,t)=>{const i=e.lastIndexOf(".");if(i>=0&&i<e.length-1)return e.slice(i+1).toUpperCase().slice(0,4);if(t){const e=t.indexOf("/");if(e>=0)return t.slice(e+1).toUpperCase().slice(0,4)}return"FILE"},s=e=>e.startsWith("image/");return i`
|
|
3099
3096
|
<div class="context-tags-row" part="context-tags">
|
|
3100
3097
|
${b(e,e=>e.id,e=>i`
|
|
3101
3098
|
<nr-dropdown
|
|
@@ -3110,29 +3107,29 @@ function(e){const t=e.match(/\[ERROR_START\]\[ERROR_TITLE_START\]([\s\S]*?)\[ERR
|
|
|
3110
3107
|
role="button"
|
|
3111
3108
|
tabindex="0"
|
|
3112
3109
|
title="${e.name}"
|
|
3113
|
-
@click=${()=>null==
|
|
3110
|
+
@click=${()=>null==a?void 0:a(e)}
|
|
3114
3111
|
>
|
|
3115
|
-
${
|
|
3112
|
+
${s(e.mimeType)&&(e.previewUrl||e.url)?i`
|
|
3116
3113
|
<img
|
|
3117
3114
|
class="file-thumb__image"
|
|
3118
3115
|
src="${e.previewUrl||e.url}"
|
|
3119
3116
|
alt="${e.name}"
|
|
3120
3117
|
/>
|
|
3121
3118
|
`:i`
|
|
3122
|
-
<div class="file-thumb__ext" data-ext="${
|
|
3123
|
-
<span class="file-thumb__ext-label">${
|
|
3119
|
+
<div class="file-thumb__ext" data-ext="${o(e.name,e.mimeType)}">
|
|
3120
|
+
<span class="file-thumb__ext-label">${o(e.name,e.mimeType)}</span>
|
|
3124
3121
|
</div>
|
|
3125
3122
|
`}
|
|
3126
3123
|
${e.isUploading?i`
|
|
3127
|
-
<div class="file-thumb__spinner" aria-label="${
|
|
3124
|
+
<div class="file-thumb__spinner" aria-label="${n.input.uploadingLabel}">
|
|
3128
3125
|
<span class="file-thumb__spinner-ring"></span>
|
|
3129
3126
|
</div>
|
|
3130
3127
|
`:""}
|
|
3131
3128
|
<button
|
|
3132
3129
|
type="button"
|
|
3133
3130
|
class="file-thumb__remove"
|
|
3134
|
-
aria-label="${
|
|
3135
|
-
title="${
|
|
3131
|
+
aria-label="${n.input.removeFileLabel}"
|
|
3132
|
+
title="${n.input.removeFileLabel}"
|
|
3136
3133
|
@click=${i=>{i.stopPropagation(),t(e.id)}}
|
|
3137
3134
|
>
|
|
3138
3135
|
<svg width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round">
|
|
@@ -3143,22 +3140,22 @@ function(e){const t=e.match(/\[ERROR_START\]\[ERROR_TITLE_START\]([\s\S]*?)\[ERR
|
|
|
3143
3140
|
</div>
|
|
3144
3141
|
|
|
3145
3142
|
<div slot="content" class="file-preview-content">
|
|
3146
|
-
${
|
|
3143
|
+
${s(e.mimeType)&&(e.url||e.previewUrl)?i`
|
|
3147
3144
|
<img
|
|
3148
3145
|
src="${e.previewUrl||e.url}"
|
|
3149
3146
|
alt="${e.name}"
|
|
3150
3147
|
class="file-preview-image"
|
|
3151
3148
|
/>
|
|
3152
3149
|
`:i`
|
|
3153
|
-
<div class="file-preview-ext" data-ext="${
|
|
3154
|
-
${
|
|
3150
|
+
<div class="file-preview-ext" data-ext="${o(e.name,e.mimeType)}">
|
|
3151
|
+
${o(e.name,e.mimeType)}
|
|
3155
3152
|
</div>
|
|
3156
3153
|
`}
|
|
3157
3154
|
<div class="file-preview-info">
|
|
3158
3155
|
<div class="file-preview-name" title="${e.name}">${e.name}</div>
|
|
3159
3156
|
<div class="file-preview-details">
|
|
3160
3157
|
<span>${(e=>{if(0===e)return"0 Bytes";const t=Math.floor(Math.log(e)/Math.log(1024));return Math.round(e/Math.pow(1024,t)*100)/100+" "+["Bytes","KB","MB","GB"][t]})(e.size)}</span>
|
|
3161
|
-
${e.isUploading?i`<span> · ${
|
|
3158
|
+
${e.isUploading?i`<span> · ${n.input.uploadingProgress}</span>`:""}
|
|
3162
3159
|
</div>
|
|
3163
3160
|
</div>
|
|
3164
3161
|
</div>
|
|
@@ -3178,17 +3175,17 @@ function(e){const t=e.match(/\[ERROR_START\]\[ERROR_TITLE_START\]([\s\S]*?)\[ERR
|
|
|
3178
3175
|
?disabled=${e.disabled}
|
|
3179
3176
|
@nr-dropdown-item-click=${t.onFileDropdownClick}
|
|
3180
3177
|
>
|
|
3181
|
-
<nr-button
|
|
3178
|
+
<nr-button
|
|
3182
3179
|
slot="trigger"
|
|
3183
3180
|
part="file-button"
|
|
3184
3181
|
type="default"
|
|
3185
3182
|
size="small"
|
|
3186
|
-
.icon=${["
|
|
3183
|
+
.icon=${["paperclip"]}
|
|
3187
3184
|
?disabled=${e.disabled}
|
|
3188
|
-
aria-label="${
|
|
3189
|
-
title="${
|
|
3185
|
+
aria-label="${e.i18n.input.attachFilesAriaLabel}"
|
|
3186
|
+
title="${e.i18n.input.attachFilesAriaLabel}"
|
|
3190
3187
|
>
|
|
3191
|
-
|
|
3188
|
+
${e.i18n.input.attachButton}
|
|
3192
3189
|
</nr-button>
|
|
3193
3190
|
</nr-dropdown>
|
|
3194
3191
|
`}(e,t):n}
|
|
@@ -3201,12 +3198,12 @@ function(e){const t=e.match(/\[ERROR_START\]\[ERROR_TITLE_START\]([\s\S]*?)\[ERR
|
|
|
3201
3198
|
size="small"
|
|
3202
3199
|
?disabled=${e.disabled}
|
|
3203
3200
|
searchable
|
|
3204
|
-
search-placeholder="${
|
|
3201
|
+
search-placeholder="${e.i18n.modules.moduleSearchPlaceholder}"
|
|
3205
3202
|
use-custom-selected-display
|
|
3206
3203
|
part="module-select"
|
|
3207
3204
|
class="module-select"
|
|
3208
3205
|
@nr-change=${t.onModuleChange}
|
|
3209
|
-
aria-label="${
|
|
3206
|
+
aria-label="${e.i18n.modules.moduleSelectAriaLabel}"
|
|
3210
3207
|
>
|
|
3211
3208
|
<span slot="selected-display">
|
|
3212
3209
|
${e.renderModuleDisplay()}
|
|
@@ -3220,10 +3217,10 @@ function(e){const t=e.match(/\[ERROR_START\]\[ERROR_TITLE_START\]([\s\S]*?)\[ERR
|
|
|
3220
3217
|
<!-- Speech-to-text: mic + keyboard indicator -->
|
|
3221
3218
|
<button
|
|
3222
3219
|
class="audio-mic-btn"
|
|
3223
|
-
title="${
|
|
3220
|
+
title="${e.i18n.audio.recordSpeechLabel}"
|
|
3224
3221
|
?disabled=${e.disabled}
|
|
3225
3222
|
@click=${()=>{var e;return null===(e=t.onAudioStart)||void 0===e?void 0:e.call(t,"transcribe")}}
|
|
3226
|
-
aria-label="${
|
|
3223
|
+
aria-label="${e.i18n.audio.recordSpeechLabel}"
|
|
3227
3224
|
>
|
|
3228
3225
|
<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
3229
3226
|
<path d="M12 1a3 3 0 00-3 3v8a3 3 0 006 0V4a3 3 0 00-3-3z"/>
|
|
@@ -3238,10 +3235,10 @@ function(e){const t=e.match(/\[ERROR_START\]\[ERROR_TITLE_START\]([\s\S]*?)\[ERR
|
|
|
3238
3235
|
<!-- Voice message: mic + waveform indicator -->
|
|
3239
3236
|
<button
|
|
3240
3237
|
class="audio-mic-btn"
|
|
3241
|
-
title="${
|
|
3238
|
+
title="${e.i18n.audio.sendVoiceMessageLabel}"
|
|
3242
3239
|
?disabled=${e.disabled}
|
|
3243
3240
|
@click=${()=>{var e;return null===(e=t.onAudioStart)||void 0===e?void 0:e.call(t,"message")}}
|
|
3244
|
-
aria-label="${
|
|
3241
|
+
aria-label="${e.i18n.audio.sendVoiceMessageLabel}"
|
|
3245
3242
|
>
|
|
3246
3243
|
<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
3247
3244
|
<path d="M12 1a3 3 0 00-3 3v8a3 3 0 006 0V4a3 3 0 00-3-3z"/>
|
|
@@ -3262,10 +3259,10 @@ function(e){const t=e.match(/\[ERROR_START\]\[ERROR_TITLE_START\]([\s\S]*?)\[ERR
|
|
|
3262
3259
|
.iconRight=${e.isQueryRunning?"square":"arrow-up"}
|
|
3263
3260
|
@click=${e.isQueryRunning?t.onStop:t.onSend}
|
|
3264
3261
|
@keydown=${t.onSendKeydown}
|
|
3265
|
-
aria-label="${e.isQueryRunning?
|
|
3266
|
-
title="${e.isQueryRunning?
|
|
3262
|
+
aria-label="${e.isQueryRunning?e.i18n.send.stopQueryLabel:e.i18n.send.sendMessageLabel}"
|
|
3263
|
+
title="${e.isQueryRunning?e.i18n.send.stopQueryLabel:e.i18n.send.sendMessageLabel}"
|
|
3267
3264
|
>
|
|
3268
|
-
${e.isQueryRunning?
|
|
3265
|
+
${e.isQueryRunning?e.i18n.send.stopButton:e.i18n.send.sendButton}
|
|
3269
3266
|
</nr-button>
|
|
3270
3267
|
`}(e,t):n}
|
|
3271
3268
|
</div>
|
|
@@ -3273,7 +3270,7 @@ function(e){const t=e.match(/\[ERROR_START\]\[ERROR_TITLE_START\]([\s\S]*?)\[ERR
|
|
|
3273
3270
|
`}function Vt(e,t){return e.audioRecording.active?i`
|
|
3274
3271
|
<div class="input-box" part="input-box">
|
|
3275
3272
|
<div class="input-container" part="input-container">
|
|
3276
|
-
${function(e,t){const{duration:n,bars:a}=e.audioRecording,o="transcribe"===e.audioMode,s=
|
|
3273
|
+
${function(e,t){const{duration:n,bars:a}=e.audioRecording,o="transcribe"===e.audioMode,s=o?e.i18n.audio.convertToTextLabel:e.i18n.audio.sendAsVoiceMessageLabel,r=o?i`<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
3277
3274
|
<rect x="2" y="3" width="20" height="14" rx="2"/><path d="M8 21h8M12 17v4"/>
|
|
3278
3275
|
<path d="M7 10h2l2 3 2-6 2 3h2"/>
|
|
3279
3276
|
</svg>`:i`<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5">
|
|
@@ -3282,9 +3279,9 @@ function(e){const t=e.match(/\[ERROR_START\]\[ERROR_TITLE_START\]([\s\S]*?)\[ERR
|
|
|
3282
3279
|
<div class="audio-recording-bar">
|
|
3283
3280
|
<button
|
|
3284
3281
|
class="audio-rec-cancel"
|
|
3285
|
-
title="${
|
|
3282
|
+
title="${e.i18n.audio.cancelRecordingLabel}"
|
|
3286
3283
|
@click=${t.onAudioCancel}
|
|
3287
|
-
aria-label="${
|
|
3284
|
+
aria-label="${e.i18n.audio.cancelRecordingLabel}"
|
|
3288
3285
|
>
|
|
3289
3286
|
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
3290
3287
|
<polyline points="3 6 5 6 21 6"/>
|
|
@@ -3304,7 +3301,7 @@ function(e){const t=e.match(/\[ERROR_START\]\[ERROR_TITLE_START\]([\s\S]*?)\[ERR
|
|
|
3304
3301
|
</div>
|
|
3305
3302
|
|
|
3306
3303
|
<span class="audio-rec-mode-label">
|
|
3307
|
-
${
|
|
3304
|
+
${o?e.i18n.audio.speechToTextLabel:e.i18n.audio.voiceMessageLabel}
|
|
3308
3305
|
</span>
|
|
3309
3306
|
|
|
3310
3307
|
<button
|
|
@@ -3323,7 +3320,7 @@ function(e){const t=e.match(/\[ERROR_START\]\[ERROR_TITLE_START\]([\s\S]*?)\[ERR
|
|
|
3323
3320
|
<div class="input-box" part="input-box">
|
|
3324
3321
|
<div class="input-container" part="input-container">
|
|
3325
3322
|
<!-- Context tags -->
|
|
3326
|
-
${e.uploadedFiles.length>0?Bt(e.uploadedFiles,t.onFileRemove,t.onFileClick):n}
|
|
3323
|
+
${e.uploadedFiles.length>0?Bt(e.uploadedFiles,t.onFileRemove,e.i18n,t.onFileClick):n}
|
|
3327
3324
|
|
|
3328
3325
|
<!-- Input area -->
|
|
3329
3326
|
<div class="input-row">
|
|
@@ -3333,7 +3330,7 @@ function(e){const t=e.match(/\[ERROR_START\]\[ERROR_TITLE_START\]([\s\S]*?)\[ERR
|
|
|
3333
3330
|
contenteditable="true"
|
|
3334
3331
|
role="textbox"
|
|
3335
3332
|
aria-multiline="true"
|
|
3336
|
-
aria-label="${
|
|
3333
|
+
aria-label="${e.i18n.input.chatInputAriaLabel}"
|
|
3337
3334
|
data-placeholder="${e.placeholder}"
|
|
3338
3335
|
@input=${t.onInput}
|
|
3339
3336
|
@keydown=${t.onKeydown}
|
|
@@ -3368,13 +3365,13 @@ function(e){const t=e.match(/\[ERROR_START\]\[ERROR_TITLE_START\]([\s\S]*?)\[ERR
|
|
|
3368
3365
|
@blur=${t=>{const i=t.target.value.trim();i&&i!==e.title?n.onRenameThread(e.id,i):n.onRenameThread(e.id,e.title||"")}}
|
|
3369
3366
|
/>
|
|
3370
3367
|
`:i`
|
|
3371
|
-
<div class="thread-item__title">${e.title||
|
|
3368
|
+
<div class="thread-item__title">${e.title||t.i18n.threads.newChatTitle}</div>
|
|
3372
3369
|
`}
|
|
3373
3370
|
<div class="thread-item__actions">
|
|
3374
3371
|
${n.onBookmarkThread&&e.bookmarked?i`
|
|
3375
3372
|
<button
|
|
3376
3373
|
class="thread-item__action-btn thread-item__bookmark--active"
|
|
3377
|
-
title="${
|
|
3374
|
+
title="${t.i18n.threads.removeBookmarkLabel}"
|
|
3378
3375
|
@click=${t=>{t.stopPropagation(),n.onBookmarkThread(e.id)}}
|
|
3379
3376
|
part="thread-bookmark"
|
|
3380
3377
|
>
|
|
@@ -3389,14 +3386,14 @@ function(e){const t=e.match(/\[ERROR_START\]\[ERROR_TITLE_START\]([\s\S]*?)\[ERR
|
|
|
3389
3386
|
auto-close
|
|
3390
3387
|
@click=${e=>e.stopPropagation()}
|
|
3391
3388
|
@nr-dropdown-item-click=${t=>{var i,a;const o=null===(a=null===(i=t.detail)||void 0===i?void 0:i.item)||void 0===a?void 0:a.id;"rename"===o&&n.onRenameThread?t.target.dispatchEvent(new CustomEvent("nr-thread-edit",{bubbles:!0,composed:!0,detail:{threadId:e.id}})):"bookmark"===o&&n.onBookmarkThread?n.onBookmarkThread(e.id):"delete"===o&&n.onDeleteThread&&n.onDeleteThread(e.id)}}
|
|
3392
|
-
.items=${[...n.onRenameThread?[{id:"rename",label:
|
|
3389
|
+
.items=${[...n.onRenameThread?[{id:"rename",label:t.i18n.threads.renameLabel}]:[],...n.onBookmarkThread?[{id:"bookmark",label:e.bookmarked?t.i18n.threads.removeBookmarkLabel:t.i18n.threads.bookmarkLabel}]:[],...n.onDeleteThread?[{id:"delete",label:t.i18n.threads.deleteLabel}]:[]]}
|
|
3393
3390
|
>
|
|
3394
3391
|
<button
|
|
3395
3392
|
slot="trigger"
|
|
3396
3393
|
class="thread-item__action-btn thread-item__menu"
|
|
3397
|
-
title="${
|
|
3394
|
+
title="${t.i18n.threads.moreOptionsLabel}"
|
|
3398
3395
|
part="thread-menu"
|
|
3399
|
-
aria-label="${
|
|
3396
|
+
aria-label="${t.i18n.threads.moreOptionsLabel}"
|
|
3400
3397
|
>
|
|
3401
3398
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" stroke="none"><circle cx="5" cy="12" r="1.8"/><circle cx="12" cy="12" r="1.8"/><circle cx="19" cy="12" r="1.8"/></svg>
|
|
3402
3399
|
</button>
|
|
@@ -3481,16 +3478,16 @@ function(e){if(0===e)return"0 Bytes";const t=Math.floor(Math.log(e)/Math.log(102
|
|
|
3481
3478
|
size="small"
|
|
3482
3479
|
.icon=${["copy"]}
|
|
3483
3480
|
@click=${()=>t.onCopy(o)}
|
|
3484
|
-
title="${
|
|
3485
|
-
aria-label="${
|
|
3481
|
+
title="${e.i18n.artifactPanel.copyCodeLabel}"
|
|
3482
|
+
aria-label="${e.i18n.artifactPanel.copyCodeLabel}"
|
|
3486
3483
|
></nr-button>
|
|
3487
3484
|
<nr-button
|
|
3488
3485
|
type="text"
|
|
3489
3486
|
size="small"
|
|
3490
3487
|
.icon=${["x"]}
|
|
3491
3488
|
@click=${t.onClose}
|
|
3492
|
-
title="${
|
|
3493
|
-
aria-label="${
|
|
3489
|
+
title="${e.i18n.artifactPanel.closePanelLabel}"
|
|
3490
|
+
aria-label="${e.i18n.artifactPanel.closePanelLabel}"
|
|
3494
3491
|
></nr-button>
|
|
3495
3492
|
</div>
|
|
3496
3493
|
</div>
|
|
@@ -3506,7 +3503,7 @@ function(e){if(0===e)return"0 Bytes";const t=Math.floor(Math.log(e)/Math.log(102
|
|
|
3506
3503
|
* SPDX-License-Identifier: MIT
|
|
3507
3504
|
*/function Wt(e,t){return!1!==e.showMessages?i`
|
|
3508
3505
|
<div class="chatbot-content" part="content">
|
|
3509
|
-
${jt(e.messages,Ft(e.chatStarted,e.suggestions,t.suggestion),e.isTyping?function(e,t,a){if(!e)return n;const o=t===Mt.Dots?i`
|
|
3506
|
+
${jt(e.messages,Ft(e.chatStarted,e.suggestions,t.suggestion,e.i18n),e.isTyping?function(e,t,a){if(!e)return n;const o=t===Mt.Dots?i`
|
|
3510
3507
|
<div class="dots">
|
|
3511
3508
|
<span></span>
|
|
3512
3509
|
<span></span>
|
|
@@ -3519,20 +3516,25 @@ function(e){if(0===e)return"0 Bytes";const t=Math.floor(Math.log(e)/Math.log(102
|
|
|
3519
3516
|
${a?i`<span class="loading-text">${a.split("").map((e,t)=>i`<span class="loading-text__char" style="animation-delay:${.04*t}s">${" "===e?" ":e}</span>`)}</span>`:n}
|
|
3520
3517
|
</div>
|
|
3521
3518
|
</div>
|
|
3522
|
-
`}(e.isTyping,e.loadingIndicator||Mt.Spinner,e.loadingText):n,t.message)}
|
|
3519
|
+
`}(e.isTyping,e.loadingIndicator||Mt.Spinner,e.loadingText):n,t.message,e.i18n)}
|
|
3523
3520
|
<slot name="messages"></slot>
|
|
3524
3521
|
</div>
|
|
3525
3522
|
`:e.suggestions&&e.suggestions.length>0?i`
|
|
3526
3523
|
<div class="input-only-suggestions" part="input-only-suggestions">
|
|
3527
|
-
${Ft(0,e.suggestions,t.suggestion)}
|
|
3528
|
-
</div>
|
|
3529
|
-
`:n}function Kt(e,t){var a;const o=e.enableArtifacts&&(null===(a=e.artifactPanel)||void 0===a?void 0:a.isOpen);return i`
|
|
3530
|
-
<div class="chatbot-container ${h({"chatbot-container--with-sidebar":e.enableThreads&&e.isThreadSidebarOpen,"chatbot-container--with-artifact-panel":!!o})}" part="container"
|
|
3524
|
+
${Ft(0,e.suggestions,t.suggestion,e.i18n)}
|
|
3525
|
+
</div>
|
|
3526
|
+
`:n}function Kt(e,t){var a;const o=e.enableArtifacts&&(null===(a=e.artifactPanel)||void 0===a?void 0:a.isOpen),s=e.enableFileUpload?t.fileUploadArea:void 0;return i`
|
|
3527
|
+
<div class="chatbot-container ${h({"chatbot-container--with-sidebar":e.enableThreads&&e.isThreadSidebarOpen,"chatbot-container--with-artifact-panel":!!o})}" part="container"
|
|
3528
|
+
@dragenter=${null==s?void 0:s.onDragEnter}
|
|
3529
|
+
@dragover=${null==s?void 0:s.onDragOver}
|
|
3530
|
+
@dragleave=${null==s?void 0:s.onDragLeave}
|
|
3531
|
+
@drop=${null==s?void 0:s.onDrop}
|
|
3532
|
+
>
|
|
3531
3533
|
|
|
3532
3534
|
${e.enableThreads&&e.isThreadSidebarOpen&&e.threadSidebar&&t.threadSidebar?function(e,t){const a=e.threads.filter(e=>e.bookmarked),o=e.threads.filter(e=>!e.bookmarked);return i`
|
|
3533
3535
|
<div class="thread-sidebar" part="thread-sidebar">
|
|
3534
3536
|
<div class="thread-sidebar__header">
|
|
3535
|
-
<h3>${
|
|
3537
|
+
<h3>${e.i18n.threads.conversationsTitle}</h3>
|
|
3536
3538
|
</div>
|
|
3537
3539
|
|
|
3538
3540
|
<div class="thread-list">
|
|
@@ -3540,18 +3542,18 @@ function(e){if(0===e)return"0 Bytes";const t=Math.floor(Math.log(e)/Math.log(102
|
|
|
3540
3542
|
<div class="thread-section" part="thread-section-bookmarks">
|
|
3541
3543
|
<div class="thread-section__label">
|
|
3542
3544
|
<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="currentColor" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M19 21l-7-5-7 5V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z"/></svg>
|
|
3543
|
-
${
|
|
3545
|
+
${e.i18n.threads.bookmarksLabel}
|
|
3544
3546
|
</div>
|
|
3545
3547
|
${b(a,e=>e.id,i=>Ht(i,e,t))}
|
|
3546
3548
|
</div>
|
|
3547
3549
|
`:n}
|
|
3548
3550
|
${o.length>0||0===a.length?i`
|
|
3549
3551
|
${a.length>0?i`
|
|
3550
|
-
<div class="thread-section__label">${
|
|
3552
|
+
<div class="thread-section__label">${e.i18n.threads.allConversationsLabel}</div>
|
|
3551
3553
|
`:n}
|
|
3552
3554
|
${b(o,e=>e.id,i=>Ht(i,e,t))}
|
|
3553
3555
|
${0===o.length&&0===a.length?i`
|
|
3554
|
-
<p class="empty-msg">${
|
|
3556
|
+
<p class="empty-msg">${e.i18n.threads.noConversationsLabel}</p>
|
|
3555
3557
|
`:n}
|
|
3556
3558
|
`:n}
|
|
3557
3559
|
</div>
|
|
@@ -3573,8 +3575,8 @@ function(e){if(0===e)return"0 Bytes";const t=Math.floor(Math.log(e)/Math.log(102
|
|
|
3573
3575
|
size="small"
|
|
3574
3576
|
.icon=${["panel-left"]}
|
|
3575
3577
|
@click=${t.onToggleThreadSidebar}
|
|
3576
|
-
title="${
|
|
3577
|
-
aria-label="${
|
|
3578
|
+
title="${e.isThreadSidebarOpen?e.i18n.threads.hideThreadsLabel:e.i18n.threads.showThreadsLabel}"
|
|
3579
|
+
aria-label="${e.isThreadSidebarOpen?e.i18n.threads.hideThreadsLabel:e.i18n.threads.showThreadsLabel}"
|
|
3578
3580
|
></nr-button>
|
|
3579
3581
|
${e.enableThreadCreation&&e.messages.length>0?i`
|
|
3580
3582
|
<nr-button
|
|
@@ -3582,8 +3584,8 @@ function(e){if(0===e)return"0 Bytes";const t=Math.floor(Math.log(e)/Math.log(102
|
|
|
3582
3584
|
size="small"
|
|
3583
3585
|
.icon=${["square-pen"]}
|
|
3584
3586
|
@click=${null===(a=t.threadSidebar)||void 0===a?void 0:a.onCreateNew}
|
|
3585
|
-
title="${
|
|
3586
|
-
aria-label="${
|
|
3587
|
+
title="${e.i18n.threads.newConversationLabel}"
|
|
3588
|
+
aria-label="${e.i18n.threads.newConversationLabel}"
|
|
3587
3589
|
></nr-button>
|
|
3588
3590
|
`:""}
|
|
3589
3591
|
</div>
|
|
@@ -3600,18 +3602,15 @@ function(e){if(0===e)return"0 Bytes";const t=Math.floor(Math.log(e)/Math.log(102
|
|
|
3600
3602
|
|
|
3601
3603
|
${o&&e.artifactPanel&&t.artifactPanel?Gt(e.artifactPanel,t.artifactPanel):""}
|
|
3602
3604
|
|
|
3603
|
-
${e.isDragging?function(e
|
|
3604
|
-
<div
|
|
3605
|
+
${e.isDragging?function(e){return i`
|
|
3606
|
+
<div
|
|
3605
3607
|
class="file-upload-area ${e.isDragging?"file-upload-area--dragging":""}"
|
|
3606
3608
|
part="file-upload-area"
|
|
3607
|
-
@drop=${t.onDrop}
|
|
3608
|
-
@dragover=${t.onDragOver}
|
|
3609
|
-
@dragleave=${t.onDragLeave}
|
|
3610
3609
|
>
|
|
3611
3610
|
<div class="file-upload-area__content">
|
|
3612
|
-
<
|
|
3611
|
+
<nr-icon name="upload" size="xlarge"></nr-icon>
|
|
3613
3612
|
<div class="file-upload-area__text">
|
|
3614
|
-
${
|
|
3613
|
+
${e.label}
|
|
3615
3614
|
</div>
|
|
3616
3615
|
</div>
|
|
3617
3616
|
</div>
|
|
@@ -3620,91 +3619,91 @@ function(e){if(0===e)return"0 Bytes";const t=Math.floor(Math.log(e)/Math.log(102
|
|
|
3620
3619
|
* @license
|
|
3621
3620
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
3622
3621
|
* SPDX-License-Identifier: MIT
|
|
3623
|
-
*/({isDragging:e.isDragging
|
|
3622
|
+
*/({isDragging:e.isDragging,label:e.i18n.input.dropFilesHere}):""}
|
|
3624
3623
|
|
|
3625
3624
|
${e.urlModal&&t.urlModal?function(e,t){return i`
|
|
3626
|
-
<nr-modal
|
|
3625
|
+
<nr-modal
|
|
3627
3626
|
?open=${e.isOpen}
|
|
3628
3627
|
@nr-modal-close=${t.onClose}
|
|
3629
3628
|
part="url-modal"
|
|
3630
3629
|
>
|
|
3631
|
-
<div slot="header">${
|
|
3632
|
-
|
|
3630
|
+
<div slot="header">${e.i18n.urlModal.addUrlTitle}</div>
|
|
3631
|
+
|
|
3633
3632
|
<div >
|
|
3634
3633
|
<nr-row gutter="8" align="bottom">
|
|
3635
3634
|
<nr-col span="20" >
|
|
3636
3635
|
<nr-input
|
|
3637
|
-
|
|
3636
|
+
|
|
3638
3637
|
type="url"
|
|
3639
3638
|
.value=${e.urlInput}
|
|
3640
|
-
placeholder="${
|
|
3639
|
+
placeholder="${e.i18n.urlModal.urlPlaceholder}"
|
|
3641
3640
|
?disabled=${e.isLoading}
|
|
3642
3641
|
@nr-input=${t.onUrlInputChange}
|
|
3643
3642
|
@keydown=${t.onUrlInputKeydown}
|
|
3644
3643
|
>
|
|
3645
|
-
<nr-label slot="label">${
|
|
3644
|
+
<nr-label slot="label">${e.i18n.urlModal.urlLabel}</nr-label>
|
|
3646
3645
|
</nr-input>
|
|
3647
3646
|
</nr-col>
|
|
3648
3647
|
<nr-col span="4" >
|
|
3649
|
-
<nr-button
|
|
3648
|
+
<nr-button
|
|
3650
3649
|
type="default"
|
|
3651
3650
|
.icon=${["paperclip"]}
|
|
3652
3651
|
size="small"
|
|
3653
3652
|
?disabled=${e.isLoading}
|
|
3654
3653
|
@click=${t.onAttachFile}
|
|
3655
|
-
title="${
|
|
3654
|
+
title="${e.i18n.urlModal.loadFromUrlLabel}"
|
|
3656
3655
|
style="margin-left: 0.5rem;"
|
|
3657
3656
|
>
|
|
3658
3657
|
</nr-button>
|
|
3659
3658
|
</nr-col>
|
|
3660
3659
|
</nr-row>
|
|
3661
|
-
|
|
3660
|
+
|
|
3662
3661
|
${e.error?i`
|
|
3663
|
-
<nr-alert
|
|
3664
|
-
type="error"
|
|
3662
|
+
<nr-alert
|
|
3663
|
+
type="error"
|
|
3665
3664
|
closable
|
|
3666
3665
|
style="margin-top: 1rem;"
|
|
3667
3666
|
>
|
|
3668
3667
|
${e.error}
|
|
3669
3668
|
</nr-alert>
|
|
3670
3669
|
`:n}
|
|
3671
|
-
|
|
3670
|
+
|
|
3672
3671
|
${e.selectedFileName?i`
|
|
3673
|
-
<nr-alert
|
|
3674
|
-
type="success"
|
|
3672
|
+
<nr-alert
|
|
3673
|
+
type="success"
|
|
3675
3674
|
style="margin-top: 1rem;"
|
|
3676
3675
|
>
|
|
3677
|
-
${
|
|
3676
|
+
${e.i18n.urlModal.selectedFileLabel}: ${e.selectedFileName}
|
|
3678
3677
|
</nr-alert>
|
|
3679
3678
|
`:n}
|
|
3680
|
-
|
|
3679
|
+
|
|
3681
3680
|
${e.isLoading?i`
|
|
3682
|
-
<nr-alert
|
|
3683
|
-
type="info"
|
|
3681
|
+
<nr-alert
|
|
3682
|
+
type="info"
|
|
3684
3683
|
style="margin-top: 1rem;"
|
|
3685
3684
|
>
|
|
3686
|
-
${
|
|
3685
|
+
${e.i18n.urlModal.loadingFromUrlLabel}
|
|
3687
3686
|
</nr-alert>
|
|
3688
3687
|
`:n}
|
|
3689
3688
|
</div>
|
|
3690
|
-
|
|
3689
|
+
|
|
3691
3690
|
<div slot="footer">
|
|
3692
|
-
<nr-button
|
|
3691
|
+
<nr-button
|
|
3693
3692
|
type="default"
|
|
3694
3693
|
size="small"
|
|
3695
3694
|
?disabled=${e.isLoading}
|
|
3696
3695
|
@click=${t.onClose}
|
|
3697
3696
|
>
|
|
3698
|
-
${
|
|
3697
|
+
${e.i18n.urlModal.cancelButton}
|
|
3699
3698
|
</nr-button>
|
|
3700
|
-
<nr-button
|
|
3699
|
+
<nr-button
|
|
3701
3700
|
type="primary"
|
|
3702
3701
|
size="small"
|
|
3703
3702
|
?disabled=${!e.urlInput&&!e.selectedFileName||e.isLoading}
|
|
3704
3703
|
?loading=${e.isLoading}
|
|
3705
3704
|
@click=${t.onConfirm}
|
|
3706
3705
|
>
|
|
3707
|
-
${
|
|
3706
|
+
${e.i18n.urlModal.addButton}
|
|
3708
3707
|
</nr-button>
|
|
3709
3708
|
</div>
|
|
3710
3709
|
</nr-modal>
|
|
@@ -3717,12 +3716,12 @@ function(e){if(0===e)return"0 Bytes";const t=Math.floor(Math.log(e)/Math.log(102
|
|
|
3717
3716
|
* @license
|
|
3718
3717
|
* Copyright 2024 Nuraly, Laabidi Aymen
|
|
3719
3718
|
* SPDX-License-Identifier: MIT
|
|
3720
|
-
*/var Jt=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 Yt={active:!1,duration:"00:00",bars:[]};class Qt{constructor(e){this.state=Object.assign({},Yt),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 Jt(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({},Yt),this.host.requestUpdate()}stop(){return Jt(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({},Yt),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
|
|
3719
|
+
*/var Jt=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 Yt={active:!1,duration:"00:00",bars:[]};class Qt{constructor(e){this.state=Object.assign({},Yt),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 Jt(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({},Yt),this.host.requestUpdate()}stop(){return Jt(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({},Yt),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 al}),{blob:i,mimeType:o}=yield e(a,n);return{blob:i,mimeType:o,duration:t}}catch(e){return{blob:a,mimeType:n,duration:t}}})}}
|
|
3721
3720
|
/**
|
|
3722
3721
|
* @license
|
|
3723
3722
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
3724
3723
|
* SPDX-License-Identifier: MIT
|
|
3725
|
-
*/var Xt=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},Zt=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 ei=class extends($e(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=Et.Medium,this.variant=At.Default,this.loadingIndicator=Mt.Dots,this.loadingText=at("Agent is working..."),this.disabled=!1,this.placeholder=at("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=at("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 Qt(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`
|
|
3724
|
+
*/var Xt=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},Zt=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 ei={input:{placeholder:at("Type your message..."),chatInputAriaLabel:at("Chat input"),attachButton:at("Attach"),attachFilesAriaLabel:at("Attach files"),removeFileLabel:at("Remove file"),uploadingLabel:at("Uploading"),uploadingProgress:at("Uploading…"),dropFilesHere:at("Drop files here to upload")},send:{sendButton:at("Send"),stopButton:at("Stop"),sendMessageLabel:at("Send message"),stopQueryLabel:at("Stop query")},audio:{recordSpeechLabel:at("Record speech to text"),sendVoiceMessageLabel:at("Send voice message"),cancelRecordingLabel:at("Cancel recording"),speechToTextLabel:at("Speech to text"),voiceMessageLabel:at("Voice message"),convertToTextLabel:at("Convert to text"),sendAsVoiceMessageLabel:at("Send as voice message")},modules:{moduleSelectionLabel:at("Select Modules"),moduleSearchPlaceholder:at("Search modules..."),moduleSelectAriaLabel:at("Select modules"),modulesSelectedSuffix:at("modules selected")},threads:{conversationsTitle:at("Conversations"),bookmarksLabel:at("Bookmarks"),allConversationsLabel:at("All Conversations"),noConversationsLabel:at("No conversations yet"),newChatTitle:at("New Chat"),newConversationLabel:at("New conversation"),removeBookmarkLabel:at("Remove bookmark"),bookmarkLabel:at("Bookmark"),renameLabel:at("Rename"),deleteLabel:at("Delete"),moreOptionsLabel:at("More options"),showThreadsLabel:at("Show threads"),hideThreadsLabel:at("Hide threads")},messages:{attachedFilesLabel:at("Attached files"),copyMessageLabel:at("Copy message"),retryMessageLabel:at("Retry message"),retryButton:at("Retry"),startConversationLabel:at("Start a conversation"),suggestionPrefix:at("Select suggestion: ")},urlModal:{addUrlTitle:at("Add URL"),urlLabel:at("URL"),urlPlaceholder:at("Enter URL..."),loadFromUrlLabel:at("Load file from URL"),selectedFileLabel:at("Selected file"),loadingFromUrlLabel:at("Loading file from URL..."),cancelButton:at("Cancel"),addButton:at("Add")},artifactPanel:{copyCodeLabel:at("Copy code"),closePanelLabel:at("Close panel")},loading:{agentWorkingLabel:at("Agent is working...")}};let ti=class extends($e(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=Et.Medium,this.variant=At.Default,this.loadingIndicator=Mt.Dots,this.loadingText=at("Agent is working..."),this.disabled=!1,this.placeholder=at("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=at("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._isDragging=!1,this._dragDepth=0,this.controllerUnsubscribes=[],this._audio=new Qt(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)}get resolvedI18n(){var e,t,i,n,a,o,s,r,l;const c=this.i18n;return{input:Object.assign(Object.assign({},ei.input),null!==(e=null==c?void 0:c.input)&&void 0!==e?e:{}),send:Object.assign(Object.assign({},ei.send),null!==(t=null==c?void 0:c.send)&&void 0!==t?t:{}),audio:Object.assign(Object.assign({},ei.audio),null!==(i=null==c?void 0:c.audio)&&void 0!==i?i:{}),modules:Object.assign(Object.assign({},ei.modules),null!==(n=null==c?void 0:c.modules)&&void 0!==n?n:{}),threads:Object.assign(Object.assign({},ei.threads),null!==(a=null==c?void 0:c.threads)&&void 0!==a?a:{}),messages:Object.assign(Object.assign({},ei.messages),null!==(o=null==c?void 0:c.messages)&&void 0!==o?o:{}),urlModal:Object.assign(Object.assign({},ei.urlModal),null!==(s=null==c?void 0:c.urlModal)&&void 0!==s?s:{}),artifactPanel:Object.assign(Object.assign({},ei.artifactPanel),null!==(r=null==c?void 0:c.artifactPanel)&&void 0!==r?r:{}),loading:Object.assign(Object.assign({},ei.loading),null!==(l=null==c?void 0:c.loading)&&void 0!==l?l:{})}}render(){var e;const t=this.resolvedI18n,n={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,i18n:t},enableThreads:this.showThreads,enableThreadCreation:this.enableThreadCreation,isThreadSidebarOpen:this.showThreads&&this.isThreadSidebarOpen,threadSidebar:this.showThreads?{threads:this.threads,activeThreadId:this.activeThreadId,editingThreadId:this._editingThreadId,i18n:t}:void 0,enableFileUpload:this.enableFileUpload,isDragging:this._isDragging,i18n:t,enableArtifacts:this.enableArtifacts,artifactPanel:this.enableArtifacts?{artifact:this.selectedArtifact,isOpen:this.isArtifactPanelOpen,renderContent:null!==(e=this.renderArtifactContent)&&void 0!==e?e:this.getPluginArtifactRenderer(),i18n:t}:void 0,urlModal:this.isUrlModalOpen?{isOpen:this.isUrlModalOpen,urlInput:this.urlInput,isLoading:this.isUrlLoading,error:this.urlModalError,selectedFileName:this.selectedUrlFileName,i18n:t}:void 0},a={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:{onDragEnter:this.handleDragEnter.bind(this),onDragOver:this.handleDragOver.bind(this),onDragLeave:this.handleDragLeave.bind(this),onDrop:this.handleDrop.bind(this)},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`
|
|
3726
3725
|
<div
|
|
3727
3726
|
class="chat-container ${h({"chat-container--with-threads":this.showThreads,"chat-container--disabled":this.disabled,"chat-container--focused":this.focused,"chat-container--boxed":this.boxed})}"
|
|
3728
3727
|
dir=${this.isRTL?"rtl":"ltr"}
|
|
@@ -3732,7 +3731,7 @@ function(e){if(0===e)return"0 Bytes";const t=Math.floor(Math.log(e)/Math.log(102
|
|
|
3732
3731
|
data-mode="${this.mode}"
|
|
3733
3732
|
part="chat-container">
|
|
3734
3733
|
|
|
3735
|
-
${Kt(
|
|
3734
|
+
${Kt(n,a)}
|
|
3736
3735
|
</div>
|
|
3737
3736
|
|
|
3738
3737
|
${qt({isOpen:this.isFilePreviewModalOpen,file:this.previewFile},{onClose:this.handleFilePreviewModalClose.bind(this)})}
|
|
@@ -3743,146 +3742,146 @@ function(e){if(0===e)return"0 Bytes";const t=Math.floor(Math.log(e)/Math.log(102
|
|
|
3743
3742
|
</span>
|
|
3744
3743
|
`}return i`
|
|
3745
3744
|
<span class="module-display-multiple">
|
|
3746
|
-
${e} ${
|
|
3745
|
+
${e} ${this.resolvedI18n.modules.modulesSelectedSuffix}
|
|
3747
3746
|
</span>
|
|
3748
|
-
`}handleContentEditableInput(e){const t=e.target.textContent||"";this.currentInput=t,this.dispatchEventWithMetadata("nr-chatbot-input-changed",{metadata:{value:t}})}handleInputFocus(e){this.focused=!0,this.dispatchEventWithMetadata("nr-chatbot-input-focused",{metadata:{event:e}})}handleInputBlur(e){this.focused=!1,this.dispatchEventWithMetadata("nr-chatbot-input-blurred",{metadata:{event:e}})}clearInput(){var e;this.currentInput="";const t=null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector(".input-box__input");t&&(t.textContent="")}focusInput(){var e;const t=null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector(".input-box__input");t&&t.focus()}handleAudioStart(e){this._audioMode=e,this._audio.start()}handleAudioCancel(){this._audio.cancel()}handleAudioSend(){return Zt(this,void 0,void 0,function*(){var e;const t=yield this._audio.stop();if(!t)return;const i=this._audioMode;null===(e=this.onAudioRecorded)||void 0===e||e.call(this,t.blob,t.mimeType,t.duration,i),this.dispatchEvent(new CustomEvent("nr-chatbot-audio-recorded",{detail:{blob:t.blob,mimeType:t.mimeType,duration:t.duration,mode:i},bubbles:!0,composed:!0}))})}handleKeyDown(e){"Enter"!==e.key||e.shiftKey||(e.preventDefault(),this.handleSendMessage())}handleSendMessage(){if(!this.currentInput.trim()||this.disabled)return;if(!this.controller)return void console.warn("nr-chatbot: No controller is attached; message will not be sent.");const e=this.uploadedFiles&&this.uploadedFiles.length>0?[...this.uploadedFiles]:void 0;this.controller.sendMessage(this.currentInput.trim(),{files:e,metadata:{selectedModules:this.selectedModules}}),this.clearInput(),this.chatStarted=!0,this.dispatchEventWithMetadata("nr-chatbot-message-sent",{metadata:{text:this.currentInput}})}handleStopQuery(){var e;try{null===(e=this.controller)||void 0===e||e.stop()}catch(e){console.warn("nr-chatbot: stop failed",e)}this.dispatchEventWithMetadata("nr-chatbot-query-stopped",{metadata:{action:"stop"}})}handleRetry(e){e.text&&(this.currentInput=e.text,this.handleSendMessage())}handleCopyMessage(e){const t=e.text;if(!t)return;const i=()=>{this.dispatchEventWithMetadata("nr-chatbot-message-copied",{metadata:{messageId:e.id}})};navigator.clipboard?navigator.clipboard.writeText(t).then(i).catch(()=>{this.copyViaFallback(t,i)}):this.copyViaFallback(t,i)}copyViaFallback(e,t){const i=document.createElement("textarea");i.value=e,i.style.position="fixed",i.style.left="-9999px",i.style.top="-9999px",document.body.appendChild(i),i.focus(),i.select();try{document.execCommand("copy"),t()}catch(e){}i.remove()}handleSuggestionClick(e){this.currentInput=e.text,this.handleSendMessage(),this.dispatchEventWithMetadata("nr-chatbot-suggestion-clicked",{metadata:{suggestion:e}})}handleModuleSelectionChange(e){const t=e.detail.value;this.selectedModules=t,this.dispatchEventWithMetadata("nr-chatbot-modules-selected",{metadata:{modules:t}})}handleFileDropdownClick(e){const t=e.detail.item.id;"upload-file"===t?this.openFileDialog():"upload-url"===t&&this.openUrlModal()}openFileDialog(){const e=document.createElement("input");e.type="file",e.multiple=!0,e.accept="image/*,application/pdf,text/*,video/*,audio/*",e.addEventListener("change",e=>Zt(this,void 0,void 0,function*(){var t;const i=e.target;if(i.files&&i.files.length>0){const e=Array.from(i.files);yield null===(t=this.controller)||void 0===t?void 0:t.uploadFiles(e)}})),e.click()}openUrlModal(){this.isUrlModalOpen=!0,this.urlInput="",this.urlModalError="",this.selectedUrlFileName=""}handleUrlModalClose(){this.isUrlModalOpen=!1,this.urlInput="",this.urlModalError="",this.isUrlLoading=!1,this.selectedUrlFileName=""}handleUrlInputChange(e){const t=e.target;this.urlInput=t.value,this.urlModalError=""}handleUrlInputKeydown(e){"Enter"===e.key&&(e.preventDefault(),this.handleUrlAttachFile())}handleUrlConfirm(){this.handleUrlModalClose()}handleUrlAttachFile(){return Zt(this,void 0,void 0,function*(){if(this.urlInput.trim()){this.isUrlLoading=!0,this.urlModalError="";try{const e=yield fetch(this.urlInput);if(!e.ok)throw new Error(`Failed to fetch file: ${e.statusText}`);const t=yield e.blob(),i=this.urlInput.split("/").pop()||"downloaded-file",n=new File([t],i,{type:t.type});this.selectedUrlFileName=i,this.controller&&(yield this.controller.uploadFiles([n])),this.isUrlLoading=!1,setTimeout(()=>{this.handleUrlModalClose()},1e3)}catch(e){this.isUrlLoading=!1,this.urlModalError=e instanceof Error?e.message:"Failed to load file from URL"}}else this.urlModalError="Please enter a URL"})}handleFileRemove(e){var t;null===(t=this.controller)||void 0===t||t.removeFile(e)}handleFilePreview(e){this.previewFile=e,this.isFilePreviewModalOpen=!0}handleArtifactClick(e){if(!this.enableArtifacts||!this.controller)return;const t=this.getArtifactPlugin();if(!t)return;const i=t.getArtifact(e);i&&(this.selectedArtifact=i,this.isArtifactPanelOpen=!0)}handleArtifactPanelClose(){this.isArtifactPanelOpen=!1,this.selectedArtifact=null}updateArtifactPanelResize(){var e,t,i;const n=null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector(".artifact-panel__resize-handle"),a=null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector(".artifact-panel");if(!n||!a)return null===(i=this._artifactResizeCleanup)||void 0===i||i.call(this),void(this._artifactResizeBound=!1);if(this._artifactResizeBound)return;this._artifactResizeBound=!0;let o=!1,s=0,r=0;const l=e=>{if(!o)return;const t=e.clientX-s,i=a.parentElement,n=i?.85*i.getBoundingClientRect().width:1200,l=Number.parseInt(getComputedStyle(a).minWidth,10)||300,c=Math.max(l,Math.min(r-t,n));a.style.width=`${c}px`},c=()=>{o&&(o=!1,n.classList.remove("artifact-panel__resize-handle--active"),document.body.style.cursor="",document.body.style.userSelect="",document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",c))},d=e=>{e.preventDefault(),o=!0,s=e.clientX,r=a.getBoundingClientRect().width,n.classList.add("artifact-panel__resize-handle--active"),document.body.style.cursor="col-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",l),document.addEventListener("mouseup",c)};n.addEventListener("mousedown",d),this._artifactResizeCleanup=()=>{n.removeEventListener("mousedown",d),c()}}handleArtifactCopy(e){const t=e.content;t&&(navigator.clipboard?navigator.clipboard.writeText(t).catch(()=>{this.copyViaFallback(t,()=>{})}):this.copyViaFallback(t,()=>{}))}getArtifactPlugin(){var e;try{const t=null===(e=this.controller)||void 0===e?void 0:e.plugins;return t&&"function"==typeof t.get?t.get("artifact"):void 0}catch(e){return}}getPluginArtifactRenderer(){var e;try{const t=null===(e=this.controller)||void 0===e?void 0:e.plugins;if(!t||"function"!=typeof t.values)return;for(const e of t.values())if("function"==typeof e.renderArtifactContent)return t=>{const n=e.renderArtifactContent(t);if(n)return i`${u(n)}`};return}catch(e){return}}handleFilePreviewModalClose(){this.isFilePreviewModalOpen=!1,this.previewFile=null}addMessage(e){var t;const i=Object.assign({id:e.id||`msg-${Date.now()}`,sender:e.sender||Tt.User,text:e.text||"",timestamp:e.timestamp||(new Date).toISOString()},e);return null===(t=this.controller)||void 0===t||t.addMessage(i),this.chatStarted=!0,i}clearMessages(){this.messages=[],this.chatStarted=!1}};ei.useShadowDom=!0,ei.styles=Pt,Xt([s({type:Array})],ei.prototype,"messages",void 0),Xt([s({type:String})],ei.prototype,"currentInput",void 0),Xt([s({type:Boolean})],ei.prototype,"isBotTyping",void 0),Xt([s({type:Boolean})],ei.prototype,"isQueryRunning",void 0),Xt([s({type:Array})],ei.prototype,"suggestions",void 0),Xt([s({type:Boolean})],ei.prototype,"chatStarted",void 0),Xt([s({type:Boolean})],ei.prototype,"isRTL",void 0),Xt([s({type:String})],ei.prototype,"size",void 0),Xt([s({type:String})],ei.prototype,"variant",void 0),Xt([s({type:String})],ei.prototype,"loadingIndicator",void 0),Xt([s({type:String})],ei.prototype,"loadingText",void 0),Xt([s({type:Boolean})],ei.prototype,"disabled",void 0),Xt([s({type:String})],ei.prototype,"placeholder",void 0),Xt([s({type:Boolean})],ei.prototype,"showSendButton",void 0),Xt([s({type:Boolean})],ei.prototype,"autoScroll",void 0),Xt([s({type:Boolean})],ei.prototype,"showThreads",void 0),Xt([s({type:Boolean})],ei.prototype,"enableThreadCreation",void 0),Xt([s({type:Array})],ei.prototype,"threads",void 0),Xt([s({type:String})],ei.prototype,"activeThreadId",void 0),Xt([s({type:String})],ei.prototype,"mode",void 0),Xt([s({type:Boolean,reflect:!0})],ei.prototype,"boxed",void 0),Xt([s({type:Boolean})],ei.prototype,"enableUrlSync",void 0),Xt([s({type:Boolean})],ei.prototype,"showMessages",void 0),Xt([s({type:Boolean})],ei.prototype,"enableFileUpload",void 0),Xt([s({type:Array})],ei.prototype,"uploadedFiles",void 0),Xt([s({type:Array})],ei.prototype,"actionButtons",void 0),Xt([s({type:Boolean})],ei.prototype,"enableModuleSelection",void 0),Xt([s({type:Array})],ei.prototype,"modules",void 0),Xt([s({type:Array})],ei.prototype,"selectedModules",void 0),Xt([s({type:String})],ei.prototype,"moduleSelectionLabel",void 0),Xt([s({type:Boolean})],ei.prototype,"enableArtifacts",void 0),Xt([s({type:Boolean,attribute:"show-audio-button"})],ei.prototype,"showAudioButton",void 0),Xt([s({type:Function})],ei.prototype,"onAudioRecorded",void 0),Xt([s({type:Function})],ei.prototype,"renderArtifactContent",void 0),Xt([s({type:Object})],ei.prototype,"controller",void 0),Xt([r()],ei.prototype,"statusText",void 0),Xt([r()],ei.prototype,"focused",void 0),Xt([r()],ei.prototype,"isArtifactPanelOpen",void 0),Xt([r()],ei.prototype,"selectedArtifact",void 0),Xt([r()],ei.prototype,"isThreadSidebarOpen",void 0),Xt([r()],ei.prototype,"_editingThreadId",void 0),Xt([r()],ei.prototype,"isUrlModalOpen",void 0),Xt([r()],ei.prototype,"urlInput",void 0),Xt([r()],ei.prototype,"urlModalError",void 0),Xt([r()],ei.prototype,"isUrlLoading",void 0),Xt([r()],ei.prototype,"selectedUrlFileName",void 0),Xt([r()],ei.prototype,"isFilePreviewModalOpen",void 0),Xt([r()],ei.prototype,"previewFile",void 0),ei=Xt([(e,t)=>(e.addInitializer(rt),e),l("nr-chatbot")],ei);
|
|
3747
|
+
`}handleContentEditableInput(e){const t=e.target.textContent||"";this.currentInput=t,this.dispatchEventWithMetadata("nr-chatbot-input-changed",{metadata:{value:t}})}handleInputFocus(e){this.focused=!0,this.dispatchEventWithMetadata("nr-chatbot-input-focused",{metadata:{event:e}})}handleInputBlur(e){this.focused=!1,this.dispatchEventWithMetadata("nr-chatbot-input-blurred",{metadata:{event:e}})}clearInput(){var e;this.currentInput="";const t=null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector(".input-box__input");t&&(t.textContent="")}focusInput(){var e;const t=null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector(".input-box__input");t&&t.focus()}handleAudioStart(e){this._audioMode=e,this._audio.start()}handleAudioCancel(){this._audio.cancel()}handleAudioSend(){return Zt(this,void 0,void 0,function*(){var e;const t=yield this._audio.stop();if(!t)return;const i=this._audioMode;null===(e=this.onAudioRecorded)||void 0===e||e.call(this,t.blob,t.mimeType,t.duration,i),this.dispatchEvent(new CustomEvent("nr-chatbot-audio-recorded",{detail:{blob:t.blob,mimeType:t.mimeType,duration:t.duration,mode:i},bubbles:!0,composed:!0}))})}handleKeyDown(e){"Enter"!==e.key||e.shiftKey||(e.preventDefault(),this.handleSendMessage())}handleSendMessage(){if(!this.currentInput.trim()||this.disabled)return;if(!this.controller)return void console.warn("nr-chatbot: No controller is attached; message will not be sent.");const e=this.uploadedFiles&&this.uploadedFiles.length>0?[...this.uploadedFiles]:void 0;this.controller.sendMessage(this.currentInput.trim(),{files:e,metadata:{selectedModules:this.selectedModules}}),this.clearInput(),this.chatStarted=!0,this.dispatchEventWithMetadata("nr-chatbot-message-sent",{metadata:{text:this.currentInput}})}handleStopQuery(){var e;try{null===(e=this.controller)||void 0===e||e.stop()}catch(e){console.warn("nr-chatbot: stop failed",e)}this.dispatchEventWithMetadata("nr-chatbot-query-stopped",{metadata:{action:"stop"}})}handleRetry(e){e.text&&(this.currentInput=e.text,this.handleSendMessage())}handleCopyMessage(e){const t=e.text;if(!t)return;const i=()=>{this.dispatchEventWithMetadata("nr-chatbot-message-copied",{metadata:{messageId:e.id}})};navigator.clipboard?navigator.clipboard.writeText(t).then(i).catch(()=>{this.copyViaFallback(t,i)}):this.copyViaFallback(t,i)}copyViaFallback(e,t){const i=document.createElement("textarea");i.value=e,i.style.position="fixed",i.style.left="-9999px",i.style.top="-9999px",document.body.appendChild(i),i.focus(),i.select();try{document.execCommand("copy"),t()}catch(e){}i.remove()}handleSuggestionClick(e){this.currentInput=e.text,this.handleSendMessage(),this.dispatchEventWithMetadata("nr-chatbot-suggestion-clicked",{metadata:{suggestion:e}})}handleModuleSelectionChange(e){const t=e.detail.value;this.selectedModules=t,this.dispatchEventWithMetadata("nr-chatbot-modules-selected",{metadata:{modules:t}})}handleFileDropdownClick(e){const t=e.detail.item.id;"upload-file"===t?this.openFileDialog():"upload-url"===t&&this.openUrlModal()}openFileDialog(){const e=document.createElement("input");e.type="file",e.multiple=!0,e.accept="image/*,application/pdf,text/*,video/*,audio/*",e.addEventListener("change",e=>Zt(this,void 0,void 0,function*(){var t;const i=e.target;if(i.files&&i.files.length>0){const e=Array.from(i.files);yield null===(t=this.controller)||void 0===t?void 0:t.uploadFiles(e)}})),e.click()}openUrlModal(){this.isUrlModalOpen=!0,this.urlInput="",this.urlModalError="",this.selectedUrlFileName=""}handleUrlModalClose(){this.isUrlModalOpen=!1,this.urlInput="",this.urlModalError="",this.isUrlLoading=!1,this.selectedUrlFileName=""}handleUrlInputChange(e){const t=e.target;this.urlInput=t.value,this.urlModalError=""}handleUrlInputKeydown(e){"Enter"===e.key&&(e.preventDefault(),this.handleUrlAttachFile())}handleUrlConfirm(){this.handleUrlModalClose()}handleUrlAttachFile(){return Zt(this,void 0,void 0,function*(){if(this.urlInput.trim()){this.isUrlLoading=!0,this.urlModalError="";try{const e=yield fetch(this.urlInput);if(!e.ok)throw new Error(`Failed to fetch file: ${e.statusText}`);const t=yield e.blob(),i=this.urlInput.split("/").pop()||"downloaded-file",n=new File([t],i,{type:t.type});this.selectedUrlFileName=i,this.controller&&(yield this.controller.uploadFiles([n])),this.isUrlLoading=!1,setTimeout(()=>{this.handleUrlModalClose()},1e3)}catch(e){this.isUrlLoading=!1,this.urlModalError=e instanceof Error?e.message:"Failed to load file from URL"}}else this.urlModalError="Please enter a URL"})}handleFileRemove(e){var t;null===(t=this.controller)||void 0===t||t.removeFile(e)}dragHasFiles(e){var t;const i=null===(t=e.dataTransfer)||void 0===t?void 0:t.types;if(!i)return!1;for(let e=0;e<i.length;e++)if("Files"===i[e])return!0;return!1}handleDragEnter(e){this.enableFileUpload&&!this.disabled&&this.dragHasFiles(e)&&(e.preventDefault(),this._dragDepth++,this._isDragging=!0)}handleDragOver(e){this.enableFileUpload&&!this.disabled&&this.dragHasFiles(e)&&(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="copy"))}handleDragLeave(e){this.enableFileUpload&&!this.disabled&&this.dragHasFiles(e)&&(e.preventDefault(),this._dragDepth=Math.max(0,this._dragDepth-1),0===this._dragDepth&&(this._isDragging=!1))}handleDrop(e){return Zt(this,void 0,void 0,function*(){var t,i;if(!this.enableFileUpload||this.disabled)return;e.preventDefault(),this._dragDepth=0,this._isDragging=!1;const n=null===(t=e.dataTransfer)||void 0===t?void 0:t.files;n&&0!==n.length&&(yield null===(i=this.controller)||void 0===i?void 0:i.uploadFiles(Array.from(n)))})}handleFilePreview(e){this.previewFile=e,this.isFilePreviewModalOpen=!0}handleArtifactClick(e){if(!this.enableArtifacts||!this.controller)return;const t=this.getArtifactPlugin();if(!t)return;const i=t.getArtifact(e);i&&(this.selectedArtifact=i,this.isArtifactPanelOpen=!0)}handleArtifactPanelClose(){this.isArtifactPanelOpen=!1,this.selectedArtifact=null}updateArtifactPanelResize(){var e,t,i;const n=null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector(".artifact-panel__resize-handle"),a=null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector(".artifact-panel");if(!n||!a)return null===(i=this._artifactResizeCleanup)||void 0===i||i.call(this),void(this._artifactResizeBound=!1);if(this._artifactResizeBound)return;this._artifactResizeBound=!0;let o=!1,s=0,r=0;const l=e=>{if(!o)return;const t=e.clientX-s,i=a.parentElement,n=i?.85*i.getBoundingClientRect().width:1200,l=Number.parseInt(getComputedStyle(a).minWidth,10)||300,c=Math.max(l,Math.min(r-t,n));a.style.width=`${c}px`},c=()=>{o&&(o=!1,n.classList.remove("artifact-panel__resize-handle--active"),document.body.style.cursor="",document.body.style.userSelect="",document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",c))},d=e=>{e.preventDefault(),o=!0,s=e.clientX,r=a.getBoundingClientRect().width,n.classList.add("artifact-panel__resize-handle--active"),document.body.style.cursor="col-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",l),document.addEventListener("mouseup",c)};n.addEventListener("mousedown",d),this._artifactResizeCleanup=()=>{n.removeEventListener("mousedown",d),c()}}handleArtifactCopy(e){const t=e.content;t&&(navigator.clipboard?navigator.clipboard.writeText(t).catch(()=>{this.copyViaFallback(t,()=>{})}):this.copyViaFallback(t,()=>{}))}getArtifactPlugin(){var e;try{const t=null===(e=this.controller)||void 0===e?void 0:e.plugins;return t&&"function"==typeof t.get?t.get("artifact"):void 0}catch(e){return}}getPluginArtifactRenderer(){var e;try{const t=null===(e=this.controller)||void 0===e?void 0:e.plugins;if(!t||"function"!=typeof t.values)return;for(const e of t.values())if("function"==typeof e.renderArtifactContent)return t=>{const n=e.renderArtifactContent(t);if(n)return i`${u(n)}`};return}catch(e){return}}handleFilePreviewModalClose(){this.isFilePreviewModalOpen=!1,this.previewFile=null}addMessage(e){var t;const i=Object.assign({id:e.id||`msg-${Date.now()}`,sender:e.sender||Tt.User,text:e.text||"",timestamp:e.timestamp||(new Date).toISOString()},e);return null===(t=this.controller)||void 0===t||t.addMessage(i),this.chatStarted=!0,i}clearMessages(){this.messages=[],this.chatStarted=!1}};ti.useShadowDom=!0,ti.styles=Pt,Xt([s({type:Array})],ti.prototype,"messages",void 0),Xt([s({type:String})],ti.prototype,"currentInput",void 0),Xt([s({type:Boolean})],ti.prototype,"isBotTyping",void 0),Xt([s({type:Boolean})],ti.prototype,"isQueryRunning",void 0),Xt([s({type:Array})],ti.prototype,"suggestions",void 0),Xt([s({type:Boolean})],ti.prototype,"chatStarted",void 0),Xt([s({type:Boolean})],ti.prototype,"isRTL",void 0),Xt([s({type:String})],ti.prototype,"size",void 0),Xt([s({type:String})],ti.prototype,"variant",void 0),Xt([s({type:String})],ti.prototype,"loadingIndicator",void 0),Xt([s({type:String})],ti.prototype,"loadingText",void 0),Xt([s({type:Boolean})],ti.prototype,"disabled",void 0),Xt([s({type:String})],ti.prototype,"placeholder",void 0),Xt([s({type:Object})],ti.prototype,"i18n",void 0),Xt([s({type:Boolean})],ti.prototype,"showSendButton",void 0),Xt([s({type:Boolean})],ti.prototype,"autoScroll",void 0),Xt([s({type:Boolean})],ti.prototype,"showThreads",void 0),Xt([s({type:Boolean})],ti.prototype,"enableThreadCreation",void 0),Xt([s({type:Array})],ti.prototype,"threads",void 0),Xt([s({type:String})],ti.prototype,"activeThreadId",void 0),Xt([s({type:String})],ti.prototype,"mode",void 0),Xt([s({type:Boolean,reflect:!0})],ti.prototype,"boxed",void 0),Xt([s({type:Boolean})],ti.prototype,"enableUrlSync",void 0),Xt([s({type:Boolean})],ti.prototype,"showMessages",void 0),Xt([s({type:Boolean})],ti.prototype,"enableFileUpload",void 0),Xt([s({type:Array})],ti.prototype,"uploadedFiles",void 0),Xt([s({type:Array})],ti.prototype,"actionButtons",void 0),Xt([s({type:Boolean})],ti.prototype,"enableModuleSelection",void 0),Xt([s({type:Array})],ti.prototype,"modules",void 0),Xt([s({type:Array})],ti.prototype,"selectedModules",void 0),Xt([s({type:String})],ti.prototype,"moduleSelectionLabel",void 0),Xt([s({type:Boolean})],ti.prototype,"enableArtifacts",void 0),Xt([s({type:Boolean,attribute:"show-audio-button"})],ti.prototype,"showAudioButton",void 0),Xt([s({type:Function})],ti.prototype,"onAudioRecorded",void 0),Xt([s({type:Function})],ti.prototype,"renderArtifactContent",void 0),Xt([s({type:Object})],ti.prototype,"controller",void 0),Xt([r()],ti.prototype,"statusText",void 0),Xt([r()],ti.prototype,"focused",void 0),Xt([r()],ti.prototype,"isArtifactPanelOpen",void 0),Xt([r()],ti.prototype,"selectedArtifact",void 0),Xt([r()],ti.prototype,"isThreadSidebarOpen",void 0),Xt([r()],ti.prototype,"_editingThreadId",void 0),Xt([r()],ti.prototype,"isUrlModalOpen",void 0),Xt([r()],ti.prototype,"urlInput",void 0),Xt([r()],ti.prototype,"urlModalError",void 0),Xt([r()],ti.prototype,"isUrlLoading",void 0),Xt([r()],ti.prototype,"selectedUrlFileName",void 0),Xt([r()],ti.prototype,"isFilePreviewModalOpen",void 0),Xt([r()],ti.prototype,"previewFile",void 0),Xt([r()],ti.prototype,"_isDragging",void 0),ti=Xt([(e,t)=>(e.addInitializer(rt),e),l("nr-chatbot")],ti);
|
|
3749
3748
|
/**
|
|
3750
3749
|
* @license
|
|
3751
3750
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
3752
3751
|
* SPDX-License-Identifier: MIT
|
|
3753
3752
|
*/
|
|
3754
|
-
class
|
|
3753
|
+
class ii{constructor(){this.listeners=new Map}on(e,t){return this.listeners.has(e)||this.listeners.set(e,new Set),this.listeners.get(e).add(t),()=>{var i,n;null===(i=this.listeners.get(e))||void 0===i||i.delete(t),0===(null===(n=this.listeners.get(e))||void 0===n?void 0:n.size)&&this.listeners.delete(e)}}once(e,t){const i=(...n)=>{t(...n),this.off(e,i)};this.on(e,i)}off(e,t){var i;null===(i=this.listeners.get(e))||void 0===i||i.delete(t)}emit(e,t){const i=this.listeners.get(e);i&&i.forEach(i=>{try{i(t)}catch(t){console.error(`Error in event handler for "${e}":`,t)}})}removeAllListeners(e){e?this.listeners.delete(e):this.listeners.clear()}listenerCount(e){var t;return(null===(t=this.listeners.get(e))||void 0===t?void 0:t.size)||0}eventNames(){return Array.from(this.listeners.keys())}}
|
|
3755
3754
|
/**
|
|
3756
3755
|
* @license
|
|
3757
3756
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
3758
3757
|
* SPDX-License-Identifier: MIT
|
|
3759
|
-
*/class
|
|
3758
|
+
*/class ni extends Error{constructor(e){super(e.join(", ")),this.errors=e,this.name="ValidationError"}}
|
|
3760
3759
|
/**
|
|
3761
3760
|
* @license
|
|
3762
3761
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
3763
3762
|
* SPDX-License-Identifier: MIT
|
|
3764
|
-
*/class
|
|
3763
|
+
*/class ai{constructor(e,t,i,n,a){this.eventBus=t,this.ui=i,this.plugins=n,this.config=a,this.state=e}getState(){return Object.freeze(Object.assign({},this.state))}updateState(e){if(this.state=Object.assign(Object.assign({},this.state),e),this.ui.onStateChange)try{this.ui.onStateChange(this.getState())}catch(e){this.logError("Error in UI state change callback:",e)}this.eventBus.emit("state:changed",this.state),this.plugins.forEach(e=>{if(e.onStateChange)try{e.onStateChange(this.getState())}catch(e){this.logError("Error in plugin state change handler:",e)}})}addMessageToState(e){this.state.messages=[...this.state.messages,e],e.suggestions&&e.suggestions.length>0?this.state.suggestions=[...e.suggestions]:this.state.messages.length>1&&(this.state.suggestions=[]),this.config.maxMessages&&this.state.messages.length>this.config.maxMessages&&(this.state.messages=this.state.messages.slice(-this.config.maxMessages)),this.ui.onStateChange&&this.ui.onStateChange(this.getState()),this.eventBus.emit("state:changed",this.state),this.ui.scrollToBottom&&this.ui.scrollToBottom(),this.eventBus.emit("message:added",e)}updateMessageInState(e,t){this.state.messages=this.state.messages.map(i=>i.id===e?Object.assign(Object.assign({},i),t):i),this.ui.onStateChange&&this.ui.onStateChange(this.getState()),this.eventBus.emit("state:changed",this.state);const i=this.state.messages.find(t=>t.id===e);i&&this.eventBus.emit("message:updated",i)}removeMessageFromState(e){this.state.messages=this.state.messages.filter(t=>t.id!==e),this.ui.onStateChange&&this.ui.onStateChange(this.getState()),this.eventBus.emit("state:changed",this.state),this.eventBus.emit("message:deleted",e)}resetState(e){this.state=Object.assign({},e),this.updateState(this.state)}getMessages(){return[...this.state.messages]}getMessageById(e){return this.state.messages.find(t=>t.id===e)}isTyping(){return this.state.isTyping}isProcessing(){return this.state.isProcessing}setTyping(e){this.updateState({isTyping:e}),e&&this.ui.onTypingStart?this.ui.onTypingStart():!e&&this.ui.onTypingEnd&&this.ui.onTypingEnd()}setProcessing(e){this.updateState({isProcessing:e})}logError(e,t){console.error(`[StateHandler] ${e}`,t)}}
|
|
3765
3764
|
/**
|
|
3766
3765
|
* @license
|
|
3767
3766
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
3768
3767
|
* SPDX-License-Identifier: MIT
|
|
3769
|
-
*/class
|
|
3768
|
+
*/class oi{constructor(e,t,i){this.stateHandler=e,this.eventBus=t,this.plugins=i}createMessage(e){return Object.assign({id:this.generateId("msg"),sender:e.sender||"user",text:e.text||"",timestamp:e.timestamp||(new Date).toISOString()},e)}createUserMessage(e,t){return this.createMessage({sender:"user",text:e,metadata:t})}createBotMessage(e,t){return this.createMessage({sender:"bot",text:e,metadata:t})}addMessage(e){const t=this.createMessage(e);return this.stateHandler.addMessageToState(t),"bot"===t.sender?(this.eventBus.emit("message:received",t),this.plugins.forEach(e=>{e.onMessageReceived&&e.onMessageReceived(t)})):(this.eventBus.emit("message:sent",t),this.plugins.forEach(e=>{e.onMessageSent&&e.onMessageSent(t)})),t}updateMessage(e,t){this.stateHandler.updateMessageInState(e,t)}deleteMessage(e){this.stateHandler.removeMessageFromState(e)}clearMessages(){this.stateHandler.updateState({messages:[]})}getMessages(){return this.stateHandler.getMessages()}getMessageById(e){return this.stateHandler.getMessageById(e)}updateBotMessageText(e,t){const i=this.getMessageById(e);i&&"bot"===i.sender&&this.updateMessage(e,{text:t})}appendToBotMessage(e,t){const i=this.getMessageById(e);i&&"bot"===i.sender&&this.updateMessage(e,{text:i.text+t})}generateId(e){return`${e}_${Date.now()}_${Math.random().toString(36).substr(2,9)}`}}
|
|
3770
3769
|
/**
|
|
3771
3770
|
* @license
|
|
3772
3771
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
3773
3772
|
* SPDX-License-Identifier: MIT
|
|
3774
|
-
*/var
|
|
3773
|
+
*/var si=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 ri{constructor(e,t,i,n,a){this.stateHandler=e,this.eventBus=t,this.ui=i,this.config=n,this.provider=a}setProvider(e){this.provider=e}createThread(e){return si(this,void 0,void 0,function*(){if(!this.config.enableThreads)throw new Error("Threads are not enabled");const t=this.stateHandler.getState(),i={id:this.generateId("thread"),title:e||`Chat ${t.threads.length+1}`,messages:[],createdAt:(new Date).toISOString(),updatedAt:(new Date).toISOString()};if(this.provider&&"function"==typeof this.provider.createConversation)try{const e=yield this.provider.createConversation(i.title);e&&e.id&&(i.id=String(e.id),i.conversationId=e.id)}catch(e){console.error("Error calling provider.createConversation:",e)}return this.stateHandler.updateState({threads:[i,...t.threads],currentThreadId:i.id,messages:[]}),this.eventBus.emit("thread:created",i),this.eventBus.emit("thread:selected",i),this.ui.focusInput&&setTimeout(()=>{this.ui.focusInput()},100),i})}switchThread(e){const t=this.stateHandler.getState(),i=t.threads.find(t=>t.id===e);if(!i)throw new Error(`Thread "${e}" not found`);t.currentThreadId&&this.saveCurrentThread(),this.stateHandler.updateState({currentThreadId:e,messages:[...i.messages]}),this.eventBus.emit("thread:selected",i)}bookmarkThread(e){const t=this.stateHandler.getState(),i=t.threads.find(t=>t.id===e);if(!i)throw new Error(`Thread "${e}" not found`);const n=!i.bookmarked,a=t.threads.map(t=>t.id===e?Object.assign(Object.assign({},t),{bookmarked:n}):t);this.stateHandler.updateState({threads:a}),this.eventBus.emit("thread:bookmarked",{threadId:e,bookmarked:n})}renameThread(e,t){const i=this.stateHandler.getState();if(!i.threads.find(t=>t.id===e))throw new Error(`Thread "${e}" not found`);const n=i.threads.map(i=>i.id===e?Object.assign(Object.assign({},i),{title:t,updatedAt:(new Date).toISOString()}):i);this.stateHandler.updateState({threads:n}),this.eventBus.emit("thread:renamed",{threadId:e,title:t})}deleteThread(e){const t=this.stateHandler.getState(),i=t.threads.filter(t=>t.id!==e);t.currentThreadId===e?i.length>0?(this.stateHandler.updateState({threads:i}),this.switchThread(i[0].id)):this.stateHandler.updateState({threads:i,currentThreadId:void 0,messages:[]}):this.stateHandler.updateState({threads:i}),this.eventBus.emit("thread:deleted",e)}getCurrentThread(){const e=this.stateHandler.getState();return e.threads.find(t=>t.id===e.currentThreadId)}getThreads(){return[...this.stateHandler.getState().threads]}saveCurrentThread(){const e=this.stateHandler.getState();e.currentThreadId&&this.updateThreadMessages(e.currentThreadId)}updateThreadMessages(e){const t=this.stateHandler.getState(),i=t.threads.map(i=>i.id===e?Object.assign(Object.assign({},i),{messages:[...t.messages],updatedAt:(new Date).toISOString()}):i);this.stateHandler.updateState({threads:i})}generateId(e){return`${e}_${Date.now()}_${Math.random().toString(36).substr(2,9)}`}}
|
|
3775
3774
|
/**
|
|
3776
3775
|
* @license
|
|
3777
3776
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
3778
3777
|
* SPDX-License-Identifier: MIT
|
|
3779
|
-
*/var
|
|
3778
|
+
*/var li=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 ci{constructor(e,t){this.stateHandler=e,this.eventBus=t}addFile(e){const t=this.stateHandler.getState();this.stateHandler.updateState({uploadedFiles:[...t.uploadedFiles,e]}),this.eventBus.emit("file:uploaded",e)}updateFile(e,t){const i=this.stateHandler.getState();this.stateHandler.updateState({uploadedFiles:i.uploadedFiles.map(i=>i.id===e?Object.assign(Object.assign({},i),t):i)})}removeFile(e){const t=this.stateHandler.getState(),i=t.uploadedFiles.find(t=>t.id===e);this.revokePreviewUrl(i),this.stateHandler.updateState({uploadedFiles:t.uploadedFiles.filter(t=>t.id!==e)}),this.eventBus.emit("file:removed",e)}revokePreviewUrl(e){if(e&&e.previewUrl&&"undefined"!=typeof URL&&URL.revokeObjectURL&&e.previewUrl.startsWith("blob:"))try{URL.revokeObjectURL(e.previewUrl)}catch(e){}}clearFiles(){this.stateHandler.updateState({uploadedFiles:[]})}getUploadedFiles(){return[...this.stateHandler.getState().uploadedFiles]}getFileById(e){return this.stateHandler.getState().uploadedFiles.find(t=>t.id===e)}createChatbotFile(e){return li(this,void 0,void 0,function*(){const t={id:this.generateId("file"),name:e.name,size:e.size,type:this.determineFileType(e.type),mimeType:e.type,uploadProgress:0,isUploading:!0};if(e.type.startsWith("image/")&&"undefined"!=typeof URL&&URL.createObjectURL)try{t.previewUrl=URL.createObjectURL(e)}catch(e){}return t})}determineFileType(e){return e.startsWith("image/")?"image":e.startsWith("video/")?"video":e.startsWith("audio/")?"audio":e.includes("pdf")?"pdf":e.includes("text/")?"text":"document"}generateId(e){return`${e}_${Date.now()}_${Math.random().toString(36).substr(2,9)}`}}
|
|
3780
3779
|
/**
|
|
3781
3780
|
* @license
|
|
3782
3781
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
3783
3782
|
* SPDX-License-Identifier: MIT
|
|
3784
|
-
*/class
|
|
3783
|
+
*/class di{constructor(e,t){this.stateHandler=e,this.eventBus=t}setModules(e){this.stateHandler.updateState({modules:e})}selectModules(e){this.stateHandler.updateState({selectedModules:e}),this.eventBus.emit("module:selected",e)}toggleModule(e){const t=this.stateHandler.getState(),i=t.selectedModules.includes(e)?t.selectedModules.filter(t=>t!==e):[...t.selectedModules,e];this.selectModules(i)}getSelectedModules(){const e=this.stateHandler.getState();return(e.modules||[]).filter(t=>e.selectedModules.includes(t.id))}clearSelection(){this.stateHandler.updateState({selectedModules:[]})}}
|
|
3785
3784
|
/**
|
|
3786
3785
|
* @license
|
|
3787
3786
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
3788
3787
|
* SPDX-License-Identifier: MIT
|
|
3789
|
-
*/class
|
|
3788
|
+
*/class pi{constructor(e){this.stateHandler=e}setSuggestions(e){this.stateHandler.updateState({suggestions:e})}clearSuggestions(){this.stateHandler.updateState({suggestions:[]})}getSuggestions(){return[...this.stateHandler.getState().suggestions]}removeSuggestion(e){const t=this.stateHandler.getState();this.stateHandler.updateState({suggestions:t.suggestions.filter(t=>t.id!==e)})}}
|
|
3790
3789
|
/**
|
|
3791
3790
|
* @license
|
|
3792
3791
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
3793
3792
|
* SPDX-License-Identifier: MIT
|
|
3794
|
-
*/var
|
|
3793
|
+
*/var hi=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 ui{constructor(e,t,i,n,a,o,s){this.stateHandler=t,this.messageHandler=i,this.fileHandler=n,this.eventBus=a,this.ui=o,this.plugins=s,this.cancelRequested=!1,this.provider=e}setProvider(e){this.provider=e}stopCurrentProcessing(){this.cancelRequested=!0,this.eventBus.emit("processing:stopped")}hasProvider(){return!!this.provider&&this.provider.isConnected()}processMessage(e){return hi(this,void 0,void 0,function*(){if(this.provider){if(!this.provider.isConnected()){this.log("Provider not connected, attempting to connect...");try{yield this.provider.connect({})}catch(e){this.logError("Failed to auto-connect provider:",e)}if(!this.provider.isConnected())return void this.log("Provider is still not connected after attempt; aborting processing")}try{this.cancelRequested=!1,this.ui.onProcessingStart&&this.ui.onProcessingStart(),this.ui.onTypingStart&&this.ui.onTypingStart(),this.stateHandler.setTyping(!0),this.stateHandler.setProcessing(!0),this.eventBus.emit("processing:start");const t=this.buildContext(),i=this.provider.sendMessage(e.text,t);yield this.processStream(i)}catch(e){throw this.logError("Provider error:",e),this.eventBus.emit("error",e),e}finally{this.ui.onProcessingEnd&&this.ui.onProcessingEnd(),this.ui.onTypingEnd&&this.ui.onTypingEnd(),this.stateHandler.updateState({statusText:void 0}),this.stateHandler.setTyping(!1),this.stateHandler.setProcessing(!1),this.eventBus.emit("processing:end"),this.fileHandler.clearFiles()}}else this.log("No provider configured")})}processStream(e){return hi(this,void 0,void 0,function*(){var t;let i=null;const n=Array.from(this.plugins.values()).filter(e=>Array.isArray(e.htmlTags)),a=[];let o="",s="",r=0;if(n.length>0)for(const e of n)for(const t of e.htmlTags)r=Math.max(r,t.open.length,t.close.length);try{let l=!1;for(;!l&&!this.cancelRequested;){const c=yield e.next();if(l=c.done||!1,l||!c.value)break;const d=String(c.value),p=d.startsWith(s)?d.slice(s.length):d;s=d,o+=p;let h="",u=!1;for(;o.length;){const e=a[a.length-1];if(e){const t=e.buffer+o,n=t.indexOf(e.close);if(-1===n){e.buffer=t,o="";break}const s=t.slice(0,n),r="function"==typeof e.plugin.renderHtmlBlock?e.plugin.renderHtmlBlock(e.name,s):"";if(r){const t=/<div data-placeholder-id="[^"]*">[\s\S]*?<\/div>/;e.hasPlaceholder&&i&&t.test(i.text)?(i.text=i.text.replace(t,r),this.messageHandler.updateMessage(i.id,{text:i.text})):e.hasPlaceholder&&t.test(h)?(h=h.replace(t,r),u=!0):(h+=r,u=!0)}a.pop(),o=t.slice(n+e.close.length);continue}if(0===n.length){h+=o,o="";break}let t=null;for(const e of n)for(const i of e.htmlTags){const n=o.indexOf(i.open);-1!==n&&(!t||n<t.idx)&&(t={idx:n,plugin:e,name:i.name,open:i.open,close:i.close})}if(!t){if(r>0&&o.length>r-1){const e=o.length-(r-1);h+=o.slice(0,e),o=o.slice(e)}break}{h+=o.slice(0,t.idx);let e=!1;if("function"==typeof t.plugin.renderHtmlBlockPlaceholder){const i=t.plugin.renderHtmlBlockPlaceholder(t.name);i&&(h+=i,u=!0,e=!0)}a.push({plugin:t.plugin,name:t.name,open:t.open,close:t.close,buffer:"",hasPlaceholder:e}),o=o.slice(t.idx+t.open.length)}}if(h)for(const e of this.plugins.values()){!(Array.isArray(e.htmlTags)&&e.htmlTags.length>0)&&e.afterReceive&&(h=yield e.afterReceive(h))}const b=u||/<\w+[^>]*>/.test(h);i?h&&(this.messageHandler.appendToBotMessage(i.id,h),i.text+=h,b&&!(null===(t=i.metadata)||void 0===t?void 0:t.renderAsHtml)&&this.messageHandler.updateMessage(i.id,{metadata:Object.assign(Object.assign({},i.metadata||{}),{renderAsHtml:!0})})):(i=this.messageHandler.createBotMessage(h,b?{renderAsHtml:!0}:void 0),this.stateHandler.addMessageToState(i),this.ui.onTypingEnd&&this.ui.onTypingEnd(),this.stateHandler.setTyping(!1))}if(!this.cancelRequested&&i&&(o&&this.messageHandler.appendToBotMessage(i.id,o),a.length>0)){const e=a.map(e=>e.open+e.buffer).join("");e&&this.messageHandler.appendToBotMessage(i.id,e)}}catch(e){throw this.logError("Error processing stream:",e),e}})}buildContext(){const e=this.stateHandler.getState(),t=e.currentThreadId?e.threads.find(t=>t.id===e.currentThreadId):void 0;return console.log("[ProviderService] buildContext state.uploadedFiles:",e.uploadedFiles),{messages:e.messages,metadata:e.metadata,selectedModules:e.selectedModules,currentThread:t,uploadedFiles:e.uploadedFiles}}uploadFileToProvider(e){return hi(this,void 0,void 0,function*(){var t,i;if(!(null===(i=null===(t=this.provider)||void 0===t?void 0:t.capabilities)||void 0===i?void 0:i.fileUpload)||!this.provider.uploadFile)throw new Error("Provider does not support file upload");const n=this.buildContext();return yield this.provider.uploadFile(e,n)})}getCapabilities(){var e;return(null===(e=this.provider)||void 0===e?void 0:e.capabilities)||{streaming:!1,fileUpload:!1,contextWindow:0}}log(e,...t){console.log(`[ProviderService] ${e}`,...t)}logError(e,t){console.error(`[ProviderService] ${e}`,t)}}
|
|
3795
3794
|
/**
|
|
3796
3795
|
* @license
|
|
3797
3796
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
3798
3797
|
* SPDX-License-Identifier: MIT
|
|
3799
|
-
*/var
|
|
3798
|
+
*/var bi=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 fi{constructor(e){this.validators=[],this.validators=e.validators||[]}validateMessage(e){return bi(this,void 0,void 0,function*(){const t=[],i=[];e.trim()||t.push("Message cannot be empty");for(const n of this.validators)try{(yield n.validator(e))||(t.push(n.errorMessage),n.warningMessage&&i.push(n.warningMessage))}catch(e){this.logError("Validation error:",e),t.push("Validation failed")}return{isValid:0===t.length,errors:t,warnings:i}})}validateFile(e,t){const i=[],n=(null==t?void 0:t.maxFileSize)||10485760;if(e.size>n&&i.push(`File size exceeds maximum allowed (${this.formatFileSize(n)})`),(null==t?void 0:t.allowedTypes)&&t.allowedTypes.length>0){t.allowedTypes.some(t=>t.startsWith(".")?e.name.toLowerCase().endsWith(t.toLowerCase()):e.type.includes(t))||i.push(`File type not allowed. Allowed types: ${t.allowedTypes.join(", ")}`)}return{isValid:0===i.length,errors:i,warnings:[]}}addValidator(e){this.validators.push(e)}removeValidator(e){this.validators=this.validators.filter(t=>t.id!==e)}clearValidators(){this.validators=[]}getValidators(){return[...this.validators]}formatFileSize(e){if(0===e)return"0 Bytes";const t=Math.floor(Math.log(e)/Math.log(1024));return Math.round(e/Math.pow(1024,t)*100)/100+" "+["Bytes","KB","MB","GB"][t]}logError(e,t){console.error(`[ValidationService] ${e}`,t)}}
|
|
3800
3799
|
/**
|
|
3801
3800
|
* @license
|
|
3802
3801
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
3803
3802
|
* SPDX-License-Identifier: MIT
|
|
3804
|
-
*/var
|
|
3803
|
+
*/var vi=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 gi{constructor(e,t,i){this.stateHandler=t,this.config=i,this.storage=e,this.setupAutoSave()}setStorage(e){this.storage=e,this.setupAutoSave()}saveState(){return vi(this,arguments,void 0,function*(e="chatbot-state"){if(!this.storage)throw new Error("No storage configured");try{const t=this.stateHandler.getState();yield this.storage.save(e,t),this.log("State saved to storage")}catch(e){throw this.logError("Error saving to storage:",e),e}})}loadState(){return vi(this,arguments,void 0,function*(e="chatbot-state"){if(!this.storage)throw new Error("No storage configured");try{const t=yield this.storage.load(e);t&&(this.stateHandler.updateState(t),this.log("State loaded from storage"))}catch(e){throw this.logError("Error loading from storage:",e),e}})}clearStorage(){return vi(this,void 0,void 0,function*(){if(!this.storage)throw new Error("No storage configured");try{yield this.storage.clear(),this.log("Storage cleared")}catch(e){throw this.logError("Error clearing storage:",e),e}})}setupAutoSave(){this.autoSaveTimer&&clearInterval(this.autoSaveTimer),this.config.autoSaveInterval&&this.storage&&(this.autoSaveTimer=setInterval(()=>{this.saveState().catch(e=>{this.logError("Auto-save failed:",e)})},this.config.autoSaveInterval))}stopAutoSave(){this.autoSaveTimer&&(clearInterval(this.autoSaveTimer),this.autoSaveTimer=void 0)}startAutoSave(e){this.config.autoSaveInterval=e,this.setupAutoSave()}hasStorage(){return!!this.storage}destroy(){this.stopAutoSave()}log(e){console.log(`[StorageService] ${e}`)}logError(e,t){console.error(`[StorageService] ${e}`,t)}}
|
|
3805
3804
|
/**
|
|
3806
3805
|
* @license
|
|
3807
3806
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
3808
3807
|
* SPDX-License-Identifier: MIT
|
|
3809
|
-
*/var
|
|
3808
|
+
*/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,e&&e.forEach(e=>this.registerPlugin(e))}registerPlugin(e,t){if(this.plugins.has(e.id))this.log(`Plugin "${e.id}" is already registered, skipping`);else if(this.plugins.set(e.id,e),this.log(`Registered plugin: ${e.name} v${e.version}`),e.onInit&&t)try{e.onInit(t)}catch(t){this.logError(`Error initializing plugin "${e.id}":`,t)}}unregisterPlugin(e){const t=this.plugins.get(e);if(t&&t.onDestroy)try{t.onDestroy()}catch(t){this.logError(`Error destroying plugin "${e}":`,t)}this.plugins.delete(e),this.log(`Unregistered plugin: ${e}`)}getPlugin(e){return this.plugins.get(e)}getAllPlugins(){return Array.from(this.plugins.values())}hasPlugin(e){return this.plugins.has(e)}getPluginsMap(){return this.plugins}executeHook(e,...t){return mi(this,void 0,void 0,function*(){for(const i of this.plugins.values()){const n=i[e];if("function"==typeof n)try{yield n(...t)}catch(t){this.logError(`Error executing hook "${String(e)}" on plugin "${i.id}":`,t)}}})}clearPlugins(){this.plugins.forEach((e,t)=>{this.unregisterPlugin(t)}),this.plugins.clear()}getPluginCount(){return this.plugins.size}log(e){console.log(`[PluginService] ${e}`)}logError(e,t){console.error(`[PluginService] ${e}`,t)}}const yi=["ar","fr"],wi="__nuraly_localization__";!function(){if(globalThis[wi])return globalThis[wi];const e=kt({sourceLocale:"en",targetLocales:yi,loadLocale:e=>import(`../../locales/generated/${e}.js`)});globalThis[wi]=e}();
|
|
3810
3809
|
/**
|
|
3811
3810
|
* @license
|
|
3812
3811
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
3813
3812
|
* SPDX-License-Identifier: MIT
|
|
3814
3813
|
*/
|
|
3815
|
-
var wi=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 $i{constructor(e={}){this.plugins=new Map,this.config=e,this.ui=e.ui||{},this.eventBus=new ti,this.pluginService=new mi,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 ni(t,this.eventBus,this.ui,this.plugins,this.config),this.messageHandler=new ai(this.stateHandler,this.eventBus,this.plugins),this.threadHandler=new si(this.stateHandler,this.eventBus,this.ui,this.config,e.provider),this.fileHandler=new li(this.stateHandler,this.eventBus),this.moduleHandler=new ci(this.stateHandler,this.eventBus),this.suggestionHandler=new di(this.stateHandler),this.providerService=new hi(e.provider,this.stateHandler,this.messageHandler,this.fileHandler,this.eventBus,this.ui,this.plugins),this.validationService=new bi(this.config),this.storageService=new vi(e.storage,this.stateHandler,this.config),e.provider){const t=e.provider;queueMicrotask(()=>{this.initializeProvider(t)})}this.setupLifecycleHooks()}initializeProvider(e){return wi(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 wi(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 wi(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 ii(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 wi(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);this.fileHandler.addFile(n);try{const t=yield this.providerService.uploadFileToProvider(e),a=Object.assign({isUploading:!1,uploadProgress:100},t||{});this.fileHandler.updateFile(n.id,a),Object.assign(n,a),i.push(n),this.ui.showFilePreview&&this.ui.showFilePreview(n)}catch(e){throw this.fileHandler.removeFile(n.id),e}}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 wi(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 wi(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 wi(this,void 0,void 0,function*(){this.log("Message sent:",e)})}beforeProviderCall(e){return wi(this,void 0,void 0,function*(){this.log("Calling provider for message:",e.id)})}afterProviderCall(){return wi(this,void 0,void 0,function*(){this.log("Provider call completed")})}handleProviderError(e){return wi(this,void 0,void 0,function*(){this.logError("Provider error:",e);const t=this.messageHandler.createMessage({sender:Tt.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(()=>wi(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 wi(this,arguments,void 0,function*(e="chatbot-state"){yield this.storageService.saveState(e)})}loadFromStorage(){return wi(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 wi(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)}}
|
|
3814
|
+
var $i=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 ki{constructor(e={}){this.plugins=new Map,this.config=e,this.ui=e.ui||{},this.eventBus=new ii,this.pluginService=new xi,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 ai(t,this.eventBus,this.ui,this.plugins,this.config),this.messageHandler=new oi(this.stateHandler,this.eventBus,this.plugins),this.threadHandler=new ri(this.stateHandler,this.eventBus,this.ui,this.config,e.provider),this.fileHandler=new ci(this.stateHandler,this.eventBus),this.moduleHandler=new di(this.stateHandler,this.eventBus),this.suggestionHandler=new pi(this.stateHandler),this.providerService=new ui(e.provider,this.stateHandler,this.messageHandler,this.fileHandler,this.eventBus,this.ui,this.plugins),this.validationService=new fi(this.config),this.storageService=new gi(e.storage,this.stateHandler,this.config),e.provider){const t=e.provider;queueMicrotask(()=>{this.initializeProvider(t)})}this.setupLifecycleHooks()}initializeProvider(e){return $i(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 $i(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 $i(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 ni(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 $i(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);this.fileHandler.addFile(n);try{const t=yield this.providerService.uploadFileToProvider(e),a=Object.assign({isUploading:!1,uploadProgress:100},t||{});this.fileHandler.updateFile(n.id,a),Object.assign(n,a),i.push(n),this.ui.showFilePreview&&this.ui.showFilePreview(n)}catch(e){throw this.fileHandler.removeFile(n.id),e}}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 $i(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 $i(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 $i(this,void 0,void 0,function*(){this.log("Message sent:",e)})}beforeProviderCall(e){return $i(this,void 0,void 0,function*(){this.log("Calling provider for message:",e.id)})}afterProviderCall(){return $i(this,void 0,void 0,function*(){this.log("Provider call completed")})}handleProviderError(e){return $i(this,void 0,void 0,function*(){this.logError("Provider error:",e);const t=this.messageHandler.createMessage({sender:Tt.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(()=>$i(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 $i(this,arguments,void 0,function*(e="chatbot-state"){yield this.storageService.saveState(e)})}loadFromStorage(){return $i(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 $i(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)}}
|
|
3816
3815
|
/**
|
|
3817
3816
|
* @license
|
|
3818
3817
|
* Copyright 2024 Nuraly, Laabidi Aymen
|
|
3819
3818
|
* SPDX-License-Identifier: MIT
|
|
3820
|
-
*/class
|
|
3819
|
+
*/class Si extends Ve{get canvasWrapper(){return this._host.canvasWrapper}get canvasViewport(){return this._host.canvasViewport}clientToCanvas(e,t){const i=this.canvasWrapper;if(!i)return{x:0,y:0};const n=i.getBoundingClientRect(),{viewport:a}=this._host;return{x:(e-n.left-a.panX)/a.zoom,y:(t-n.top-a.panY)/a.zoom}}snapToGrid(e,t,i=20){return{x:Math.round(e/i)*i,y:Math.round(t/i)*i}}generateUniqueName(e){const t=e.replace(/ \(copy(?: \d+)?\)$/,""),i=new Set(this._host.workflow.nodes.map(e=>e.name)),n=`${t} (copy)`;if(!i.has(n))return n;let a=2;for(;i.has(`${t} (copy ${a})`);)a++;return`${t} (copy ${a})`}generateNodeId(){return`node_${Date.now()}_${globalThis.crypto.randomUUID().slice(0,9)}`}generateEdgeId(){return`edge_${Date.now()}_${globalThis.crypto.randomUUID().slice(0,9)}`}}
|
|
3821
3820
|
/**
|
|
3822
3821
|
* @license
|
|
3823
3822
|
* Copyright 2024 Nuraly, Laabidi Aymen
|
|
3824
3823
|
* SPDX-License-Identifier: MIT
|
|
3825
|
-
*/class
|
|
3824
|
+
*/class Ci extends Si{constructor(e){super(e),this.debouncedDispatchViewportChanged=this.debounce(()=>{this._host.dispatchViewportChanged()},300),this.animationFrameId=null,this.boundHandleWheel=this.handleWheel.bind(this)}hostConnected(){window.addEventListener("wheel",this.boundHandleWheel,{passive:!1,capture:!0})}hostDisconnected(){window.removeEventListener("wheel",this.boundHandleWheel,{capture:!0}),this.debouncedDispatchViewportChanged.cancel(),null!==this.animationFrameId&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null)}handleWheel(e){const t=this.canvasWrapper;if(!t)return;if(this._host.disabled)return;const i=e.composedPath();if(!i.some(e=>e===t||e===this._host))return;if(i.some(e=>{var t,i,n,a,o,s,r;return e instanceof HTMLElement&&((null===(t=e.classList)||void 0===t?void 0:t.contains("node-palette"))||(null===(i=e.classList)||void 0===i?void 0:i.contains("config-panel"))||(null===(n=e.classList)||void 0===n?void 0:n.contains("insert-panel"))||(null===(a=e.classList)||void 0===a?void 0:a.contains("chatbot-preview-panel"))||(null===(o=e.classList)||void 0===o?void 0:o.contains("palette-content"))||(null===(s=e.classList)||void 0===s?void 0:s.contains("config-panel-content"))||(null===(r=e.classList)||void 0===r?void 0:r.contains("chatbot-preview-content")))}))return;e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation();const{deltaX:n,deltaY:a,ctrlKey:o,metaKey:s}=e;o||s?this.handleZoom(e,a):this.handlePan(n,a)}handleZoom(e,t){const i=this.canvasWrapper;if(!i)return;const{viewport:n}=this._host,a=Math.max(.25,Math.min(2,n.zoom*(1-.01*t))),o=i.getBoundingClientRect(),s=e.clientX-o.left,r=e.clientY-o.top,l=a/n.zoom;this._host.viewport={zoom:a,panX:s-(s-n.panX)*l,panY:r-(r-n.panY)*l},this.updateTransform(),this._host.dispatchViewportChanged()}handlePan(e,t){const{viewport:i}=this._host;this._host.viewport=Object.assign(Object.assign({},i),{panX:i.panX-e,panY:i.panY-t}),this.updateTransform(),this.debouncedDispatchViewportChanged()}updateTransform(){const e=this.canvasViewport;if(!e)return;const{viewport:t}=this._host;e.style.transform=`translate(${t.panX}px, ${t.panY}px) scale(${t.zoom})`,this.updateConfigPanelPosition(),this.updateInsertPanelPosition()}updateConfigPanelPosition(){const{configuredNode:e,configPanel:t,viewport:i}=this._host;if(!t||!e)return;const n=(e.position.x+180+20)*i.zoom+i.panX,a=e.position.y*i.zoom+i.panY;t.style.left=`${n}px`,t.style.top=`${a}px`}updateInsertPanelPosition(){const e=this._host,{insertPanelNode:t,insertPanel:i,viewport:n}=e;if(!i||!t)return;const a=t.position.x*n.zoom+n.panX-340*n.zoom,o=t.position.y*n.zoom+n.panY;i.style.left=`${a}px`,i.style.top=`${o}px`,i.style.transform=`scale(${n.zoom})`,i.style.transformOrigin="top right"}handlePanDrag(e){if(this._host.disabled)return;const{panStart:t}=this._host;this._host.viewport=Object.assign(Object.assign({},this._host.viewport),{panX:e.clientX-t.x,panY:e.clientY-t.y}),this.updateTransform()}startPan(e){this._host.disabled||(this._host.isPanning=!0,this._host.panStart={x:e.clientX-this._host.viewport.panX,y:e.clientY-this._host.viewport.panY})}stopPan(){this._host.isPanning=!1,this._host.dispatchViewportChanged()}zoomIn(){this.setZoom(Math.min(2,1.2*this._host.viewport.zoom))}zoomOut(){this.setZoom(Math.max(.25,this._host.viewport.zoom/1.2))}panToPosition(e,t,i=!0){const n=this.canvasWrapper;if(!n)return;const a=n.getBoundingClientRect(),{zoom:o}=this._host.viewport,s=a.width/2-e*o,r=a.height/2-t*o;if(!i)return this._host.viewport={zoom:o,panX:s,panY:r},this.updateTransform(),void this._host.dispatchViewportChanged();null!==this.animationFrameId&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null);const l=this._host.viewport.panX,c=this._host.viewport.panY,d=performance.now(),p=e=>{const t=e-d,i=Math.min(t/500,1),n=1-Math.pow(1-i,3),a=l+(s-l)*n,h=c+(r-c)*n;this._host.viewport={zoom:o,panX:a,panY:h},this.updateTransform(),i<1?this.animationFrameId=requestAnimationFrame(p):(this.animationFrameId=null,this._host.dispatchViewportChanged())};this.animationFrameId=requestAnimationFrame(p)}resetView(){this._host.viewport={zoom:1,panX:0,panY:0},this.updateTransform(),this._host.dispatchViewportChanged()}setZoomAtPoint(e,t,i){const n=this.canvasWrapper;if(!n)return;const a=Math.max(.25,Math.min(2,e)),o=n.getBoundingClientRect(),s=t-o.left,r=i-o.top,{viewport:l}=this._host,c=a/l.zoom;this._host.viewport={zoom:a,panX:s-(s-l.panX)*c,panY:r-(r-l.panY)*c},this.updateTransform(),this._host.dispatchViewportChanged()}setZoom(e){const t=this.canvasWrapper;if(!t)return;const i=t.getBoundingClientRect(),{viewport:n}=this._host,a=i.width/2,o=i.height/2,s=a-(a-n.panX)*(e/n.zoom),r=o-(o-n.panY)*(e/n.zoom);this._host.viewport={zoom:e,panX:s,panY:r},this.updateTransform(),this._host.dispatchViewportChanged()}getZoomPercentage(){return Math.round(100*this._host.viewport.zoom)}}
|
|
3826
3825
|
/**
|
|
3827
3826
|
* @license
|
|
3828
3827
|
* Copyright 2024 Nuraly, Laabidi Aymen
|
|
3829
3828
|
* SPDX-License-Identifier: MIT
|
|
3830
|
-
*/class
|
|
3829
|
+
*/class Ti extends Si{constructor(e){super(e),this.undoController=null}setUndoController(e){this.undoController=e}clearSelection(){this._host.selectedNodeIds=new Set,this._host.selectedEdgeIds=new Set,this._host.contextMenu=null}selectAll(){this._host.selectedNodeIds=new Set(this._host.workflow.nodes.map(e=>e.id)),this._host.selectedEdgeIds=new Set(this._host.workflow.edges.map(e=>e.id))}selectNode(e,t=!1){t||this.clearSelection(),this._host.selectedNodeIds.add(e),this._host.selectedNodeIds=new Set(this._host.selectedNodeIds)}deselectNode(e){this._host.selectedNodeIds.delete(e),this._host.selectedNodeIds=new Set(this._host.selectedNodeIds)}toggleNodeSelection(e){this._host.selectedNodeIds.has(e)?this.deselectNode(e):this.selectNode(e,!0)}selectEdge(e,t=!1){t||this.clearSelection(),this._host.selectedEdgeIds.add(e),this._host.selectedEdgeIds=new Set(this._host.selectedEdgeIds)}isNodeSelected(e){return this._host.selectedNodeIds.has(e)}isEdgeSelected(e){return this._host.selectedEdgeIds.has(e)}getSelectedNodes(){return this._host.workflow.nodes.filter(e=>this._host.selectedNodeIds.has(e.id))}getSelectedEdges(){return this._host.workflow.edges.filter(e=>this._host.selectedEdgeIds.has(e.id))}deleteSelected(){if(this._host.readonly)return;const e=this._host.selectedNodeIds,t=this._host.selectedEdgeIds,i=this._host.workflow.nodes.filter(t=>e.has(t.id)),n=this._host.workflow.edges.filter(i=>t.has(i.id)||e.has(i.sourceNodeId)||e.has(i.targetNodeId));this.undoController&&(i.length>0||n.length>0)&&this.undoController.recordBulkDeleted(i,n),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.configuredNode&&e.has(this._host.configuredNode.id)&&(this._host.configuredNode=null);const a=this._host;if(a.collaborative&&a.collaborationController){for(const e of i)a.collaborationController.broadcastOperation("DELETE",e.id,{});for(const e of n)t.has(e.id)&&a.collaborationController.broadcastOperation("DELETE_CONNECTOR",e.id,{})}this.clearSelection(),this._host.dispatchWorkflowChanged()}duplicateSelected(){var e;if(this._host.readonly||0===this._host.selectedNodeIds.size)return;const t=this._host.workflow.nodes.filter(e=>this._host.selectedNodeIds.has(e.id)),i=new Map,n=[],a=[];for(const a of t){const t=this.generateNodeId();i.set(a.id,t),n.push(Object.assign(Object.assign({},a),{id:t,name:this.generateUniqueName(a.name),position:{x:a.position.x+40,y:a.position.y+40},ports:{inputs:a.ports.inputs.map(e=>Object.assign({},e)),configs:null===(e=a.ports.configs)||void 0===e?void 0:e.map(e=>Object.assign({},e)),outputs:a.ports.outputs.map(e=>Object.assign({},e))}}))}const o=this._host.workflow.edges.filter(e=>this._host.selectedNodeIds.has(e.sourceNodeId)&&this._host.selectedNodeIds.has(e.targetNodeId));for(const e of o){const t=i.get(e.sourceNodeId),n=i.get(e.targetNodeId);t&&n&&a.push(Object.assign(Object.assign({},e),{id:this.generateEdgeId(),sourceNodeId:t,targetNodeId:n}))}this.undoController&&this.undoController.recordNodesDuplicated(n,a);const s=new Set(n.map(e=>e.id)),r=new Set(a.map(e=>e.id));this._host.selectedNodeIds=s,this._host.selectedEdgeIds=r,this._host.setWorkflow(Object.assign(Object.assign({},this._host.workflow),{nodes:[...this._host.workflow.nodes,...n],edges:[...this._host.workflow.edges,...a]})),this._host.dispatchWorkflowChanged(),this._host.updateComplete.then(()=>{this._host.selectedNodeIds=s,this._host.selectedEdgeIds=r,this._host.requestUpdate()})}openConfigForSelected(){if(0===this._host.selectedNodeIds.size)return;const e=Array.from(this._host.selectedNodeIds)[0],t=this._host.workflow.nodes.find(t=>t.id===e);t&&(this._host.configuredNode=t)}hasSelection(){return this._host.selectedNodeIds.size>0||this._host.selectedEdgeIds.size>0}getSelectionCount(){return{nodes:this._host.selectedNodeIds.size,edges:this._host.selectedEdgeIds.size}}}
|
|
3831
3830
|
/**
|
|
3832
3831
|
* @license
|
|
3833
3832
|
* Copyright 2024 Nuraly, Laabidi Aymen
|
|
3834
3833
|
* SPDX-License-Identifier: MIT
|
|
3835
|
-
*/class
|
|
3834
|
+
*/class Mi extends Si{constructor(e){super(e),this.undoController=null}setUndoController(e){this.undoController=e}startConnection(e,t,i,n){const a=this.clientToCanvas(n.clientX,n.clientY);this._host.connectionState={sourceNodeId:e.id,sourcePortId:t.id,sourceIsInput:i,mouseX:a.x,mouseY:a.y}}updateConnectionPosition(e){if(!this._host.connectionState)return;const t=this.clientToCanvas(e.clientX,e.clientY);this._host.connectionState=Object.assign(Object.assign({},this._host.connectionState),{mouseX:t.x,mouseY:t.y})}completeConnection(e,t,i){const n=this._host.connectionState;if(!n)return!1;if(n.sourceIsInput===i)return this.cancelConnection(),!1;if(n.sourceNodeId===e.id)return this.cancelConnection(),!1;const a=n.sourceIsInput?e.id:n.sourceNodeId,o=n.sourceIsInput?t.id:n.sourcePortId,s=n.sourceIsInput?n.sourceNodeId:e.id,r=n.sourceIsInput?n.sourcePortId:t.id,l=this._host.workflow.edges.some(e=>e.sourceNodeId===a&&e.sourcePortId===o&&e.targetNodeId===s&&e.targetPortId===r);if(!l){const e={id:"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}),sourceNodeId:a,sourcePortId:o,targetNodeId:s,targetPortId:r};this.undoController&&this.undoController.recordEdgeAdded(e),this._host.setWorkflow(Object.assign(Object.assign({},this._host.workflow),{edges:[...this._host.workflow.edges,e]})),this._host.dispatchWorkflowChanged()}return this.cancelConnection(),!l}cancelConnection(){this._host.connectionState=null}isConnecting(){return null!==this._host.connectionState}getConnectionState(){return this._host.connectionState}getPortPosition(e,t,i){const n=e.ports.configs||[],a=n.findIndex(e=>e.id===t);if(-1!==a){const t=(a-(n.length-1)/2)*45,i=e.status&&"IDLE"!==e.status?110:85;return{x:e.position.x+90+t,y:e.position.y+i}}const o=i?e.ports.inputs.findIndex(e=>e.id===t):e.ports.outputs.findIndex(e=>e.id===t),s=(80-20*((i?e.ports.inputs.length:e.ports.outputs.length)-1))/2+20*o;return{x:e.position.x+(i?2:178),y:e.position.y+s+3}}deleteEdge(e){if(this._host.readonly)return;const t=this._host.workflow.edges.find(t=>t.id===e);this.undoController&&t&&this.undoController.recordEdgeDeleted(t),this._host.setWorkflow(Object.assign(Object.assign({},this._host.workflow),{edges:this._host.workflow.edges.filter(t=>t.id!==e)})),this._host.dispatchWorkflowChanged()}getNodeEdges(e){return{inputs:this._host.workflow.edges.filter(t=>t.targetNodeId===e),outputs:this._host.workflow.edges.filter(t=>t.sourceNodeId===e)}}setHoveredEdge(e){this._host.hoveredEdgeId=e}getHoveredEdge(){return this._host.hoveredEdgeId}}
|
|
3836
3835
|
/**
|
|
3837
3836
|
* @license
|
|
3838
3837
|
* Copyright 2024 Nuraly, Laabidi Aymen
|
|
3839
3838
|
* SPDX-License-Identifier: MIT
|
|
3840
|
-
*/class
|
|
3839
|
+
*/class Ei extends Si{constructor(e,t){super(e),this.clipboardController=null,this.undoController=null,this.selectionController=t,this.boundHandleKeyDown=this.handleKeyDown.bind(this)}setClipboardController(e){this.clipboardController=e}setUndoController(e){this.undoController=e}hostConnected(){window.addEventListener("keydown",this.boundHandleKeyDown)}hostDisconnected(){window.removeEventListener("keydown",this.boundHandleKeyDown)}isEditableElement(e){if(!e)return!1;const t=e.tagName.toUpperCase();if("INPUT"===t||"TEXTAREA"===t)return!0;if(e.isContentEditable)return!0;if(t.startsWith("NR-")&&(t.includes("INPUT")||t.includes("SELECT")||t.includes("TEXTAREA")))return!0;const i=e.shadowRoot;if(i){const e=i.activeElement;if(e&&this.isEditableElement(e))return!0}return!1}handleKeyDown(e){var t,i;if(this._host.disabled)return;const n=e.target,a=document.activeElement;if(!this.isEditableElement(n)&&!this.isEditableElement(a))switch(e.key){case"Delete":case"Backspace":!this._host.readonly&&this.selectionController.hasSelection()&&(e.preventDefault(),this.selectionController.deleteSelected());break;case"Escape":this._host.connectionState=null,this._host.contextMenu=null,this._host.configuredNode=null,this.selectionController.clearSelection();break;case"a":(e.ctrlKey||e.metaKey)&&(e.preventDefault(),this.selectionController.selectAll());break;case"c":(e.ctrlKey||e.metaKey)&&this.clipboardController&&this.selectionController.hasSelection()&&(e.preventDefault(),this.clipboardController.copySelected());break;case"x":(e.ctrlKey||e.metaKey)&&!this._host.readonly&&this.clipboardController&&this.selectionController.hasSelection()&&(e.preventDefault(),this.clipboardController.cutSelected());break;case"v":(e.ctrlKey||e.metaKey)&&!this._host.readonly&&this.clipboardController?(e.preventDefault(),this.clipboardController.pasteFromClipboard()):e.ctrlKey||e.metaKey||e.shiftKey||(e.preventDefault(),this._host.mode=Y.SELECT,this._host.requestUpdate());break;case"d":!e.ctrlKey&&!e.metaKey||this._host.readonly||(e.preventDefault(),this.selectionController.duplicateSelected());break;case"z":(e.ctrlKey||e.metaKey)&&!this._host.readonly&&this.undoController&&(e.preventDefault(),e.shiftKey?this.undoController.performRedo():this.undoController.performUndo());break;case"y":(e.ctrlKey||e.metaKey)&&!this._host.readonly&&this.undoController&&(e.preventDefault(),this.undoController.performRedo());break;case"h":e.ctrlKey||e.metaKey||e.shiftKey||(e.preventDefault(),this._host.mode=Y.PAN,this._host.requestUpdate());break;case"ArrowUp":case"ArrowDown":case"ArrowLeft":case"ArrowRight":e.preventDefault(),this.navigateToNode(e.key);break;case"Enter":1===this._host.selectedNodeIds.size&&this.selectionController.openConfigForSelected();break;case"/":(e.ctrlKey||e.metaKey)&&(e.preventDefault(),null===(i=(t=this._host).toggleChatbotPanel)||void 0===i||i.call(t))}}navigateToNode(e){const{workflow:t,selectedNodeIds:i,viewport:n,configuredNode:a}=this._host;if(0===t.nodes.length)return;let o;if(i.size>0){const e=Array.from(i)[0],n=t.nodes.find(t=>t.id===e);o=n?n.position:{x:0,y:0}}else o={x:(400-n.panX)/n.zoom,y:(300-n.panY)/n.zoom};let s=null,r=1/0;for(const n of t.nodes){if(i.has(n.id))continue;const t=n.position.x-o.x,a=n.position.y-o.y;let l=!1,c=0,d=0;switch(e){case"ArrowUp":l=a<-10,c=Math.abs(a),d=Math.abs(t);break;case"ArrowDown":l=a>10,c=Math.abs(a),d=Math.abs(t);break;case"ArrowLeft":l=t<-10,c=Math.abs(t),d=Math.abs(a);break;case"ArrowRight":l=t>10,c=Math.abs(t),d=Math.abs(a)}if(l){const e=c+2*d;e<r&&(r=e,s=n)}}if(!s&&0===i.size)for(const e of t.nodes){const t=e.position.x-o.x,i=e.position.y-o.y,n=Math.sqrt(t*t+i*i);n<r&&(r=n,s=e)}s&&(this.selectionController.clearSelection(),this._host.selectedNodeIds.add(s.id),this._host.selectedNodeIds=new Set(this._host.selectedNodeIds),a&&(this._host.configuredNode=s),this._host.dispatchNodeSelected(s))}}
|
|
3841
3840
|
/**
|
|
3842
3841
|
* @license
|
|
3843
3842
|
* Copyright 2024 Nuraly, Laabidi Aymen
|
|
3844
3843
|
* SPDX-License-Identifier: MIT
|
|
3845
|
-
*/class
|
|
3844
|
+
*/class Ai extends Si{constructor(e,t){super(e),this.undoController=null,this.frameController=null,this.dragStartPositions=new Map,this.frameContainedNodeIds=new Set,this.viewportController=t}setUndoController(e){this.undoController=e}setFrameController(e){this.frameController=e}startDrag(e,t){const i=this.clientToCanvas(t.clientX,t.clientY);this._host.dragState={nodeId:e.id,startX:e.position.x,startY:e.position.y,offsetX:i.x-e.position.x,offsetY:i.y-e.position.y},this.dragStartPositions.clear(),this.frameContainedNodeIds.clear(),this._host.selectedNodeIds.forEach(e=>{const t=this._host.workflow.nodes.find(t=>t.id===e);if(t&&(this.dragStartPositions.set(e,Object.assign({},t.position)),t.type===U.FRAME&&t.containedNodeIds))for(const e of t.containedNodeIds){if(this._host.selectedNodeIds.has(e))continue;const t=this._host.workflow.nodes.find(t=>t.id===e);t&&(this.frameContainedNodeIds.add(e),this.dragStartPositions.set(e,Object.assign({},t.position)))}})}handleDrag(e){const{dragState:t}=this._host;if(!t)return;const i=this.clientToCanvas(e.clientX,e.clientY),n=i.x-t.offsetX,a=i.y-t.offsetY,o=this.snapToGrid(n,a),s=o.x-t.startX,r=o.y-t.startY;if(this._host.setWorkflow(Object.assign(Object.assign({},this._host.workflow),{nodes:this._host.workflow.nodes.map(e=>this._host.selectedNodeIds.has(e.id)?e.id===t.nodeId?Object.assign(Object.assign({},e),{position:{x:o.x,y:o.y}}):Object.assign(Object.assign({},e),{position:{x:e.position.x+s,y:e.position.y+r}}):this.frameContainedNodeIds.has(e.id)?Object.assign(Object.assign({},e),{position:{x:e.position.x+s,y:e.position.y+r}}):e)})),this._host.dragState=Object.assign(Object.assign({},t),{startX:o.x,startY:o.y}),this._host.configuredNode&&this._host.selectedNodeIds.has(this._host.configuredNode.id)){const e=this._host.workflow.nodes.find(e=>e.id===this._host.configuredNode.id);e&&(this._host.configuredNode=e,this.viewportController.updateConfigPanelPosition())}if(this._host.insertPanelNode&&this._host.selectedNodeIds.has(this._host.insertPanelNode.id)){const e=this._host.workflow.nodes.find(e=>e.id===this._host.insertPanelNode.id);e&&(this._host.insertPanelNode=e,this.viewportController.updateInsertPanelPosition())}}stopDrag(){if(this._host.dragState){if(this.undoController&&this.dragStartPositions.size>0){const e=[];new Set([...this._host.selectedNodeIds,...this.frameContainedNodeIds]).forEach(t=>{const i=this._host.workflow.nodes.find(e=>e.id===t),n=this.dragStartPositions.get(t);i&&n&&(i.position.x===n.x&&i.position.y===n.y||e.push({nodeId:t,oldPosition:n,newPosition:Object.assign({},i.position)}))}),e.length>0&&this.undoController.recordNodesMoved(e)}new Set([...this._host.selectedNodeIds,...this.frameContainedNodeIds]).forEach(e=>{const t=this._host.workflow.nodes.find(t=>t.id===e);t&&this._host.dispatchNodeMoved(t,t.position)}),this.frameController&&this.frameController.updateAllFrameContainments(),this._host.dragState=null,this.dragStartPositions.clear(),this.frameContainedNodeIds.clear(),this._host.dispatchWorkflowChanged()}}isDragging(){return null!==this._host.dragState}getDragState(){return this._host.dragState}getDraggedNodeId(){var e;return(null===(e=this._host.dragState)||void 0===e?void 0:e.nodeId)||null}}
|
|
3846
3845
|
/**
|
|
3847
3846
|
* @license
|
|
3848
3847
|
* Copyright 2024 Nuraly, Laabidi Aymen
|
|
3849
3848
|
* SPDX-License-Identifier: MIT
|
|
3850
|
-
*/class
|
|
3849
|
+
*/class zi extends Si{constructor(e){super(e),this.undoController=null}setUndoController(e){this.undoController=e}openConfig(e){this._host.configuredNode=e}closeConfig(){this._host.configuredNode=null}getConfiguredNode(){return this._host.configuredNode}isOpen(){return null!==this._host.configuredNode}updateConfig(e,t){const i=this._host.configuredNode;if(!i)return;const n={configuration:Object.assign({},i.configuration)},a=Object.assign(Object.assign({},i),{configuration:Object.assign(Object.assign({},i.configuration),{[e]:t})});this.undoController&&this.undoController.recordNodeConfigUpdated(i.id,{configuration:a.configuration},n),this.applyNodeUpdate(a)}updateName(e){const t=this._host.configuredNode;if(!t)return;const i={name:t.name},n=Object.assign(Object.assign({},t),{name:e});this.undoController&&this.undoController.recordNodeConfigUpdated(t.id,{name:e},i),this.applyNodeUpdate(n)}updateDescription(e){const t=this._host.configuredNode;if(!t)return;const i={metadata:Object.assign({},t.metadata)},n=Object.assign(Object.assign({},t),{metadata:Object.assign(Object.assign({},t.metadata),{description:e})});this.undoController&&this.undoController.recordNodeConfigUpdated(t.id,{metadata:n.metadata},i),this.applyNodeUpdate(n)}applyNodeUpdate(e){this._host.setWorkflow(Object.assign(Object.assign({},this._host.workflow),{nodes:this._host.workflow.nodes.map(t=>t.id===e.id?e:t)})),this._host.configuredNode=e,this._host.dispatchWorkflowChanged()}getPanelPosition(){const e=this._host.configuredNode;if(!e)return null;const{viewport:t}=this._host;return{x:(e.position.x+180+20)*t.zoom+t.panX,y:e.position.y*t.zoom+t.panY}}}
|
|
3851
3850
|
/**
|
|
3852
3851
|
* @license
|
|
3853
3852
|
* Copyright 2024 Nuraly, Laabidi Aymen
|
|
3854
3853
|
* SPDX-License-Identifier: MIT
|
|
3855
|
-
*/class
|
|
3854
|
+
*/class Ii extends Si{get isSelecting(){return null!==this._host.marqueeState}get marqueeState(){return this._host.marqueeState}startSelection(e,t=!1){if(this._host.readonly||this._host.disabled)return;const i=this.clientToCanvas(e.clientX,e.clientY);this._host.marqueeState={startX:i.x,startY:i.y,currentX:i.x,currentY:i.y},t||(this._host.selectedNodeIds=new Set,this._host.selectedEdgeIds=new Set),this._host.requestUpdate()}updateSelection(e){if(!this._host.marqueeState)return;const t=this.clientToCanvas(e.clientX,e.clientY);this._host.marqueeState=Object.assign(Object.assign({},this._host.marqueeState),{currentX:t.x,currentY:t.y}),this._host.requestUpdate()}endSelection(e=!1){if(!this._host.marqueeState)return;const t=this.getSelectionRect(),i=new Set(e?this._host.selectedNodeIds:[]),n=new Set(e?this._host.selectedEdgeIds:[]);for(const e of this._host.workflow.nodes)this.nodeIntersectsRect(e,t)&&i.add(e.id);for(const e of this._host.workflow.edges)i.has(e.sourceNodeId)&&i.has(e.targetNodeId)&&n.add(e.id);this._host.selectedNodeIds=i,this._host.selectedEdgeIds=n,this._host.marqueeState=null,this._host.requestUpdate()}cancelSelection(){this._host.marqueeState=null,this._host.requestUpdate()}getSelectionRect(){const e=this._host.marqueeState;return e?{x:Math.min(e.startX,e.currentX),y:Math.min(e.startY,e.currentY),width:Math.abs(e.currentX-e.startX),height:Math.abs(e.currentY-e.startY)}:{x:0,y:0,width:0,height:0}}nodeIntersectsRect(e,t){const i=e.position.x,n=e.position.y,a=80;return!(i+200<t.x||t.x+t.width<i||n+a<t.y||t.y+t.height<n)}}
|
|
3856
3855
|
/**
|
|
3857
3856
|
* @license
|
|
3858
3857
|
* Copyright 2024 Nuraly, Laabidi Aymen
|
|
3859
3858
|
* SPDX-License-Identifier: MIT
|
|
3860
|
-
*/var
|
|
3859
|
+
*/var Oi=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 Pi extends Si{constructor(){super(...arguments),this.undoController=null,this.internalClipboard=null}setUndoController(e){this.undoController=e}copySelected(){return Oi(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 Oi(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 Oi(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 Oi(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()}}
|
|
3861
3860
|
/**
|
|
3862
3861
|
* @license
|
|
3863
3862
|
* Copyright 2024 Nuraly, Laabidi Aymen
|
|
3864
3863
|
* SPDX-License-Identifier: MIT
|
|
3865
|
-
*/class
|
|
3864
|
+
*/class _i extends Si{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())}}
|
|
3866
3865
|
/**
|
|
3867
3866
|
* @license
|
|
3868
3867
|
* Copyright 2024 Nuraly, Laabidi Aymen
|
|
3869
3868
|
* SPDX-License-Identifier: MIT
|
|
3870
|
-
*/class
|
|
3869
|
+
*/class Ri extends Si{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 v=this.snapToGrid(b,f);b=v.x,f=v.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===U.FRAME||e.type===U.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!==U.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===U.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!==U.FRAME&&e.type!==U.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:U.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)||X[e.type]||"box",color:(null===(i=e.metadata)||void 0===i?void 0:i.color)||Q[e.type]||"#3b82f6",name:e.name}})}}
|
|
3871
3870
|
/**
|
|
3872
3871
|
* @license
|
|
3873
3872
|
* Copyright 2024 Nuraly, Laabidi Aymen
|
|
3874
3873
|
* SPDX-License-Identifier: MIT
|
|
3875
|
-
*/class
|
|
3874
|
+
*/class Ni extends Si{constructor(){super(...arguments),this.socket=null,this.staleCursorInterval=null,this.keepaliveInterval=null,this.lastCursorBroadcast=0,this.cursorThrottleTimer=null,this.myUserId="",this.state={connected:!1,canvasId:null,users:new Map,cursors:new Map,selections:new Map,typingIndicators:new Map,lockedNodes:new Map,serverVersion:0,pendingOps:new Map},this.opCounter=0,this.myHeldLocks=new Set}connect(e,t,i){var n,a,o;if((!(null===(n=this.socket)||void 0===n?void 0:n.connected)||this.state.canvasId!==e)&&(console.log("[collab] connect()",{canvasId:e,namespace:t,userId:i}),this.disconnect(),this.state.canvasId=e,this.myUserId=i,t&&i))try{this.socket=f(t,{path:"/__nk_socketio/",query:{o:JSON.stringify({workflowId:e,resourceId:e,userId:i,source:"canvas"})},forceNew:!0,transports:["websocket","polling"],reconnection:!0,reconnectionAttempts:1/0,reconnectionDelay:1e3});const n=()=>{console.log("[collab] socket connected",{canvasId:e}),this.state.connected=!0,this.safeExecute(()=>this.socket.emit("nk:canvas:lock:request"),"connect: lock:request"),this._host.requestUpdate()};this.socket.on("connect",n),this.socket.connected&&(console.log("[collab] socket already connected at attach time"),n()),this.socket.on("disconnect",e=>{console.log("[collab] socket disconnected",e),this.state.connected=!1,this._host.requestUpdate()}),this.socket.on("connect_error",e=>{console.warn("[collab] connect_error",null==e?void 0:e.message)}),this.socket.on("nk:data",e=>{console.log("[collab] nk:data",null==e?void 0:e.event,null==e?void 0:e.data),this.safeExecute(()=>this.handleWireMessage(e),"handleWireMessage")}),console.log("[collab] post-io()",{connected:this.socket.connected,id:this.socket.id,active:null===(o=null===(a=this.socket.io)||void 0===a?void 0:a.engine)||void 0===o?void 0:o.readyState}),setTimeout(()=>{var e,t,i,n,a,o,s,r,l;console.log("[collab] 1s probe",{connected:null===(e=this.socket)||void 0===e?void 0:e.connected,id:null===(t=this.socket)||void 0===t?void 0:t.id,active:null===(a=null===(n=null===(i=this.socket)||void 0===i?void 0:i.io)||void 0===n?void 0:n.engine)||void 0===a?void 0:a.readyState,transport:null===(l=null===(r=null===(s=null===(o=this.socket)||void 0===o?void 0:o.io)||void 0===s?void 0:s.engine)||void 0===r?void 0:r.transport)||void 0===l?void 0:l.name})},1e3),setTimeout(()=>{var e,t,i,n,a,o,s,r,l;console.log("[collab] 3s probe",{connected:null===(e=this.socket)||void 0===e?void 0:e.connected,id:null===(t=this.socket)||void 0===t?void 0:t.id,active:null===(a=null===(n=null===(i=this.socket)||void 0===i?void 0:i.io)||void 0===n?void 0:n.engine)||void 0===a?void 0:a.readyState,transport:null===(l=null===(r=null===(s=null===(o=this.socket)||void 0===o?void 0:o.io)||void 0===s?void 0:s.engine)||void 0===r?void 0:r.transport)||void 0===l?void 0:l.name})},3e3),this.staleCursorInterval=setInterval(()=>this.cleanStaleCursors(),5e3)}catch(e){this.handleError(e,"connect")}}disconnect(){this.socket&&(this.safeExecute(()=>{this.socket.removeAllListeners(),this.socket.disconnect()},"disconnect"),this.socket=null),this.staleCursorInterval&&(clearInterval(this.staleCursorInterval),this.staleCursorInterval=null),this.keepaliveInterval&&(clearInterval(this.keepaliveInterval),this.keepaliveInterval=null),this.cursorThrottleTimer&&(clearTimeout(this.cursorThrottleTimer),this.cursorThrottleTimer=null),this.state={connected:!1,canvasId:null,users:new Map,cursors:new Map,selections:new Map,typingIndicators:new Map,lockedNodes:new Map,serverVersion:0,pendingOps:new Map},this.myHeldLocks.clear()}hostDisconnected(){this.disconnect()}handleWireMessage(e){if(null==e?void 0:e.event)switch(e.event){case"canvas:op":this.handleOperationReceived(e.data);break;case"canvas:lock:state":this.handleLockState(e.data)}}broadcastCursorMove(e,t){var i;if(!(null===(i=this.socket)||void 0===i?void 0:i.connected)||!this.state.canvasId)return;const n=Date.now();n-this.lastCursorBroadcast<33?this.cursorThrottleTimer||(this.cursorThrottleTimer=setTimeout(()=>{this.cursorThrottleTimer=null,this.emitCursorMove(e,t)},33-(n-this.lastCursorBroadcast))):this.emitCursorMove(e,t)}emitCursorMove(e,t){var i;(null===(i=this.socket)||void 0===i?void 0:i.connected)&&this.state.canvasId&&(this.lastCursorBroadcast=Date.now(),this.safeExecute(()=>this.socket.emit("nk:cursor:move",{x:e,y:t}),"emitCursorMove"))}broadcastSelectionChange(e){var t;(null===(t=this.socket)||void 0===t?void 0:t.connected)&&this.state.canvasId&&this.safeExecute(()=>this.socket.emit("nk:selection:change",{elementIds:e}),"broadcastSelectionChange")}broadcastTypingStart(e){var t;(null===(t=this.socket)||void 0===t?void 0:t.connected)&&this.state.canvasId&&this.safeExecute(()=>this.socket.emit("nk:typing:start",{elementId:e}),"broadcastTypingStart")}broadcastTypingStop(e){var t;(null===(t=this.socket)||void 0===t?void 0:t.connected)&&this.state.canvasId&&this.safeExecute(()=>this.socket.emit("nk:typing:stop",{elementId:e}),"broadcastTypingStop")}broadcastOperation(e,t,i){var n;if(!(null===(n=this.socket)||void 0===n?void 0:n.connected)||!this.state.canvasId)return;const a=`op_${Date.now()}_${++this.opCounter}`;this.state.pendingOps.set(a,{id:a,type:e,elementId:t,data:i,userId:this.myUserId,timestamp:Date.now(),version:this.state.serverVersion}),this.safeExecute(()=>this.socket.emit("nk:canvas:op",{id:a,type:e,elementId:t,data:i}),"broadcastOperation")}acquireLock(e){var t,i;console.log("[collab] acquireLock()",{nodeId:e,connected:null===(t=this.socket)||void 0===t?void 0:t.connected}),(null===(i=this.socket)||void 0===i?void 0:i.connected)&&e&&(this.myHeldLocks.add(e),this.safeExecute(()=>this.socket.emit("nk:canvas:lock:acquire",{nodeId:e}),"acquireLock"),this.ensureKeepalive())}releaseLock(e){var t,i;if(!e)return;console.log("[collab] releaseLock()",{nodeId:e,connected:null===(t=this.socket)||void 0===t?void 0:t.connected});const n=this.myHeldLocks.delete(e);(null===(i=this.socket)||void 0===i?void 0:i.connected)&&n&&this.safeExecute(()=>this.socket.emit("nk:canvas:lock:release",{nodeId:e}),"releaseLock"),0===this.myHeldLocks.size&&this.keepaliveInterval&&(clearInterval(this.keepaliveInterval),this.keepaliveInterval=null)}getRemoteLock(e){const t=this.state.lockedNodes.get(e);return t?t.userId===this.myUserId?null:t:null}ensureKeepalive(){this.keepaliveInterval||0===this.myHeldLocks.size||(this.keepaliveInterval=setInterval(()=>{var e;if(null===(e=this.socket)||void 0===e?void 0:e.connected)for(const e of this.myHeldLocks)this.safeExecute(()=>this.socket.emit("nk:canvas:lock:keepalive",{nodeId:e}),"lockKeepalive")},1e4))}handleLockState(e){if(null==e?void 0:e.locks){this.state.lockedNodes.clear();for(const[t,i]of Object.entries(e.locks))this.state.lockedNodes.set(t,i);this._host.requestUpdate()}}handleOperationReceived(e){var t,i,n;if(!e||!e.type)return;if(e.userId&&e.userId===this.myUserId)return;const a={id:null!==(t=e.id)&&void 0!==t?t:`remote_${Date.now()}`,type:e.type,elementId:e.elementId,data:e.data||{},userId:null!==(i=e.userId)&&void 0!==i?i:"",timestamp:null!==(n=e.timestamp)&&void 0!==n?n:Date.now(),version:this.state.serverVersion};this.applyRemoteOperation(a)}applyRemoteOperation(e){const t=this._host.workflow;if(!t)return;let i=[...t.nodes],n=[...t.edges],a=!1;switch(e.type){case"ADD":{const t=e.data.node;t&&(i=[...i,t],a=!0);break}case"DELETE":e.elementId&&(i=i.filter(t=>t.id!==e.elementId),n=n.filter(t=>t.sourceNodeId!==e.elementId&&t.targetNodeId!==e.elementId),a=!0);break;case"MOVE":e.elementId&&(i=i.map(t=>t.id===e.elementId?Object.assign(Object.assign({},t),{position:{x:e.data.x,y:e.data.y}}):t),a=!0);break;case"RESIZE":e.elementId&&(i=i.map(t=>t.id===e.elementId?Object.assign(Object.assign({},t),{configuration:Object.assign(Object.assign({},t.configuration),{width:e.data.width,height:e.data.height})}):t),a=!0);break;case"UPDATE_TEXT":e.elementId&&(i=i.map(t=>t.id===e.elementId?Object.assign(Object.assign({},t),{configuration:Object.assign(Object.assign({},t.configuration),{textContent:e.data.textContent})}):t),a=!0);break;case"UPDATE":e.elementId&&(i=i.map(t=>t.id===e.elementId?Object.assign(Object.assign({},t),{configuration:Object.assign(Object.assign({},t.configuration),e.data)}):t),a=!0);break;case"ADD_CONNECTOR":{const t=e.data.edge;t&&(n=[...n,t],a=!0);break}case"DELETE_CONNECTOR":e.elementId&&(n=n.filter(t=>t.id!==e.elementId),a=!0)}a&&(this._host.setWorkflow(Object.assign(Object.assign({},t),{nodes:i,edges:n})),this._host.requestUpdate())}getState(){return this.state}isConnected(){return this.state.connected}getUsers(){return Array.from(this.state.users.values())}getCursors(){return Array.from(this.state.cursors.values())}isElementSelectedByRemote(e){for(const[t,i]of this.state.selections)if(i.elementIds.includes(e)){const e=this.state.users.get(t);if(e)return{userId:t,color:e.color,username:e.username}}return null}isElementBeingTypedByRemote(e){for(const[t,i]of this.state.typingIndicators)if(i.elementId===e&&i.isTyping){const e=this.state.users.get(t);if(e)return{userId:t,username:e.username,color:e.color}}return null}cleanStaleCursors(){const e=Date.now();let t=!1;for(const[i,n]of this.state.cursors)e-n.lastUpdate>1e4&&(this.state.cursors.delete(i),t=!0);t&&this._host.requestUpdate()}}
|
|
3876
3875
|
/**
|
|
3877
3876
|
* @license
|
|
3878
3877
|
* Copyright 2024 Nuraly, Laabidi Aymen
|
|
3879
3878
|
* SPDX-License-Identifier: MIT
|
|
3880
|
-
*/const
|
|
3879
|
+
*/const Di=["canvas-toolbar","wb-sidebar","zoom-controls","context-menu","wb-floating-toolbar","wb-color-picker-panel","presence-bar","config-panel","config-panel-content","wb-action-indicator","node-palette"];class Li extends Si{constructor(e,t,i,n){super(e),this.activeTouches=new Map,this.gestureType="none",this.initialPinchDistance=0,this.initialPinchZoom=1,this.lastTapTime=0,this.lastTapPosition={x:0,y:0},this.touchStartPos=null,this.touchTargetNode=null,this.handleTouchStart=e=>{if(this._host.disabled)return;if(this.isTouchOnUIOverlay(e))return;e.preventDefault(),this.updateActiveTouches(e.changedTouches);const t=this.activeTouches.size;if(2!==t){if(1===t){const t=e.changedTouches[0];this.touchStartPos={x:t.clientX,y:t.clientY},this.touchTargetNode=this.findNodeFromTouch(e),this.gestureType="pending"}}else this.startPinchGesture()},this.handleTouchMove=e=>{if(this._host.disabled||"none"===this.gestureType)return;if(e.preventDefault(),this.updateActiveTouches(e.changedTouches),this.updateCursorPosition(e),"pinch"===this.gestureType&&this.activeTouches.size>=2)return void this.handlePinchMove();if(1!==this.activeTouches.size)return;const t=e.touches[0];if(!t||!this.touchStartPos)return;const i=Math.hypot(t.clientX-this.touchStartPos.x,t.clientY-this.touchStartPos.y);"pending"===this.gestureType&&i>10&&this.promoteGesture(t),"drag"===this.gestureType?this.dragController.handleDrag(this.createSyntheticMouseEvent(t)):"pan"===this.gestureType&&this.viewportController.handlePanDrag(this.createSyntheticMouseEvent(t))},this.handleTouchEnd=e=>{if(this._host.disabled||"none"===this.gestureType)return;e.preventDefault();for(const t of Array.from(e.changedTouches))this.activeTouches.delete(t.identifier);const t=this.activeTouches.size;if("pinch"===this.gestureType)return void this.handlePinchEnd(t);if(t>0)return;const i=e.changedTouches[0];"pan"===this.gestureType?this.viewportController.stopPan():"drag"===this.gestureType?this.dragController.stopDrag():"pending"===this.gestureType&&this.touchStartPos&&this.handleTap(i),this.resetGesture()},this.viewportController=t,this.dragController=i,this.selectionController=n}hostConnected(){this._host.updateComplete.then(()=>{const e=this.canvasWrapper;e&&(e.addEventListener("touchstart",this.handleTouchStart,{passive:!1}),e.addEventListener("touchmove",this.handleTouchMove,{passive:!1}),e.addEventListener("touchend",this.handleTouchEnd,{passive:!1}),e.addEventListener("touchcancel",this.handleTouchEnd,{passive:!1}))})}hostDisconnected(){const e=this.canvasWrapper;e&&(e.removeEventListener("touchstart",this.handleTouchStart),e.removeEventListener("touchmove",this.handleTouchMove),e.removeEventListener("touchend",this.handleTouchEnd),e.removeEventListener("touchcancel",this.handleTouchEnd))}startPinchGesture(){"drag"===this.gestureType&&this.dragController.isDragging()&&this.dragController.stopDrag(),"pan"===this.gestureType&&this._host.isPanning&&this.viewportController.stopPan(),this.gestureType="pinch";const e=Array.from(this.activeTouches.values());this.initialPinchDistance=this.getDistance(e[0],e[1]),this.initialPinchZoom=this._host.viewport.zoom}promoteGesture(e){if(this.touchTargetNode){this.gestureType="drag";const t=this.createSyntheticMouseEvent(e);this._host.selectedNodeIds.has(this.touchTargetNode.id)||(this.selectionController.clearSelection(),this.selectionController.selectNode(this.touchTargetNode.id,!1)),this.dragController.startDrag(this.touchTargetNode,t)}else{this.gestureType="pan";const e=this.createSyntheticMouseEvent({clientX:this.touchStartPos.x,clientY:this.touchStartPos.y});this.viewportController.startPan(e)}}handleTap(e){const t=Date.now();if(this.isDoubleTap(e.clientX,e.clientY,t)&&this.touchTargetNode){const e=this.findNodeElementFromTouch();e&&e.dispatchEvent(new CustomEvent("node-dblclick",{detail:{node:this.touchTargetNode},bubbles:!0,composed:!0}))}else this.touchTargetNode?(this.selectionController.clearSelection(),this.selectionController.selectNode(this.touchTargetNode.id,!1),this._host.dispatchNodeSelected(this.touchTargetNode)):this.selectionController.clearSelection();this.lastTapTime=t,this.lastTapPosition={x:e.clientX,y:e.clientY}}handlePinchEnd(e){if(1===e){this.gestureType="pan";const e=Array.from(this.activeTouches.values())[0];this.viewportController.startPan(this.createSyntheticMouseEvent(e))}else 0===e&&this.resetGesture()}updateActiveTouches(e){for(const t of Array.from(e))this.activeTouches.set(t.identifier,t)}updateCursorPosition(e){if(e.touches.length>=1&&this.canvasWrapper){const t=e.touches[0],i=this.canvasWrapper.getBoundingClientRect();this._host.lastMousePosition={x:(t.clientX-i.left-this._host.viewport.panX)/this._host.viewport.zoom,y:(t.clientY-i.top-this._host.viewport.panY)/this._host.viewport.zoom}}}handlePinchMove(){const e=Array.from(this.activeTouches.values());if(e.length<2)return;const t=this.getDistance(e[0],e[1]);if(0===this.initialPinchDistance)return;const i=t/this.initialPinchDistance,n=this.initialPinchZoom*i,a=this.getMidpoint(e[0],e[1]);this.viewportController.setZoomAtPoint(n,a.clientX,a.clientY)}isTouchOnUIOverlay(e){const t=e.composedPath();for(const e of t){if(e===this.canvasWrapper)break;if(e instanceof HTMLElement)for(const t of Di)if(e.classList.contains(t))return!0}return!1}createSyntheticMouseEvent(e){return new MouseEvent("mousemove",{clientX:e.clientX,clientY:e.clientY,button:0,bubbles:!0})}getDistance(e,t){return Math.hypot(e.clientX-t.clientX,e.clientY-t.clientY)}getMidpoint(e,t){return{clientX:(e.clientX+t.clientX)/2,clientY:(e.clientY+t.clientY)/2}}findNodeFromTouch(e){const t=e.composedPath();for(const e of t)if(e instanceof HTMLElement&&e.dataset.nodeId)return this._host.workflow.nodes.find(t=>t.id===e.dataset.nodeId)||null;return null}findNodeElementFromTouch(){var e;const t=this._host;if(!t.shadowRoot)return null;const i=null===(e=this.touchTargetNode)||void 0===e?void 0:e.id;return i?t.shadowRoot.querySelector(`whiteboard-node[data-node-id="${i}"]`):null}isDoubleTap(e,t,i){return i-this.lastTapTime<300&&Math.hypot(e-this.lastTapPosition.x,t-this.lastTapPosition.y)<30}resetGesture(){this.gestureType="none",this.touchTargetNode=null,this.touchStartPos=null,this.initialPinchDistance=0,this.initialPinchZoom=1}}
|
|
3881
3880
|
/**
|
|
3882
3881
|
* @license
|
|
3883
3882
|
* Copyright 2024 Nuraly, Laabidi Aymen
|
|
3884
3883
|
* SPDX-License-Identifier: MIT
|
|
3885
|
-
*/function
|
|
3884
|
+
*/function ji(e){var t;if(!e.onToggleChatbot)return n;const a=e.showChatbot?"active":"";return i`
|
|
3886
3885
|
<div class="toolbar-divider"></div>
|
|
3887
3886
|
<button
|
|
3888
3887
|
class="toolbar-btn ${a}"
|
|
@@ -3898,7 +3897,7 @@ var wi=function(e,t,i,n){return new(i||(i=Promise))(function(a,o){function s(e){
|
|
|
3898
3897
|
* Copyright 2024 Nuraly, Laabidi Aymen
|
|
3899
3898
|
* SPDX-License-Identifier: MIT
|
|
3900
3899
|
*/
|
|
3901
|
-
var
|
|
3900
|
+
var Fi=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())})};function Bi(e,t){const i=[],n=new Set;return function t(a){if(n.has(a))return;n.add(a);const o=e.edges.filter(e=>e.targetNodeId===a);for(const n of o){const a=e.nodes.find(e=>e.id===n.sourceNodeId);a&&(i.push(a),t(a.id))}}(t),i}function Ui(e){return Z.find(t=>t.type===e)}function Vi(e,t=""){const i=[];for(const t of e)i.push({path:t.path,description:t.description,type:t.type}),t.children&&i.push(...Vi(t.children,t.path));return i}function Hi(e,t){const i=function(e,t){const i=Bi(e,t),n=[];for(const e of i){const t=Ui(e.type);(null==t?void 0:t.outputSchema)&&n.push({node:e,variables:t.outputSchema})}return n}(e,t),n=[];for(const{node:e,variables:t}of i){const i=Vi(t);for(const t of i)n.push(Object.assign({nodeName:e.name},t))}return n}function qi(e){return null===e?"null":Array.isArray(e)?"array":typeof e}function Gi(e,...t){let i=e;for(const e of t)e.startsWith("[")?i+=e:i+="."+e;return"${"+i+"}"}function Wi(e,t,i=4,n=0){const a=[];if(n>=i||null==e)return a;if(Array.isArray(e)){if(a.push({path:Gi(t),type:"array"}),e.length>0){const o=Wi(e[0],t+"[0]",i,n+1);a.push(...o)}}else if("object"==typeof e){n>0&&a.push({path:Gi(t),type:"object"});for(const[o,s]of Object.entries(e)){const e=t+"."+o,r=qi(s);if("object"===r||"array"===r)a.push(...Wi(s,e,i,n+1));else{let e=s;"string"==typeof s&&s.length>50&&(e=s.substring(0,50)+"..."),a.push({path:Gi(t,o),type:r,value:e})}}}else a.push({path:Gi(t),type:qi(e),value:e});return a}function Ki(e,t,i,n,a){if(!a)return[];let o;if("CHAT_START"===i||"HTTP_START"===i||"START"===i)o="input";else if(null==n?void 0:n.outputVariable)o=`variables.${n.outputVariable}`;else{o=`variables.${t.toLowerCase().replaceAll(/[^a-z0-9]/g,"_")}`}return Wi(a,o,4,0).map(e=>({nodeName:t,path:e.path,description:void 0!==e.value?`Value: ${e.value}`:`Type: ${e.type}`,type:e.type}))}function Ji(e,t){return Fi(this,arguments,void 0,function*(e,t,i=""){const n=[],a=Hi(e,t);for(const t of a){const i=e.nodes.find(e=>e.name===t.nodeName);n.push(Object.assign(Object.assign({},t),{nodeId:(null==i?void 0:i.id)||"",isDynamic:!1}))}try{const a=yield function(e){return Fi(this,arguments,void 0,function*(e,t=""){try{const i=yield fetch(`${t}/api/v1/workflows/${e}/latest-node-outputs`);if(!i.ok)return new Map;const n=yield i.json();return new Map(Object.entries(n))}catch(e){return console.warn("[VariableResolver] Failed to fetch node outputs:",e),new Map}})}(e.id,i),o=Bi(e,t);for(const e of o){const t=a.get(e.id);if(t){const i=Ki(e.id,e.name,e.type,e.configuration,t);for(const t of i){n.some(e=>e.path===t.path&&e.nodeName===t.nodeName)||n.push(Object.assign(Object.assign({},t),{nodeId:e.id,isDynamic:!0}))}}}}catch(e){console.warn("[VariableResolver] Error fetching dynamic variables:",e)}return n})}var Yi=e`
|
|
3902
3901
|
:host {
|
|
3903
3902
|
display: inline-block;
|
|
3904
3903
|
width: fit-content;
|
|
@@ -3957,12 +3956,12 @@ var ji=function(e,t,i,n){return new(i||(i=Promise))(function(a,o){function s(e){
|
|
|
3957
3956
|
margin-left: 2px;
|
|
3958
3957
|
font-weight: normal;
|
|
3959
3958
|
}
|
|
3960
|
-
`,
|
|
3959
|
+
`,Qi=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 Xi=class extends($e(t)){constructor(){super(...arguments),this.size="medium",this.variant="default",this.required=!1,this.disabled=!1,this.value=""}render(){return i`
|
|
3961
3960
|
<label part="label" for=${this.for||""}>
|
|
3962
3961
|
<slot></slot>
|
|
3963
3962
|
${this.required?i`<span part="required-asterisk" class="required-asterisk">*</span>`:""}
|
|
3964
3963
|
</label>
|
|
3965
|
-
`}};
|
|
3964
|
+
`}};Xi.styles=Yi,Xi.useShadowDom=!0,Qi([s({reflect:!0})],Xi.prototype,"size",void 0),Qi([s({reflect:!0})],Xi.prototype,"variant",void 0),Qi([s({type:Boolean,reflect:!0})],Xi.prototype,"required",void 0),Qi([s({type:Boolean,reflect:!0})],Xi.prototype,"disabled",void 0),Qi([s()],Xi.prototype,"for",void 0),Qi([s()],Xi.prototype,"value",void 0),Xi=Qi([l("nr-label")],Xi);const Zi=e`
|
|
3966
3965
|
:host {
|
|
3967
3966
|
display: inline-block;
|
|
3968
3967
|
}
|
|
@@ -4265,8 +4264,8 @@ var ji=function(e,t,i,n){return new(i||(i=Promise))(function(a,o){function s(e){
|
|
|
4265
4264
|
* @license
|
|
4266
4265
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
4267
4266
|
* SPDX-License-Identifier: MIT
|
|
4268
|
-
*/;var
|
|
4269
|
-
<style>${
|
|
4267
|
+
*/;var en=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},tn=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 nn=class extends($e(t)){constructor(){super(...arguments),this.requiredComponents=["nr-icon","nr-button","nr-label"],this.title="",this.description="",this.okText="OK",this.cancelText="Cancel",this.okType="primary",this.showCancel=!0,this.icon="exclamation-circle",this.iconColor="",this.placement="top",this.trigger="click",this.disabled=!1,this.arrow=!0,this.open=!1,this.okLoading=!1,this._portalHost=null,this._portalRoot=null,this._boundHandleOutsideClick=null,this._boundHandleKeydown=null,this._boundReposition=null,this.handleTriggerClick=e=>{this.disabled||(e.stopPropagation(),this.open?this.closePopconfirm():this.openPopconfirm())},this.handleConfirm=e=>tn(this,void 0,void 0,function*(){e.stopPropagation();const t=new CustomEvent("nr-confirm",{bubbles:!0,composed:!0,cancelable:!0,detail:{originalEvent:e}});if(this.dispatchEvent(t)&&!t.defaultPrevented){const t=this.onConfirm;if(t&&"function"==typeof t){const i=t(e);if(i&&"function"==typeof i.then){this.okLoading=!0;try{yield i,this.closePopconfirm()}catch(e){console.error("Confirmation failed:",e)}finally{this.okLoading=!1}return}}this.closePopconfirm()}}),this.handleCancel=e=>{e.stopPropagation(),this.dispatchEvent(new CustomEvent("nr-cancel",{bubbles:!0,composed:!0,detail:{originalEvent:e}})),this.closePopconfirm()}}connectedCallback(){super.connectedCallback(),this._boundHandleOutsideClick=this.handleOutsideClick.bind(this),this._boundHandleKeydown=this.handleKeydown.bind(this),this._boundReposition=()=>this.reposition(),document.addEventListener("click",this._boundHandleOutsideClick,!0),document.addEventListener("keydown",this._boundHandleKeydown)}disconnectedCallback(){super.disconnectedCallback(),this._boundHandleOutsideClick&&document.removeEventListener("click",this._boundHandleOutsideClick,!0),this._boundHandleKeydown&&document.removeEventListener("keydown",this._boundHandleKeydown),this._detachViewportListeners(),this._teardownPortal()}updated(e){super.updated(e),e.has("open")&&(this.open?this._attachViewportListeners():this._detachViewportListeners()),this._renderPortal()}_ensurePortal(){if(this._portalRoot)return this._portalRoot;const e=document.createElement("div");return e.setAttribute("data-nr-popconfirm-portal",""),e.style.position="fixed",e.style.top="0",e.style.left="0",e.style.width="0",e.style.height="0",e.style.zIndex="2147483000",document.body.appendChild(e),this._portalHost=e,this._portalRoot=e.attachShadow({mode:"open"}),this._portalRoot}_teardownPortal(){this._portalRoot&&a(n,this._portalRoot),this._portalHost&&this._portalHost.parentNode&&this._portalHost.parentNode.removeChild(this._portalHost),this._portalHost=null,this._portalRoot=null}_attachViewportListeners(){this._boundReposition&&(window.addEventListener("scroll",this._boundReposition,!0),window.addEventListener("resize",this._boundReposition))}_detachViewportListeners(){this._boundReposition&&(window.removeEventListener("scroll",this._boundReposition,!0),window.removeEventListener("resize",this._boundReposition))}_renderPortal(){if(!this.open)return void(this._portalRoot&&a(n,this._portalRoot));const e=this._ensurePortal();a(this._renderPortalTemplate(),e),requestAnimationFrame(()=>this.reposition())}_renderPortalTemplate(){const e=`popconfirm-panel--${this.placement}`;return i`
|
|
4268
|
+
<style>${Zi.cssText}</style>
|
|
4270
4269
|
<div
|
|
4271
4270
|
class="popconfirm-panel ${h({[e]:!0,"popconfirm-panel--with-arrow":this.arrow})}"
|
|
4272
4271
|
part="panel"
|
|
@@ -4313,13 +4312,13 @@ var ji=function(e,t,i,n){return new(i||(i=Promise))(function(a,o){function s(e){
|
|
|
4313
4312
|
<div class="popconfirm-trigger" part="trigger" @click=${this.handleTriggerClick}>
|
|
4314
4313
|
<slot name="trigger"></slot>
|
|
4315
4314
|
</div>
|
|
4316
|
-
`}};
|
|
4315
|
+
`}};nn.useShadowDom=!0,nn.styles=Zi,en([s({type:String})],nn.prototype,"title",void 0),en([s({type:String})],nn.prototype,"description",void 0),en([s({type:String,attribute:"ok-text"})],nn.prototype,"okText",void 0),en([s({type:String,attribute:"cancel-text"})],nn.prototype,"cancelText",void 0),en([s({type:String,attribute:"ok-type"})],nn.prototype,"okType",void 0),en([s({type:Boolean,attribute:"show-cancel"})],nn.prototype,"showCancel",void 0),en([s({type:String})],nn.prototype,"icon",void 0),en([s({type:String,attribute:"icon-color"})],nn.prototype,"iconColor",void 0),en([s({type:String})],nn.prototype,"placement",void 0),en([s({type:String})],nn.prototype,"trigger",void 0),en([s({type:Boolean})],nn.prototype,"disabled",void 0),en([s({type:Boolean})],nn.prototype,"arrow",void 0),en([s({type:Boolean,reflect:!0})],nn.prototype,"open",void 0),en([r()],nn.prototype,"okLoading",void 0),nn=en([l("nr-popconfirm")],nn);
|
|
4317
4316
|
/**
|
|
4318
4317
|
* @license
|
|
4319
4318
|
* Copyright 2024 Nuraly
|
|
4320
4319
|
* SPDX-License-Identifier: MIT
|
|
4321
4320
|
*/
|
|
4322
|
-
var
|
|
4321
|
+
var an=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},on=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 sn=class extends t{constructor(){super(...arguments),this.connectionPath="",this.value="",this.placeholder="Select schema...",this.disabled=!1,this.applicationId="",this.schemas=[],this.loading=!1,this.error=""}connectedCallback(){super.connectedCallback(),this.connectionPath&&this.loadSchemas()}updated(e){if(e.has("connectionPath")){const t=e.get("connectionPath");t!==this.connectionPath&&(t&&(this.value="",this.dispatchValueChange("")),this.loadSchemas())}}loadSchemas(){return on(this,void 0,void 0,function*(){if(this.applicationId&&this.connectionPath&&this.databaseProvider){this.loading=!0,this.error="";try{const e=yield this.databaseProvider.getSchemas(this.connectionPath,this.applicationId);if(this.schemas=e,!this.value&&e.length>0){e.find(e=>"public"===e.name)&&(this.value="public",this.dispatchValueChange("public"))}}catch(e){console.error("Failed to load schemas:",e),this.error=e.message||"Failed to load schemas",this.schemas=[]}this.loading=!1}else this.schemas=[]})}handleSelectChange(e){var t;const i=(null===(t=e.detail)||void 0===t?void 0:t.value)||"";this.value=i,this.dispatchValueChange(i)}dispatchValueChange(e){this.dispatchEvent(new CustomEvent("value-change",{detail:{value:e},bubbles:!0,composed:!0}))}render(){if(!this.connectionPath)return i`
|
|
4323
4322
|
<nr-select .options=${[]} placeholder="Select connection first..." ?disabled=${!0}></nr-select>
|
|
4324
4323
|
`;if(this.loading)return i`
|
|
4325
4324
|
<nr-select .options=${[]} placeholder="Loading schemas..." ?disabled=${!0}>
|
|
@@ -4337,7 +4336,7 @@ var nn=function(e,t,i,n){for(var a,o=arguments.length,s=o<3?t:null===n?n=Object.
|
|
|
4337
4336
|
.noOptionsMessage=${"No schemas found"}
|
|
4338
4337
|
@nr-change=${this.handleSelectChange}
|
|
4339
4338
|
></nr-select>
|
|
4340
|
-
`}};
|
|
4339
|
+
`}};sn.styles=e`
|
|
4341
4340
|
:host {
|
|
4342
4341
|
display: block;
|
|
4343
4342
|
}
|
|
@@ -4369,13 +4368,13 @@ var nn=function(e,t,i,n){for(var a,o=arguments.length,s=o<3?t:null===n?n=Object.
|
|
|
4369
4368
|
@keyframes spin {
|
|
4370
4369
|
to { transform: rotate(360deg); }
|
|
4371
4370
|
}
|
|
4372
|
-
`,
|
|
4371
|
+
`,an([s({type:String})],sn.prototype,"connectionPath",void 0),an([s({type:String})],sn.prototype,"value",void 0),an([s({type:String})],sn.prototype,"placeholder",void 0),an([s({type:Boolean})],sn.prototype,"disabled",void 0),an([s({type:String})],sn.prototype,"applicationId",void 0),an([s({attribute:!1})],sn.prototype,"databaseProvider",void 0),an([r()],sn.prototype,"schemas",void 0),an([r()],sn.prototype,"loading",void 0),an([r()],sn.prototype,"error",void 0),sn=an([l("nr-schema-select")],sn);
|
|
4373
4372
|
/**
|
|
4374
4373
|
* @license
|
|
4375
4374
|
* Copyright 2024 Nuraly
|
|
4376
4375
|
* SPDX-License-Identifier: MIT
|
|
4377
4376
|
*/
|
|
4378
|
-
var
|
|
4377
|
+
var rn=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},ln=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 cn=class extends t{constructor(){super(...arguments),this.connectionPath="",this.schema="",this.value="",this.placeholder="Select table...",this.disabled=!1,this.applicationId="",this.tables=[],this.loading=!1,this.error=""}connectedCallback(){super.connectedCallback(),this.connectionPath&&this.loadTables()}updated(e){const t=e.has("connectionPath"),i=e.has("schema");if(t||i){const n=e.get("connectionPath"),a=e.get("schema");(t&&void 0!==n&&n!==this.connectionPath||i&&void 0!==a&&a!==this.schema)&&(this.value="",this.dispatchValueChange("")),this.loadTables()}}loadTables(){return ln(this,void 0,void 0,function*(){if(this.applicationId&&this.connectionPath&&this.databaseProvider){this.loading=!0,this.error="";try{const e=yield this.databaseProvider.getTables(this.connectionPath,this.applicationId,this.schema||void 0);this.tables=e}catch(e){console.error("Failed to load tables:",e),this.error=e.message||"Failed to load tables",this.tables=[]}this.loading=!1}else this.tables=[]})}handleSelectChange(e){var t;const i=(null===(t=e.detail)||void 0===t?void 0:t.value)||"";this.value=i,this.dispatchValueChange(i)}dispatchValueChange(e){this.dispatchEvent(new CustomEvent("value-change",{detail:{value:e},bubbles:!0,composed:!0}))}getTableTypeLabel(e){return"view"===e?"View":"collection"===e?"Collection":"Table"}render(){if(!this.connectionPath)return i`
|
|
4379
4378
|
<nr-select .options=${[]} placeholder="Select connection first..." ?disabled=${!0}></nr-select>
|
|
4380
4379
|
`;if(this.loading)return i`
|
|
4381
4380
|
<nr-select .options=${[]} placeholder="Loading tables..." ?disabled=${!0}>
|
|
@@ -4394,7 +4393,7 @@ var sn=function(e,t,i,n){for(var a,o=arguments.length,s=o<3?t:null===n?n=Object.
|
|
|
4394
4393
|
searchable
|
|
4395
4394
|
@nr-change=${this.handleSelectChange}
|
|
4396
4395
|
></nr-select>
|
|
4397
|
-
`}};
|
|
4396
|
+
`}};cn.styles=e`
|
|
4398
4397
|
:host {
|
|
4399
4398
|
display: block;
|
|
4400
4399
|
}
|
|
@@ -4426,13 +4425,13 @@ var sn=function(e,t,i,n){for(var a,o=arguments.length,s=o<3?t:null===n?n=Object.
|
|
|
4426
4425
|
@keyframes spin {
|
|
4427
4426
|
to { transform: rotate(360deg); }
|
|
4428
4427
|
}
|
|
4429
|
-
`,
|
|
4428
|
+
`,rn([s({type:String})],cn.prototype,"connectionPath",void 0),rn([s({type:String})],cn.prototype,"schema",void 0),rn([s({type:String})],cn.prototype,"value",void 0),rn([s({type:String})],cn.prototype,"placeholder",void 0),rn([s({type:Boolean})],cn.prototype,"disabled",void 0),rn([s({type:String})],cn.prototype,"applicationId",void 0),rn([s({attribute:!1})],cn.prototype,"databaseProvider",void 0),rn([r()],cn.prototype,"tables",void 0),rn([r()],cn.prototype,"loading",void 0),rn([r()],cn.prototype,"error",void 0),cn=rn([l("nr-table-select")],cn);
|
|
4430
4429
|
/**
|
|
4431
4430
|
* @license
|
|
4432
4431
|
* Copyright 2024 Nuraly
|
|
4433
4432
|
* SPDX-License-Identifier: MIT
|
|
4434
4433
|
*/
|
|
4435
|
-
var
|
|
4434
|
+
var dn=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 pn=class extends t{constructor(){super(...arguments),this.dbType="postgresql",this.value="",this.placeholder="Select database connection...",this.entries=[],this.loading=!1,this.testResult=null,this.showCreateForm=!1,this.creating=!1,this.testing=!1,this.error="",this.newConnectionName="",this.newHost="localhost",this.newPort=5432,this.newDatabase="",this.newUsername="",this.newPassword="",this.newSsl=!1}connectedCallback(){super.connectedCallback(),this.updateDefaultPort()}updated(e){e.has("dbType")&&this.updateDefaultPort()}updateDefaultPort(){this.newPort={postgresql:5432,mysql:3306,mongodb:27017,mssql:1433,oracle:1521,sqlite:0}[this.dbType]||5432}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}))}toggleCreateForm(){this.showCreateForm=!this.showCreateForm,this.showCreateForm||this.resetCreateForm()}resetCreateForm(){this.newConnectionName="",this.newHost="localhost",this.updateDefaultPort(),this.newDatabase="",this.newUsername="",this.newPassword="",this.newSsl=!1,this.error="",this.testing=!1,this.creating=!1}handleTestConnection(){this.testing=!0,this.dispatchEvent(new CustomEvent("test-connection",{detail:{type:this.dbType,host:this.newHost,port:this.newPort,database:this.newDatabase,username:this.newUsername,password:this.newPassword,ssl:this.newSsl},bubbles:!0,composed:!0}))}notifyTestResult(e){this.testResult=e,this.testing=!1}handleCreate(){if(!this.newConnectionName||!this.newHost||!this.newDatabase)return;this.creating=!0,this.error="";const e=`database/${this.newConnectionName}`,t={type:this.dbType,host:this.newHost,port:this.newPort,database:this.newDatabase,username:this.newUsername,password:this.newPassword,ssl:this.newSsl};this.dispatchEvent(new CustomEvent("create-entry",{detail:{keyPath:e,value:JSON.stringify(t),scope:this.dbType,isSecret:!0},bubbles:!0,composed:!0}))}notifyCreateSuccess(e){this.value=e,this.showCreateForm=!1,this.resetCreateForm(),this.dispatchEvent(new CustomEvent("value-change",{detail:{value:e},bubbles:!0,composed:!0}))}notifyCreateError(e){this.error=e,this.creating=!1}getDbTypeLabel(){return{postgresql:"PostgreSQL",mysql:"MySQL",mongodb:"MongoDB",mssql:"SQL Server",oracle:"Oracle",sqlite:"SQLite"}[this.dbType]||this.dbType}renderCreateForm(){const e=this.newConnectionName&&this.newHost&&this.newDatabase&&this.newUsername;return i`
|
|
4436
4435
|
<div class="create-form">
|
|
4437
4436
|
<div class="create-form-header">
|
|
4438
4437
|
<span class="create-form-title">Add ${this.getDbTypeLabel()} Connection</span>
|
|
@@ -4562,7 +4561,7 @@ var cn=function(e,t,i,n){for(var a,o=arguments.length,s=o<3?t:null===n?n=Object.
|
|
|
4562
4561
|
${this.showCreateForm?this.renderCreateForm():this.renderAddButton()}
|
|
4563
4562
|
</div>
|
|
4564
4563
|
</nr-select>
|
|
4565
|
-
`}};
|
|
4564
|
+
`}};pn.styles=e`
|
|
4566
4565
|
:host {
|
|
4567
4566
|
display: block;
|
|
4568
4567
|
}
|
|
@@ -4735,13 +4734,13 @@ var cn=function(e,t,i,n){for(var a,o=arguments.length,s=o<3?t:null===n?n=Object.
|
|
|
4735
4734
|
.checkbox-field label {
|
|
4736
4735
|
margin-bottom: 0;
|
|
4737
4736
|
}
|
|
4738
|
-
`,
|
|
4737
|
+
`,pn.useShadowDom=!0,dn([s({type:String})],pn.prototype,"dbType",void 0),dn([s({type:String})],pn.prototype,"value",void 0),dn([s({type:String})],pn.prototype,"placeholder",void 0),dn([s({attribute:!1})],pn.prototype,"entries",void 0),dn([s({type:Boolean})],pn.prototype,"loading",void 0),dn([s({attribute:!1})],pn.prototype,"testResult",void 0),dn([r()],pn.prototype,"showCreateForm",void 0),dn([r()],pn.prototype,"creating",void 0),dn([r()],pn.prototype,"testing",void 0),dn([r()],pn.prototype,"error",void 0),dn([r()],pn.prototype,"newConnectionName",void 0),dn([r()],pn.prototype,"newHost",void 0),dn([r()],pn.prototype,"newPort",void 0),dn([r()],pn.prototype,"newDatabase",void 0),dn([r()],pn.prototype,"newUsername",void 0),dn([r()],pn.prototype,"newPassword",void 0),dn([r()],pn.prototype,"newSsl",void 0),pn=dn([l("nr-db-connection-select")],pn);
|
|
4739
4738
|
/**
|
|
4740
4739
|
* @license
|
|
4741
4740
|
* Copyright 2024 Nuraly, Laabidi Aymen
|
|
4742
4741
|
* SPDX-License-Identifier: MIT
|
|
4743
4742
|
*/
|
|
4744
|
-
const
|
|
4743
|
+
const hn=e`
|
|
4745
4744
|
:host {
|
|
4746
4745
|
display: block;
|
|
4747
4746
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
|
|
@@ -5186,7 +5185,7 @@ const pn=e`
|
|
|
5186
5185
|
* @license
|
|
5187
5186
|
* Copyright 2024 Nuraly, Laabidi Aymen
|
|
5188
5187
|
* SPDX-License-Identifier: MIT
|
|
5189
|
-
*/;var
|
|
5188
|
+
*/;var un=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 bn=class extends($e(t)){constructor(){super(...arguments),this.requiredComponents=["nr-input"],this.value="",this.placeholder="",this.disabled=!1,this.multiline=!1,this.label=""}handleInput(e){this.value=e.detail.value,this.dispatchEvent(new CustomEvent("value-change",{detail:{value:this.value},bubbles:!0,composed:!0}))}render(){return i`
|
|
5190
5189
|
<div class="expression-input">
|
|
5191
5190
|
${this.label?i`<label class="field-label">${this.label}</label>`:n}
|
|
5192
5191
|
${this.multiline?i`
|
|
@@ -5206,7 +5205,7 @@ const pn=e`
|
|
|
5206
5205
|
></nr-input>
|
|
5207
5206
|
`}
|
|
5208
5207
|
</div>
|
|
5209
|
-
`}};
|
|
5208
|
+
`}};bn.useShadowDom=!0,bn.styles=hn,un([s({type:String})],bn.prototype,"value",void 0),un([s({type:String})],bn.prototype,"placeholder",void 0),un([s({type:Boolean})],bn.prototype,"disabled",void 0),un([s({type:Boolean})],bn.prototype,"multiline",void 0),un([s({type:String})],bn.prototype,"label",void 0),bn=un([l("nr-expression-input")],bn);let fn=class extends($e(t)){constructor(){super(...arguments),this.requiredComponents=["nr-input"],this.value="",this.placeholder="variableName",this.prefix="",this.disabled=!1,this.label="",this.description=""}handleInput(e){const t=e.detail.value.replaceAll(/[^a-zA-Z0-9_]/g,"");this.value=t,this.dispatchEvent(new CustomEvent("value-change",{detail:{value:this.value},bubbles:!0,composed:!0}))}render(){return i`
|
|
5210
5209
|
<div class="field-container">
|
|
5211
5210
|
${this.label?i`<label class="field-label">${this.label}</label>`:n}
|
|
5212
5211
|
<div class="variable-name-input">
|
|
@@ -5220,7 +5219,7 @@ const pn=e`
|
|
|
5220
5219
|
</div>
|
|
5221
5220
|
${this.description?i`<span class="field-description">${this.description}</span>`:n}
|
|
5222
5221
|
</div>
|
|
5223
|
-
`}};
|
|
5222
|
+
`}};fn.useShadowDom=!0,fn.styles=hn,un([s({type:String})],fn.prototype,"value",void 0),un([s({type:String})],fn.prototype,"placeholder",void 0),un([s({type:String})],fn.prototype,"prefix",void 0),un([s({type:Boolean})],fn.prototype,"disabled",void 0),un([s({type:String})],fn.prototype,"label",void 0),un([s({type:String})],fn.prototype,"description",void 0),fn=un([l("nr-variable-name-input")],fn);let vn=class extends($e(t)){constructor(){super(...arguments),this.requiredComponents=["nr-select"],this.value=P.QUERY,this.disabled=!1,this.label=""}handleChange(e){this.value=e.detail.value,this.dispatchEvent(new CustomEvent("value-change",{detail:{value:this.value},bubbles:!0,composed:!0}))}render(){const e=L.map(e=>({value:e.value,label:e.label,description:e.description,icon:e.icon}));return i`
|
|
5224
5223
|
<div class="field-container">
|
|
5225
5224
|
${this.label?i`<label class="field-label">${this.label}</label>`:n}
|
|
5226
5225
|
<nr-select
|
|
@@ -5230,7 +5229,7 @@ const pn=e`
|
|
|
5230
5229
|
@nr-change=${this.handleChange}
|
|
5231
5230
|
></nr-select>
|
|
5232
5231
|
</div>
|
|
5233
|
-
`}};
|
|
5232
|
+
`}};vn.useShadowDom=!0,vn.styles=hn,un([s({type:String})],vn.prototype,"value",void 0),un([s({type:Boolean})],vn.prototype,"disabled",void 0),un([s({type:String})],vn.prototype,"label",void 0),vn=un([l("nr-operation-select")],vn);let gn=class extends($e(t)){constructor(){super(...arguments),this.requiredComponents=["nr-select"],this.value=null,this.dataSources=[],this.disabled=!1,this.placeholder="Select data source...",this.label="",this.description=""}handleChange(e){this.value=e.detail.value||null,this.dispatchEvent(new CustomEvent("value-change",{detail:{value:this.value},bubbles:!0,composed:!0}))}render(){const e=this.dataSources.map(e=>({value:e.id,label:e.name,description:e.type,icon:e.icon||"database"}));return i`
|
|
5234
5233
|
<div class="field-container">
|
|
5235
5234
|
${this.label?i`<label class="field-label">${this.label}</label>`:n}
|
|
5236
5235
|
<nr-select
|
|
@@ -5242,7 +5241,7 @@ const pn=e`
|
|
|
5242
5241
|
></nr-select>
|
|
5243
5242
|
${this.description?i`<span class="field-description">${this.description}</span>`:n}
|
|
5244
5243
|
</div>
|
|
5245
|
-
`}};
|
|
5244
|
+
`}};gn.useShadowDom=!0,gn.styles=hn,un([s({type:String})],gn.prototype,"value",void 0),un([s({type:Array})],gn.prototype,"dataSources",void 0),un([s({type:Boolean})],gn.prototype,"disabled",void 0),un([s({type:String})],gn.prototype,"placeholder",void 0),un([s({type:String})],gn.prototype,"label",void 0),un([s({type:String})],gn.prototype,"description",void 0),gn=un([l("nr-datasource-select")],gn);let mn=class extends($e(t)){constructor(){super(...arguments),this.requiredComponents=["nr-select"],this.value=null,this.entities=[],this.disabled=!1,this.loading=!1,this.placeholder="Select table/collection...",this.label="",this.description=""}handleChange(e){this.value=e.detail.value||null,this.dispatchEvent(new CustomEvent("value-change",{detail:{value:this.value},bubbles:!0,composed:!0}))}render(){const e=this.entities.map(e=>({value:e.id,label:e.schema?`${e.schema}.${e.name}`:e.name,description:e.type,icon:"collection"===e.type?"folder":"table"}));return i`
|
|
5246
5245
|
<div class="field-container">
|
|
5247
5246
|
${this.label?i`<label class="field-label">${this.label}</label>`:n}
|
|
5248
5247
|
<nr-select
|
|
@@ -5255,7 +5254,7 @@ const pn=e`
|
|
|
5255
5254
|
></nr-select>
|
|
5256
5255
|
${this.description?i`<span class="field-description">${this.description}</span>`:n}
|
|
5257
5256
|
</div>
|
|
5258
|
-
`}};
|
|
5257
|
+
`}};mn.useShadowDom=!0,mn.styles=hn,un([s({type:String})],mn.prototype,"value",void 0),un([s({type:Array})],mn.prototype,"entities",void 0),un([s({type:Boolean})],mn.prototype,"disabled",void 0),un([s({type:Boolean})],mn.prototype,"loading",void 0),un([s({type:String})],mn.prototype,"placeholder",void 0),un([s({type:String})],mn.prototype,"label",void 0),un([s({type:String})],mn.prototype,"description",void 0),mn=un([l("nr-entity-select")],mn);let xn=class extends($e(t)){constructor(){super(...arguments),this.requiredComponents=["nr-select"],this.value=null,this.fields=[],this.disabled=!1,this.placeholder="Select field..."}handleChange(e){this.value=e.detail.value||null,this.dispatchEvent(new CustomEvent("value-change",{detail:{value:this.value},bubbles:!0,composed:!0}))}render(){const e=this.fields.map(e=>({value:e.name,label:e.name,description:e.type}));return i`
|
|
5259
5258
|
<nr-select
|
|
5260
5259
|
.value=${this.value||""}
|
|
5261
5260
|
.options=${e}
|
|
@@ -5264,7 +5263,7 @@ const pn=e`
|
|
|
5264
5263
|
size="small"
|
|
5265
5264
|
@nr-change=${this.handleChange}
|
|
5266
5265
|
></nr-select>
|
|
5267
|
-
`}};
|
|
5266
|
+
`}};xn.useShadowDom=!0,xn.styles=hn,un([s({type:String})],xn.prototype,"value",void 0),un([s({type:Array})],xn.prototype,"fields",void 0),un([s({type:Boolean})],xn.prototype,"disabled",void 0),un([s({type:String})],xn.prototype,"placeholder",void 0),xn=un([l("nr-field-select")],xn);let yn=class extends($e(t)){constructor(){super(...arguments),this.requiredComponents=["nr-select"],this.value=[],this.fields=[],this.disabled=!1,this.placeholder="All fields",this.label="",this.description=""}handleChange(e){this.value=Array.isArray(e.detail.value)?e.detail.value:[e.detail.value].filter(Boolean),this.dispatchEvent(new CustomEvent("value-change",{detail:{value:this.value},bubbles:!0,composed:!0}))}render(){const e=this.fields.map(e=>({value:e.name,label:e.name,description:e.type}));return i`
|
|
5268
5267
|
<div class="field-container">
|
|
5269
5268
|
${this.label?i`<label class="field-label">${this.label}</label>`:n}
|
|
5270
5269
|
<nr-select
|
|
@@ -5279,7 +5278,7 @@ const pn=e`
|
|
|
5279
5278
|
></nr-select>
|
|
5280
5279
|
${this.description?i`<span class="field-description">${this.description}</span>`:n}
|
|
5281
5280
|
</div>
|
|
5282
|
-
`}};
|
|
5281
|
+
`}};yn.useShadowDom=!0,yn.styles=hn,un([s({type:Array})],yn.prototype,"value",void 0),un([s({type:Array})],yn.prototype,"fields",void 0),un([s({type:Boolean})],yn.prototype,"disabled",void 0),un([s({type:String})],yn.prototype,"placeholder",void 0),un([s({type:String})],yn.prototype,"label",void 0),un([s({type:String})],yn.prototype,"description",void 0),yn=un([l("nr-field-multi-select")],yn);let wn=class extends($e(t)){constructor(){super(...arguments),this.requiredComponents=["nr-select","nr-input","nr-icon"],this.value=null,this.fields=[],this.disabled=!1,this.label="",this.description="",this.allowExpressions=!0}getEmptyGroup(e="and"){return{[e]:[]}}getEmptyCondition(){return{field:"",op:_.EQUALS,value:""}}updateValue(e){this.value=e,this.dispatchEvent(new CustomEvent("value-change",{detail:{value:this.value},bubbles:!0,composed:!0}))}toggleLogic(e){return e.and?{or:e.and}:e.or?{and:e.or}:e}addCondition(){if(this.value){const e=this.value.and?"and":"or",t=this.value[e]||[];this.updateValue({[e]:[...t,this.getEmptyCondition()]})}else this.updateValue({and:[this.getEmptyCondition()]})}addGroup(){if(this.value){const e=this.value.and?"and":"or",t=this.value[e]||[];this.updateValue({[e]:[...t,this.getEmptyGroup("and")]})}else this.updateValue({and:[this.getEmptyGroup("and")]})}removeCondition(e){if(!this.value)return;const t=this.value.and?"and":"or",i=(this.value[t]||[]).filter((t,i)=>i!==e);0===i.length?this.updateValue(null):this.updateValue({[t]:i})}updateCondition(e,t){if(!this.value)return;const i=this.value.and?"and":"or",n=[...this.value[i]||[]];n[e]=Object.assign(Object.assign({},n[e]),t),this.updateValue({[i]:n})}renderCondition(e,t){const n=R.find(t=>t.value===e.op),a=!1!==(null==n?void 0:n.requiresValue),o=this.fields.map(e=>({value:e.name,label:e.name})),s=R.map(e=>({value:e.value,label:e.label}));return i`
|
|
5283
5282
|
<div class="filter-condition">
|
|
5284
5283
|
<nr-select
|
|
5285
5284
|
.value=${e.field}
|
|
@@ -5360,7 +5359,7 @@ const pn=e`
|
|
|
5360
5359
|
</div>
|
|
5361
5360
|
${this.description?i`<span class="field-description">${this.description}</span>`:n}
|
|
5362
5361
|
</div>
|
|
5363
|
-
`}};
|
|
5362
|
+
`}};wn.useShadowDom=!0,wn.styles=hn,un([s({type:Object})],wn.prototype,"value",void 0),un([s({type:Array})],wn.prototype,"fields",void 0),un([s({type:Boolean})],wn.prototype,"disabled",void 0),un([s({type:String})],wn.prototype,"label",void 0),un([s({type:String})],wn.prototype,"description",void 0),un([s({type:Boolean})],wn.prototype,"allowExpressions",void 0),wn=un([l("nr-filter-builder")],wn);let $n=class extends($e(t)){constructor(){super(...arguments),this.requiredComponents=["nr-select","nr-input","nr-icon"],this.value={},this.fields=[],this.disabled=!1,this.label="",this.description="",this.allowExpressions=!0}updateValue(e){this.value=e,this.dispatchEvent(new CustomEvent("value-change",{detail:{value:this.value},bubbles:!0,composed:!0}))}addMapping(){const e=Object.keys(this.value),t=this.fields.find(t=>!e.includes(t.name));t&&this.updateValue(Object.assign(Object.assign({},this.value),{[t.name]:""}))}removeMapping(e){const t=Object.assign({},this.value);delete t[e],this.updateValue(t)}updateMapping(e,t,i){const n=Object.assign({},this.value);e!==t&&delete n[e],n[t]=i,this.updateValue(n)}render(){const e=Object.entries(this.value),t=this.fields.map(e=>({value:e.name,label:e.name}));return i`
|
|
5364
5363
|
<div class="field-container">
|
|
5365
5364
|
${this.label?i`<label class="field-label">${this.label}</label>`:n}
|
|
5366
5365
|
<div class="field-mapper">
|
|
@@ -5406,7 +5405,7 @@ const pn=e`
|
|
|
5406
5405
|
</div>
|
|
5407
5406
|
${this.description?i`<span class="field-description">${this.description}</span>`:n}
|
|
5408
5407
|
</div>
|
|
5409
|
-
`}}
|
|
5408
|
+
`}};$n.useShadowDom=!0,$n.styles=hn,un([s({type:Object})],$n.prototype,"value",void 0),un([s({type:Array})],$n.prototype,"fields",void 0),un([s({type:Boolean})],$n.prototype,"disabled",void 0),un([s({type:String})],$n.prototype,"label",void 0),un([s({type:String})],$n.prototype,"description",void 0),un([s({type:Boolean})],$n.prototype,"allowExpressions",void 0),$n=un([l("nr-field-mapper")],$n);let kn=class extends($e(t)){constructor(){super(...arguments),this.requiredComponents=["nr-select","nr-icon"],this.value=[],this.fields=[],this.disabled=!1,this.label=""}updateValue(e){this.value=e,this.dispatchEvent(new CustomEvent("value-change",{detail:{value:this.value},bubbles:!0,composed:!0}))}addSort(){const e=this.value.map(e=>e.field),t=this.fields.find(t=>!e.includes(t.name));t&&this.updateValue([...this.value,{field:t.name,dir:"ASC"}])}removeSort(e){this.updateValue(this.value.filter((t,i)=>i!==e))}updateSort(e,t){const i=[...this.value];i[e]=Object.assign(Object.assign({},i[e]),t),this.updateValue(i)}toggleDirection(e){const t=this.value[e].dir;this.updateSort(e,{dir:"ASC"===t?"DESC":"ASC"})}render(){const e=this.fields.map(e=>({value:e.name,label:e.name}));return i`
|
|
5410
5409
|
<div class="field-container">
|
|
5411
5410
|
${this.label?i`<label class="field-label">${this.label}</label>`:n}
|
|
5412
5411
|
<div class="sort-builder">
|
|
@@ -5447,13 +5446,13 @@ const pn=e`
|
|
|
5447
5446
|
</button>
|
|
5448
5447
|
</div>
|
|
5449
5448
|
</div>
|
|
5450
|
-
`}}
|
|
5449
|
+
`}};kn.useShadowDom=!0,kn.styles=hn,un([s({type:Array})],kn.prototype,"value",void 0),un([s({type:Array})],kn.prototype,"fields",void 0),un([s({type:Boolean})],kn.prototype,"disabled",void 0),un([s({type:String})],kn.prototype,"label",void 0),kn=un([l("nr-sort-builder")],kn);
|
|
5451
5450
|
/**
|
|
5452
5451
|
* @license
|
|
5453
5452
|
* Copyright 2024 Nuraly, Laabidi Aymen
|
|
5454
5453
|
* SPDX-License-Identifier: MIT
|
|
5455
5454
|
*/
|
|
5456
|
-
var
|
|
5455
|
+
var Sn=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},Cn=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())})};function Tn(e){const t={integer:"number",bigint:"number",smallint:"number",decimal:"number",numeric:"number",real:"number","double precision":"number",serial:"number",bigserial:"number",int:"number",int4:"number",int8:"number",float:"number",float4:"number",float8:"number",varchar:"string","character varying":"string",text:"string",char:"string",character:"string",uuid:"string",boolean:"boolean",bool:"boolean",date:"date",timestamp:"datetime","timestamp without time zone":"datetime","timestamp with time zone":"datetime",timestamptz:"datetime",time:"datetime","time without time zone":"datetime","time with time zone":"datetime",timetz:"datetime",json:"json",jsonb:"json",array:"array",bytea:"binary"}[e.type.toLowerCase()]||"string";return{id:e.name,name:e.name,type:t}}function Mn(e,t){const i={filter:[P.QUERY,P.UPDATE,P.DELETE],fields:[P.INSERT,P.UPDATE],select:[P.QUERY],sorting:[P.QUERY],pagination:[P.QUERY]};return!i[e]||i[e].includes(t)}let En=class extends t{constructor(){super(...arguments),this.config={},this.applicationId="",this.kvEntries=[],this.columns=[],this.loadingColumns=!1}updated(e){if(e.has("config")){const t=e.get("config"),i=this.config.connectionPath,n=this.config.schema,a=this.config.entity,o=(null==t?void 0:t.connectionPath)!==i,s=(null==t?void 0:t.schema)!==n,r=(null==t?void 0:t.entity)!==a;(o||s||r)&&this.loadColumns()}}loadColumns(){return Cn(this,void 0,void 0,function*(){const e=this.applicationId,t=this.config.connectionPath,i=this.config.entity;if(e&&t&&i&&this.databaseProvider){this.loadingColumns=!0;try{const n=yield this.databaseProvider.getColumns(t,e,i,this.config.schema||void 0);this.columns=n}catch(e){console.error("Failed to load columns:",e),this.columns=[]}this.loadingColumns=!1}else this.columns=[]})}onUpdate(e,t){this.dispatchEvent(new CustomEvent("config-update",{detail:{key:e,value:t},bubbles:!0,composed:!0}))}renderDatabaseTypeSelect(){const e=N.map(e=>({label:e.label,value:e.value,icon:e.icon}));return i`
|
|
5457
5456
|
<div class="config-field">
|
|
5458
5457
|
<label>Database Type</label>
|
|
5459
5458
|
<nr-select
|
|
@@ -5518,9 +5517,9 @@ var kn=function(e,t,i,n){for(var a,o=arguments.length,s=o<3?t:null===n?n=Object.
|
|
|
5518
5517
|
<div class="loading-columns">
|
|
5519
5518
|
Loading columns...
|
|
5520
5519
|
</div>
|
|
5521
|
-
`;const t=this.columns.map(
|
|
5520
|
+
`;const t=this.columns.map(Tn);return i`
|
|
5522
5521
|
<!-- Filter Section -->
|
|
5523
|
-
${
|
|
5522
|
+
${Mn("filter",e)?i`
|
|
5524
5523
|
<div class="config-section">
|
|
5525
5524
|
<div class="config-section-header">
|
|
5526
5525
|
<span class="config-section-title">Filter</span>
|
|
@@ -5537,7 +5536,7 @@ var kn=function(e,t,i,n){for(var a,o=arguments.length,s=o<3?t:null===n?n=Object.
|
|
|
5537
5536
|
`:n}
|
|
5538
5537
|
|
|
5539
5538
|
<!-- Fields Section (for INSERT/UPDATE) -->
|
|
5540
|
-
${
|
|
5539
|
+
${Mn("fields",e)?i`
|
|
5541
5540
|
<div class="config-section">
|
|
5542
5541
|
<div class="config-section-header">
|
|
5543
5542
|
<span class="config-section-title">Fields</span>
|
|
@@ -5554,7 +5553,7 @@ var kn=function(e,t,i,n){for(var a,o=arguments.length,s=o<3?t:null===n?n=Object.
|
|
|
5554
5553
|
`:n}
|
|
5555
5554
|
|
|
5556
5555
|
<!-- Select Fields Section (for QUERY) -->
|
|
5557
|
-
${
|
|
5556
|
+
${Mn("select",e)?i`
|
|
5558
5557
|
<div class="config-section">
|
|
5559
5558
|
<div class="config-section-header">
|
|
5560
5559
|
<span class="config-section-title">Select Fields</span>
|
|
@@ -5571,7 +5570,7 @@ var kn=function(e,t,i,n){for(var a,o=arguments.length,s=o<3?t:null===n?n=Object.
|
|
|
5571
5570
|
`:n}
|
|
5572
5571
|
|
|
5573
5572
|
<!-- Sorting Section (for QUERY) -->
|
|
5574
|
-
${
|
|
5573
|
+
${Mn("sorting",e)?i`
|
|
5575
5574
|
<div class="config-section">
|
|
5576
5575
|
<div class="config-section-header">
|
|
5577
5576
|
<span class="config-section-title">Sorting</span>
|
|
@@ -5604,7 +5603,7 @@ var kn=function(e,t,i,n){for(var a,o=arguments.length,s=o<3?t:null===n?n=Object.
|
|
|
5604
5603
|
${this.renderColumnDependentSections()}
|
|
5605
5604
|
|
|
5606
5605
|
<!-- Pagination Section (for QUERY) -->
|
|
5607
|
-
${
|
|
5606
|
+
${Mn("pagination",e)?i`
|
|
5608
5607
|
<div class="config-section">
|
|
5609
5608
|
<div class="config-section-header">
|
|
5610
5609
|
<span class="config-section-title">Pagination</span>
|
|
@@ -5645,7 +5644,7 @@ var kn=function(e,t,i,n){for(var a,o=arguments.length,s=o<3?t:null===n?n=Object.
|
|
|
5645
5644
|
@value-change=${e=>this.onUpdate("outputVariable",e.detail.value)}
|
|
5646
5645
|
></nr-variable-name-input>
|
|
5647
5646
|
</div>
|
|
5648
|
-
`}};
|
|
5647
|
+
`}};En.styles=e`
|
|
5649
5648
|
:host {
|
|
5650
5649
|
display: block;
|
|
5651
5650
|
}
|
|
@@ -5708,13 +5707,13 @@ var kn=function(e,t,i,n){for(var a,o=arguments.length,s=o<3?t:null===n?n=Object.
|
|
|
5708
5707
|
border-radius: 6px;
|
|
5709
5708
|
border: 1px dashed var(--border-color, #e5e7eb);
|
|
5710
5709
|
}
|
|
5711
|
-
`,
|
|
5710
|
+
`,Sn([s({type:Object})],En.prototype,"config",void 0),Sn([s({type:String})],En.prototype,"applicationId",void 0),Sn([s({attribute:!1})],En.prototype,"databaseProvider",void 0),Sn([s({attribute:!1})],En.prototype,"kvEntries",void 0),Sn([s({attribute:!1})],En.prototype,"onCreateKvEntry",void 0),Sn([r()],En.prototype,"columns",void 0),Sn([r()],En.prototype,"loadingColumns",void 0),En=Sn([l("nr-data-node-config")],En);
|
|
5712
5711
|
/**
|
|
5713
5712
|
* @license
|
|
5714
5713
|
* Copyright 2024 Nuraly, Laabidi Aymen
|
|
5715
5714
|
* SPDX-License-Identifier: MIT
|
|
5716
5715
|
*/
|
|
5717
|
-
const
|
|
5716
|
+
const An=e`
|
|
5718
5717
|
:host {
|
|
5719
5718
|
display: block;
|
|
5720
5719
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
|
|
@@ -6034,16 +6033,16 @@ const En=e`
|
|
|
6034
6033
|
* @license
|
|
6035
6034
|
* Copyright 2024 Nuraly, Laabidi Aymen
|
|
6036
6035
|
* SPDX-License-Identifier: MIT
|
|
6037
|
-
*/;var
|
|
6036
|
+
*/;var zn;!function(e){e.MESSAGE_RECEIVED="MESSAGE_RECEIVED",e.MESSAGE_SENT="MESSAGE_SENT",e.SUGGESTION_CLICKED="SUGGESTION_CLICKED",e.FILE_UPLOADED="FILE_UPLOADED",e.THREAD_CREATED="THREAD_CREATED",e.MODULE_SELECTED="MODULE_SELECTED",e.SESSION_STARTED="SESSION_STARTED"}(zn||(zn={}));const In=[{value:zn.MESSAGE_SENT,label:"Message Sent",icon:"send",description:"When user sends a message"},{value:zn.MESSAGE_RECEIVED,label:"Message Received",icon:"message-square",description:"When bot receives a message"},{value:zn.SUGGESTION_CLICKED,label:"Suggestion Clicked",icon:"mouse-pointer",description:"When user clicks a suggestion"},{value:zn.FILE_UPLOADED,label:"File Uploaded",icon:"upload",description:"When user uploads a file"},{value:zn.THREAD_CREATED,label:"Thread Created",icon:"message-circle",description:"When a new thread is created"},{value:zn.MODULE_SELECTED,label:"Module Selected",icon:"grid",description:"When user selects a module"},{value:zn.SESSION_STARTED,label:"Session Started",icon:"play",description:"When chat session starts"}],On={triggerEvents:[zn.MESSAGE_SENT],messageFilter:null,size:"medium",variant:"default",placeholder:"Type your message...",loadingIndicator:"dots",loadingText:"Processing...",enableFileUpload:!1,enableThreads:!1,enableSuggestions:!0,enableModules:!1,boxedLayout:!1,alwaysOpenPlan:!1,suggestions:[],modules:[],welcomeMessage:"",outputVariable:"chatMessage"};function Pn(e){const t=[];return e.triggerEvents&&0!==e.triggerEvents.length||t.push({field:"triggerEvents",message:"At least one trigger event is required"}),e.outputVariable&&""!==e.outputVariable.trim()||t.push({field:"outputVariable",message:"Output variable name is required"}),t}
|
|
6038
6037
|
/**
|
|
6039
6038
|
* @license
|
|
6040
6039
|
* Copyright 2024 Nuraly, Laabidi Aymen
|
|
6041
6040
|
* SPDX-License-Identifier: MIT
|
|
6042
|
-
*/var
|
|
6041
|
+
*/var _n=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 Rn=class extends($e(t)){constructor(){super(...arguments),this.requiredComponents=["nr-checkbox","nr-icon"],this.value=[],this.disabled=!1,this.label="",this.description=""}toggleEvent(e){if(this.disabled)return;const t=this.value.includes(e)?this.value.filter(t=>t!==e):[...this.value,e];this.value=t,this.dispatchEvent(new CustomEvent("value-change",{detail:{value:this.value},bubbles:!0,composed:!0}))}render(){return i`
|
|
6043
6042
|
<div class="field-container">
|
|
6044
6043
|
${this.label?i`<label class="field-label">${this.label}</label>`:n}
|
|
6045
6044
|
<div class="event-list">
|
|
6046
|
-
${v(
|
|
6045
|
+
${v(In,e=>{const t=this.value.includes(e.value);return i`
|
|
6047
6046
|
<div
|
|
6048
6047
|
class="event-item ${h({selected:t})}"
|
|
6049
6048
|
@click=${()=>this.toggleEvent(e.value)}
|
|
@@ -6065,7 +6064,7 @@ const En=e`
|
|
|
6065
6064
|
</div>
|
|
6066
6065
|
${this.description?i`<span class="field-description">${this.description}</span>`:n}
|
|
6067
6066
|
</div>
|
|
6068
|
-
`}};
|
|
6067
|
+
`}};Rn.useShadowDom=!0,Rn.styles=An,_n([s({type:Array})],Rn.prototype,"value",void 0),_n([s({type:Boolean})],Rn.prototype,"disabled",void 0),_n([s({type:String})],Rn.prototype,"label",void 0),_n([s({type:String})],Rn.prototype,"description",void 0),Rn=_n([l("nr-trigger-event-select")],Rn);let Nn=class extends($e(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`
|
|
6069
6068
|
<div class="field-container">
|
|
6070
6069
|
${this.label?i`<label class="field-label">${this.label}</label>`:n}
|
|
6071
6070
|
<div class="option-grid">
|
|
@@ -6080,7 +6079,7 @@ const En=e`
|
|
|
6080
6079
|
`)}
|
|
6081
6080
|
</div>
|
|
6082
6081
|
</div>
|
|
6083
|
-
`}};
|
|
6082
|
+
`}};Nn.useShadowDom=!0,Nn.styles=An,_n([s({type:String})],Nn.prototype,"value",void 0),_n([s({type:Boolean})],Nn.prototype,"disabled",void 0),_n([s({type:String})],Nn.prototype,"label",void 0),Nn=_n([l("nr-chatbot-size-select")],Nn);let Dn=class extends($e(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`
|
|
6084
6083
|
<div class="field-container">
|
|
6085
6084
|
${this.label?i`<label class="field-label">${this.label}</label>`:n}
|
|
6086
6085
|
<div class="option-grid">
|
|
@@ -6095,7 +6094,7 @@ const En=e`
|
|
|
6095
6094
|
`)}
|
|
6096
6095
|
</div>
|
|
6097
6096
|
</div>
|
|
6098
|
-
`}};
|
|
6097
|
+
`}};Dn.useShadowDom=!0,Dn.styles=An,_n([s({type:String})],Dn.prototype,"value",void 0),_n([s({type:Boolean})],Dn.prototype,"disabled",void 0),_n([s({type:String})],Dn.prototype,"label",void 0),Dn=_n([l("nr-chatbot-variant-select")],Dn);let Ln=class extends($e(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`
|
|
6099
6098
|
<div class="toggle-container" @click=${this.toggle}>
|
|
6100
6099
|
<div class="toggle-label">
|
|
6101
6100
|
<span class="toggle-label-text">${this.label}</span>
|
|
@@ -6105,7 +6104,7 @@ const En=e`
|
|
|
6105
6104
|
<div class="toggle-switch-knob"></div>
|
|
6106
6105
|
</div>
|
|
6107
6106
|
</div>
|
|
6108
|
-
`}};
|
|
6107
|
+
`}};Ln.useShadowDom=!0,Ln.styles=An,_n([s({type:Boolean})],Ln.prototype,"value",void 0),_n([s({type:Boolean})],Ln.prototype,"disabled",void 0),_n([s({type:String})],Ln.prototype,"label",void 0),_n([s({type:String})],Ln.prototype,"description",void 0),Ln=_n([l("nr-feature-toggle")],Ln);let jn=class extends($e(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`
|
|
6109
6108
|
<div class="field-container">
|
|
6110
6109
|
${this.label?i`<label class="field-label">${this.label}</label>`:n}
|
|
6111
6110
|
<div class="suggestion-list">
|
|
@@ -6150,7 +6149,7 @@ const En=e`
|
|
|
6150
6149
|
</div>
|
|
6151
6150
|
${this.description?i`<span class="field-description">${this.description}</span>`:n}
|
|
6152
6151
|
</div>
|
|
6153
|
-
`}};
|
|
6152
|
+
`}};jn.useShadowDom=!0,jn.styles=An,_n([s({type:Array})],jn.prototype,"value",void 0),_n([s({type:Boolean})],jn.prototype,"disabled",void 0),_n([s({type:String})],jn.prototype,"label",void 0),_n([s({type:String})],jn.prototype,"description",void 0),jn=_n([l("nr-suggestion-list")],jn);let Fn=class extends($e(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=In.find(e=>e.value===this.triggerEvents[0]))||void 0===e?void 0:e.label}`:`Triggers on ${t} events`;return i`
|
|
6154
6153
|
<div class="chatbot-preview">
|
|
6155
6154
|
<div class="chatbot-preview-icon">
|
|
6156
6155
|
<nr-icon name="message-square" size="large"></nr-icon>
|
|
@@ -6161,7 +6160,7 @@ const En=e`
|
|
|
6161
6160
|
${this.size} / ${this.variant}
|
|
6162
6161
|
</div>
|
|
6163
6162
|
</div>
|
|
6164
|
-
`}};
|
|
6163
|
+
`}};Fn.useShadowDom=!0,Fn.styles=An,_n([s({type:String})],Fn.prototype,"size",void 0),_n([s({type:String})],Fn.prototype,"variant",void 0),_n([s({type:String})],Fn.prototype,"placeholder",void 0),_n([s({type:Array})],Fn.prototype,"triggerEvents",void 0),Fn=_n([l("nr-chatbot-preview")],Fn);let Bn=class extends($e(t)){constructor(){super(...arguments),this.requiredComponents=["nr-select"],this.value="dots",this.disabled=!1,this.label=""}handleChange(e){this.value=e.detail.value,this.dispatchEvent(new CustomEvent("value-change",{detail:{value:this.value},bubbles:!0,composed:!0}))}render(){return i`
|
|
6165
6164
|
<div class="field-container">
|
|
6166
6165
|
${this.label?i`<label class="field-label">${this.label}</label>`:n}
|
|
6167
6166
|
<nr-select
|
|
@@ -6177,7 +6176,7 @@ const En=e`
|
|
|
6177
6176
|
* Copyright 2024 Nuraly, Laabidi Aymen
|
|
6178
6177
|
* SPDX-License-Identifier: MIT
|
|
6179
6178
|
*/
|
|
6180
|
-
function
|
|
6179
|
+
function Un(e,t,a){var o,s;const r=e.tableColumns||[],l=(e,i,n)=>{const a=[...r];a[e]=Object.assign(Object.assign({},a[e]),{[i]:n}),t("tableColumns",a)},c=null==a?void 0:a.outputData;return i`
|
|
6181
6180
|
<!-- Columns Section -->
|
|
6182
6181
|
<div class="config-section">
|
|
6183
6182
|
<div class="config-section-header">
|
|
@@ -6323,7 +6322,7 @@ function Bn(e,t,a){var o,s;const r=e.tableColumns||[],l=(e,i,n)=>{const a=[...r]
|
|
|
6323
6322
|
* @license
|
|
6324
6323
|
* Copyright 2024 Nuraly, Laabidi Aymen
|
|
6325
6324
|
* SPDX-License-Identifier: MIT
|
|
6326
|
-
*/function
|
|
6325
|
+
*/function Vn(e,t,a,o){const s=
|
|
6327
6326
|
/**
|
|
6328
6327
|
* @license
|
|
6329
6328
|
* Copyright 2024 Nuraly, Laabidi Aymen
|
|
@@ -6399,13 +6398,13 @@ function(e,t){const i={sourceTableName:null,sourceColumns:[],targetTableName:nul
|
|
|
6399
6398
|
* @license
|
|
6400
6399
|
* Copyright 2024 Nuraly, Laabidi Aymen
|
|
6401
6400
|
* SPDX-License-Identifier: MIT
|
|
6402
|
-
*/
|
|
6401
|
+
*/Bn.useShadowDom=!0,Bn.styles=An,_n([s({type:String})],Bn.prototype,"value",void 0),_n([s({type:Boolean})],Bn.prototype,"disabled",void 0),_n([s({type:String})],Bn.prototype,"label",void 0),Bn=_n([l("nr-loading-type-select")],Bn);
|
|
6403
6402
|
/**
|
|
6404
6403
|
* @license
|
|
6405
6404
|
* Copyright 2024 Nuraly
|
|
6406
6405
|
* SPDX-License-Identifier: MIT
|
|
6407
6406
|
*/
|
|
6408
|
-
var
|
|
6407
|
+
var Hn=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 qn=class extends t{constructor(){super(...arguments),this.provider="openai",this.value="",this.placeholder="Select API key...",this.type="api-key",this.entries=[],this.loading=!1,this.showCreateForm=!1,this.newKeyName="",this.newKeyValue="",this.creating=!1,this.error=""}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}))}toggleCreateForm(){this.showCreateForm=!this.showCreateForm,this.showCreateForm||this.resetCreateForm()}resetCreateForm(){this.newKeyName="",this.newKeyValue="",this.error="",this.creating=!1}handleCreate(){if(!this.newKeyName||!this.newKeyValue)return;this.creating=!0,this.error="";const e=`${this.provider}/${this.newKeyName}`;this.dispatchEvent(new CustomEvent("create-entry",{detail:{keyPath:e,value:this.newKeyValue,scope:this.provider,isSecret:!0},bubbles:!0,composed:!0}))}notifyCreateSuccess(e){this.value=e,this.showCreateForm=!1,this.resetCreateForm(),this.dispatchEvent(new CustomEvent("value-change",{detail:{value:e},bubbles:!0,composed:!0}))}notifyCreateError(e){this.error=e,this.creating=!1}getTypeLabel(){return"url"===this.type?"URL":"API Key"}getValuePlaceholder(){return"url"===this.type?"http://localhost:11434":"sk-..."}renderCreateForm(){const e=this.getTypeLabel();return i`
|
|
6409
6408
|
<div class="create-form">
|
|
6410
6409
|
<div class="create-form-header">
|
|
6411
6410
|
<span class="create-form-title">Add ${this.provider} ${e}</span>
|
|
@@ -6475,7 +6474,7 @@ var Vn=function(e,t,i,n){for(var a,o=arguments.length,s=o<3?t:null===n?n=Object.
|
|
|
6475
6474
|
* Copyright 2024 Nuraly, Laabidi Aymen
|
|
6476
6475
|
* SPDX-License-Identifier: MIT
|
|
6477
6476
|
*/
|
|
6478
|
-
function
|
|
6477
|
+
function Gn(e,t){const i=document.createElement(e);return i.style.cssText=t,i}function Wn(e,t,i,n){const a=document.createElementNS("http://www.w3.org/2000/svg","line");return a.setAttribute("x1",e),a.setAttribute("y1",t),a.setAttribute("x2",i),a.setAttribute("y2",n),a}qn.styles=e`
|
|
6479
6478
|
:host {
|
|
6480
6479
|
display: block;
|
|
6481
6480
|
}
|
|
@@ -6589,7 +6588,7 @@ function qn(e,t){const i=document.createElement(e);return i.style.cssText=t,i}fu
|
|
|
6589
6588
|
color: var(--text-secondary, #6b7280);
|
|
6590
6589
|
font-size: 13px;
|
|
6591
6590
|
}
|
|
6592
|
-
`,
|
|
6591
|
+
`,qn.useShadowDom=!0,Hn([s({type:String})],qn.prototype,"provider",void 0),Hn([s({type:String})],qn.prototype,"value",void 0),Hn([s({type:String})],qn.prototype,"placeholder",void 0),Hn([s({type:String})],qn.prototype,"type",void 0),Hn([s({attribute:!1})],qn.prototype,"entries",void 0),Hn([s({type:Boolean})],qn.prototype,"loading",void 0),Hn([r()],qn.prototype,"showCreateForm",void 0),Hn([r()],qn.prototype,"newKeyName",void 0),Hn([r()],qn.prototype,"newKeyValue",void 0),Hn([r()],qn.prototype,"creating",void 0),Hn([r()],qn.prototype,"error",void 0),qn=Hn([l("nr-kv-secret-select")],qn);const Kn="\n .code-editor-wrapper {\n position: relative;\n height: 200px;\n border: 1px solid var(--border-color, #e0e0e0);\n border-radius: 4px;\n overflow: hidden;\n }\n .code-editor-wrapper nr-code-editor {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n --nuraly-code-editor-height: 100%;\n --nuraly-code-editor-width: 100%;\n --nuraly-code-editor-border-radius: 4px;\n --nuraly-code-editor-border: none;\n }\n .code-editor-toolbar {\n display: flex;\n justify-content: flex-end;\n margin-bottom: 8px;\n }\n .expand-btn {\n display: inline-flex;\n align-items: center;\n gap: 4px;\n padding: 4px 8px;\n border: 1px solid var(--border-color, #e0e0e0);\n border-radius: 4px;\n background: var(--bg-secondary, #f5f5f5);\n color: var(--text-secondary, #666);\n font-size: 12px;\n cursor: pointer;\n transition: all 0.2s;\n }\n .expand-btn:hover {\n background: var(--bg-hover, #e8e8e8);\n color: var(--text-primary, #333);\n }\n";function Jn(e){return i`
|
|
6593
6592
|
<div class="code-editor-toolbar">
|
|
6594
6593
|
<button class="expand-btn" @click=${e.onFullscreen}>
|
|
6595
6594
|
<nr-icon name="maximize-2" size="14"></nr-icon>
|
|
@@ -6604,13 +6603,13 @@ function qn(e,t){const i=document.createElement(e);return i.style.cssText=t,i}fu
|
|
|
6604
6603
|
@nr-change=${e.onCodeChange}
|
|
6605
6604
|
></nr-code-editor>
|
|
6606
6605
|
</div>
|
|
6607
|
-
`}function
|
|
6606
|
+
`}function Yn(e){var t;const{modalId:i,title:n,language:a,initialCode:o,onCodeChange:s}=e;null===(t=document.querySelector(`#${i}`))||void 0===t||t.remove();const r=Gn("div","position:fixed;top:0;left:0;right:0;bottom:0;width:100vw;height:100vh;background:rgba(0,0,0,0.5);display:flex;align-items:center;justify-content:center;z-index:99999");r.id=i;const l=Gn("div","background:#ffffff;border-radius:8px;width:85vw;height:85vh;max-width:1200px;display:flex;flex-direction:column;box-shadow:0 8px 32px rgba(0,0,0,0.2)"),c=Gn("div","display:flex;align-items:center;justify-content:space-between;padding:16px 20px;border-bottom:1px solid var(--border-color,#e0e0e0)"),d=Gn("span","font-size:16px;font-weight:500;color:var(--text-primary,#333)");d.textContent=n;const p=Gn("button","background:none;border:none;cursor:pointer;padding:4px;display:flex;align-items:center;justify-content:center;border-radius:4px");p.appendChild(function(){const e=document.createElementNS("http://www.w3.org/2000/svg","svg");return e.setAttribute("width","20"),e.setAttribute("height","20"),e.setAttribute("viewBox","0 0 24 24"),e.setAttribute("fill","none"),e.setAttribute("stroke","currentColor"),e.setAttribute("stroke-width","2"),e.appendChild(Wn("18","6","6","18")),e.appendChild(Wn("6","6","18","18")),e}()),c.append(d,p);const h=Gn("div","flex:1;padding:16px;overflow:hidden;display:flex;flex-direction:column"),u=Gn("div","flex:1;position:relative;border-radius:4px;overflow:hidden"),b=document.createElement("nr-code-editor");b.setAttribute("language",a),b.setAttribute("theme","vs-dark"),b.style.cssText="position:absolute;top:0;left:0;right:0;bottom:0;--nuraly-code-editor-height:100%;--nuraly-code-editor-width:100%",u.appendChild(b),h.appendChild(u);const f=Gn("div","display:flex;justify-content:flex-end;padding:12px 20px;border-top:1px solid var(--border-color,#e0e0e0);gap:8px"),v=Gn("button","padding:8px 16px;border:1px solid var(--border-color,#e0e0e0);border-radius:4px;background:var(--bg-secondary,#f5f5f5);cursor:pointer;font-size:14px");v.textContent="Close",f.appendChild(v),l.append(c,h,f),r.appendChild(l),document.body.appendChild(r),requestAnimationFrame(()=>{b.code=o,b.addEventListener("nr-change",e=>{s(e.detail.value)})});const g=()=>r.remove();p.addEventListener("click",g),v.addEventListener("click",g),r.addEventListener("click",e=>{e.target===r&&g()}),document.addEventListener("keydown",function e(t){"Escape"===t.key&&(g(),document.removeEventListener("keydown",e))})}
|
|
6608
6607
|
/**
|
|
6609
6608
|
* @license
|
|
6610
6609
|
* Copyright 2024 Nuraly, Laabidi Aymen
|
|
6611
6610
|
* SPDX-License-Identifier: MIT
|
|
6612
|
-
*/function
|
|
6613
|
-
<style>${
|
|
6611
|
+
*/function Qn(e,t){const n='// Available variables:\n// - input: Data from previous node or tool arguments\n// - variables: Workflow variables\n// - args: Node configuration args\n\n// Example: Return a value\nreturn {\n result: input.value * 2,\n message: "Processed successfully"\n};';return i`
|
|
6612
|
+
<style>${Kn}</style>
|
|
6614
6613
|
<div class="config-section">
|
|
6615
6614
|
<div class="config-section-header">
|
|
6616
6615
|
<span class="config-section-title">JavaScript Code</span>
|
|
@@ -6618,7 +6617,7 @@ function qn(e,t){const i=document.createElement(e);return i.style.cssText=t,i}fu
|
|
|
6618
6617
|
</div>
|
|
6619
6618
|
<div class="config-field">
|
|
6620
6619
|
<label>Code</label>
|
|
6621
|
-
${
|
|
6620
|
+
${Jn({language:"javascript",code:e.code||n,onCodeChange:e=>t("code",e.detail.value),onFullscreen:()=>function(e,t,i){Yn({modalId:"function-code-modal",title:"Edit Function Code",language:"javascript",initialCode:e.code||t,onCodeChange:e=>i("code",e)})}(e,n,t)})}
|
|
6622
6621
|
<span class="field-description">JavaScript code to execute. Use 'return' to output a value.</span>
|
|
6623
6622
|
</div>
|
|
6624
6623
|
</div>
|
|
@@ -6641,7 +6640,7 @@ function qn(e,t){const i=document.createElement(e);return i.style.cssText=t,i}fu
|
|
|
6641
6640
|
* @license
|
|
6642
6641
|
* Copyright 2024 Nuraly, Laabidi Aymen
|
|
6643
6642
|
* SPDX-License-Identifier: MIT
|
|
6644
|
-
*/const
|
|
6643
|
+
*/const Xn=[{label:"Equals",value:"eq"},{label:"Not Equals",value:"neq"},{label:"Greater Than",value:"gt"},{label:"Greater Than or Equal",value:"gte"},{label:"Less Than",value:"lt"},{label:"Less Than or Equal",value:"lte"},{label:"Contains",value:"contains"},{label:"Does Not Contain",value:"notContains"},{label:"Starts With",value:"startsWith"},{label:"Ends With",value:"endsWith"},{label:"Is Empty",value:"isEmpty"},{label:"Is Not Empty",value:"isNotEmpty"},{label:"Matches Regex",value:"regex"}],Zn=new Set(["isEmpty","isNotEmpty"]);function ea(e,t){var a;const o=e.conditionMode||"expression",s=e.conditionLogic||"and",r=(null===(a=e.conditions)||void 0===a?void 0:a.length)?e.conditions:[{leftValue:"",operator:"eq",rightValue:""}],l=e=>{t("conditions",e)};return i`
|
|
6645
6644
|
<div class="config-field">
|
|
6646
6645
|
<label>Mode</label>
|
|
6647
6646
|
<nr-select
|
|
@@ -6675,7 +6674,7 @@ function qn(e,t){const i=document.createElement(e);return i.style.cssText=t,i}fu
|
|
|
6675
6674
|
<span>${"and"===s?"AND":"OR"}</span>
|
|
6676
6675
|
</div>
|
|
6677
6676
|
`:n}
|
|
6678
|
-
${function(e,t,a,o){const s=
|
|
6677
|
+
${function(e,t,a,o){const s=Zn.has(e.operator);return i`
|
|
6679
6678
|
<div class="condition-row">
|
|
6680
6679
|
<div class="condition-row-fields">
|
|
6681
6680
|
<nr-input
|
|
@@ -6687,7 +6686,7 @@ function qn(e,t){const i=document.createElement(e);return i.style.cssText=t,i}fu
|
|
|
6687
6686
|
<nr-select
|
|
6688
6687
|
size="small"
|
|
6689
6688
|
.value=${e.operator}
|
|
6690
|
-
.options=${
|
|
6689
|
+
.options=${Xn}
|
|
6691
6690
|
class="condition-operator"
|
|
6692
6691
|
@nr-change=${i=>{const n=[...a];n[t]=Object.assign(Object.assign({},e),{operator:i.detail.value}),o(n)}}
|
|
6693
6692
|
></nr-select>
|
|
@@ -6753,7 +6752,7 @@ function qn(e,t){const i=document.createElement(e);return i.style.cssText=t,i}fu
|
|
|
6753
6752
|
* @license
|
|
6754
6753
|
* Copyright 2024 Nuraly, Laabidi Aymen
|
|
6755
6754
|
* SPDX-License-Identifier: MIT
|
|
6756
|
-
*/function
|
|
6755
|
+
*/function ta(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`
|
|
6757
6756
|
<div class="config-field">
|
|
6758
6757
|
<label>Expression</label>
|
|
6759
6758
|
<nr-input
|
|
@@ -6820,7 +6819,7 @@ function qn(e,t){const i=document.createElement(e);return i.style.cssText=t,i}fu
|
|
|
6820
6819
|
* Copyright 2024 Nuraly, Laabidi Aymen
|
|
6821
6820
|
* SPDX-License-Identifier: MIT
|
|
6822
6821
|
*/
|
|
6823
|
-
function
|
|
6822
|
+
function ia(e,t){var n;const a=Array.isArray(e.catchTypes)?e.catchTypes:["*"];return i`
|
|
6824
6823
|
<div class="config-field">
|
|
6825
6824
|
<label>Catch Error Types</label>
|
|
6826
6825
|
<nr-input
|
|
@@ -6867,7 +6866,7 @@ function ta(e,t){var n;const a=Array.isArray(e.catchTypes)?e.catchTypes:["*"];re
|
|
|
6867
6866
|
* @license
|
|
6868
6867
|
* Copyright 2024 Nuraly, Laabidi Aymen
|
|
6869
6868
|
* SPDX-License-Identifier: MIT
|
|
6870
|
-
*/function
|
|
6869
|
+
*/function na(e,t,n,a){const o="html"===e.bodyType,s=(n||[]).filter(e=>e.keyPath.startsWith("smtp/"));return i`
|
|
6871
6870
|
<style>
|
|
6872
6871
|
.email-body-wrapper {
|
|
6873
6872
|
position: relative;
|
|
@@ -7033,19 +7032,19 @@ function(e,t){const i=document.querySelector("#email-body-modal");null==i||i.rem
|
|
|
7033
7032
|
* @license
|
|
7034
7033
|
* Copyright 2024 Nuraly, Laabidi Aymen
|
|
7035
7034
|
* SPDX-License-Identifier: MIT
|
|
7036
|
-
*/const
|
|
7035
|
+
*/const aa={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}};
|
|
7037
7036
|
/**
|
|
7038
7037
|
* @license
|
|
7039
7038
|
* Copyright 2024 Nuraly, Laabidi Aymen
|
|
7040
7039
|
* SPDX-License-Identifier: MIT
|
|
7041
7040
|
*/
|
|
7042
|
-
const
|
|
7041
|
+
const oa=[{value:"mail",label:"Mail"},{value:"contact",label:"Contact"},{value:"list",label:"List"}],sa=[{value:"send_email",label:"Send Email"},{value:"send_template",label:"Send Template Email"}],ra=[{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"}],la=[{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"}];
|
|
7043
7042
|
/**
|
|
7044
7043
|
* @license
|
|
7045
7044
|
* Copyright 2024 Nuraly, Laabidi Aymen
|
|
7046
7045
|
* SPDX-License-Identifier: MIT
|
|
7047
7046
|
*/
|
|
7048
|
-
function
|
|
7047
|
+
function ca(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`
|
|
7049
7048
|
<div class="config-section">
|
|
7050
7049
|
<div class="config-section-header">
|
|
7051
7050
|
<span class="config-section-title">Template</span>
|
|
@@ -7119,7 +7118,7 @@ function la(e,t){const n=[];if(e.data&&"object"==typeof e.data)for(const[t,i]of
|
|
|
7119
7118
|
<small class="field-hint">Access via \${variables.documentResult.fileUrl}</small>
|
|
7120
7119
|
</div>
|
|
7121
7120
|
</div>
|
|
7122
|
-
`}const
|
|
7121
|
+
`}const da=e`
|
|
7123
7122
|
:host {
|
|
7124
7123
|
display: block;
|
|
7125
7124
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
|
|
@@ -7489,7 +7488,7 @@ function la(e,t){const n=[];if(e.data&&"object"==typeof e.data)for(const[t,i]of
|
|
|
7489
7488
|
font-size: 16px;
|
|
7490
7489
|
}
|
|
7491
7490
|
}
|
|
7492
|
-
`,
|
|
7491
|
+
`,pa={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 ha=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},ua=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 ba=class extends($e(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 ua(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=pa.isImageFile(t),a={name:t.name,size:pa.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 pa.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=pa.isImageFile(i),n={name:i.name,size:pa.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 pa.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`
|
|
7493
7492
|
<div class="upload" part="container" @drop=${this._onDrop} @dragover=${e=>e.preventDefault()}>
|
|
7494
7493
|
<input
|
|
7495
7494
|
type="file"
|
|
@@ -7597,7 +7596,7 @@ function la(e,t){const n=[];if(e.data&&"object"==typeof e.data)for(const[t,i]of
|
|
|
7597
7596
|
* Copyright 2024 Nuraly, Laabidi Aymen
|
|
7598
7597
|
* SPDX-License-Identifier: MIT
|
|
7599
7598
|
*/
|
|
7600
|
-
function
|
|
7599
|
+
function fa(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 va(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}
|
|
7601
7600
|
/**
|
|
7602
7601
|
* @license
|
|
7603
7602
|
* Copyright 2024 Nuraly, Laabidi Aymen
|
|
@@ -7608,7 +7607,7 @@ function ba(e,t,i="testFile"){var n;const a=null===(n=e.detail)||void 0===n?void
|
|
|
7608
7607
|
* Copyright 2024 Nuraly, Laabidi Aymen
|
|
7609
7608
|
* SPDX-License-Identifier: MIT
|
|
7610
7609
|
*/
|
|
7611
|
-
function
|
|
7610
|
+
function ga(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`
|
|
7612
7611
|
<div class="config-field">
|
|
7613
7612
|
<label>Mode</label>
|
|
7614
7613
|
<nr-select
|
|
@@ -7805,25 +7804,25 @@ function va(e,t){const a=e.checks||[],o=e=>{const i={type:e,action:"block"};"pii
|
|
|
7805
7804
|
*/(e,o,s)}
|
|
7806
7805
|
</div>
|
|
7807
7806
|
`;var r})}
|
|
7808
|
-
`}
|
|
7807
|
+
`}ba.useShadowDom=!0,ba.styles=da,ha([s({type:String})],ba.prototype,"accept",void 0),ha([s({type:Boolean})],ba.prototype,"multiple",void 0),ha([s({type:Boolean})],ba.prototype,"drag",void 0),ha([s({type:String})],ba.prototype,"tip",void 0),ha([s({type:Number})],ba.prototype,"limit",void 0),ha([s({type:Boolean})],ba.prototype,"preview",void 0),ha([s({type:Boolean})],ba.prototype,"generatePreviewOnUpload",void 0),ha([r()],ba.prototype,"fileList",void 0),ha([r()],ba.prototype,"isDragOver",void 0),ha([r()],ba.prototype,"showDragArea",void 0),ha([r()],ba.prototype,"inputElement",void 0),ha([r()],ba.prototype,"dragCounter",void 0),ha([r()],ba.prototype,"previewImage",void 0),ba=ha([l("nr-file-upload")],ba);const ma=[{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"}];
|
|
7809
7808
|
/**
|
|
7810
7809
|
* @license
|
|
7811
7810
|
* Copyright 2024 Nuraly, Laabidi Aymen
|
|
7812
7811
|
* SPDX-License-Identifier: MIT
|
|
7813
7812
|
*/
|
|
7814
|
-
const
|
|
7813
|
+
const xa=[{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"}],ya=[{value:"LIST",label:"List"},{value:"READ",label:"Read"},{value:"CREATE",label:"Create"},{value:"UPDATE",label:"Update"},{value:"DELETE",label:"Delete"}],wa=[{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"}],$a=[{value:"",label:"None"},{value:"created_at",label:"Created At"},{value:"updated_at",label:"Updated At"},{value:"id",label:"ID"}],ka=[{value:"asc",label:"Ascending"},{value:"desc",label:"Descending"}],Sa=[{value:"any",label:"Any"},{value:"open",label:"Open"},{value:"closed",label:"Closed"},{value:"cancelled",label:"Cancelled"}],Ca=[{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"}],Ta=[{value:"any",label:"Any"},{value:"shipped",label:"Shipped"},{value:"partial",label:"Partial"},{value:"unshipped",label:"Unshipped"},{value:"unfulfilled",label:"Unfulfilled"}];
|
|
7815
7814
|
/**
|
|
7816
7815
|
* @license
|
|
7817
7816
|
* Copyright 2024 Nuraly, Laabidi Aymen
|
|
7818
7817
|
* SPDX-License-Identifier: MIT
|
|
7819
7818
|
*/
|
|
7820
|
-
const
|
|
7819
|
+
const Ma=[{value:"",label:"None"},{value:"HTML",label:"HTML"},{value:"Markdown",label:"Markdown"},{value:"MarkdownV2",label:"MarkdownV2"}],Ea=[{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"}],Aa=[{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"}],za=[{value:"",label:"None"},{value:"👍",label:"👍 Thumbs Up"},{value:"👀",label:"👀 Eyes (read)"},{value:"✅",label:"✅ Check"},{value:"❤",label:"❤ Heart"},{value:"🔥",label:"🔥 Fire"},{value:"⚡",label:"⚡ Lightning"}],Ia=["sendPhoto","sendVideo","sendDocument","sendAudio","sendAnimation"],Oa=["sendPhoto","sendVideo","sendDocument","sendAudio","sendSticker","sendAnimation"],Pa=["sendMessage","editMessageText",...Ia];
|
|
7821
7820
|
/**
|
|
7822
7821
|
* @license
|
|
7823
7822
|
* Copyright 2024 Nuraly, Laabidi Aymen
|
|
7824
7823
|
* SPDX-License-Identifier: MIT
|
|
7825
7824
|
*/
|
|
7826
|
-
const
|
|
7825
|
+
const _a=[{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"}],Ra=[{value:"CREATE",label:"Create"},{value:"READ",label:"Read"},{value:"UPDATE",label:"Update"},{value:"DELETE",label:"Delete"},{value:"LIST",label:"List"},{value:"SEARCH",label:"Search"}],Na=[{value:"",label:"None"},{value:"low",label:"Low"},{value:"normal",label:"Normal"},{value:"high",label:"High"},{value:"urgent",label:"Urgent"}],Da=[{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"}],La=[{value:"",label:"None"},{value:"question",label:"Question"},{value:"incident",label:"Incident"},{value:"problem",label:"Problem"},{value:"task",label:"Task"}],ja=[{value:"",label:"Default"},{value:"created_at",label:"Created At"},{value:"updated_at",label:"Updated At"},{value:"priority",label:"Priority"},{value:"status",label:"Status"}],Fa=[{value:"asc",label:"Ascending"},{value:"desc",label:"Descending"}];function Ba(e){return i`
|
|
7827
7826
|
<div class="trigger-stats-row">
|
|
7828
7827
|
<span class="trigger-stat">
|
|
7829
7828
|
<nr-icon name="message-square" size="small"></nr-icon>
|
|
@@ -7841,7 +7840,7 @@ function(e){const t=Date.now()-new Date(e).getTime();return t<0?"just now":t<6e4
|
|
|
7841
7840
|
</span>
|
|
7842
7841
|
`:n}
|
|
7843
7842
|
</div>
|
|
7844
|
-
`}function
|
|
7843
|
+
`}function Ua(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`
|
|
7845
7844
|
<div class="config-section">
|
|
7846
7845
|
<div class="config-section-header">
|
|
7847
7846
|
<span class="config-section-title">
|
|
@@ -7863,7 +7862,7 @@ function(e){const t=Date.now()-new Date(e).getTime();return t<0?"just now":t<6e4
|
|
|
7863
7862
|
<div class="trigger-status-reason">${e.stateReason}</div>
|
|
7864
7863
|
`:n}
|
|
7865
7864
|
|
|
7866
|
-
${h&&e?
|
|
7865
|
+
${h&&e?Ba(e):n}
|
|
7867
7866
|
|
|
7868
7867
|
${(null==e?void 0:e.inDevMode)?i`
|
|
7869
7868
|
<div class="trigger-dev-mode-badge">
|
|
@@ -7939,37 +7938,37 @@ function(e){const t=Date.now()-new Date(e).getTime();return t<0?"just now":t<6e4
|
|
|
7939
7938
|
* @license
|
|
7940
7939
|
* Copyright 2024 Nuraly, Laabidi Aymen
|
|
7941
7940
|
* SPDX-License-Identifier: MIT
|
|
7942
|
-
*/const
|
|
7941
|
+
*/const Va=[{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"}];
|
|
7943
7942
|
/**
|
|
7944
7943
|
* @license
|
|
7945
7944
|
* Copyright 2024 Nuraly, Laabidi Aymen
|
|
7946
7945
|
* SPDX-License-Identifier: MIT
|
|
7947
7946
|
*/
|
|
7948
|
-
const
|
|
7947
|
+
const Ha=[{value:"GUILDS",label:"Guilds"},{value:"GUILD_MEMBERS",label:"Guild Members (privileged)"},{value:"GUILD_MODERATION",label:"Guild Moderation"},{value:"GUILD_VOICE_STATES",label:"Voice States"},{value:"GUILD_PRESENCES",label:"Presences (privileged)"},{value:"GUILD_MESSAGES",label:"Guild Messages"},{value:"GUILD_MESSAGE_REACTIONS",label:"Guild Message Reactions"},{value:"DIRECT_MESSAGES",label:"Direct Messages"},{value:"DIRECT_MESSAGE_REACTIONS",label:"DM Reactions"},{value:"MESSAGE_CONTENT",label:"Message Content (privileged)"},{value:"GUILD_SCHEDULED_EVENTS",label:"Scheduled Events"},{value:"AUTO_MODERATION_EXECUTION",label:"Auto-Moderation Execution"}],qa=[{value:"MESSAGE_CREATE",label:"Message Create"},{value:"MESSAGE_UPDATE",label:"Message Update"},{value:"MESSAGE_DELETE",label:"Message Delete"},{value:"MESSAGE_REACTION_ADD",label:"Reaction Add"},{value:"MESSAGE_REACTION_REMOVE",label:"Reaction Remove"},{value:"GUILD_MEMBER_ADD",label:"Member Join"},{value:"GUILD_MEMBER_REMOVE",label:"Member Leave"},{value:"INTERACTION_CREATE",label:"Interaction (Slash Command / Button)"},{value:"TYPING_START",label:"Typing Start"},{value:"PRESENCE_UPDATE",label:"Presence Update"}];
|
|
7949
7948
|
/**
|
|
7950
7949
|
* @license
|
|
7951
7950
|
* Copyright 2024 Nuraly, Laabidi Aymen
|
|
7952
7951
|
* SPDX-License-Identifier: MIT
|
|
7953
7952
|
*/
|
|
7954
|
-
const
|
|
7953
|
+
const Ga=[{value:"messages",label:"Messages"},{value:"message_status",label:"Message Status"},{value:"message_template_status_update",label:"Template Status"},{value:"account_update",label:"Account Update"},{value:"account_alerts",label:"Account Alerts"},{value:"business_capability_update",label:"Business Capability"},{value:"phone_number_name_update",label:"Phone Number Name"},{value:"phone_number_quality_update",label:"Phone Number Quality"}],Wa=[{value:"text",label:"Text"},{value:"image",label:"Image"},{value:"audio",label:"Audio"},{value:"video",label:"Video"},{value:"document",label:"Document"},{value:"sticker",label:"Sticker"},{value:"location",label:"Location"},{value:"contacts",label:"Contacts"},{value:"interactive",label:"Interactive (Buttons / Lists)"},{value:"button",label:"Button Reply"},{value:"reaction",label:"Reaction"},{value:"order",label:"Order"}];
|
|
7955
7954
|
/**
|
|
7956
7955
|
* @license
|
|
7957
7956
|
* Copyright 2024 Nuraly, Laabidi Aymen
|
|
7958
7957
|
* SPDX-License-Identifier: MIT
|
|
7959
7958
|
*/
|
|
7960
|
-
const
|
|
7959
|
+
const Ka=[{value:"message.channels",label:"Message in Public Channel"},{value:"message.groups",label:"Message in Private Channel"},{value:"message.im",label:"Direct Message"},{value:"message.mpim",label:"Group Direct Message"},{value:"app_mention",label:"App Mentioned"},{value:"reaction_added",label:"Reaction Added"},{value:"reaction_removed",label:"Reaction Removed"},{value:"channel_created",label:"Channel Created"},{value:"channel_archive",label:"Channel Archived"},{value:"team_join",label:"User Joined Workspace"},{value:"member_joined_channel",label:"Member Joined Channel"},{value:"member_left_channel",label:"Member Left Channel"},{value:"file_shared",label:"File Shared"},{value:"pin_added",label:"Pin Added"},{value:"emoji_changed",label:"Emoji Changed"}],Ja=[{value:"block_actions",label:"Block Actions (Button / Select)"},{value:"view_submission",label:"Modal Submission"},{value:"view_closed",label:"Modal Closed"},{value:"shortcut",label:"Global Shortcut"},{value:"message_action",label:"Message Shortcut"}];
|
|
7961
7960
|
/**
|
|
7962
7961
|
* @license
|
|
7963
7962
|
* Copyright 2024 Nuraly, Laabidi Aymen
|
|
7964
7963
|
* SPDX-License-Identifier: MIT
|
|
7965
7964
|
*/
|
|
7966
|
-
const
|
|
7965
|
+
const Ya=[{value:"application/json",label:"JSON"},{value:"text/plain",label:"Text"},{value:"application/octet-stream",label:"Binary"}];
|
|
7967
7966
|
/**
|
|
7968
7967
|
* @license
|
|
7969
7968
|
* Copyright 2024 Nuraly, Laabidi Aymen
|
|
7970
7969
|
* SPDX-License-Identifier: MIT
|
|
7971
7970
|
*/
|
|
7972
|
-
const
|
|
7971
|
+
const Qa=[{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"}],Xa=[{value:"none",label:"None"},{value:"Enable",label:"Enable"},{value:"DetectMessageEnd",label:"Detect Message End"}];function Za(e,t,n,a){const o=(n||[]).filter(e=>e.keyPath.startsWith("twilio/"));return i`
|
|
7973
7972
|
<div class="config-section">
|
|
7974
7973
|
<div class="config-section-header">
|
|
7975
7974
|
<span class="config-section-title">Credentials</span>
|
|
@@ -7994,7 +7993,7 @@ const Ya=[{value:"send_sms",label:"Send SMS"},{value:"make_call",label:"Make Voi
|
|
|
7994
7993
|
* Copyright 2024 Nuraly, Laabidi Aymen
|
|
7995
7994
|
* SPDX-License-Identifier: MIT
|
|
7996
7995
|
*/
|
|
7997
|
-
const
|
|
7996
|
+
const eo=[{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"}],to=[{value:"create",label:"Create"},{value:"get",label:"Get"},{value:"getAll",label:"Get All"},{value:"update",label:"Update"},{value:"delete",label:"Delete"}];function io(e,t){const a=e,o=a.gitlabResource||"issue",s=a.gitlabOperation||"getAll";return i`
|
|
7998
7997
|
<div class="config-section">
|
|
7999
7998
|
<div class="config-section-header">
|
|
8000
7999
|
<span class="config-section-title">Connection</span>
|
|
@@ -8032,7 +8031,7 @@ const Za=[{value:"issue",label:"Issue"},{value:"merge_request",label:"Merge Requ
|
|
|
8032
8031
|
value=${o}
|
|
8033
8032
|
@nr-change=${e=>t("gitlabResource",e.detail.value)}
|
|
8034
8033
|
>
|
|
8035
|
-
${
|
|
8034
|
+
${eo.map(e=>i`
|
|
8036
8035
|
<nr-option value=${e.value}>${e.label}</nr-option>
|
|
8037
8036
|
`)}
|
|
8038
8037
|
</nr-select>
|
|
@@ -8043,7 +8042,7 @@ const Za=[{value:"issue",label:"Issue"},{value:"merge_request",label:"Merge Requ
|
|
|
8043
8042
|
value=${s}
|
|
8044
8043
|
@nr-change=${e=>t("gitlabOperation",e.detail.value)}
|
|
8045
8044
|
>
|
|
8046
|
-
${
|
|
8045
|
+
${to.map(e=>i`
|
|
8047
8046
|
<nr-option value=${e.value}>${e.label}</nr-option>
|
|
8048
8047
|
`)}
|
|
8049
8048
|
</nr-select>
|
|
@@ -8212,7 +8211,7 @@ const Za=[{value:"issue",label:"Issue"},{value:"merge_request",label:"Merge Requ
|
|
|
8212
8211
|
* @license
|
|
8213
8212
|
* Copyright 2024 Nuraly, Laabidi Aymen
|
|
8214
8213
|
* SPDX-License-Identifier: MIT
|
|
8215
|
-
*/const
|
|
8214
|
+
*/const no=[{label:"Streamable HTTP",value:"streamable_http"},{label:"SSE (Server-Sent Events)",value:"sse"}],ao=[{label:"None",value:"none"},{label:"Bearer Token",value:"bearer"},{label:"API Key Header",value:"api_key"}];function oo(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`
|
|
8216
8215
|
<div class="config-section">
|
|
8217
8216
|
<div class="config-section-header">
|
|
8218
8217
|
<span class="config-section-title">
|
|
@@ -8275,7 +8274,7 @@ const Za=[{value:"issue",label:"Issue"},{value:"merge_request",label:"Merge Requ
|
|
|
8275
8274
|
* Copyright 2024 Nuraly, Laabidi Aymen
|
|
8276
8275
|
* SPDX-License-Identifier: MIT
|
|
8277
8276
|
*/
|
|
8278
|
-
function
|
|
8277
|
+
function so(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`
|
|
8279
8278
|
<div class="config-field">
|
|
8280
8279
|
<label>Input Field</label>
|
|
8281
8280
|
<nr-input
|
|
@@ -8404,31 +8403,31 @@ function oo(e,t){const a=e.schema||[{name:"field1",type:"string",description:"",
|
|
|
8404
8403
|
* @license
|
|
8405
8404
|
* Copyright 2024 Nuraly, Laabidi Aymen
|
|
8406
8405
|
* SPDX-License-Identifier: MIT
|
|
8407
|
-
*/const
|
|
8406
|
+
*/const ro=[{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"}],lo=[{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"}],co=[{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"}];
|
|
8408
8407
|
/**
|
|
8409
8408
|
* @license
|
|
8410
8409
|
* Copyright 2024 Nuraly, Laabidi Aymen
|
|
8411
8410
|
* SPDX-License-Identifier: MIT
|
|
8412
8411
|
*/
|
|
8413
|
-
const
|
|
8412
|
+
const po=[{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"}],ho=[{value:"Task",label:"Task"},{value:"Bug",label:"Bug"},{value:"Story",label:"Story"},{value:"Epic",label:"Epic"},{value:"Sub-task",label:"Sub-task"}],uo=[{value:"Highest",label:"Highest"},{value:"High",label:"High"},{value:"Medium",label:"Medium"},{value:"Low",label:"Low"},{value:"Lowest",label:"Lowest"}];
|
|
8414
8413
|
/**
|
|
8415
8414
|
* @license
|
|
8416
8415
|
* Copyright 2024 Nuraly, Laabidi Aymen
|
|
8417
8416
|
* SPDX-License-Identifier: MIT
|
|
8418
8417
|
*/
|
|
8419
|
-
const
|
|
8418
|
+
const bo=[{value:"search",label:"Search"},{value:"index",label:"Index"},{value:"get",label:"Get"},{value:"update",label:"Update"},{value:"delete",label:"Delete"},{value:"bulk",label:"Bulk"}],fo=[{value:"false",label:"false (default)"},{value:"true",label:"true"},{value:"wait_for",label:"wait_for"}];
|
|
8420
8419
|
/**
|
|
8421
8420
|
* @license
|
|
8422
8421
|
* Copyright 2024 Nuraly, Laabidi Aymen
|
|
8423
8422
|
* SPDX-License-Identifier: MIT
|
|
8424
8423
|
*/
|
|
8425
|
-
const
|
|
8424
|
+
const vo=[{value:"invitee.created",label:"Invitee Created (meeting booked)"},{value:"invitee.canceled",label:"Invitee Canceled (meeting cancelled)"}],go=[{value:"user",label:"User — only your events"},{value:"organization",label:"Organization — all members' events"}];
|
|
8426
8425
|
/**
|
|
8427
8426
|
* @license
|
|
8428
8427
|
* Copyright 2024 Nuraly, Laabidi Aymen
|
|
8429
8428
|
* SPDX-License-Identifier: MIT
|
|
8430
8429
|
*/
|
|
8431
|
-
const
|
|
8430
|
+
const mo=[{value:"none",label:"None — No acknowledgment"},{value:"leader",label:"Leader — Leader broker only"},{value:"all",label:"All — All in-sync replicas"}],xo=[{value:"none",label:"None"},{value:"gzip",label:"Gzip"},{value:"snappy",label:"Snappy"},{value:"lz4",label:"LZ4"}];function yo(e){return i`
|
|
8432
8431
|
<div class="trigger-stats-row">
|
|
8433
8432
|
<span class="trigger-stat">
|
|
8434
8433
|
<nr-icon name="message-square" size="small"></nr-icon>
|
|
@@ -8440,7 +8439,7 @@ const go=[{value:"none",label:"None — No acknowledgment"},{value:"leader",labe
|
|
|
8440
8439
|
</span>
|
|
8441
8440
|
`:n}
|
|
8442
8441
|
</div>
|
|
8443
|
-
`}function
|
|
8442
|
+
`}function wo(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`
|
|
8444
8443
|
<div class="config-section">
|
|
8445
8444
|
<div class="config-section-header">
|
|
8446
8445
|
<span class="config-section-title">
|
|
@@ -8462,7 +8461,7 @@ const go=[{value:"none",label:"None — No acknowledgment"},{value:"leader",labe
|
|
|
8462
8461
|
<div class="trigger-status-reason">${e.stateReason}</div>
|
|
8463
8462
|
`:n}
|
|
8464
8463
|
|
|
8465
|
-
${c&&e?
|
|
8464
|
+
${c&&e?yo(e):n}
|
|
8466
8465
|
|
|
8467
8466
|
${(null==e?void 0:e.inDevMode)?i`
|
|
8468
8467
|
<div class="trigger-dev-mode-badge">
|
|
@@ -8517,7 +8516,7 @@ const go=[{value:"none",label:"None — No acknowledgment"},{value:"leader",labe
|
|
|
8517
8516
|
</div>
|
|
8518
8517
|
`:n}
|
|
8519
8518
|
</div>
|
|
8520
|
-
`}function
|
|
8519
|
+
`}function $o(e,t,n,a){return i`
|
|
8521
8520
|
<div class="config-section">
|
|
8522
8521
|
<div class="config-section-header">
|
|
8523
8522
|
<span class="config-section-title">Connection</span>
|
|
@@ -8594,7 +8593,7 @@ const go=[{value:"none",label:"None — No acknowledgment"},{value:"leader",labe
|
|
|
8594
8593
|
* Copyright 2024 Nuraly, Laabidi Aymen
|
|
8595
8594
|
* SPDX-License-Identifier: MIT
|
|
8596
8595
|
*/
|
|
8597
|
-
const
|
|
8596
|
+
const ko=[{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)"}],So=[{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 Co(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`
|
|
8598
8597
|
<div class="config-section">
|
|
8599
8598
|
<div class="config-section-header">
|
|
8600
8599
|
<span class="config-section-title">
|
|
@@ -8653,13 +8652,13 @@ const $o=[{value:"UTC",label:"UTC"},{value:"America/New_York",label:"America/New
|
|
|
8653
8652
|
* Copyright 2024 Nuraly, Laabidi Aymen
|
|
8654
8653
|
* SPDX-License-Identifier: MIT
|
|
8655
8654
|
*/
|
|
8656
|
-
const
|
|
8655
|
+
const To=[{value:"none",label:"None"},{value:"bearer",label:"Bearer Token"},{value:"basic",label:"Basic Auth"},{value:"header",label:"Custom Header"},{value:"query",label:"Query Parameter"}],Mo=[{value:"json",label:"JSON"},{value:"text",label:"Text"},{value:"binary",label:"Binary (base64)"}];
|
|
8657
8656
|
/**
|
|
8658
8657
|
* @license
|
|
8659
8658
|
* Copyright 2024 Nuraly, Laabidi Aymen
|
|
8660
8659
|
* SPDX-License-Identifier: MIT
|
|
8661
8660
|
*/
|
|
8662
|
-
var
|
|
8661
|
+
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},Ao=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 zo=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 Ao(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`
|
|
8663
8662
|
<div class="loading-indicator">
|
|
8664
8663
|
<div class="spinner"></div>
|
|
8665
8664
|
<span>Loading models...</span>
|
|
@@ -8709,7 +8708,7 @@ var Mo=function(e,t,i,n){for(var a,o=arguments.length,s=o<3?t:null===n?n=Object.
|
|
|
8709
8708
|
</button>
|
|
8710
8709
|
</div>
|
|
8711
8710
|
`:n}
|
|
8712
|
-
`}};
|
|
8711
|
+
`}};zo.styles=e`
|
|
8713
8712
|
:host {
|
|
8714
8713
|
display: block;
|
|
8715
8714
|
}
|
|
@@ -8793,18 +8792,18 @@ var Mo=function(e,t,i,n){for(var a,o=arguments.length,s=o<3?t:null===n?n=Object.
|
|
|
8793
8792
|
font-size: 12px;
|
|
8794
8793
|
color: var(--text-secondary, #6b7280);
|
|
8795
8794
|
}
|
|
8796
|
-
`,
|
|
8795
|
+
`,Eo([s({type:String})],zo.prototype,"serverUrl",void 0),Eo([s({type:String})],zo.prototype,"value",void 0),Eo([s({type:String})],zo.prototype,"placeholder",void 0),Eo([r()],zo.prototype,"models",void 0),Eo([r()],zo.prototype,"loading",void 0),Eo([r()],zo.prototype,"error",void 0),zo=Eo([l("nr-ollama-model-select")],zo);
|
|
8797
8796
|
/**
|
|
8798
8797
|
* @license
|
|
8799
8798
|
* Copyright 2024 Nuraly, Laabidi Aymen
|
|
8800
8799
|
* SPDX-License-Identifier: MIT
|
|
8801
8800
|
*/
|
|
8802
|
-
const
|
|
8801
|
+
const Io={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},Oo={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},Po={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},_o={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},Ro={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},No={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},Do={openai:Io,anthropic:Oo,gemini:Po,deepseek:_o,ollama:Ro,local:No},Lo=[{label:Io.label,value:Io.id},{label:Oo.label,value:Oo.id},{label:Po.label,value:Po.id},{label:_o.label,value:_o.id},{label:Ro.label,value:Ro.id},{label:No.label,value:No.id}];
|
|
8803
8802
|
/**
|
|
8804
8803
|
* @license
|
|
8805
8804
|
* Copyright 2024 Nuraly, Laabidi Aymen
|
|
8806
8805
|
* SPDX-License-Identifier: MIT
|
|
8807
|
-
*/function
|
|
8806
|
+
*/function jo(e){return Do[e]||Io}
|
|
8808
8807
|
/**
|
|
8809
8808
|
* @license
|
|
8810
8809
|
* Copyright 2024 Nuraly, Laabidi Aymen
|
|
@@ -8815,7 +8814,7 @@ const zo={id:"openai",label:"OpenAI",defaultModel:"gpt-4",modelPlaceholder:"gpt-
|
|
|
8815
8814
|
* Copyright 2024 Nuraly, Laabidi Aymen
|
|
8816
8815
|
* SPDX-License-Identifier: MIT
|
|
8817
8816
|
*/
|
|
8818
|
-
const
|
|
8817
|
+
const Fo=[{value:"message",label:"Message Count"},{value:"token",label:"Token Count"}];const Bo=e`
|
|
8819
8818
|
:host {
|
|
8820
8819
|
display: inline-block;
|
|
8821
8820
|
cursor: pointer;
|
|
@@ -8858,7 +8857,7 @@ const jo=[{value:"message",label:"Message Count"},{value:"token",label:"Token Co
|
|
|
8858
8857
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
8859
8858
|
* SPDX-License-Identifier: MIT
|
|
8860
8859
|
*/
|
|
8861
|
-
var
|
|
8860
|
+
var Uo=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 Vo=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`
|
|
8862
8861
|
<div
|
|
8863
8862
|
class="${h(e)}"
|
|
8864
8863
|
style="${d(t)}"
|
|
@@ -8867,7 +8866,7 @@ var Bo=function(e,t,i,n){for(var a,o=arguments.length,s=o<3?t:null===n?n=Object.
|
|
|
8867
8866
|
aria-label="Color swatch: ${this.color}"
|
|
8868
8867
|
title="${this.color}"
|
|
8869
8868
|
></div>
|
|
8870
|
-
`}};
|
|
8869
|
+
`}};Vo.styles=Bo,Vo.useShadowDom=!0,Uo([s({type:String})],Vo.prototype,"color",void 0),Uo([s({type:String,reflect:!0})],Vo.prototype,"size",void 0),Uo([s({type:Boolean,reflect:!0})],Vo.prototype,"disabled",void 0),Uo([s({type:Boolean,attribute:"show-transparency-grid"})],Vo.prototype,"showTransparencyGrid",void 0),Uo([s({type:Number,attribute:"border-width"})],Vo.prototype,"borderWidth",void 0),Uo([s({type:Boolean,attribute:"show-border"})],Vo.prototype,"showBorder",void 0),Vo=Uo([l("nr-colorholder-box")],Vo);const Ho=e`
|
|
8871
8870
|
.default-color-sets-container {
|
|
8872
8871
|
display: flex;
|
|
8873
8872
|
flex-wrap: wrap;
|
|
@@ -8899,7 +8898,7 @@ var Bo=function(e,t,i,n){for(var a,o=arguments.length,s=o<3?t:null===n?n=Object.
|
|
|
8899
8898
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
8900
8899
|
* SPDX-License-Identifier: MIT
|
|
8901
8900
|
*/
|
|
8902
|
-
var
|
|
8901
|
+
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};let Go=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`
|
|
8903
8902
|
<div
|
|
8904
8903
|
class="default-color-sets-container"
|
|
8905
8904
|
part="container"
|
|
@@ -8920,7 +8919,7 @@ var Ho=function(e,t,i,n){for(var a,o=arguments.length,s=o<3?t:null===n?n=Object.
|
|
|
8920
8919
|
></nr-colorholder-box>
|
|
8921
8920
|
`)}
|
|
8922
8921
|
</div>
|
|
8923
|
-
`:n}};
|
|
8922
|
+
`:n}};Go.styles=Ho,Go.useShadowDom=!0,qo([s({type:Array,attribute:"default-color-sets"})],Go.prototype,"defaultColorSets",void 0),qo([s({type:String,reflect:!0})],Go.prototype,"size",void 0),qo([s({type:Number,attribute:"columns"})],Go.prototype,"columns",void 0),Go=qo([l("nr-default-color-sets")],Go);var Wo=e`
|
|
8924
8923
|
:host {
|
|
8925
8924
|
display: inline-block;
|
|
8926
8925
|
vertical-align: middle;
|
|
@@ -8996,12 +8995,12 @@ var Ho=function(e,t,i,n){for(var a,o=arguments.length,s=o<3?t:null===n?n=Object.
|
|
|
8996
8995
|
opacity: 1;
|
|
8997
8996
|
visibility: visible;
|
|
8998
8997
|
}
|
|
8999
|
-
`;class
|
|
8998
|
+
`;class Ko extends Ve{findElement(e){var t;return(null===(t=this._host.shadowRoot)||void 0===t?void 0:t.querySelector(e))||null}}class Jo extends Ko{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 Yo extends Ko{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}}}
|
|
9000
8999
|
/**
|
|
9001
9000
|
* @license
|
|
9002
9001
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
9003
9002
|
* SPDX-License-Identifier: MIT
|
|
9004
|
-
*/var
|
|
9003
|
+
*/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};let Xo=class extends($e(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 Jo(this),this.eventController=new Yo(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 _l})}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`
|
|
9005
9004
|
<div class="${h(e)}" part="container" data-theme="${this.currentTheme}">
|
|
9006
9005
|
${this.renderLabel()}
|
|
9007
9006
|
|
|
@@ -9078,13 +9077,13 @@ return function(e,t,a){if(!e)return n;const o=(null==a?void 0:a.cssClass)||"labe
|
|
|
9078
9077
|
<div class="color-picker-helper-text">
|
|
9079
9078
|
${this.helperText}
|
|
9080
9079
|
</div>
|
|
9081
|
-
`:n}};
|
|
9080
|
+
`:n}};Xo.useShadowDom=!0,Xo.styles=Wo,Qo([s({type:String})],Xo.prototype,"color",void 0),Qo([s({type:Boolean,reflect:!0})],Xo.prototype,"show",void 0),Qo([s({type:Array,attribute:"default-color-sets"})],Xo.prototype,"defaultColorSets",void 0),Qo([s({type:Boolean,reflect:!0})],Xo.prototype,"disabled",void 0),Qo([s({type:String,reflect:!0})],Xo.prototype,"size",void 0),Qo([s({type:String,reflect:!0})],Xo.prototype,"trigger",void 0),Qo([s({type:String,reflect:!0})],Xo.prototype,"placement",void 0),Qo([s({type:String,reflect:!0})],Xo.prototype,"animation",void 0),Qo([s({type:Boolean,attribute:"close-on-select"})],Xo.prototype,"closeOnSelect",void 0),Qo([s({type:Boolean,attribute:"close-on-outside-click"})],Xo.prototype,"closeOnOutsideClick",void 0),Qo([s({type:Boolean,attribute:"close-on-escape"})],Xo.prototype,"closeOnEscape",void 0),Qo([s({type:Boolean,attribute:"show-input"})],Xo.prototype,"showInput",void 0),Qo([s({type:Boolean,attribute:"show-copy-button"})],Xo.prototype,"showCopyButton",void 0),Qo([s({type:String,reflect:!0})],Xo.prototype,"format",void 0),Qo([s({type:String,attribute:"input-placeholder"})],Xo.prototype,"inputPlaceholder",void 0),Qo([s({type:String})],Xo.prototype,"label",void 0),Qo([s({type:String,attribute:"helper-text"})],Xo.prototype,"helperText",void 0),Qo([r()],Xo.prototype,"isValidColor",void 0),Xo=Qo([l("nr-color-picker")],Xo);
|
|
9082
9081
|
/**
|
|
9083
9082
|
* @license
|
|
9084
9083
|
* Copyright 2024 Nuraly
|
|
9085
9084
|
* SPDX-License-Identifier: MIT
|
|
9086
9085
|
*/
|
|
9087
|
-
const
|
|
9086
|
+
const Zo=e`
|
|
9088
9087
|
:host {
|
|
9089
9088
|
display: block;
|
|
9090
9089
|
width: 100%;
|
|
@@ -9244,13 +9243,13 @@ const Xo=e`
|
|
|
9244
9243
|
* @license
|
|
9245
9244
|
* Copyright 2024 Nuraly
|
|
9246
9245
|
* SPDX-License-Identifier: MIT
|
|
9247
|
-
*/,
|
|
9246
|
+
*/,es="vs",ts="vs-dark",is="hc-black",ns="hc-light",as=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))}};
|
|
9248
9247
|
/**
|
|
9249
9248
|
* @license
|
|
9250
9249
|
* Copyright 2024 Nuraly
|
|
9251
9250
|
* SPDX-License-Identifier: MIT
|
|
9252
9251
|
*/
|
|
9253
|
-
var
|
|
9252
|
+
var os=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};w.registerLanguage("javascript",$),w.registerLanguage("typescript",k),w.registerLanguage("json",S),w.registerLanguage("html",C),w.registerLanguage("xml",C),w.registerLanguage("css",T),w.registerLanguage("markdown",M),w.registerLanguage("python",E),w.registerLanguage("sql",A);let ss=class extends(as(t)){constructor(){super(...arguments),this.isEditorReady=!1,this.editorRef=m(),this.suppressChange=!1,this.readonly=!1,this.theme=ts,this.language="javascript",this.code="",this.lineNumbers=!0,this.fontSize=13,this.wordWrap=!1,this.tabSize=2}render(){const e=this.isDarkTheme();return i`
|
|
9254
9253
|
<div class="editor-container ${e?"dark":"light"}" part="editor-container">
|
|
9255
9254
|
<div class="line-numbers-gutter" style="display: ${this.lineNumbers?"block":"none"}"></div>
|
|
9256
9255
|
<code
|
|
@@ -9259,14 +9258,14 @@ var as=function(e,t,i,n){for(var a,o=arguments.length,s=o<3?t:null===n?n=Object.
|
|
|
9259
9258
|
style="font-size: ${this.fontSize}px; tab-size: ${this.tabSize}; white-space: ${this.wordWrap?"pre-wrap":"pre"};"
|
|
9260
9259
|
></code>
|
|
9261
9260
|
</div>
|
|
9262
|
-
`}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=y(e,e=>{const t=e.textContent||"",i=this.language||"plaintext";try{"plaintext"!==i&&w.getLanguage(i)?e.innerHTML=w.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,"&").replace(/</g,"<").replace(/>/g,">")}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===
|
|
9261
|
+
`}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=y(e,e=>{const t=e.textContent||"",i=this.language||"plaintext";try{"plaintext"!==i&&w.getLanguage(i)?e.innerHTML=w.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,"&").replace(/</g,"<").replace(/>/g,">")}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===ts||this.theme===is||this.theme!==es&&this.theme!==ns&&(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}};ss.styles=Zo,ss.useShadowDom=!0,os([s({type:Boolean,reflect:!0})],ss.prototype,"readonly",void 0),os([s({type:String,reflect:!0})],ss.prototype,"theme",void 0),os([s({type:String,reflect:!0})],ss.prototype,"language",void 0),os([s({type:String})],ss.prototype,"code",void 0),os([s({type:Boolean,attribute:"line-numbers"})],ss.prototype,"lineNumbers",void 0),os([s({type:Number,attribute:"font-size"})],ss.prototype,"fontSize",void 0),os([s({type:Boolean,attribute:"word-wrap"})],ss.prototype,"wordWrap",void 0),os([s({type:Number,attribute:"tab-size"})],ss.prototype,"tabSize",void 0),ss=os([l("nr-code-editor")],ss);
|
|
9263
9262
|
/**
|
|
9264
9263
|
* @license
|
|
9265
9264
|
* Copyright 2024 Nuraly, Laabidi Aymen
|
|
9266
9265
|
* SPDX-License-Identifier: MIT
|
|
9267
9266
|
*/
|
|
9268
|
-
const
|
|
9269
|
-
<style>${
|
|
9267
|
+
const rs="graph TD\n A[Start] --\x3e B[End]";function ls(e,t){return i`
|
|
9268
|
+
<style>${Kn}</style>
|
|
9270
9269
|
<div class="config-section">
|
|
9271
9270
|
<div class="config-section-header">
|
|
9272
9271
|
<span class="config-section-title">Mermaid Diagram</span>
|
|
@@ -9274,7 +9273,7 @@ const ss="graph TD\n A[Start] --\x3e B[End]";function rs(e,t){return i`
|
|
|
9274
9273
|
</div>
|
|
9275
9274
|
<div class="config-field">
|
|
9276
9275
|
<label>Mermaid Code</label>
|
|
9277
|
-
${
|
|
9276
|
+
${Jn({language:"markdown",code:e.textContent||rs,onCodeChange:e=>t("textContent",e.detail.value),onFullscreen:()=>function(e,t){Yn({modalId:"mermaid-code-modal",title:"Edit Mermaid Diagram",language:"markdown",initialCode:e.textContent||rs,onCodeChange:e=>t("textContent",e)})}(e,t)})}
|
|
9278
9277
|
<span class="field-description">Supports flowcharts, sequence diagrams, class diagrams, and more.</span>
|
|
9279
9278
|
</div>
|
|
9280
9279
|
</div>
|
|
@@ -9289,7 +9288,7 @@ const ss="graph TD\n A[Start] --\x3e B[End]";function rs(e,t){return i`
|
|
|
9289
9288
|
* Copyright 2024 Nuraly, Laabidi Aymen
|
|
9290
9289
|
* SPDX-License-Identifier: MIT
|
|
9291
9290
|
*/
|
|
9292
|
-
var
|
|
9291
|
+
var cs=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())})};let ps=class extends t{constructor(){super(...arguments),this.selectedWorkflowId="",this._workflows=[],this._loading=!1,this._error=""}connectedCallback(){super.connectedCallback(),this._fetchWorkflows()}_fetchWorkflows(){return ds(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 ds(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`
|
|
9293
9292
|
<div class="error-container">
|
|
9294
9293
|
<span class="error">${this._error}</span>
|
|
9295
9294
|
<button class="retry-btn" @click=${()=>this._fetchWorkflows()}>Retry</button>
|
|
@@ -9309,7 +9308,7 @@ var ls=function(e,t,i,n){for(var a,o=arguments.length,s=o<3?t:null===n?n=Object.
|
|
|
9309
9308
|
* Copyright 2024 Nuraly, Laabidi Aymen
|
|
9310
9309
|
* SPDX-License-Identifier: MIT
|
|
9311
9310
|
*/
|
|
9312
|
-
function
|
|
9311
|
+
function hs(e,t,a,o,s,r,l,c,d,p,h,u,b,f){switch(e){case U.START:
|
|
9313
9312
|
/**
|
|
9314
9313
|
* @license
|
|
9315
9314
|
* Copyright 2024 Nuraly, Laabidi Aymen
|
|
@@ -9587,7 +9586,7 @@ return function(e,t,a,o,s){const r=a||"{workflowId}",l=e.httpPath||"/webhook",c=
|
|
|
9587
9586
|
@nr-input=${e=>t("timeout",Number.parseInt(e.detail.value))}
|
|
9588
9587
|
></nr-input>
|
|
9589
9588
|
</div>
|
|
9590
|
-
`}(t,a,s,r);case U.FUNCTION:return
|
|
9589
|
+
`}(t,a,s,r);case U.FUNCTION:return Qn(t,a);case U.CONDITION:return ea(t,a);case U.SWITCH:return ta(t,a);case U.DELAY:return function(e,t){return i`
|
|
9591
9590
|
<div class="config-field">
|
|
9592
9591
|
<label>Duration</label>
|
|
9593
9592
|
<nr-input
|
|
@@ -9719,7 +9718,7 @@ return function(e,t,a,o,s){const r=a||"{workflowId}",l=e.httpPath||"/webhook",c=
|
|
|
9719
9718
|
></nr-input>
|
|
9720
9719
|
<small class="field-hint">Wait time between iterations (useful for API rate limits)</small>
|
|
9721
9720
|
</div>
|
|
9722
|
-
`}(t,a);case U.TRY_CATCH:return
|
|
9721
|
+
`}(t,a);case U.TRY_CATCH:return ia(t,a);case U.TRANSFORM:return function(e,t){return i`
|
|
9723
9722
|
<div class="config-section">
|
|
9724
9723
|
<div class="config-section-header">
|
|
9725
9724
|
<span class="config-section-title">Transform</span>
|
|
@@ -9811,7 +9810,7 @@ return function(e,t,a,o,s){const r=a||"{workflowId}",l=e.httpPath||"/webhook",c=
|
|
|
9811
9810
|
</div>
|
|
9812
9811
|
<span class="field-description">Expr: \${input.field} or \${variables.name}</span>
|
|
9813
9812
|
</div>
|
|
9814
|
-
`}(t,a);case U.EMAIL:return
|
|
9813
|
+
`}(t,a);case U.EMAIL:return na(t,a,s,r);case U.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`
|
|
9815
9814
|
<!-- Provider Section -->
|
|
9816
9815
|
<div class="config-section">
|
|
9817
9816
|
<div class="config-section-header">
|
|
@@ -9823,7 +9822,7 @@ return function(e,t,a,o,s){const r=a||"{workflowId}",l=e.httpPath||"/webhook",c=
|
|
|
9823
9822
|
<nr-select
|
|
9824
9823
|
.value=${s}
|
|
9825
9824
|
.options=${[{label:"IMAP (Generic)",value:"imap"},{label:"Gmail",value:"gmail"},{label:"Outlook / Office 365",value:"outlook"},{label:"Yahoo Mail",value:"yahoo"}]}
|
|
9826
|
-
@nr-change=${e=>{const i=e.detail.value;t("provider",i);const n=
|
|
9825
|
+
@nr-change=${e=>{const i=e.detail.value;t("provider",i);const n=aa[i];n&&"imap"!==i&&(t("host",n.host),t("port",n.port),t("tls",n.tls))}}
|
|
9827
9826
|
></nr-select>
|
|
9828
9827
|
</div>
|
|
9829
9828
|
|
|
@@ -10032,7 +10031,7 @@ return function(e,t,a,o,s){const r=a||"{workflowId}",l=e.httpPath||"/webhook",c=
|
|
|
10032
10031
|
>
|
|
10033
10032
|
</div>
|
|
10034
10033
|
</div>
|
|
10035
|
-
`}(t,a,s,r);case U.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?
|
|
10034
|
+
`}(t,a,s,r);case U.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?ra:"list"===r?la:sa;return i`
|
|
10036
10035
|
<!-- Connection Section -->
|
|
10037
10036
|
<div class="config-section">
|
|
10038
10037
|
<div class="config-section-header">
|
|
@@ -10061,8 +10060,8 @@ return function(e,t,a,o,s){const r=a||"{workflowId}",l=e.httpPath||"/webhook",c=
|
|
|
10061
10060
|
<label>Resource</label>
|
|
10062
10061
|
<nr-select
|
|
10063
10062
|
.value=${r}
|
|
10064
|
-
.options=${
|
|
10065
|
-
@nr-change=${e=>{t("resource",e.detail.value);const i="contact"===e.detail.value?
|
|
10063
|
+
.options=${oa}
|
|
10064
|
+
@nr-change=${e=>{t("resource",e.detail.value);const i="contact"===e.detail.value?ra:"list"===e.detail.value?la:sa;t("operation",i[0].value)}}
|
|
10066
10065
|
></nr-select>
|
|
10067
10066
|
<span class="field-description">SendGrid resource to interact with</span>
|
|
10068
10067
|
</div>
|
|
@@ -11275,7 +11274,7 @@ return function(e,t){return i`
|
|
|
11275
11274
|
></nr-input>
|
|
11276
11275
|
<small class="field-hint">Variable to store crawl results (access via \${variables.crawlResult})</small>
|
|
11277
11276
|
</div>
|
|
11278
|
-
`}(t,a);case U.DOCUMENT_GENERATOR:return
|
|
11277
|
+
`}(t,a);case U.DOCUMENT_GENERATOR:return ca(t,a);case U.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`
|
|
11279
11278
|
<div class="config-field">
|
|
11280
11279
|
<label>Storage Provider</label>
|
|
11281
11280
|
<nr-select
|
|
@@ -11370,7 +11369,7 @@ return function(e,t){return i`
|
|
|
11370
11369
|
<nr-icon name="file" size="small"></nr-icon>
|
|
11371
11370
|
<div class="test-file-meta">
|
|
11372
11371
|
<span class="test-file-name">${r.filename}</span>
|
|
11373
|
-
<span class="test-file-size">${
|
|
11372
|
+
<span class="test-file-size">${va(r.size)} • ${r.contentType||"unknown type"}</span>
|
|
11374
11373
|
</div>
|
|
11375
11374
|
</div>
|
|
11376
11375
|
<nr-button
|
|
@@ -11393,7 +11392,7 @@ return function(e,t){return i`
|
|
|
11393
11392
|
`:i`
|
|
11394
11393
|
<nr-file-upload
|
|
11395
11394
|
tip="Drop file here or click to upload"
|
|
11396
|
-
@file-select=${e=>
|
|
11395
|
+
@file-select=${e=>fa(e,t)}
|
|
11397
11396
|
></nr-file-upload>
|
|
11398
11397
|
`}
|
|
11399
11398
|
<small class="field-hint">Upload a file to use as test input when running the workflow</small>
|
|
@@ -11848,7 +11847,7 @@ return function(e,t){return i`
|
|
|
11848
11847
|
<nr-icon name="file-text" size="small"></nr-icon>
|
|
11849
11848
|
<div class="test-file-meta">
|
|
11850
11849
|
<span class="test-file-name">${a.filename}</span>
|
|
11851
|
-
<span class="test-file-size">${
|
|
11850
|
+
<span class="test-file-size">${va(a.size)} • ${a.contentType||"unknown type"}</span>
|
|
11852
11851
|
</div>
|
|
11853
11852
|
</div>
|
|
11854
11853
|
<nr-button variant="ghost" size="small"
|
|
@@ -11866,7 +11865,7 @@ return function(e,t){return i`
|
|
|
11866
11865
|
<nr-file-upload
|
|
11867
11866
|
accept=".txt,.md,.pdf,.docx,.html,.csv,.json,.xlsx"
|
|
11868
11867
|
tip="Drop document here or click to upload"
|
|
11869
|
-
@file-select=${e=>
|
|
11868
|
+
@file-select=${e=>fa(e,t,"testDocument")}
|
|
11870
11869
|
></nr-file-upload>
|
|
11871
11870
|
`}
|
|
11872
11871
|
<small class="field-hint">Upload a document to use as test input</small>
|
|
@@ -12316,7 +12315,7 @@ return function(e,t){return i`
|
|
|
12316
12315
|
></nr-input>
|
|
12317
12316
|
<small class="field-hint">Variable to store the built context</small>
|
|
12318
12317
|
</div>
|
|
12319
|
-
`}(t,a);case U.GUARDRAIL:return
|
|
12318
|
+
`}(t,a);case U.GUARDRAIL:return ga(t,a);case U.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`
|
|
12320
12319
|
<div class="config-section">
|
|
12321
12320
|
<div class="config-section-header">
|
|
12322
12321
|
<span class="config-section-title">Connection</span>
|
|
@@ -12354,7 +12353,7 @@ return function(e,t){return i`
|
|
|
12354
12353
|
value=${n}
|
|
12355
12354
|
@nr-change=${e=>t("googleCalendarOperation",e.detail.value)}
|
|
12356
12355
|
>
|
|
12357
|
-
${
|
|
12356
|
+
${ma.map(e=>i`
|
|
12358
12357
|
<nr-option value=${e.value}>${e.label}</nr-option>
|
|
12359
12358
|
`)}
|
|
12360
12359
|
</nr-select>
|
|
@@ -12516,7 +12515,7 @@ return function(e,t){return i`
|
|
|
12516
12515
|
value=${e.apiVersion||"2025-01"}
|
|
12517
12516
|
@nr-change=${e=>t("apiVersion",e.detail.value)}
|
|
12518
12517
|
>
|
|
12519
|
-
${
|
|
12518
|
+
${wa.map(e=>i`
|
|
12520
12519
|
<nr-option value=${e.value}>${e.label}</nr-option>
|
|
12521
12520
|
`)}
|
|
12522
12521
|
</nr-select>
|
|
@@ -12535,7 +12534,7 @@ return function(e,t){return i`
|
|
|
12535
12534
|
value=${e.resource||"ORDER"}
|
|
12536
12535
|
@nr-change=${e=>t("resource",e.detail.value)}
|
|
12537
12536
|
>
|
|
12538
|
-
${
|
|
12537
|
+
${xa.map(e=>i`
|
|
12539
12538
|
<nr-option value=${e.value}>${e.label}</nr-option>
|
|
12540
12539
|
`)}
|
|
12541
12540
|
</nr-select>
|
|
@@ -12546,7 +12545,7 @@ return function(e,t){return i`
|
|
|
12546
12545
|
value=${r}
|
|
12547
12546
|
@nr-change=${e=>t("operation",e.detail.value)}
|
|
12548
12547
|
>
|
|
12549
|
-
${
|
|
12548
|
+
${ya.map(e=>i`
|
|
12550
12549
|
<nr-option value=${e.value}>${e.label}</nr-option>
|
|
12551
12550
|
`)}
|
|
12552
12551
|
</nr-select>
|
|
@@ -12588,7 +12587,7 @@ return function(e,t){return i`
|
|
|
12588
12587
|
value=${e.sortField||""}
|
|
12589
12588
|
@nr-change=${e=>t("sortField",e.detail.value)}
|
|
12590
12589
|
>
|
|
12591
|
-
${
|
|
12590
|
+
${$a.map(e=>i`
|
|
12592
12591
|
<nr-option value=${e.value}>${e.label}</nr-option>
|
|
12593
12592
|
`)}
|
|
12594
12593
|
</nr-select>
|
|
@@ -12600,7 +12599,7 @@ return function(e,t){return i`
|
|
|
12600
12599
|
value=${e.sortOrder||"asc"}
|
|
12601
12600
|
@nr-change=${e=>t("sortOrder",e.detail.value)}
|
|
12602
12601
|
>
|
|
12603
|
-
${
|
|
12602
|
+
${ka.map(e=>i`
|
|
12604
12603
|
<nr-option value=${e.value}>${e.label}</nr-option>
|
|
12605
12604
|
`)}
|
|
12606
12605
|
</nr-select>
|
|
@@ -12631,7 +12630,7 @@ return function(e,t){return i`
|
|
|
12631
12630
|
value=${e.orderStatus||"any"}
|
|
12632
12631
|
@nr-change=${e=>t("orderStatus",e.detail.value)}
|
|
12633
12632
|
>
|
|
12634
|
-
${
|
|
12633
|
+
${Sa.map(e=>i`
|
|
12635
12634
|
<nr-option value=${e.value}>${e.label}</nr-option>
|
|
12636
12635
|
`)}
|
|
12637
12636
|
</nr-select>
|
|
@@ -12643,7 +12642,7 @@ return function(e,t){return i`
|
|
|
12643
12642
|
value=${e.financialStatus||"any"}
|
|
12644
12643
|
@nr-change=${e=>t("financialStatus",e.detail.value)}
|
|
12645
12644
|
>
|
|
12646
|
-
${
|
|
12645
|
+
${Ca.map(e=>i`
|
|
12647
12646
|
<nr-option value=${e.value}>${e.label}</nr-option>
|
|
12648
12647
|
`)}
|
|
12649
12648
|
</nr-select>
|
|
@@ -12655,7 +12654,7 @@ return function(e,t){return i`
|
|
|
12655
12654
|
value=${e.fulfillmentStatus||"any"}
|
|
12656
12655
|
@nr-change=${e=>t("fulfillmentStatus",e.detail.value)}
|
|
12657
12656
|
>
|
|
12658
|
-
${
|
|
12657
|
+
${Ta.map(e=>i`
|
|
12659
12658
|
<nr-option value=${e.value}>${e.label}</nr-option>
|
|
12660
12659
|
`)}
|
|
12661
12660
|
</nr-select>
|
|
@@ -12689,7 +12688,7 @@ return function(e,t){return i`
|
|
|
12689
12688
|
<span class="field-description">Variable name to store the Shopify response</span>
|
|
12690
12689
|
</div>
|
|
12691
12690
|
</div>
|
|
12692
|
-
`}(t,a,s,r);case U.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=
|
|
12691
|
+
`}(t,a,s,r);case U.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=Ia.includes(s),d=Oa.includes(s),p=Pa.includes(s),h="editMessageText"===s||"deleteMessage"===s||"pinChatMessage"===s||"unpinChatMessage"===s,u="sendLocation"===s,b="answerCallbackQuery"===s,f="sendChatAction"===s,v="sendMediaGroup"===s;return i`
|
|
12693
12692
|
<div class="config-section">
|
|
12694
12693
|
<div class="config-section-header">
|
|
12695
12694
|
<span class="config-section-title">Operation</span>
|
|
@@ -12701,7 +12700,7 @@ return function(e,t){return i`
|
|
|
12701
12700
|
value=${s}
|
|
12702
12701
|
@nr-change=${e=>t("operation",e.detail.value)}
|
|
12703
12702
|
>
|
|
12704
|
-
${
|
|
12703
|
+
${Ea.map(e=>i`
|
|
12705
12704
|
<nr-option value=${e.value}>${e.label}</nr-option>
|
|
12706
12705
|
`)}
|
|
12707
12706
|
</nr-select>
|
|
@@ -12759,7 +12758,7 @@ return function(e,t){return i`
|
|
|
12759
12758
|
value=${e.parseMode||""}
|
|
12760
12759
|
@nr-change=${e=>t("parseMode",e.detail.value)}
|
|
12761
12760
|
>
|
|
12762
|
-
${
|
|
12761
|
+
${Ma.map(e=>i`
|
|
12763
12762
|
<nr-option value=${e.value}>${e.label}</nr-option>
|
|
12764
12763
|
`)}
|
|
12765
12764
|
</nr-select>
|
|
@@ -12809,7 +12808,7 @@ return function(e,t){return i`
|
|
|
12809
12808
|
value=${e.parseMode||""}
|
|
12810
12809
|
@nr-change=${e=>t("parseMode",e.detail.value)}
|
|
12811
12810
|
>
|
|
12812
|
-
${
|
|
12811
|
+
${Ma.map(e=>i`
|
|
12813
12812
|
<nr-option value=${e.value}>${e.label}</nr-option>
|
|
12814
12813
|
`)}
|
|
12815
12814
|
</nr-select>
|
|
@@ -12925,7 +12924,7 @@ return function(e,t){return i`
|
|
|
12925
12924
|
value=${e.chatAction||"typing"}
|
|
12926
12925
|
@nr-change=${e=>t("chatAction",e.detail.value)}
|
|
12927
12926
|
>
|
|
12928
|
-
${
|
|
12927
|
+
${Aa.map(e=>i`
|
|
12929
12928
|
<nr-option value=${e.value}>${e.label}</nr-option>
|
|
12930
12929
|
`)}
|
|
12931
12930
|
</nr-select>
|
|
@@ -12989,7 +12988,7 @@ return function(e,t){return i`
|
|
|
12989
12988
|
value=${e.reaction||""}
|
|
12990
12989
|
@nr-change=${e=>t("reaction",e.detail.value)}
|
|
12991
12990
|
>
|
|
12992
|
-
${
|
|
12991
|
+
${za.map(e=>i`
|
|
12993
12992
|
<nr-option value=${e.value}>${e.label}</nr-option>
|
|
12994
12993
|
`)}
|
|
12995
12994
|
</nr-select>
|
|
@@ -13045,7 +13044,7 @@ return function(e,t){return i`
|
|
|
13045
13044
|
value=${r}
|
|
13046
13045
|
@nr-change=${e=>t("zendeskResource",e.detail.value)}
|
|
13047
13046
|
>
|
|
13048
|
-
${
|
|
13047
|
+
${_a.map(e=>i`
|
|
13049
13048
|
<nr-option value=${e.value}>${e.label}</nr-option>
|
|
13050
13049
|
`)}
|
|
13051
13050
|
</nr-select>
|
|
@@ -13056,7 +13055,7 @@ return function(e,t){return i`
|
|
|
13056
13055
|
value=${l}
|
|
13057
13056
|
@nr-change=${e=>t("zendeskOperation",e.detail.value)}
|
|
13058
13057
|
>
|
|
13059
|
-
${
|
|
13058
|
+
${Ra.map(e=>i`
|
|
13060
13059
|
<nr-option value=${e.value}>${e.label}</nr-option>
|
|
13061
13060
|
`)}
|
|
13062
13061
|
</nr-select>
|
|
@@ -13107,7 +13106,7 @@ return function(e,t){return i`
|
|
|
13107
13106
|
value=${e.zendeskSortBy||""}
|
|
13108
13107
|
@nr-change=${e=>t("zendeskSortBy",e.detail.value)}
|
|
13109
13108
|
>
|
|
13110
|
-
${
|
|
13109
|
+
${ja.map(e=>i`
|
|
13111
13110
|
<nr-option value=${e.value}>${e.label}</nr-option>
|
|
13112
13111
|
`)}
|
|
13113
13112
|
</nr-select>
|
|
@@ -13118,7 +13117,7 @@ return function(e,t){return i`
|
|
|
13118
13117
|
value=${e.zendeskSortOrder||"asc"}
|
|
13119
13118
|
@nr-change=${e=>t("zendeskSortOrder",e.detail.value)}
|
|
13120
13119
|
>
|
|
13121
|
-
${
|
|
13120
|
+
${Fa.map(e=>i`
|
|
13122
13121
|
<nr-option value=${e.value}>${e.label}</nr-option>
|
|
13123
13122
|
`)}
|
|
13124
13123
|
</nr-select>
|
|
@@ -13154,7 +13153,7 @@ return function(e,t){return i`
|
|
|
13154
13153
|
value=${e.zendeskType||""}
|
|
13155
13154
|
@nr-change=${e=>t("zendeskType",e.detail.value)}
|
|
13156
13155
|
>
|
|
13157
|
-
${
|
|
13156
|
+
${La.map(e=>i`
|
|
13158
13157
|
<nr-option value=${e.value}>${e.label}</nr-option>
|
|
13159
13158
|
`)}
|
|
13160
13159
|
</nr-select>
|
|
@@ -13166,7 +13165,7 @@ return function(e,t){return i`
|
|
|
13166
13165
|
value=${e.zendeskPriority||""}
|
|
13167
13166
|
@nr-change=${e=>t("zendeskPriority",e.detail.value)}
|
|
13168
13167
|
>
|
|
13169
|
-
${
|
|
13168
|
+
${Na.map(e=>i`
|
|
13170
13169
|
<nr-option value=${e.value}>${e.label}</nr-option>
|
|
13171
13170
|
`)}
|
|
13172
13171
|
</nr-select>
|
|
@@ -13177,7 +13176,7 @@ return function(e,t){return i`
|
|
|
13177
13176
|
value=${e.zendeskStatus||""}
|
|
13178
13177
|
@nr-change=${e=>t("zendeskStatus",e.detail.value)}
|
|
13179
13178
|
>
|
|
13180
|
-
${
|
|
13179
|
+
${Da.map(e=>i`
|
|
13181
13180
|
<nr-option value=${e.value}>${e.label}</nr-option>
|
|
13182
13181
|
`)}
|
|
13183
13182
|
</nr-select>
|
|
@@ -13274,7 +13273,7 @@ return function(e,t){return i`
|
|
|
13274
13273
|
value=${e.twilioOperation||"send_sms"}
|
|
13275
13274
|
@nr-change=${e=>t("twilioOperation",e.detail.value)}
|
|
13276
13275
|
>
|
|
13277
|
-
${
|
|
13276
|
+
${Qa.map(e=>i`
|
|
13278
13277
|
<nr-option value=${e.value}>${e.label}</nr-option>
|
|
13279
13278
|
`)}
|
|
13280
13279
|
</nr-select>
|
|
@@ -13282,7 +13281,7 @@ return function(e,t){return i`
|
|
|
13282
13281
|
</div>
|
|
13283
13282
|
</div>
|
|
13284
13283
|
|
|
13285
|
-
${
|
|
13284
|
+
${Za(e,t,n,a)}
|
|
13286
13285
|
|
|
13287
13286
|
${"get_message"===e.twilioOperation?i`
|
|
13288
13287
|
<div class="config-section">
|
|
@@ -13361,7 +13360,7 @@ return function(e,t){return i`
|
|
|
13361
13360
|
</div>
|
|
13362
13361
|
`}
|
|
13363
13362
|
`}(t,a,s,r);case U.TWILIO_VOICE:return function(e,t,n,a){const o=e.twilioTwimlSource||"url";return i`
|
|
13364
|
-
${
|
|
13363
|
+
${Za(e,t,n,a)}
|
|
13365
13364
|
|
|
13366
13365
|
<div class="config-section">
|
|
13367
13366
|
<div class="config-section-header">
|
|
@@ -13431,7 +13430,7 @@ return function(e,t){return i`
|
|
|
13431
13430
|
value=${e.twilioMachineDetection||"none"}
|
|
13432
13431
|
@nr-change=${e=>t("twilioMachineDetection",e.detail.value)}
|
|
13433
13432
|
>
|
|
13434
|
-
${
|
|
13433
|
+
${Xa.map(e=>i`
|
|
13435
13434
|
<nr-option value=${e.value}>${e.label}</nr-option>
|
|
13436
13435
|
`)}
|
|
13437
13436
|
</nr-select>
|
|
@@ -13468,7 +13467,7 @@ return function(e,t){return i`
|
|
|
13468
13467
|
</div>
|
|
13469
13468
|
</div>
|
|
13470
13469
|
`}(t,a,s,r);case U.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`
|
|
13471
|
-
${
|
|
13470
|
+
${Ua(a,o,"TELEGRAM_BOT",e,{activateLabel:"Activate Bot"})}
|
|
13472
13471
|
|
|
13473
13472
|
<div class="config-section">
|
|
13474
13473
|
<div class="config-section-header">
|
|
@@ -13550,7 +13549,7 @@ return function(e,t){return i`
|
|
|
13550
13549
|
</div>
|
|
13551
13550
|
<div class="config-field">
|
|
13552
13551
|
<div class="method-checkboxes">
|
|
13553
|
-
${
|
|
13552
|
+
${Va.map(e=>{const n=c.includes(e.value);return i`
|
|
13554
13553
|
<label class="method-checkbox">
|
|
13555
13554
|
<nr-checkbox
|
|
13556
13555
|
.checked=${n}
|
|
@@ -13588,7 +13587,7 @@ return function(e,t){return i`
|
|
|
13588
13587
|
</div>
|
|
13589
13588
|
</div>
|
|
13590
13589
|
`}(t,a,p,h,s,r);case U.DISCORD_BOT:return function(e,t,n,a,o,s){const r=e.intents||["GUILDS","GUILD_MESSAGES","MESSAGE_CONTENT"],l=e.eventTypes||[],c=(o||[]).filter(e=>e.keyPath.startsWith("discord/"));return i`
|
|
13591
|
-
${
|
|
13590
|
+
${Ua(n,a,"DISCORD_BOT",e,{activateLabel:"Activate Bot"})}
|
|
13592
13591
|
|
|
13593
13592
|
<div class="config-section">
|
|
13594
13593
|
<div class="config-section-header">
|
|
@@ -13619,7 +13618,7 @@ return function(e,t){return i`
|
|
|
13619
13618
|
</div>
|
|
13620
13619
|
<div class="config-field">
|
|
13621
13620
|
<div class="method-checkboxes">
|
|
13622
|
-
${
|
|
13621
|
+
${Ha.map(e=>{const n=r.includes(e.value);return i`
|
|
13623
13622
|
<label class="method-checkbox">
|
|
13624
13623
|
<nr-checkbox
|
|
13625
13624
|
.checked=${n}
|
|
@@ -13639,7 +13638,7 @@ return function(e,t){return i`
|
|
|
13639
13638
|
</div>
|
|
13640
13639
|
<div class="config-field">
|
|
13641
13640
|
<div class="method-checkboxes">
|
|
13642
|
-
${
|
|
13641
|
+
${qa.map(e=>{const n=l.includes(e.value);return i`
|
|
13643
13642
|
<label class="method-checkbox">
|
|
13644
13643
|
<nr-checkbox
|
|
13645
13644
|
.checked=${n}
|
|
@@ -13694,7 +13693,7 @@ return function(e,t){return i`
|
|
|
13694
13693
|
</div>
|
|
13695
13694
|
</div>
|
|
13696
13695
|
`}(t,a,p,h,s,r);case U.WHATSAPP_WEBHOOK:return function(e,t,a,o,s,r){const l=e.webhookFields||["messages"],c=e.messageTypes||[],d=null==a?void 0:a.webhookUrl,p=(s||[]).filter(e=>e.keyPath.startsWith("whatsapp/")),h=e=>{r&&r(e.detail)};return i`
|
|
13697
|
-
${
|
|
13696
|
+
${Ua(a,o,"WHATSAPP_WEBHOOK",e,{activateLabel:"Activate Webhook"})}
|
|
13698
13697
|
|
|
13699
13698
|
<div class="config-section">
|
|
13700
13699
|
<div class="config-section-header">
|
|
@@ -13792,7 +13791,7 @@ return function(e,t){return i`
|
|
|
13792
13791
|
</div>
|
|
13793
13792
|
<div class="config-field">
|
|
13794
13793
|
<div class="method-checkboxes">
|
|
13795
|
-
${
|
|
13794
|
+
${Ga.map(e=>{const n=l.includes(e.value);return i`
|
|
13796
13795
|
<label class="method-checkbox">
|
|
13797
13796
|
<nr-checkbox
|
|
13798
13797
|
.checked=${n}
|
|
@@ -13812,7 +13811,7 @@ return function(e,t){return i`
|
|
|
13812
13811
|
</div>
|
|
13813
13812
|
<div class="config-field">
|
|
13814
13813
|
<div class="method-checkboxes">
|
|
13815
|
-
${
|
|
13814
|
+
${Wa.map(e=>{const n=c.includes(e.value);return i`
|
|
13816
13815
|
<label class="method-checkbox">
|
|
13817
13816
|
<nr-checkbox
|
|
13818
13817
|
.checked=${n}
|
|
@@ -13849,7 +13848,7 @@ return function(e,t){return i`
|
|
|
13849
13848
|
</div>
|
|
13850
13849
|
</div>
|
|
13851
13850
|
`}(t,a,p,h,s,r);case U.SLACK_SOCKET:return function(e,t,n,a,o,s){const r=e.eventTypes||[],l=e.interactionTypes||[],c=(o||[]).filter(e=>e.keyPath.startsWith("slack/")),d=e=>{s&&s(e.detail)};return i`
|
|
13852
|
-
${
|
|
13851
|
+
${Ua(n,a,"SLACK_SOCKET",e,{activateLabel:"Connect"})}
|
|
13853
13852
|
|
|
13854
13853
|
<div class="config-section">
|
|
13855
13854
|
<div class="config-section-header">
|
|
@@ -13889,7 +13888,7 @@ return function(e,t){return i`
|
|
|
13889
13888
|
</div>
|
|
13890
13889
|
<div class="config-field">
|
|
13891
13890
|
<div class="method-checkboxes">
|
|
13892
|
-
${
|
|
13891
|
+
${Ka.map(e=>{const n=r.includes(e.value);return i`
|
|
13893
13892
|
<label class="method-checkbox">
|
|
13894
13893
|
<nr-checkbox
|
|
13895
13894
|
.checked=${n}
|
|
@@ -13910,7 +13909,7 @@ return function(e,t){return i`
|
|
|
13910
13909
|
</div>
|
|
13911
13910
|
<div class="config-field">
|
|
13912
13911
|
<div class="method-checkboxes">
|
|
13913
|
-
${
|
|
13912
|
+
${Ja.map(e=>{const n=l.includes(e.value);return i`
|
|
13914
13913
|
<label class="method-checkbox">
|
|
13915
13914
|
<nr-checkbox
|
|
13916
13915
|
.checked=${n}
|
|
@@ -13986,7 +13985,7 @@ return function(e,t){return i`
|
|
|
13986
13985
|
* Copyright 2024 Nuraly, Laabidi Aymen
|
|
13987
13986
|
* SPDX-License-Identifier: MIT
|
|
13988
13987
|
*/(t,a,p,h,s,r);case U.CUSTOM_WEBSOCKET:return function(e,t,a,o,s,r){var l,c,d;const p=e.authMode||"none",h=e.messageFormat||"json",u=!1!==e.autoReconnect,b=(s||[]).filter(e=>e.keyPath.startsWith("websocket/")),f=e=>{r&&r(e.detail)};return i`
|
|
13989
|
-
${
|
|
13988
|
+
${Ua(a,o,"CUSTOM_WEBSOCKET",e,{activateLabel:"Connect"})}
|
|
13990
13989
|
|
|
13991
13990
|
<div class="config-section">
|
|
13992
13991
|
<div class="config-section-header">
|
|
@@ -14022,7 +14021,7 @@ return function(e,t){return i`
|
|
|
14022
14021
|
<label>Mode</label>
|
|
14023
14022
|
<nr-select
|
|
14024
14023
|
.value=${p}
|
|
14025
|
-
.options=${
|
|
14024
|
+
.options=${To}
|
|
14026
14025
|
@nr-change=${e=>t("authMode",e.detail.value)}
|
|
14027
14026
|
></nr-select>
|
|
14028
14027
|
</div>
|
|
@@ -14178,7 +14177,7 @@ return function(e,t){return i`
|
|
|
14178
14177
|
<label>Message Format</label>
|
|
14179
14178
|
<nr-select
|
|
14180
14179
|
.value=${h}
|
|
14181
|
-
.options=${
|
|
14180
|
+
.options=${Mo}
|
|
14182
14181
|
@nr-change=${e=>t("messageFormat",e.detail.value)}
|
|
14183
14182
|
></nr-select>
|
|
14184
14183
|
</div>
|
|
@@ -14321,7 +14320,7 @@ return function(e,t){return i`
|
|
|
14321
14320
|
</div>
|
|
14322
14321
|
`:i``}
|
|
14323
14322
|
`}(t,a);case U.RABBITMQ_TRIGGER:return function(e,t,n,a,o,s){var r;return i`
|
|
14324
|
-
${
|
|
14323
|
+
${Ua(n,a,"RABBITMQ_TRIGGER",e)}
|
|
14325
14324
|
|
|
14326
14325
|
<div class="config-section">
|
|
14327
14326
|
<div class="config-section-header">
|
|
@@ -14394,7 +14393,7 @@ return function(e,t){return i`
|
|
|
14394
14393
|
<label>Content Type</label>
|
|
14395
14394
|
<nr-select
|
|
14396
14395
|
.value=${e.contentType||"application/json"}
|
|
14397
|
-
.options=${
|
|
14396
|
+
.options=${Ya}
|
|
14398
14397
|
@nr-change=${e=>t("contentType",e.detail.value)}
|
|
14399
14398
|
></nr-select>
|
|
14400
14399
|
<span class="field-description">Expected message content type for deserialization</span>
|
|
@@ -14412,7 +14411,7 @@ return function(e,t){return i`
|
|
|
14412
14411
|
</div>
|
|
14413
14412
|
</div>
|
|
14414
14413
|
`}(t,a,p,h,s,r);case U.KAFKA:return function(e,t,n,a){return i`
|
|
14415
|
-
${
|
|
14414
|
+
${$o(e,t,n,a)}
|
|
14416
14415
|
|
|
14417
14416
|
<div class="config-section">
|
|
14418
14417
|
<div class="config-section-header">
|
|
@@ -14451,7 +14450,7 @@ return function(e,t){return i`
|
|
|
14451
14450
|
<label>Acks</label>
|
|
14452
14451
|
<nr-select
|
|
14453
14452
|
.value=${e.kafkaAcks||"all"}
|
|
14454
|
-
.options=${
|
|
14453
|
+
.options=${mo}
|
|
14455
14454
|
@nr-change=${e=>t("kafkaAcks",e.detail.value)}
|
|
14456
14455
|
></nr-select>
|
|
14457
14456
|
<span class="field-description">Acknowledgment level required from brokers</span>
|
|
@@ -14460,7 +14459,7 @@ return function(e,t){return i`
|
|
|
14460
14459
|
<label>Compression</label>
|
|
14461
14460
|
<nr-select
|
|
14462
14461
|
.value=${e.kafkaCompressionType||"none"}
|
|
14463
|
-
.options=${
|
|
14462
|
+
.options=${xo}
|
|
14464
14463
|
@nr-change=${e=>t("kafkaCompressionType",e.detail.value)}
|
|
14465
14464
|
></nr-select>
|
|
14466
14465
|
<span class="field-description">Compression codec for message batches</span>
|
|
@@ -14482,9 +14481,9 @@ return function(e,t){return i`
|
|
|
14482
14481
|
</div>
|
|
14483
14482
|
</div>
|
|
14484
14483
|
`}(t,a,s,r);case U.KAFKA_TRIGGER:return function(e,t,n,a,o,s){var r,l;return i`
|
|
14485
|
-
${
|
|
14484
|
+
${wo(n,a,"KAFKA_TRIGGER",e)}
|
|
14486
14485
|
|
|
14487
|
-
${
|
|
14486
|
+
${$o(e,t,o,s)}
|
|
14488
14487
|
|
|
14489
14488
|
<div class="config-section">
|
|
14490
14489
|
<div class="config-section-header">
|
|
@@ -14556,7 +14555,7 @@ return function(e,t){return i`
|
|
|
14556
14555
|
</div>
|
|
14557
14556
|
</div>
|
|
14558
14557
|
`}(t,a,p,h,s,r);case U.CRON:return function(e,t,n,a){const o=e.cronExpression||"0 * * * *",s=e.timezone||"UTC";return i`
|
|
14559
|
-
${
|
|
14558
|
+
${Co(n,a,e)}
|
|
14560
14559
|
|
|
14561
14560
|
<div class="config-section">
|
|
14562
14561
|
<div class="config-section-header">
|
|
@@ -14569,7 +14568,7 @@ return function(e,t){return i`
|
|
|
14569
14568
|
<nr-select
|
|
14570
14569
|
.value=${""}
|
|
14571
14570
|
placeholder="Pick a preset..."
|
|
14572
|
-
.options=${
|
|
14571
|
+
.options=${So}
|
|
14573
14572
|
@nr-change=${e=>{e.detail.value&&t("cronExpression",e.detail.value)}}
|
|
14574
14573
|
></nr-select>
|
|
14575
14574
|
<span class="field-description">Select a common schedule or enter a custom expression below</span>
|
|
@@ -14591,14 +14590,14 @@ return function(e,t){return i`
|
|
|
14591
14590
|
<label>Timezone</label>
|
|
14592
14591
|
<nr-select
|
|
14593
14592
|
.value=${s}
|
|
14594
|
-
.options=${
|
|
14593
|
+
.options=${ko}
|
|
14595
14594
|
@nr-change=${e=>t("timezone",e.detail.value)}
|
|
14596
14595
|
></nr-select>
|
|
14597
14596
|
<span class="field-description">Timezone used to interpret the cron expression</span>
|
|
14598
14597
|
</div>
|
|
14599
14598
|
</div>
|
|
14600
|
-
`}(t,a,p,h);case U.GITLAB:return
|
|
14601
|
-
${
|
|
14599
|
+
`}(t,a,p,h);case U.GITLAB:return io(t,a);case U.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`
|
|
14600
|
+
${oo(a,o,e)}
|
|
14602
14601
|
|
|
14603
14602
|
<div class="config-section">
|
|
14604
14603
|
<div class="config-section-header">
|
|
@@ -14618,7 +14617,7 @@ return function(e,t){return i`
|
|
|
14618
14617
|
<label>Transport Type</label>
|
|
14619
14618
|
<nr-select
|
|
14620
14619
|
.value=${l}
|
|
14621
|
-
.options=${
|
|
14620
|
+
.options=${no}
|
|
14622
14621
|
@nr-change=${e=>t("transportType",e.detail.value)}
|
|
14623
14622
|
></nr-select>
|
|
14624
14623
|
<span class="field-description">
|
|
@@ -14636,7 +14635,7 @@ return function(e,t){return i`
|
|
|
14636
14635
|
<label>Auth Type</label>
|
|
14637
14636
|
<nr-select
|
|
14638
14637
|
.value=${c}
|
|
14639
|
-
.options=${
|
|
14638
|
+
.options=${ao}
|
|
14640
14639
|
@nr-change=${e=>t("authType",e.detail.value)}
|
|
14641
14640
|
></nr-select>
|
|
14642
14641
|
</div>
|
|
@@ -14681,7 +14680,7 @@ return function(e,t){return i`
|
|
|
14681
14680
|
</span>
|
|
14682
14681
|
</div>
|
|
14683
14682
|
</div>
|
|
14684
|
-
`}(t,a,p,h,s,r);case U.INFORMATION_EXTRACTOR:return
|
|
14683
|
+
`}(t,a,p,h,s,r);case U.INFORMATION_EXTRACTOR:return so(t,a);case U.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`
|
|
14685
14684
|
<div class="config-section">
|
|
14686
14685
|
<div class="config-section-header">
|
|
14687
14686
|
<span class="config-section-title">Authentication</span>
|
|
@@ -14712,7 +14711,7 @@ return function(e,t){return i`
|
|
|
14712
14711
|
value=${r}
|
|
14713
14712
|
@nr-change=${e=>t("hubspotResource",e.detail.value)}
|
|
14714
14713
|
>
|
|
14715
|
-
${
|
|
14714
|
+
${ro.map(e=>i`
|
|
14716
14715
|
<nr-option value=${e.value}>${e.label}</nr-option>
|
|
14717
14716
|
`)}
|
|
14718
14717
|
</nr-select>
|
|
@@ -14724,7 +14723,7 @@ return function(e,t){return i`
|
|
|
14724
14723
|
value=${l}
|
|
14725
14724
|
@nr-change=${e=>t("hubspotOperation",e.detail.value)}
|
|
14726
14725
|
>
|
|
14727
|
-
${
|
|
14726
|
+
${lo.map(e=>i`
|
|
14728
14727
|
<nr-option value=${e.value}>${e.label}</nr-option>
|
|
14729
14728
|
`)}
|
|
14730
14729
|
</nr-select>
|
|
@@ -14813,7 +14812,7 @@ return function(e,t){return i`
|
|
|
14813
14812
|
style="flex: 1;"
|
|
14814
14813
|
@nr-change=${i=>{const o=[...c];o[n].filters[a]=Object.assign(Object.assign({},e),{operator:i.detail.value}),t("hubspotFilterGroups",o)}}
|
|
14815
14814
|
>
|
|
14816
|
-
${
|
|
14815
|
+
${co.map(e=>i`
|
|
14817
14816
|
<nr-option value=${e.value}>${e.label}</nr-option>
|
|
14818
14817
|
`)}
|
|
14819
14818
|
</nr-select>
|
|
@@ -14876,7 +14875,7 @@ return function(e,t){return i`
|
|
|
14876
14875
|
style="flex: 1;"
|
|
14877
14876
|
@nr-change=${i=>{const a=[...d];a[n]=Object.assign(Object.assign({},e),{toObjectType:i.detail.value}),t("hubspotAssociations",a)}}
|
|
14878
14877
|
>
|
|
14879
|
-
${
|
|
14878
|
+
${ro.map(e=>i`
|
|
14880
14879
|
<nr-option value=${e.value}>${e.label}</nr-option>
|
|
14881
14880
|
`)}
|
|
14882
14881
|
</nr-select>
|
|
@@ -14948,7 +14947,7 @@ return function(e,t){return i`
|
|
|
14948
14947
|
value=${l}
|
|
14949
14948
|
@nr-change=${e=>t("operation",e.detail.value)}
|
|
14950
14949
|
>
|
|
14951
|
-
${
|
|
14950
|
+
${po.map(e=>i`
|
|
14952
14951
|
<nr-option value=${e.value}>${e.label}</nr-option>
|
|
14953
14952
|
`)}
|
|
14954
14953
|
</nr-select>
|
|
@@ -14996,7 +14995,7 @@ return function(e,t){return i`
|
|
|
14996
14995
|
value=${e.issueType||"Task"}
|
|
14997
14996
|
@nr-change=${e=>t("issueType",e.detail.value)}
|
|
14998
14997
|
>
|
|
14999
|
-
${
|
|
14998
|
+
${ho.map(e=>i`
|
|
15000
14999
|
<nr-option value=${e.value}>${e.label}</nr-option>
|
|
15001
15000
|
`)}
|
|
15002
15001
|
</nr-select>
|
|
@@ -15035,7 +15034,7 @@ return function(e,t){return i`
|
|
|
15035
15034
|
value=${e.priority||"Medium"}
|
|
15036
15035
|
@nr-change=${e=>t("priority",e.detail.value)}
|
|
15037
15036
|
>
|
|
15038
|
-
${
|
|
15037
|
+
${uo.map(e=>i`
|
|
15039
15038
|
<nr-option value=${e.value}>${e.label}</nr-option>
|
|
15040
15039
|
`)}
|
|
15041
15040
|
</nr-select>
|
|
@@ -15344,7 +15343,7 @@ return function(e,t){return i`
|
|
|
15344
15343
|
value=${r}
|
|
15345
15344
|
@nr-change=${e=>t("elasticsearchOperation",e.detail.value)}
|
|
15346
15345
|
>
|
|
15347
|
-
${
|
|
15346
|
+
${bo.map(e=>i`
|
|
15348
15347
|
<nr-option value=${e.value}>${e.label}</nr-option>
|
|
15349
15348
|
`)}
|
|
15350
15349
|
</nr-select>
|
|
@@ -15437,7 +15436,7 @@ return function(e,t){return i`
|
|
|
15437
15436
|
value=${e.elasticsearchRefresh||"false"}
|
|
15438
15437
|
@nr-change=${e=>t("elasticsearchRefresh",e.detail.value)}
|
|
15439
15438
|
>
|
|
15440
|
-
${
|
|
15439
|
+
${fo.map(e=>i`
|
|
15441
15440
|
<nr-option value=${e.value}>${e.label}</nr-option>
|
|
15442
15441
|
`)}
|
|
15443
15442
|
</nr-select>
|
|
@@ -15478,7 +15477,7 @@ return function(e,t){return i`
|
|
|
15478
15477
|
</div>
|
|
15479
15478
|
</div>
|
|
15480
15479
|
`}(t,a,s,r);case U.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`
|
|
15481
|
-
${
|
|
15480
|
+
${Ua(n,a,"CALENDLY_TRIGGER",e,{activateLabel:"Activate Trigger"})}
|
|
15482
15481
|
|
|
15483
15482
|
<div class="config-section">
|
|
15484
15483
|
<div class="config-section-header">
|
|
@@ -15506,7 +15505,7 @@ return function(e,t){return i`
|
|
|
15506
15505
|
</div>
|
|
15507
15506
|
<div class="config-field">
|
|
15508
15507
|
<div class="method-checkboxes">
|
|
15509
|
-
${
|
|
15508
|
+
${vo.map(e=>{const n=r.includes(e.value);return i`
|
|
15510
15509
|
<label class="method-checkbox">
|
|
15511
15510
|
<nr-checkbox
|
|
15512
15511
|
.checked=${n}
|
|
@@ -15528,7 +15527,7 @@ return function(e,t){return i`
|
|
|
15528
15527
|
<label>Scope</label>
|
|
15529
15528
|
<nr-select
|
|
15530
15529
|
.value=${e.scope||"user"}
|
|
15531
|
-
.options=${
|
|
15530
|
+
.options=${go}
|
|
15532
15531
|
@nr-change=${e=>t("scope",e.detail.value)}
|
|
15533
15532
|
></nr-select>
|
|
15534
15533
|
</div>
|
|
@@ -15549,7 +15548,7 @@ return function(e,t){return i`
|
|
|
15549
15548
|
<span class="field-description">The event data will be available as this variable in downstream nodes</span>
|
|
15550
15549
|
</div>
|
|
15551
15550
|
</div>
|
|
15552
|
-
`}(t,a,p,h,s,r);case U.UI_TABLE:return
|
|
15551
|
+
`}(t,a,p,h,s,r);case U.UI_TABLE:return Un(t,a,d);case U.NOTE:
|
|
15553
15552
|
/**
|
|
15554
15553
|
* @license
|
|
15555
15554
|
* Copyright 2024 Nuraly, Laabidi Aymen
|
|
@@ -15662,13 +15661,13 @@ return function(e,t){const n=e.noteBackgroundColor||"#fef08a",a=e.noteTextColor|
|
|
|
15662
15661
|
<span class="field-description">Maximum tool call loops before stopping</span>
|
|
15663
15662
|
</div>
|
|
15664
15663
|
</div>
|
|
15665
|
-
`}(t,a);case V.LLM:return function(e,t,a,o){var s,r,l;const c=e.provider||"openai",d=
|
|
15664
|
+
`}(t,a);case V.LLM:return function(e,t,a,o){var s,r,l;const c=e.provider||"openai",d=jo(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`
|
|
15666
15665
|
<div class="config-field">
|
|
15667
15666
|
<label>Provider</label>
|
|
15668
15667
|
<nr-select
|
|
15669
15668
|
.value=${c}
|
|
15670
|
-
.options=${
|
|
15671
|
-
@nr-change=${e=>{const i=e.detail.value,n=
|
|
15669
|
+
.options=${Lo}
|
|
15670
|
+
@nr-change=${e=>{const i=e.detail.value,n=jo(i);t("provider",i),t("model",n.defaultModel),t("maxTokens",n.defaultMaxTokens)}}
|
|
15672
15671
|
></nr-select>
|
|
15673
15672
|
</div>
|
|
15674
15673
|
|
|
@@ -15804,7 +15803,7 @@ return function(e,t){const n=e.noteBackgroundColor||"#fef08a",a=e.noteTextColor|
|
|
|
15804
15803
|
<label>Cutoff Mode</label>
|
|
15805
15804
|
<nr-select
|
|
15806
15805
|
.value=${n}
|
|
15807
|
-
.options=${
|
|
15806
|
+
.options=${Fo}
|
|
15808
15807
|
@nr-change=${e=>t("cutoffMode",e.detail.value)}
|
|
15809
15808
|
></nr-select>
|
|
15810
15809
|
<span class="field-description">How to limit the conversation context window</span>
|
|
@@ -16231,7 +16230,7 @@ return function(e,t){const n=e.noteBackgroundColor||"#fef08a",a=e.noteTextColor|
|
|
|
16231
16230
|
<span class="field-description">Type of index algorithm</span>
|
|
16232
16231
|
</div>
|
|
16233
16232
|
</div>
|
|
16234
|
-
`}(t,a);case H.RELATIONSHIP:return
|
|
16233
|
+
`}(t,a);case H.RELATIONSHIP:return Vn(t,a,u,b);case H.CONSTRAINT:return function(e,t){const a=e.constraintColumns||[],o=e.constraintType||"UNIQUE";return i`
|
|
16235
16234
|
<!-- Constraint Name Section -->
|
|
16236
16235
|
<div class="config-section">
|
|
16237
16236
|
<div class="config-field">
|
|
@@ -16387,7 +16386,7 @@ return function(e,t){const n=e.noteBackgroundColor||"#fef08a",a=e.noteTextColor|
|
|
|
16387
16386
|
</button>
|
|
16388
16387
|
</div>
|
|
16389
16388
|
</div>
|
|
16390
|
-
`}(t,a);case q.MERMAID:return
|
|
16389
|
+
`}(t,a);case q.MERMAID:return ls(t,a);case q.ANCHOR:return function(e,t){const n=e.anchorLabel||"Anchor";return i`
|
|
16391
16390
|
<div class="config-section">
|
|
16392
16391
|
<div class="config-section-header">
|
|
16393
16392
|
<span class="config-section-title">Anchor Settings</span>
|
|
@@ -16490,7 +16489,7 @@ return function(e,t){const a="string"==typeof e.workflowId?e.workflowId:"",o="st
|
|
|
16490
16489
|
* @license
|
|
16491
16490
|
* Copyright 2024 Nuraly, Laabidi Aymen
|
|
16492
16491
|
* SPDX-License-Identifier: MIT
|
|
16493
|
-
*/
|
|
16492
|
+
*/ps.styles=e`
|
|
16494
16493
|
:host {
|
|
16495
16494
|
display: block;
|
|
16496
16495
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
|
|
@@ -16551,13 +16550,13 @@ return function(e,t){const a="string"==typeof e.workflowId?e.workflowId:"",o="st
|
|
|
16551
16550
|
color: #161616;
|
|
16552
16551
|
border-color: #7c3aed;
|
|
16553
16552
|
}
|
|
16554
|
-
`,
|
|
16553
|
+
`,cs([s({type:String})],ps.prototype,"selectedWorkflowId",void 0),cs([r()],ps.prototype,"_workflows",void 0),cs([r()],ps.prototype,"_loading",void 0),cs([r()],ps.prototype,"_error",void 0),ps=cs([l("wb-workflow-selector")],ps);
|
|
16555
16554
|
/**
|
|
16556
16555
|
* @license
|
|
16557
16556
|
* Copyright 2024 Nuraly, Laabidi Aymen
|
|
16558
16557
|
* SPDX-License-Identifier: MIT
|
|
16559
16558
|
*/
|
|
16560
|
-
const
|
|
16559
|
+
const us={[U.LOOP]:{title:"How the Loop node works",description:'Iterates over the array resolved from "arrayExpression" and runs the item-port subgraph once per element. Each iteration binds the current value to ${variables.<iteratorVariable>} and its position to ${variables.<iteratorVariable>_index}. Wire downstream nodes to the "item" port to run them per element, and to the "done" port for whatever should run after the loop finishes. A Break node anywhere in the item subgraph short-circuits the remaining iterations.'}};function bs(e){const{node:t,position:a,callbacks:o,workflowId:s,workflow:r,dynamicVariables:l,loadingVariables:c,nodeExecution:p,executionId:h,kvEntries:u,onCreateKvEntry:b,applicationId:f,databaseProvider:v,triggerInfo:g,triggerActions:m}=e;if(!t||!a)return n;const x=Z.find(e=>e.type===t.type),y=(w=t.type,us[w]);var w;
|
|
16561
16560
|
/**
|
|
16562
16561
|
* @license
|
|
16563
16562
|
* Copyright 2024 Nuraly, Laabidi Aymen
|
|
@@ -16623,7 +16622,7 @@ function(e,t){var n;return i`
|
|
|
16623
16622
|
></nr-input>
|
|
16624
16623
|
</div>
|
|
16625
16624
|
`}(t,o)}
|
|
16626
|
-
${
|
|
16625
|
+
${hs(t.type,t.configuration,o.onUpdateConfig,s,u,b,f,v,p,g,m,r,t.id,o.onRunWorkflow)}
|
|
16627
16626
|
${oe(t.type)&&t.type!==q.ANCHOR?function(e,t,a){const o=e.onClickAction||"none",s=e.onClickTargetAnchorId||"",r=a.filter(e=>e.type===q.ANCHOR);return i`
|
|
16628
16627
|
<div class="config-section">
|
|
16629
16628
|
<div class="config-section-header">
|
|
@@ -16726,7 +16725,7 @@ function(e,t){var n;return i`
|
|
|
16726
16725
|
`:n}
|
|
16727
16726
|
</div>
|
|
16728
16727
|
`}(p,h,t.id,o,t.type)}
|
|
16729
|
-
${function(e,t,a,o){if(!e)return n;let s;s=a&&a.length>0?a:
|
|
16728
|
+
${function(e,t,a,o){if(!e)return n;let s;s=a&&a.length>0?a:Hi(e,t.id).map(e=>Object.assign(Object.assign({},e),{isDynamic:!1}));if(0===s.length&&!o)return n;const r=s.reduce((e,t)=>(e[t.nodeName]||(e[t.nodeName]=[]),e[t.nodeName].push(t),e),{});return i`
|
|
16730
16729
|
<div class="config-section variables-section">
|
|
16731
16730
|
<div class="config-section-header">
|
|
16732
16731
|
<span class="config-section-title">
|
|
@@ -16766,7 +16765,7 @@ function(e,t){var n;return i`
|
|
|
16766
16765
|
* @license
|
|
16767
16766
|
* Copyright 2024 Nuraly, Laabidi Aymen
|
|
16768
16767
|
* SPDX-License-Identifier: MIT
|
|
16769
|
-
*/function
|
|
16768
|
+
*/function fs(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 vs(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 gs(e,t,i,a,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=fs(l,t),p=fs(c,t);if(d&&p&&d.id===p.id)return n;let h,u;h=d?vs(d,!1,0,1):r.getPortPosition(l,e.sourcePortId,!1),u=p?vs(p,!0,0,1):r.getPortPosition(c,e.targetPortId,!0);const b=u.x-h.x,f=Math.min(.5*Math.abs(b),100),v=`M ${h.x} ${h.y} C ${h.x+f} ${h.y}, ${u.x-f} ${u.y}, ${u.x} ${u.y}`,g=i.has(e.id),m=a===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"}(g,m,x,s),w=g||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 o`
|
|
16770
16769
|
<g class="edge-group" data-edge-id=${e.id}>
|
|
16771
16770
|
<!-- Invisible wider path for easier clicking -->
|
|
16772
16771
|
<path
|
|
@@ -16802,27 +16801,27 @@ function(e,t){var n;return i`
|
|
|
16802
16801
|
>${e.label}</text>
|
|
16803
16802
|
`:n}
|
|
16804
16803
|
</g>
|
|
16805
|
-
`}function
|
|
16806
|
-
${t.map(e=>
|
|
16804
|
+
`}function ms(e){const{edges:t,nodes:i,selectedEdgeIds:a,hoveredEdgeId:s,connectionState:r,currentTheme:l,callbacks:c}=e;return o`
|
|
16805
|
+
${t.map(e=>gs(e,i,a,s,l,c))}
|
|
16807
16806
|
${function(e,t,i){if(!e)return n;const a=t.find(t=>t.id===e.sourceNodeId);if(!a)return n;const s=i(a,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 o`<path class="connection-line" d=${p} stroke="#3b82f6" stroke-width="2" stroke-dasharray="5" fill="none" />`}(r,i,c.getPortPosition)}
|
|
16808
16807
|
`}
|
|
16809
16808
|
/**
|
|
16810
16809
|
* @license
|
|
16811
16810
|
* Copyright 2024 Nuraly, Laabidi Aymen
|
|
16812
16811
|
* SPDX-License-Identifier: MIT
|
|
16813
|
-
*/const
|
|
16812
|
+
*/const xs=[{type:q.SHAPE_RECTANGLE,icon:"square",label:"Rectangle"},{type:q.SHAPE_CIRCLE,icon:"circle",label:"Circle"},{type:q.SHAPE_DIAMOND,icon:"diamond",label:"Diamond"},{type:q.SHAPE_TRIANGLE,icon:"triangle",label:"Triangle"},{type:q.SHAPE_ARROW,icon:"arrow-right",label:"Arrow"},{type:q.SHAPE_LINE,icon:"minus",label:"Line"},{type:q.SHAPE_STAR,icon:"star",label:"Star"},{type:q.SHAPE_HEXAGON,icon:"hexagon",label:"Hexagon"}];
|
|
16814
16813
|
/**
|
|
16815
16814
|
* @license
|
|
16816
16815
|
* Copyright 2024 Nuraly, Laabidi Aymen
|
|
16817
16816
|
* SPDX-License-Identifier: MIT
|
|
16818
16817
|
*/
|
|
16819
|
-
function
|
|
16818
|
+
function ys(e){e.stopPropagation()}
|
|
16820
16819
|
/**
|
|
16821
16820
|
* @license
|
|
16822
16821
|
* Copyright 2024 Nuraly, Laabidi Aymen
|
|
16823
16822
|
* SPDX-License-Identifier: MIT
|
|
16824
16823
|
*/
|
|
16825
|
-
const
|
|
16824
|
+
const ws=400,$s=300,ks="rgba(99, 102, 241, 0.05)",Ss="rgba(99, 102, 241, 0.3)",Cs="Group",Ts="top-left",Ms="outside",Es=180,As=80,zs=200,Is=100,Os=200,Ps=100,_s=50,Rs=320,Ns=200,Ds=200,Ls=120,js=400,Fs=200,Bs=1e4,Us=["TELEGRAM_BOT","SLACK_SOCKET","DISCORD_BOT","WHATSAPP_WEBHOOK","CUSTOM_WEBSOCKET","RABBITMQ_TRIGGER","CALENDLY_TRIGGER","KAFKA_TRIGGER","CRON"],Vs=["#fef08a","#bbf7d0","#bfdbfe","#fecaca","#e9d5ff","#fed7aa","#ffffff","#f3f4f6"],Hs=["#8b5cf6","#3b82f6","#ef4444","#22c55e","#f59e0b","#6b7280","#1a1a1a","#e5e7eb"],qs=["#1a1a1a","#374151","#713f12","#1e3a5f","#7f1d1d","#4c1d95","#ffffff"],Gs=[{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"}],Ws=[{value:"default",label:"Default"},{value:"dark",label:"Dark"},{value:"forest",label:"Forest"},{value:"neutral",label:"Neutral"},{value:"base",label:"Base"}];function Ks(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,c=s.frameBackgroundColor||ks,p=s.frameBorderColor||Ss,h=s.frameLabel||Cs,u=s.frameLabelPosition||Ts,b=s.frameLabelPlacement||Ms,f=!1!==s.frameShowLabel,v={left:`${t.position.x}px`,top:`${t.position.y}px`,width:`${r}px`,height:`${l}px`,backgroundColor:c,borderColor:p};return i`
|
|
16826
16825
|
<div
|
|
16827
16826
|
class="frame-node ${n?"selected":""}"
|
|
16828
16827
|
style=${d(v)}
|
|
@@ -16869,7 +16868,7 @@ function(e,t,n,a,o,s){const r=n===e.id?i`
|
|
|
16869
16868
|
* @license
|
|
16870
16869
|
* Copyright 2024 Nuraly, Laabidi Aymen
|
|
16871
16870
|
* SPDX-License-Identifier: MIT
|
|
16872
|
-
*/function
|
|
16871
|
+
*/function Js(e){const{node:t,nodeScreenPosition:a,viewportZoom:o,activeColorPicker:s,shadowRoot:r,hostBoundingRect:l,callbacks:c}=e,p=t.configuration||{},h=function(e){return e.type===q.STICKY_NOTE||e.type===q.TEXT_BLOCK||e.type===q.VOTING}(t),u=function(e){return e.type!==q.DRAWING&&e.type!==q.SHAPE_LINE&&e.type!==q.SHAPE_ARROW&&e.type!==q.ANCHOR&&e.type!==q.WORKFLOW&&e.type!==q.DATABASE}(t),b=function(e){return e.type===q.MERMAID||e.type===q.SHAPE_RECTANGLE||e.type===q.IMAGE||e.type===q.FRAME||e.type===q.WORKFLOW||e.type===q.DATABASE}(t),f=(p.width||200)*o,v={left:`${a.x+f/2}px`,top:a.y-52+"px"};return i`
|
|
16873
16872
|
<div class="wb-floating-toolbar" style=${d(v)} @mousedown=${e=>e.stopPropagation()}>
|
|
16874
16873
|
${u?i`
|
|
16875
16874
|
<div class="wb-toolbar-group">
|
|
@@ -16927,7 +16926,7 @@ function(e,t,n,a,o,s){const r=n===e.id?i`
|
|
|
16927
16926
|
<label class="wb-toolbar-label">Font</label>
|
|
16928
16927
|
<nr-select
|
|
16929
16928
|
size="small"
|
|
16930
|
-
.options=${[...
|
|
16929
|
+
.options=${[...Gs]}
|
|
16931
16930
|
.value=${p.fontFamily||"Inter, sans-serif"}
|
|
16932
16931
|
placeholder="Font"
|
|
16933
16932
|
style="width: 130px;"
|
|
@@ -16942,7 +16941,7 @@ function(e,t,n,a,o,s){const r=n===e.id?i`
|
|
|
16942
16941
|
<label class="wb-toolbar-label">Theme</label>
|
|
16943
16942
|
<nr-select
|
|
16944
16943
|
size="small"
|
|
16945
|
-
.options=${[...
|
|
16944
|
+
.options=${[...Ws]}
|
|
16946
16945
|
.value=${p.mermaidTheme||"default"}
|
|
16947
16946
|
placeholder="Theme"
|
|
16948
16947
|
style="width: 110px;"
|
|
@@ -16958,7 +16957,7 @@ function(e,t,n,a,o,s){const r=n===e.id?i`
|
|
|
16958
16957
|
</button>
|
|
16959
16958
|
</div>
|
|
16960
16959
|
</div>
|
|
16961
|
-
${(()=>{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:
|
|
16960
|
+
${(()=>{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:Vs,configKey:"backgroundColor"}:"border"===e?{currentColor:t.borderColor||"#8b5cf6",presets:Hs,configKey:"borderColor"}:{currentColor:t.textColor||"#1a1a1a",presets:qs,configKey:"textColor"}}(s,p);return i`
|
|
16962
16961
|
<div class="wb-color-picker-panel" style=${d(o)} @mousedown=${e=>e.stopPropagation()}>
|
|
16963
16962
|
<div class="wb-picker-presets">
|
|
16964
16963
|
${u.map(e=>i`
|
|
@@ -16993,7 +16992,7 @@ function(e,t,n,a,o,s){const r=n===e.id?i`
|
|
|
16993
16992
|
* @license
|
|
16994
16993
|
* Copyright 2024 Nuraly, Laabidi Aymen
|
|
16995
16994
|
* SPDX-License-Identifier: MIT
|
|
16996
|
-
*/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},Ys=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 Qs extends($e(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.userId="",this.namespace="",this.viewport={zoom:1,panX:0,panY:0},this.mode=Y.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===Y.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 Si(e),this.selectionController=new Ci(e),this.connectionController=new Ti(e),this.configController=new Ai(e),this.marqueeController=new zi(this),this.clipboardController=new Oi(this),this.undoController=new Pi(e),this.frameController=new _i(e),this.keyboardController=new Mi(e,this.selectionController),this.keyboardController.setClipboardController(this.clipboardController),this.keyboardController.setUndoController(this.undoController),this.dragController=new Ei(e,this.viewportController),new Di(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 Ri(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=>pe(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||pe(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 Ys(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.namespace&&this.userId&&this.collaborationController.connect(this.canvasId,this.namespace,this.userId),this.onConnected()})}disconnectedCallback(){super.disconnectedCallback(),globalThis.removeEventListener("mouseup",this.handleGlobalMouseUp),globalThis.removeEventListener("mousemove",this.handleGlobalMouseMove),this.onDisconnected()}willUpdate(e){if(super.willUpdate(e),(e.has("collaborative")||e.has("canvasId")||e.has("namespace")||e.has("userId"))&&(console.log("[collab] willUpdate collab props",{collaborative:this.collaborative,canvasId:this.canvasId,namespace:this.namespace,userId:this.userId,changed:{collaborative:e.has("collaborative"),canvasId:e.has("canvasId"),namespace:e.has("namespace"),userId:e.has("userId")}}),this.collaborative&&this.canvasId&&this.namespace&&this.userId&&this.collaborationController.connect(this.canvasId,this.namespace,this.userId)),this.collaborative&&e.has("selectedNodeIds")&&this.collaborationController.broadcastSelectionChange(Array.from(this.selectedNodeIds)),this.collaborative&&e.has("configuredNode")){const t=e.get("configuredNode");let i=this.configuredNode;console.log("[collab] configuredNode change",{prevId:null==t?void 0:t.id,nextId:null==i?void 0:i.id}),i&&this.collaborationController.getRemoteLock(i.id)&&(this.configuredNode=null!=t?t:null,i=this.configuredNode),!t||i&&t.id===i.id||this.collaborationController.releaseLock(t.id),!i||t&&t.id===i.id||this.collaborationController.acquireLock(i.id)}}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=re(e,t||{x:(400-this.viewport.panX)/this.viewport.zoom,y:(200-this.viewport.panY)/this.viewport.zoom});i&&(this.undoController.recordNodeAdded(i),pe(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=>pe(e.type))}getVisibleNonFrameNodes(){return this.getNodesForRendering().filter(e=>{var t;return!pe(e.type)&&!(null===(t=e.metadata)||void 0===t?void 0:t._hiddenByFrame)})}renderExpandedFrame(e){return Ws({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()||Ss;this.saveFrameLabel(t,i),this.editingFrameLabelId=null}handleFrameLabelKeydown(e,t){if("Enter"===e.key){e.preventDefault();const i=e.target.value.trim()||Ss;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 $i)}toggleChatbotPanel(){this.showChatbotPanel=!this.showChatbotPanel,this.showChatbotPanel&&(this.initCanvasChatbotController(),this.chatbotUnreadCount=0)}renderEdges(){return gs({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`
|
|
16995
|
+
*/var Ys=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},Qs=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 Xs extends($e(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.userId="",this.namespace="",this.viewport={zoom:1,panX:0,panY:0},this.mode=Y.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===Y.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 Ci(e),this.selectionController=new Ti(e),this.connectionController=new Mi(e),this.configController=new zi(e),this.marqueeController=new Ii(this),this.clipboardController=new Pi(this),this.undoController=new _i(e),this.frameController=new Ri(e),this.keyboardController=new Ei(e,this.selectionController),this.keyboardController.setClipboardController(this.clipboardController),this.keyboardController.setUndoController(this.undoController),this.dragController=new Ai(e,this.viewportController),new Li(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 Ni(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=>pe(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||pe(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 Qs(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.namespace&&this.userId&&this.collaborationController.connect(this.canvasId,this.namespace,this.userId),this.onConnected()})}disconnectedCallback(){super.disconnectedCallback(),globalThis.removeEventListener("mouseup",this.handleGlobalMouseUp),globalThis.removeEventListener("mousemove",this.handleGlobalMouseMove),this.onDisconnected()}willUpdate(e){if(super.willUpdate(e),(e.has("collaborative")||e.has("canvasId")||e.has("namespace")||e.has("userId"))&&(console.log("[collab] willUpdate collab props",{collaborative:this.collaborative,canvasId:this.canvasId,namespace:this.namespace,userId:this.userId,changed:{collaborative:e.has("collaborative"),canvasId:e.has("canvasId"),namespace:e.has("namespace"),userId:e.has("userId")}}),this.collaborative&&this.canvasId&&this.namespace&&this.userId&&this.collaborationController.connect(this.canvasId,this.namespace,this.userId)),this.collaborative&&e.has("selectedNodeIds")&&this.collaborationController.broadcastSelectionChange(Array.from(this.selectedNodeIds)),this.collaborative&&e.has("configuredNode")){const t=e.get("configuredNode");let i=this.configuredNode;console.log("[collab] configuredNode change",{prevId:null==t?void 0:t.id,nextId:null==i?void 0:i.id}),i&&this.collaborationController.getRemoteLock(i.id)&&(this.configuredNode=null!=t?t:null,i=this.configuredNode),!t||i&&t.id===i.id||this.collaborationController.releaseLock(t.id),!i||t&&t.id===i.id||this.collaborationController.acquireLock(i.id)}}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=re(e,t||{x:(400-this.viewport.panX)/this.viewport.zoom,y:(200-this.viewport.panY)/this.viewport.zoom});i&&(this.undoController.recordNodeAdded(i),pe(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=>pe(e.type))}getVisibleNonFrameNodes(){return this.getNodesForRendering().filter(e=>{var t;return!pe(e.type)&&!(null===(t=e.metadata)||void 0===t?void 0:t._hiddenByFrame)})}renderExpandedFrame(e){return Ks({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()||Cs;this.saveFrameLabel(t,i),this.editingFrameLabelId=null}handleFrameLabelKeydown(e,t){if("Enter"===e.key){e.preventDefault();const i=e.target.value.trim()||Cs;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 ki)}toggleChatbotPanel(){this.showChatbotPanel=!this.showChatbotPanel,this.showChatbotPanel&&(this.initCanvasChatbotController(),this.chatbotUnreadCount=0)}renderEdges(){return ms({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`
|
|
16997
16996
|
<div class="canvas-toolbar">
|
|
16998
16997
|
<button
|
|
16999
16998
|
class="toolbar-btn"
|
|
@@ -17050,7 +17049,7 @@ function(e,t,n,a,o,s){const r=n===e.id?i`
|
|
|
17050
17049
|
>
|
|
17051
17050
|
<nr-icon name="trash-2" size="small"></nr-icon>
|
|
17052
17051
|
</button>
|
|
17053
|
-
${
|
|
17052
|
+
${ji(e)}
|
|
17054
17053
|
</div>
|
|
17055
17054
|
`:n;var e}renderZoomControls(){return this.showZoomControls?(e={zoomPercentage:this.viewportController.getZoomPercentage(),onZoomIn:()=>this.viewportController.zoomIn(),onZoomOut:()=>this.viewportController.zoomOut()},i`
|
|
17056
17055
|
<div class="zoom-controls">
|
|
@@ -17218,12 +17217,12 @@ function(e){const{cursors:t,viewport:a,localUserId:o}=e,s=t.filter(e=>e.userId!=
|
|
|
17218
17217
|
${a?`${t.length} online`:"Reconnecting..."}
|
|
17219
17218
|
</span>
|
|
17220
17219
|
</div>
|
|
17221
|
-
`}({users:this.collaborationController.getUsers(),connected:this.collaborationController.isConnected(),onUserClick:e=>this.handlePanToUser(e)}):n}renderConfigPanel(){return
|
|
17220
|
+
`}({users:this.collaborationController.getUsers(),connected:this.collaborationController.isConnected(),onUserClick:e=>this.handlePanToUser(e)}):n}renderConfigPanel(){return bs({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`
|
|
17222
17221
|
<div class="chatbot-panel"
|
|
17223
17222
|
data-theme=${e.currentTheme}
|
|
17224
|
-
@mousedown=${
|
|
17225
|
-
@touchstart=${
|
|
17226
|
-
@pointerdown=${
|
|
17223
|
+
@mousedown=${ys}
|
|
17224
|
+
@touchstart=${ys}
|
|
17225
|
+
@pointerdown=${ys}
|
|
17227
17226
|
>
|
|
17228
17227
|
<div class="chatbot-panel-header">
|
|
17229
17228
|
<span class="chatbot-panel-title">
|
|
@@ -17246,7 +17245,7 @@ function(e){const{cursors:t,viewport:a,localUserId:o}=e,s=t.filter(e=>e.userId!=
|
|
|
17246
17245
|
></nr-chatbot>
|
|
17247
17246
|
</div>
|
|
17248
17247
|
</div>
|
|
17249
|
-
`:n;var e,t}}
|
|
17248
|
+
`:n;var e,t}}Xs.useShadowDom=!0,Ys([s({type:Object})],Xs.prototype,"workflow",null),Ys([s({type:Boolean})],Xs.prototype,"readonly",void 0),Ys([s({type:Boolean})],Xs.prototype,"disabled",void 0),Ys([s({type:Boolean})],Xs.prototype,"showMinimap",void 0),Ys([s({type:Boolean})],Xs.prototype,"showToolbar",void 0),Ys([s({type:Boolean})],Xs.prototype,"showZoomControls",void 0),Ys([s({type:Boolean})],Xs.prototype,"showPalette",void 0),Ys([s({type:String,attribute:"canvas-id"})],Xs.prototype,"canvasId",void 0),Ys([s({type:Boolean,attribute:"collaborative"})],Xs.prototype,"collaborative",void 0),Ys([s({type:String,attribute:"user-id"})],Xs.prototype,"userId",void 0),Ys([s({type:String,attribute:"namespace"})],Xs.prototype,"namespace",void 0),Ys([s({attribute:!1})],Xs.prototype,"undoProvider",null),Ys([r()],Xs.prototype,"viewport",void 0),Ys([r()],Xs.prototype,"mode",void 0),Ys([r()],Xs.prototype,"selectedNodeIds",void 0),Ys([r()],Xs.prototype,"selectedEdgeIds",void 0),Ys([r()],Xs.prototype,"connectionState",void 0),Ys([r()],Xs.prototype,"dragState",void 0),Ys([r()],Xs.prototype,"contextMenu",void 0),Ys([r()],Xs.prototype,"isPanning",void 0),Ys([r()],Xs.prototype,"panStart",void 0),Ys([r()],Xs.prototype,"hoveredEdgeId",void 0),Ys([r()],Xs.prototype,"marqueeState",void 0),Ys([r()],Xs.prototype,"lastMousePosition",void 0),Ys([r()],Xs.prototype,"editingFrameLabelId",void 0),Ys([r()],Xs.prototype,"editingNoteId",void 0),Ys([r()],Xs.prototype,"configuredNode",void 0),Ys([r()],Xs.prototype,"insertPanelNode",void 0),Ys([r()],Xs.prototype,"expandedCategories",void 0),Ys([r()],Xs.prototype,"showChatbotPanel",void 0),Ys([r()],Xs.prototype,"chatbotUnreadCount",void 0),Ys([c(".canvas-wrapper")],Xs.prototype,"canvasWrapper",void 0),Ys([c(".canvas-viewport")],Xs.prototype,"canvasViewport",void 0),Ys([c(".config-panel")],Xs.prototype,"configPanel",void 0),Ys([c(".insert-panel")],Xs.prototype,"insertPanel",void 0),Ys([s({attribute:!1})],Xs.prototype,"insertPanelColumns",void 0),Ys([s({type:String})],Xs.prototype,"insertPanelSchemaName",void 0);const Zs=e`
|
|
17250
17249
|
:host {
|
|
17251
17250
|
display: block;
|
|
17252
17251
|
position: absolute;
|
|
@@ -18292,7 +18291,7 @@ function(e){const{cursors:t,viewport:a,localUserId:o}=e,s=t.filter(e=>e.userId!=
|
|
|
18292
18291
|
outline: 2px dashed var(--remote-selection-color, #3b82f6);
|
|
18293
18292
|
outline-offset: 4px;
|
|
18294
18293
|
}
|
|
18295
|
-
`,
|
|
18294
|
+
`,er=e`
|
|
18296
18295
|
:host {
|
|
18297
18296
|
display: inline-block;
|
|
18298
18297
|
vertical-align: middle;
|
|
@@ -18647,33 +18646,33 @@ function(e){const{cursors:t,viewport:a,localUserId:o}=e,s=t.filter(e=>e.userId!=
|
|
|
18647
18646
|
:host([type="default"]) .ripple { background: rgba(0, 0, 0, 0.06); }
|
|
18648
18647
|
:host([type="ghost"]) .ripple { background: rgba(124, 58, 237, 0.15); }
|
|
18649
18648
|
:host([type="danger"]) .ripple { background: rgba(255, 255, 255, 0.3); }
|
|
18650
|
-
`,er
|
|
18649
|
+
`,tr=er,ir="";
|
|
18651
18650
|
/**
|
|
18652
18651
|
* @license
|
|
18653
18652
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
18654
18653
|
* SPDX-License-Identifier: MIT
|
|
18655
18654
|
*/
|
|
18656
|
-
class
|
|
18655
|
+
class nr extends Ve{}
|
|
18657
18656
|
/**
|
|
18658
18657
|
* @license
|
|
18659
18658
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
18660
18659
|
* SPDX-License-Identifier: MIT
|
|
18661
|
-
*/class
|
|
18660
|
+
*/class ar extends nr{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")}}}
|
|
18662
18661
|
/**
|
|
18663
18662
|
* @license
|
|
18664
18663
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
18665
18664
|
* SPDX-License-Identifier: MIT
|
|
18666
|
-
*/class
|
|
18665
|
+
*/class or extends nr{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)}}
|
|
18667
18666
|
/**
|
|
18668
18667
|
* @license
|
|
18669
18668
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
18670
18669
|
* SPDX-License-Identifier: MIT
|
|
18671
|
-
*/class
|
|
18670
|
+
*/class sr extends nr{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")}}}
|
|
18672
18671
|
/**
|
|
18673
18672
|
* @license
|
|
18674
18673
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
18675
18674
|
* SPDX-License-Identifier: MIT
|
|
18676
|
-
*/var
|
|
18675
|
+
*/var rr=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($e(t)){constructor(){super(...arguments),this.disabled=!1,this.loading=!1,this.size=ir,this.type="default",this.shape="default",this.block=!1,this.dashed=!1,this.icon=[],this.iconPosition="left",this.href=ir,this.target=ir,this.ripple=!0,this.buttonAriaLabel=ir,this.ariaDescribedBy=ir,this.htmlType=ir,this.requiredComponents=["nr-icon"],this.rippleController=new ar(this),this.keyboardController=new or(this),this.linkController=new sr(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
|
|
18677
18676
|
name=${a}
|
|
18678
18677
|
type=${o}
|
|
18679
18678
|
alt=${l||""}
|
|
@@ -18729,13 +18728,13 @@ class ir extends Ve{}
|
|
|
18729
18728
|
>
|
|
18730
18729
|
${l}
|
|
18731
18730
|
</button>
|
|
18732
|
-
`}};
|
|
18731
|
+
`}};lr.styles=tr,lr.useShadowDom=!0,rr([s({type:Boolean})],lr.prototype,"disabled",void 0),rr([s({type:Boolean})],lr.prototype,"loading",void 0),rr([s({type:String})],lr.prototype,"size",void 0),rr([s({type:String,reflect:!0})],lr.prototype,"type",void 0),rr([s({type:String})],lr.prototype,"shape",void 0),rr([s({type:Boolean})],lr.prototype,"block",void 0),rr([s({type:Boolean})],lr.prototype,"dashed",void 0),rr([s({type:Array})],lr.prototype,"icon",void 0),rr([s({type:Object})],lr.prototype,"iconLeft",void 0),rr([s({type:Object})],lr.prototype,"iconRight",void 0),rr([s({type:Object})],lr.prototype,"icons",void 0),rr([s({reflect:!0})],lr.prototype,"iconPosition",void 0),rr([s({type:String})],lr.prototype,"href",void 0),rr([s({type:String})],lr.prototype,"target",void 0),rr([s({type:Boolean})],lr.prototype,"ripple",void 0),rr([s({type:String})],lr.prototype,"buttonAriaLabel",void 0),rr([s({type:String})],lr.prototype,"ariaDescribedBy",void 0),rr([s({type:String})],lr.prototype,"htmlType",void 0),lr=rr([l("nr-button")],lr);
|
|
18733
18732
|
/**
|
|
18734
18733
|
* @license
|
|
18735
18734
|
* Copyright 2024 Nuraly, Laabidi Aymen
|
|
18736
18735
|
* SPDX-License-Identifier: MIT
|
|
18737
18736
|
*/
|
|
18738
|
-
var
|
|
18737
|
+
var cr=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 dr=class extends($e(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)||Q[this.node.type]||"#3b82f6"}getNodeIcon(){var e;return(null===(e=this.node.metadata)||void 0===e?void 0:e.icon)||X[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===U.CHATBOT||this.node.type===U.CHAT_START}hasPreviewPanel(){return this.isChatbotNode()||this.node.type===U.HTTP_START}isStartNode(){return this.node.type===U.START}isDbTableNode(){return this.node.type===H.TABLE}isUiTableNode(){return this.node.type===U.UI_TABLE}isNoteNode(){return he(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,c={"node-container":!0,"note-node":!0,selected:this.selected,dragging:this.dragging,editing:this.editing},p={"--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`
|
|
18739
18738
|
<div
|
|
18740
18739
|
class=${h(c)}
|
|
18741
18740
|
style=${d(p)}
|
|
@@ -19007,13 +19006,13 @@ var lr=function(e,t,i,n){for(var a,o=arguments.length,s=o<3?t:null===n?n=Object.
|
|
|
19007
19006
|
${null===(a=this.node.ports.configs)||void 0===a?void 0:a.map((e,t)=>this.renderConfigPort(e,t,this.node.ports.configs.length))}
|
|
19008
19007
|
</div>
|
|
19009
19008
|
</div>
|
|
19010
|
-
`;return this.wrapWithRemoteOverlays(f)}};
|
|
19009
|
+
`;return this.wrapWithRemoteOverlays(f)}};dr.useShadowDom=!0,dr.styles=[Zs,er],cr([s({type:Object})],dr.prototype,"node",void 0),cr([s({type:Boolean})],dr.prototype,"selected",void 0),cr([s({type:Boolean})],dr.prototype,"dragging",void 0),cr([s({type:String})],dr.prototype,"connectingPortId",void 0),cr([s({type:Boolean})],dr.prototype,"editing",void 0),cr([s({type:Object})],dr.prototype,"remoteSelection",void 0),cr([s({type:Object})],dr.prototype,"remoteTyping",void 0),cr([r()],dr.prototype,"hoveredPort",void 0),dr=cr([l("workflow-node")],dr);
|
|
19011
19010
|
/**
|
|
19012
19011
|
* @license
|
|
19013
19012
|
* Copyright 2024 Nuraly, Laabidi Aymen
|
|
19014
19013
|
* SPDX-License-Identifier: MIT
|
|
19015
19014
|
*/
|
|
19016
|
-
const
|
|
19015
|
+
const pr=e`
|
|
19017
19016
|
/* ========================================
|
|
19018
19017
|
* CHATBOT PANEL (AI Assistant side panel)
|
|
19019
19018
|
* ======================================== */
|
|
@@ -19181,7 +19180,7 @@ const dr=e`
|
|
|
19181
19180
|
width: 100%;
|
|
19182
19181
|
}
|
|
19183
19182
|
}
|
|
19184
|
-
`,
|
|
19183
|
+
`,hr=[e`
|
|
19185
19184
|
:host {
|
|
19186
19185
|
display: block;
|
|
19187
19186
|
width: 100%;
|
|
@@ -22254,7 +22253,7 @@ const dr=e`
|
|
|
22254
22253
|
white-space: nowrap;
|
|
22255
22254
|
}
|
|
22256
22255
|
|
|
22257
|
-
`,
|
|
22256
|
+
`,pr],ur=e`
|
|
22258
22257
|
:host {
|
|
22259
22258
|
width: fit-content;
|
|
22260
22259
|
display: block;
|
|
@@ -22644,7 +22643,7 @@ const dr=e`
|
|
|
22644
22643
|
.wrapper:focus,
|
|
22645
22644
|
.wrapper:focus-within { outline: 3px solid; }
|
|
22646
22645
|
}
|
|
22647
|
-
`,
|
|
22646
|
+
`,br=e`
|
|
22648
22647
|
:host {
|
|
22649
22648
|
display: flex;
|
|
22650
22649
|
align-items: center;
|
|
@@ -22788,7 +22787,7 @@ const dr=e`
|
|
|
22788
22787
|
:host([checked]) input:after,
|
|
22789
22788
|
:host([indeterminate]) input:after { font-weight: 900; }
|
|
22790
22789
|
}
|
|
22791
|
-
`,
|
|
22790
|
+
`,fr=e`
|
|
22792
22791
|
:host {
|
|
22793
22792
|
display: block;
|
|
22794
22793
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
|
|
@@ -22929,7 +22928,7 @@ const dr=e`
|
|
|
22929
22928
|
.alert { padding: 0.5rem 0.75rem; }
|
|
22930
22929
|
.alert--with-description { padding: 0.75rem 1rem; }
|
|
22931
22930
|
}
|
|
22932
|
-
`,
|
|
22931
|
+
`,vr=e`
|
|
22933
22932
|
:host {
|
|
22934
22933
|
display: block;
|
|
22935
22934
|
color: var(--nr-text, #161616);
|
|
@@ -22989,7 +22988,7 @@ const dr=e`
|
|
|
22989
22988
|
* @license
|
|
22990
22989
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
22991
22990
|
* SPDX-License-Identifier: MIT
|
|
22992
|
-
*/,
|
|
22991
|
+
*/,gr=e`
|
|
22993
22992
|
:host {
|
|
22994
22993
|
display: inline-flex;
|
|
22995
22994
|
align-items: center;
|
|
@@ -23083,7 +23082,7 @@ const dr=e`
|
|
|
23083
23082
|
:host([size="large"]) .radio-label { font-size: 16px; }
|
|
23084
23083
|
|
|
23085
23084
|
:host([disabled]) .radio-label { color: #bfbfbf; }
|
|
23086
|
-
`;var gr,mr,xr,yr,wr,$r,kr,Sr,Cr;!function(e){e.Default="default",e.Inline="inline",e.Button="button",e.Slot="slot"}(gr||(gr={})),function(e){e.Default="default",e.Warning="warning",e.Error="error",e.Success="success"}(mr||(mr={})),function(e){e.Small="small",e.Medium="medium",e.Large="large"}(xr||(xr={})),function(e){e.Small="small",e.Medium="medium",e.Large="large"}(yr||(yr={})),function(e){e.Horizontal="horizontal",e.Vertical="vertical"}(wr||(wr={})),function(e){e.Default="default",e.Solid="solid",e.Outline="outline",e.Borderless="borderless"}($r||($r={})),function(e){e.Bottom="bottom",e.Top="top",e.Auto="auto"}(kr||(kr={})),function(e){e.None="none",e.StartsWith="starts-with",e.Contains="contains",e.Fuzzy="fuzzy"}(Sr||(Sr={}));class Tr extends Ve{}class Mr extends Tr{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 Er extends Tr{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 Ar(e){if(e.parentElement)return e.parentElement;const t=e.getRootNode();return t instanceof ShadowRoot?t.host:null}function zr(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=Ar(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,v=function(e,t,i){return i>=e?"bottom":t>=e||t>i?"top":"bottom"}(f,b,u);let g;g="bottom"===v?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)),g=Math.max(s,Math.min(g,c-f-s)),p&&(g-=h.top,m-=h.left),{top:g,left:m,width:r.width,placement:v}}function Ir(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 Or extends Tr{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=zr(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?Ir(this._dropdownElement,this._triggerElement,this._position.placement,{viewportMargin:10,maxHeight:t}):n?(this._dropdownElement.style.removeProperty("max-height"),this._dropdownElement.style.overflowY="visible"):Ir(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 Tr{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"}(Cr||(Cr={}));class _r extends He{constructor(e,t){super(e),this.selectionController=t}get validationState(){return this._validationState}validate(){try{this._validationState=Cr.Pending;const e=this.selectionController.getSelectedOptions().length>0;return this.host.required&&!e?(this.setValidationResult(!1,"This field is required",Cr.Invalid),!1):(this.setValidationResult(!0,"",Cr.Valid),!0)}catch(e){return this.handleError(e,"validate"),this.setValidationResult(!1,"Validation error occurred",Cr.Invalid),!1}}reset(){try{this._isValid=!0,this._validationMessage="",this._validationState=Cr.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,Cr.Invalid):this.validate()}catch(e){this.handleError(e,"setCustomValidity")}}validateOnChange(){this._validationState!==Cr.Pristine&&this.validate()}validateOnBlur(){this._validationState===Cr.Pristine&&(this._validationState=Cr.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===Cr.Valid,invalid:!this._isValid&&this._validationState===Cr.Invalid,pending:this._validationState===Cr.Pending,pristine:this._validationState===Cr.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 Rr extends Tr{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`
|
|
23085
|
+
`;var mr,xr,yr,wr,$r,kr,Sr,Cr,Tr;!function(e){e.Default="default",e.Inline="inline",e.Button="button",e.Slot="slot"}(mr||(mr={})),function(e){e.Default="default",e.Warning="warning",e.Error="error",e.Success="success"}(xr||(xr={})),function(e){e.Small="small",e.Medium="medium",e.Large="large"}(yr||(yr={})),function(e){e.Small="small",e.Medium="medium",e.Large="large"}(wr||(wr={})),function(e){e.Horizontal="horizontal",e.Vertical="vertical"}($r||($r={})),function(e){e.Default="default",e.Solid="solid",e.Outline="outline",e.Borderless="borderless"}(kr||(kr={})),function(e){e.Bottom="bottom",e.Top="top",e.Auto="auto"}(Sr||(Sr={})),function(e){e.None="none",e.StartsWith="starts-with",e.Contains="contains",e.Fuzzy="fuzzy"}(Cr||(Cr={}));class Mr extends Ve{}class Er extends Mr{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 Ar extends Mr{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 zr(e){if(e.parentElement)return e.parentElement;const t=e.getRootNode();return t instanceof ShadowRoot?t.host:null}function Ir(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=zr(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,v=function(e,t,i){return i>=e?"bottom":t>=e||t>i?"top":"bottom"}(f,b,u);let g;g="bottom"===v?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)),g=Math.max(s,Math.min(g,c-f-s)),p&&(g-=h.top,m-=h.left),{top:g,left:m,width:r.width,placement:v}}function Or(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 Pr extends Mr{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=Ir(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?Or(this._dropdownElement,this._triggerElement,this._position.placement,{viewportMargin:10,maxHeight:t}):n?(this._dropdownElement.style.removeProperty("max-height"),this._dropdownElement.style.overflowY="visible"):Or(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 _r extends Mr{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"}(Tr||(Tr={}));class Rr extends He{constructor(e,t){super(e),this.selectionController=t}get validationState(){return this._validationState}validate(){try{this._validationState=Tr.Pending;const e=this.selectionController.getSelectedOptions().length>0;return this.host.required&&!e?(this.setValidationResult(!1,"This field is required",Tr.Invalid),!1):(this.setValidationResult(!0,"",Tr.Valid),!0)}catch(e){return this.handleError(e,"validate"),this.setValidationResult(!1,"Validation error occurred",Tr.Invalid),!1}}reset(){try{this._isValid=!0,this._validationMessage="",this._validationState=Tr.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,Tr.Invalid):this.validate()}catch(e){this.handleError(e,"setCustomValidity")}}validateOnChange(){this._validationState!==Tr.Pristine&&this.validate()}validateOnBlur(){this._validationState===Tr.Pristine&&(this._validationState=Tr.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===Tr.Valid,invalid:!this._isValid&&this._validationState===Tr.Invalid,pending:this._validationState===Tr.Pending,pristine:this._validationState===Tr.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 Nr extends Mr{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`
|
|
23087
23086
|
<div class="search-container">
|
|
23088
23087
|
<nr-input
|
|
23089
23088
|
type="text"
|
|
@@ -23115,12 +23114,12 @@ const dr=e`
|
|
|
23115
23114
|
<span class="no-options-text">No results found for "${this._searchQuery}"</span>
|
|
23116
23115
|
</div>
|
|
23117
23116
|
</div>
|
|
23118
|
-
`}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
|
|
23117
|
+
`}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 Dr extends Mr{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()}}
|
|
23119
23118
|
/**
|
|
23120
23119
|
* @license
|
|
23121
23120
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
23122
23121
|
* SPDX-License-Identifier: MIT
|
|
23123
|
-
*/var
|
|
23122
|
+
*/var Lr=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 jr=class extends($e(t)){constructor(){super(...arguments),this.requiredComponents=["nr-input","nr-icon"],this.options=[],this.placeholder="Select an option",this.disabled=!1,this.type=mr.Default,this.multiple=!1,this.show=!1,this.status=xr.Default,this.size=yr.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 Er(this),this.dropdownController=new Pr(this),this.keyboardController=new Ar(this,this.selectionController,this.dropdownController),this.focusController=new _r(this),this.validationController=new Rr(this,this.selectionController),this.searchController=new Nr(this),this.eventController=new Dr(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=xr.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,[[mr.Default,()=>this.renderDefault()],[mr.Inline,()=>this.renderInline()],[mr.Button,()=>this.renderButton()],[mr.Slot,()=>this.renderSlot()]])}`}renderDefault(){const e=this.selectedOptions,t=this.validationController.getValidationClasses();return i`
|
|
23124
23123
|
<slot name="label"></slot>
|
|
23125
23124
|
<div
|
|
23126
23125
|
class="${h(Object.assign({wrapper:!0},t))}"
|
|
@@ -23219,7 +23218,7 @@ const dr=e`
|
|
|
23219
23218
|
aria-label="Remove ${e.label}"
|
|
23220
23219
|
></nr-icon>
|
|
23221
23220
|
</span>
|
|
23222
|
-
`):i`${e[0].label}`}renderStatusIcon(){switch(this.status){case
|
|
23221
|
+
`):i`${e[0].label}`}renderStatusIcon(){switch(this.status){case xr.Warning:return i`<nr-icon name="alert-triangle" size="${this.size}" class="status-icon warning"></nr-icon>`;case xr.Error:return i`<nr-icon name="alert-circle" size="${this.size}" class="status-icon error"></nr-icon>`;case xr.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`
|
|
23223
23222
|
<nr-icon
|
|
23224
23223
|
part="clear"
|
|
23225
23224
|
name="x"
|
|
@@ -23273,18 +23272,18 @@ const dr=e`
|
|
|
23273
23272
|
<div class="${a} ${o}" id="${s}" role="alert" aria-live="polite">
|
|
23274
23273
|
${e}
|
|
23275
23274
|
</div>
|
|
23276
|
-
`}(this.validationController.validationMessage,{statusClass:this.status})}};
|
|
23275
|
+
`}(this.validationController.validationMessage,{statusClass:this.status})}};jr.styles=ur,jr.useShadowDom=!0,Lr([s({type:Array})],jr.prototype,"options",void 0),Lr([s({type:String})],jr.prototype,"placeholder",void 0),Lr([s({type:Boolean,reflect:!0})],jr.prototype,"disabled",void 0),Lr([s({type:String,reflect:!0})],jr.prototype,"type",void 0),Lr([s({type:Boolean,attribute:"multiple"})],jr.prototype,"multiple",void 0),Lr([s({type:Boolean,reflect:!0})],jr.prototype,"show",void 0),Lr([s({type:String,reflect:!0})],jr.prototype,"status",void 0),Lr([s({type:String,reflect:!0})],jr.prototype,"size",void 0),Lr([s({type:Boolean,reflect:!0})],jr.prototype,"required",void 0),Lr([s({type:String})],jr.prototype,"name",void 0),Lr([s()],jr.prototype,"value",void 0),Lr([s({type:String,attribute:"no-options-message"})],jr.prototype,"noOptionsMessage",void 0),Lr([s({type:String,attribute:"no-options-icon"})],jr.prototype,"noOptionsIcon",void 0),Lr([s({type:Boolean,reflect:!0})],jr.prototype,"searchable",void 0),Lr([s({type:Boolean,reflect:!0})],jr.prototype,"clearable",void 0),Lr([s({type:String,attribute:"search-placeholder"})],jr.prototype,"searchPlaceholder",void 0),Lr([s({type:String})],jr.prototype,"searchQuery",void 0),Lr([s({type:Boolean,attribute:"use-custom-selected-display"})],jr.prototype,"useCustomSelectedDisplay",void 0),Lr([s({type:String,attribute:"max-height"})],jr.prototype,"maxHeight",void 0),Lr([s({type:Boolean,reflect:!0})],jr.prototype,"block",void 0),jr=Lr([l("nr-select")],jr);
|
|
23277
23276
|
/**
|
|
23278
23277
|
* @license
|
|
23279
23278
|
* Copyright 2024 Nuraly, Laabidi Aymen
|
|
23280
23279
|
* SPDX-License-Identifier: MIT
|
|
23281
23280
|
*/
|
|
23282
|
-
var jr=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())})},Fr=function(e){return this instanceof Fr?(this.v=e,this):new Fr(e)},Br=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 Fr?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 Ur{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 jr(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=f(t,{path:this.config.socketPath,query:{o:JSON.stringify({workflowId:this.config.workflowId})},autoConnect:!0,reconnection:!0,reconnectionAttempts:5}),new Promise((e,t)=>{const i=setTimeout(()=>{t(new Error("Socket connection timeout"))},3e4);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 jr(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 Br(this,arguments,function*(){var i,n;if(!this.connected||!this.socket||!this.config)return yield yield Fr(this.formatError("Not Connected","Socket is not connected. Please check your connection.")),yield Fr(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 Fr(fetch(s,{method:"POST",headers:Object.assign({"Content-Type":"application/json"},this.config.headers),body:JSON.stringify(a)}));if(!r.ok){const e=yield Fr(r.text().catch(()=>r.statusText));return yield yield Fr(this.formatError(`${r.status} ${r.statusText}`,e)),yield Fr(void 0)}const l=r.headers.get("X-Execution-Id")||(null===(i=yield Fr(r.json().catch(()=>({}))))||void 0===i?void 0:i.executionId);if(!l)return yield yield Fr(this.formatError("Execution Error","No execution ID received from server")),yield Fr(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 Fr(e)}yield Fr(new Promise(e=>setTimeout(e,200)))}clearInterval(h);const e=yield Fr(c);yield yield Fr(e)}catch(e){throw clearInterval(h),e}}catch(e){const t=e instanceof Error?e.message:String(e);yield yield Fr(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 jr(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===It.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/")?It.Image:e.startsWith("video/")?It.Video:e.startsWith("audio/")?It.Audio:e.startsWith("application/pdf")||e.includes("document")||e.startsWith("text/")?It.Document:e.includes("zip")||e.includes("rar")||e.includes("tar")?It.Archive:e.includes("javascript")||e.includes("json")||e.includes("xml")?It.Code:It.Unknown}formatError(e,t){return`[ERROR_START][ERROR_TITLE_START]${e}[ERROR_TITLE_END]${t}[ERROR_END]`}onError(e){console.error("[WorkflowSocketProvider] Error:",e)}}
|
|
23281
|
+
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())})},Br=function(e){return this instanceof Br?(this.v=e,this):new Br(e)},Ur=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 Br?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 Vr{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 Fr(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=f(t,{path:this.config.socketPath,query:{o:JSON.stringify({workflowId:this.config.workflowId})},autoConnect:!0,reconnection:!0,reconnectionAttempts:5}),new Promise((e,t)=>{const i=setTimeout(()=>{t(new Error("Socket connection timeout"))},3e4);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 Fr(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 Ur(this,arguments,function*(){var i,n;if(!this.connected||!this.socket||!this.config)return yield yield Br(this.formatError("Not Connected","Socket is not connected. Please check your connection.")),yield Br(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 Br(fetch(s,{method:"POST",headers:Object.assign({"Content-Type":"application/json"},this.config.headers),body:JSON.stringify(a)}));if(!r.ok){const e=yield Br(r.text().catch(()=>r.statusText));return yield yield Br(this.formatError(`${r.status} ${r.statusText}`,e)),yield Br(void 0)}const l=r.headers.get("X-Execution-Id")||(null===(i=yield Br(r.json().catch(()=>({}))))||void 0===i?void 0:i.executionId);if(!l)return yield yield Br(this.formatError("Execution Error","No execution ID received from server")),yield Br(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 Br(e)}yield Br(new Promise(e=>setTimeout(e,200)))}clearInterval(h);const e=yield Br(c);yield yield Br(e)}catch(e){throw clearInterval(h),e}}catch(e){const t=e instanceof Error?e.message:String(e);yield yield Br(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 Fr(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===It.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/")?It.Image:e.startsWith("video/")?It.Video:e.startsWith("audio/")?It.Audio:e.startsWith("application/pdf")||e.includes("document")||e.startsWith("text/")?It.Document:e.includes("zip")||e.includes("rar")||e.includes("tar")?It.Archive:e.includes("javascript")||e.includes("json")||e.includes("xml")?It.Code:It.Unknown}formatError(e,t){return`[ERROR_START][ERROR_TITLE_START]${e}[ERROR_TITLE_END]${t}[ERROR_END]`}onError(e){console.error("[WorkflowSocketProvider] Error:",e)}}
|
|
23283
23282
|
/**
|
|
23284
23283
|
* @license
|
|
23285
23284
|
* Copyright 2024 Nuraly, Laabidi Aymen
|
|
23286
23285
|
* SPDX-License-Identifier: MIT
|
|
23287
|
-
*/var Vr=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},Hr=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 qr=class extends Qs{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===U.NOTE}onWorkflowLoaded(e,t){if(!t||t.id!==e.id){const t=e.nodes.find(e=>{var t;return e.type===U.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===U.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=>be(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 Hr(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=>Hr(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 Hr(this,void 0,void 0,function*(){try{yield fetch(`/api/v1/triggers/${e}/activate`,{method:"POST"})}catch(e){}yield this.fetchTriggerStatuses()})}deactivateTrigger(e){return Hr(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 Hr(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 Hr(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 Hr(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===U.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 Hr(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 Ur,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 Hr(this,void 0,void 0,function*(){try{this.chatPreviewProvider=new Ur,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 Hr(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:Tt.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 $i({provider:this.chatPreviewProvider,enableFileUpload:t,ui:{onStateChange:()=>{this.requestUpdate()}}})}cleanupChatPreview(){return Hr(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 Hr(this,void 0,void 0,function*(){var e;const t=this.getPreviewNode();if(!t||!(null===(e=this.workflow)||void 0===e?void 0:e.id))return;const i=t.configuration||{},n=i.httpPath||"/webhook",a=(i.httpMethod||"POST").toUpperCase(),o="GET"!==a&&"HEAD"!==a&&"OPTIONS"!==a;this.httpPreviewLoading=!0,this.httpPreviewError="",this.httpPreviewResponse="",this.nodeStatuses={};try{let e;if(o)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${n}`;console.log("[Canvas] Sending HTTP preview request:",a,t,e);const i=yield fetch(t,{method:a,headers:o?{"Content-Type":"application/json"}:{},body:o?JSON.stringify(e):void 0}),s=i.headers.get("X-Execution-Id");let r;try{r=yield i.json()}catch(e){r=yield i.text()}if(!i.ok)throw new Error(r.message||r||`HTTP ${i.status}`);this.httpPreviewResponse=JSON.stringify({status:i.status,executionId:s,data:r},null,2),s&&(this.currentExecutionId=s,this.fetchExecutionData(s))}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(be(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!==U.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 Hr(this,void 0,void 0,function*(){var t;if(this.disabled)return;const{node:i}=e.detail;if(i.type===U.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 Ki(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 Hr(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 Hr(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||Ss,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,c=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`
|
|
23286
|
+
*/var Hr=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},qr=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 Gr=class extends Xs{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===U.NOTE}onWorkflowLoaded(e,t){if(!t||t.id!==e.id){const t=e.nodes.find(e=>{var t;return e.type===U.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===U.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=>be(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 qr(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=>qr(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 qr(this,void 0,void 0,function*(){try{yield fetch(`/api/v1/triggers/${e}/activate`,{method:"POST"})}catch(e){}yield this.fetchTriggerStatuses()})}deactivateTrigger(e){return qr(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 qr(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 qr(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 qr(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===U.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 qr(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 Vr,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 qr(this,void 0,void 0,function*(){try{this.chatPreviewProvider=new Vr,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 qr(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:Tt.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 ki({provider:this.chatPreviewProvider,enableFileUpload:t,ui:{onStateChange:()=>{this.requestUpdate()}}})}cleanupChatPreview(){return qr(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 qr(this,void 0,void 0,function*(){var e;const t=this.getPreviewNode();if(!t||!(null===(e=this.workflow)||void 0===e?void 0:e.id))return;const i=t.configuration||{},n=i.httpPath||"/webhook",a=(i.httpMethod||"POST").toUpperCase(),o="GET"!==a&&"HEAD"!==a&&"OPTIONS"!==a;this.httpPreviewLoading=!0,this.httpPreviewError="",this.httpPreviewResponse="",this.nodeStatuses={};try{let e;if(o)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${n}`;console.log("[Canvas] Sending HTTP preview request:",a,t,e);const i=yield fetch(t,{method:a,headers:o?{"Content-Type":"application/json"}:{},body:o?JSON.stringify(e):void 0}),s=i.headers.get("X-Execution-Id");let r;try{r=yield i.json()}catch(e){r=yield i.text()}if(!i.ok)throw new Error(r.message||r||`HTTP ${i.status}`);this.httpPreviewResponse=JSON.stringify({status:i.status,executionId:s,data:r},null,2),s&&(this.currentExecutionId=s,this.fetchExecutionData(s))}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(be(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!==U.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 qr(this,void 0,void 0,function*(){var t;if(this.disabled)return;const{node:i}=e.detail;if(i.type===U.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 Ji(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 qr(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 qr(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||Cs,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,c=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`
|
|
23288
23287
|
<div
|
|
23289
23288
|
class="collapsed-frame-node ${o?"selected":""} ${b}"
|
|
23290
23289
|
style=${d(h)}
|
|
@@ -23430,7 +23429,7 @@ var jr=function(e,t,i,n){return new(i||(i=Promise))(function(a,o){function s(e){
|
|
|
23430
23429
|
`)}
|
|
23431
23430
|
</div>
|
|
23432
23431
|
</div>
|
|
23433
|
-
`}({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&&be(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
|
|
23432
|
+
`}({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&&be(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 bs({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)===U.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`
|
|
23434
23433
|
<div
|
|
23435
23434
|
class="disabled-overlay ${this.isHoveringDisabledOverlay?"hovering":""}"
|
|
23436
23435
|
@dblclick=${this.handleDisabledOverlayDblClick}
|
|
@@ -23631,7 +23630,7 @@ var jr=function(e,t,i,n){return new(i||(i=Promise))(function(a,o){function s(e){
|
|
|
23631
23630
|
${this.renderContextMenu()}
|
|
23632
23631
|
</div>
|
|
23633
23632
|
${this.renderChatbotPanel()}
|
|
23634
|
-
`}};
|
|
23633
|
+
`}};Gr.useShadowDom=!0,Gr.styles=[hr,er,ur,br,fr,vr,gr,ze,Yi],Hr([s({type:String})],Gr.prototype,"canvasType",void 0),Hr([s({type:Object})],Gr.prototype,"nodeStatuses",void 0),Hr([s({type:Object})],Gr.prototype,"agentActivity",void 0),Hr([s({type:Boolean})],Gr.prototype,"listenToExecutionEvents",void 0),Hr([s({type:String})],Gr.prototype,"executionId",null),Hr([s({attribute:!1})],Gr.prototype,"databaseProvider",void 0),Hr([s({type:String})],Gr.prototype,"applicationId",void 0),Hr([s({attribute:!1})],Gr.prototype,"kvEntries",void 0),Hr([s({attribute:!1})],Gr.prototype,"onCreateKvEntry",void 0),Hr([r()],Gr.prototype,"paletteSearchTerm",void 0),Hr([r()],Gr.prototype,"previewNodeId",void 0),Hr([r()],Gr.prototype,"isHoveringDisabledOverlay",void 0),Hr([r()],Gr.prototype,"httpPreviewBody",void 0),Hr([r()],Gr.prototype,"httpPreviewResponse",void 0),Hr([r()],Gr.prototype,"httpPreviewLoading",void 0),Hr([r()],Gr.prototype,"httpPreviewError",void 0),Hr([r()],Gr.prototype,"dynamicVariables",void 0),Hr([r()],Gr.prototype,"loadingVariables",void 0),Hr([r()],Gr.prototype,"nodeExecutionData",void 0),Hr([r()],Gr.prototype,"currentExecutionId",void 0),Gr=Hr([l("workflow-canvas")],Gr);const Wr=e`
|
|
23635
23634
|
:host {
|
|
23636
23635
|
display: block;
|
|
23637
23636
|
position: absolute;
|
|
@@ -24404,7 +24403,7 @@ var jr=function(e,t,i,n){return new(i||(i=Promise))(function(a,o){function s(e){
|
|
|
24404
24403
|
* Copyright 2024 Nuraly, Laabidi Aymen
|
|
24405
24404
|
* SPDX-License-Identifier: MIT
|
|
24406
24405
|
*/
|
|
24407
|
-
var
|
|
24406
|
+
var Kr,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},Yr=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 Qr=Kr=class extends($e(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)>Kr.CLICK_THRESHOLD||Math.abs(i)>Kr.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)===q.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 Yr(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`
|
|
24408
24407
|
<div
|
|
24409
24408
|
class=${h(Object.assign(Object.assign({},e),{"wb-sticky-note":!0}))}
|
|
24410
24409
|
style=${d(t)}
|
|
@@ -24693,7 +24692,7 @@ var Wr,Kr=function(e,t,i,n){for(var a,o=arguments.length,s=o<3?t:null===n?n=Obje
|
|
|
24693
24692
|
${this.renderRemoteOverlays()}
|
|
24694
24693
|
</div>
|
|
24695
24694
|
${y?this.renderActionIndicator():n}
|
|
24696
|
-
`:y?i`${x}${this.renderActionIndicator()}`:x}};
|
|
24695
|
+
`:y?i`${x}${this.renderActionIndicator()}`:x}};Qr.useShadowDom=!0,Qr.styles=Wr,Qr.CLICK_THRESHOLD=5,Jr([s({type:Object})],Qr.prototype,"node",void 0),Jr([s({type:Boolean})],Qr.prototype,"selected",void 0),Jr([s({type:Boolean})],Qr.prototype,"dragging",void 0),Jr([s({type:String})],Qr.prototype,"connectingPortId",void 0),Jr([s({type:Boolean})],Qr.prototype,"editing",void 0),Jr([s({type:Object})],Qr.prototype,"remoteSelection",void 0),Jr([s({type:Object})],Qr.prototype,"remoteTyping",void 0),Jr([s({type:String})],Qr.prototype,"actionTargetLabel",void 0),Jr([r()],Qr.prototype,"_mermaidSvg",void 0),Jr([r()],Qr.prototype,"_mermaidError",void 0),Qr=Kr=Jr([l("whiteboard-node")],Qr);const Xr=[e`
|
|
24697
24696
|
:host {
|
|
24698
24697
|
display: block;
|
|
24699
24698
|
width: 100%;
|
|
@@ -25716,13 +25715,13 @@ var Wr,Kr=function(e,t,i,n){for(var a,o=arguments.length,s=o<3?t:null===n?n=Obje
|
|
|
25716
25715
|
}
|
|
25717
25716
|
}
|
|
25718
25717
|
|
|
25719
|
-
`,
|
|
25718
|
+
`,pr];
|
|
25720
25719
|
/**
|
|
25721
25720
|
* @license
|
|
25722
25721
|
* Copyright 2024 Nuraly, Laabidi Aymen
|
|
25723
25722
|
* SPDX-License-Identifier: MIT
|
|
25724
25723
|
*/
|
|
25725
|
-
var
|
|
25724
|
+
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};let el=class extends Xs{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||Os,height:t.height||Os}}shouldExcludeFromContainment(e){return!1}onWorkflowLoaded(e,t){}getNoteContentKey(e){return e.type===q.ANCHOR?"anchorLabel":"textContent"}getNoteSizeKeys(){return{widthKey:"width",heightKey:"height"}}getDefaultNoteSize(){return{width:Os,height:Os}}getCanvasType(){return G.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||Os,height:i.height||Os})}}}handleNodeDblClick(e){if(this.disabled)return;const{node:t}=e.detail;if(t.type===q.STICKY_NOTE||t.type===q.TEXT_BLOCK||t.type===q.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())})}oe(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`
|
|
25726
25725
|
<div class="wb-sidebar" @mousedown=${e=>e.stopPropagation()}>
|
|
25727
25726
|
<!-- Mode tools -->
|
|
25728
25727
|
<button
|
|
@@ -25769,7 +25768,7 @@ var Xr=function(e,t,i,n){for(var a,o=arguments.length,s=o<3?t:null===n?n=Object.
|
|
|
25769
25768
|
</button>
|
|
25770
25769
|
${e.shapesFlyoutOpen?i`
|
|
25771
25770
|
<div class="wb-shapes-flyout">
|
|
25772
|
-
${
|
|
25771
|
+
${xs.map(t=>i`
|
|
25773
25772
|
<button
|
|
25774
25773
|
class="wb-shapes-flyout-btn"
|
|
25775
25774
|
@click=${()=>e.onAddNode(t.type)}
|
|
@@ -25848,7 +25847,7 @@ var Xr=function(e,t,i,n){for(var a,o=arguments.length,s=o<3?t:null===n?n=Object.
|
|
|
25848
25847
|
<nr-icon name="anchor" size="small"></nr-icon>
|
|
25849
25848
|
</button>
|
|
25850
25849
|
</div>
|
|
25851
|
-
`;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&&oe(i.type)?i:null}getNodeScreenPosition(e){const t=(e.configuration||{}).width||
|
|
25850
|
+
`;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&&oe(i.type)?i:null}getNodeScreenPosition(e){const t=(e.configuration||{}).width||Os;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):Js({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`
|
|
25852
25851
|
<div
|
|
25853
25852
|
class="canvas-wrapper"
|
|
25854
25853
|
data-theme=${this.currentTheme}
|
|
@@ -25910,7 +25909,7 @@ var Xr=function(e,t,i,n){for(var a,o=arguments.length,s=o<3?t:null===n?n=Object.
|
|
|
25910
25909
|
${this.renderContextMenu()}
|
|
25911
25910
|
</div>
|
|
25912
25911
|
${this.renderChatbotPanel()}
|
|
25913
|
-
`}};
|
|
25912
|
+
`}};el.useShadowDom=!0,el.styles=[Xr,ze,Yi,er,ur,br,fr,gr],Zr([r()],el.prototype,"_wbActiveColorPicker",void 0),Zr([r()],el.prototype,"wbShapesFlyoutOpen",void 0),el=Zr([l("whiteboard-canvas")],el);
|
|
25914
25913
|
/**
|
|
25915
25914
|
* @license
|
|
25916
25915
|
* Copyright 2024 Nuraly, Laabidi Aymen
|
|
@@ -25924,4 +25923,4 @@ var Xr=function(e,t,i,n){for(var a,o=arguments.length,s=o<3?t:null===n?n=Object.
|
|
|
25924
25923
|
* input blob → AudioContext.decodeAudioData → BufferSource → MediaStreamDestination
|
|
25925
25924
|
* → MediaRecorder(ogg/opus, 32 kbps) → output blob
|
|
25926
25925
|
*/
|
|
25927
|
-
var el=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 tl="audio/ogg;codecs=opus";function il(){try{return"undefined"!=typeof MediaRecorder&&MediaRecorder.isTypeSupported(tl)}catch(e){return!1}}var nl=Object.freeze({__proto__:null,canEncodeOgg:il,compressToOpus:function(e,t){return el(this,void 0,void 0,function*(){if(!il()){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:tl,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:tl}),mimeType:tl,ext:"ogg"}})}});const al=(e,t=0,i=1)=>e>i?i:e<t?t:e,ol=(e,t=0,i=Math.pow(10,t))=>Math.round(i*e)/i,sl=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?ol(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?ol(parseInt(e.substring(6,8),16)/255,2):1}),rl=e=>{const{h:t,s:i,l:n}=(({h:e,s:t,v:i,a:n})=>{const a=(200-t)*i/100;return{h:ol(e),s:ol(a>0&&a<200?t*i/100/(a<=100?a:200-a)*100:0),l:ol(a/2),a:ol(n,2)}})(e);return`hsl(${t}, ${i}%, ${n}%)`},ll=({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:ol(255*[i,s,o,o,r,i][l]),g:ol(255*[r,i,i,s,o,o][l]),b:ol(255*[o,o,r,i,i,s][l]),a:ol(n,2)}},cl=e=>{const t=e.toString(16);return t.length<2?"0"+t:t},dl=({r:e,g:t,b:i,a:n})=>{const a=n<1?cl(ol(255*n)):"";return"#"+cl(e)+cl(t)+cl(i)+a},pl=({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:ol(60*(s<0?s+6:s)),s:ol(a?o/a*100:0),v:ol(a/255*100),a:n}},hl=(e,t)=>{if(e===t)return!0;for(const i in e)if(e[i]!==t[i])return!1;return!0},ul={},bl=e=>{let t=ul[e];return t||(t=document.createElement("template"),t.innerHTML=e,ul[e]=t),t},fl=(e,t,i)=>{e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:i}))};let vl=!1;const gl=e=>"touches"in e,ml=(e,t)=>{const i=gl(t)?t.touches[0]:t,n=e.el.getBoundingClientRect();fl(e.el,"move",e.getMove({x:al((i.pageX-(n.left+window.pageXOffset))/n.width),y:al((i.pageY-(n.top+window.pageYOffset))/n.height)}))};class xl{constructor(e,t,i,n){const a=bl(`<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(vl?"touchmove":"mousemove",this),t(vl?"touchend":"mouseup",this)}handleEvent(e){switch(e.type){case"mousedown":case"touchstart":if(e.preventDefault(),!(e=>!(vl&&!gl(e)||(vl||(vl=gl(e)),0)))(e)||!vl&&0!=e.button)return;this.el.focus(),ml(this,e),this.dragging=!0;break;case"mousemove":case"touchmove":e.preventDefault(),ml(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(),fl(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 yl extends xl{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:rl({h:e,s:100,v:100,a:1})}]),this.el.setAttribute("aria-valuenow",`${ol(e)}`)}getMove(e,t){return{h:t?al(this.h+360*e.x,0,360):360*e.x}}}class wl extends xl{constructor(e){super(e,"saturation",'aria-label="Color"',!0)}update(e){this.hsva=e,this.style([{top:100-e.v+"%",left:`${e.s}%`,color:rl(e)},{"background-color":rl({h:e.h,s:100,v:100,a:1})}]),this.el.setAttribute("aria-valuetext",`Saturation ${ol(e.s)}%, Brightness ${ol(e.v)}%`)}getMove(e,t){return{s:t?al(this.hsva.s+100*e.x,0,100):100*e.x,v:t?al(this.hsva.v-100*e.y,0,100):Math.round(100-100*e.y)}}}const $l=Symbol("same"),kl=Symbol("color"),Sl=Symbol("hsva"),Cl=Symbol("update"),Tl=Symbol("parts"),Ml=Symbol("css"),El=Symbol("sliders");class Al extends HTMLElement{static get observedAttributes(){return["color"]}get[Ml](){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[El](){return[wl,yl]}get color(){return this[kl]}set color(e){if(!this[$l](e)){const t=this.colorModel.toHsva(e);this[Cl](t),this[kl]=e}}constructor(){super();const e=bl(`<style>${this[Ml].join("")}</style>`),t=this.attachShadow({mode:"open"});t.appendChild(e.content.cloneNode(!0)),t.addEventListener("move",this),this[Tl]=this[El].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[$l](n)||(this.color=n)}handleEvent(e){const t=this[Sl],i={...t,...e.detail};let n;this[Cl](i),hl(i,t)||this[$l](n=this.colorModel.fromHsva(i))||(this[kl]=n,fl(this,"color-changed",{value:n}))}[$l](e){return this.color&&this.colorModel.equal(e,this.color)}[Cl](e){this[Sl]=e,this[Tl].forEach(t=>t.update(e))}}const zl={defaultColor:"#000",toHsva:e=>pl(sl(e)),fromHsva:({h:e,s:t,v:i})=>dl(ll({h:e,s:t,v:i,a:1})),equal:(e,t)=>e.toLowerCase()===t.toLowerCase()||hl(sl(e),sl(t)),fromAttr:e=>e};class Il extends Al{get colorModel(){return zl}}class Ol extends Il{}customElements.define("hex-color-picker",Ol);var Pl=Object.freeze({__proto__:null,HexColorPicker:Ol});export{V as AgentNodeType,Vs as BORDER_COLOR_PRESETS,Qs as BaseCanvasElement,zn as CHATBOT_TRIGGER_EVENTS,Y as CanvasMode,G as CanvasType,jn as ChatbotPreviewComponent,Rn as ChatbotSizeSelectComponent,An as ChatbotTriggerEvent,Nn as ChatbotVariantSelectComponent,j as DATA_NODE_SECTIONS,L as DATA_OPERATIONS,In as DEFAULT_CHATBOT_TRIGGER_CONFIG,D as DEFAULT_DATA_NODE_CONFIG,P as DataOperation,L as DataOperations,vn as DataSourceSelectComponent,H as DbDesignerNodeType,gn as EntitySelectComponent,K as ExecutionStatus,un as ExpressionInputComponent,Us as FILL_COLOR_PRESETS,R as FILTER_OPERATORS,qs as FONT_FAMILY_OPTIONS,ce as FRAME_COLOR_PRESETS,$s as FRAME_DEFAULT_BG_COLOR,ks as FRAME_DEFAULT_BORDER_COLOR,ws as FRAME_DEFAULT_HEIGHT,Ss as FRAME_DEFAULT_LABEL,Ts as FRAME_DEFAULT_LABEL_PLACEMENT,Cs as FRAME_DEFAULT_LABEL_POSITION,ys as FRAME_DEFAULT_WIDTH,Dn as FeatureToggleComponent,wn as FieldMapperComponent,xn as FieldMultiSelectComponent,mn as FieldSelectComponent,yn as FilterBuilderComponent,_ as FilterOperator,Fn as LoadingTypeSelectComponent,Gs as MERMAID_THEME_OPTIONS,ee as NODE_CATEGORIES,Q as NODE_COLORS,X as NODE_ICONS,Z as NODE_TEMPLATES,le as NOTE_COLOR_PRESETS,Ps as NOTE_MIN_HEIGHT,Os as NOTE_MIN_WIDTH,fn as OperationSelectComponent,ue as PERSISTENT_TRIGGER_TYPES,Bs as PERSISTENT_TRIGGER_TYPE_NAMES,J as PortType,$n as SortBuilderComponent,Ln as SuggestionListComponent,Rs as TABLE_DEFAULT_HEIGHT,_s as TABLE_DEFAULT_WIDTH,Ds as TABLE_MIN_HEIGHT,Ns as TABLE_MIN_WIDTH,Hs as TEXT_COLOR_PRESETS,Fs as TRIGGER_POLL_INTERVAL_MS,W as TriggerConnectionState,_n as TriggerEventSelectComponent,Ls as VIEWPORT_ADD_NODE_OFFSET_X,js as VIEWPORT_ADD_NODE_OFFSET_Y,bn as VariableNameInputComponent,Is as WHITEBOARD_NODE_DEFAULT_SIZE,Es as WORKFLOW_NODE_HEIGHT,Ms as WORKFLOW_NODE_WIDTH,zs as WORKFLOW_NOTE_DEFAULT_HEIGHT,As as WORKFLOW_NOTE_DEFAULT_WIDTH,Zr as WhiteboardCanvasElement,Yr as WhiteboardNodeElement,q as WhiteboardNodeType,qr as WorkflowCanvasElement,cr as WorkflowNodeElement,U as WorkflowNodeType,En as chatbotTriggerFieldStyles,re as createNodeFromTemplate,pn as dataNodeFieldStyles,se as getCategoriesForCanvasType,te as getNodeTemplate,ie as isAgentNode,de as isAnnotationNode,ae as isDbDesignerNode,pe as isFrameNode,he as isNoteNode,be as isPersistentTriggerNode,oe as isWhiteboardNode,ne as isWorkflowNode,F as shouldShowSection,On as validateChatbotTriggerConfig,B as validateDataNodeConfig};
|
|
25926
|
+
var tl=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 il="audio/ogg;codecs=opus";function nl(){try{return"undefined"!=typeof MediaRecorder&&MediaRecorder.isTypeSupported(il)}catch(e){return!1}}var al=Object.freeze({__proto__:null,canEncodeOgg:nl,compressToOpus:function(e,t){return tl(this,void 0,void 0,function*(){if(!nl()){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:il,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:il}),mimeType:il,ext:"ogg"}})}});const ol=(e,t=0,i=1)=>e>i?i:e<t?t:e,sl=(e,t=0,i=Math.pow(10,t))=>Math.round(i*e)/i,rl=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?sl(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?sl(parseInt(e.substring(6,8),16)/255,2):1}),ll=e=>{const{h:t,s:i,l:n}=(({h:e,s:t,v:i,a:n})=>{const a=(200-t)*i/100;return{h:sl(e),s:sl(a>0&&a<200?t*i/100/(a<=100?a:200-a)*100:0),l:sl(a/2),a:sl(n,2)}})(e);return`hsl(${t}, ${i}%, ${n}%)`},cl=({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:sl(255*[i,s,o,o,r,i][l]),g:sl(255*[r,i,i,s,o,o][l]),b:sl(255*[o,o,r,i,i,s][l]),a:sl(n,2)}},dl=e=>{const t=e.toString(16);return t.length<2?"0"+t:t},pl=({r:e,g:t,b:i,a:n})=>{const a=n<1?dl(sl(255*n)):"";return"#"+dl(e)+dl(t)+dl(i)+a},hl=({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:sl(60*(s<0?s+6:s)),s:sl(a?o/a*100:0),v:sl(a/255*100),a:n}},ul=(e,t)=>{if(e===t)return!0;for(const i in e)if(e[i]!==t[i])return!1;return!0},bl={},fl=e=>{let t=bl[e];return t||(t=document.createElement("template"),t.innerHTML=e,bl[e]=t),t},vl=(e,t,i)=>{e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:i}))};let gl=!1;const ml=e=>"touches"in e,xl=(e,t)=>{const i=ml(t)?t.touches[0]:t,n=e.el.getBoundingClientRect();vl(e.el,"move",e.getMove({x:ol((i.pageX-(n.left+window.pageXOffset))/n.width),y:ol((i.pageY-(n.top+window.pageYOffset))/n.height)}))};class yl{constructor(e,t,i,n){const a=fl(`<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(gl?"touchmove":"mousemove",this),t(gl?"touchend":"mouseup",this)}handleEvent(e){switch(e.type){case"mousedown":case"touchstart":if(e.preventDefault(),!(e=>!(gl&&!ml(e)||(gl||(gl=ml(e)),0)))(e)||!gl&&0!=e.button)return;this.el.focus(),xl(this,e),this.dragging=!0;break;case"mousemove":case"touchmove":e.preventDefault(),xl(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(),vl(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 wl extends yl{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:ll({h:e,s:100,v:100,a:1})}]),this.el.setAttribute("aria-valuenow",`${sl(e)}`)}getMove(e,t){return{h:t?ol(this.h+360*e.x,0,360):360*e.x}}}class $l extends yl{constructor(e){super(e,"saturation",'aria-label="Color"',!0)}update(e){this.hsva=e,this.style([{top:100-e.v+"%",left:`${e.s}%`,color:ll(e)},{"background-color":ll({h:e.h,s:100,v:100,a:1})}]),this.el.setAttribute("aria-valuetext",`Saturation ${sl(e.s)}%, Brightness ${sl(e.v)}%`)}getMove(e,t){return{s:t?ol(this.hsva.s+100*e.x,0,100):100*e.x,v:t?ol(this.hsva.v-100*e.y,0,100):Math.round(100-100*e.y)}}}const kl=Symbol("same"),Sl=Symbol("color"),Cl=Symbol("hsva"),Tl=Symbol("update"),Ml=Symbol("parts"),El=Symbol("css"),Al=Symbol("sliders");class zl extends HTMLElement{static get observedAttributes(){return["color"]}get[El](){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[Al](){return[$l,wl]}get color(){return this[Sl]}set color(e){if(!this[kl](e)){const t=this.colorModel.toHsva(e);this[Tl](t),this[Sl]=e}}constructor(){super();const e=fl(`<style>${this[El].join("")}</style>`),t=this.attachShadow({mode:"open"});t.appendChild(e.content.cloneNode(!0)),t.addEventListener("move",this),this[Ml]=this[Al].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[kl](n)||(this.color=n)}handleEvent(e){const t=this[Cl],i={...t,...e.detail};let n;this[Tl](i),ul(i,t)||this[kl](n=this.colorModel.fromHsva(i))||(this[Sl]=n,vl(this,"color-changed",{value:n}))}[kl](e){return this.color&&this.colorModel.equal(e,this.color)}[Tl](e){this[Cl]=e,this[Ml].forEach(t=>t.update(e))}}const Il={defaultColor:"#000",toHsva:e=>hl(rl(e)),fromHsva:({h:e,s:t,v:i})=>pl(cl({h:e,s:t,v:i,a:1})),equal:(e,t)=>e.toLowerCase()===t.toLowerCase()||ul(rl(e),rl(t)),fromAttr:e=>e};class Ol extends zl{get colorModel(){return Il}}class Pl extends Ol{}customElements.define("hex-color-picker",Pl);var _l=Object.freeze({__proto__:null,HexColorPicker:Pl});export{V as AgentNodeType,Hs as BORDER_COLOR_PRESETS,Xs as BaseCanvasElement,In as CHATBOT_TRIGGER_EVENTS,Y as CanvasMode,G as CanvasType,Fn as ChatbotPreviewComponent,Nn as ChatbotSizeSelectComponent,zn as ChatbotTriggerEvent,Dn as ChatbotVariantSelectComponent,j as DATA_NODE_SECTIONS,L as DATA_OPERATIONS,On as DEFAULT_CHATBOT_TRIGGER_CONFIG,D as DEFAULT_DATA_NODE_CONFIG,P as DataOperation,L as DataOperations,gn as DataSourceSelectComponent,H as DbDesignerNodeType,mn as EntitySelectComponent,K as ExecutionStatus,bn as ExpressionInputComponent,Vs as FILL_COLOR_PRESETS,R as FILTER_OPERATORS,Gs as FONT_FAMILY_OPTIONS,ce as FRAME_COLOR_PRESETS,ks as FRAME_DEFAULT_BG_COLOR,Ss as FRAME_DEFAULT_BORDER_COLOR,$s as FRAME_DEFAULT_HEIGHT,Cs as FRAME_DEFAULT_LABEL,Ms as FRAME_DEFAULT_LABEL_PLACEMENT,Ts as FRAME_DEFAULT_LABEL_POSITION,ws as FRAME_DEFAULT_WIDTH,Ln as FeatureToggleComponent,$n as FieldMapperComponent,yn as FieldMultiSelectComponent,xn as FieldSelectComponent,wn as FilterBuilderComponent,_ as FilterOperator,Bn as LoadingTypeSelectComponent,Ws as MERMAID_THEME_OPTIONS,ee as NODE_CATEGORIES,Q as NODE_COLORS,X as NODE_ICONS,Z as NODE_TEMPLATES,le as NOTE_COLOR_PRESETS,_s as NOTE_MIN_HEIGHT,Ps as NOTE_MIN_WIDTH,vn as OperationSelectComponent,ue as PERSISTENT_TRIGGER_TYPES,Us as PERSISTENT_TRIGGER_TYPE_NAMES,J as PortType,kn as SortBuilderComponent,jn as SuggestionListComponent,Ns as TABLE_DEFAULT_HEIGHT,Rs as TABLE_DEFAULT_WIDTH,Ls as TABLE_MIN_HEIGHT,Ds as TABLE_MIN_WIDTH,qs as TEXT_COLOR_PRESETS,Bs as TRIGGER_POLL_INTERVAL_MS,W as TriggerConnectionState,Rn as TriggerEventSelectComponent,js as VIEWPORT_ADD_NODE_OFFSET_X,Fs as VIEWPORT_ADD_NODE_OFFSET_Y,fn as VariableNameInputComponent,Os as WHITEBOARD_NODE_DEFAULT_SIZE,As as WORKFLOW_NODE_HEIGHT,Es as WORKFLOW_NODE_WIDTH,Is as WORKFLOW_NOTE_DEFAULT_HEIGHT,zs as WORKFLOW_NOTE_DEFAULT_WIDTH,el as WhiteboardCanvasElement,Qr as WhiteboardNodeElement,q as WhiteboardNodeType,Gr as WorkflowCanvasElement,dr as WorkflowNodeElement,U as WorkflowNodeType,An as chatbotTriggerFieldStyles,re as createNodeFromTemplate,hn as dataNodeFieldStyles,se as getCategoriesForCanvasType,te as getNodeTemplate,ie as isAgentNode,de as isAnnotationNode,ae as isDbDesignerNode,pe as isFrameNode,he as isNoteNode,be as isPersistentTriggerNode,oe as isWhiteboardNode,ne as isWorkflowNode,F as shouldShowSection,Pn as validateChatbotTriggerConfig,B as validateDataNodeConfig};
|