ezux 1.1.19 → 1.1.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/README.md +7 -1
  2. package/dist/{DeleteConfirmationModal-CukNDgtX.cjs → DeleteConfirmationModal-BM1PoL6P.cjs} +1 -1
  3. package/dist/{DeleteConfirmationModal-p8XGDGIw.js → DeleteConfirmationModal-B_tXm0N0.js} +4 -4
  4. package/dist/{EzEventModal-BrCBSXBM.cjs → EzEventModal-D1EzXBsQ.cjs} +1 -1
  5. package/dist/{EzEventModal-BDSHG11m.js → EzEventModal-D5lX9XuW.js} +2 -2
  6. package/dist/{EzFlow-CQFeY7DL.cjs → EzFlow-B4qRm5KH.cjs} +3 -3
  7. package/dist/{EzFlow-C74NbZA9.js → EzFlow-CEfPykao.js} +278 -278
  8. package/dist/EzKanban-2b9skOep.cjs +2 -0
  9. package/dist/{EzKanban-COcGidzh.js → EzKanban-CpYH8b8g.js} +86 -80
  10. package/dist/{EzLayout-CiaPLniV.js → EzLayout-DFxegglu.js} +30 -24
  11. package/dist/EzLayout-EYOfpFXs.cjs +1 -0
  12. package/dist/{EzScheduler-CjQbi1Na.js → EzScheduler-D7aH4KCY.js} +60 -55
  13. package/dist/EzScheduler-hC9PsLrI.cjs +1 -0
  14. package/dist/{EzSchedulerQuickAdd-BeNfGdWs.cjs → EzSchedulerQuickAdd-BYrV9PQ-.cjs} +1 -1
  15. package/dist/{EzSchedulerQuickAdd-BIC8xbSn.js → EzSchedulerQuickAdd-D0kGTzE3.js} +2 -2
  16. package/dist/{EzSchedulerToolbar-jMw8KB8k.js → EzSchedulerToolbar-BhlCMeOT.js} +2 -2
  17. package/dist/{EzSchedulerToolbar-ihfe-5Yd.cjs → EzSchedulerToolbar-Dy62PVnH.cjs} +1 -1
  18. package/dist/{EzSignature-7UHO5lSP.js → EzSignature-B-CPcf7e.js} +5 -2
  19. package/dist/{EzSignature-Df7UZ-IS.cjs → EzSignature-DcmWBPIL.cjs} +1 -1
  20. package/dist/EzTable-BHyYGv8H.cjs +3 -0
  21. package/dist/{EzTable-D2p1IWHc.js → EzTable-Dyw8LIDD.js} +1270 -1159
  22. package/dist/EzTableEditDialog--8pD39Rp.cjs +1 -0
  23. package/dist/EzTableEditDialog-m0zW6r6z.js +100 -0
  24. package/dist/{EzTableFooter-DrLoWelo.js → EzTableFooter-BuTS3wDK.js} +1 -1
  25. package/dist/{EzTableToolbar-DwuumvWP.cjs → EzTableToolbar-BWjqKfwx.cjs} +1 -1
  26. package/dist/{EzTableToolbar-BH5z9fSJ.js → EzTableToolbar-BiRfKm9d.js} +2 -2
  27. package/dist/{EzTreeView-D1G0Aomc.js → EzTreeView-B2B_Ruwm.js} +37 -37
  28. package/dist/EzTreeView-DLoPKe2i.cjs +1 -0
  29. package/dist/{KanbanBoard-BsZP_PJi.js → KanbanBoard-CRF0-mYa.js} +119 -119
  30. package/dist/{KanbanBoard-C9bjU_gk.cjs → KanbanBoard-DdXD-Zjt.cjs} +1 -1
  31. package/dist/advanced.cjs +2 -2
  32. package/dist/advanced.es.js +30 -29
  33. package/dist/card-NlCLCGFb.cjs +1 -0
  34. package/dist/{card-ZUNxcdIM.js → card-urNaa5h-.js} +1 -1
  35. package/dist/{checkbox-BrCh_Iid.cjs → checkbox-B9yPkCYi.cjs} +1 -1
  36. package/dist/{checkbox-DRkQuB4W.js → checkbox-BTuckDEm.js} +1 -1
  37. package/dist/components/EzTable/EzTableEditDialog.d.ts +1 -1
  38. package/dist/components/EzTable/hooks/useTableFiltering.d.ts +6 -6
  39. package/dist/components/EzTable/hooks/useTableHistory.d.ts +3 -3
  40. package/dist/components/EzTable/hooks/useTableImperative.d.ts +9 -6
  41. package/dist/components/EzTable/hooks/useTableState.d.ts +12 -12
  42. package/dist/components/EzTable/types/EzTableProps.d.ts +9 -1
  43. package/dist/ezux.css +1 -1
  44. package/dist/flow.cjs +1 -1
  45. package/dist/flow.es.js +1 -1
  46. package/dist/index.cjs +2 -2
  47. package/dist/index.es.js +20 -20
  48. package/dist/input-CcRi0LeO.js +14 -0
  49. package/dist/input-DOh8O0iX.cjs +1 -0
  50. package/dist/kanban.cjs +1 -1
  51. package/dist/kanban.es.js +2 -2
  52. package/dist/layout.cjs +1 -1
  53. package/dist/layout.es.js +1 -1
  54. package/dist/mock-services.cjs +1 -1
  55. package/dist/mock-services.es.js +1 -1
  56. package/dist/scheduler.cjs +1 -1
  57. package/dist/scheduler.es.js +1 -1
  58. package/dist/signature.cjs +1 -1
  59. package/dist/signature.es.js +1 -1
  60. package/dist/table.cjs +1 -1
  61. package/dist/table.es.js +1 -1
  62. package/dist/theme-vars.css +25 -5
  63. package/dist/treeview.cjs +1 -1
  64. package/dist/treeview.es.js +1 -1
  65. package/package.json +39 -36
  66. package/dist/EzKanban-DokdXGqQ.cjs +0 -2
  67. package/dist/EzLayout-BGnqFtvO.cjs +0 -1
  68. package/dist/EzScheduler-B8nV1VWY.cjs +0 -1
  69. package/dist/EzTable-CEXvJR1t.cjs +0 -3
  70. package/dist/EzTableEditDialog-BXnnYSSy.cjs +0 -1
  71. package/dist/EzTableEditDialog-Ccd5XoHm.js +0 -84
  72. package/dist/EzTreeView-KMGlU4ax.cjs +0 -1
  73. package/dist/card-CPlRZxbq.cjs +0 -1
  74. package/dist/input-CYlvlbF7.cjs +0 -1
  75. package/dist/input-Cj3sQK3M.js +0 -14
package/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # ezUX | Premium React UI Kit for Enterprise Dashboards
2
2
 
3
+ > **Current release: 1.1.20**
4
+
3
5
  > **High-performance React components** for building modern enterprise applications. Powered by **TanStack** (Table, Query, Virtual) and built with **TypeScript**.
4
6
  >
5
7
  > 🔗 **[View ezux-showcase on GitHub](https://github.com/zee24-cmd/ezux-showcase)** | 🌐 **[Live Showcase](https://ezux-showcase.vercel.app)**
@@ -19,6 +21,7 @@ ezUX is a comprehensive **component library** designed for developers who need t
19
21
  - **Full TypeScript Support**: 100% type-safe components with exported types for a seamless developer experience.
20
22
  - **High-Performance Data Grid**: Handle 100k+ rows with ease using integrated row and column virtualization.
21
23
  - **Modern Styling**: Styled with **Tailwind CSS v4** and CSS variables for easy theming and dark mode support.
24
+ - **Responsive Typography**: Semantic typography tokens, mobile scaling, and touch-friendly controls from mobile to desktop.
22
25
  - **Accessibility (A11Y)**: Built with WAI-ARIA patterns to ensure your **dashboard** is accessible to everyone.
23
26
 
24
27
  ## Core Components
@@ -37,6 +40,8 @@ ezUX is a comprehensive **component library** designed for developers who need t
37
40
 
38
41
  You must have [Tailwind CSS v4](https://tailwindcss.com/docs/installation) installed and configured in your consumer application to use `ezux` components.
39
42
 
43
+ EzUX is developed and typechecked with **TypeScript 7**. Published declarations are validated with a clean **TypeScript 6.0.3** compiler for consumers whose toolchains have not migrated yet. The runtime peer requirements are React 19.2 and React DOM 19.2.
44
+
40
45
  ## Installation
41
46
 
42
47
  ```bash
@@ -95,6 +100,8 @@ function UserDashboard() {
95
100
 
96
101
  Visit the [Live Showcase](https://ezux-showcase.vercel.app) for full documentation and interactive examples.
97
102
 
103
+ Theme colors use semantic CSS variables. **Zinc** is the default theme, with Orange, Blue, Green, and Rose alternatives. Components expose responsive typography utilities such as `ez-text-body`, `ez-text-label`, and `ez-text-caption`; prefer semantic tokens over hardcoded color classes when extending components.
104
+
98
105
  ## License
99
106
 
100
107
  MIT © [Zeeshan Sayed](https://github.com/ezux)
@@ -103,4 +110,3 @@ MIT © [Zeeshan Sayed](https://github.com/ezux)
103
110
 
104
111
  ### Tags & Keywords
105
112
  `react`, `components`, `table`, `scheduler`, `kanban`, `dashboard`, `enterprise`, `ui-kit`, `tanstack`, `typescript`, `react-components`, `data-grid`, `workflow-builder`, `scheduler-component`, `kanban-board`
106
-
@@ -1 +1 @@
1
- const e=require("./EzProvider-L2qQMq-v.cjs"),t=require("./button-BBMwzUtG.cjs"),n=require("./Modal-BmX1C448.cjs"),r=require("./card-CPlRZxbq.cjs");let i=require("react");i=e.y(i,1);let a=require("react/jsx-runtime");var o=({isOpen:e,onClose:i,onConfirm:o,title:s,message:c,description:l})=>{let{t:u}=r.c();return(0,a.jsx)(n.t,{isOpen:e,onClose:i,title:s||u(`confirm_delete`)||`Confirm Delete`,size:`sm`,footer:(0,a.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,a.jsx)(t.t,{variant:`ghost`,onClick:i,children:u(`cancel`)||`Cancel`}),(0,a.jsx)(t.t,{variant:`destructive`,onClick:()=>{o(),i()},children:u(`delete`)||`Delete`})]}),children:(0,a.jsxs)(`div`,{className:`py-2`,children:[(0,a.jsx)(`p`,{children:c||u(`confirm_delete_message`)||`Are you sure you want to delete this item?`}),(l||u(`action_cannot_be_undone`))&&(0,a.jsx)(`p`,{className:`text-sm text-muted-foreground mt-2`,children:l||u(`action_cannot_be_undone`)||`This action cannot be undone.`})]})})};Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return o}});
1
+ const e=require("./EzProvider-L2qQMq-v.cjs"),t=require("./button-BBMwzUtG.cjs"),n=require("./card-NlCLCGFb.cjs"),r=require("./Modal-BmX1C448.cjs");let i=require("react");i=e.y(i,1);let a=require("react/jsx-runtime");var o=({isOpen:e,onClose:i,onConfirm:o,title:s,message:c,description:l})=>{let{t:u}=n.c();return(0,a.jsx)(r.t,{isOpen:e,onClose:i,title:s||u(`confirm_delete`)||`Confirm Delete`,size:`sm`,footer:(0,a.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,a.jsx)(t.t,{variant:`ghost`,onClick:i,children:u(`cancel`)||`Cancel`}),(0,a.jsx)(t.t,{variant:`destructive`,onClick:()=>{o(),i()},children:u(`delete`)||`Delete`})]}),children:(0,a.jsxs)(`div`,{className:`py-2`,children:[(0,a.jsx)(`p`,{children:c||u(`confirm_delete_message`)||`Are you sure you want to delete this item?`}),(l||u(`action_cannot_be_undone`))&&(0,a.jsx)(`p`,{className:`text-sm text-muted-foreground mt-2`,children:l||u(`action_cannot_be_undone`)||`This action cannot be undone.`})]})})};Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return o}});
@@ -1,12 +1,12 @@
1
1
  import { t as e } from "./button-CYyNwV8S.js";
2
- import { t } from "./Modal-CrzpKyjK.js";
3
- import { c as n } from "./card-ZUNxcdIM.js";
2
+ import { c as t } from "./card-urNaa5h-.js";
3
+ import { t as n } from "./Modal-CrzpKyjK.js";
4
4
  import "react";
5
5
  import { jsx as r, jsxs as i } from "react/jsx-runtime";
6
6
  //#region src/shared/components/DeleteConfirmationModal.tsx
7
7
  var a = ({ isOpen: a, onClose: o, onConfirm: s, title: c, message: l, description: u }) => {
8
- let { t: d } = n();
9
- return /* @__PURE__ */ r(t, {
8
+ let { t: d } = t();
9
+ return /* @__PURE__ */ r(n, {
10
10
  isOpen: a,
11
11
  onClose: o,
12
12
  title: c || d("confirm_delete") || "Confirm Delete",
@@ -1 +1 @@
1
- const e=require("./EzProvider-L2qQMq-v.cjs"),t=require("./button-BBMwzUtG.cjs"),n=require("./input-CYlvlbF7.cjs"),r=require("./label-BGgvoZWD.cjs"),i=require("./date-time-picker-D0w0sDgq.cjs");let a=require("react");a=e.y(a,1);let o=require("lucide-react"),s=require("react/jsx-runtime"),c=require("@tanstack/react-form"),l=require("react-dom");var u=e.v({EzEventModal:()=>f}),d=[{label:`S`,value:`SU`},{label:`M`,value:`MO`},{label:`T`,value:`TU`},{label:`W`,value:`WE`},{label:`T`,value:`TH`},{label:`F`,value:`FR`},{label:`S`,value:`SA`}],f=({isOpen:u,onClose:f,mode:p,event:m,onSave:h,onDelete:g,locale:_,slotDuration:v,timeOptions:y,editorTemplate:b,headerTemplate:x,footerTemplate:S,headerFieldsTemplate:C,hiddenFields:w=[]})=>{let T=(0,c.useForm)({defaultValues:{title:m?.title||``,start:m?.start,end:m?.end,resourceIds:m?.resourceIds||(m?.resourceId?[m.resourceId]:[])||[],location:m?.location||``,isAllDay:!!m?.allDay||!!m?.isAllDay||!1,description:m?.description||``,isTimezoneEnabled:!!m?.timezone,startTimezone:m?.timezone?.start||`Asia/Calcutta`,endTimezone:m?.timezone?.end||`Asia/Calcutta`,repeatFrequency:m?.recurrence?.frequency||`Never`,repeatInterval:m?.recurrence?.interval||1,repeatDays:m?.recurrence?.days||[],repeatBy:m?.recurrence?.repeatBy||`day`,repeatEndLevel:m?.recurrence?.end||`Never`,repeatEndCount:m?.recurrence?.endCount||1,repeatEndUntil:m?.recurrence?.endUntil,attachments:m?.attachments||[]},onSubmit:async({value:e})=>{h({...m,title:e.title,start:e.start,end:e.end,resourceId:e.resourceIds[0],resourceIds:e.resourceIds,location:e.location,allDay:e.isAllDay,description:e.description,timezone:e.isTimezoneEnabled?{start:e.startTimezone,end:e.endTimezone}:void 0,recurrence:e.repeatFrequency===`Never`?void 0:{frequency:e.repeatFrequency,interval:e.repeatInterval,unit:e.repeatFrequency.replace(`ly`,``)+`(s)`,end:e.repeatEndLevel,endCount:e.repeatEndLevel===`Count`?e.repeatEndCount:void 0,endUntil:e.repeatEndLevel===`Until`?e.repeatEndUntil:void 0,days:e.repeatFrequency===`Weekly`?e.repeatDays:void 0,repeatBy:e.repeatFrequency===`Monthly`||e.repeatFrequency===`Yearly`?e.repeatBy:void 0},attachments:e.attachments}),f()}});if((0,a.useEffect)(()=>{u&&T.reset()},[u,m,T]),!u)return null;let E=e=>{e?.preventDefault(),e?.stopPropagation(),T.handleSubmit()},D=p===`view`;return(0,l.createPortal)((0,s.jsxs)(`div`,{"data-testid":`ez-event-modal`,style:{position:`fixed`,top:0,left:0,width:`100vw`,height:`100vh`,zIndex:1e4,backgroundColor:`rgba(0, 0, 0, 0.4)`,backdropFilter:`blur(2px)`,pointerEvents:`auto`},children:[(0,s.jsx)(`div`,{style:{position:`absolute`,inset:0},onClick:f}),(0,s.jsxs)(`div`,{className:e._(`bg-background rounded-xl shadow-2xl flex flex-col border border-border overflow-hidden`,`animate-in zoom-in-95 fade-in duration-300 ease-out`),style:{backgroundColor:`white`,width:`650px`,maxWidth:`95vw`,maxHeight:`92vh`,position:`absolute`,top:`50%`,left:`50%`,transform:`translate(-50%, -50%)`,zIndex:10001},children:[(0,s.jsx)(`div`,{className:`flex items-center justify-between shrink-0 bg-background`,style:{padding:`16px 40px`},children:x?x(m||{},p):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(`h2`,{className:`text-xl font-bold tracking-tight text-foreground`,children:[p===`create`&&`New Event`,p===`edit`&&`Edit Event`,p===`view`&&`Event Details`]}),(0,s.jsx)(t.t,{variant:`ghost`,size:`icon`,className:`h-9 w-9 rounded-full hover:bg-muted text-muted-foreground mr-[-8px]`,onClick:f,children:(0,s.jsx)(o.X,{className:`w-5 h-5`})})]})}),b?(0,s.jsx)(`div`,{className:`overflow-y-auto custom-scrollbar flex-1 bg-background`,style:{padding:`8px 40px 32px 40px`},children:b(m||{})}):(0,s.jsxs)(`form`,{onSubmit:E,className:`space-y-6 overflow-y-auto custom-scrollbar flex-1 bg-background`,style:{padding:`8px 40px 32px 40px`},children:[C?.({event:m||{},mode:p,isReadOnly:D}),(0,s.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-6`,children:[(0,s.jsx)(T.Field,{name:`title`,validators:{onChange:({value:e})=>e?void 0:`Title is required`},children:t=>(0,s.jsxs)(`div`,{className:`space-y-2`,children:[(0,s.jsx)(r.t,{htmlFor:`title`,className:`text-[13px] font-semibold text-foreground/70`,children:`Title`}),(0,s.jsx)(n.t,{id:`title`,placeholder:`Add title`,value:t.state.value,onChange:e=>t.handleChange(e.target.value),onBlur:t.handleBlur,disabled:D,className:e._(`h-10 rounded-md border-border focus-visible:border-primary focus-visible:ring-1 focus-visible:ring-primary/20 bg-background transition-all`,t.state.meta.errors.length>0&&`border-destructive focus-visible:border-destructive ring-destructive/20`)}),t.state.meta.errors.length>0&&(0,s.jsx)(`p`,{className:`text-[12px] font-medium text-destructive mt-1.5 animate-in fade-in slide-in-from-top-1`,children:t.state.meta.errors.join(`, `)})]})}),!w.includes(`location`)&&(0,s.jsx)(T.Field,{name:`location`,children:e=>(0,s.jsxs)(`div`,{className:`space-y-2`,children:[(0,s.jsx)(r.t,{htmlFor:`location`,className:`text-[13px] font-semibold text-foreground/70`,children:`Location`}),(0,s.jsx)(n.t,{id:`location`,placeholder:`Add location`,value:e.state.value,onChange:t=>e.handleChange(t.target.value),disabled:D,className:`h-10 rounded-md border-border focus-visible:border-primary focus-visible:ring-1 focus-visible:ring-primary/20 bg-background transition-all`})]})})]}),(0,s.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-6`,children:[(0,s.jsx)(T.Field,{name:`start`,validators:{onChange:({value:e})=>e?void 0:`Start date is required`},children:e=>(0,s.jsxs)(`div`,{className:`space-y-2`,children:[(0,s.jsx)(r.t,{className:`text-[13px] font-semibold text-foreground/70`,children:`Start`}),(0,s.jsx)(i.t,{date:e.state.value,setDate:t=>e.handleChange(t),disabled:D,required:!0,locale:_,mode:T.getFieldValue(`isAllDay`)?`date`:`datetime`,slotDuration:v,timeOptions:y,className:`border-border focus-visible:border-primary focus-visible:ring-1 focus-visible:ring-primary/20`}),e.state.meta.errors.length>0&&(0,s.jsx)(`p`,{className:`text-[12px] font-medium text-destructive mt-1.5`,children:e.state.meta.errors.join(`, `)})]})}),(0,s.jsx)(T.Field,{name:`end`,validators:{onChange:({value:e,fieldApi:t})=>{if(!e)return`End date is required`;let n=t.form.getFieldValue(`start`);if(n&&e<=n)return`End time must be after start time`}},children:t=>(0,s.jsxs)(`div`,{className:`space-y-2`,children:[(0,s.jsx)(r.t,{className:`text-[13px] font-semibold text-foreground/70`,children:`End`}),(0,s.jsx)(i.t,{date:t.state.value,setDate:e=>t.handleChange(e),disabled:D,required:!0,locale:_,mode:T.getFieldValue(`isAllDay`)?`date`:`datetime`,minDate:T.getFieldValue(`start`),slotDuration:v,timeOptions:y,className:e._(`border-border focus-visible:border-primary focus-visible:ring-1 focus-visible:ring-primary/20`,t.state.meta.errors.length>0&&`border-destructive focus-visible:border-destructive ring-destructive/20`)}),t.state.meta.errors.length>0&&(0,s.jsx)(`p`,{className:`text-[12px] font-medium text-destructive mt-1.5 animate-in fade-in slide-in-from-top-1`,children:t.state.meta.errors.join(`, `)})]})})]}),(0,s.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-6`,children:[(0,s.jsx)(T.Field,{name:`isAllDay`,children:e=>(0,s.jsx)(`div`,{className:`flex items-center h-10`,children:(0,s.jsxs)(`label`,{className:`flex items-center space-x-3 cursor-pointer group select-none`,children:[(0,s.jsx)(`input`,{type:`checkbox`,checked:e.state.value,onChange:t=>e.handleChange(t.target.checked),disabled:D,className:`h-4 w-4 rounded border-border/50 text-primary focus:ring-primary/30 accent-primary transition-all cursor-pointer`}),(0,s.jsx)(`span`,{className:`text-[14px] font-medium text-foreground/70 group-hover:text-foreground`,children:`All day event`})]})})}),(0,s.jsx)(T.Field,{name:`isTimezoneEnabled`,children:e=>(0,s.jsx)(`div`,{className:`flex items-center h-10`,children:(0,s.jsxs)(`label`,{className:`flex items-center space-x-3 cursor-pointer group select-none`,children:[(0,s.jsx)(`input`,{type:`checkbox`,checked:e.state.value,onChange:t=>e.handleChange(t.target.checked),disabled:D,className:`h-4 w-4 rounded border-border/50 text-primary focus:ring-primary/30 accent-primary transition-all cursor-pointer`}),(0,s.jsx)(`span`,{className:`text-[14px] font-medium text-foreground/70 group-hover:text-foreground`,children:`Enable timezone`})]})})})]}),(0,s.jsx)(T.Subscribe,{selector:e=>[e.values.isTimezoneEnabled],children:([e])=>e&&(0,s.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-6 p-6 bg-highlight/50 rounded-lg border border-border animate-in slide-in-from-top-2 duration-300`,children:[(0,s.jsx)(T.Field,{name:`startTimezone`,children:e=>(0,s.jsxs)(`div`,{className:`space-y-2`,children:[(0,s.jsx)(r.t,{className:`text-[13px] font-semibold text-foreground/70`,children:`Start Timezone`}),(0,s.jsxs)(`select`,{className:`w-full h-10 px-3 rounded-md border-border bg-background text-sm focus:outline-none focus-visible:ring-1 focus-visible:ring-primary/20 focus-visible:border-primary appearance-none bg-[url('data:image/svg+xml;charset=utf-8,%3Csvg%20xlmns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20fill%3D%27none%27%20viewBox%3D%270%200%2020%2020%27%3E%3Cpath%20stroke%3D%27%236b7280%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%20stroke-width%3D%271.5%27%20d%3D%27m6%208%204%204%204-4%27%2F%3E%3C%2Fsvg%3E')] bg-[length:20px] bg-[right_8px_center] bg-no-repeat transition-all`,value:e.state.value,onChange:t=>e.handleChange(t.target.value),children:[(0,s.jsx)(`option`,{value:`Asia/Calcutta`,children:`Asia/Calcutta`}),(0,s.jsx)(`option`,{value:`UTC`,children:`UTC`}),(0,s.jsx)(`option`,{value:`America/New_York`,children:`America/New_York`})]})]})}),(0,s.jsx)(T.Field,{name:`endTimezone`,children:e=>(0,s.jsxs)(`div`,{className:`space-y-2`,children:[(0,s.jsx)(r.t,{className:`text-[13px] font-semibold text-foreground/70`,children:`End Timezone`}),(0,s.jsxs)(`select`,{className:`w-full h-10 px-3 rounded-md border-border bg-background text-sm focus:outline-none focus-visible:ring-1 focus-visible:ring-primary/20 focus-visible:border-primary appearance-none bg-[url('data:image/svg+xml;charset=utf-8,%3Csvg%20xlmns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20fill%3D%27none%27%20viewBox%3D%270%200%2020%2020%27%3E%3Cpath%20stroke%3D%27%236b7280%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%20stroke-width%3D%271.5%27%20d%3D%27m6%208%204%204%204-4%27%2F%3E%3C%2Fsvg%3E')] bg-[length:20px] bg-[right_8px_center] bg-no-repeat transition-all`,value:e.state.value,onChange:t=>e.handleChange(t.target.value),children:[(0,s.jsx)(`option`,{value:`Asia/Calcutta`,children:`Asia/Calcutta`}),(0,s.jsx)(`option`,{value:`UTC`,children:`UTC`}),(0,s.jsx)(`option`,{value:`America/New_York`,children:`America/New_York`})]})]})})]})}),(0,s.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-6`,children:[(0,s.jsx)(T.Field,{name:`repeatFrequency`,children:e=>(0,s.jsxs)(`div`,{className:`space-y-2`,children:[(0,s.jsx)(r.t,{className:`text-[13px] font-semibold text-foreground/70`,children:`Repeat`}),(0,s.jsxs)(`select`,{className:`w-full h-10 px-3 rounded-md border-border bg-background text-sm focus:outline-none focus-visible:ring-1 focus-visible:ring-primary/20 focus-visible:border-primary appearance-none bg-[url('data:image/svg+xml;charset=utf-8,%3Csvg%20xlmns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20fill%3D%27none%27%20viewBox%3D%270%200%2020%2020%27%3E%3Cpath%20stroke%3D%27%236b7280%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%20stroke-width%3D%271.5%27%20d%3D%27m6%208%204%204%204-4%27%2F%3E%3C%2Fsvg%3E')] bg-[length:20px] bg-[right_8px_center] bg-no-repeat transition-all`,value:e.state.value,onChange:t=>e.handleChange(t.target.value),children:[(0,s.jsx)(`option`,{value:`Never`,children:`Never`}),(0,s.jsx)(`option`,{value:`Daily`,children:`Daily`}),(0,s.jsx)(`option`,{value:`Weekly`,children:`Weekly`}),(0,s.jsx)(`option`,{value:`Monthly`,children:`Monthly`}),(0,s.jsx)(`option`,{value:`Yearly`,children:`Yearly`})]})]})}),(0,s.jsx)(T.Subscribe,{selector:e=>[e.values.repeatFrequency],children:([e])=>e!==`Never`&&(0,s.jsx)(T.Field,{name:`repeatEndLevel`,children:e=>(0,s.jsxs)(`div`,{className:`space-y-2 animate-in slide-in-from-top-2 duration-300`,children:[(0,s.jsx)(r.t,{className:`text-[13px] font-semibold text-foreground/70`,children:`End`}),(0,s.jsxs)(`select`,{className:`w-full h-10 px-3 rounded-md border-border bg-background text-sm focus:outline-none focus-visible:ring-1 focus-visible:ring-primary/20 focus-visible:border-primary appearance-none bg-[url('data:image/svg+xml;charset=utf-8,%3Csvg%20xlmns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20fill%3D%27none%27%20viewBox%3D%270%200%2020%2020%27%3E%3Cpath%20stroke%3D%27%236b7280%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%20stroke-width%3D%271.5%27%20d%3D%27m6%208%204%204%204-4%27%2F%3E%3C%2Fsvg%3E')] bg-[length:20px] bg-[right_8px_center] bg-no-repeat transition-all`,value:e.state.value,onChange:t=>e.handleChange(t.target.value),children:[(0,s.jsx)(`option`,{value:`Never`,children:`Never`}),(0,s.jsx)(`option`,{value:`Until`,children:`Until`}),(0,s.jsx)(`option`,{value:`Count`,children:`Count`})]})]})})})]}),(0,s.jsx)(T.Subscribe,{selector:e=>[e.values.repeatFrequency,e.values.repeatEndLevel],children:([e,t])=>e!==`Never`&&(0,s.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-6 animate-in slide-in-from-top-2 duration-300`,children:[(0,s.jsx)(T.Field,{name:`repeatInterval`,children:t=>(0,s.jsxs)(`div`,{className:`space-y-2`,children:[(0,s.jsx)(r.t,{className:`text-[13px] font-semibold text-foreground/70`,children:`Repeat every`}),(0,s.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,s.jsx)(`select`,{className:`flex-1 h-10 px-3 rounded-md border-border bg-background text-sm focus:outline-none focus-visible:ring-1 focus-visible:ring-primary/20 focus-visible:border-primary appearance-none bg-[url('data:image/svg+xml;charset=utf-8,%3Csvg%20xlmns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20fill%3D%27none%27%20viewBox%3D%270%200%2020%2020%27%3E%3Cpath%20stroke%3D%27%236b7280%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%20stroke-width%3D%271.5%27%20d%3D%27m6%208%204%204%204-4%27%2F%3E%3C%2Fsvg%3E')] bg-[length:20px] bg-[right_8px_center] bg-no-repeat transition-all`,value:t.state.value,onChange:e=>t.handleChange(parseInt(e.target.value)),children:[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,20,30].map(e=>(0,s.jsx)(`option`,{value:e,children:e},e))}),(0,s.jsx)(`span`,{className:`text-sm font-medium text-muted-foreground whitespace-nowrap`,children:e===`Daily`?`Day(s)`:e.replace(`ly`,``)+`(s)`})]})]})}),t===`Until`&&(0,s.jsx)(T.Field,{name:`repeatEndUntil`,children:e=>(0,s.jsxs)(`div`,{className:`space-y-2 animate-in slide-in-from-top-1`,children:[(0,s.jsx)(r.t,{className:`text-[13px] font-semibold text-foreground/70`,children:`Until`}),(0,s.jsx)(i.t,{date:e.state.value,setDate:t=>e.handleChange(t),disabled:D,locale:_,mode:`date`,minDate:T.getFieldValue(`start`),slotDuration:v,timeOptions:y,className:`border-border focus:border-primary`})]})}),t===`Count`&&(0,s.jsx)(T.Field,{name:`repeatEndCount`,children:e=>(0,s.jsxs)(`div`,{className:`space-y-2 animate-in slide-in-from-top-1`,children:[(0,s.jsx)(r.t,{className:`text-[13px] font-semibold text-foreground/70`,children:`Occurrences`}),(0,s.jsx)(n.t,{type:`number`,min:1,value:e.state.value,onChange:t=>e.handleChange(parseInt(t.target.value)),className:`h-10 rounded-md border-border focus-visible:border-primary focus-visible:ring-1 focus-visible:ring-primary/20 bg-background transition-all`})]})})]})}),(0,s.jsx)(T.Subscribe,{selector:e=>[e.values.repeatFrequency],children:([t])=>t===`Weekly`&&(0,s.jsx)(T.Field,{name:`repeatDays`,children:t=>(0,s.jsxs)(`div`,{className:`space-y-3 animate-in fade-in duration-300`,children:[(0,s.jsx)(r.t,{className:`text-[13px] font-semibold text-foreground/70`,children:`Repeat On`}),(0,s.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:d.map(n=>(0,s.jsx)(`button`,{type:`button`,onClick:()=>{let e=t.state.value||[];e.includes(n.value)?t.handleChange(e.filter(e=>e!==n.value)):t.handleChange([...e,n.value])},className:e._(`w-9 h-9 rounded-full flex items-center justify-center text-sm font-bold transition-all border`,(t.state.value||[]).includes(n.value)?`bg-primary text-white border-primary shadow-sm`:`bg-background text-foreground/60 border-border/60 hover:border-primary/40 hover:text-primary`),children:n.label},n.value))})]})})}),(0,s.jsx)(T.Subscribe,{selector:e=>[e.values.repeatFrequency],children:([e])=>(e===`Monthly`||e===`Yearly`)&&(0,s.jsx)(T.Field,{name:`repeatBy`,children:e=>(0,s.jsxs)(`div`,{className:`space-y-4 animate-in fade-in duration-300`,children:[(0,s.jsx)(r.t,{className:`text-[13px] font-semibold text-foreground/70`,children:`Repeat On`}),(0,s.jsxs)(`div`,{className:`space-y-3`,children:[(0,s.jsxs)(`label`,{className:`flex items-center space-x-3 cursor-pointer group`,children:[(0,s.jsx)(`input`,{type:`radio`,name:`repeatBy`,checked:e.state.value===`day`,onChange:()=>e.handleChange(`day`),className:`h-4 w-4 border-border text-primary focus:ring-primary`}),(0,s.jsx)(`span`,{className:`text-sm text-foreground/80`,children:`Day of the month`})]}),(0,s.jsxs)(`label`,{className:`flex items-center space-x-3 cursor-pointer group`,children:[(0,s.jsx)(`input`,{type:`radio`,name:`repeatBy`,checked:e.state.value===`ordinal`,onChange:()=>e.handleChange(`ordinal`),className:`h-4 w-4 border-border text-primary focus:ring-primary`}),(0,s.jsx)(`span`,{className:`text-sm text-foreground/80`,children:`Ordinal position`})]})]})]})})}),(0,s.jsx)(T.Field,{name:`description`,children:e=>(0,s.jsxs)(`div`,{className:`space-y-2`,children:[(0,s.jsx)(r.t,{htmlFor:`description`,className:`text-[13px] font-semibold text-foreground/70`,children:`Description`}),(0,s.jsx)(`textarea`,{id:`description`,placeholder:`Add description`,className:`flex min-h-[100px] w-full rounded-md border-border bg-background px-4 py-3 text-sm placeholder:text-muted-foreground focus:outline-none focus-visible:ring-1 focus-visible:ring-primary/20 focus-visible:border-primary disabled:cursor-not-allowed disabled:opacity-50 resize-none transition-all hover:border-border`,value:e.state.value,onChange:t=>e.handleChange(t.target.value),disabled:D})]})}),(0,s.jsx)(T.Field,{name:`attachments`,children:e=>(0,s.jsxs)(`div`,{className:`space-y-4 pt-4 pb-2`,children:[(0,s.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,s.jsxs)(r.t,{className:`text-[13px] font-semibold text-foreground/70 flex items-center gap-2`,children:[(0,s.jsx)(o.Paperclip,{className:`w-4 h-4`}),` Attachments`]}),(0,s.jsx)(`input`,{type:`file`,id:`file-upload`,multiple:!0,className:`hidden`,onChange:t=>{t.target.files&&e.handleChange([...e.state.value||[],...Array.from(t.target.files)])}}),(0,s.jsxs)(t.t,{type:`button`,variant:`outline`,size:`sm`,className:`h-8 text-xs font-semibold gap-2 border-dashed border-border/50 hover:border-primary/40 hover:text-primary transition-all`,onClick:()=>document.getElementById(`file-upload`)?.click(),children:[(0,s.jsx)(o.Paperclip,{className:`w-3 h-3`}),` Add Files`]})]}),(e.state.value||[]).length>0&&(0,s.jsx)(`div`,{className:`grid grid-cols-1 gap-3`,children:(e.state.value||[]).map((n,r)=>(0,s.jsxs)(`div`,{className:`flex items-center justify-between p-3 rounded-lg bg-highlight border border-border group hover:border-border transition-all`,children:[(0,s.jsxs)(`div`,{className:`flex items-center gap-3 overflow-hidden`,children:[(0,s.jsx)(`div`,{className:`w-9 h-9 rounded-md bg-white border border-border flex items-center justify-center shrink-0 shadow-sm`,children:(0,s.jsx)(o.Paperclip,{className:`w-4 h-4 text-muted-foreground`})}),(0,s.jsxs)(`div`,{className:`flex flex-col overflow-hidden`,children:[(0,s.jsx)(`span`,{className:`text-[13px] font-medium text-foreground truncate`,children:n.name}),(0,s.jsx)(`span`,{className:`text-[11px] text-muted-foreground font-medium`,children:typeof n.size==`number`?`${(n.size/1024).toFixed(1)} KB`:`Attachment`})]})]}),(0,s.jsx)(t.t,{type:`button`,variant:`ghost`,size:`icon`,className:`h-8 w-8 text-muted-foreground/50 hover:text-destructive hover:bg-destructive/10 opacity-0 group-hover:opacity-100 transition-all`,onClick:()=>e.handleChange((e.state.value||[]).filter((e,t)=>t!==r)),children:(0,s.jsx)(o.Trash2,{className:`w-4 h-4`})})]},r))})]})})]}),S?S(m||{},p,()=>E(),f):(0,s.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`flex-end`,padding:`24px 40px`,backgroundColor:`var(--highlight)`,gap:`12px`,width:`100%`,flexShrink:0},children:[!D&&g&&p===`edit`&&(0,s.jsx)(t.t,{type:`button`,variant:`ghost`,className:`text-destructive hover:bg-destructive/10 hover:text-destructive h-10 px-5 font-bold mr-auto`,onClick:()=>{g(m?.id),f()},children:`Delete`}),(0,s.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`12px`},children:[!D&&(0,s.jsx)(T.Subscribe,{selector:e=>[e.canSubmit,e.isSubmitting],children:([e,n])=>(0,s.jsx)(t.t,{type:`submit`,variant:`default`,className:`h-10 px-10 font-bold rounded-md shrink-0 flex items-center justify-center transition-all hover:opacity-90`,style:{minWidth:`120px`},disabled:!e||n,onClick:e=>{e.preventDefault(),e.stopPropagation(),T.handleSubmit()},children:n?`Saving...`:`Save`})}),(0,s.jsx)(t.t,{type:`button`,variant:`outline`,className:`h-10 px-8 font-bold border border-border hover:bg-highlight text-foreground shrink-0 rounded-md transition-all`,style:{minWidth:`100px`},onClick:f,children:`Cancel`})]})]})]})]}),document.body)};Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return f}});
1
+ const e=require("./EzProvider-L2qQMq-v.cjs"),t=require("./button-BBMwzUtG.cjs"),n=require("./input-DOh8O0iX.cjs"),r=require("./label-BGgvoZWD.cjs"),i=require("./date-time-picker-D0w0sDgq.cjs");let a=require("react");a=e.y(a,1);let o=require("lucide-react"),s=require("react/jsx-runtime"),c=require("@tanstack/react-form"),l=require("react-dom");var u=e.v({EzEventModal:()=>f}),d=[{label:`S`,value:`SU`},{label:`M`,value:`MO`},{label:`T`,value:`TU`},{label:`W`,value:`WE`},{label:`T`,value:`TH`},{label:`F`,value:`FR`},{label:`S`,value:`SA`}],f=({isOpen:u,onClose:f,mode:p,event:m,onSave:h,onDelete:g,locale:_,slotDuration:v,timeOptions:y,editorTemplate:b,headerTemplate:x,footerTemplate:S,headerFieldsTemplate:C,hiddenFields:w=[]})=>{let T=(0,c.useForm)({defaultValues:{title:m?.title||``,start:m?.start,end:m?.end,resourceIds:m?.resourceIds||(m?.resourceId?[m.resourceId]:[])||[],location:m?.location||``,isAllDay:!!m?.allDay||!!m?.isAllDay||!1,description:m?.description||``,isTimezoneEnabled:!!m?.timezone,startTimezone:m?.timezone?.start||`Asia/Calcutta`,endTimezone:m?.timezone?.end||`Asia/Calcutta`,repeatFrequency:m?.recurrence?.frequency||`Never`,repeatInterval:m?.recurrence?.interval||1,repeatDays:m?.recurrence?.days||[],repeatBy:m?.recurrence?.repeatBy||`day`,repeatEndLevel:m?.recurrence?.end||`Never`,repeatEndCount:m?.recurrence?.endCount||1,repeatEndUntil:m?.recurrence?.endUntil,attachments:m?.attachments||[]},onSubmit:async({value:e})=>{h({...m,title:e.title,start:e.start,end:e.end,resourceId:e.resourceIds[0],resourceIds:e.resourceIds,location:e.location,allDay:e.isAllDay,description:e.description,timezone:e.isTimezoneEnabled?{start:e.startTimezone,end:e.endTimezone}:void 0,recurrence:e.repeatFrequency===`Never`?void 0:{frequency:e.repeatFrequency,interval:e.repeatInterval,unit:e.repeatFrequency.replace(`ly`,``)+`(s)`,end:e.repeatEndLevel,endCount:e.repeatEndLevel===`Count`?e.repeatEndCount:void 0,endUntil:e.repeatEndLevel===`Until`?e.repeatEndUntil:void 0,days:e.repeatFrequency===`Weekly`?e.repeatDays:void 0,repeatBy:e.repeatFrequency===`Monthly`||e.repeatFrequency===`Yearly`?e.repeatBy:void 0},attachments:e.attachments}),f()}});if((0,a.useEffect)(()=>{u&&T.reset()},[u,m,T]),!u)return null;let E=e=>{e?.preventDefault(),e?.stopPropagation(),T.handleSubmit()},D=p===`view`;return(0,l.createPortal)((0,s.jsxs)(`div`,{"data-testid":`ez-event-modal`,style:{position:`fixed`,top:0,left:0,width:`100vw`,height:`100vh`,zIndex:1e4,backgroundColor:`rgba(0, 0, 0, 0.4)`,backdropFilter:`blur(2px)`,pointerEvents:`auto`},children:[(0,s.jsx)(`div`,{style:{position:`absolute`,inset:0},onClick:f}),(0,s.jsxs)(`div`,{className:e._(`bg-background rounded-xl shadow-2xl flex flex-col border border-border overflow-hidden`,`animate-in zoom-in-95 fade-in duration-300 ease-out`),style:{backgroundColor:`white`,width:`650px`,maxWidth:`95vw`,maxHeight:`92vh`,position:`absolute`,top:`50%`,left:`50%`,transform:`translate(-50%, -50%)`,zIndex:10001},children:[(0,s.jsx)(`div`,{className:`flex items-center justify-between shrink-0 bg-background`,style:{padding:`16px 40px`},children:x?x(m||{},p):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(`h2`,{className:`text-xl font-bold tracking-tight text-foreground`,children:[p===`create`&&`New Event`,p===`edit`&&`Edit Event`,p===`view`&&`Event Details`]}),(0,s.jsx)(t.t,{variant:`ghost`,size:`icon`,className:`h-9 w-9 rounded-full hover:bg-muted text-muted-foreground mr-[-8px]`,onClick:f,children:(0,s.jsx)(o.X,{className:`w-5 h-5`})})]})}),b?(0,s.jsx)(`div`,{className:`overflow-y-auto custom-scrollbar flex-1 bg-background`,style:{padding:`8px 40px 32px 40px`},children:b(m||{})}):(0,s.jsxs)(`form`,{onSubmit:E,className:`space-y-6 overflow-y-auto custom-scrollbar flex-1 bg-background`,style:{padding:`8px 40px 32px 40px`},children:[C?.({event:m||{},mode:p,isReadOnly:D}),(0,s.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-6`,children:[(0,s.jsx)(T.Field,{name:`title`,validators:{onChange:({value:e})=>e?void 0:`Title is required`},children:t=>(0,s.jsxs)(`div`,{className:`space-y-2`,children:[(0,s.jsx)(r.t,{htmlFor:`title`,className:`text-[13px] font-semibold text-foreground/70`,children:`Title`}),(0,s.jsx)(n.t,{id:`title`,placeholder:`Add title`,value:t.state.value,onChange:e=>t.handleChange(e.target.value),onBlur:t.handleBlur,disabled:D,className:e._(`h-10 rounded-md border-border focus-visible:border-primary focus-visible:ring-1 focus-visible:ring-primary/20 bg-background transition-all`,t.state.meta.errors.length>0&&`border-destructive focus-visible:border-destructive ring-destructive/20`)}),t.state.meta.errors.length>0&&(0,s.jsx)(`p`,{className:`text-[12px] font-medium text-destructive mt-1.5 animate-in fade-in slide-in-from-top-1`,children:t.state.meta.errors.join(`, `)})]})}),!w.includes(`location`)&&(0,s.jsx)(T.Field,{name:`location`,children:e=>(0,s.jsxs)(`div`,{className:`space-y-2`,children:[(0,s.jsx)(r.t,{htmlFor:`location`,className:`text-[13px] font-semibold text-foreground/70`,children:`Location`}),(0,s.jsx)(n.t,{id:`location`,placeholder:`Add location`,value:e.state.value,onChange:t=>e.handleChange(t.target.value),disabled:D,className:`h-10 rounded-md border-border focus-visible:border-primary focus-visible:ring-1 focus-visible:ring-primary/20 bg-background transition-all`})]})})]}),(0,s.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-6`,children:[(0,s.jsx)(T.Field,{name:`start`,validators:{onChange:({value:e})=>e?void 0:`Start date is required`},children:e=>(0,s.jsxs)(`div`,{className:`space-y-2`,children:[(0,s.jsx)(r.t,{className:`text-[13px] font-semibold text-foreground/70`,children:`Start`}),(0,s.jsx)(i.t,{date:e.state.value,setDate:t=>e.handleChange(t),disabled:D,required:!0,locale:_,mode:T.getFieldValue(`isAllDay`)?`date`:`datetime`,slotDuration:v,timeOptions:y,className:`border-border focus-visible:border-primary focus-visible:ring-1 focus-visible:ring-primary/20`}),e.state.meta.errors.length>0&&(0,s.jsx)(`p`,{className:`text-[12px] font-medium text-destructive mt-1.5`,children:e.state.meta.errors.join(`, `)})]})}),(0,s.jsx)(T.Field,{name:`end`,validators:{onChange:({value:e,fieldApi:t})=>{if(!e)return`End date is required`;let n=t.form.getFieldValue(`start`);if(n&&e<=n)return`End time must be after start time`}},children:t=>(0,s.jsxs)(`div`,{className:`space-y-2`,children:[(0,s.jsx)(r.t,{className:`text-[13px] font-semibold text-foreground/70`,children:`End`}),(0,s.jsx)(i.t,{date:t.state.value,setDate:e=>t.handleChange(e),disabled:D,required:!0,locale:_,mode:T.getFieldValue(`isAllDay`)?`date`:`datetime`,minDate:T.getFieldValue(`start`),slotDuration:v,timeOptions:y,className:e._(`border-border focus-visible:border-primary focus-visible:ring-1 focus-visible:ring-primary/20`,t.state.meta.errors.length>0&&`border-destructive focus-visible:border-destructive ring-destructive/20`)}),t.state.meta.errors.length>0&&(0,s.jsx)(`p`,{className:`text-[12px] font-medium text-destructive mt-1.5 animate-in fade-in slide-in-from-top-1`,children:t.state.meta.errors.join(`, `)})]})})]}),(0,s.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-6`,children:[(0,s.jsx)(T.Field,{name:`isAllDay`,children:e=>(0,s.jsx)(`div`,{className:`flex items-center h-10`,children:(0,s.jsxs)(`label`,{className:`flex items-center space-x-3 cursor-pointer group select-none`,children:[(0,s.jsx)(`input`,{type:`checkbox`,checked:e.state.value,onChange:t=>e.handleChange(t.target.checked),disabled:D,className:`h-4 w-4 rounded border-border/50 text-primary focus:ring-primary/30 accent-primary transition-all cursor-pointer`}),(0,s.jsx)(`span`,{className:`text-[14px] font-medium text-foreground/70 group-hover:text-foreground`,children:`All day event`})]})})}),(0,s.jsx)(T.Field,{name:`isTimezoneEnabled`,children:e=>(0,s.jsx)(`div`,{className:`flex items-center h-10`,children:(0,s.jsxs)(`label`,{className:`flex items-center space-x-3 cursor-pointer group select-none`,children:[(0,s.jsx)(`input`,{type:`checkbox`,checked:e.state.value,onChange:t=>e.handleChange(t.target.checked),disabled:D,className:`h-4 w-4 rounded border-border/50 text-primary focus:ring-primary/30 accent-primary transition-all cursor-pointer`}),(0,s.jsx)(`span`,{className:`text-[14px] font-medium text-foreground/70 group-hover:text-foreground`,children:`Enable timezone`})]})})})]}),(0,s.jsx)(T.Subscribe,{selector:e=>[e.values.isTimezoneEnabled],children:([e])=>e&&(0,s.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-6 p-6 bg-highlight/50 rounded-lg border border-border animate-in slide-in-from-top-2 duration-300`,children:[(0,s.jsx)(T.Field,{name:`startTimezone`,children:e=>(0,s.jsxs)(`div`,{className:`space-y-2`,children:[(0,s.jsx)(r.t,{className:`text-[13px] font-semibold text-foreground/70`,children:`Start Timezone`}),(0,s.jsxs)(`select`,{className:`w-full h-10 px-3 rounded-md border-border bg-background text-sm focus:outline-none focus-visible:ring-1 focus-visible:ring-primary/20 focus-visible:border-primary appearance-none bg-[url('data:image/svg+xml;charset=utf-8,%3Csvg%20xlmns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20fill%3D%27none%27%20viewBox%3D%270%200%2020%2020%27%3E%3Cpath%20stroke%3D%27%236b7280%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%20stroke-width%3D%271.5%27%20d%3D%27m6%208%204%204%204-4%27%2F%3E%3C%2Fsvg%3E')] bg-[length:20px] bg-[right_8px_center] bg-no-repeat transition-all`,value:e.state.value,onChange:t=>e.handleChange(t.target.value),children:[(0,s.jsx)(`option`,{value:`Asia/Calcutta`,children:`Asia/Calcutta`}),(0,s.jsx)(`option`,{value:`UTC`,children:`UTC`}),(0,s.jsx)(`option`,{value:`America/New_York`,children:`America/New_York`})]})]})}),(0,s.jsx)(T.Field,{name:`endTimezone`,children:e=>(0,s.jsxs)(`div`,{className:`space-y-2`,children:[(0,s.jsx)(r.t,{className:`text-[13px] font-semibold text-foreground/70`,children:`End Timezone`}),(0,s.jsxs)(`select`,{className:`w-full h-10 px-3 rounded-md border-border bg-background text-sm focus:outline-none focus-visible:ring-1 focus-visible:ring-primary/20 focus-visible:border-primary appearance-none bg-[url('data:image/svg+xml;charset=utf-8,%3Csvg%20xlmns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20fill%3D%27none%27%20viewBox%3D%270%200%2020%2020%27%3E%3Cpath%20stroke%3D%27%236b7280%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%20stroke-width%3D%271.5%27%20d%3D%27m6%208%204%204%204-4%27%2F%3E%3C%2Fsvg%3E')] bg-[length:20px] bg-[right_8px_center] bg-no-repeat transition-all`,value:e.state.value,onChange:t=>e.handleChange(t.target.value),children:[(0,s.jsx)(`option`,{value:`Asia/Calcutta`,children:`Asia/Calcutta`}),(0,s.jsx)(`option`,{value:`UTC`,children:`UTC`}),(0,s.jsx)(`option`,{value:`America/New_York`,children:`America/New_York`})]})]})})]})}),(0,s.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-6`,children:[(0,s.jsx)(T.Field,{name:`repeatFrequency`,children:e=>(0,s.jsxs)(`div`,{className:`space-y-2`,children:[(0,s.jsx)(r.t,{className:`text-[13px] font-semibold text-foreground/70`,children:`Repeat`}),(0,s.jsxs)(`select`,{className:`w-full h-10 px-3 rounded-md border-border bg-background text-sm focus:outline-none focus-visible:ring-1 focus-visible:ring-primary/20 focus-visible:border-primary appearance-none bg-[url('data:image/svg+xml;charset=utf-8,%3Csvg%20xlmns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20fill%3D%27none%27%20viewBox%3D%270%200%2020%2020%27%3E%3Cpath%20stroke%3D%27%236b7280%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%20stroke-width%3D%271.5%27%20d%3D%27m6%208%204%204%204-4%27%2F%3E%3C%2Fsvg%3E')] bg-[length:20px] bg-[right_8px_center] bg-no-repeat transition-all`,value:e.state.value,onChange:t=>e.handleChange(t.target.value),children:[(0,s.jsx)(`option`,{value:`Never`,children:`Never`}),(0,s.jsx)(`option`,{value:`Daily`,children:`Daily`}),(0,s.jsx)(`option`,{value:`Weekly`,children:`Weekly`}),(0,s.jsx)(`option`,{value:`Monthly`,children:`Monthly`}),(0,s.jsx)(`option`,{value:`Yearly`,children:`Yearly`})]})]})}),(0,s.jsx)(T.Subscribe,{selector:e=>[e.values.repeatFrequency],children:([e])=>e!==`Never`&&(0,s.jsx)(T.Field,{name:`repeatEndLevel`,children:e=>(0,s.jsxs)(`div`,{className:`space-y-2 animate-in slide-in-from-top-2 duration-300`,children:[(0,s.jsx)(r.t,{className:`text-[13px] font-semibold text-foreground/70`,children:`End`}),(0,s.jsxs)(`select`,{className:`w-full h-10 px-3 rounded-md border-border bg-background text-sm focus:outline-none focus-visible:ring-1 focus-visible:ring-primary/20 focus-visible:border-primary appearance-none bg-[url('data:image/svg+xml;charset=utf-8,%3Csvg%20xlmns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20fill%3D%27none%27%20viewBox%3D%270%200%2020%2020%27%3E%3Cpath%20stroke%3D%27%236b7280%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%20stroke-width%3D%271.5%27%20d%3D%27m6%208%204%204%204-4%27%2F%3E%3C%2Fsvg%3E')] bg-[length:20px] bg-[right_8px_center] bg-no-repeat transition-all`,value:e.state.value,onChange:t=>e.handleChange(t.target.value),children:[(0,s.jsx)(`option`,{value:`Never`,children:`Never`}),(0,s.jsx)(`option`,{value:`Until`,children:`Until`}),(0,s.jsx)(`option`,{value:`Count`,children:`Count`})]})]})})})]}),(0,s.jsx)(T.Subscribe,{selector:e=>[e.values.repeatFrequency,e.values.repeatEndLevel],children:([e,t])=>e!==`Never`&&(0,s.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-6 animate-in slide-in-from-top-2 duration-300`,children:[(0,s.jsx)(T.Field,{name:`repeatInterval`,children:t=>(0,s.jsxs)(`div`,{className:`space-y-2`,children:[(0,s.jsx)(r.t,{className:`text-[13px] font-semibold text-foreground/70`,children:`Repeat every`}),(0,s.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,s.jsx)(`select`,{className:`flex-1 h-10 px-3 rounded-md border-border bg-background text-sm focus:outline-none focus-visible:ring-1 focus-visible:ring-primary/20 focus-visible:border-primary appearance-none bg-[url('data:image/svg+xml;charset=utf-8,%3Csvg%20xlmns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20fill%3D%27none%27%20viewBox%3D%270%200%2020%2020%27%3E%3Cpath%20stroke%3D%27%236b7280%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%20stroke-width%3D%271.5%27%20d%3D%27m6%208%204%204%204-4%27%2F%3E%3C%2Fsvg%3E')] bg-[length:20px] bg-[right_8px_center] bg-no-repeat transition-all`,value:t.state.value,onChange:e=>t.handleChange(parseInt(e.target.value)),children:[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,20,30].map(e=>(0,s.jsx)(`option`,{value:e,children:e},e))}),(0,s.jsx)(`span`,{className:`text-sm font-medium text-muted-foreground whitespace-nowrap`,children:e===`Daily`?`Day(s)`:e.replace(`ly`,``)+`(s)`})]})]})}),t===`Until`&&(0,s.jsx)(T.Field,{name:`repeatEndUntil`,children:e=>(0,s.jsxs)(`div`,{className:`space-y-2 animate-in slide-in-from-top-1`,children:[(0,s.jsx)(r.t,{className:`text-[13px] font-semibold text-foreground/70`,children:`Until`}),(0,s.jsx)(i.t,{date:e.state.value,setDate:t=>e.handleChange(t),disabled:D,locale:_,mode:`date`,minDate:T.getFieldValue(`start`),slotDuration:v,timeOptions:y,className:`border-border focus:border-primary`})]})}),t===`Count`&&(0,s.jsx)(T.Field,{name:`repeatEndCount`,children:e=>(0,s.jsxs)(`div`,{className:`space-y-2 animate-in slide-in-from-top-1`,children:[(0,s.jsx)(r.t,{className:`text-[13px] font-semibold text-foreground/70`,children:`Occurrences`}),(0,s.jsx)(n.t,{type:`number`,min:1,value:e.state.value,onChange:t=>e.handleChange(parseInt(t.target.value)),className:`h-10 rounded-md border-border focus-visible:border-primary focus-visible:ring-1 focus-visible:ring-primary/20 bg-background transition-all`})]})})]})}),(0,s.jsx)(T.Subscribe,{selector:e=>[e.values.repeatFrequency],children:([t])=>t===`Weekly`&&(0,s.jsx)(T.Field,{name:`repeatDays`,children:t=>(0,s.jsxs)(`div`,{className:`space-y-3 animate-in fade-in duration-300`,children:[(0,s.jsx)(r.t,{className:`text-[13px] font-semibold text-foreground/70`,children:`Repeat On`}),(0,s.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:d.map(n=>(0,s.jsx)(`button`,{type:`button`,onClick:()=>{let e=t.state.value||[];e.includes(n.value)?t.handleChange(e.filter(e=>e!==n.value)):t.handleChange([...e,n.value])},className:e._(`w-9 h-9 rounded-full flex items-center justify-center text-sm font-bold transition-all border`,(t.state.value||[]).includes(n.value)?`bg-primary text-white border-primary shadow-sm`:`bg-background text-foreground/60 border-border/60 hover:border-primary/40 hover:text-primary`),children:n.label},n.value))})]})})}),(0,s.jsx)(T.Subscribe,{selector:e=>[e.values.repeatFrequency],children:([e])=>(e===`Monthly`||e===`Yearly`)&&(0,s.jsx)(T.Field,{name:`repeatBy`,children:e=>(0,s.jsxs)(`div`,{className:`space-y-4 animate-in fade-in duration-300`,children:[(0,s.jsx)(r.t,{className:`text-[13px] font-semibold text-foreground/70`,children:`Repeat On`}),(0,s.jsxs)(`div`,{className:`space-y-3`,children:[(0,s.jsxs)(`label`,{className:`flex items-center space-x-3 cursor-pointer group`,children:[(0,s.jsx)(`input`,{type:`radio`,name:`repeatBy`,checked:e.state.value===`day`,onChange:()=>e.handleChange(`day`),className:`h-4 w-4 border-border text-primary focus:ring-primary`}),(0,s.jsx)(`span`,{className:`text-sm text-foreground/80`,children:`Day of the month`})]}),(0,s.jsxs)(`label`,{className:`flex items-center space-x-3 cursor-pointer group`,children:[(0,s.jsx)(`input`,{type:`radio`,name:`repeatBy`,checked:e.state.value===`ordinal`,onChange:()=>e.handleChange(`ordinal`),className:`h-4 w-4 border-border text-primary focus:ring-primary`}),(0,s.jsx)(`span`,{className:`text-sm text-foreground/80`,children:`Ordinal position`})]})]})]})})}),(0,s.jsx)(T.Field,{name:`description`,children:e=>(0,s.jsxs)(`div`,{className:`space-y-2`,children:[(0,s.jsx)(r.t,{htmlFor:`description`,className:`text-[13px] font-semibold text-foreground/70`,children:`Description`}),(0,s.jsx)(`textarea`,{id:`description`,placeholder:`Add description`,className:`flex min-h-[100px] w-full rounded-md border-border bg-background px-4 py-3 text-sm placeholder:text-muted-foreground focus:outline-none focus-visible:ring-1 focus-visible:ring-primary/20 focus-visible:border-primary disabled:cursor-not-allowed disabled:opacity-50 resize-none transition-all hover:border-border`,value:e.state.value,onChange:t=>e.handleChange(t.target.value),disabled:D})]})}),(0,s.jsx)(T.Field,{name:`attachments`,children:e=>(0,s.jsxs)(`div`,{className:`space-y-4 pt-4 pb-2`,children:[(0,s.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,s.jsxs)(r.t,{className:`text-[13px] font-semibold text-foreground/70 flex items-center gap-2`,children:[(0,s.jsx)(o.Paperclip,{className:`w-4 h-4`}),` Attachments`]}),(0,s.jsx)(`input`,{type:`file`,id:`file-upload`,multiple:!0,className:`hidden`,onChange:t=>{t.target.files&&e.handleChange([...e.state.value||[],...Array.from(t.target.files)])}}),(0,s.jsxs)(t.t,{type:`button`,variant:`outline`,size:`sm`,className:`h-8 text-xs font-semibold gap-2 border-dashed border-border/50 hover:border-primary/40 hover:text-primary transition-all`,onClick:()=>document.getElementById(`file-upload`)?.click(),children:[(0,s.jsx)(o.Paperclip,{className:`w-3 h-3`}),` Add Files`]})]}),(e.state.value||[]).length>0&&(0,s.jsx)(`div`,{className:`grid grid-cols-1 gap-3`,children:(e.state.value||[]).map((n,r)=>(0,s.jsxs)(`div`,{className:`flex items-center justify-between p-3 rounded-lg bg-highlight border border-border group hover:border-border transition-all`,children:[(0,s.jsxs)(`div`,{className:`flex items-center gap-3 overflow-hidden`,children:[(0,s.jsx)(`div`,{className:`w-9 h-9 rounded-md bg-white border border-border flex items-center justify-center shrink-0 shadow-sm`,children:(0,s.jsx)(o.Paperclip,{className:`w-4 h-4 text-muted-foreground`})}),(0,s.jsxs)(`div`,{className:`flex flex-col overflow-hidden`,children:[(0,s.jsx)(`span`,{className:`text-[13px] font-medium text-foreground truncate`,children:n.name}),(0,s.jsx)(`span`,{className:`text-[11px] text-muted-foreground font-medium`,children:typeof n.size==`number`?`${(n.size/1024).toFixed(1)} KB`:`Attachment`})]})]}),(0,s.jsx)(t.t,{type:`button`,variant:`ghost`,size:`icon`,className:`h-8 w-8 text-muted-foreground/50 hover:text-destructive hover:bg-destructive/10 opacity-0 group-hover:opacity-100 transition-all`,onClick:()=>e.handleChange((e.state.value||[]).filter((e,t)=>t!==r)),children:(0,s.jsx)(o.Trash2,{className:`w-4 h-4`})})]},r))})]})})]}),S?S(m||{},p,()=>E(),f):(0,s.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`flex-end`,padding:`24px 40px`,backgroundColor:`var(--highlight)`,gap:`12px`,width:`100%`,flexShrink:0},children:[!D&&g&&p===`edit`&&(0,s.jsx)(t.t,{type:`button`,variant:`ghost`,className:`text-destructive hover:bg-destructive/10 hover:text-destructive h-10 px-5 font-bold mr-auto`,onClick:()=>{g(m?.id),f()},children:`Delete`}),(0,s.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`12px`},children:[!D&&(0,s.jsx)(T.Subscribe,{selector:e=>[e.canSubmit,e.isSubmitting],children:([e,n])=>(0,s.jsx)(t.t,{type:`submit`,variant:`default`,className:`h-10 px-10 font-bold rounded-md shrink-0 flex items-center justify-center transition-all hover:opacity-90`,style:{minWidth:`120px`},disabled:!e||n,onClick:e=>{e.preventDefault(),e.stopPropagation(),T.handleSubmit()},children:n?`Saving...`:`Save`})}),(0,s.jsx)(t.t,{type:`button`,variant:`outline`,className:`h-10 px-8 font-bold border border-border hover:bg-highlight text-foreground shrink-0 rounded-md transition-all`,style:{minWidth:`100px`},onClick:f,children:`Cancel`})]})]})]})]}),document.body)};Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return f}});
@@ -1,7 +1,7 @@
1
- import { p as e } from "./EzLayout-CiaPLniV.js";
1
+ import { p as e } from "./EzLayout-DFxegglu.js";
2
2
  import { _ as t } from "./EzProvider-AlmsYIDk.js";
3
3
  import { t as n } from "./button-CYyNwV8S.js";
4
- import { t as r } from "./input-Cj3sQK3M.js";
4
+ import { t as r } from "./input-CcRi0LeO.js";
5
5
  import { t as i } from "./label-DWEV--5W.js";
6
6
  import { t as a } from "./date-time-picker-DqdtBpAg.js";
7
7
  import { useEffect as o } from "react";
@@ -1,5 +1,5 @@
1
- const e=require("./EzProvider-L2qQMq-v.cjs"),t=require("./button-BBMwzUtG.cjs"),n=require("./input-CYlvlbF7.cjs"),r=require("./select-sVieKbLu.cjs"),i=require("./card-CPlRZxbq.cjs"),a=require("./DeleteConfirmationModal-CukNDgtX.cjs");let o=require("react");o=e.y(o,1);let s=require("lucide-react"),c=require("react/jsx-runtime"),l=require("@xyflow/react");var u=o.default.memo(({data:t,selected:n})=>{let{label:r,description:i}=t;return(0,c.jsxs)(`div`,{className:e._(`group relative flex flex-col items-center gap-1 px-6 py-3 rounded-full`,`border-2 transition-all duration-200`,`bg-emerald-500/10 border-emerald-500/40 text-emerald-500`,`shadow-[0_0_20px_rgba(16,185,129,0.08)]`,n&&`ring-4 ring-emerald-500/20 scale-105 border-emerald-500 shadow-[0_0_30px_rgba(16,185,129,0.2)]`),role:`group`,"aria-label":`Start node: ${r||`Start`}`,children:[(0,c.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,c.jsx)(s.Play,{size:14,className:`fill-emerald-500`}),(0,c.jsx)(`span`,{className:`text-[11px] font-black uppercase tracking-[0.2em]`,children:r||`START`})]}),i&&(0,c.jsx)(`span`,{className:`text-[8px] opacity-50 uppercase tracking-tight`,children:i}),(0,c.jsx)(l.Handle,{type:`source`,position:l.Position.Bottom,className:`!w-4 !h-4 !bg-emerald-500 !border-[3px] !border-background !-bottom-2 shadow-lg shadow-emerald-500/30`,"aria-label":`Output connection`})]})});u.displayName=`StartNode`;var d=o.default.memo(({data:t,selected:n})=>{let{label:r,description:i}=t;return(0,c.jsxs)(`div`,{className:e._(`group relative flex items-center gap-3 px-6 py-3 rounded-full`,`border-2 transition-all duration-200`,`bg-rose-500/10 border-rose-500/30 text-rose-400`,`shadow-xl`,n&&`ring-4 ring-rose-500/20 scale-105 border-rose-500/60`),role:`group`,"aria-label":`End node: ${r||`End`}`,children:[(0,c.jsx)(l.Handle,{type:`target`,position:l.Position.Top,className:`!w-4 !h-4 !bg-rose-500 !border-[3px] !border-background`,"aria-label":`Input connection`}),(0,c.jsx)(s.Square,{size:10,className:`fill-rose-500 text-rose-500`}),(0,c.jsxs)(`div`,{className:`flex flex-col`,children:[(0,c.jsx)(`span`,{className:`text-[11px] font-black uppercase tracking-[0.2em]`,children:r||`END`}),i&&(0,c.jsx)(`span`,{className:`text-[8px] opacity-40 uppercase tracking-tight`,children:i})]})]})});d.displayName=`EndNode`;var f=o.default.memo(({data:t,selected:n})=>{let{label:r}=t,[i,a]=o.default.useState(!1);return(0,c.jsxs)(`div`,{className:`relative w-full h-full group`,onPointerDownCapture:e=>{let t=e.target.closest(`.react-flow__resize-control`);if(t){let e=t.getAttribute(`data-handlepos`)?.includes(`-`);a(!!e)}},role:`group`,"aria-label":`Decision node: ${r||`Decision`}`,children:[(0,c.jsx)(l.NodeResizer,{color:`oklch(var(--primary))`,isVisible:n,minWidth:100,minHeight:100,keepAspectRatio:i,handleClassName:e._(`!w-3 !h-3 !bg-white !border-2 transition-all hover:!scale-125 !z-[70] shadow-sm`,`data-[handlepos^='top-']:!rounded-sm data-[handlepos^='bottom-']:!rounded-sm !border-indigo-600`,`data-[handlepos='top']:!rounded-full data-[handlepos='bottom']:!rounded-full data-[handlepos='left']:!rounded-full data-[handlepos='right']:!rounded-full !border-slate-400`),lineClassName:`!border-indigo-500/30`}),(0,c.jsx)(l.Handle,{type:`target`,position:l.Position.Top,className:`!w-4 !h-4 !bg-amber-500 !border-2 !border-background !z-50`,style:{top:-8},"aria-label":`Input connection`}),(0,c.jsx)(l.Handle,{type:`source`,position:l.Position.Right,id:`yes`,className:`!w-4 !h-4 !bg-emerald-500 !border-2 !border-background !z-50`,style:{right:-8,top:`50%`},"aria-label":`Yes path`}),(0,c.jsx)(l.Handle,{type:`source`,position:l.Position.Bottom,id:`no`,className:`!w-4 !h-4 !bg-rose-500 !border-2 !border-background !z-50`,style:{bottom:-8},"aria-label":`No path`}),(0,c.jsx)(`div`,{className:e._(`absolute inset-0 transition-all duration-200`,`border-2 border-amber-500/40 bg-amber-500/10 backdrop-blur-xl`,n&&`border-amber-500 bg-amber-500/20 shadow-[0_0_30px_rgba(245,158,11,0.3)]`),style:{clipPath:`polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%)`}}),(0,c.jsxs)(`div`,{className:`absolute inset-0 flex flex-col items-center justify-center z-10 pointer-events-none px-6`,children:[(0,c.jsx)(`span`,{className:`text-[8px] uppercase font-black tracking-widest text-amber-500/80 mb-0.5`,children:`Decision`}),(0,c.jsx)(`span`,{className:`text-[11px] font-bold leading-tight text-foreground text-center max-w-[70px] truncate`,children:r})]}),(0,c.jsx)(`div`,{className:`absolute -right-8 top-1/2 -translate-y-1/2 text-[9px] font-black text-emerald-400 pointer-events-none tracking-widest select-none z-20`,children:`YES`}),(0,c.jsx)(`div`,{className:`absolute -bottom-5 left-1/2 -translate-x-1/2 text-[9px] font-black text-rose-400 pointer-events-none tracking-widest select-none z-20`,children:`NO`})]})});f.displayName=`DecisionNode`;var p=o.default.memo(({data:t,selected:n})=>{let{label:r,description:a,maxIterations:u}=t,[d,f]=o.default.useState(!1);return(0,c.jsxs)(`div`,{className:`w-full h-full relative group`,onPointerDownCapture:e=>{let t=e.target.closest(`.react-flow__resize-control`);if(t){let e=t.getAttribute(`data-handlepos`)?.includes(`-`);f(!!e)}},children:[(0,c.jsx)(l.NodeResizer,{color:`oklch(var(--primary))`,isVisible:n,minWidth:160,minHeight:80,keepAspectRatio:d,handleClassName:e._(`!w-3 !h-3 !bg-white !border-2 transition-all hover:!scale-125 !z-[70] shadow-sm`,`data-[handlepos^='top-']:!rounded-sm data-[handlepos^='bottom-']:!rounded-sm !border-indigo-600`,`data-[handlepos='top']:!rounded-full data-[handlepos='bottom']:!rounded-full data-[handlepos='left']:!rounded-full data-[handlepos='right']:!rounded-full !border-slate-400`),lineClassName:`!border-indigo-500/30`}),(0,c.jsxs)(i.t,{className:e._(`w-full h-full rounded-2xl transition-all duration-200 overflow-hidden`,`border-2 border-orange-500/30 bg-orange-500/5 backdrop-blur-xl`,n&&`ring-2 ring-orange-500/40 border-orange-500 shadow-lg`),role:`group`,"aria-label":`Loop node: ${r||`Loop`}`,children:[(0,c.jsx)(l.Handle,{type:`target`,position:l.Position.Top,className:`!w-3.5 !h-3.5 !bg-orange-500 !border-[3px] !border-background !z-50`,"aria-label":`Input connection`}),(0,c.jsxs)(i.a,{className:`p-4 space-y-1`,children:[(0,c.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,c.jsx)(`div`,{className:`flex items-center justify-center w-8 h-8 rounded-lg bg-orange-500/15`,children:(0,c.jsx)(s.Repeat,{size:16,className:`text-orange-500`})}),(0,c.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,c.jsx)(`div`,{className:`text-[9px] uppercase font-bold tracking-widest text-orange-500/70`,children:`Loop`}),(0,c.jsx)(i.o,{className:`text-sm font-semibold truncate`,children:r})]})]}),a&&(0,c.jsx)(i.r,{className:`text-xs line-clamp-2`,children:a}),u&&(0,c.jsxs)(`div`,{className:`text-[10px] text-orange-400/80 font-medium`,children:[`Max: `,u,` iterations`]})]}),(0,c.jsx)(l.Handle,{type:`source`,position:l.Position.Bottom,className:`!w-3.5 !h-3.5 !bg-orange-500 !border-[3px] !border-background !z-50`,"aria-label":`Output connection`}),(0,c.jsx)(l.Handle,{type:`source`,position:l.Position.Left,id:`loop-back`,className:`!w-3 !h-3 !bg-orange-400/70 !border-2 !border-background !z-50`,"aria-label":`Loop back connection`})]})]})});p.displayName=`LoopNode`;var m=o.default.memo(({data:t,selected:n})=>{let{label:r,description:a,actionType:u}=t,[d,f]=o.default.useState(!1);return(0,c.jsxs)(`div`,{className:`w-full h-full relative group`,onPointerDownCapture:e=>{let t=e.target.closest(`.react-flow__resize-control`);if(t){let e=t.getAttribute(`data-handlepos`)?.includes(`-`);f(!!e)}},children:[(0,c.jsx)(l.NodeResizer,{color:`oklch(var(--primary))`,isVisible:n,minWidth:160,minHeight:80,keepAspectRatio:d,handleClassName:e._(`!w-3 !h-3 !bg-white !border-2 transition-all hover:!scale-125 !z-[70] shadow-sm`,`data-[handlepos^='top-']:!rounded-sm data-[handlepos^='bottom-']:!rounded-sm !border-indigo-600`,`data-[handlepos='top']:!rounded-full data-[handlepos='bottom']:!rounded-full data-[handlepos='left']:!rounded-full data-[handlepos='right']:!rounded-full !border-slate-400`),lineClassName:`!border-indigo-500/30`}),(0,c.jsxs)(i.t,{className:e._(`w-full h-full rounded-2xl transition-all duration-200 overflow-hidden`,`border-2 border-blue-500/30 bg-blue-500/5 backdrop-blur-xl`,n&&`ring-2 ring-blue-500/40 border-blue-500 shadow-lg`),role:`group`,"aria-label":`Action node: ${r||`Action`}`,children:[(0,c.jsx)(l.Handle,{type:`target`,position:l.Position.Top,className:`!w-3.5 !h-3.5 !bg-blue-500 !border-[3px] !border-background !z-50`,"aria-label":`Input connection`}),(0,c.jsxs)(i.a,{className:`p-4 space-y-1`,children:[(0,c.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,c.jsx)(`div`,{className:`flex items-center justify-center w-8 h-8 rounded-lg bg-blue-500/15`,children:(0,c.jsx)(s.Zap,{size:16,className:`text-blue-500`})}),(0,c.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,c.jsx)(`div`,{className:`text-[9px] uppercase font-bold tracking-widest text-blue-500/70`,children:`Action`}),(0,c.jsx)(i.o,{className:`text-sm font-semibold truncate`,children:r})]})]}),a&&(0,c.jsx)(i.r,{className:`text-xs line-clamp-2`,children:a}),u&&(0,c.jsx)(`div`,{className:`text-[10px] text-blue-400/80 font-medium mt-1`,children:u})]}),(0,c.jsx)(l.Handle,{type:`source`,position:l.Position.Bottom,className:`!w-3.5 !h-3.5 !bg-blue-500 !border-[3px] !border-background !z-50`,"aria-label":`Output connection`})]})]})});m.displayName=`ActionNode`;var h=o.default.memo(({data:t,selected:n})=>{let{label:r,description:a,method:u,url:d}=t,[f,p]=o.default.useState(!1);return(0,c.jsxs)(`div`,{className:`w-full h-full relative group`,onPointerDownCapture:e=>{let t=e.target.closest(`.react-flow__resize-control`);if(t){let e=t.getAttribute(`data-handlepos`)?.includes(`-`);p(!!e)}},children:[(0,c.jsx)(l.NodeResizer,{color:`oklch(var(--primary))`,isVisible:n,minWidth:200,minHeight:100,keepAspectRatio:f,handleClassName:e._(`!w-3 !h-3 !bg-white !border-2 transition-all hover:!scale-125 !z-[70] shadow-sm`,`data-[handlepos^='top-']:!rounded-sm data-[handlepos^='bottom-']:!rounded-sm !border-indigo-600`,`data-[handlepos='top']:!rounded-full data-[handlepos='bottom']:!rounded-full data-[handlepos='left']:!rounded-full data-[handlepos='right']:!rounded-full !border-slate-400`),lineClassName:`!border-indigo-500/30`}),(0,c.jsxs)(i.t,{className:e._(`w-full h-full rounded-2xl transition-all duration-200 overflow-hidden`,`border-2 border-indigo-500/30 bg-indigo-500/5 backdrop-blur-xl`,n&&`ring-2 ring-indigo-500/40 border-indigo-500 shadow-lg`),role:`group`,"aria-label":`Request node: ${r||`HTTP Request`}`,children:[(0,c.jsx)(l.Handle,{type:`target`,position:l.Position.Top,className:`!w-3.5 !h-3.5 !bg-indigo-500 !border-[3px] !border-background !z-50`,"aria-label":`Input connection`}),(0,c.jsxs)(i.a,{className:`p-4 space-y-1`,children:[(0,c.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,c.jsx)(`div`,{className:`flex items-center justify-center w-8 h-8 rounded-lg bg-indigo-500/15`,children:(0,c.jsx)(s.Cloud,{size:16,className:`text-indigo-500`})}),(0,c.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,c.jsx)(`div`,{className:`text-[9px] uppercase font-bold tracking-widest text-indigo-500/70`,children:`HTTP Request`}),(0,c.jsx)(i.o,{className:`text-sm font-semibold truncate`,children:r})]})]}),a&&(0,c.jsx)(i.r,{className:`text-xs line-clamp-2`,children:a}),(u||d)&&(0,c.jsxs)(`div`,{className:`flex items-center gap-2 mt-1`,children:[u&&(0,c.jsx)(`span`,{className:`text-[9px] font-black uppercase tracking-wider px-2 py-0.5 rounded-full bg-indigo-500/20 text-indigo-400`,children:u}),d&&(0,c.jsx)(`span`,{className:`text-[10px] text-muted-foreground truncate max-w-[120px]`,children:d})]})]}),(0,c.jsx)(l.Handle,{type:`source`,position:l.Position.Bottom,className:`!w-3.5 !h-3.5 !bg-indigo-500 !border-[3px] !border-background !z-50`,"aria-label":`Output connection`})]})]})});h.displayName=`RequestNode`;var g=o.default.memo(({data:t,selected:n})=>{let{label:r,description:a,duration:u,unit:d}=t,f=()=>u?`${u} ${d||`minutes`}`:null,[p,m]=o.default.useState(!1);return(0,c.jsxs)(`div`,{className:`w-full h-full relative group`,onPointerDownCapture:e=>{let t=e.target.closest(`.react-flow__resize-control`);if(t){let e=t.getAttribute(`data-handlepos`)?.includes(`-`);m(!!e)}},children:[(0,c.jsx)(l.NodeResizer,{color:`oklch(var(--primary))`,isVisible:n,minWidth:160,minHeight:80,keepAspectRatio:p,handleClassName:e._(`!w-3 !h-3 !bg-white !border-2 transition-all hover:!scale-125 !z-[70] shadow-sm`,`data-[handlepos^='top-']:!rounded-sm data-[handlepos^='bottom-']:!rounded-sm !border-indigo-600`,`data-[handlepos='top']:!rounded-full data-[handlepos='bottom']:!rounded-full data-[handlepos='left']:!rounded-full data-[handlepos='right']:!rounded-full !border-slate-400`),lineClassName:`!border-indigo-500/30`}),(0,c.jsxs)(i.t,{className:e._(`w-full h-full rounded-2xl transition-all duration-200 overflow-hidden`,`border-2 border-gray-400/30 bg-gray-500/5 backdrop-blur-xl`,n&&`ring-2 ring-gray-400/40 border-gray-400 shadow-lg`),role:`group`,"aria-label":`Delay node: ${r||`Delay`}`,children:[(0,c.jsx)(l.Handle,{type:`target`,position:l.Position.Top,className:`!w-3.5 !h-3.5 !bg-gray-400 !border-[3px] !border-background !z-50`,"aria-label":`Input connection`}),(0,c.jsxs)(i.a,{className:`p-4 space-y-1`,children:[(0,c.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,c.jsx)(`div`,{className:`flex items-center justify-center w-8 h-8 rounded-lg bg-gray-500/15`,children:(0,c.jsx)(s.Clock,{size:16,className:`text-gray-400`})}),(0,c.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,c.jsx)(`div`,{className:`text-[9px] uppercase font-bold tracking-widest text-gray-400/70`,children:`Delay`}),(0,c.jsx)(i.o,{className:`text-sm font-semibold truncate`,children:r})]})]}),a&&(0,c.jsx)(i.r,{className:`text-xs line-clamp-2`,children:a}),f()&&(0,c.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[10px] text-gray-400/80 font-medium mt-1`,children:[(0,c.jsx)(s.Clock,{size:10}),f()]})]}),(0,c.jsx)(l.Handle,{type:`source`,position:l.Position.Bottom,className:`!w-3.5 !h-3.5 !bg-gray-400 !border-[3px] !border-background !z-50`,"aria-label":`Output connection`})]})]})});g.displayName=`DelayNode`;var _=o.default.memo(({data:t,selected:n})=>{let{label:r,description:a,approverRole:u,slaHours:d}=t,[f,p]=o.default.useState(!1);return(0,c.jsxs)(`div`,{className:`w-full h-full relative group`,onPointerDownCapture:e=>{let t=e.target.closest(`.react-flow__resize-control`);if(t){let e=t.getAttribute(`data-handlepos`)?.includes(`-`);p(!!e)}},children:[(0,c.jsx)(l.NodeResizer,{color:`oklch(var(--primary))`,isVisible:n,minWidth:200,minHeight:100,keepAspectRatio:f,handleClassName:e._(`!w-3 !h-3 !bg-white !border-2 transition-all hover:!scale-125 !z-[70] shadow-sm`,`data-[handlepos^='top-']:!rounded-sm data-[handlepos^='bottom-']:!rounded-sm !border-indigo-600`,`data-[handlepos='top']:!rounded-full data-[handlepos='bottom']:!rounded-full data-[handlepos='left']:!rounded-full data-[handlepos='right']:!rounded-full !border-slate-400`),lineClassName:`!border-indigo-500/30`}),(0,c.jsxs)(i.t,{className:e._(`w-full h-full rounded-2xl transition-all duration-200 overflow-hidden`,`border-2 border-purple-500/30 bg-purple-500/5 backdrop-blur-xl`,n&&`ring-2 ring-purple-500/40 border-purple-500 shadow-lg`),role:`group`,"aria-label":`Approval node: ${r||`Approval`}`,children:[(0,c.jsx)(l.Handle,{type:`target`,position:l.Position.Top,className:`!w-3.5 !h-3.5 !bg-purple-500 !border-[3px] !border-background !z-50`,"aria-label":`Input connection`}),(0,c.jsxs)(i.a,{className:`p-4 space-y-1`,children:[(0,c.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,c.jsx)(`div`,{className:`flex items-center justify-center w-8 h-8 rounded-lg bg-purple-500/15`,children:(0,c.jsx)(s.User,{size:16,className:`text-purple-500`})}),(0,c.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,c.jsx)(`div`,{className:`text-[9px] uppercase font-bold tracking-widest text-purple-500/70`,children:`Approval`}),(0,c.jsx)(i.o,{className:`text-sm font-semibold truncate`,children:r})]})]}),a&&(0,c.jsx)(i.r,{className:`text-xs line-clamp-2`,children:a}),(0,c.jsxs)(`div`,{className:`flex flex-col gap-1 mt-1`,children:[u&&(0,c.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[10px] text-purple-400/80 font-medium`,children:[(0,c.jsx)(s.User,{size:10}),` `,u]}),d&&(0,c.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[10px] text-purple-400/60 font-medium`,children:[(0,c.jsx)(s.Clock,{size:10}),` `,d,`h SLA`]})]})]}),(0,c.jsx)(l.Handle,{type:`source`,position:l.Position.Bottom,id:`approved`,className:`!w-3.5 !h-3.5 !bg-emerald-500 !border-[3px] !border-background !z-50`,"aria-label":`Approved path`}),(0,c.jsx)(l.Handle,{type:`source`,position:l.Position.Right,id:`rejected`,className:`!w-3 !h-3 !bg-rose-500 !border-2 !border-background !z-50`,"aria-label":`Rejected path`})]})]})});_.displayName=`ApprovalNode`;var v=o.default.memo(({data:t,selected:n})=>{let{label:r,description:i}=t,[a,u]=o.default.useState(!1);return(0,c.jsxs)(`div`,{className:e._(`w-full h-full rounded-2xl transition-all duration-200 relative group`,`border-2 border-dashed border-muted-foreground/20 bg-muted/5 backdrop-blur-sm`,`p-4`,n&&`ring-2 ring-primary/30 border-primary/40 bg-muted/10`),onPointerDownCapture:e=>{let t=e.target.closest(`.react-flow__resize-control`);if(t){let e=t.getAttribute(`data-handlepos`)?.includes(`-`);u(!!e)}},role:`group`,"aria-label":`Group node: ${r||`Group`}`,children:[(0,c.jsx)(l.NodeResizer,{color:`oklch(var(--primary))`,isVisible:n,minWidth:200,minHeight:150,keepAspectRatio:a,handleClassName:e._(`!w-3 !h-3 !bg-white !border-2 transition-all hover:!scale-125 !z-[70] shadow-sm`,`data-[handlepos^='top-']:!rounded-sm data-[handlepos^='bottom-']:!rounded-sm !border-indigo-600`,`data-[handlepos='top']:!rounded-full data-[handlepos='bottom']:!rounded-full data-[handlepos='left']:!rounded-full data-[handlepos='right']:!rounded-full !border-slate-400`),lineClassName:`!border-indigo-500/30`}),(0,c.jsxs)(`div`,{className:`flex items-center gap-2 mb-4 pb-2 border-b border-dashed border-muted-foreground/10`,children:[(0,c.jsx)(s.Box,{size:14,className:`text-muted-foreground/60`}),(0,c.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-widest text-muted-foreground/60`,children:r||`Sub-process`})]}),i&&(0,c.jsx)(`p`,{className:`text-[10px] text-muted-foreground/40 mb-4`,children:i}),(0,c.jsx)(l.Handle,{type:`target`,position:l.Position.Top,className:`!w-3 !h-3 !bg-muted-foreground/40 !border-2 !border-background`,"aria-label":`Input connection`}),(0,c.jsx)(l.Handle,{type:`source`,position:l.Position.Bottom,className:`!w-3 !h-3 !bg-muted-foreground/40 !border-2 !border-background`,"aria-label":`Output connection`})]})});v.displayName=`GroupNode`;var y=({sourceX:e,sourceY:n,targetX:r,targetY:i,sourcePosition:a,targetPosition:o,style:u={},markerEnd:d,selected:f,label:p,data:m,id:h,onDelete:g})=>{let[_,v,y]=(0,l.getSmoothStepPath)({sourceX:e,sourceY:n,sourcePosition:a,targetX:r,targetY:i,targetPosition:o,borderRadius:16});return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(l.BaseEdge,{path:_,markerEnd:d,style:{...u,strokeWidth:f?3:2,stroke:f?`oklch(var(--primary))`:`oklch(var(--foreground))`,transition:`stroke-width 0.2s ease, stroke 0.2s ease`}}),(p||m?.label)&&(0,c.jsx)(l.EdgeLabelRenderer,{children:(0,c.jsx)(`div`,{style:{position:`absolute`,transform:`translate(-50%, -50%) translate(${v}px,${y}px)`,pointerEvents:`all`},className:`nodrag nopan`,children:(0,c.jsx)(`div`,{className:`px-3 py-1 rounded-full bg-background/80 backdrop-blur-md border border-border text-[10px] font-bold uppercase tracking-widest text-primary shadow-lg`,children:p||m?.label})})}),f&&(0,c.jsx)(l.EdgeLabelRenderer,{children:(0,c.jsx)(`div`,{style:{position:`absolute`,transform:`translate(-50%, -50%) translate(${v}px,${y+22}px)`,pointerEvents:`all`},className:`nodrag nopan`,children:(0,c.jsx)(t.t,{variant:`destructive`,size:`icon`,className:`w-5 h-5 rounded-full shadow-md`,"aria-label":`Delete edge`,onClick:()=>g?.(h),children:(0,c.jsx)(s.X,{className:`w-3 h-3`})})})})]})};y.displayName=`EzFlowEdge`;var b=({fromX:e,fromY:t,toX:n,toY:r,fromPosition:i,toPosition:a,fromHandle:o})=>{let[s]=(0,l.getSmoothStepPath)({sourceX:e,sourceY:t,sourcePosition:i,targetX:n,targetY:r,targetPosition:a,borderRadius:16}),u=o?.id===`yes`||o?.id===`approved`,d=o?.id===`no`||o?.id===`rejected`,f=o?.id===`loop-back`,p=u?`oklch(0.627 0.154 160.06)`:d?`oklch(0.577 0.245 27.325)`:f?`oklch(0.7 0.15 45)`:`oklch(var(--primary))`,m=u?`YES?`:d?`NO?`:f?`LOOP`:`CONNECT`;return(0,c.jsxs)(`g`,{children:[(0,c.jsx)(`path`,{fill:`none`,stroke:p,strokeWidth:2,d:s,style:{strokeDasharray:`6,4`}}),(0,c.jsx)(`circle`,{cx:n,cy:r,fill:`oklch(var(--background))`,r:4,stroke:p,strokeWidth:1.5}),(0,c.jsx)(`foreignObject`,{x:n+10,y:r-12,width:80,height:30,className:`pointer-events-none`,children:(0,c.jsx)(`div`,{className:`flex items-center`,children:(0,c.jsx)(`div`,{className:`px-2 py-0.5 rounded-full bg-background/80 backdrop-blur-md border border-border text-[8px] font-black uppercase tracking-tighter shadow-xl whitespace-nowrap`,style:{color:p},children:m})})})]})};b.displayName=`EzConnectionLine`;var x=e=>(0,c.jsx)(l.Background,{...e,color:`oklch(var(--border))`,variant:`dots`,gap:24,size:1,className:`opacity-40`});x.displayName=`EzFlowBackground`;var S=e=>(0,c.jsx)(l.Controls,{...e,className:`!bg-card/80 !backdrop-blur-md !border !border-border !shadow-2xl !rounded-2xl !p-1 !flex !flex-row !gap-1 !m-4 !overflow-hidden`,showInteractive:!1,"aria-label":`Canvas zoom and fit controls`});S.displayName=`EzFlowControls`;var C={startNode:u,endNode:d,decisionNode:f,loopNode:p,actionNode:m,requestNode:h,delayNode:g,approvalNode:_,groupNode:v},w=o.default.forwardRef(({nodes:t,edges:n,onNodesChange:r,onEdgesChange:i,onConnect:a,onDrop:s,onDragOver:u,onNodeClick:d,onNodeDoubleClick:f,onEdgeClick:p,onEdgeDelete:m,onPaneClick:h,nodeTypes:g=C,edgeTypes:_,isValidConnection:v,snapToGrid:w=!0,snapGrid:T=[15,15],showGrid:E=!0,fitView:ee=!1,readOnly:D=!1,className:O,style:k,...A},j)=>{let M=o.default.useMemo(()=>_??{ezEdge:e=>(0,c.jsx)(y,{...e,onDelete:m})},[_,m]),N=o.default.useCallback(e=>{if(v)return v(e);if(!e.source||!e.target||e.source===e.target)return!1;let r=new Map(t.map(e=>[e.id,e])),i=new Set,a=[{id:e.target,path:[e.target]}];for(;a.length>0;){let t=a.shift();if(!(!t||i.has(t.id))){i.add(t.id);for(let i of n)if(i.source===t.id){if(i.target===e.source)return[...t.path,i.target].some(e=>r.get(e)?.type===`loopNode`);a.push({id:i.target,path:[...t.path,i.target]})}}}return!0},[n,v,t]);return(0,c.jsx)(`div`,{ref:j,className:e._(`w-full h-full min-h-0 relative`,O),style:k,...A,children:(0,c.jsxs)(l.ReactFlow,{nodes:t,edges:n,onNodesChange:D?void 0:r,onEdgesChange:D?void 0:i,onConnect:D?void 0:a,onDrop:D?void 0:s,onDragOver:D?void 0:u,onNodeClick:d,onNodeDoubleClick:f,onEdgeClick:p,onPaneClick:h,nodeTypes:g,edgeTypes:M,connectionLineComponent:b,isValidConnection:N,fitView:ee,defaultViewport:{x:0,y:0,zoom:1},panOnScroll:!0,zoomOnScroll:!1,snapToGrid:w,snapGrid:T,nodesDraggable:!D,nodesConnectable:!D,elementsSelectable:!D,defaultEdgeOptions:{type:`ezEdge`,animated:!0,selectable:!0},proOptions:{hideAttribution:!0},children:[E&&(0,c.jsx)(x,{gap:T[0],size:1.5}),(0,c.jsx)(S,{"aria-label":`Canvas controls`})]})})});w.displayName=`EzFlowCanvas`;var T=({category:e,isExpanded:t,onToggle:n,onNodeActivate:r})=>{let i=(e,t)=>{e.dataTransfer.setData(`application/reactflow`,t),e.dataTransfer.setData(`text/plain`,t),e.dataTransfer.effectAllowed=`move`};return(0,c.jsxs)(`div`,{className:`mb-2`,children:[(0,c.jsxs)(`button`,{className:`w-full flex items-center gap-2 px-3 py-2 rounded-xl text-[10px] font-black uppercase tracking-widest text-muted-foreground/60 hover:bg-muted/30 transition-colors`,onClick:n,"aria-expanded":t,"aria-label":`Toggle ${e.categoryKey} section`,children:[t?(0,c.jsx)(s.ChevronDown,{size:12}):(0,c.jsx)(s.ChevronRight,{size:12}),e.categoryKey]}),t&&(0,c.jsx)(`div`,{className:`flex flex-col gap-1.5 mt-1 px-1`,children:e.items.map(e=>(0,c.jsxs)(`div`,{className:`group relative flex items-center gap-3 p-3 rounded-xl bg-background/30 border border-transparent hover:border-primary/30 hover:bg-primary/5 transition-all cursor-grab active:cursor-grabbing`,onDragStart:t=>i(t,e.type),onDoubleClick:()=>r?.(e),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),r?.(e))},draggable:!0,role:`button`,tabIndex:0,"aria-label":`Drag ${e.labelKey} node`,"data-ezflow-node-type":e.type,children:[(0,c.jsx)(`div`,{className:`absolute left-1 top-1/2 -translate-y-1/2 opacity-0 group-hover:opacity-30 transition-opacity`,children:(0,c.jsx)(s.GripVertical,{size:12})}),(0,c.jsx)(`div`,{className:`flex items-center justify-center w-8 h-8 rounded-lg bg-primary/10 text-primary group-hover:scale-110 transition-transform ml-2`,children:e.icon}),(0,c.jsxs)(`div`,{className:`flex flex-col min-w-0`,children:[(0,c.jsx)(`span`,{className:`text-xs font-bold leading-none mb-0.5 truncate`,children:e.labelKey}),e.descriptionKey&&(0,c.jsx)(`span`,{className:`text-[10px] text-muted-foreground leading-tight line-clamp-1`,children:e.descriptionKey})]})]},e.type))})]})},E=({categories:n,title:r=`Node Library`,className:i,collapsed:a=!1,onCollapsedChange:l,onNodeActivate:u})=>{let[d,f]=o.default.useState(new Set(n.map(e=>e.category))),p=e=>{f(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})};return a?(0,c.jsxs)(`aside`,{className:e._(`p-2 border-r border-border bg-card/30 backdrop-blur-md flex flex-col items-center`,i),"aria-label":`Node Library (collapsed)`,children:[(0,c.jsx)(t.t,{variant:`ghost`,size:`icon`,className:`rounded-xl mb-2`,onClick:()=>l?.(!1),"aria-label":`Expand node library`,children:(0,c.jsx)(s.PanelLeft,{size:16})}),n.flatMap(e=>e.items.map(e=>(0,c.jsx)(`div`,{className:`w-10 h-10 flex items-center justify-center rounded-xl hover:bg-primary/10 cursor-grab active:cursor-grabbing transition-colors mb-1`,onDragStart:t=>{t.dataTransfer.setData(`application/reactflow`,e.type),t.dataTransfer.setData(`text/plain`,e.type),t.dataTransfer.effectAllowed=`move`},onDoubleClick:()=>u?.(e),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),u?.(e))},draggable:!0,title:e.labelKey,role:`button`,tabIndex:0,"aria-label":`Drag ${e.labelKey} node`,"data-ezflow-node-type":e.type,children:e.icon},e.type)))]}):(0,c.jsxs)(`aside`,{className:e._(`w-72 p-4 border-r border-border bg-card/30 backdrop-blur-md flex flex-col gap-2 overflow-y-auto`,i),"aria-label":`Node Library`,children:[(0,c.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,c.jsx)(`div`,{className:`text-[10px] uppercase font-black tracking-widest text-primary/60 px-1`,children:r}),l&&(0,c.jsx)(t.t,{variant:`ghost`,size:`icon`,className:`rounded-xl w-7 h-7`,onClick:()=>l(!0),"aria-label":`Collapse node library`,children:(0,c.jsx)(s.PanelLeftClose,{size:14})})]}),n.map(e=>(0,c.jsx)(T,{category:e,isExpanded:d.has(e.category),onToggle:()=>p(e.category),onNodeActivate:u},e.category))]})};E.displayName=`EzFlowToolbox`;var ee={draft:{className:`bg-amber-500/15 text-amber-500 border-amber-500/30`,label:`Draft`},live:{className:`bg-emerald-500/15 text-emerald-500 border-emerald-500/30`,label:`Live`},archived:{className:`bg-gray-500/15 text-gray-400 border-gray-500/30`,label:`Archived`}},D=({title:n,description:r,status:i=`draft`,isDirty:a=!1,onTitleChange:l,onDescriptionChange:u,onSave:d,onPublish:f,onCancel:p,showGrid:m=!0,onShowGridChange:h,snapToGrid:g=!0,onSnapToGridChange:_,className:v})=>{let[y,b]=o.default.useState(!1),[x,S]=o.default.useState(!1),[C,w]=o.default.useState(n),[T,E]=o.default.useState(r||``),D=o.default.useRef(null),O=o.default.useRef(null);o.default.useEffect(()=>{w(n)},[n]),o.default.useEffect(()=>{E(r||``)},[r]);let k=()=>{b(!1),C!==n&&l?.(C)},A=()=>{S(!1),T!==r&&u?.(T)},j=()=>{a&&!window.confirm(`You have unsaved changes. Discard and exit?`)||p?.()},M=ee[i];return(0,c.jsxs)(`header`,{className:e._(`h-16 border-b border-border flex items-center justify-between px-6 bg-card/50 backdrop-blur-xl shrink-0`,v),role:`banner`,"aria-label":`Workflow designer header`,children:[(0,c.jsxs)(`div`,{className:`flex items-center gap-4 min-w-0`,children:[(0,c.jsx)(t.t,{variant:`ghost`,size:`icon`,className:`rounded-xl shrink-0`,onClick:j,"aria-label":`Go back`,children:(0,c.jsx)(s.ChevronLeft,{size:18})}),(0,c.jsx)(`div`,{className:`h-6 w-px bg-border shrink-0`}),(0,c.jsxs)(`div`,{className:`flex flex-col min-w-0`,children:[y?(0,c.jsx)(`input`,{ref:D,value:C,onChange:e=>w(e.target.value),onBlur:k,onKeyDown:e=>{e.key===`Enter`&&k(),e.key===`Escape`&&(w(n),b(!1))},className:`text-base font-bold bg-transparent border-none outline-none ring-0 p-0 text-foreground w-full`,autoFocus:!0,"aria-label":`Workflow title`}):(0,c.jsxs)(`button`,{className:`text-base font-bold text-left hover:text-primary transition-colors cursor-text truncate`,onClick:()=>{b(!0),setTimeout(()=>D.current?.focus(),0)},"aria-label":`Workflow title: ${C}. Click to edit`,children:[C||`Untitled Workflow`,a&&(0,c.jsx)(`span`,{className:`ml-2 text-[9px] text-muted-foreground/50 font-normal`,children:`(unsaved)`})]}),x?(0,c.jsx)(`input`,{ref:O,value:T,onChange:e=>E(e.target.value),onBlur:A,onKeyDown:e=>{e.key===`Enter`&&A(),e.key===`Escape`&&(E(r||``),S(!1))},className:`text-[10px] uppercase tracking-widest text-muted-foreground bg-transparent border-none outline-none ring-0 p-0 w-full`,autoFocus:!0,"aria-label":`Workflow description`}):(0,c.jsx)(`button`,{className:`text-[10px] uppercase tracking-widest text-muted-foreground/50 text-left hover:text-muted-foreground transition-colors cursor-text truncate`,onClick:()=>{S(!0),setTimeout(()=>O.current?.focus(),0)},"aria-label":`Description: ${T||`Click to add description`}`,children:T||`Click to add description`})]}),(0,c.jsx)(`div`,{className:e._(`shrink-0 px-3 py-1 rounded-full border text-[10px] font-bold uppercase tracking-widest`,M.className),role:`status`,"aria-label":`Status: ${M.label}`,children:M.label})]}),(0,c.jsxs)(`div`,{className:`flex items-center gap-6 shrink-0`,children:[(0,c.jsxs)(`div`,{className:`flex items-center gap-4 bg-background/40 px-4 py-1.5 rounded-2xl border border-border/10`,children:[(0,c.jsxs)(`label`,{className:`flex items-center gap-2 cursor-pointer group`,children:[(0,c.jsx)(`input`,{type:`checkbox`,checked:m,onChange:e=>h?.(e.target.checked),className:`w-4 h-4 rounded border-border text-primary focus:ring-primary/20 transition-all cursor-pointer`}),(0,c.jsx)(`span`,{className:`text-[10px] uppercase tracking-wider font-bold text-muted-foreground group-hover:text-foreground transition-colors`,children:`Grid`})]}),(0,c.jsx)(`div`,{className:`w-px h-4 bg-border/20`}),(0,c.jsxs)(`label`,{className:`flex items-center gap-2 cursor-pointer group`,children:[(0,c.jsx)(`input`,{type:`checkbox`,checked:g,onChange:e=>_?.(e.target.checked),className:`w-4 h-4 rounded border-border text-primary focus:ring-primary/20 transition-all cursor-pointer`}),(0,c.jsx)(`span`,{className:`text-[10px] uppercase tracking-wider font-bold text-muted-foreground group-hover:text-foreground transition-colors`,children:`Snap`})]})]}),(0,c.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,c.jsxs)(t.t,{variant:`ghost`,className:`rounded-xl h-9 px-4 text-xs gap-2`,onClick:j,"aria-label":`Cancel changes`,children:[(0,c.jsx)(s.X,{size:14}),`Cancel`]}),(0,c.jsxs)(t.t,{className:`rounded-xl h-9 px-6 bg-primary text-primary-foreground gap-2 shadow-lg shadow-primary/20 text-xs font-bold`,onClick:d,"aria-label":`Save workflow`,children:[(0,c.jsx)(s.Save,{size:14}),`Save`]}),f&&(0,c.jsxs)(t.t,{variant:`secondary`,className:`rounded-xl h-9 px-4 text-xs gap-2 font-bold`,onClick:f,"aria-label":`Publish workflow`,children:[(0,c.jsx)(s.Rocket,{size:14}),`Publish`]})]})]})]})};D.displayName=`EzFlowHeader`;var O={nodes:[],edges:[],viewport:{x:0,y:0,zoom:1},metadata:{title:`Untitled Workflow`,status:`draft`,version:1}},k={startNode:{label:`Start`,triggerType:`manual`},endNode:{label:`End`,outcome:`success`},decisionNode:{label:`Decision`,branches:[]},loopNode:{label:`Loop`,iteratorSource:``,maxIterations:10},actionNode:{label:`Action`,actionType:``,config:{}},requestNode:{label:`API Request`,method:`GET`,url:``},delayNode:{label:`Delay`,duration:1,unit:`hours`},approvalNode:{label:`Approval`,approverRole:``},groupNode:{label:`Group`,collapsed:!1}},A={startNode:{type:`startNode`,label:`Start`,description:`Workflow entry point`,category:`flow_control`,icon:(0,c.jsx)(s.Play,{size:16}),component:u,defaultData:k.startNode},endNode:{type:`endNode`,label:`End`,description:`Workflow completion`,category:`flow_control`,icon:(0,c.jsx)(s.CheckCircle2,{size:16}),component:d,defaultData:k.endNode},decisionNode:{type:`decisionNode`,label:`Decision`,description:`Branch by condition`,category:`logic`,icon:(0,c.jsx)(s.Diamond,{size:16}),component:f,defaultData:k.decisionNode,requiredDataKeys:[`branches`]},loopNode:{type:`loopNode`,label:`Loop`,description:`Repeat a path`,category:`flow_control`,icon:(0,c.jsx)(s.GitBranch,{size:16}),component:p,defaultData:k.loopNode,requiredDataKeys:[`iteratorSource`]},actionNode:{type:`actionNode`,label:`Action`,description:`Run an action`,category:`execution`,icon:(0,c.jsx)(s.Circle,{size:16}),component:m,defaultData:k.actionNode,requiredDataKeys:[`actionType`]},requestNode:{type:`requestNode`,label:`API Request`,description:`Call an HTTP endpoint`,category:`execution`,icon:(0,c.jsx)(s.Send,{size:16}),component:h,defaultData:k.requestNode,requiredDataKeys:[`url`]},delayNode:{type:`delayNode`,label:`Delay`,description:`Pause execution`,category:`logic`,icon:(0,c.jsx)(s.Clock,{size:16}),component:g,defaultData:k.delayNode,requiredDataKeys:[`duration`]},approvalNode:{type:`approvalNode`,label:`Approval`,description:`Wait for a person`,category:`human`,icon:(0,c.jsx)(s.Hand,{size:16}),component:_,defaultData:k.approvalNode,requiredDataKeys:[`approverRole`]},groupNode:{type:`groupNode`,label:`Group`,description:`Organize nodes`,category:`structural`,icon:(0,c.jsx)(s.SquareStack,{size:16}),component:v,defaultData:k.groupNode}},j=[`flow_control`,`logic`,`execution`,`human`,`structural`],M={flow_control:`Flow`,logic:`Logic`,execution:`Work`,human:`Human`,structural:`Structure`},N=e=>({...e,nodes:e.nodes.map(e=>({...e,data:{...e.data}})),edges:e.edges.map(e=>({...e,data:e.data?{...e.data}:e.data})),metadata:e.metadata?{...e.metadata}:void 0,viewport:e.viewport?{...e.viewport}:void 0}),te=e=>e==null||e===``||Array.isArray(e)&&e.length===0,P=(e,t)=>t.filter(t=>t.source===e).map(e=>e.target),ne=(e=A)=>{let t=new Map;return Object.values(e).forEach(e=>{let n=t.get(e.category)??{categoryKey:M[e.category]??e.category,category:e.category,items:[]};n.items.push({type:e.type,labelKey:e.label,descriptionKey:e.description,category:e.category,icon:e.icon??(0,c.jsx)(s.Circle,{size:16}),defaultData:e.defaultData}),t.set(e.category,n)}),Array.from(t.values()).sort((e,t)=>j.indexOf(e.category)-j.indexOf(t.category))},F=(e,t=A)=>{let n=[],r=e.nodes.filter(e=>e.type===`startNode`),i=e.nodes.filter(e=>e.type===`endNode`),a=new Set(i.map(e=>e.id)),o=new Map(e.nodes.map(e=>[e.id,e])),s=new Map,c=new Map;e.edges.forEach(e=>{s.set(e.target,(s.get(e.target)??0)+1),c.set(e.source,(c.get(e.source)??0)+1)}),r.length===0&&n.push({code:`missing_start`,severity:`error`,message:`Workflow requires a start node.`}),i.length===0&&n.push({code:`missing_end`,severity:`error`,message:`Workflow requires an end node.`}),e.nodes.forEach(r=>{r.type!==`startNode`&&r.type!==`groupNode`&&(s.get(r.id)??0)===0&&n.push({code:`orphan_node`,severity:`error`,message:`Node has no incoming path.`,nodeId:r.id});let i=t[String(r.type??``)];if(i?.requiredDataKeys?.forEach(e=>{te(r.data?.[e])&&n.push({code:`missing_required_config`,severity:`error`,message:`${i.label} requires ${e}.`,nodeId:r.id,field:e})}),r.data?.label||n.push({code:`missing_required_config`,severity:`error`,message:`Node label is required.`,nodeId:r.id,field:`label`}),r.type===`decisionNode`){let e=Array.isArray(r.data?.branches)?r.data.branches:[];(e.length<2||(c.get(r.id)??0)<e.length)&&n.push({code:`missing_decision_branch`,severity:`error`,message:`Decision nodes require branch coverage for each outcome.`,nodeId:r.id,field:`branches`})}n.push(...i?.validate?.(r,e)??[])}),e.nodes.forEach(t=>{if(t.type===`endNode`||t.type===`groupNode`)return;let r=new Set,i=[t.id],o=!1;for(;i.length>0;){let t=i.shift();if(!(!t||r.has(t))){if(r.add(t),a.has(t)){o=!0;break}i.push(...P(t,e.edges))}}o||n.push({code:`missing_end_path`,severity:`error`,message:`Node has no path to an end node.`,nodeId:t.id})});let l=new Set,u=new Set,d=(t,r)=>{if(l.has(t)){r.slice(r.indexOf(t)).some(e=>o.get(e)?.type===`loopNode`)||n.push({code:`invalid_cycle`,severity:`error`,message:`Workflow cycles require a loop node.`,nodeId:t});return}u.has(t)||(l.add(t),P(t,e.edges).forEach(e=>d(e,[...r,e])),l.delete(t),u.add(t))};return e.nodes.forEach(e=>d(e.id,[e.id])),{valid:!n.some(e=>e.severity===`error`),issues:n}},re=F,I=e=>e==null?``:String(e),ie=e=>e.split(`
1
+ const e=require("./EzProvider-L2qQMq-v.cjs"),t=require("./button-BBMwzUtG.cjs"),n=require("./input-DOh8O0iX.cjs"),r=require("./card-NlCLCGFb.cjs"),i=require("./select-sVieKbLu.cjs"),a=require("./DeleteConfirmationModal-BM1PoL6P.cjs");let o=require("react");o=e.y(o,1);let s=require("lucide-react"),c=require("react/jsx-runtime"),l=require("@xyflow/react");var u=o.default.memo(({data:t,selected:n})=>{let{label:r,description:i}=t;return(0,c.jsxs)(`div`,{className:e._(`group relative flex flex-col items-center gap-1 px-6 py-3 rounded-full`,`border-2 transition-all duration-200`,`bg-emerald-500/10 border-emerald-500/40 text-emerald-500`,`shadow-[0_0_20px_rgba(16,185,129,0.08)]`,n&&`ring-4 ring-emerald-500/20 scale-105 border-emerald-500 shadow-[0_0_30px_rgba(16,185,129,0.2)]`),role:`group`,"aria-label":`Start node: ${r||`Start`}`,children:[(0,c.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,c.jsx)(s.Play,{size:14,className:`fill-emerald-500`}),(0,c.jsx)(`span`,{className:`text-[11px] font-black uppercase tracking-[0.2em]`,children:r||`START`})]}),i&&(0,c.jsx)(`span`,{className:`text-[8px] opacity-50 uppercase tracking-tight`,children:i}),(0,c.jsx)(l.Handle,{type:`source`,position:l.Position.Bottom,className:`!w-4 !h-4 !bg-emerald-500 !border-[3px] !border-background !-bottom-2 shadow-lg shadow-emerald-500/30`,"aria-label":`Output connection`})]})});u.displayName=`StartNode`;var d=o.default.memo(({data:t,selected:n})=>{let{label:r,description:i}=t;return(0,c.jsxs)(`div`,{className:e._(`group relative flex items-center gap-3 px-6 py-3 rounded-full`,`border-2 transition-all duration-200`,`bg-rose-500/10 border-rose-500/30 text-rose-400`,`shadow-xl`,n&&`ring-4 ring-rose-500/20 scale-105 border-rose-500/60`),role:`group`,"aria-label":`End node: ${r||`End`}`,children:[(0,c.jsx)(l.Handle,{type:`target`,position:l.Position.Top,className:`!w-4 !h-4 !bg-rose-500 !border-[3px] !border-background`,"aria-label":`Input connection`}),(0,c.jsx)(s.Square,{size:10,className:`fill-rose-500 text-rose-500`}),(0,c.jsxs)(`div`,{className:`flex flex-col`,children:[(0,c.jsx)(`span`,{className:`text-[11px] font-black uppercase tracking-[0.2em]`,children:r||`END`}),i&&(0,c.jsx)(`span`,{className:`text-[8px] opacity-40 uppercase tracking-tight`,children:i})]})]})});d.displayName=`EndNode`;var f=o.default.memo(({data:t,selected:n})=>{let{label:r}=t,[i,a]=o.default.useState(!1);return(0,c.jsxs)(`div`,{className:`relative w-full h-full group`,onPointerDownCapture:e=>{let t=e.target.closest(`.react-flow__resize-control`);if(t){let e=t.getAttribute(`data-handlepos`)?.includes(`-`);a(!!e)}},role:`group`,"aria-label":`Decision node: ${r||`Decision`}`,children:[(0,c.jsx)(l.NodeResizer,{color:`oklch(var(--primary))`,isVisible:n,minWidth:100,minHeight:100,keepAspectRatio:i,handleClassName:e._(`!w-3 !h-3 !bg-white !border-2 transition-all hover:!scale-125 !z-[70] shadow-sm`,`data-[handlepos^='top-']:!rounded-sm data-[handlepos^='bottom-']:!rounded-sm !border-indigo-600`,`data-[handlepos='top']:!rounded-full data-[handlepos='bottom']:!rounded-full data-[handlepos='left']:!rounded-full data-[handlepos='right']:!rounded-full !border-slate-400`),lineClassName:`!border-indigo-500/30`}),(0,c.jsx)(l.Handle,{type:`target`,position:l.Position.Top,className:`!w-4 !h-4 !bg-amber-500 !border-2 !border-background !z-50`,style:{top:-8},"aria-label":`Input connection`}),(0,c.jsx)(l.Handle,{type:`source`,position:l.Position.Right,id:`yes`,className:`!w-4 !h-4 !bg-emerald-500 !border-2 !border-background !z-50`,style:{right:-8,top:`50%`},"aria-label":`Yes path`}),(0,c.jsx)(l.Handle,{type:`source`,position:l.Position.Bottom,id:`no`,className:`!w-4 !h-4 !bg-rose-500 !border-2 !border-background !z-50`,style:{bottom:-8},"aria-label":`No path`}),(0,c.jsx)(`div`,{className:e._(`absolute inset-0 transition-all duration-200`,`border-2 border-amber-500/40 bg-amber-500/10 backdrop-blur-xl`,n&&`border-amber-500 bg-amber-500/20 shadow-[0_0_30px_rgba(245,158,11,0.3)]`),style:{clipPath:`polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%)`}}),(0,c.jsxs)(`div`,{className:`absolute inset-0 flex flex-col items-center justify-center z-10 pointer-events-none px-6`,children:[(0,c.jsx)(`span`,{className:`text-[8px] uppercase font-black tracking-widest text-amber-500/80 mb-0.5`,children:`Decision`}),(0,c.jsx)(`span`,{className:`text-[11px] font-bold leading-tight text-foreground text-center max-w-[70px] truncate`,children:r})]}),(0,c.jsx)(`div`,{className:`absolute -right-8 top-1/2 -translate-y-1/2 text-[9px] font-black text-emerald-400 pointer-events-none tracking-widest select-none z-20`,children:`YES`}),(0,c.jsx)(`div`,{className:`absolute -bottom-5 left-1/2 -translate-x-1/2 text-[9px] font-black text-rose-400 pointer-events-none tracking-widest select-none z-20`,children:`NO`})]})});f.displayName=`DecisionNode`;var p=o.default.memo(({data:t,selected:n})=>{let{label:i,description:a,maxIterations:u}=t,[d,f]=o.default.useState(!1);return(0,c.jsxs)(`div`,{className:`w-full h-full relative group`,onPointerDownCapture:e=>{let t=e.target.closest(`.react-flow__resize-control`);if(t){let e=t.getAttribute(`data-handlepos`)?.includes(`-`);f(!!e)}},children:[(0,c.jsx)(l.NodeResizer,{color:`oklch(var(--primary))`,isVisible:n,minWidth:160,minHeight:80,keepAspectRatio:d,handleClassName:e._(`!w-3 !h-3 !bg-white !border-2 transition-all hover:!scale-125 !z-[70] shadow-sm`,`data-[handlepos^='top-']:!rounded-sm data-[handlepos^='bottom-']:!rounded-sm !border-indigo-600`,`data-[handlepos='top']:!rounded-full data-[handlepos='bottom']:!rounded-full data-[handlepos='left']:!rounded-full data-[handlepos='right']:!rounded-full !border-slate-400`),lineClassName:`!border-indigo-500/30`}),(0,c.jsxs)(r.t,{className:e._(`w-full h-full rounded-2xl transition-all duration-200 overflow-hidden`,`border-2 border-orange-500/30 bg-orange-500/5 backdrop-blur-xl`,n&&`ring-2 ring-orange-500/40 border-orange-500 shadow-lg`),role:`group`,"aria-label":`Loop node: ${i||`Loop`}`,children:[(0,c.jsx)(l.Handle,{type:`target`,position:l.Position.Top,className:`!w-3.5 !h-3.5 !bg-orange-500 !border-[3px] !border-background !z-50`,"aria-label":`Input connection`}),(0,c.jsxs)(r.a,{className:`p-4 space-y-1`,children:[(0,c.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,c.jsx)(`div`,{className:`flex items-center justify-center w-8 h-8 rounded-lg bg-orange-500/15`,children:(0,c.jsx)(s.Repeat,{size:16,className:`text-orange-500`})}),(0,c.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,c.jsx)(`div`,{className:`text-[9px] uppercase font-bold tracking-widest text-orange-500/70`,children:`Loop`}),(0,c.jsx)(r.o,{className:`text-sm font-semibold truncate`,children:i})]})]}),a&&(0,c.jsx)(r.r,{className:`text-xs line-clamp-2`,children:a}),u&&(0,c.jsxs)(`div`,{className:`text-[10px] text-orange-400/80 font-medium`,children:[`Max: `,u,` iterations`]})]}),(0,c.jsx)(l.Handle,{type:`source`,position:l.Position.Bottom,className:`!w-3.5 !h-3.5 !bg-orange-500 !border-[3px] !border-background !z-50`,"aria-label":`Output connection`}),(0,c.jsx)(l.Handle,{type:`source`,position:l.Position.Left,id:`loop-back`,className:`!w-3 !h-3 !bg-orange-400/70 !border-2 !border-background !z-50`,"aria-label":`Loop back connection`})]})]})});p.displayName=`LoopNode`;var m=o.default.memo(({data:t,selected:n})=>{let{label:i,description:a,actionType:u}=t,[d,f]=o.default.useState(!1);return(0,c.jsxs)(`div`,{className:`w-full h-full relative group`,onPointerDownCapture:e=>{let t=e.target.closest(`.react-flow__resize-control`);if(t){let e=t.getAttribute(`data-handlepos`)?.includes(`-`);f(!!e)}},children:[(0,c.jsx)(l.NodeResizer,{color:`oklch(var(--primary))`,isVisible:n,minWidth:160,minHeight:80,keepAspectRatio:d,handleClassName:e._(`!w-3 !h-3 !bg-white !border-2 transition-all hover:!scale-125 !z-[70] shadow-sm`,`data-[handlepos^='top-']:!rounded-sm data-[handlepos^='bottom-']:!rounded-sm !border-indigo-600`,`data-[handlepos='top']:!rounded-full data-[handlepos='bottom']:!rounded-full data-[handlepos='left']:!rounded-full data-[handlepos='right']:!rounded-full !border-slate-400`),lineClassName:`!border-indigo-500/30`}),(0,c.jsxs)(r.t,{className:e._(`w-full h-full rounded-2xl transition-all duration-200 overflow-hidden`,`border-2 border-blue-500/30 bg-blue-500/5 backdrop-blur-xl`,n&&`ring-2 ring-blue-500/40 border-blue-500 shadow-lg`),role:`group`,"aria-label":`Action node: ${i||`Action`}`,children:[(0,c.jsx)(l.Handle,{type:`target`,position:l.Position.Top,className:`!w-3.5 !h-3.5 !bg-blue-500 !border-[3px] !border-background !z-50`,"aria-label":`Input connection`}),(0,c.jsxs)(r.a,{className:`p-4 space-y-1`,children:[(0,c.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,c.jsx)(`div`,{className:`flex items-center justify-center w-8 h-8 rounded-lg bg-blue-500/15`,children:(0,c.jsx)(s.Zap,{size:16,className:`text-blue-500`})}),(0,c.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,c.jsx)(`div`,{className:`text-[9px] uppercase font-bold tracking-widest text-blue-500/70`,children:`Action`}),(0,c.jsx)(r.o,{className:`text-sm font-semibold truncate`,children:i})]})]}),a&&(0,c.jsx)(r.r,{className:`text-xs line-clamp-2`,children:a}),u&&(0,c.jsx)(`div`,{className:`text-[10px] text-blue-400/80 font-medium mt-1`,children:u})]}),(0,c.jsx)(l.Handle,{type:`source`,position:l.Position.Bottom,className:`!w-3.5 !h-3.5 !bg-blue-500 !border-[3px] !border-background !z-50`,"aria-label":`Output connection`})]})]})});m.displayName=`ActionNode`;var h=o.default.memo(({data:t,selected:n})=>{let{label:i,description:a,method:u,url:d}=t,[f,p]=o.default.useState(!1);return(0,c.jsxs)(`div`,{className:`w-full h-full relative group`,onPointerDownCapture:e=>{let t=e.target.closest(`.react-flow__resize-control`);if(t){let e=t.getAttribute(`data-handlepos`)?.includes(`-`);p(!!e)}},children:[(0,c.jsx)(l.NodeResizer,{color:`oklch(var(--primary))`,isVisible:n,minWidth:200,minHeight:100,keepAspectRatio:f,handleClassName:e._(`!w-3 !h-3 !bg-white !border-2 transition-all hover:!scale-125 !z-[70] shadow-sm`,`data-[handlepos^='top-']:!rounded-sm data-[handlepos^='bottom-']:!rounded-sm !border-indigo-600`,`data-[handlepos='top']:!rounded-full data-[handlepos='bottom']:!rounded-full data-[handlepos='left']:!rounded-full data-[handlepos='right']:!rounded-full !border-slate-400`),lineClassName:`!border-indigo-500/30`}),(0,c.jsxs)(r.t,{className:e._(`w-full h-full rounded-2xl transition-all duration-200 overflow-hidden`,`border-2 border-indigo-500/30 bg-indigo-500/5 backdrop-blur-xl`,n&&`ring-2 ring-indigo-500/40 border-indigo-500 shadow-lg`),role:`group`,"aria-label":`Request node: ${i||`HTTP Request`}`,children:[(0,c.jsx)(l.Handle,{type:`target`,position:l.Position.Top,className:`!w-3.5 !h-3.5 !bg-indigo-500 !border-[3px] !border-background !z-50`,"aria-label":`Input connection`}),(0,c.jsxs)(r.a,{className:`p-4 space-y-1`,children:[(0,c.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,c.jsx)(`div`,{className:`flex items-center justify-center w-8 h-8 rounded-lg bg-indigo-500/15`,children:(0,c.jsx)(s.Cloud,{size:16,className:`text-indigo-500`})}),(0,c.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,c.jsx)(`div`,{className:`text-[9px] uppercase font-bold tracking-widest text-indigo-500/70`,children:`HTTP Request`}),(0,c.jsx)(r.o,{className:`text-sm font-semibold truncate`,children:i})]})]}),a&&(0,c.jsx)(r.r,{className:`text-xs line-clamp-2`,children:a}),(u||d)&&(0,c.jsxs)(`div`,{className:`flex items-center gap-2 mt-1`,children:[u&&(0,c.jsx)(`span`,{className:`text-[9px] font-black uppercase tracking-wider px-2 py-0.5 rounded-full bg-indigo-500/20 text-indigo-400`,children:u}),d&&(0,c.jsx)(`span`,{className:`text-[10px] text-muted-foreground truncate max-w-[120px]`,children:d})]})]}),(0,c.jsx)(l.Handle,{type:`source`,position:l.Position.Bottom,className:`!w-3.5 !h-3.5 !bg-indigo-500 !border-[3px] !border-background !z-50`,"aria-label":`Output connection`})]})]})});h.displayName=`RequestNode`;var g=o.default.memo(({data:t,selected:n})=>{let{label:i,description:a,duration:u,unit:d}=t,f=()=>u?`${u} ${d||`minutes`}`:null,[p,m]=o.default.useState(!1);return(0,c.jsxs)(`div`,{className:`w-full h-full relative group`,onPointerDownCapture:e=>{let t=e.target.closest(`.react-flow__resize-control`);if(t){let e=t.getAttribute(`data-handlepos`)?.includes(`-`);m(!!e)}},children:[(0,c.jsx)(l.NodeResizer,{color:`oklch(var(--primary))`,isVisible:n,minWidth:160,minHeight:80,keepAspectRatio:p,handleClassName:e._(`!w-3 !h-3 !bg-white !border-2 transition-all hover:!scale-125 !z-[70] shadow-sm`,`data-[handlepos^='top-']:!rounded-sm data-[handlepos^='bottom-']:!rounded-sm !border-indigo-600`,`data-[handlepos='top']:!rounded-full data-[handlepos='bottom']:!rounded-full data-[handlepos='left']:!rounded-full data-[handlepos='right']:!rounded-full !border-slate-400`),lineClassName:`!border-indigo-500/30`}),(0,c.jsxs)(r.t,{className:e._(`w-full h-full rounded-2xl transition-all duration-200 overflow-hidden`,`border-2 border-gray-400/30 bg-gray-500/5 backdrop-blur-xl`,n&&`ring-2 ring-gray-400/40 border-gray-400 shadow-lg`),role:`group`,"aria-label":`Delay node: ${i||`Delay`}`,children:[(0,c.jsx)(l.Handle,{type:`target`,position:l.Position.Top,className:`!w-3.5 !h-3.5 !bg-gray-400 !border-[3px] !border-background !z-50`,"aria-label":`Input connection`}),(0,c.jsxs)(r.a,{className:`p-4 space-y-1`,children:[(0,c.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,c.jsx)(`div`,{className:`flex items-center justify-center w-8 h-8 rounded-lg bg-gray-500/15`,children:(0,c.jsx)(s.Clock,{size:16,className:`text-gray-400`})}),(0,c.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,c.jsx)(`div`,{className:`text-[9px] uppercase font-bold tracking-widest text-gray-400/70`,children:`Delay`}),(0,c.jsx)(r.o,{className:`text-sm font-semibold truncate`,children:i})]})]}),a&&(0,c.jsx)(r.r,{className:`text-xs line-clamp-2`,children:a}),f()&&(0,c.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[10px] text-gray-400/80 font-medium mt-1`,children:[(0,c.jsx)(s.Clock,{size:10}),f()]})]}),(0,c.jsx)(l.Handle,{type:`source`,position:l.Position.Bottom,className:`!w-3.5 !h-3.5 !bg-gray-400 !border-[3px] !border-background !z-50`,"aria-label":`Output connection`})]})]})});g.displayName=`DelayNode`;var _=o.default.memo(({data:t,selected:n})=>{let{label:i,description:a,approverRole:u,slaHours:d}=t,[f,p]=o.default.useState(!1);return(0,c.jsxs)(`div`,{className:`w-full h-full relative group`,onPointerDownCapture:e=>{let t=e.target.closest(`.react-flow__resize-control`);if(t){let e=t.getAttribute(`data-handlepos`)?.includes(`-`);p(!!e)}},children:[(0,c.jsx)(l.NodeResizer,{color:`oklch(var(--primary))`,isVisible:n,minWidth:200,minHeight:100,keepAspectRatio:f,handleClassName:e._(`!w-3 !h-3 !bg-white !border-2 transition-all hover:!scale-125 !z-[70] shadow-sm`,`data-[handlepos^='top-']:!rounded-sm data-[handlepos^='bottom-']:!rounded-sm !border-indigo-600`,`data-[handlepos='top']:!rounded-full data-[handlepos='bottom']:!rounded-full data-[handlepos='left']:!rounded-full data-[handlepos='right']:!rounded-full !border-slate-400`),lineClassName:`!border-indigo-500/30`}),(0,c.jsxs)(r.t,{className:e._(`w-full h-full rounded-2xl transition-all duration-200 overflow-hidden`,`border-2 border-purple-500/30 bg-purple-500/5 backdrop-blur-xl`,n&&`ring-2 ring-purple-500/40 border-purple-500 shadow-lg`),role:`group`,"aria-label":`Approval node: ${i||`Approval`}`,children:[(0,c.jsx)(l.Handle,{type:`target`,position:l.Position.Top,className:`!w-3.5 !h-3.5 !bg-purple-500 !border-[3px] !border-background !z-50`,"aria-label":`Input connection`}),(0,c.jsxs)(r.a,{className:`p-4 space-y-1`,children:[(0,c.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,c.jsx)(`div`,{className:`flex items-center justify-center w-8 h-8 rounded-lg bg-purple-500/15`,children:(0,c.jsx)(s.User,{size:16,className:`text-purple-500`})}),(0,c.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,c.jsx)(`div`,{className:`text-[9px] uppercase font-bold tracking-widest text-purple-500/70`,children:`Approval`}),(0,c.jsx)(r.o,{className:`text-sm font-semibold truncate`,children:i})]})]}),a&&(0,c.jsx)(r.r,{className:`text-xs line-clamp-2`,children:a}),(0,c.jsxs)(`div`,{className:`flex flex-col gap-1 mt-1`,children:[u&&(0,c.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[10px] text-purple-400/80 font-medium`,children:[(0,c.jsx)(s.User,{size:10}),` `,u]}),d&&(0,c.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[10px] text-purple-400/60 font-medium`,children:[(0,c.jsx)(s.Clock,{size:10}),` `,d,`h SLA`]})]})]}),(0,c.jsx)(l.Handle,{type:`source`,position:l.Position.Bottom,id:`approved`,className:`!w-3.5 !h-3.5 !bg-emerald-500 !border-[3px] !border-background !z-50`,"aria-label":`Approved path`}),(0,c.jsx)(l.Handle,{type:`source`,position:l.Position.Right,id:`rejected`,className:`!w-3 !h-3 !bg-rose-500 !border-2 !border-background !z-50`,"aria-label":`Rejected path`})]})]})});_.displayName=`ApprovalNode`;var v=o.default.memo(({data:t,selected:n})=>{let{label:r,description:i}=t,[a,u]=o.default.useState(!1);return(0,c.jsxs)(`div`,{className:e._(`w-full h-full rounded-2xl transition-all duration-200 relative group`,`border-2 border-dashed border-muted-foreground/20 bg-muted/5 backdrop-blur-sm`,`p-4`,n&&`ring-2 ring-primary/30 border-primary/40 bg-muted/10`),onPointerDownCapture:e=>{let t=e.target.closest(`.react-flow__resize-control`);if(t){let e=t.getAttribute(`data-handlepos`)?.includes(`-`);u(!!e)}},role:`group`,"aria-label":`Group node: ${r||`Group`}`,children:[(0,c.jsx)(l.NodeResizer,{color:`oklch(var(--primary))`,isVisible:n,minWidth:200,minHeight:150,keepAspectRatio:a,handleClassName:e._(`!w-3 !h-3 !bg-white !border-2 transition-all hover:!scale-125 !z-[70] shadow-sm`,`data-[handlepos^='top-']:!rounded-sm data-[handlepos^='bottom-']:!rounded-sm !border-indigo-600`,`data-[handlepos='top']:!rounded-full data-[handlepos='bottom']:!rounded-full data-[handlepos='left']:!rounded-full data-[handlepos='right']:!rounded-full !border-slate-400`),lineClassName:`!border-indigo-500/30`}),(0,c.jsxs)(`div`,{className:`flex items-center gap-2 mb-4 pb-2 border-b border-dashed border-muted-foreground/10`,children:[(0,c.jsx)(s.Box,{size:14,className:`text-muted-foreground/60`}),(0,c.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-widest text-muted-foreground/60`,children:r||`Sub-process`})]}),i&&(0,c.jsx)(`p`,{className:`text-[10px] text-muted-foreground/40 mb-4`,children:i}),(0,c.jsx)(l.Handle,{type:`target`,position:l.Position.Top,className:`!w-3 !h-3 !bg-muted-foreground/40 !border-2 !border-background`,"aria-label":`Input connection`}),(0,c.jsx)(l.Handle,{type:`source`,position:l.Position.Bottom,className:`!w-3 !h-3 !bg-muted-foreground/40 !border-2 !border-background`,"aria-label":`Output connection`})]})});v.displayName=`GroupNode`;var y=({sourceX:e,sourceY:n,targetX:r,targetY:i,sourcePosition:a,targetPosition:o,style:u={},markerEnd:d,selected:f,label:p,data:m,id:h,onDelete:g})=>{let[_,v,y]=(0,l.getSmoothStepPath)({sourceX:e,sourceY:n,sourcePosition:a,targetX:r,targetY:i,targetPosition:o,borderRadius:16});return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(l.BaseEdge,{path:_,markerEnd:d,style:{...u,strokeWidth:f?3:2,stroke:f?`oklch(var(--primary))`:`oklch(var(--foreground))`,transition:`stroke-width 0.2s ease, stroke 0.2s ease`}}),(p||m?.label)&&(0,c.jsx)(l.EdgeLabelRenderer,{children:(0,c.jsx)(`div`,{style:{position:`absolute`,transform:`translate(-50%, -50%) translate(${v}px,${y}px)`,pointerEvents:`all`},className:`nodrag nopan`,children:(0,c.jsx)(`div`,{className:`px-3 py-1 rounded-full bg-background/80 backdrop-blur-md border border-border text-[10px] font-bold uppercase tracking-widest text-primary shadow-lg`,children:p||m?.label})})}),f&&(0,c.jsx)(l.EdgeLabelRenderer,{children:(0,c.jsx)(`div`,{style:{position:`absolute`,transform:`translate(-50%, -50%) translate(${v}px,${y+22}px)`,pointerEvents:`all`},className:`nodrag nopan`,children:(0,c.jsx)(t.t,{variant:`destructive`,size:`icon`,className:`w-5 h-5 rounded-full shadow-md`,"aria-label":`Delete edge`,onClick:()=>g?.(h),children:(0,c.jsx)(s.X,{className:`w-3 h-3`})})})})]})};y.displayName=`EzFlowEdge`;var b=({fromX:e,fromY:t,toX:n,toY:r,fromPosition:i,toPosition:a,fromHandle:o})=>{let[s]=(0,l.getSmoothStepPath)({sourceX:e,sourceY:t,sourcePosition:i,targetX:n,targetY:r,targetPosition:a,borderRadius:16}),u=o?.id===`yes`||o?.id===`approved`,d=o?.id===`no`||o?.id===`rejected`,f=o?.id===`loop-back`,p=u?`oklch(0.627 0.154 160.06)`:d?`oklch(0.577 0.245 27.325)`:f?`oklch(0.7 0.15 45)`:`oklch(var(--primary))`,m=u?`YES?`:d?`NO?`:f?`LOOP`:`CONNECT`;return(0,c.jsxs)(`g`,{children:[(0,c.jsx)(`path`,{fill:`none`,stroke:p,strokeWidth:2,d:s,style:{strokeDasharray:`6,4`}}),(0,c.jsx)(`circle`,{cx:n,cy:r,fill:`oklch(var(--background))`,r:4,stroke:p,strokeWidth:1.5}),(0,c.jsx)(`foreignObject`,{x:n+10,y:r-12,width:80,height:30,className:`pointer-events-none`,children:(0,c.jsx)(`div`,{className:`flex items-center`,children:(0,c.jsx)(`div`,{className:`px-2 py-0.5 rounded-full bg-background/80 backdrop-blur-md border border-border text-[8px] font-black uppercase tracking-tighter shadow-xl whitespace-nowrap`,style:{color:p},children:m})})})]})};b.displayName=`EzConnectionLine`;var x=e=>(0,c.jsx)(l.Background,{...e,color:`oklch(var(--border))`,variant:`dots`,gap:24,size:1,className:`opacity-40`});x.displayName=`EzFlowBackground`;var S=e=>(0,c.jsx)(l.Controls,{...e,className:`!bg-card/80 !backdrop-blur-md !border !border-border !shadow-2xl !rounded-2xl !p-1 !flex !flex-row !gap-1 !m-4 !overflow-hidden`,showInteractive:!1,"aria-label":`Canvas zoom and fit controls`});S.displayName=`EzFlowControls`;var C={startNode:u,endNode:d,decisionNode:f,loopNode:p,actionNode:m,requestNode:h,delayNode:g,approvalNode:_,groupNode:v},w=o.default.forwardRef(({nodes:t,edges:n,onNodesChange:r,onEdgesChange:i,onConnect:a,onDrop:s,onDragOver:u,onNodeClick:d,onNodeDoubleClick:f,onEdgeClick:p,onEdgeDelete:m,onPaneClick:h,nodeTypes:g=C,edgeTypes:_,isValidConnection:v,snapToGrid:w=!0,snapGrid:T=[15,15],showGrid:E=!0,fitView:ee=!1,readOnly:D=!1,className:O,style:k,...A},j)=>{let M=o.default.useMemo(()=>_??{ezEdge:e=>(0,c.jsx)(y,{...e,onDelete:m})},[_,m]),N=o.default.useCallback(e=>{if(v)return v(e);if(!e.source||!e.target||e.source===e.target)return!1;let r=new Map(t.map(e=>[e.id,e])),i=new Set,a=[{id:e.target,path:[e.target]}];for(;a.length>0;){let t=a.shift();if(!(!t||i.has(t.id))){i.add(t.id);for(let i of n)if(i.source===t.id){if(i.target===e.source)return[...t.path,i.target].some(e=>r.get(e)?.type===`loopNode`);a.push({id:i.target,path:[...t.path,i.target]})}}}return!0},[n,v,t]);return(0,c.jsx)(`div`,{ref:j,className:e._(`w-full h-full min-h-0 relative`,O),style:k,...A,children:(0,c.jsxs)(l.ReactFlow,{nodes:t,edges:n,onNodesChange:D?void 0:r,onEdgesChange:D?void 0:i,onConnect:D?void 0:a,onDrop:D?void 0:s,onDragOver:D?void 0:u,onNodeClick:d,onNodeDoubleClick:f,onEdgeClick:p,onPaneClick:h,nodeTypes:g,edgeTypes:M,connectionLineComponent:b,isValidConnection:N,fitView:ee,defaultViewport:{x:0,y:0,zoom:1},panOnScroll:!0,zoomOnScroll:!1,snapToGrid:w,snapGrid:T,nodesDraggable:!D,nodesConnectable:!D,elementsSelectable:!D,defaultEdgeOptions:{type:`ezEdge`,animated:!0,selectable:!0},proOptions:{hideAttribution:!0},children:[E&&(0,c.jsx)(x,{gap:T[0],size:1.5}),(0,c.jsx)(S,{"aria-label":`Canvas controls`})]})})});w.displayName=`EzFlowCanvas`;var T=({category:e,isExpanded:t,onToggle:n,onNodeActivate:r})=>{let i=(e,t)=>{e.dataTransfer.setData(`application/reactflow`,t),e.dataTransfer.setData(`text/plain`,t),e.dataTransfer.effectAllowed=`move`};return(0,c.jsxs)(`div`,{className:`mb-2`,children:[(0,c.jsxs)(`button`,{className:`w-full flex items-center gap-2 px-3 py-2 rounded-xl text-[10px] font-black uppercase tracking-widest text-muted-foreground/60 hover:bg-muted/30 transition-colors`,onClick:n,"aria-expanded":t,"aria-label":`Toggle ${e.categoryKey} section`,children:[t?(0,c.jsx)(s.ChevronDown,{size:12}):(0,c.jsx)(s.ChevronRight,{size:12}),e.categoryKey]}),t&&(0,c.jsx)(`div`,{className:`flex flex-col gap-1.5 mt-1 px-1`,children:e.items.map(e=>(0,c.jsxs)(`div`,{className:`group relative flex items-center gap-3 p-3 rounded-xl bg-background/30 border border-transparent hover:border-primary/30 hover:bg-primary/5 transition-all cursor-grab active:cursor-grabbing`,onDragStart:t=>i(t,e.type),onDoubleClick:()=>r?.(e),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),r?.(e))},draggable:!0,role:`button`,tabIndex:0,"aria-label":`Drag ${e.labelKey} node`,"data-ezflow-node-type":e.type,children:[(0,c.jsx)(`div`,{className:`absolute left-1 top-1/2 -translate-y-1/2 opacity-0 group-hover:opacity-30 transition-opacity`,children:(0,c.jsx)(s.GripVertical,{size:12})}),(0,c.jsx)(`div`,{className:`flex items-center justify-center w-8 h-8 rounded-lg bg-primary/10 text-primary group-hover:scale-110 transition-transform ml-2`,children:e.icon}),(0,c.jsxs)(`div`,{className:`flex flex-col min-w-0`,children:[(0,c.jsx)(`span`,{className:`text-xs font-bold leading-none mb-0.5 truncate`,children:e.labelKey}),e.descriptionKey&&(0,c.jsx)(`span`,{className:`text-[10px] text-muted-foreground leading-tight line-clamp-1`,children:e.descriptionKey})]})]},e.type))})]})},E=({categories:n,title:r=`Node Library`,className:i,collapsed:a=!1,onCollapsedChange:l,onNodeActivate:u})=>{let[d,f]=o.default.useState(new Set(n.map(e=>e.category))),p=e=>{f(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})};return a?(0,c.jsxs)(`aside`,{className:e._(`p-2 border-r border-border bg-card/30 backdrop-blur-md flex flex-col items-center`,i),"aria-label":`Node Library (collapsed)`,children:[(0,c.jsx)(t.t,{variant:`ghost`,size:`icon`,className:`rounded-xl mb-2`,onClick:()=>l?.(!1),"aria-label":`Expand node library`,children:(0,c.jsx)(s.PanelLeft,{size:16})}),n.flatMap(e=>e.items.map(e=>(0,c.jsx)(`div`,{className:`w-10 h-10 flex items-center justify-center rounded-xl hover:bg-primary/10 cursor-grab active:cursor-grabbing transition-colors mb-1`,onDragStart:t=>{t.dataTransfer.setData(`application/reactflow`,e.type),t.dataTransfer.setData(`text/plain`,e.type),t.dataTransfer.effectAllowed=`move`},onDoubleClick:()=>u?.(e),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),u?.(e))},draggable:!0,title:e.labelKey,role:`button`,tabIndex:0,"aria-label":`Drag ${e.labelKey} node`,"data-ezflow-node-type":e.type,children:e.icon},e.type)))]}):(0,c.jsxs)(`aside`,{className:e._(`w-72 p-4 border-r border-border bg-card/30 backdrop-blur-md flex flex-col gap-2 overflow-y-auto`,i),"aria-label":`Node Library`,children:[(0,c.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,c.jsx)(`div`,{className:`text-[10px] uppercase font-black tracking-widest text-primary/60 px-1`,children:r}),l&&(0,c.jsx)(t.t,{variant:`ghost`,size:`icon`,className:`rounded-xl w-7 h-7`,onClick:()=>l(!0),"aria-label":`Collapse node library`,children:(0,c.jsx)(s.PanelLeftClose,{size:14})})]}),n.map(e=>(0,c.jsx)(T,{category:e,isExpanded:d.has(e.category),onToggle:()=>p(e.category),onNodeActivate:u},e.category))]})};E.displayName=`EzFlowToolbox`;var ee={draft:{className:`bg-amber-500/15 text-amber-500 border-amber-500/30`,label:`Draft`},live:{className:`bg-emerald-500/15 text-emerald-500 border-emerald-500/30`,label:`Live`},archived:{className:`bg-gray-500/15 text-gray-400 border-gray-500/30`,label:`Archived`}},D=({title:n,description:r,status:i=`draft`,isDirty:a=!1,onTitleChange:l,onDescriptionChange:u,onSave:d,onPublish:f,onCancel:p,showGrid:m=!0,onShowGridChange:h,snapToGrid:g=!0,onSnapToGridChange:_,className:v})=>{let[y,b]=o.default.useState(!1),[x,S]=o.default.useState(!1),[C,w]=o.default.useState(n),[T,E]=o.default.useState(r||``),D=o.default.useRef(null),O=o.default.useRef(null);o.default.useEffect(()=>{w(n)},[n]),o.default.useEffect(()=>{E(r||``)},[r]);let k=()=>{b(!1),C!==n&&l?.(C)},A=()=>{S(!1),T!==r&&u?.(T)},j=()=>{a&&!window.confirm(`You have unsaved changes. Discard and exit?`)||p?.()},M=ee[i];return(0,c.jsxs)(`header`,{className:e._(`h-16 border-b border-border flex items-center justify-between px-6 bg-card/50 backdrop-blur-xl shrink-0`,v),role:`banner`,"aria-label":`Workflow designer header`,children:[(0,c.jsxs)(`div`,{className:`flex items-center gap-4 min-w-0`,children:[(0,c.jsx)(t.t,{variant:`ghost`,size:`icon`,className:`rounded-xl shrink-0`,onClick:j,"aria-label":`Go back`,children:(0,c.jsx)(s.ChevronLeft,{size:18})}),(0,c.jsx)(`div`,{className:`h-6 w-px bg-border shrink-0`}),(0,c.jsxs)(`div`,{className:`flex flex-col min-w-0`,children:[y?(0,c.jsx)(`input`,{ref:D,value:C,onChange:e=>w(e.target.value),onBlur:k,onKeyDown:e=>{e.key===`Enter`&&k(),e.key===`Escape`&&(w(n),b(!1))},className:`text-base font-bold bg-transparent border-none outline-none ring-0 p-0 text-foreground w-full`,autoFocus:!0,"aria-label":`Workflow title`}):(0,c.jsxs)(`button`,{className:`text-base font-bold text-left hover:text-primary transition-colors cursor-text truncate`,onClick:()=>{b(!0),setTimeout(()=>D.current?.focus(),0)},"aria-label":`Workflow title: ${C}. Click to edit`,children:[C||`Untitled Workflow`,a&&(0,c.jsx)(`span`,{className:`ml-2 text-[9px] text-muted-foreground/50 font-normal`,children:`(unsaved)`})]}),x?(0,c.jsx)(`input`,{ref:O,value:T,onChange:e=>E(e.target.value),onBlur:A,onKeyDown:e=>{e.key===`Enter`&&A(),e.key===`Escape`&&(E(r||``),S(!1))},className:`text-[10px] uppercase tracking-widest text-muted-foreground bg-transparent border-none outline-none ring-0 p-0 w-full`,autoFocus:!0,"aria-label":`Workflow description`}):(0,c.jsx)(`button`,{className:`text-[10px] uppercase tracking-widest text-muted-foreground/50 text-left hover:text-muted-foreground transition-colors cursor-text truncate`,onClick:()=>{S(!0),setTimeout(()=>O.current?.focus(),0)},"aria-label":`Description: ${T||`Click to add description`}`,children:T||`Click to add description`})]}),(0,c.jsx)(`div`,{className:e._(`shrink-0 px-3 py-1 rounded-full border text-[10px] font-bold uppercase tracking-widest`,M.className),role:`status`,"aria-label":`Status: ${M.label}`,children:M.label})]}),(0,c.jsxs)(`div`,{className:`flex items-center gap-6 shrink-0`,children:[(0,c.jsxs)(`div`,{className:`flex items-center gap-4 bg-background/40 px-4 py-1.5 rounded-2xl border border-border/10`,children:[(0,c.jsxs)(`label`,{className:`flex items-center gap-2 cursor-pointer group`,children:[(0,c.jsx)(`input`,{type:`checkbox`,checked:m,onChange:e=>h?.(e.target.checked),className:`w-4 h-4 rounded border-border text-primary focus:ring-primary/20 transition-all cursor-pointer`}),(0,c.jsx)(`span`,{className:`text-[10px] uppercase tracking-wider font-bold text-muted-foreground group-hover:text-foreground transition-colors`,children:`Grid`})]}),(0,c.jsx)(`div`,{className:`w-px h-4 bg-border/20`}),(0,c.jsxs)(`label`,{className:`flex items-center gap-2 cursor-pointer group`,children:[(0,c.jsx)(`input`,{type:`checkbox`,checked:g,onChange:e=>_?.(e.target.checked),className:`w-4 h-4 rounded border-border text-primary focus:ring-primary/20 transition-all cursor-pointer`}),(0,c.jsx)(`span`,{className:`text-[10px] uppercase tracking-wider font-bold text-muted-foreground group-hover:text-foreground transition-colors`,children:`Snap`})]})]}),(0,c.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,c.jsxs)(t.t,{variant:`ghost`,className:`rounded-xl h-9 px-4 text-xs gap-2`,onClick:j,"aria-label":`Cancel changes`,children:[(0,c.jsx)(s.X,{size:14}),`Cancel`]}),(0,c.jsxs)(t.t,{className:`rounded-xl h-9 px-6 bg-primary text-primary-foreground gap-2 shadow-lg shadow-primary/20 text-xs font-bold`,onClick:d,"aria-label":`Save workflow`,children:[(0,c.jsx)(s.Save,{size:14}),`Save`]}),f&&(0,c.jsxs)(t.t,{variant:`secondary`,className:`rounded-xl h-9 px-4 text-xs gap-2 font-bold`,onClick:f,"aria-label":`Publish workflow`,children:[(0,c.jsx)(s.Rocket,{size:14}),`Publish`]})]})]})]})};D.displayName=`EzFlowHeader`;var O={nodes:[],edges:[],viewport:{x:0,y:0,zoom:1},metadata:{title:`Untitled Workflow`,status:`draft`,version:1}},k={startNode:{label:`Start`,triggerType:`manual`},endNode:{label:`End`,outcome:`success`},decisionNode:{label:`Decision`,branches:[]},loopNode:{label:`Loop`,iteratorSource:``,maxIterations:10},actionNode:{label:`Action`,actionType:``,config:{}},requestNode:{label:`API Request`,method:`GET`,url:``},delayNode:{label:`Delay`,duration:1,unit:`hours`},approvalNode:{label:`Approval`,approverRole:``},groupNode:{label:`Group`,collapsed:!1}},A={startNode:{type:`startNode`,label:`Start`,description:`Workflow entry point`,category:`flow_control`,icon:(0,c.jsx)(s.Play,{size:16}),component:u,defaultData:k.startNode},endNode:{type:`endNode`,label:`End`,description:`Workflow completion`,category:`flow_control`,icon:(0,c.jsx)(s.CheckCircle2,{size:16}),component:d,defaultData:k.endNode},decisionNode:{type:`decisionNode`,label:`Decision`,description:`Branch by condition`,category:`logic`,icon:(0,c.jsx)(s.Diamond,{size:16}),component:f,defaultData:k.decisionNode,requiredDataKeys:[`branches`]},loopNode:{type:`loopNode`,label:`Loop`,description:`Repeat a path`,category:`flow_control`,icon:(0,c.jsx)(s.GitBranch,{size:16}),component:p,defaultData:k.loopNode,requiredDataKeys:[`iteratorSource`]},actionNode:{type:`actionNode`,label:`Action`,description:`Run an action`,category:`execution`,icon:(0,c.jsx)(s.Circle,{size:16}),component:m,defaultData:k.actionNode,requiredDataKeys:[`actionType`]},requestNode:{type:`requestNode`,label:`API Request`,description:`Call an HTTP endpoint`,category:`execution`,icon:(0,c.jsx)(s.Send,{size:16}),component:h,defaultData:k.requestNode,requiredDataKeys:[`url`]},delayNode:{type:`delayNode`,label:`Delay`,description:`Pause execution`,category:`logic`,icon:(0,c.jsx)(s.Clock,{size:16}),component:g,defaultData:k.delayNode,requiredDataKeys:[`duration`]},approvalNode:{type:`approvalNode`,label:`Approval`,description:`Wait for a person`,category:`human`,icon:(0,c.jsx)(s.Hand,{size:16}),component:_,defaultData:k.approvalNode,requiredDataKeys:[`approverRole`]},groupNode:{type:`groupNode`,label:`Group`,description:`Organize nodes`,category:`structural`,icon:(0,c.jsx)(s.SquareStack,{size:16}),component:v,defaultData:k.groupNode}},j=[`flow_control`,`logic`,`execution`,`human`,`structural`],M={flow_control:`Flow`,logic:`Logic`,execution:`Work`,human:`Human`,structural:`Structure`},N=e=>({...e,nodes:e.nodes.map(e=>({...e,data:{...e.data}})),edges:e.edges.map(e=>({...e,data:e.data?{...e.data}:e.data})),metadata:e.metadata?{...e.metadata}:void 0,viewport:e.viewport?{...e.viewport}:void 0}),te=e=>e==null||e===``||Array.isArray(e)&&e.length===0,P=(e,t)=>t.filter(t=>t.source===e).map(e=>e.target),ne=(e=A)=>{let t=new Map;return Object.values(e).forEach(e=>{let n=t.get(e.category)??{categoryKey:M[e.category]??e.category,category:e.category,items:[]};n.items.push({type:e.type,labelKey:e.label,descriptionKey:e.description,category:e.category,icon:e.icon??(0,c.jsx)(s.Circle,{size:16}),defaultData:e.defaultData}),t.set(e.category,n)}),Array.from(t.values()).sort((e,t)=>j.indexOf(e.category)-j.indexOf(t.category))},F=(e,t=A)=>{let n=[],r=e.nodes.filter(e=>e.type===`startNode`),i=e.nodes.filter(e=>e.type===`endNode`),a=new Set(i.map(e=>e.id)),o=new Map(e.nodes.map(e=>[e.id,e])),s=new Map,c=new Map;e.edges.forEach(e=>{s.set(e.target,(s.get(e.target)??0)+1),c.set(e.source,(c.get(e.source)??0)+1)}),r.length===0&&n.push({code:`missing_start`,severity:`error`,message:`Workflow requires a start node.`}),i.length===0&&n.push({code:`missing_end`,severity:`error`,message:`Workflow requires an end node.`}),e.nodes.forEach(r=>{r.type!==`startNode`&&r.type!==`groupNode`&&(s.get(r.id)??0)===0&&n.push({code:`orphan_node`,severity:`error`,message:`Node has no incoming path.`,nodeId:r.id});let i=t[String(r.type??``)];if(i?.requiredDataKeys?.forEach(e=>{te(r.data?.[e])&&n.push({code:`missing_required_config`,severity:`error`,message:`${i.label} requires ${e}.`,nodeId:r.id,field:e})}),r.data?.label||n.push({code:`missing_required_config`,severity:`error`,message:`Node label is required.`,nodeId:r.id,field:`label`}),r.type===`decisionNode`){let e=Array.isArray(r.data?.branches)?r.data.branches:[];(e.length<2||(c.get(r.id)??0)<e.length)&&n.push({code:`missing_decision_branch`,severity:`error`,message:`Decision nodes require branch coverage for each outcome.`,nodeId:r.id,field:`branches`})}n.push(...i?.validate?.(r,e)??[])}),e.nodes.forEach(t=>{if(t.type===`endNode`||t.type===`groupNode`)return;let r=new Set,i=[t.id],o=!1;for(;i.length>0;){let t=i.shift();if(!(!t||r.has(t))){if(r.add(t),a.has(t)){o=!0;break}i.push(...P(t,e.edges))}}o||n.push({code:`missing_end_path`,severity:`error`,message:`Node has no path to an end node.`,nodeId:t.id})});let l=new Set,u=new Set,d=(t,r)=>{if(l.has(t)){r.slice(r.indexOf(t)).some(e=>o.get(e)?.type===`loopNode`)||n.push({code:`invalid_cycle`,severity:`error`,message:`Workflow cycles require a loop node.`,nodeId:t});return}u.has(t)||(l.add(t),P(t,e.edges).forEach(e=>d(e,[...r,e])),l.delete(t),u.add(t))};return e.nodes.forEach(e=>d(e.id,[e.id])),{valid:!n.some(e=>e.severity===`error`),issues:n}},re=F,I=e=>e==null?``:String(e),ie=e=>e.split(`
2
2
  `).map(e=>e.trim()).filter(Boolean).reduce((e,t)=>{let[n,...r]=t.split(`:`);return n&&r.length>0&&(e[n.trim()]=r.join(`:`).trim()),e},{}),ae=e=>e&&typeof e==`object`?Object.entries(e).map(([e,t])=>`${e}: ${t}`).join(`
3
- `):``,oe=({node:l,registry:u,issues:d,readOnly:f,onChange:p,onDelete:m,onClose:h,className:g})=>{let[_,v]=o.default.useState(!1);if(!l)return(0,c.jsxs)(`aside`,{className:e._(`w-80 border-l border-border bg-card/35 p-4`,g),"aria-label":`Workflow inspector`,children:[(0,c.jsx)(`div`,{className:`text-xs font-bold uppercase tracking-wide text-muted-foreground`,children:`Inspector`}),(0,c.jsx)(`div`,{className:`mt-6 rounded-lg border border-dashed border-border p-4 text-sm text-muted-foreground`,children:`Select a node to edit its configuration.`})]});let y=u[String(l.type??``)],b=l.data,x=y?.editor,S=(t,n,r)=>(0,c.jsxs)(`label`,{className:`grid gap-1.5`,children:[(0,c.jsx)(`span`,{className:e._(`text-[11px] font-semibold uppercase tracking-wide text-muted-foreground`,(r?d.some(e=>e.field===r):!1)&&`text-destructive`),children:t}),n]}),C=e=>p(e);return(0,c.jsxs)(`aside`,{className:e._(`w-80 border-l border-border bg-card/35 p-4 overflow-y-auto`,g),"aria-label":`Workflow inspector`,children:[(0,c.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,c.jsxs)(`div`,{className:`min-w-0`,children:[(0,c.jsx)(`div`,{className:`text-xs font-bold uppercase tracking-wide text-muted-foreground`,children:`Inspector`}),(0,c.jsx)(`div`,{className:`truncate text-sm font-semibold`,children:y?.label??l.type??`Node`})]}),(0,c.jsx)(t.t,{variant:`ghost`,size:`icon`,onClick:h,"aria-label":`Close inspector`,children:(0,c.jsx)(s.X,{size:16})})]}),(0,c.jsxs)(`div`,{className:`mt-4 grid gap-4`,children:[S(`Label`,(0,c.jsx)(n.t,{value:I(b.label),onChange:e=>C({label:e.target.value}),disabled:f}),`label`),S(`Description`,(0,c.jsx)(i.s,{value:I(b.description),onChange:e=>C({description:e.target.value}),disabled:f})),(()=>{if(x)return(0,c.jsx)(x,{node:l,data:b,onChange:C,readOnly:f,issues:d});switch(l.type){case`startNode`:return S(`Trigger`,(0,c.jsxs)(r.t,{value:I(`triggerType`in b?b.triggerType:`manual`),onValueChange:f?void 0:e=>C({triggerType:e}),children:[(0,c.jsx)(r.i,{children:(0,c.jsx)(r.a,{})}),(0,c.jsxs)(r.n,{children:[(0,c.jsx)(r.r,{value:`manual`,children:`Manual`}),(0,c.jsx)(r.r,{value:`scheduled`,children:`Scheduled`}),(0,c.jsx)(r.r,{value:`webhook`,children:`Webhook`})]})]}));case`endNode`:return S(`Outcome`,(0,c.jsxs)(r.t,{value:I(`outcome`in b?b.outcome:`success`),onValueChange:f?void 0:e=>C({outcome:e}),children:[(0,c.jsx)(r.i,{children:(0,c.jsx)(r.a,{})}),(0,c.jsxs)(r.n,{children:[(0,c.jsx)(r.r,{value:`success`,children:`Success`}),(0,c.jsx)(r.r,{value:`failure`,children:`Failure`}),(0,c.jsx)(r.r,{value:`cancelled`,children:`Cancelled`})]})]}));case`decisionNode`:return(0,c.jsxs)(c.Fragment,{children:[S(`Condition`,(0,c.jsx)(i.s,{value:I(`condition`in b?b.condition:``),onChange:e=>C({condition:e.target.value}),disabled:f})),S(`Branches`,(0,c.jsx)(i.s,{value:(`branches`in b&&Array.isArray(b.branches)?b.branches:[]).map(e=>e.label).join(`
3
+ `):``,oe=({node:l,registry:u,issues:d,readOnly:f,onChange:p,onDelete:m,onClose:h,className:g})=>{let[_,v]=o.default.useState(!1);if(!l)return(0,c.jsxs)(`aside`,{className:e._(`w-80 border-l border-border bg-card/35 p-4`,g),"aria-label":`Workflow inspector`,children:[(0,c.jsx)(`div`,{className:`text-xs font-bold uppercase tracking-wide text-muted-foreground`,children:`Inspector`}),(0,c.jsx)(`div`,{className:`mt-6 rounded-lg border border-dashed border-border p-4 text-sm text-muted-foreground`,children:`Select a node to edit its configuration.`})]});let y=u[String(l.type??``)],b=l.data,x=y?.editor,S=(t,n,r)=>(0,c.jsxs)(`label`,{className:`grid gap-1.5`,children:[(0,c.jsx)(`span`,{className:e._(`text-[11px] font-semibold uppercase tracking-wide text-muted-foreground`,(r?d.some(e=>e.field===r):!1)&&`text-destructive`),children:t}),n]}),C=e=>p(e);return(0,c.jsxs)(`aside`,{className:e._(`w-80 border-l border-border bg-card/35 p-4 overflow-y-auto`,g),"aria-label":`Workflow inspector`,children:[(0,c.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,c.jsxs)(`div`,{className:`min-w-0`,children:[(0,c.jsx)(`div`,{className:`text-xs font-bold uppercase tracking-wide text-muted-foreground`,children:`Inspector`}),(0,c.jsx)(`div`,{className:`truncate text-sm font-semibold`,children:y?.label??l.type??`Node`})]}),(0,c.jsx)(t.t,{variant:`ghost`,size:`icon`,onClick:h,"aria-label":`Close inspector`,children:(0,c.jsx)(s.X,{size:16})})]}),(0,c.jsxs)(`div`,{className:`mt-4 grid gap-4`,children:[S(`Label`,(0,c.jsx)(n.t,{value:I(b.label),onChange:e=>C({label:e.target.value}),disabled:f}),`label`),S(`Description`,(0,c.jsx)(r.s,{value:I(b.description),onChange:e=>C({description:e.target.value}),disabled:f})),(()=>{if(x)return(0,c.jsx)(x,{node:l,data:b,onChange:C,readOnly:f,issues:d});switch(l.type){case`startNode`:return S(`Trigger`,(0,c.jsxs)(i.t,{value:I(`triggerType`in b?b.triggerType:`manual`),onValueChange:f?void 0:e=>C({triggerType:e}),children:[(0,c.jsx)(i.i,{children:(0,c.jsx)(i.a,{})}),(0,c.jsxs)(i.n,{children:[(0,c.jsx)(i.r,{value:`manual`,children:`Manual`}),(0,c.jsx)(i.r,{value:`scheduled`,children:`Scheduled`}),(0,c.jsx)(i.r,{value:`webhook`,children:`Webhook`})]})]}));case`endNode`:return S(`Outcome`,(0,c.jsxs)(i.t,{value:I(`outcome`in b?b.outcome:`success`),onValueChange:f?void 0:e=>C({outcome:e}),children:[(0,c.jsx)(i.i,{children:(0,c.jsx)(i.a,{})}),(0,c.jsxs)(i.n,{children:[(0,c.jsx)(i.r,{value:`success`,children:`Success`}),(0,c.jsx)(i.r,{value:`failure`,children:`Failure`}),(0,c.jsx)(i.r,{value:`cancelled`,children:`Cancelled`})]})]}));case`decisionNode`:return(0,c.jsxs)(c.Fragment,{children:[S(`Condition`,(0,c.jsx)(r.s,{value:I(`condition`in b?b.condition:``),onChange:e=>C({condition:e.target.value}),disabled:f})),S(`Branches`,(0,c.jsx)(r.s,{value:(`branches`in b&&Array.isArray(b.branches)?b.branches:[]).map(e=>e.label).join(`
4
4
  `),onChange:e=>C({branches:e.target.value.split(`
5
- `).filter(Boolean).map((e,t)=>({id:`branch-${t+1}`,label:e}))}),disabled:f}),`branches`)]});case`loopNode`:return(0,c.jsxs)(c.Fragment,{children:[S(`Iterator source`,(0,c.jsx)(n.t,{value:I(`iteratorSource`in b?b.iteratorSource:``),onChange:e=>C({iteratorSource:e.target.value}),disabled:f}),`iteratorSource`),S(`Max iterations`,(0,c.jsx)(n.t,{type:`number`,min:1,value:I(`maxIterations`in b?b.maxIterations:10),onChange:e=>C({maxIterations:Number(e.target.value)}),disabled:f}))]});case`actionNode`:return S(`Action type`,(0,c.jsx)(n.t,{value:I(`actionType`in b?b.actionType:``),onChange:e=>C({actionType:e.target.value}),disabled:f}),`actionType`);case`requestNode`:return(0,c.jsxs)(c.Fragment,{children:[S(`Method`,(0,c.jsxs)(r.t,{value:I(`method`in b?b.method:`GET`),onValueChange:f?void 0:e=>C({method:e}),children:[(0,c.jsx)(r.i,{children:(0,c.jsx)(r.a,{})}),(0,c.jsxs)(r.n,{children:[(0,c.jsx)(r.r,{value:`GET`,children:`GET`}),(0,c.jsx)(r.r,{value:`POST`,children:`POST`}),(0,c.jsx)(r.r,{value:`PUT`,children:`PUT`}),(0,c.jsx)(r.r,{value:`PATCH`,children:`PATCH`}),(0,c.jsx)(r.r,{value:`DELETE`,children:`DELETE`})]})]})),S(`URL`,(0,c.jsx)(n.t,{value:I(`url`in b?b.url:``),onChange:e=>C({url:e.target.value}),disabled:f}),`url`),S(`Headers`,(0,c.jsx)(i.s,{value:ae(`headers`in b?b.headers:void 0),onChange:e=>C({headers:ie(e.target.value)}),disabled:f}))]});case`delayNode`:return(0,c.jsxs)(c.Fragment,{children:[S(`Duration`,(0,c.jsx)(n.t,{type:`number`,min:1,value:I(`duration`in b?b.duration:1),onChange:e=>C({duration:Number(e.target.value)}),disabled:f}),`duration`),S(`Unit`,(0,c.jsxs)(r.t,{value:I(`unit`in b?b.unit:`hours`),onValueChange:f?void 0:e=>C({unit:e}),children:[(0,c.jsx)(r.i,{children:(0,c.jsx)(r.a,{})}),(0,c.jsxs)(r.n,{children:[(0,c.jsx)(r.r,{value:`seconds`,children:`Seconds`}),(0,c.jsx)(r.r,{value:`minutes`,children:`Minutes`}),(0,c.jsx)(r.r,{value:`hours`,children:`Hours`}),(0,c.jsx)(r.r,{value:`days`,children:`Days`})]})]}))]});case`approvalNode`:return(0,c.jsxs)(c.Fragment,{children:[S(`Approver role`,(0,c.jsx)(n.t,{value:I(`approverRole`in b?b.approverRole:``),onChange:e=>C({approverRole:e.target.value}),disabled:f}),`approverRole`),S(`Escalation role`,(0,c.jsx)(n.t,{value:I(`escalationRole`in b?b.escalationRole:``),onChange:e=>C({escalationRole:e.target.value}),disabled:f})),S(`SLA hours`,(0,c.jsx)(n.t,{type:`number`,min:1,value:I(`slaHours`in b?b.slaHours:``),onChange:e=>C({slaHours:Number(e.target.value)}),disabled:f}))]});default:return S(`Description`,(0,c.jsx)(i.s,{value:I(b.description),onChange:e=>C({description:e.target.value}),disabled:f}))}})()]}),d.length>0&&(0,c.jsx)(`div`,{className:`mt-4 grid gap-2 rounded-lg border border-destructive/30 bg-destructive/5 p-3`,children:d.map((e,t)=>(0,c.jsxs)(`div`,{className:`flex gap-2 text-xs text-destructive`,children:[(0,c.jsx)(s.AlertCircle,{size:14,className:`mt-0.5 shrink-0`}),(0,c.jsx)(`span`,{children:e.message})]},`${e.code}-${t}`))}),!f&&(0,c.jsxs)(c.Fragment,{children:[(0,c.jsxs)(t.t,{variant:`destructive`,className:`mt-4 w-full gap-2`,onClick:()=>v(!0),children:[(0,c.jsx)(s.Trash2,{size:14}),`Delete node`]}),(0,c.jsx)(a.t,{isOpen:_,onClose:()=>v(!1),onConfirm:()=>{m(),v(!1)},title:`Delete Node`,message:`Are you sure you want to delete this node?`,description:`This action cannot be undone.`})]})]})},se=o.default.forwardRef((n,r)=>{let{workflow:i,defaultWorkflow:a=O,workflowId:u,service:d,nodeRegistry:f,onWorkflowChange:p,onNodeAdd:m,onNodeUpdate:h,onNodeDelete:g,onConnectionCreate:_,onValidationChange:v,onSave:y,onPublish:b,onError:x,title:S,description:C,status:T,toolboxTitle:ee=`Node Library`,showHeader:k=!0,showToolbox:j=!0,showInspector:M=!0,showValidationPanel:te=!0,showActionBar:P=!0,autoValidate:re=!0,readOnly:I=!1,showGrid:ie=!0,snapToGrid:ae=!0,fitView:se=!0,exportFileName:L=`workflow.json`,className:ce,classNames:R,...z}=n,B=o.default.useMemo(()=>({...A,...f}),[f]),le=o.default.useMemo(()=>{let e={};return Object.values(B).forEach(t=>{t.component&&(e[t.type]=t.component)}),e},[B]),ue=o.default.useMemo(()=>ne(B),[B]),V=i!==void 0,[de,fe]=o.default.useState(()=>N(a)),[pe,me]=o.default.useState(ie),[he,ge]=o.default.useState(ae),[_e,ve]=o.default.useState(!1),[ye,H]=o.default.useState(null),[U,W]=o.default.useState(()=>F(i??de,B)),[be,xe]=o.default.useState(!1),[Se,Ce]=o.default.useState(!1),[we,Te]=o.default.useState(!1),[Ee,De]=o.default.useState(void 0),[Oe,G]=o.default.useState(null),ke=o.default.useRef(null),K=o.default.useRef(i??de),q=o.default.useRef([]),J=o.default.useRef([]),{fitView:Ae,screenToFlowPosition:je}=(0,l.useReactFlow)(),Y=i??de;o.default.useEffect(()=>{K.current=Y},[Y]),o.default.useEffect(()=>me(ie),[ie]),o.default.useEffect(()=>ge(ae),[ae]);let X=o.default.useCallback((e=K.current)=>F(e,B),[B]),Z=o.default.useCallback((e,t=!0)=>{let n=N({...e,metadata:{...e.metadata,updatedAt:new Date().toISOString()}});if(t&&(q.current=[...q.current,N(K.current)],J.current=[]),K.current=n,V||fe(n),p?.(n),re){let e=X(n);W(e),v?.(e)}},[re,V,v,p,X]),Q=o.default.useCallback(e=>{let t=B[String(e.type)],n={id:e.id??`${e.type}-${Date.now()}`,type:e.type,position:e.position??{x:120,y:120},data:{...t?.defaultData??{label:e.type},...e.data??{}}},r={...K.current,nodes:[...K.current.nodes,n]};Z(r),m?.({node:n,workflow:N(r)})},[Z,B,m]),Me=o.default.useCallback((e,t)=>{let n,r=K.current.nodes.map(r=>r.id===e?(n={...r,data:{...r.data,...t}},n):r);if(!n)return;let i={...K.current,nodes:r};Z(i),h?.({node:n,workflow:N(i)})},[Z,h]),Ne=o.default.useCallback(e=>{let t=K.current.nodes.find(t=>t.id===e);if(!t)return;let n={...K.current,nodes:K.current.nodes.filter(t=>t.id!==e),edges:K.current.edges.filter(t=>t.source!==e&&t.target!==e)};H(t=>t===e?null:t),Z(n),g?.({node:t,workflow:N(n)})},[Z,g]),Pe=o.default.useCallback((e,t)=>{let n={id:`${e}-${t}-${Date.now()}`,source:e,target:t,type:`ezEdge`,animated:!0},r={...K.current,edges:(0,l.addEdge)(n,K.current.edges)};Z(r),_?.({edge:n,sourceId:e,targetId:t,workflow:N(r)})},[Z,_]);o.default.useEffect(()=>{if(!d||!u||V)return;let e=!0;return xe(!0),G(null),d.loadWorkflow(u).then(t=>{e&&Z(t,!1)}).catch(t=>{e&&(G(t.message),x?.(t,`load`))}).finally(()=>{e&&xe(!1)}),()=>{e=!1}},[V,Z,x,d,u]),o.default.useEffect(()=>{let e=X(Y);W(e),v?.(e)},[Y,v,X]),o.default.useImperativeHandle(r,()=>({getWorkflow:()=>N(K.current),setWorkflow:e=>Z(e),validate:()=>X(),addNode:Q,updateNode:Me,deleteNode:Ne,connect:Pe,undo:()=>{let e=q.current[q.current.length-1];e&&(q.current=q.current.slice(0,-1),J.current=[N(K.current),...J.current],Z(e,!1))},redo:()=>{let e=J.current[0];e&&(J.current=J.current.slice(1),q.current=[...q.current,N(K.current)],Z(e,!1))},canUndo:()=>q.current.length>0,canRedo:()=>J.current.length>0,fitView:()=>Ae(),exportJson:()=>JSON.stringify(K.current,null,2),importJson:e=>{try{Z(JSON.parse(e)),G(null)}catch(e){let t=e instanceof Error?e:Error(`Invalid workflow JSON.`);G(t.message),x?.(t,`import`)}}}),[Q,Pe,Ne,Z,Ae,x,Me,X]);let Fe=o.default.useCallback(e=>{let t=(0,l.applyNodeChanges)(e,K.current.nodes);Z({...K.current,nodes:t})},[Z]),Ie=o.default.useCallback(e=>{Z({...K.current,edges:(0,l.applyEdgeChanges)(e,K.current.edges)})},[Z]),Le=o.default.useCallback(e=>{Z({...K.current,edges:K.current.edges.filter(t=>t.id!==e)})},[Z]),Re=o.default.useCallback(e=>{e.source&&e.target&&Pe(e.source,e.target)},[Pe]),ze=o.default.useCallback(e=>{e.preventDefault();let t=e.dataTransfer.getData(`application/reactflow`)||e.dataTransfer.getData(`text/plain`);t&&Q({type:t,position:je({x:e.clientX,y:e.clientY})})},[Q,je]),Be=o.default.useCallback(async()=>{let e=N(K.current),t=X(e);if(W(t),v?.(t),t.valid){Ce(!0),G(null);try{d&&u&&await d.saveWorkflow(u,e),await y?.(e),De(new Date().toISOString())}catch(e){let t=e instanceof Error?e:Error(`Failed to save workflow.`);G(t.message),x?.(t,`save`)}finally{Ce(!1)}}},[x,y,v,d,X,u]),Ve=o.default.useCallback(async()=>{let e=N({...K.current,metadata:{...K.current.metadata,status:`live`,publishedAt:new Date().toISOString()}}),t=X(e);if(W(t),v?.(t),t.valid){Te(!0),G(null);try{d&&u&&await d.publishWorkflow(u,e),await b?.(e),Z(e,!1)}catch(e){let t=e instanceof Error?e:Error(`Failed to publish workflow.`);G(t.message),x?.(t,`publish`)}finally{Te(!1)}}},[Z,x,b,v,d,X,u]),He=o.default.useCallback(()=>{try{let e=X();W(e),v?.(e),G(null)}catch(e){let t=e instanceof Error?e:Error(`Failed to validate workflow.`);G(t.message),x?.(t,`validate`)}},[x,v,X]),Ue=o.default.useCallback(e=>{let t=e.target.files?.[0];t&&t.text().then(t=>{try{Z(JSON.parse(t)),G(null)}catch(e){let t=e instanceof Error?e:Error(`Invalid workflow JSON.`);G(t.message),x?.(t,`import`)}finally{e.target.value=``}})},[Z,x]),We=o.default.useCallback(()=>{let e=new Blob([JSON.stringify(K.current,null,2)],{type:`application/json`}),t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=L,n.click(),URL.revokeObjectURL(t)},[L]),Ge=S??Y.metadata?.title??`Untitled Workflow`,Ke=C??Y.metadata?.description,$=ye?Y.nodes.find(e=>e.id===ye):void 0,qe=ye?U.issues.filter(e=>e.nodeId===ye):[],Je=U.issues.filter(e=>e.severity===`error`).length,Ye=U.issues.filter(e=>e.severity===`warning`).length,Xe=q.current.length>0,Ze=J.current.length>0;return(0,c.jsxs)(`div`,{className:e._(`ez-workflow flex h-full min-h-[560px] flex-col overflow-hidden bg-background`,R?.root,ce),...z,children:[(0,c.jsx)(`input`,{ref:ke,type:`file`,accept:`application/json,.json`,className:`hidden`,onChange:Ue}),k&&(0,c.jsx)(D,{title:Ge,description:Ke,status:T??Y.metadata?.status,isDirty:q.current.length>0,onTitleChange:e=>Z({...K.current,metadata:{...K.current.metadata,title:e}}),onDescriptionChange:e=>Z({...K.current,metadata:{...K.current.metadata,description:e}}),onSave:Be,onPublish:Ve,showGrid:pe,onShowGridChange:me,snapToGrid:he,onSnapToGridChange:ge,className:R?.header}),(0,c.jsxs)(`div`,{className:e._(`flex min-h-0 flex-1`,R?.body),children:[j&&(0,c.jsx)(E,{categories:ue,title:ee,collapsed:_e,onCollapsedChange:ve,onNodeActivate:e=>Q({type:e.type}),className:R?.toolbox}),(0,c.jsx)(w,{nodes:Y.nodes,edges:Y.edges,onNodesChange:Fe,onEdgesChange:Ie,onConnect:Re,onDrop:ze,onDragOver:e=>{e.preventDefault(),e.dataTransfer.dropEffect=`move`},onNodeClick:(e,t)=>H(t.id),onNodeDoubleClick:(e,t)=>H(t.id),onEdgeDelete:Le,onPaneClick:()=>H(null),nodeTypes:le,showGrid:pe,snapToGrid:he,fitView:se,readOnly:I,className:e._(`flex-1`,R?.canvas)}),M&&(0,c.jsx)(oe,{node:$,registry:B,issues:qe,readOnly:I,onChange:e=>$&&Me($.id,e),onDelete:()=>$&&Ne($.id),onClose:()=>H(null),className:R?.inspector})]}),(P||te)&&(0,c.jsxs)(`footer`,{className:e._(`flex min-h-14 items-center justify-between gap-3 border-t border-border bg-card/50 px-4 py-2`,R?.actionBar),"aria-label":`Workflow actions`,children:[(0,c.jsx)(`div`,{className:`flex min-w-0 items-center gap-2`,children:P&&(0,c.jsxs)(c.Fragment,{children:[(0,c.jsxs)(t.t,{variant:`outline`,size:`sm`,className:`gap-2`,disabled:!Xe||I,onClick:()=>{let e=q.current[q.current.length-1];e&&(q.current=q.current.slice(0,-1),J.current=[N(K.current),...J.current],Z(e,!1))},children:[(0,c.jsx)(s.Undo2,{size:14}),`Undo`]}),(0,c.jsxs)(t.t,{variant:`outline`,size:`sm`,className:`gap-2`,disabled:!Ze||I,onClick:()=>{let e=J.current[0];e&&(J.current=J.current.slice(1),q.current=[...q.current,N(K.current)],Z(e,!1))},children:[(0,c.jsx)(s.Redo2,{size:14}),`Redo`]}),(0,c.jsxs)(t.t,{variant:`outline`,size:`sm`,className:`gap-2`,onClick:He,children:[(0,c.jsx)(s.Wand2,{size:14}),`Validate`]}),(0,c.jsxs)(t.t,{variant:`outline`,size:`sm`,className:`gap-2`,onClick:()=>ke.current?.click(),disabled:I,children:[(0,c.jsx)(s.Upload,{size:14}),`Import`]}),(0,c.jsxs)(t.t,{variant:`outline`,size:`sm`,className:`gap-2`,onClick:We,children:[(0,c.jsx)(s.Download,{size:14}),`Export`]})]})}),te&&(0,c.jsxs)(`div`,{className:e._(`flex min-w-0 items-center gap-3 text-xs`,R?.validationPanel),children:[be||Se||we?(0,c.jsxs)(`span`,{className:`inline-flex items-center gap-2 text-muted-foreground`,children:[(0,c.jsx)(s.RefreshCw,{size:14,className:`animate-spin`}),be?`Loading`:we?`Publishing`:`Saving`]}):U.valid?(0,c.jsxs)(`span`,{className:`inline-flex items-center gap-2 text-emerald-600`,children:[(0,c.jsx)(s.CheckCircle2,{size:14}),`Valid`]}):(0,c.jsxs)(`span`,{className:`inline-flex items-center gap-2 text-destructive`,children:[(0,c.jsx)(s.AlertCircle,{size:14}),Je,` error`,Je===1?``:`s`,Ye>0?`, ${Ye} warning${Ye===1?``:`s`}`:``]}),Ee&&(0,c.jsxs)(`span`,{className:`hidden text-muted-foreground md:inline`,children:[`Saved `,new Date(Ee).toLocaleTimeString()]}),Oe&&(0,c.jsx)(`span`,{className:`max-w-[320px] truncate text-destructive`,children:Oe}),U.issues.slice(0,2).map((e,t)=>(0,c.jsx)(`button`,{type:`button`,className:`hidden max-w-[260px] truncate rounded border border-border px-2 py-1 text-left text-muted-foreground hover:bg-muted lg:block`,"aria-label":`Go to validation issue: ${e.message}`,onClick:()=>e.nodeId&&H(e.nodeId),children:e.message},`${e.code}-${e.nodeId??t}`))]})]})]})});se.displayName=`EzWorkflowInner`;var L=o.default.forwardRef((e,t)=>(0,c.jsx)(l.ReactFlowProvider,{children:(0,c.jsx)(se,{...e,ref:t})}));L.displayName=`EzWorkflow`;var ce=o.default.forwardRef((e,t)=>(0,c.jsx)(L,{...e,ref:t}));ce.displayName=`EzFlow`;var R=async e=>({"content-type":`application/json`,...(typeof e==`function`?await e():e)??{}}),z=async(e,t)=>{if(e.ok)return;let n=await e.text().catch(()=>``);throw Error(n||`Workflow ${t} failed with ${e.status}.`)},B=class{baseUrl;fetcher;headers;constructor(e){this.baseUrl=e.baseUrl.replace(/\/$/,``),this.fetcher=e.fetcher??fetch,this.headers=e.headers}async loadWorkflow(e){let t=await this.fetcher(`${this.baseUrl}/workflows/${encodeURIComponent(e)}`);return await z(t,`load`),t.json()}async saveWorkflow(e,t){await z(await this.fetcher(`${this.baseUrl}/workflows/${encodeURIComponent(e)}`,{method:`PUT`,headers:await R(this.headers),body:JSON.stringify(t)}),`save`)}async publishWorkflow(e,t){await z(await this.fetcher(`${this.baseUrl}/workflows/${encodeURIComponent(e)}/publish`,{method:`POST`,headers:await R(this.headers),body:JSON.stringify(t)}),`publish`)}async validateWorkflow(e){let t=await this.fetcher(`${this.baseUrl}/workflows/validate`,{method:`POST`,headers:await R(this.headers),body:JSON.stringify(e)});return await z(t,`validate`),t.json()}},le=class{service;lastStableWorkflow;constructor(e){this.service=e}getRollbackWorkflow(){return this.lastStableWorkflow}async loadWorkflow(e){let t=await this.service.loadWorkflow(e);return this.lastStableWorkflow=t,t}async saveWorkflow(e,t){let n=this.lastStableWorkflow;this.lastStableWorkflow=t;try{await this.service.saveWorkflow(e,t)}catch(e){throw this.lastStableWorkflow=n,e}}async publishWorkflow(e,t){let n=this.lastStableWorkflow;this.lastStableWorkflow=t;try{await this.service.publishWorkflow(e,t)}catch(e){throw this.lastStableWorkflow=n,e}}validateWorkflow(e){return this.service.validateWorkflow(e)}},ue=(e={})=>{let t=new Map(Object.entries(e));return{workflows:t,async loadWorkflow(e){let n=t.get(e);if(!n)throw Error(`Workflow ${e} was not found.`);return n},async saveWorkflow(e,n){t.set(e,n)},async publishWorkflow(e,n){t.set(e,{...n,metadata:{...n.metadata,status:`live`,publishedAt:n.metadata?.publishedAt??new Date().toISOString()}})},async validateWorkflow(e){return F(e)}}},V=e=>{let t=Math.max(2,Math.floor(e)),n=Array.from({length:t},(e,n)=>n===0?{id:`node-0`,type:`startNode`,position:{x:0,y:0},data:{label:`Start`}}:n===t-1?{id:`node-${n}`,type:`endNode`,position:{x:n*180,y:0},data:{label:`End`}}:{id:`node-${n}`,type:`actionNode`,position:{x:n*180,y:n%5*120},data:{label:`Action ${n}`,actionType:`noop`}});return{nodes:n,edges:n.slice(0,-1).map((e,t)=>({id:`${e.id}-${n[t+1].id}`,source:e.id,target:n[t+1].id,type:`ezEdge`})),metadata:{title:`${t} node performance workflow`,status:`draft`,version:1}}},de=e=>{let t=V(e),n=typeof performance<`u`?()=>performance.now():()=>Date.now(),r=n(),i=F(t);return{nodeCount:t.nodes.length,edgeCount:t.edges.length,validateMs:n()-r,valid:i.valid,issueCount:i.issues.length}},fe={nodes:[{id:`start`,type:`startNode`,position:{x:0,y:120},data:{label:`Request submitted`,triggerType:`manual`}},{id:`approval`,type:`approvalNode`,position:{x:280,y:120},data:{label:`Manager approval`,approverRole:`manager`,slaHours:24}},{id:`decision`,type:`decisionNode`,position:{x:560,y:120},data:{label:`Approved?`,branches:[{id:`yes`,label:`Approved`},{id:`no`,label:`Rejected`}]}},{id:`end-success`,type:`endNode`,position:{x:840,y:40},data:{label:`Approved`,outcome:`success`}},{id:`end-failure`,type:`endNode`,position:{x:840,y:200},data:{label:`Rejected`,outcome:`failure`}}],edges:[{id:`start-approval`,source:`start`,target:`approval`,type:`ezEdge`},{id:`approval-decision`,source:`approval`,target:`decision`,type:`ezEdge`},{id:`decision-success`,source:`decision`,target:`end-success`,type:`ezEdge`},{id:`decision-failure`,source:`decision`,target:`end-failure`,type:`ezEdge`}],metadata:{title:`Approval workflow`,description:`Human approval with positive and negative outcomes.`,status:`draft`,version:1}},pe={nodes:[{id:`start`,type:`startNode`,position:{x:0,y:100},data:{label:`Webhook received`,triggerType:`webhook`}},{id:`request`,type:`requestNode`,position:{x:280,y:100},data:{label:`Create ticket`,method:`POST`,url:`https://api.example.com/tickets`}},{id:`end`,type:`endNode`,position:{x:560,y:100},data:{label:`Ticket created`,outcome:`success`}}],edges:[{id:`start-request`,source:`start`,target:`request`,type:`ezEdge`},{id:`request-end`,source:`request`,target:`end`,type:`ezEdge`}],metadata:{title:`API request workflow`,description:`Webhook to HTTP request.`,status:`draft`,version:1}},me={nodes:[{id:`start`,type:`startNode`,position:{x:0,y:100},data:{label:`Nightly schedule`,triggerType:`scheduled`}},{id:`delay`,type:`delayNode`,position:{x:280,y:100},data:{label:`Wait for upstream data`,duration:30,unit:`minutes`}},{id:`action`,type:`actionNode`,position:{x:560,y:100},data:{label:`Run reconciliation`,actionType:`reconcile`}},{id:`end`,type:`endNode`,position:{x:840,y:100},data:{label:`Completed`,outcome:`success`}}],edges:[{id:`start-delay`,source:`start`,target:`delay`,type:`ezEdge`},{id:`delay-action`,source:`delay`,target:`action`,type:`ezEdge`},{id:`action-end`,source:`action`,target:`end`,type:`ezEdge`}],metadata:{title:`Scheduled workflow`,description:`Scheduled job with delayed execution.`,status:`draft`,version:1}},he={nodes:[{id:`start`,type:`startNode`,position:{x:0,y:100},data:{label:`Case opened`,triggerType:`manual`}},{id:`review`,type:`approvalNode`,position:{x:280,y:100},data:{label:`Specialist review`,approverRole:`specialist`,escalationRole:`team-lead`,slaHours:8}},{id:`action`,type:`actionNode`,position:{x:560,y:100},data:{label:`Apply decision`,actionType:`apply-review-outcome`}},{id:`end`,type:`endNode`,position:{x:840,y:100},data:{label:`Case closed`,outcome:`success`}}],edges:[{id:`start-review`,source:`start`,target:`review`,type:`ezEdge`},{id:`review-action`,source:`review`,target:`action`,type:`ezEdge`},{id:`action-end`,source:`action`,target:`end`,type:`ezEdge`}],metadata:{title:`Human review workflow`,description:`Human review followed by an automated action.`,status:`draft`,version:1}};Object.defineProperty(exports,"A",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"C",{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,"D",{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,"E",{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,"O",{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,"S",{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,"T",{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,"_",{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return V}}),Object.defineProperty(exports,"b",{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return B}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return L}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(exports,"g",{enumerable:!0,get:function(){return D}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return re}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return me}}),Object.defineProperty(exports,"j",{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,"k",{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return F}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return fe}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return de}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return A}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return he}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return le}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return pe}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return ce}}),Object.defineProperty(exports,"v",{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,"w",{enumerable:!0,get:function(){return _}}),Object.defineProperty(exports,"x",{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,"y",{enumerable:!0,get:function(){return S}});
5
+ `).filter(Boolean).map((e,t)=>({id:`branch-${t+1}`,label:e}))}),disabled:f}),`branches`)]});case`loopNode`:return(0,c.jsxs)(c.Fragment,{children:[S(`Iterator source`,(0,c.jsx)(n.t,{value:I(`iteratorSource`in b?b.iteratorSource:``),onChange:e=>C({iteratorSource:e.target.value}),disabled:f}),`iteratorSource`),S(`Max iterations`,(0,c.jsx)(n.t,{type:`number`,min:1,value:I(`maxIterations`in b?b.maxIterations:10),onChange:e=>C({maxIterations:Number(e.target.value)}),disabled:f}))]});case`actionNode`:return S(`Action type`,(0,c.jsx)(n.t,{value:I(`actionType`in b?b.actionType:``),onChange:e=>C({actionType:e.target.value}),disabled:f}),`actionType`);case`requestNode`:return(0,c.jsxs)(c.Fragment,{children:[S(`Method`,(0,c.jsxs)(i.t,{value:I(`method`in b?b.method:`GET`),onValueChange:f?void 0:e=>C({method:e}),children:[(0,c.jsx)(i.i,{children:(0,c.jsx)(i.a,{})}),(0,c.jsxs)(i.n,{children:[(0,c.jsx)(i.r,{value:`GET`,children:`GET`}),(0,c.jsx)(i.r,{value:`POST`,children:`POST`}),(0,c.jsx)(i.r,{value:`PUT`,children:`PUT`}),(0,c.jsx)(i.r,{value:`PATCH`,children:`PATCH`}),(0,c.jsx)(i.r,{value:`DELETE`,children:`DELETE`})]})]})),S(`URL`,(0,c.jsx)(n.t,{value:I(`url`in b?b.url:``),onChange:e=>C({url:e.target.value}),disabled:f}),`url`),S(`Headers`,(0,c.jsx)(r.s,{value:ae(`headers`in b?b.headers:void 0),onChange:e=>C({headers:ie(e.target.value)}),disabled:f}))]});case`delayNode`:return(0,c.jsxs)(c.Fragment,{children:[S(`Duration`,(0,c.jsx)(n.t,{type:`number`,min:1,value:I(`duration`in b?b.duration:1),onChange:e=>C({duration:Number(e.target.value)}),disabled:f}),`duration`),S(`Unit`,(0,c.jsxs)(i.t,{value:I(`unit`in b?b.unit:`hours`),onValueChange:f?void 0:e=>C({unit:e}),children:[(0,c.jsx)(i.i,{children:(0,c.jsx)(i.a,{})}),(0,c.jsxs)(i.n,{children:[(0,c.jsx)(i.r,{value:`seconds`,children:`Seconds`}),(0,c.jsx)(i.r,{value:`minutes`,children:`Minutes`}),(0,c.jsx)(i.r,{value:`hours`,children:`Hours`}),(0,c.jsx)(i.r,{value:`days`,children:`Days`})]})]}))]});case`approvalNode`:return(0,c.jsxs)(c.Fragment,{children:[S(`Approver role`,(0,c.jsx)(n.t,{value:I(`approverRole`in b?b.approverRole:``),onChange:e=>C({approverRole:e.target.value}),disabled:f}),`approverRole`),S(`Escalation role`,(0,c.jsx)(n.t,{value:I(`escalationRole`in b?b.escalationRole:``),onChange:e=>C({escalationRole:e.target.value}),disabled:f})),S(`SLA hours`,(0,c.jsx)(n.t,{type:`number`,min:1,value:I(`slaHours`in b?b.slaHours:``),onChange:e=>C({slaHours:Number(e.target.value)}),disabled:f}))]});default:return S(`Description`,(0,c.jsx)(r.s,{value:I(b.description),onChange:e=>C({description:e.target.value}),disabled:f}))}})()]}),d.length>0&&(0,c.jsx)(`div`,{className:`mt-4 grid gap-2 rounded-lg border border-destructive/30 bg-destructive/5 p-3`,children:d.map((e,t)=>(0,c.jsxs)(`div`,{className:`flex gap-2 text-xs text-destructive`,children:[(0,c.jsx)(s.AlertCircle,{size:14,className:`mt-0.5 shrink-0`}),(0,c.jsx)(`span`,{children:e.message})]},`${e.code}-${t}`))}),!f&&(0,c.jsxs)(c.Fragment,{children:[(0,c.jsxs)(t.t,{variant:`destructive`,className:`mt-4 w-full gap-2`,onClick:()=>v(!0),children:[(0,c.jsx)(s.Trash2,{size:14}),`Delete node`]}),(0,c.jsx)(a.t,{isOpen:_,onClose:()=>v(!1),onConfirm:()=>{m(),v(!1)},title:`Delete Node`,message:`Are you sure you want to delete this node?`,description:`This action cannot be undone.`})]})]})},se=o.default.forwardRef((n,r)=>{let{workflow:i,defaultWorkflow:a=O,workflowId:u,service:d,nodeRegistry:f,onWorkflowChange:p,onNodeAdd:m,onNodeUpdate:h,onNodeDelete:g,onConnectionCreate:_,onValidationChange:v,onSave:y,onPublish:b,onError:x,title:S,description:C,status:T,toolboxTitle:ee=`Node Library`,showHeader:k=!0,showToolbox:j=!0,showInspector:M=!0,showValidationPanel:te=!0,showActionBar:P=!0,autoValidate:re=!0,readOnly:I=!1,showGrid:ie=!0,snapToGrid:ae=!0,fitView:se=!0,exportFileName:L=`workflow.json`,className:ce,classNames:R,...z}=n,B=o.default.useMemo(()=>({...A,...f}),[f]),le=o.default.useMemo(()=>{let e={};return Object.values(B).forEach(t=>{t.component&&(e[t.type]=t.component)}),e},[B]),ue=o.default.useMemo(()=>ne(B),[B]),V=i!==void 0,[de,fe]=o.default.useState(()=>N(a)),[pe,me]=o.default.useState(ie),[he,ge]=o.default.useState(ae),[_e,ve]=o.default.useState(!1),[ye,H]=o.default.useState(null),[U,W]=o.default.useState(()=>F(i??de,B)),[be,xe]=o.default.useState(!1),[Se,Ce]=o.default.useState(!1),[we,Te]=o.default.useState(!1),[Ee,De]=o.default.useState(void 0),[Oe,G]=o.default.useState(null),ke=o.default.useRef(null),K=o.default.useRef(i??de),q=o.default.useRef([]),J=o.default.useRef([]),{fitView:Ae,screenToFlowPosition:je}=(0,l.useReactFlow)(),Y=i??de;o.default.useEffect(()=>{K.current=Y},[Y]),o.default.useEffect(()=>me(ie),[ie]),o.default.useEffect(()=>ge(ae),[ae]);let X=o.default.useCallback((e=K.current)=>F(e,B),[B]),Z=o.default.useCallback((e,t=!0)=>{let n=N({...e,metadata:{...e.metadata,updatedAt:new Date().toISOString()}});if(t&&(q.current=[...q.current,N(K.current)],J.current=[]),K.current=n,V||fe(n),p?.(n),re){let e=X(n);W(e),v?.(e)}},[re,V,v,p,X]),Q=o.default.useCallback(e=>{let t=B[String(e.type)],n={id:e.id??`${e.type}-${Date.now()}`,type:e.type,position:e.position??{x:120,y:120},data:{...t?.defaultData??{label:e.type},...e.data??{}}},r={...K.current,nodes:[...K.current.nodes,n]};Z(r),m?.({node:n,workflow:N(r)})},[Z,B,m]),Me=o.default.useCallback((e,t)=>{let n,r=K.current.nodes.map(r=>r.id===e?(n={...r,data:{...r.data,...t}},n):r);if(!n)return;let i={...K.current,nodes:r};Z(i),h?.({node:n,workflow:N(i)})},[Z,h]),Ne=o.default.useCallback(e=>{let t=K.current.nodes.find(t=>t.id===e);if(!t)return;let n={...K.current,nodes:K.current.nodes.filter(t=>t.id!==e),edges:K.current.edges.filter(t=>t.source!==e&&t.target!==e)};H(t=>t===e?null:t),Z(n),g?.({node:t,workflow:N(n)})},[Z,g]),Pe=o.default.useCallback((e,t)=>{let n={id:`${e}-${t}-${Date.now()}`,source:e,target:t,type:`ezEdge`,animated:!0},r={...K.current,edges:(0,l.addEdge)(n,K.current.edges)};Z(r),_?.({edge:n,sourceId:e,targetId:t,workflow:N(r)})},[Z,_]);o.default.useEffect(()=>{if(!d||!u||V)return;let e=!0;return xe(!0),G(null),d.loadWorkflow(u).then(t=>{e&&Z(t,!1)}).catch(t=>{e&&(G(t.message),x?.(t,`load`))}).finally(()=>{e&&xe(!1)}),()=>{e=!1}},[V,Z,x,d,u]),o.default.useEffect(()=>{let e=X(Y);W(e),v?.(e)},[Y,v,X]),o.default.useImperativeHandle(r,()=>({getWorkflow:()=>N(K.current),setWorkflow:e=>Z(e),validate:()=>X(),addNode:Q,updateNode:Me,deleteNode:Ne,connect:Pe,undo:()=>{let e=q.current[q.current.length-1];e&&(q.current=q.current.slice(0,-1),J.current=[N(K.current),...J.current],Z(e,!1))},redo:()=>{let e=J.current[0];e&&(J.current=J.current.slice(1),q.current=[...q.current,N(K.current)],Z(e,!1))},canUndo:()=>q.current.length>0,canRedo:()=>J.current.length>0,fitView:()=>Ae(),exportJson:()=>JSON.stringify(K.current,null,2),importJson:e=>{try{Z(JSON.parse(e)),G(null)}catch(e){let t=e instanceof Error?e:Error(`Invalid workflow JSON.`);G(t.message),x?.(t,`import`)}}}),[Q,Pe,Ne,Z,Ae,x,Me,X]);let Fe=o.default.useCallback(e=>{let t=(0,l.applyNodeChanges)(e,K.current.nodes);Z({...K.current,nodes:t})},[Z]),Ie=o.default.useCallback(e=>{Z({...K.current,edges:(0,l.applyEdgeChanges)(e,K.current.edges)})},[Z]),Le=o.default.useCallback(e=>{Z({...K.current,edges:K.current.edges.filter(t=>t.id!==e)})},[Z]),Re=o.default.useCallback(e=>{e.source&&e.target&&Pe(e.source,e.target)},[Pe]),ze=o.default.useCallback(e=>{e.preventDefault();let t=e.dataTransfer.getData(`application/reactflow`)||e.dataTransfer.getData(`text/plain`);t&&Q({type:t,position:je({x:e.clientX,y:e.clientY})})},[Q,je]),Be=o.default.useCallback(async()=>{let e=N(K.current),t=X(e);if(W(t),v?.(t),t.valid){Ce(!0),G(null);try{d&&u&&await d.saveWorkflow(u,e),await y?.(e),De(new Date().toISOString())}catch(e){let t=e instanceof Error?e:Error(`Failed to save workflow.`);G(t.message),x?.(t,`save`)}finally{Ce(!1)}}},[x,y,v,d,X,u]),Ve=o.default.useCallback(async()=>{let e=N({...K.current,metadata:{...K.current.metadata,status:`live`,publishedAt:new Date().toISOString()}}),t=X(e);if(W(t),v?.(t),t.valid){Te(!0),G(null);try{d&&u&&await d.publishWorkflow(u,e),await b?.(e),Z(e,!1)}catch(e){let t=e instanceof Error?e:Error(`Failed to publish workflow.`);G(t.message),x?.(t,`publish`)}finally{Te(!1)}}},[Z,x,b,v,d,X,u]),He=o.default.useCallback(()=>{try{let e=X();W(e),v?.(e),G(null)}catch(e){let t=e instanceof Error?e:Error(`Failed to validate workflow.`);G(t.message),x?.(t,`validate`)}},[x,v,X]),Ue=o.default.useCallback(e=>{let t=e.target.files?.[0];t&&t.text().then(t=>{try{Z(JSON.parse(t)),G(null)}catch(e){let t=e instanceof Error?e:Error(`Invalid workflow JSON.`);G(t.message),x?.(t,`import`)}finally{e.target.value=``}})},[Z,x]),We=o.default.useCallback(()=>{let e=new Blob([JSON.stringify(K.current,null,2)],{type:`application/json`}),t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=L,n.click(),URL.revokeObjectURL(t)},[L]),Ge=S??Y.metadata?.title??`Untitled Workflow`,Ke=C??Y.metadata?.description,$=ye?Y.nodes.find(e=>e.id===ye):void 0,qe=ye?U.issues.filter(e=>e.nodeId===ye):[],Je=U.issues.filter(e=>e.severity===`error`).length,Ye=U.issues.filter(e=>e.severity===`warning`).length,Xe=q.current.length>0,Ze=J.current.length>0;return(0,c.jsxs)(`div`,{className:e._(`ez-workflow flex h-full min-h-[560px] flex-col overflow-hidden bg-background`,R?.root,ce),...z,children:[(0,c.jsx)(`input`,{ref:ke,type:`file`,accept:`application/json,.json`,className:`hidden`,onChange:Ue}),k&&(0,c.jsx)(D,{title:Ge,description:Ke,status:T??Y.metadata?.status,isDirty:q.current.length>0,onTitleChange:e=>Z({...K.current,metadata:{...K.current.metadata,title:e}}),onDescriptionChange:e=>Z({...K.current,metadata:{...K.current.metadata,description:e}}),onSave:Be,onPublish:Ve,showGrid:pe,onShowGridChange:me,snapToGrid:he,onSnapToGridChange:ge,className:R?.header}),(0,c.jsxs)(`div`,{className:e._(`flex min-h-0 flex-1`,R?.body),children:[j&&(0,c.jsx)(E,{categories:ue,title:ee,collapsed:_e,onCollapsedChange:ve,onNodeActivate:e=>Q({type:e.type}),className:R?.toolbox}),(0,c.jsx)(w,{nodes:Y.nodes,edges:Y.edges,onNodesChange:Fe,onEdgesChange:Ie,onConnect:Re,onDrop:ze,onDragOver:e=>{e.preventDefault(),e.dataTransfer.dropEffect=`move`},onNodeClick:(e,t)=>H(t.id),onNodeDoubleClick:(e,t)=>H(t.id),onEdgeDelete:Le,onPaneClick:()=>H(null),nodeTypes:le,showGrid:pe,snapToGrid:he,fitView:se,readOnly:I,className:e._(`flex-1`,R?.canvas)}),M&&(0,c.jsx)(oe,{node:$,registry:B,issues:qe,readOnly:I,onChange:e=>$&&Me($.id,e),onDelete:()=>$&&Ne($.id),onClose:()=>H(null),className:R?.inspector})]}),(P||te)&&(0,c.jsxs)(`footer`,{className:e._(`flex min-h-14 items-center justify-between gap-3 border-t border-border bg-card/50 px-4 py-2`,R?.actionBar),"aria-label":`Workflow actions`,children:[(0,c.jsx)(`div`,{className:`flex min-w-0 items-center gap-2`,children:P&&(0,c.jsxs)(c.Fragment,{children:[(0,c.jsxs)(t.t,{variant:`outline`,size:`sm`,className:`gap-2`,disabled:!Xe||I,onClick:()=>{let e=q.current[q.current.length-1];e&&(q.current=q.current.slice(0,-1),J.current=[N(K.current),...J.current],Z(e,!1))},children:[(0,c.jsx)(s.Undo2,{size:14}),`Undo`]}),(0,c.jsxs)(t.t,{variant:`outline`,size:`sm`,className:`gap-2`,disabled:!Ze||I,onClick:()=>{let e=J.current[0];e&&(J.current=J.current.slice(1),q.current=[...q.current,N(K.current)],Z(e,!1))},children:[(0,c.jsx)(s.Redo2,{size:14}),`Redo`]}),(0,c.jsxs)(t.t,{variant:`outline`,size:`sm`,className:`gap-2`,onClick:He,children:[(0,c.jsx)(s.Wand2,{size:14}),`Validate`]}),(0,c.jsxs)(t.t,{variant:`outline`,size:`sm`,className:`gap-2`,onClick:()=>ke.current?.click(),disabled:I,children:[(0,c.jsx)(s.Upload,{size:14}),`Import`]}),(0,c.jsxs)(t.t,{variant:`outline`,size:`sm`,className:`gap-2`,onClick:We,children:[(0,c.jsx)(s.Download,{size:14}),`Export`]})]})}),te&&(0,c.jsxs)(`div`,{className:e._(`flex min-w-0 items-center gap-3 text-xs`,R?.validationPanel),children:[be||Se||we?(0,c.jsxs)(`span`,{className:`inline-flex items-center gap-2 text-muted-foreground`,children:[(0,c.jsx)(s.RefreshCw,{size:14,className:`animate-spin`}),be?`Loading`:we?`Publishing`:`Saving`]}):U.valid?(0,c.jsxs)(`span`,{className:`inline-flex items-center gap-2 text-emerald-600`,children:[(0,c.jsx)(s.CheckCircle2,{size:14}),`Valid`]}):(0,c.jsxs)(`span`,{className:`inline-flex items-center gap-2 text-destructive`,children:[(0,c.jsx)(s.AlertCircle,{size:14}),Je,` error`,Je===1?``:`s`,Ye>0?`, ${Ye} warning${Ye===1?``:`s`}`:``]}),Ee&&(0,c.jsxs)(`span`,{className:`hidden text-muted-foreground md:inline`,children:[`Saved `,new Date(Ee).toLocaleTimeString()]}),Oe&&(0,c.jsx)(`span`,{className:`max-w-[320px] truncate text-destructive`,children:Oe}),U.issues.slice(0,2).map((e,t)=>(0,c.jsx)(`button`,{type:`button`,className:`hidden max-w-[260px] truncate rounded border border-border px-2 py-1 text-left text-muted-foreground hover:bg-muted lg:block`,"aria-label":`Go to validation issue: ${e.message}`,onClick:()=>e.nodeId&&H(e.nodeId),children:e.message},`${e.code}-${e.nodeId??t}`))]})]})]})});se.displayName=`EzWorkflowInner`;var L=o.default.forwardRef((e,t)=>(0,c.jsx)(l.ReactFlowProvider,{children:(0,c.jsx)(se,{...e,ref:t})}));L.displayName=`EzWorkflow`;var ce=o.default.forwardRef((e,t)=>(0,c.jsx)(L,{...e,ref:t}));ce.displayName=`EzFlow`;var R=async e=>({"content-type":`application/json`,...(typeof e==`function`?await e():e)??{}}),z=async(e,t)=>{if(e.ok)return;let n=await e.text().catch(()=>``);throw Error(n||`Workflow ${t} failed with ${e.status}.`)},B=class{baseUrl;fetcher;headers;constructor(e){this.baseUrl=e.baseUrl.replace(/\/$/,``),this.fetcher=e.fetcher??fetch,this.headers=e.headers}async loadWorkflow(e){let t=await this.fetcher(`${this.baseUrl}/workflows/${encodeURIComponent(e)}`);return await z(t,`load`),t.json()}async saveWorkflow(e,t){await z(await this.fetcher(`${this.baseUrl}/workflows/${encodeURIComponent(e)}`,{method:`PUT`,headers:await R(this.headers),body:JSON.stringify(t)}),`save`)}async publishWorkflow(e,t){await z(await this.fetcher(`${this.baseUrl}/workflows/${encodeURIComponent(e)}/publish`,{method:`POST`,headers:await R(this.headers),body:JSON.stringify(t)}),`publish`)}async validateWorkflow(e){let t=await this.fetcher(`${this.baseUrl}/workflows/validate`,{method:`POST`,headers:await R(this.headers),body:JSON.stringify(e)});return await z(t,`validate`),t.json()}},le=class{service;lastStableWorkflow;constructor(e){this.service=e}getRollbackWorkflow(){return this.lastStableWorkflow}async loadWorkflow(e){let t=await this.service.loadWorkflow(e);return this.lastStableWorkflow=t,t}async saveWorkflow(e,t){let n=this.lastStableWorkflow;this.lastStableWorkflow=t;try{await this.service.saveWorkflow(e,t)}catch(e){throw this.lastStableWorkflow=n,e}}async publishWorkflow(e,t){let n=this.lastStableWorkflow;this.lastStableWorkflow=t;try{await this.service.publishWorkflow(e,t)}catch(e){throw this.lastStableWorkflow=n,e}}validateWorkflow(e){return this.service.validateWorkflow(e)}},ue=(e={})=>{let t=new Map(Object.entries(e));return{workflows:t,async loadWorkflow(e){let n=t.get(e);if(!n)throw Error(`Workflow ${e} was not found.`);return n},async saveWorkflow(e,n){t.set(e,n)},async publishWorkflow(e,n){t.set(e,{...n,metadata:{...n.metadata,status:`live`,publishedAt:n.metadata?.publishedAt??new Date().toISOString()}})},async validateWorkflow(e){return F(e)}}},V=e=>{let t=Math.max(2,Math.floor(e)),n=Array.from({length:t},(e,n)=>n===0?{id:`node-0`,type:`startNode`,position:{x:0,y:0},data:{label:`Start`}}:n===t-1?{id:`node-${n}`,type:`endNode`,position:{x:n*180,y:0},data:{label:`End`}}:{id:`node-${n}`,type:`actionNode`,position:{x:n*180,y:n%5*120},data:{label:`Action ${n}`,actionType:`noop`}});return{nodes:n,edges:n.slice(0,-1).map((e,t)=>({id:`${e.id}-${n[t+1].id}`,source:e.id,target:n[t+1].id,type:`ezEdge`})),metadata:{title:`${t} node performance workflow`,status:`draft`,version:1}}},de=e=>{let t=V(e),n=typeof performance<`u`?()=>performance.now():()=>Date.now(),r=n(),i=F(t);return{nodeCount:t.nodes.length,edgeCount:t.edges.length,validateMs:n()-r,valid:i.valid,issueCount:i.issues.length}},fe={nodes:[{id:`start`,type:`startNode`,position:{x:0,y:120},data:{label:`Request submitted`,triggerType:`manual`}},{id:`approval`,type:`approvalNode`,position:{x:280,y:120},data:{label:`Manager approval`,approverRole:`manager`,slaHours:24}},{id:`decision`,type:`decisionNode`,position:{x:560,y:120},data:{label:`Approved?`,branches:[{id:`yes`,label:`Approved`},{id:`no`,label:`Rejected`}]}},{id:`end-success`,type:`endNode`,position:{x:840,y:40},data:{label:`Approved`,outcome:`success`}},{id:`end-failure`,type:`endNode`,position:{x:840,y:200},data:{label:`Rejected`,outcome:`failure`}}],edges:[{id:`start-approval`,source:`start`,target:`approval`,type:`ezEdge`},{id:`approval-decision`,source:`approval`,target:`decision`,type:`ezEdge`},{id:`decision-success`,source:`decision`,target:`end-success`,type:`ezEdge`},{id:`decision-failure`,source:`decision`,target:`end-failure`,type:`ezEdge`}],metadata:{title:`Approval workflow`,description:`Human approval with positive and negative outcomes.`,status:`draft`,version:1}},pe={nodes:[{id:`start`,type:`startNode`,position:{x:0,y:100},data:{label:`Webhook received`,triggerType:`webhook`}},{id:`request`,type:`requestNode`,position:{x:280,y:100},data:{label:`Create ticket`,method:`POST`,url:`https://api.example.com/tickets`}},{id:`end`,type:`endNode`,position:{x:560,y:100},data:{label:`Ticket created`,outcome:`success`}}],edges:[{id:`start-request`,source:`start`,target:`request`,type:`ezEdge`},{id:`request-end`,source:`request`,target:`end`,type:`ezEdge`}],metadata:{title:`API request workflow`,description:`Webhook to HTTP request.`,status:`draft`,version:1}},me={nodes:[{id:`start`,type:`startNode`,position:{x:0,y:100},data:{label:`Nightly schedule`,triggerType:`scheduled`}},{id:`delay`,type:`delayNode`,position:{x:280,y:100},data:{label:`Wait for upstream data`,duration:30,unit:`minutes`}},{id:`action`,type:`actionNode`,position:{x:560,y:100},data:{label:`Run reconciliation`,actionType:`reconcile`}},{id:`end`,type:`endNode`,position:{x:840,y:100},data:{label:`Completed`,outcome:`success`}}],edges:[{id:`start-delay`,source:`start`,target:`delay`,type:`ezEdge`},{id:`delay-action`,source:`delay`,target:`action`,type:`ezEdge`},{id:`action-end`,source:`action`,target:`end`,type:`ezEdge`}],metadata:{title:`Scheduled workflow`,description:`Scheduled job with delayed execution.`,status:`draft`,version:1}},he={nodes:[{id:`start`,type:`startNode`,position:{x:0,y:100},data:{label:`Case opened`,triggerType:`manual`}},{id:`review`,type:`approvalNode`,position:{x:280,y:100},data:{label:`Specialist review`,approverRole:`specialist`,escalationRole:`team-lead`,slaHours:8}},{id:`action`,type:`actionNode`,position:{x:560,y:100},data:{label:`Apply decision`,actionType:`apply-review-outcome`}},{id:`end`,type:`endNode`,position:{x:840,y:100},data:{label:`Case closed`,outcome:`success`}}],edges:[{id:`start-review`,source:`start`,target:`review`,type:`ezEdge`},{id:`review-action`,source:`review`,target:`action`,type:`ezEdge`},{id:`action-end`,source:`action`,target:`end`,type:`ezEdge`}],metadata:{title:`Human review workflow`,description:`Human review followed by an automated action.`,status:`draft`,version:1}};Object.defineProperty(exports,"A",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"C",{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,"D",{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,"E",{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,"O",{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,"S",{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,"T",{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,"_",{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return V}}),Object.defineProperty(exports,"b",{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return B}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return L}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(exports,"g",{enumerable:!0,get:function(){return D}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return re}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return me}}),Object.defineProperty(exports,"j",{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,"k",{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return F}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return fe}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return de}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return A}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return he}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return le}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return pe}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return ce}}),Object.defineProperty(exports,"v",{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,"w",{enumerable:!0,get:function(){return _}}),Object.defineProperty(exports,"x",{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,"y",{enumerable:!0,get:function(){return S}});