@object-ui/plugin-workflow 4.0.5 → 4.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,30 @@
1
1
  # @object-ui/plugin-workflow
2
2
 
3
+ ## 4.0.6
4
+
5
+ ### Patch Changes
6
+
7
+ - 1b6dc64: fix: complete Tailwind v3→v4 migration cleanup
8
+ - Rename deprecated `flex-shrink-0` → `shrink-0` and `flex-grow-N` →
9
+ `grow-N` (Tailwind v4 dropped the long-form aliases). Affects
10
+ data-table, fields/index, FileField, ChatbotEnhanced,
11
+ FloatingChatbotPanel, ProcessDesigner, HistoryPanel, KanbanEnhanced,
12
+ KanbanImpl, plugin-timeline index, FlowDesigner, LayoutRenderer.
13
+ - Replace `theme(spacing.4)` inside arbitrary-value `[calc(...)]` with
14
+ literal `1rem` in sidebar.tsx — `theme()` is deprecated in v4.
15
+ - Remove obsolete v3-escape CSS overrides from index.css and
16
+ sidebar-fixes.css. The component source now uses native v4 stacked
17
+ data variants (`group-data-[state=collapsed]:group-data-[collapsible=icon]:w-(--sidebar-width-icon)`)
18
+ which Tailwind v4 emits correctly without the manual overrides.
19
+ Only the bespoke `.sidebar-menu-button-icon-mode*` rules are kept.
20
+
21
+ - Updated dependencies [925051d]
22
+ - Updated dependencies [1b6dc64]
23
+ - @object-ui/components@4.0.6
24
+ - @object-ui/types@4.0.6
25
+ - @object-ui/core@4.0.6
26
+ - @object-ui/react@4.0.6
27
+
3
28
  ## 4.0.5
4
29
 
5
30
  ### Patch Changes
package/dist/index.js CHANGED
@@ -1823,7 +1823,7 @@ var Ve = ({ node: e, isSelected: t, isConnectSource: n, connectMode: r, readOnly
1823
1823
  Ee
1824
1824
  ]),
1825
1825
  children: [/* @__PURE__ */ H(l, {
1826
- className: "py-2 px-4 border-b flex-shrink-0",
1826
+ className: "py-2 px-4 border-b shrink-0",
1827
1827
  children: /* @__PURE__ */ U("div", {
1828
1828
  className: "flex items-center gap-3 flex-wrap",
1829
1829
  children: [
@@ -1948,7 +1948,7 @@ var Ve = ({ node: e, isSelected: t, isConnectSource: n, connectMode: r, readOnly
1948
1948
  className: "flex flex-1 p-0 overflow-hidden",
1949
1949
  children: [
1950
1950
  m && !p && /* @__PURE__ */ U("div", {
1951
- className: "w-36 border-r bg-muted/30 flex-shrink-0 overflow-y-auto py-2 px-2",
1951
+ className: "w-36 border-r bg-muted/30 shrink-0 overflow-y-auto py-2 px-2",
1952
1952
  children: [
1953
1953
  /* @__PURE__ */ H("p", {
1954
1954
  className: "text-[10px] font-semibold text-muted-foreground uppercase tracking-wide mb-2 px-1",
@@ -2119,11 +2119,11 @@ var Ve = ({ node: e, isSelected: t, isConnectSource: n, connectMode: r, readOnly
2119
2119
  })
2120
2120
  }),
2121
2121
  W && b.length > 0 && /* @__PURE__ */ H("div", {
2122
- className: "w-48 border-l bg-background flex-shrink-0 overflow-y-auto",
2122
+ className: "w-48 border-l bg-background shrink-0 overflow-y-auto",
2123
2123
  children: /* @__PURE__ */ H(Ue, { versions: b })
2124
2124
  }),
2125
2125
  _e && /* @__PURE__ */ U("div", {
2126
- className: "w-52 border-l bg-background flex-shrink-0 overflow-y-auto",
2126
+ className: "w-52 border-l bg-background shrink-0 overflow-y-auto",
2127
2127
  children: [/* @__PURE__ */ H(He, {
2128
2128
  node: xe,
2129
2129
  edge: Se,
@@ -1,2 +1,2 @@
1
1
  (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`@object-ui/core`),require(`react`),require(`@object-ui/components`),require(`lucide-react`),require(`react/jsx-runtime`),require(`clsx`),require(`tailwind-merge`)):typeof define==`function`&&define.amd?define([`exports`,`@object-ui/core`,`react`,`@object-ui/components`,`lucide-react`,`react/jsx-runtime`,`clsx`,`tailwind-merge`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.ObjectUIPluginWorkflow={},e.ObjectUICore,e.React,e.ObjectUIComponents,e.lucide_react,e.react_jsx_runtime,e.clsx,e.tailwind_merge))})(this,function(e,t,n,r,i,a,o,s){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var c=Object.create,l=Object.defineProperty,u=Object.getOwnPropertyDescriptor,d=Object.getOwnPropertyNames,f=Object.getPrototypeOf,p=Object.prototype.hasOwnProperty,m=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=d(t),a=0,o=i.length,s;a<o;a++)s=i[a],!p.call(e,s)&&s!==n&&l(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=u(t,s))||r.enumerable});return e};n=((e,t,n)=>(n=e==null?{}:c(f(e)),m(t||!e||!e.__esModule?l(n,`default`,{value:e,enumerable:!0}):n,e)))(n,1);var h={start:(0,a.jsx)(i.Play,{className:`h-4 w-4 text-green-500`}),end:(0,a.jsx)(i.CheckCircle,{className:`h-4 w-4 text-red-500`}),task:(0,a.jsx)(i.Circle,{className:`h-4 w-4 text-blue-500`}),approval:(0,a.jsx)(i.Users,{className:`h-4 w-4 text-purple-500`}),condition:(0,a.jsx)(i.GitBranch,{className:`h-4 w-4 text-orange-500`}),parallel:(0,a.jsx)(i.ArrowRight,{className:`h-4 w-4 text-teal-500`}),delay:(0,a.jsx)(i.Clock,{className:`h-4 w-4 text-gray-500`}),notification:(0,a.jsx)(i.Bell,{className:`h-4 w-4 text-yellow-500`}),script:(0,a.jsx)(i.Code,{className:`h-4 w-4 text-indigo-500`})},g={start:`border-green-300 bg-green-50`,end:`border-red-300 bg-red-50`,task:`border-blue-300 bg-blue-50`,approval:`border-purple-300 bg-purple-50`,condition:`border-orange-300 bg-orange-50`,parallel:`border-teal-300 bg-teal-50`,delay:`border-gray-300 bg-gray-50`,notification:`border-yellow-300 bg-yellow-50`,script:`border-indigo-300 bg-indigo-50`},_={draft:{variant:`secondary`,label:`Draft`},active:{variant:`default`,label:`Active`},paused:{variant:`outline`,label:`Paused`},completed:{variant:`default`,label:`Completed`},cancelled:{variant:`destructive`,label:`Cancelled`}},v=({schema:e})=>{let{workflow:t,readOnly:o=!1,showToolbar:s=!0}=e,[c,l]=(0,n.useState)(t||{type:`workflow`,title:`New Workflow`,status:`draft`,nodes:[{id:`start-1`,type:`start`,label:`Start`,position:{x:100,y:100}},{id:`end-1`,type:`end`,label:`End`,position:{x:100,y:400}}],edges:[],variables:[]}),[u,d]=(0,n.useState)(null),[f,p]=(0,n.useState)(null),m=(0,n.useMemo)(()=>c.nodes.find(e=>e.id===u),[c.nodes,u]),v=(0,n.useCallback)(e=>{if(o)return;let t=`${e}-${Date.now()}`,n={id:t,type:e,label:`New ${e.charAt(0).toUpperCase()+e.slice(1)}`,position:{x:200,y:(c.nodes.length+1)*80}};l(e=>({...e,nodes:[...e.nodes,n]})),d(t)},[o,c.nodes.length]),y=(0,n.useCallback)((e,t)=>{o||l(n=>({...n,nodes:n.nodes.map(n=>n.id===e?{...n,...t}:n)}))},[o]),b=(0,n.useCallback)(e=>{o||(l(t=>({...t,nodes:t.nodes.filter(t=>t.id!==e),edges:t.edges.filter(t=>t.source!==e&&t.target!==e)})),u===e&&d(null))},[o,u]),x=(0,n.useCallback)((e,t)=>{if(o)return;let n={id:`edge-${Date.now()}`,source:e,target:t};l(e=>({...e,edges:[...e.edges,n]}))},[o]),S=(0,n.useCallback)(e=>{o||(l(t=>({...t,edges:t.edges.filter(t=>t.id!==e)})),f===e&&p(null))},[o,f]),C=()=>{console.log(`Saving workflow:`,c),e.onSave},w=()=>{l(e=>({...e,status:`active`})),console.log(`Publishing workflow`),e.onPublish},T=_[c.status||`draft`];return(0,a.jsxs)(`div`,{className:`space-y-4`,children:[s&&(0,a.jsxs)(`div`,{className:`flex items-center justify-between gap-2 p-4 bg-card rounded-lg border`,children:[(0,a.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,a.jsx)(`div`,{children:(0,a.jsx)(r.Input,{value:c.title||``,onChange:e=>l(t=>({...t,title:e.target.value})),className:`text-lg font-semibold border-none p-0 h-auto focus-visible:ring-0`,readOnly:o,placeholder:`Workflow Title`})}),(0,a.jsx)(r.Badge,{variant:T.variant,children:T.label})]}),!o&&(0,a.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,a.jsxs)(r.Button,{variant:`outline`,size:`sm`,onClick:C,children:[(0,a.jsx)(i.Save,{className:`h-4 w-4 mr-2`}),`Save`]}),(0,a.jsxs)(r.Button,{size:`sm`,onClick:w,disabled:c.status===`active`,children:[(0,a.jsx)(i.Play,{className:`h-4 w-4 mr-2`}),`Publish`]})]})]}),(0,a.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-4 gap-4`,children:[!o&&(0,a.jsxs)(r.Card,{className:`lg:col-span-1`,children:[(0,a.jsx)(r.CardHeader,{children:(0,a.jsx)(r.CardTitle,{className:`text-sm`,children:`Add Node`})}),(0,a.jsx)(r.CardContent,{className:`space-y-2`,children:[`task`,`approval`,`condition`,`parallel`,`delay`,`notification`,`script`].map(e=>(0,a.jsxs)(`button`,{onClick:()=>v(e),className:`w-full flex items-center gap-2 p-2 rounded-md border hover:bg-muted/50 transition-colors text-sm`,children:[h[e],(0,a.jsx)(`span`,{className:`capitalize`,children:e})]},e))})]}),(0,a.jsxs)(r.Card,{className:o?`lg:col-span-3`:`lg:col-span-2`,children:[(0,a.jsx)(r.CardHeader,{children:(0,a.jsxs)(r.CardTitle,{className:`text-sm flex items-center gap-2`,children:[(0,a.jsx)(i.GitBranch,{className:`h-4 w-4`}),`Workflow Flow`]})}),(0,a.jsx)(r.CardContent,{children:(0,a.jsxs)(`div`,{className:`space-y-2`,children:[c.nodes.map(e=>(0,a.jsxs)(`div`,{onClick:()=>{d(e.id),p(null)},className:`flex items-center justify-between p-3 rounded-lg border-2 cursor-pointer transition-all ${g[e.type]} ${u===e.id?`ring-2 ring-primary shadow-md`:`hover:shadow-sm`}`,children:[(0,a.jsxs)(`div`,{className:`flex items-center gap-2`,children:[h[e.type],(0,a.jsx)(`span`,{className:`font-medium text-sm`,children:e.label}),(0,a.jsxs)(`span`,{className:`text-xs text-muted-foreground capitalize`,children:[`(`,e.type,`)`]})]}),(0,a.jsxs)(`div`,{className:`flex items-center gap-1`,children:[c.edges.filter(t=>t.source===e.id).length>0&&(0,a.jsxs)(r.Badge,{variant:`outline`,className:`text-xs`,children:[c.edges.filter(t=>t.source===e.id).length,` out`]}),!o&&e.type!==`start`&&e.type!==`end`&&(0,a.jsx)(r.Button,{size:`sm`,variant:`ghost`,className:`h-6 w-6 p-0 text-red-500 hover:text-red-700`,onClick:t=>{t.stopPropagation(),b(e.id)},children:(0,a.jsx)(i.Trash2,{className:`h-3 w-3`})})]})]},e.id)),c.edges.length>0&&(0,a.jsxs)(`div`,{className:`mt-4 pt-4 border-t`,children:[(0,a.jsx)(r.Label,{className:`text-xs text-muted-foreground mb-2 block`,children:`Connections`}),c.edges.map(e=>{let t=c.nodes.find(t=>t.id===e.source),n=c.nodes.find(t=>t.id===e.target);return(0,a.jsxs)(`div`,{className:`flex items-center gap-2 p-2 text-sm`,children:[(0,a.jsx)(`span`,{children:t?.label||e.source}),(0,a.jsx)(i.ArrowRight,{className:`h-3 w-3 text-muted-foreground`}),(0,a.jsx)(`span`,{children:n?.label||e.target}),e.label&&(0,a.jsx)(r.Badge,{variant:`outline`,className:`text-xs`,children:e.label}),!o&&(0,a.jsx)(r.Button,{size:`sm`,variant:`ghost`,className:`h-5 w-5 p-0 ml-auto text-red-500`,onClick:()=>S(e.id),children:(0,a.jsx)(i.Trash2,{className:`h-3 w-3`})})]},e.id)})]}),!o&&c.nodes.length>=2&&(0,a.jsxs)(`div`,{className:`mt-4 pt-4 border-t`,children:[(0,a.jsx)(r.Label,{className:`text-xs text-muted-foreground mb-2 block`,children:`Quick Connect`}),(0,a.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,a.jsxs)(`select`,{id:`edge-source`,className:`border rounded-md p-1.5 text-sm bg-background`,children:[(0,a.jsx)(`option`,{value:``,children:`From...`}),c.nodes.filter(e=>e.type!==`end`).map(e=>(0,a.jsx)(`option`,{value:e.id,children:e.label},e.id))]}),(0,a.jsxs)(`select`,{id:`edge-target`,className:`border rounded-md p-1.5 text-sm bg-background`,children:[(0,a.jsx)(`option`,{value:``,children:`To...`}),c.nodes.filter(e=>e.type!==`start`).map(e=>(0,a.jsx)(`option`,{value:e.id,children:e.label},e.id))]})]}),(0,a.jsxs)(r.Button,{size:`sm`,variant:`outline`,className:`mt-2 w-full`,onClick:()=>{let e=document.getElementById(`edge-source`)?.value,t=document.getElementById(`edge-target`)?.value;e&&t&&e!==t&&x(e,t)},children:[(0,a.jsx)(i.Plus,{className:`h-3 w-3 mr-1`}),`Connect`]})]})]})})]}),(0,a.jsxs)(r.Card,{className:`lg:col-span-1`,children:[(0,a.jsx)(r.CardHeader,{children:(0,a.jsxs)(r.CardTitle,{className:`text-sm flex items-center gap-2`,children:[(0,a.jsx)(i.Settings,{className:`h-4 w-4`}),`Properties`]})}),(0,a.jsx)(r.CardContent,{children:m?(0,a.jsxs)(`div`,{className:`space-y-3`,children:[(0,a.jsxs)(`div`,{className:`space-y-1`,children:[(0,a.jsx)(r.Label,{className:`text-xs`,children:`Label`}),(0,a.jsx)(r.Input,{value:m.label,onChange:e=>y(m.id,{label:e.target.value}),className:`h-8 text-sm`,readOnly:o})]}),(0,a.jsxs)(`div`,{className:`space-y-1`,children:[(0,a.jsx)(r.Label,{className:`text-xs`,children:`Type`}),(0,a.jsxs)(`div`,{className:`flex items-center gap-2 p-2 rounded-md bg-muted text-sm`,children:[h[m.type],(0,a.jsx)(`span`,{className:`capitalize`,children:m.type})]})]}),m.description!==void 0&&(0,a.jsxs)(`div`,{className:`space-y-1`,children:[(0,a.jsx)(r.Label,{className:`text-xs`,children:`Description`}),(0,a.jsx)(r.Input,{value:m.description||``,onChange:e=>y(m.id,{description:e.target.value}),className:`h-8 text-sm`,readOnly:o})]}),(m.type===`approval`||m.type===`task`)&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(`div`,{className:`space-y-1`,children:[(0,a.jsx)(r.Label,{className:`text-xs`,children:`Assignee`}),(0,a.jsx)(r.Input,{value:m.assignee||``,onChange:e=>y(m.id,{assignee:e.target.value}),className:`h-8 text-sm`,placeholder:`User, role, or expression`,readOnly:o})]}),(0,a.jsxs)(`div`,{className:`space-y-1`,children:[(0,a.jsx)(r.Label,{className:`text-xs`,children:`Assignee Type`}),(0,a.jsxs)(`select`,{className:`w-full border rounded-md h-8 text-sm px-2 bg-background`,value:m.assigneeType||`user`,onChange:e=>y(m.id,{assigneeType:e.target.value}),disabled:o,children:[(0,a.jsx)(`option`,{value:`user`,children:`User`}),(0,a.jsx)(`option`,{value:`role`,children:`Role`}),(0,a.jsx)(`option`,{value:`group`,children:`Group`}),(0,a.jsx)(`option`,{value:`expression`,children:`Expression`})]})]})]}),m.type===`delay`&&(0,a.jsxs)(`div`,{className:`space-y-1`,children:[(0,a.jsx)(r.Label,{className:`text-xs`,children:`Timeout (minutes)`}),(0,a.jsx)(r.Input,{type:`number`,value:m.timeout||60,onChange:e=>y(m.id,{timeout:Number(e.target.value)}),className:`h-8 text-sm`,readOnly:o})]}),(0,a.jsxs)(`div`,{className:`text-xs text-muted-foreground mt-2`,children:[`ID: `,m.id]})]}):(0,a.jsx)(`div`,{className:`text-sm text-muted-foreground text-center py-8`,children:`Select a node to edit its properties`})})]})]})]})},y=({schema:e})=>{let{currentNodeId:t,approvalRule:o,history:s=[],data:c,showHistory:l=!0,showComments:u=!0}=e,[d,f]=(0,n.useState)(``),[p,m]=(0,n.useState)(!1),h=e=>{m(!0),console.log(`Approval action: ${e}`,{currentNodeId:t,comment:d,data:c}),setTimeout(()=>{m(!1),f(``)},500)},g=e=>{switch(e){case`approve`:case`approved`:return(0,a.jsx)(r.Badge,{variant:`default`,className:`bg-green-500`,children:`Approved`});case`reject`:case`rejected`:return(0,a.jsx)(r.Badge,{variant:`destructive`,children:`Rejected`});case`reassign`:case`reassigned`:return(0,a.jsx)(r.Badge,{variant:`secondary`,children:`Reassigned`});case`comment`:return(0,a.jsx)(r.Badge,{variant:`outline`,children:`Comment`});case`escalate`:case`escalated`:return(0,a.jsx)(r.Badge,{variant:`secondary`,className:`bg-orange-500 text-white`,children:`Escalated`});default:return(0,a.jsx)(r.Badge,{variant:`outline`,children:e})}};return(0,a.jsxs)(`div`,{className:`space-y-4`,children:[(0,a.jsxs)(r.Card,{children:[(0,a.jsx)(r.CardHeader,{children:(0,a.jsxs)(r.CardTitle,{className:`flex items-center gap-2`,children:[(0,a.jsx)(i.Clock,{className:`h-5 w-5`}),`Pending Approval`,o&&(0,a.jsxs)(r.Badge,{variant:`outline`,className:`ml-2`,children:[o.type===`any`&&`Any approver`,o.type===`all`&&`All must approve`,o.type===`majority`&&`Majority approval`,o.type===`sequential`&&`Sequential`]})]})}),(0,a.jsxs)(r.CardContent,{className:`space-y-4`,children:[c&&Object.keys(c).length>0&&(0,a.jsxs)(`div`,{className:`p-3 bg-muted/50 rounded-lg`,children:[(0,a.jsx)(r.Label,{className:`text-xs text-muted-foreground mb-2 block`,children:`Request Details`}),(0,a.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:Object.entries(c).slice(0,6).map(([e,t])=>(0,a.jsxs)(`div`,{className:`text-sm`,children:[(0,a.jsxs)(`span`,{className:`text-muted-foreground`,children:[e,`: `]}),(0,a.jsx)(`span`,{className:`font-medium`,children:String(t)})]},e))})]}),u&&(0,a.jsxs)(`div`,{className:`space-y-2`,children:[(0,a.jsxs)(r.Label,{className:`flex items-center gap-2 text-sm`,children:[(0,a.jsx)(i.MessageSquare,{className:`h-4 w-4`}),`Comment`]}),(0,a.jsx)(r.Input,{value:d,onChange:e=>f(e.target.value),placeholder:`Add a comment (optional)`})]}),(0,a.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,a.jsxs)(r.Button,{onClick:()=>h(`approve`),disabled:p,className:`bg-green-600 hover:bg-green-700`,children:[(0,a.jsx)(i.Check,{className:`h-4 w-4 mr-2`}),`Approve`]}),(0,a.jsxs)(r.Button,{variant:`destructive`,onClick:()=>h(`reject`),disabled:p,children:[(0,a.jsx)(i.X,{className:`h-4 w-4 mr-2`}),`Reject`]}),(0,a.jsxs)(r.Button,{variant:`outline`,onClick:()=>h(`reassign`),disabled:p,children:[(0,a.jsx)(i.RefreshCw,{className:`h-4 w-4 mr-2`}),`Reassign`]})]})]})]}),l&&s.length>0&&(0,a.jsxs)(r.Card,{children:[(0,a.jsx)(r.CardHeader,{children:(0,a.jsx)(r.CardTitle,{className:`text-sm`,children:`Approval History`})}),(0,a.jsx)(r.CardContent,{children:(0,a.jsx)(`div`,{className:`space-y-3`,children:s.map((e,t)=>(0,a.jsxs)(`div`,{className:`flex items-start gap-3 p-3 rounded-lg border`,children:[(0,a.jsx)(`div`,{className:`mt-0.5`,children:(0,a.jsx)(i.User,{className:`h-4 w-4 text-muted-foreground`})}),(0,a.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,a.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,a.jsx)(`span`,{className:`font-medium text-sm`,children:e.actorName||e.actor}),g(e.action),(0,a.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:new Date(e.timestamp).toLocaleString()})]}),e.comment&&(0,a.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:e.comment})]})]},t))})})]}),l&&s.length===0&&(0,a.jsx)(r.Card,{children:(0,a.jsx)(r.CardContent,{className:`p-6 text-center text-muted-foreground text-sm`,children:`No approval history yet`})})]})},b={record_created:`Record Created`,record_updated:`Record Updated`,record_deleted:`Record Deleted`,field_changed:`Field Changed`,scheduled:`Scheduled`},x={send_email:`Send Email`,update_field:`Update Field`,create_record:`Create Record`,delete_record:`Delete Record`,webhook:`Webhook`,notification:`Notification`},S={send_email:(0,a.jsx)(i.Mail,{className:`h-4 w-4`}),update_field:(0,a.jsx)(i.FileEdit,{className:`h-4 w-4`}),create_record:(0,a.jsx)(i.Plus,{className:`h-4 w-4`}),delete_record:(0,a.jsx)(i.Trash2,{className:`h-4 w-4`}),webhook:(0,a.jsx)(i.Globe,{className:`h-4 w-4`}),notification:(0,a.jsx)(i.Bell,{className:`h-4 w-4`})},C={equals:`Equals`,not_equals:`Not Equals`,contains:`Contains`,greater_than:`Greater Than`,less_than:`Less Than`},w=()=>({id:`auto-${Date.now()}`,name:``,description:``,enabled:!0,trigger:{type:`record_created`},actions:[],createdAt:new Date().toISOString()}),T=({label:e,value:t,placeholder:n,onChange:i})=>(0,a.jsxs)(`div`,{className:`space-y-1`,children:[(0,a.jsx)(r.Label,{className:`text-xs`,children:e}),(0,a.jsx)(r.Input,{value:t,onChange:e=>i(e.target.value),placeholder:n})]}),E=({automation:e,objects:t=[],onSave:o,onCancel:s,className:c})=>{let[l,u]=(0,n.useState)(e??w()),d=(0,n.useCallback)(e=>{u(t=>({...t,trigger:{...t.trigger,...e}}))},[]),f=(0,n.useCallback)(()=>{u(e=>({...e,actions:[...e.actions,{type:`send_email`,params:{}}]}))},[]),p=(0,n.useCallback)((e,t)=>{u(n=>({...n,actions:n.actions.map((n,r)=>r===e?{...n,...t}:n)}))},[]),m=(0,n.useCallback)(e=>{u(t=>({...t,actions:t.actions.filter((t,n)=>n!==e)}))},[]),h=l.trigger.type!==`scheduled`,g=l.trigger.type===`field_changed`,_=l.trigger.type===`scheduled`,v=t.find(e=>e.name===l.trigger.objectName)?.fields,y=(e,t)=>{let n=(n,r)=>p(t,{params:{...e.params,[n]:r}});switch(e.type){case`send_email`:return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(T,{label:`To`,value:e.params.to??``,placeholder:`Recipient email`,onChange:e=>n(`to`,e)}),(0,a.jsx)(T,{label:`Subject`,value:e.params.subject??``,placeholder:`Email subject`,onChange:e=>n(`subject`,e)})]});case`webhook`:return(0,a.jsx)(T,{label:`URL`,value:e.params.url??``,placeholder:`https://...`,onChange:e=>n(`url`,e)});case`notification`:return(0,a.jsx)(T,{label:`Message`,value:e.params.message??``,placeholder:`Notification message`,onChange:e=>n(`message`,e)});case`update_field`:case`create_record`:case`delete_record`:return(0,a.jsx)(T,{label:`Target Object`,value:e.params.objectName??``,placeholder:`Object name`,onChange:e=>n(`objectName`,e)});default:return null}};return(0,a.jsxs)(`div`,{className:c??`space-y-4`,children:[(0,a.jsxs)(r.Card,{children:[(0,a.jsx)(r.CardHeader,{children:(0,a.jsxs)(r.CardTitle,{className:`flex items-center gap-2 text-sm`,children:[(0,a.jsx)(i.Zap,{className:`h-4 w-4 text-yellow-500`}),`Trigger`]})}),(0,a.jsxs)(r.CardContent,{className:`space-y-4`,children:[(0,a.jsxs)(`div`,{className:`space-y-1`,children:[(0,a.jsx)(r.Label,{className:`text-xs`,children:`Trigger Type`}),(0,a.jsxs)(r.Select,{value:l.trigger.type,onValueChange:e=>d({type:e}),children:[(0,a.jsx)(r.SelectTrigger,{children:(0,a.jsx)(r.SelectValue,{placeholder:`Select trigger type`})}),(0,a.jsx)(r.SelectContent,{children:Object.keys(b).map(e=>(0,a.jsx)(r.SelectItem,{value:e,children:b[e]},e))})]})]}),h&&(0,a.jsxs)(`div`,{className:`space-y-1`,children:[(0,a.jsx)(r.Label,{className:`text-xs`,children:`Object`}),t.length>0?(0,a.jsxs)(r.Select,{value:l.trigger.objectName??``,onValueChange:e=>d({objectName:e}),children:[(0,a.jsx)(r.SelectTrigger,{children:(0,a.jsx)(r.SelectValue,{placeholder:`Select object`})}),(0,a.jsx)(r.SelectContent,{children:t.map(e=>(0,a.jsx)(r.SelectItem,{value:e.name,children:e.label},e.name))})]}):(0,a.jsx)(r.Input,{value:l.trigger.objectName??``,onChange:e=>d({objectName:e.target.value}),placeholder:`Object name`})]}),g&&(0,a.jsxs)(`div`,{className:`space-y-1`,children:[(0,a.jsx)(r.Label,{className:`text-xs`,children:`Field`}),v?(0,a.jsxs)(r.Select,{value:l.trigger.fieldName??``,onValueChange:e=>d({fieldName:e}),children:[(0,a.jsx)(r.SelectTrigger,{children:(0,a.jsx)(r.SelectValue,{placeholder:`Select field`})}),(0,a.jsx)(r.SelectContent,{children:Object.keys(v).map(e=>(0,a.jsx)(r.SelectItem,{value:e,children:e},e))})]}):(0,a.jsx)(r.Input,{value:l.trigger.fieldName??``,onChange:e=>d({fieldName:e.target.value}),placeholder:`Field name`})]}),_&&(0,a.jsxs)(`div`,{className:`space-y-1`,children:[(0,a.jsxs)(r.Label,{className:`text-xs flex items-center gap-1`,children:[(0,a.jsx)(i.Clock,{className:`h-3 w-3`}),` Cron Schedule`]}),(0,a.jsx)(r.Input,{value:l.trigger.schedule??``,onChange:e=>d({schedule:e.target.value}),placeholder:`e.g. 0 9 * * 1-5`})]}),(0,a.jsxs)(`div`,{className:`space-y-1`,children:[(0,a.jsx)(r.Label,{className:`text-xs`,children:`Condition (optional)`}),(0,a.jsx)(r.Input,{value:l.trigger.condition??``,onChange:e=>d({condition:e.target.value}),placeholder:'e.g. ${data.status === "active"}'})]}),(0,a.jsx)(r.Separator,{}),(0,a.jsxs)(`div`,{className:`space-y-3`,children:[(0,a.jsx)(r.Label,{className:`text-xs font-medium`,children:`Conditional Trigger (optional)`}),(0,a.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Run only when a field matches a specific value.`}),(0,a.jsxs)(`div`,{className:`grid grid-cols-3 gap-2`,children:[(0,a.jsxs)(`div`,{className:`space-y-1`,children:[(0,a.jsx)(r.Label,{className:`text-xs`,children:`Field`}),v?(0,a.jsxs)(r.Select,{value:l.trigger.conditionField??``,onValueChange:e=>d({conditionField:e}),children:[(0,a.jsx)(r.SelectTrigger,{children:(0,a.jsx)(r.SelectValue,{placeholder:`Field`})}),(0,a.jsx)(r.SelectContent,{children:Object.keys(v).map(e=>(0,a.jsx)(r.SelectItem,{value:e,children:e},e))})]}):(0,a.jsx)(r.Input,{value:l.trigger.conditionField??``,onChange:e=>d({conditionField:e.target.value}),placeholder:`e.g. status`})]}),(0,a.jsxs)(`div`,{className:`space-y-1`,children:[(0,a.jsx)(r.Label,{className:`text-xs`,children:`Operator`}),(0,a.jsxs)(r.Select,{value:l.trigger.conditionOperator??`equals`,onValueChange:e=>d({conditionOperator:e}),children:[(0,a.jsx)(r.SelectTrigger,{children:(0,a.jsx)(r.SelectValue,{placeholder:`Operator`})}),(0,a.jsx)(r.SelectContent,{children:Object.keys(C).map(e=>(0,a.jsx)(r.SelectItem,{value:e,children:C[e]},e))})]})]}),(0,a.jsxs)(`div`,{className:`space-y-1`,children:[(0,a.jsx)(r.Label,{className:`text-xs`,children:`Value`}),(0,a.jsx)(r.Input,{value:l.trigger.conditionValue??``,onChange:e=>d({conditionValue:e.target.value}),placeholder:`e.g. urgent`})]})]})]})]})]}),(0,a.jsxs)(r.Card,{children:[(0,a.jsx)(r.CardHeader,{children:(0,a.jsxs)(r.CardTitle,{className:`flex items-center gap-2 text-sm`,children:[(0,a.jsx)(i.Settings,{className:`h-4 w-4`}),` Actions`,(0,a.jsx)(r.Badge,{variant:`secondary`,className:`ml-auto`,children:l.actions.length})]})}),(0,a.jsxs)(r.CardContent,{className:`space-y-3`,children:[l.actions.length>1&&(0,a.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,a.jsx)(r.Label,{className:`text-xs`,children:`Execution`}),(0,a.jsxs)(r.Select,{value:l.executionMode??`sequential`,onValueChange:e=>u(t=>({...t,executionMode:e})),children:[(0,a.jsx)(r.SelectTrigger,{className:`h-7 w-36`,children:(0,a.jsx)(r.SelectValue,{})}),(0,a.jsxs)(r.SelectContent,{children:[(0,a.jsx)(r.SelectItem,{value:`sequential`,children:`Sequential`}),(0,a.jsx)(r.SelectItem,{value:`parallel`,children:`Parallel`})]})]})]}),l.actions.map((e,t)=>(0,a.jsxs)(`div`,{className:`rounded-lg border p-3 space-y-3`,children:[(0,a.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,a.jsxs)(`div`,{className:`flex items-center gap-2`,children:[S[e.type],(0,a.jsx)(`span`,{className:`text-sm font-medium`,children:l.actions.length>1&&(l.executionMode??`sequential`)===`sequential`?`Step ${t+1}`:`Action ${t+1}`}),t>0&&l.actions.length>1&&(l.executionMode??`sequential`)===`sequential`&&(0,a.jsx)(r.Badge,{variant:`outline`,className:`text-[10px] px-1`,children:`then`})]}),(0,a.jsx)(r.Button,{size:`sm`,variant:`ghost`,className:`h-7 w-7 p-0 text-red-500 hover:text-red-700`,onClick:()=>m(t),children:(0,a.jsx)(i.Trash2,{className:`h-4 w-4`})})]}),(0,a.jsxs)(`div`,{className:`space-y-1`,children:[(0,a.jsx)(r.Label,{className:`text-xs`,children:`Action Type`}),(0,a.jsxs)(r.Select,{value:e.type,onValueChange:e=>p(t,{type:e,params:{}}),children:[(0,a.jsx)(r.SelectTrigger,{children:(0,a.jsx)(r.SelectValue,{})}),(0,a.jsx)(r.SelectContent,{children:Object.keys(x).map(e=>(0,a.jsx)(r.SelectItem,{value:e,children:x[e]},e))})]})]}),y(e,t)]},t)),(0,a.jsxs)(r.Button,{variant:`outline`,size:`sm`,className:`w-full`,onClick:f,children:[(0,a.jsx)(i.Plus,{className:`h-4 w-4 mr-2`}),` Add Action`]})]})]}),(0,a.jsxs)(r.Card,{children:[(0,a.jsx)(r.CardHeader,{children:(0,a.jsx)(r.CardTitle,{className:`text-sm`,children:`Summary`})}),(0,a.jsxs)(r.CardContent,{className:`space-y-4`,children:[(0,a.jsxs)(`div`,{className:`space-y-1`,children:[(0,a.jsx)(r.Label,{className:`text-xs`,children:`Name`}),(0,a.jsx)(r.Input,{value:l.name,onChange:e=>u(t=>({...t,name:e.target.value})),placeholder:`Automation name`})]}),(0,a.jsxs)(`div`,{className:`space-y-1`,children:[(0,a.jsx)(r.Label,{className:`text-xs`,children:`Description`}),(0,a.jsx)(r.Input,{value:l.description??``,onChange:e=>u(t=>({...t,description:e.target.value})),placeholder:`Optional description`})]}),(0,a.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,a.jsx)(r.Label,{className:`text-sm`,children:`Enabled`}),(0,a.jsx)(r.Switch,{checked:l.enabled,onCheckedChange:e=>u(t=>({...t,enabled:e}))})]}),(0,a.jsx)(r.Separator,{}),(0,a.jsxs)(`div`,{className:`flex items-center gap-2 justify-end`,children:[s&&(0,a.jsx)(r.Button,{variant:`outline`,size:`sm`,onClick:s,children:`Cancel`}),(0,a.jsxs)(r.Button,{size:`sm`,onClick:()=>o?.(l),children:[(0,a.jsx)(i.Zap,{className:`h-4 w-4 mr-2`}),` Save Automation`]})]})]})]})]})},D={success:`default`,failure:`destructive`,running:`secondary`,pending:`outline`},O={success:`Success`,failure:`Failed`,running:`Running`,pending:`Pending`};function k(e,t){if(!t)return`—`;let n=new Date(t).getTime()-new Date(e).getTime();if(n<1e3)return`${n}ms`;let r=Math.floor(n/1e3);return r<60?`${r}s`:`${Math.floor(r/60)}m ${r%60}s`}var A=({runs:e=[],className:t})=>(0,a.jsxs)(r.Card,{className:t,children:[(0,a.jsx)(r.CardHeader,{children:(0,a.jsxs)(r.CardTitle,{className:`flex items-center gap-2 text-sm`,children:[(0,a.jsx)(i.Clock,{className:`h-4 w-4`}),`Automation Run History`,(0,a.jsx)(r.Badge,{variant:`outline`,className:`ml-auto`,children:e.length})]})}),(0,a.jsx)(r.CardContent,{children:e.length===0?(0,a.jsx)(`p`,{className:`text-sm text-muted-foreground text-center py-6`,children:`No automation runs yet`}):(0,a.jsx)(`div`,{className:`space-y-2`,children:e.map(e=>(0,a.jsxs)(`div`,{className:`flex items-start gap-3 rounded-lg border p-3`,children:[(0,a.jsx)(r.Badge,{variant:D[e.status],children:O[e.status]}),(0,a.jsxs)(`div`,{className:`flex-1 min-w-0 space-y-1`,children:[(0,a.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,a.jsx)(`span`,{className:`text-sm font-medium`,children:e.automationName}),e.triggerEvent&&(0,a.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`— `,e.triggerEvent]})]}),(0,a.jsxs)(`div`,{className:`flex items-center gap-3 text-xs text-muted-foreground`,children:[(0,a.jsx)(`span`,{children:new Date(e.startedAt).toLocaleString()}),(0,a.jsxs)(`span`,{children:[`Duration: `,k(e.startedAt,e.completedAt)]})]}),e.status===`failure`&&e.error&&(0,a.jsx)(`p`,{className:`text-xs text-red-600 mt-1`,children:e.error})]})]},e.id))})})]});function j(...e){return(0,s.twMerge)((0,o.clsx)(e))}var M=130,N=52,P={start:`Start`,end:`End`,task:`Task`,user_task:`User Task`,service_task:`Service Task`,script_task:`Script Task`,approval:`Approval`,condition:`Condition`,parallel_gateway:`Parallel Gateway`,join_gateway:`Join Gateway`,boundary_event:`Boundary Event`,delay:`Delay`,notification:`Notification`,webhook:`Webhook`},F={start:(0,a.jsx)(i.Play,{className:`h-3.5 w-3.5 text-green-500`}),end:(0,a.jsx)(i.Square,{className:`h-3.5 w-3.5 text-red-500`}),task:(0,a.jsx)(i.CheckCircle,{className:`h-3.5 w-3.5 text-blue-500`}),user_task:(0,a.jsx)(i.Users,{className:`h-3.5 w-3.5 text-blue-600`}),service_task:(0,a.jsx)(i.Settings,{className:`h-3.5 w-3.5 text-blue-400`}),script_task:(0,a.jsx)(i.Code,{className:`h-3.5 w-3.5 text-indigo-500`}),approval:(0,a.jsx)(i.Users,{className:`h-3.5 w-3.5 text-purple-500`}),condition:(0,a.jsx)(i.GitBranch,{className:`h-3.5 w-3.5 text-orange-500`}),parallel_gateway:(0,a.jsx)(i.GitBranch,{className:`h-3.5 w-3.5 text-teal-500`}),join_gateway:(0,a.jsx)(i.GitMerge,{className:`h-3.5 w-3.5 text-teal-600`}),boundary_event:(0,a.jsx)(i.AlertCircle,{className:`h-3.5 w-3.5 text-amber-500`}),delay:(0,a.jsx)(i.Clock,{className:`h-3.5 w-3.5 text-gray-500`}),notification:(0,a.jsx)(i.Bell,{className:`h-3.5 w-3.5 text-yellow-500`}),webhook:(0,a.jsx)(i.Globe,{className:`h-3.5 w-3.5 text-cyan-500`})},I={start:`border-green-400 bg-green-50 dark:bg-green-950`,end:`border-red-400 bg-red-50 dark:bg-red-950`,task:`border-blue-300 bg-blue-50 dark:bg-blue-950`,user_task:`border-blue-400 bg-blue-50 dark:bg-blue-950`,service_task:`border-blue-200 bg-slate-50 dark:bg-slate-900`,script_task:`border-indigo-300 bg-indigo-50 dark:bg-indigo-950`,approval:`border-purple-400 bg-purple-50 dark:bg-purple-950`,condition:`border-orange-400 bg-orange-50 dark:bg-orange-950`,parallel_gateway:`border-teal-400 bg-teal-50 dark:bg-teal-950`,join_gateway:`border-teal-500 bg-teal-50 dark:bg-teal-950`,boundary_event:`border-amber-400 bg-amber-50 dark:bg-amber-950 border-dashed`,delay:`border-gray-400 bg-gray-50 dark:bg-gray-900`,notification:`border-yellow-400 bg-yellow-50 dark:bg-yellow-950`,webhook:`border-cyan-400 bg-cyan-50 dark:bg-cyan-950`},L={pending:{color:`text-muted-foreground`,icon:(0,a.jsx)(i.Clock,{className:`h-3 w-3`})},running:{color:`text-blue-500`,icon:(0,a.jsx)(i.Loader2,{className:`h-3 w-3 animate-spin`})},completed:{color:`text-green-500`,icon:(0,a.jsx)(i.CheckCircle,{className:`h-3 w-3`})},failed:{color:`text-red-500`,icon:(0,a.jsx)(i.AlertCircle,{className:`h-3 w-3`})},skipped:{color:`text-gray-400`,icon:(0,a.jsx)(i.SkipForward,{className:`h-3 w-3`})}},ee=[`task`,`user_task`,`service_task`,`script_task`,`approval`,`condition`,`parallel_gateway`,`join_gateway`,`boundary_event`,`delay`,`notification`,`webhook`],R={allow:`Allow (run concurrently)`,forbid:`Forbid (skip new)`,replace:`Replace (cancel existing)`,queue:`Queue (run after current)`},z={condition:`Condition`,manual:`Manual`,webhook:`Webhook`,timer:`Timer`,signal:`Signal`},te=()=>[{id:`start-1`,type:`start`,label:`Start`,position:{x:80,y:200}},{id:`end-1`,type:`end`,label:`End`,position:{x:500,y:200}}],ne=()=>[];function re(e){let[t,r]=(0,n.useState)([e]),[i,a]=(0,n.useState)(0);return{current:t[i],push:(0,n.useCallback)(e=>{r(t=>[...t.slice(0,i+1),e]),a(e=>e+1)},[i]),undo:(0,n.useCallback)(()=>{a(e=>Math.max(0,e-1))},[]),redo:(0,n.useCallback)(()=>{r(e=>(a(t=>Math.min(e.length-1,t+1)),e))},[]),canUndo:i>0,canRedo:i<t.length-1}}function ie(e,t,n){let r=[],i=[`boundary_event`];e.forEach(e=>{i.includes(e.type)&&r.push(`Node "${e.label}" (${e.type}) has limited BPMN mapping.`)});let a=[`<?xml version="1.0" encoding="UTF-8"?>`,`<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"`,` xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI"`,` targetNamespace="http://objectui.org/bpmn">`,` <process id="process-1" name="${n}" isExecutable="true">`,...e.map(e=>` <${B(e.type)} id="${e.id}" name="${e.label}" />`),...t.map(e=>` <sequenceFlow ${[`id="${e.id}"`,`sourceRef="${e.source}"`,`targetRef="${e.target}"`,e.condition?`conditionExpression="${e.condition}"`:``].filter(Boolean).join(` `)} />`),` </process>`,`</definitions>`].join(`
2
- `);return{success:!0,nodeCount:e.length,edgeCount:t.length,warnings:r.length?r:void 0,bpmnXml:a}}function B(e){return{start:`startEvent`,end:`endEvent`,task:`task`,user_task:`userTask`,service_task:`serviceTask`,script_task:`scriptTask`,approval:`userTask`,condition:`exclusiveGateway`,parallel_gateway:`parallelGateway`,join_gateway:`parallelGateway`,boundary_event:`boundaryEvent`,delay:`intermediateCatchEvent`,notification:`sendTask`,webhook:`serviceTask`}[e]??`task`}function ae(e,t){let n=e.position.x+M,r=e.position.y+N/2,i=t.position.x,a=t.position.y+N/2,o=(n+i)/2;return{d:`M ${n} ${r} C ${o} ${r}, ${o} ${a}, ${i} ${a}`,labelX:o,labelY:(r+a)/2-8}}var oe=({node:e,isSelected:t,isConnectSource:n,connectMode:r,readOnly:o,showExecutionOverlay:s,onSelect:c,onDelete:l,onDragStart:u,onPortClick:d})=>{let f=e.executionStatus,p=f?L[f]:null;return(0,a.jsxs)(`div`,{className:`absolute select-none`,style:{left:e.position.x,top:e.position.y},draggable:!o&&!r,onDragStart:t=>u(t,e.id),onClick:t=>c(e.id,t.shiftKey),role:`group`,"aria-label":e.label,children:[(0,a.jsxs)(`div`,{className:j(`flex items-center gap-2 border-2 rounded px-3 py-2 min-h-[52px] transition-shadow cursor-pointer`,I[e.type],t&&`ring-2 ring-primary shadow-md`,n&&`ring-2 ring-blue-400 shadow-lg`,r&&!n&&`cursor-crosshair`,s&&f===`running`&&`ring-2 ring-blue-400`,s&&f===`failed`&&`ring-2 ring-red-400`,s&&f===`completed`&&`ring-2 ring-green-400`),style:{width:M,minHeight:N},children:[(0,a.jsx)(`span`,{className:`shrink-0`,children:F[e.type]}),(0,a.jsx)(`span`,{className:`text-xs font-medium leading-tight flex-1 truncate`,children:e.label}),s&&p&&(0,a.jsx)(`span`,{className:j(`shrink-0`,p.color),children:p.icon})]}),!o&&(t||r)&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(`div`,{className:`absolute w-3 h-3 rounded-full bg-primary border-2 border-background shadow cursor-crosshair`,style:{right:-6,top:N/2-6},title:`Connect from this node`,onClick:t=>{t.stopPropagation(),d(e.id)}}),(0,a.jsx)(`div`,{className:`absolute w-3 h-3 rounded-full bg-muted-foreground border-2 border-background shadow cursor-crosshair`,style:{left:-6,top:N/2-6},title:`Connect to this node`,onClick:t=>{t.stopPropagation(),d(e.id)}})]}),!o&&t&&!r&&(0,a.jsx)(`button`,{className:`absolute -top-2 -right-2 p-0.5 rounded-full bg-destructive text-destructive-foreground shadow`,onClick:t=>{t.stopPropagation(),l(e.id)},"aria-label":`Delete node ${e.label}`,children:(0,a.jsx)(i.Trash2,{className:`h-3 w-3`})})]})},se=({node:e,edge:t,readOnly:n,onNodeChange:i,onEdgeChange:o})=>!e&&!t?(0,a.jsx)(`div`,{className:`p-4 text-sm text-muted-foreground`,children:`Select a node or edge to edit its properties.`}):e?(0,a.jsxs)(`div`,{className:`p-3 space-y-3 overflow-y-auto`,children:[(0,a.jsx)(`p`,{className:`text-xs font-semibold text-muted-foreground uppercase tracking-wide`,children:`Node Properties`}),(0,a.jsxs)(`div`,{className:`space-y-1`,children:[(0,a.jsx)(r.Label,{className:`text-xs`,children:`Label`}),(0,a.jsx)(r.Input,{value:e.label,onChange:t=>i({...e,label:t.target.value}),disabled:n,className:`h-7 text-xs`})]}),(0,a.jsxs)(`div`,{className:`space-y-1`,children:[(0,a.jsx)(r.Label,{className:`text-xs`,children:`Type`}),(0,a.jsxs)(r.Select,{value:e.type,onValueChange:t=>i({...e,type:t}),disabled:n,children:[(0,a.jsx)(r.SelectTrigger,{className:`h-7 text-xs`,children:(0,a.jsx)(r.SelectValue,{})}),(0,a.jsx)(r.SelectContent,{children:Object.keys(P).map(e=>(0,a.jsx)(r.SelectItem,{value:e,className:`text-xs`,children:P[e]},e))})]})]}),(0,a.jsxs)(`div`,{className:`space-y-1`,children:[(0,a.jsx)(r.Label,{className:`text-xs`,children:`Description`}),(0,a.jsx)(r.Input,{value:e.description??``,onChange:t=>i({...e,description:t.target.value}),disabled:n,className:`h-7 text-xs`,placeholder:`Optional description`})]}),[`task`,`user_task`,`service_task`,`script_task`,`delay`,`webhook`].includes(e.type)&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.Separator,{}),(0,a.jsx)(`p`,{className:`text-xs font-semibold text-muted-foreground uppercase tracking-wide`,children:`Executor`}),(0,a.jsxs)(`div`,{className:`space-y-1`,children:[(0,a.jsx)(r.Label,{className:`text-xs`,children:`Executor Type`}),(0,a.jsx)(r.Input,{value:e.executor?.type??``,onChange:t=>i({...e,executor:{...e.executor,type:t.target.value}}),disabled:n,className:`h-7 text-xs`,placeholder:`e.g. http, script, email`})]}),e.type===`delay`&&(0,a.jsxs)(`div`,{className:`space-y-1`,children:[(0,a.jsx)(r.Label,{className:`text-xs`,children:`Wait Event Type`}),(0,a.jsxs)(r.Select,{value:e.executor?.waitEventConfig?.eventType??`timer`,onValueChange:t=>i({...e,executor:{...e.executor,type:e.executor?.type??`wait`,waitEventConfig:{...e.executor?.waitEventConfig,eventType:t}}}),disabled:n,children:[(0,a.jsx)(r.SelectTrigger,{className:`h-7 text-xs`,children:(0,a.jsx)(r.SelectValue,{})}),(0,a.jsx)(r.SelectContent,{children:Object.keys(z).map(e=>(0,a.jsx)(r.SelectItem,{value:e,className:`text-xs`,children:z[e]},e))})]})]}),(0,a.jsxs)(`div`,{className:`space-y-1`,children:[(0,a.jsx)(r.Label,{className:`text-xs`,children:`Timeout (ms)`}),(0,a.jsx)(r.Input,{type:`number`,value:e.executor?.timeoutMs??``,onChange:t=>i({...e,executor:{...e.executor,type:e.executor?.type??``,timeoutMs:t.target.value?Number(t.target.value):void 0}}),disabled:n,className:`h-7 text-xs`,placeholder:`e.g. 30000`})]})]}),e.type===`boundary_event`&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.Separator,{}),(0,a.jsx)(`p`,{className:`text-xs font-semibold text-muted-foreground uppercase tracking-wide`,children:`Boundary Config`}),(0,a.jsxs)(`div`,{className:`space-y-1`,children:[(0,a.jsx)(r.Label,{className:`text-xs`,children:`Attached To Node ID`}),(0,a.jsx)(r.Input,{value:e.boundaryConfig?.attachedToNodeId??``,onChange:t=>i({...e,boundaryConfig:{...e.boundaryConfig,attachedToNodeId:t.target.value,eventType:e.boundaryConfig?.eventType??`error`}}),disabled:n,className:`h-7 text-xs`,placeholder:`Host node id`})]}),(0,a.jsxs)(`div`,{className:`space-y-1`,children:[(0,a.jsx)(r.Label,{className:`text-xs`,children:`Event Type`}),(0,a.jsxs)(r.Select,{value:e.boundaryConfig?.eventType??`error`,onValueChange:t=>i({...e,boundaryConfig:{...e.boundaryConfig,attachedToNodeId:e.boundaryConfig?.attachedToNodeId??``,eventType:t}}),disabled:n,children:[(0,a.jsx)(r.SelectTrigger,{className:`h-7 text-xs`,children:(0,a.jsx)(r.SelectValue,{})}),(0,a.jsx)(r.SelectContent,{children:[`error`,`timer`,`message`,`signal`,`compensation`].map(e=>(0,a.jsx)(r.SelectItem,{value:e,className:`text-xs capitalize`,children:e},e))})]})]})]})]}):t?(0,a.jsxs)(`div`,{className:`p-3 space-y-3 overflow-y-auto`,children:[(0,a.jsx)(`p`,{className:`text-xs font-semibold text-muted-foreground uppercase tracking-wide`,children:`Edge Properties`}),(0,a.jsxs)(`div`,{className:`space-y-1`,children:[(0,a.jsx)(r.Label,{className:`text-xs`,children:`Label`}),(0,a.jsx)(r.Input,{value:t.label??``,onChange:e=>o({...t,label:e.target.value}),disabled:n,className:`h-7 text-xs`})]}),(0,a.jsxs)(`div`,{className:`space-y-1`,children:[(0,a.jsx)(r.Label,{className:`text-xs`,children:`Type`}),(0,a.jsxs)(r.Select,{value:t.type??`default`,onValueChange:e=>o({...t,type:e}),disabled:n,children:[(0,a.jsx)(r.SelectTrigger,{className:`h-7 text-xs`,children:(0,a.jsx)(r.SelectValue,{})}),(0,a.jsxs)(r.SelectContent,{children:[(0,a.jsx)(r.SelectItem,{value:`default`,className:`text-xs`,children:`Default`}),(0,a.jsx)(r.SelectItem,{value:`conditional`,className:`text-xs`,children:`Conditional`}),(0,a.jsx)(r.SelectItem,{value:`timeout`,className:`text-xs`,children:`Timeout`})]})]})]}),t.type===`conditional`&&(0,a.jsxs)(`div`,{className:`space-y-1`,children:[(0,a.jsx)(r.Label,{className:`text-xs`,children:`Condition Expression`}),(0,a.jsx)(r.Input,{value:t.condition??``,onChange:e=>o({...t,condition:e.target.value}),disabled:n,className:`h-7 text-xs font-mono`,placeholder:`e.g. status === 'approved'`})]}),(0,a.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,a.jsx)(`input`,{type:`checkbox`,id:`edge-isDefault`,checked:t.isDefault??!1,onChange:e=>o({...t,isDefault:e.target.checked}),disabled:n,className:`h-3.5 w-3.5`}),(0,a.jsx)(r.Label,{htmlFor:`edge-isDefault`,className:`text-xs`,children:`Default edge (isDefault)`})]})]}):null,ce=({versions:e})=>(0,a.jsxs)(`div`,{className:`p-3 space-y-2`,children:[(0,a.jsx)(`p`,{className:`text-xs font-semibold text-muted-foreground uppercase tracking-wide`,children:`Version History`}),e.length===0&&(0,a.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No version history available.`}),(0,a.jsx)(`div`,{className:`space-y-1.5`,children:e.map(e=>(0,a.jsxs)(`div`,{className:j(`rounded border p-2 text-xs`,e.isCurrent?`border-primary bg-primary/5`:`border-border bg-muted/30`),children:[(0,a.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,a.jsxs)(`span`,{className:`font-medium`,children:[`v`,e.version]}),e.isCurrent&&(0,a.jsx)(r.Badge,{variant:`default`,className:`text-[10px] h-4`,children:`Current`})]}),e.changeNote&&(0,a.jsx)(`p`,{className:`text-muted-foreground mt-0.5`,children:e.changeNote}),(0,a.jsxs)(`p`,{className:`text-muted-foreground mt-0.5`,children:[e.author&&(0,a.jsxs)(a.Fragment,{children:[e.author,` · `]}),new Date(e.createdAt).toLocaleDateString()]})]},e.version))})]}),V=({schema:e,onSave:t})=>{let{readOnly:o=!1,showToolbar:s=!0,showMinimap:c=!1,showVersionHistory:l=!1,showExecutionOverlay:u=!1,executionSteps:d=[],versionHistory:f=[],concurrencyPolicy:p,title:m=`New Flow`,description:h=``,status:g=`draft`}=e,[_,v]=(0,n.useState)(m),[y,b]=(0,n.useState)(h),{current:x,push:S,undo:C,redo:w,canUndo:T,canRedo:E}=re({nodes:e.nodes??te(),edges:e.edges??ne()}),D=x.nodes,O=x.edges,[k,A]=(0,n.useState)(null),[j,M]=(0,n.useState)(null),[N,I]=(0,n.useState)(!1),[L,z]=(0,n.useState)(null),[B,V]=(0,n.useState)(!0),[H,le]=(0,n.useState)(l),[U,W]=(0,n.useState)(null),[G,K]=(0,n.useState)(1),q=(0,n.useRef)(null),ue=(0,n.useMemo)(()=>D.find(e=>e.id===k)??null,[D,k]),de=(0,n.useMemo)(()=>O.find(e=>e.id===j)??null,[O,j]),J=(0,n.useMemo)(()=>{if(!u||d.length===0)return D;let e=new Map(d.map(e=>[e.nodeId,e.status]));return D.map(t=>e.has(t.id)?{...t,executionStatus:e.get(t.id)}:t)},[D,u,d]),fe=(0,n.useCallback)(e=>{if(o)return;let t={id:`${e}-${Date.now()}`,type:e,label:P[e],position:{x:200,y:80+D.length*70}};S({nodes:[...D,t],edges:O})},[o,D,O,S]),Y=(0,n.useCallback)(e=>{o||(S({nodes:D.filter(t=>t.id!==e),edges:O.filter(t=>t.source!==e&&t.target!==e)}),k===e&&A(null))},[o,D,O,S,k]),pe=(0,n.useCallback)(e=>{o||S({nodes:D.map(t=>t.id===e.id?e:t),edges:O})},[o,D,O,S]),X=(0,n.useCallback)(e=>{o||(S({nodes:D,edges:O.filter(t=>t.id!==e)}),j===e&&M(null))},[o,D,O,S,j]),me=(0,n.useCallback)(e=>{o||S({nodes:D,edges:O.map(t=>t.id===e.id?e:t)})},[o,D,O,S]),he=(0,n.useCallback)(e=>{if(!o){if(!N){I(!0),z(e);return}if(L&&L!==e){let t={id:`edge-${Date.now()}`,source:L,target:e};S({nodes:D,edges:[...O,t]})}I(!1),z(null)}},[o,N,L,D,O,S]),Z=(0,n.useRef)(null),Q=(0,n.useRef)(null),ge=(0,n.useCallback)((e,t)=>{Z.current=t;let n=D.find(e=>e.id===t);n&&(Q.current={mouseX:e.clientX,mouseY:e.clientY,nodeX:n.position.x,nodeY:n.position.y}),e.dataTransfer.effectAllowed=`move`},[D]),_e=(0,n.useCallback)(e=>{if(e.preventDefault(),!Z.current||!Q.current||!q.current)return;q.current.getBoundingClientRect();let t=(e.clientX-Q.current.mouseX)/G,n=(e.clientY-Q.current.mouseY)/G,r=Math.max(0,Q.current.nodeX+t),i=Math.max(0,Q.current.nodeY+n),a=Z.current;S({nodes:D.map(e=>e.id===a?{...e,position:{x:r,y:i}}:e),edges:O}),Z.current=null,Q.current=null},[D,O,S,G]),ve=(0,n.useCallback)(()=>{let e=ie(D,O,_);W(e);let t=new Blob([e.bpmnXml??``],{type:`application/xml`}),n=URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=`${_.replace(/\s+/g,`-`).toLowerCase()}.bpmn`,r.click(),URL.revokeObjectURL(n)},[D,O,_]),$=(0,n.useCallback)(()=>{t?.(D,O)},[D,O,t]);return(0,a.jsxs)(r.Card,{className:`flex flex-col h-full min-h-[600px] outline-none`,tabIndex:0,onKeyDown:(0,n.useCallback)(e=>{let t=e.ctrlKey||e.metaKey;if(t&&e.key===`z`&&!e.shiftKey){e.preventDefault(),C();return}if(t&&(e.key===`y`||e.key===`z`&&e.shiftKey)){e.preventDefault(),w();return}if(t&&e.key===`s`){e.preventDefault(),$();return}e.key===`Escape`&&(I(!1),z(null),A(null),M(null)),(e.key===`Delete`||e.key===`Backspace`)&&(k?Y(k):j&&X(j))},[C,w,$,k,j,Y,X]),children:[(0,a.jsx)(r.CardHeader,{className:`py-2 px-4 border-b flex-shrink-0`,children:(0,a.jsxs)(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[(0,a.jsx)(i.Zap,{className:`h-4 w-4 text-primary shrink-0`}),(0,a.jsx)(r.CardTitle,{className:`text-sm font-semibold`,children:o?(0,a.jsx)(`span`,{children:_}):(0,a.jsx)(r.Input,{value:_,onChange:e=>v(e.target.value),className:`h-6 text-sm font-semibold border-0 p-0 focus-visible:ring-0 bg-transparent`,"aria-label":`Flow title`})}),(0,a.jsx)(r.Badge,{variant:`outline`,className:`text-xs capitalize`,children:g}),p&&(0,a.jsx)(r.Badge,{variant:`secondary`,className:`text-xs`,children:R[p]}),(0,a.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[!o&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.Button,{size:`icon`,variant:`ghost`,className:`h-7 w-7`,onClick:C,disabled:!T,title:`Undo (Ctrl+Z)`,children:(0,a.jsx)(i.Undo2,{className:`h-4 w-4`})}),(0,a.jsx)(r.Button,{size:`icon`,variant:`ghost`,className:`h-7 w-7`,onClick:w,disabled:!E,title:`Redo (Ctrl+Y)`,children:(0,a.jsx)(i.Redo2,{className:`h-4 w-4`})}),(0,a.jsx)(r.Separator,{orientation:`vertical`,className:`h-5 mx-1`})]}),(0,a.jsx)(r.Button,{size:`icon`,variant:`ghost`,className:`h-7 w-7`,onClick:()=>K(e=>Math.min(2,e+.1)),title:`Zoom in`,children:(0,a.jsx)(i.ZoomIn,{className:`h-4 w-4`})}),(0,a.jsx)(r.Button,{size:`icon`,variant:`ghost`,className:`h-7 w-7`,onClick:()=>K(1),title:`Reset zoom`,children:(0,a.jsx)(i.RotateCcw,{className:`h-4 w-4`})}),(0,a.jsx)(r.Button,{size:`icon`,variant:`ghost`,className:`h-7 w-7`,onClick:()=>K(e=>Math.max(.3,e-.1)),title:`Zoom out`,children:(0,a.jsx)(i.ZoomOut,{className:`h-4 w-4`})}),(0,a.jsx)(r.Separator,{orientation:`vertical`,className:`h-5 mx-1`}),f.length>0&&(0,a.jsx)(r.Button,{size:`icon`,variant:H?`secondary`:`ghost`,className:`h-7 w-7`,onClick:()=>le(e=>!e),title:`Version history`,children:(0,a.jsx)(i.History,{className:`h-4 w-4`})}),(0,a.jsx)(r.Button,{size:`icon`,variant:`ghost`,className:`h-7 w-7`,onClick:ve,title:`Export BPMN`,children:(0,a.jsx)(i.Download,{className:`h-4 w-4`})}),!o&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.Button,{size:`icon`,variant:`ghost`,className:`h-7 w-7`,title:`Import BPMN (drag & drop)`,children:(0,a.jsx)(i.Upload,{className:`h-4 w-4`})}),(0,a.jsxs)(r.Button,{size:`sm`,variant:`default`,className:`h-7 text-xs gap-1`,onClick:$,title:`Save (Ctrl+S)`,children:[(0,a.jsx)(i.Save,{className:`h-3.5 w-3.5`}),` Save`]})]}),(0,a.jsx)(r.Button,{size:`icon`,variant:`ghost`,className:`h-7 w-7`,onClick:()=>V(e=>!e),title:B?`Hide properties`:`Show properties`,children:B?(0,a.jsx)(i.PanelRightClose,{className:`h-4 w-4`}):(0,a.jsx)(i.PanelRightOpen,{className:`h-4 w-4`})})]})]})}),(0,a.jsxs)(r.CardContent,{className:`flex flex-1 p-0 overflow-hidden`,children:[s&&!o&&(0,a.jsxs)(`div`,{className:`w-36 border-r bg-muted/30 flex-shrink-0 overflow-y-auto py-2 px-2`,children:[(0,a.jsx)(`p`,{className:`text-[10px] font-semibold text-muted-foreground uppercase tracking-wide mb-2 px-1`,children:`Add Node`}),(0,a.jsx)(`div`,{className:`space-y-1`,children:ee.map(e=>(0,a.jsxs)(`button`,{className:`w-full flex items-center gap-2 text-xs px-2 py-1.5 rounded hover:bg-muted transition-colors text-left`,onClick:()=>fe(e),title:`Add ${P[e]}`,children:[F[e],(0,a.jsx)(`span`,{className:`truncate`,children:P[e]})]},e))}),N&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.Separator,{className:`my-2`}),(0,a.jsxs)(`div`,{className:`px-1`,children:[(0,a.jsx)(`p`,{className:`text-[10px] text-blue-600 font-medium`,children:`Connect mode`}),(0,a.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:`Click a target node port to connect.`}),(0,a.jsx)(r.Button,{size:`sm`,variant:`outline`,className:`h-6 text-xs mt-1 w-full`,onClick:()=>{I(!1),z(null)},children:`Cancel`})]})]})]}),(0,a.jsx)(`div`,{className:`flex-1 overflow-auto relative bg-dot-pattern`,children:(0,a.jsxs)(`div`,{ref:q,className:`relative`,style:{width:1200,height:700,transform:`scale(${G})`,transformOrigin:`top left`},onDrop:_e,onDragOver:e=>e.preventDefault(),onClick:e=>{e.target===q.current&&(A(null),M(null))},children:[(0,a.jsxs)(`svg`,{className:`absolute inset-0 pointer-events-none`,width:1200,height:700,style:{overflow:`visible`},children:[(0,a.jsxs)(`defs`,{children:[(0,a.jsx)(`marker`,{id:`fd-arrowhead`,markerWidth:`10`,markerHeight:`7`,refX:`9`,refY:`3.5`,orient:`auto`,children:(0,a.jsx)(`polygon`,{points:`0 0, 10 3.5, 0 7`,fill:`hsl(var(--foreground) / 0.5)`})}),(0,a.jsx)(`marker`,{id:`fd-arrowhead-selected`,markerWidth:`10`,markerHeight:`7`,refX:`9`,refY:`3.5`,orient:`auto`,children:(0,a.jsx)(`polygon`,{points:`0 0, 10 3.5, 0 7`,fill:`hsl(var(--primary))`})}),(0,a.jsx)(`marker`,{id:`fd-arrowhead-conditional`,markerWidth:`10`,markerHeight:`7`,refX:`9`,refY:`3.5`,orient:`auto`,children:(0,a.jsx)(`polygon`,{points:`0 0, 10 3.5, 0 7`,fill:`hsl(var(--foreground) / 0.6)`})})]}),O.map(e=>{let t=J.find(t=>t.id===e.source),n=J.find(t=>t.id===e.target);if(!t||!n)return null;let{d:r,labelX:i,labelY:o}=ae(t,n),s=e.id===j,c=e.type===`conditional`,l=e.isDefault;return(0,a.jsxs)(`g`,{className:`pointer-events-auto cursor-pointer`,onClick:t=>{t.stopPropagation(),M(e.id),A(null)},children:[(0,a.jsx)(`path`,{d:r,fill:`none`,stroke:s?`hsl(var(--primary))`:c?`hsl(var(--foreground) / 0.6)`:`hsl(var(--foreground) / 0.4)`,strokeWidth:s?2.5:2,strokeDasharray:c?`6 3`:l?`3 3`:void 0,markerEnd:`url(#fd-arrowhead${s?`-selected`:c?`-conditional`:``})`}),(e.label||l)&&(0,a.jsx)(`text`,{x:i,y:o,textAnchor:`middle`,className:`text-[10px] fill-muted-foreground`,style:{fontSize:10},children:e.label??(l?`(default)`:``)}),e.condition&&(0,a.jsx)(`text`,{x:i,y:o+12,textAnchor:`middle`,className:`text-[9px] fill-orange-500`,style:{fontSize:9},children:e.condition.length>24?e.condition.slice(0,24)+`…`:e.condition}),(0,a.jsx)(`path`,{d:r,fill:`none`,stroke:`transparent`,strokeWidth:12})]},e.id)})]}),J.map(e=>(0,a.jsx)(oe,{node:e,isSelected:k===e.id,isConnectSource:L===e.id,connectMode:N,readOnly:o,showExecutionOverlay:u,onSelect:(e,t)=>{t||M(null),A(e)},onDelete:Y,onDragStart:ge,onPortClick:he},e.id)),N&&L&&(0,a.jsxs)(`div`,{className:`absolute bottom-4 left-1/2 -translate-x-1/2 bg-blue-600 text-white text-xs px-3 py-1.5 rounded shadow-lg pointer-events-none`,children:[(0,a.jsx)(i.Link,{className:`h-3 w-3 inline mr-1`}),`Click a node port to complete the connection — Esc to cancel`]}),D.length===0&&(0,a.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center text-muted-foreground text-sm`,children:`No nodes yet. Use the toolbar to add nodes.`})]})}),H&&f.length>0&&(0,a.jsx)(`div`,{className:`w-48 border-l bg-background flex-shrink-0 overflow-y-auto`,children:(0,a.jsx)(ce,{versions:f})}),B&&(0,a.jsxs)(`div`,{className:`w-52 border-l bg-background flex-shrink-0 overflow-y-auto`,children:[(0,a.jsx)(se,{node:ue,edge:de,readOnly:o,onNodeChange:pe,onEdgeChange:me}),U&&(0,a.jsxs)(`div`,{className:`p-3 border-t`,children:[(0,a.jsx)(`p`,{className:`text-[10px] font-semibold text-muted-foreground uppercase tracking-wide mb-1`,children:`BPMN Export`}),(0,a.jsx)(r.Badge,{variant:U.success?`default`:`destructive`,className:`text-[10px]`,children:U.success?`Exported ${U.nodeCount} nodes`:`Export failed`}),U.warnings?.map((e,t)=>(0,a.jsx)(`p`,{className:`text-[10px] text-amber-600 mt-0.5`,children:e},t))]})]})]})]})};t.ComponentRegistry.register(`workflow-designer`,v,{label:`Workflow Designer`,category:`Enterprise`,inputs:[{name:`workflow`,type:`code`,label:`Initial Workflow Definition`},{name:`readOnly`,type:`boolean`,label:`Read Only`,defaultValue:!1},{name:`showToolbar`,type:`boolean`,label:`Show Toolbar`,defaultValue:!0},{name:`showMinimap`,type:`boolean`,label:`Show Minimap`,defaultValue:!1}]}),t.ComponentRegistry.register(`approval-process`,y,{label:`Approval Process`,category:`Enterprise`,inputs:[{name:`workflowId`,type:`string`,label:`Workflow ID`},{name:`instanceId`,type:`string`,label:`Instance ID`},{name:`currentNodeId`,type:`string`,label:`Current Node ID`},{name:`approvalRule`,type:`code`,label:`Approval Rule`},{name:`history`,type:`code`,label:`History`},{name:`showHistory`,type:`boolean`,label:`Show History`,defaultValue:!0},{name:`showComments`,type:`boolean`,label:`Show Comments`,defaultValue:!0}]}),t.ComponentRegistry.register(`automation-builder`,E,{label:`Automation Builder`,category:`Enterprise`,inputs:[{name:`automation`,type:`code`,label:`Automation Definition`},{name:`objects`,type:`code`,label:`Available Objects`}]}),t.ComponentRegistry.register(`automation-run-history`,A,{label:`Automation Run History`,category:`Enterprise`,inputs:[{name:`runs`,type:`code`,label:`Run History`}]}),t.ComponentRegistry.register(`flow-designer`,V,{label:`Flow Designer`,category:`Enterprise`,inputs:[{name:`nodes`,type:`code`,label:`Flow Nodes`},{name:`edges`,type:`code`,label:`Flow Edges`},{name:`title`,type:`string`,label:`Flow Title`},{name:`readOnly`,type:`boolean`,label:`Read Only`,defaultValue:!1},{name:`showToolbar`,type:`boolean`,label:`Show Toolbar`,defaultValue:!0},{name:`showMinimap`,type:`boolean`,label:`Show Minimap`,defaultValue:!1},{name:`showVersionHistory`,type:`boolean`,label:`Show Version History`,defaultValue:!1},{name:`showExecutionOverlay`,type:`boolean`,label:`Show Execution Overlay`,defaultValue:!1},{name:`concurrencyPolicy`,type:`string`,label:`Concurrency Policy`},{name:`versionHistory`,type:`code`,label:`Version History`},{name:`executionSteps`,type:`code`,label:`Execution Steps`}]}),e.ApprovalProcess=y,e.AutomationBuilder=E,e.AutomationRunHistory=A,e.FlowDesigner=V,e.WorkflowDesigner=v});
2
+ `);return{success:!0,nodeCount:e.length,edgeCount:t.length,warnings:r.length?r:void 0,bpmnXml:a}}function B(e){return{start:`startEvent`,end:`endEvent`,task:`task`,user_task:`userTask`,service_task:`serviceTask`,script_task:`scriptTask`,approval:`userTask`,condition:`exclusiveGateway`,parallel_gateway:`parallelGateway`,join_gateway:`parallelGateway`,boundary_event:`boundaryEvent`,delay:`intermediateCatchEvent`,notification:`sendTask`,webhook:`serviceTask`}[e]??`task`}function ae(e,t){let n=e.position.x+M,r=e.position.y+N/2,i=t.position.x,a=t.position.y+N/2,o=(n+i)/2;return{d:`M ${n} ${r} C ${o} ${r}, ${o} ${a}, ${i} ${a}`,labelX:o,labelY:(r+a)/2-8}}var oe=({node:e,isSelected:t,isConnectSource:n,connectMode:r,readOnly:o,showExecutionOverlay:s,onSelect:c,onDelete:l,onDragStart:u,onPortClick:d})=>{let f=e.executionStatus,p=f?L[f]:null;return(0,a.jsxs)(`div`,{className:`absolute select-none`,style:{left:e.position.x,top:e.position.y},draggable:!o&&!r,onDragStart:t=>u(t,e.id),onClick:t=>c(e.id,t.shiftKey),role:`group`,"aria-label":e.label,children:[(0,a.jsxs)(`div`,{className:j(`flex items-center gap-2 border-2 rounded px-3 py-2 min-h-[52px] transition-shadow cursor-pointer`,I[e.type],t&&`ring-2 ring-primary shadow-md`,n&&`ring-2 ring-blue-400 shadow-lg`,r&&!n&&`cursor-crosshair`,s&&f===`running`&&`ring-2 ring-blue-400`,s&&f===`failed`&&`ring-2 ring-red-400`,s&&f===`completed`&&`ring-2 ring-green-400`),style:{width:M,minHeight:N},children:[(0,a.jsx)(`span`,{className:`shrink-0`,children:F[e.type]}),(0,a.jsx)(`span`,{className:`text-xs font-medium leading-tight flex-1 truncate`,children:e.label}),s&&p&&(0,a.jsx)(`span`,{className:j(`shrink-0`,p.color),children:p.icon})]}),!o&&(t||r)&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(`div`,{className:`absolute w-3 h-3 rounded-full bg-primary border-2 border-background shadow cursor-crosshair`,style:{right:-6,top:N/2-6},title:`Connect from this node`,onClick:t=>{t.stopPropagation(),d(e.id)}}),(0,a.jsx)(`div`,{className:`absolute w-3 h-3 rounded-full bg-muted-foreground border-2 border-background shadow cursor-crosshair`,style:{left:-6,top:N/2-6},title:`Connect to this node`,onClick:t=>{t.stopPropagation(),d(e.id)}})]}),!o&&t&&!r&&(0,a.jsx)(`button`,{className:`absolute -top-2 -right-2 p-0.5 rounded-full bg-destructive text-destructive-foreground shadow`,onClick:t=>{t.stopPropagation(),l(e.id)},"aria-label":`Delete node ${e.label}`,children:(0,a.jsx)(i.Trash2,{className:`h-3 w-3`})})]})},se=({node:e,edge:t,readOnly:n,onNodeChange:i,onEdgeChange:o})=>!e&&!t?(0,a.jsx)(`div`,{className:`p-4 text-sm text-muted-foreground`,children:`Select a node or edge to edit its properties.`}):e?(0,a.jsxs)(`div`,{className:`p-3 space-y-3 overflow-y-auto`,children:[(0,a.jsx)(`p`,{className:`text-xs font-semibold text-muted-foreground uppercase tracking-wide`,children:`Node Properties`}),(0,a.jsxs)(`div`,{className:`space-y-1`,children:[(0,a.jsx)(r.Label,{className:`text-xs`,children:`Label`}),(0,a.jsx)(r.Input,{value:e.label,onChange:t=>i({...e,label:t.target.value}),disabled:n,className:`h-7 text-xs`})]}),(0,a.jsxs)(`div`,{className:`space-y-1`,children:[(0,a.jsx)(r.Label,{className:`text-xs`,children:`Type`}),(0,a.jsxs)(r.Select,{value:e.type,onValueChange:t=>i({...e,type:t}),disabled:n,children:[(0,a.jsx)(r.SelectTrigger,{className:`h-7 text-xs`,children:(0,a.jsx)(r.SelectValue,{})}),(0,a.jsx)(r.SelectContent,{children:Object.keys(P).map(e=>(0,a.jsx)(r.SelectItem,{value:e,className:`text-xs`,children:P[e]},e))})]})]}),(0,a.jsxs)(`div`,{className:`space-y-1`,children:[(0,a.jsx)(r.Label,{className:`text-xs`,children:`Description`}),(0,a.jsx)(r.Input,{value:e.description??``,onChange:t=>i({...e,description:t.target.value}),disabled:n,className:`h-7 text-xs`,placeholder:`Optional description`})]}),[`task`,`user_task`,`service_task`,`script_task`,`delay`,`webhook`].includes(e.type)&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.Separator,{}),(0,a.jsx)(`p`,{className:`text-xs font-semibold text-muted-foreground uppercase tracking-wide`,children:`Executor`}),(0,a.jsxs)(`div`,{className:`space-y-1`,children:[(0,a.jsx)(r.Label,{className:`text-xs`,children:`Executor Type`}),(0,a.jsx)(r.Input,{value:e.executor?.type??``,onChange:t=>i({...e,executor:{...e.executor,type:t.target.value}}),disabled:n,className:`h-7 text-xs`,placeholder:`e.g. http, script, email`})]}),e.type===`delay`&&(0,a.jsxs)(`div`,{className:`space-y-1`,children:[(0,a.jsx)(r.Label,{className:`text-xs`,children:`Wait Event Type`}),(0,a.jsxs)(r.Select,{value:e.executor?.waitEventConfig?.eventType??`timer`,onValueChange:t=>i({...e,executor:{...e.executor,type:e.executor?.type??`wait`,waitEventConfig:{...e.executor?.waitEventConfig,eventType:t}}}),disabled:n,children:[(0,a.jsx)(r.SelectTrigger,{className:`h-7 text-xs`,children:(0,a.jsx)(r.SelectValue,{})}),(0,a.jsx)(r.SelectContent,{children:Object.keys(z).map(e=>(0,a.jsx)(r.SelectItem,{value:e,className:`text-xs`,children:z[e]},e))})]})]}),(0,a.jsxs)(`div`,{className:`space-y-1`,children:[(0,a.jsx)(r.Label,{className:`text-xs`,children:`Timeout (ms)`}),(0,a.jsx)(r.Input,{type:`number`,value:e.executor?.timeoutMs??``,onChange:t=>i({...e,executor:{...e.executor,type:e.executor?.type??``,timeoutMs:t.target.value?Number(t.target.value):void 0}}),disabled:n,className:`h-7 text-xs`,placeholder:`e.g. 30000`})]})]}),e.type===`boundary_event`&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.Separator,{}),(0,a.jsx)(`p`,{className:`text-xs font-semibold text-muted-foreground uppercase tracking-wide`,children:`Boundary Config`}),(0,a.jsxs)(`div`,{className:`space-y-1`,children:[(0,a.jsx)(r.Label,{className:`text-xs`,children:`Attached To Node ID`}),(0,a.jsx)(r.Input,{value:e.boundaryConfig?.attachedToNodeId??``,onChange:t=>i({...e,boundaryConfig:{...e.boundaryConfig,attachedToNodeId:t.target.value,eventType:e.boundaryConfig?.eventType??`error`}}),disabled:n,className:`h-7 text-xs`,placeholder:`Host node id`})]}),(0,a.jsxs)(`div`,{className:`space-y-1`,children:[(0,a.jsx)(r.Label,{className:`text-xs`,children:`Event Type`}),(0,a.jsxs)(r.Select,{value:e.boundaryConfig?.eventType??`error`,onValueChange:t=>i({...e,boundaryConfig:{...e.boundaryConfig,attachedToNodeId:e.boundaryConfig?.attachedToNodeId??``,eventType:t}}),disabled:n,children:[(0,a.jsx)(r.SelectTrigger,{className:`h-7 text-xs`,children:(0,a.jsx)(r.SelectValue,{})}),(0,a.jsx)(r.SelectContent,{children:[`error`,`timer`,`message`,`signal`,`compensation`].map(e=>(0,a.jsx)(r.SelectItem,{value:e,className:`text-xs capitalize`,children:e},e))})]})]})]})]}):t?(0,a.jsxs)(`div`,{className:`p-3 space-y-3 overflow-y-auto`,children:[(0,a.jsx)(`p`,{className:`text-xs font-semibold text-muted-foreground uppercase tracking-wide`,children:`Edge Properties`}),(0,a.jsxs)(`div`,{className:`space-y-1`,children:[(0,a.jsx)(r.Label,{className:`text-xs`,children:`Label`}),(0,a.jsx)(r.Input,{value:t.label??``,onChange:e=>o({...t,label:e.target.value}),disabled:n,className:`h-7 text-xs`})]}),(0,a.jsxs)(`div`,{className:`space-y-1`,children:[(0,a.jsx)(r.Label,{className:`text-xs`,children:`Type`}),(0,a.jsxs)(r.Select,{value:t.type??`default`,onValueChange:e=>o({...t,type:e}),disabled:n,children:[(0,a.jsx)(r.SelectTrigger,{className:`h-7 text-xs`,children:(0,a.jsx)(r.SelectValue,{})}),(0,a.jsxs)(r.SelectContent,{children:[(0,a.jsx)(r.SelectItem,{value:`default`,className:`text-xs`,children:`Default`}),(0,a.jsx)(r.SelectItem,{value:`conditional`,className:`text-xs`,children:`Conditional`}),(0,a.jsx)(r.SelectItem,{value:`timeout`,className:`text-xs`,children:`Timeout`})]})]})]}),t.type===`conditional`&&(0,a.jsxs)(`div`,{className:`space-y-1`,children:[(0,a.jsx)(r.Label,{className:`text-xs`,children:`Condition Expression`}),(0,a.jsx)(r.Input,{value:t.condition??``,onChange:e=>o({...t,condition:e.target.value}),disabled:n,className:`h-7 text-xs font-mono`,placeholder:`e.g. status === 'approved'`})]}),(0,a.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,a.jsx)(`input`,{type:`checkbox`,id:`edge-isDefault`,checked:t.isDefault??!1,onChange:e=>o({...t,isDefault:e.target.checked}),disabled:n,className:`h-3.5 w-3.5`}),(0,a.jsx)(r.Label,{htmlFor:`edge-isDefault`,className:`text-xs`,children:`Default edge (isDefault)`})]})]}):null,ce=({versions:e})=>(0,a.jsxs)(`div`,{className:`p-3 space-y-2`,children:[(0,a.jsx)(`p`,{className:`text-xs font-semibold text-muted-foreground uppercase tracking-wide`,children:`Version History`}),e.length===0&&(0,a.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No version history available.`}),(0,a.jsx)(`div`,{className:`space-y-1.5`,children:e.map(e=>(0,a.jsxs)(`div`,{className:j(`rounded border p-2 text-xs`,e.isCurrent?`border-primary bg-primary/5`:`border-border bg-muted/30`),children:[(0,a.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,a.jsxs)(`span`,{className:`font-medium`,children:[`v`,e.version]}),e.isCurrent&&(0,a.jsx)(r.Badge,{variant:`default`,className:`text-[10px] h-4`,children:`Current`})]}),e.changeNote&&(0,a.jsx)(`p`,{className:`text-muted-foreground mt-0.5`,children:e.changeNote}),(0,a.jsxs)(`p`,{className:`text-muted-foreground mt-0.5`,children:[e.author&&(0,a.jsxs)(a.Fragment,{children:[e.author,` · `]}),new Date(e.createdAt).toLocaleDateString()]})]},e.version))})]}),V=({schema:e,onSave:t})=>{let{readOnly:o=!1,showToolbar:s=!0,showMinimap:c=!1,showVersionHistory:l=!1,showExecutionOverlay:u=!1,executionSteps:d=[],versionHistory:f=[],concurrencyPolicy:p,title:m=`New Flow`,description:h=``,status:g=`draft`}=e,[_,v]=(0,n.useState)(m),[y,b]=(0,n.useState)(h),{current:x,push:S,undo:C,redo:w,canUndo:T,canRedo:E}=re({nodes:e.nodes??te(),edges:e.edges??ne()}),D=x.nodes,O=x.edges,[k,A]=(0,n.useState)(null),[j,M]=(0,n.useState)(null),[N,I]=(0,n.useState)(!1),[L,z]=(0,n.useState)(null),[B,V]=(0,n.useState)(!0),[H,le]=(0,n.useState)(l),[U,W]=(0,n.useState)(null),[G,K]=(0,n.useState)(1),q=(0,n.useRef)(null),ue=(0,n.useMemo)(()=>D.find(e=>e.id===k)??null,[D,k]),de=(0,n.useMemo)(()=>O.find(e=>e.id===j)??null,[O,j]),J=(0,n.useMemo)(()=>{if(!u||d.length===0)return D;let e=new Map(d.map(e=>[e.nodeId,e.status]));return D.map(t=>e.has(t.id)?{...t,executionStatus:e.get(t.id)}:t)},[D,u,d]),fe=(0,n.useCallback)(e=>{if(o)return;let t={id:`${e}-${Date.now()}`,type:e,label:P[e],position:{x:200,y:80+D.length*70}};S({nodes:[...D,t],edges:O})},[o,D,O,S]),Y=(0,n.useCallback)(e=>{o||(S({nodes:D.filter(t=>t.id!==e),edges:O.filter(t=>t.source!==e&&t.target!==e)}),k===e&&A(null))},[o,D,O,S,k]),pe=(0,n.useCallback)(e=>{o||S({nodes:D.map(t=>t.id===e.id?e:t),edges:O})},[o,D,O,S]),X=(0,n.useCallback)(e=>{o||(S({nodes:D,edges:O.filter(t=>t.id!==e)}),j===e&&M(null))},[o,D,O,S,j]),me=(0,n.useCallback)(e=>{o||S({nodes:D,edges:O.map(t=>t.id===e.id?e:t)})},[o,D,O,S]),he=(0,n.useCallback)(e=>{if(!o){if(!N){I(!0),z(e);return}if(L&&L!==e){let t={id:`edge-${Date.now()}`,source:L,target:e};S({nodes:D,edges:[...O,t]})}I(!1),z(null)}},[o,N,L,D,O,S]),Z=(0,n.useRef)(null),Q=(0,n.useRef)(null),ge=(0,n.useCallback)((e,t)=>{Z.current=t;let n=D.find(e=>e.id===t);n&&(Q.current={mouseX:e.clientX,mouseY:e.clientY,nodeX:n.position.x,nodeY:n.position.y}),e.dataTransfer.effectAllowed=`move`},[D]),_e=(0,n.useCallback)(e=>{if(e.preventDefault(),!Z.current||!Q.current||!q.current)return;q.current.getBoundingClientRect();let t=(e.clientX-Q.current.mouseX)/G,n=(e.clientY-Q.current.mouseY)/G,r=Math.max(0,Q.current.nodeX+t),i=Math.max(0,Q.current.nodeY+n),a=Z.current;S({nodes:D.map(e=>e.id===a?{...e,position:{x:r,y:i}}:e),edges:O}),Z.current=null,Q.current=null},[D,O,S,G]),ve=(0,n.useCallback)(()=>{let e=ie(D,O,_);W(e);let t=new Blob([e.bpmnXml??``],{type:`application/xml`}),n=URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=`${_.replace(/\s+/g,`-`).toLowerCase()}.bpmn`,r.click(),URL.revokeObjectURL(n)},[D,O,_]),$=(0,n.useCallback)(()=>{t?.(D,O)},[D,O,t]);return(0,a.jsxs)(r.Card,{className:`flex flex-col h-full min-h-[600px] outline-none`,tabIndex:0,onKeyDown:(0,n.useCallback)(e=>{let t=e.ctrlKey||e.metaKey;if(t&&e.key===`z`&&!e.shiftKey){e.preventDefault(),C();return}if(t&&(e.key===`y`||e.key===`z`&&e.shiftKey)){e.preventDefault(),w();return}if(t&&e.key===`s`){e.preventDefault(),$();return}e.key===`Escape`&&(I(!1),z(null),A(null),M(null)),(e.key===`Delete`||e.key===`Backspace`)&&(k?Y(k):j&&X(j))},[C,w,$,k,j,Y,X]),children:[(0,a.jsx)(r.CardHeader,{className:`py-2 px-4 border-b shrink-0`,children:(0,a.jsxs)(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[(0,a.jsx)(i.Zap,{className:`h-4 w-4 text-primary shrink-0`}),(0,a.jsx)(r.CardTitle,{className:`text-sm font-semibold`,children:o?(0,a.jsx)(`span`,{children:_}):(0,a.jsx)(r.Input,{value:_,onChange:e=>v(e.target.value),className:`h-6 text-sm font-semibold border-0 p-0 focus-visible:ring-0 bg-transparent`,"aria-label":`Flow title`})}),(0,a.jsx)(r.Badge,{variant:`outline`,className:`text-xs capitalize`,children:g}),p&&(0,a.jsx)(r.Badge,{variant:`secondary`,className:`text-xs`,children:R[p]}),(0,a.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[!o&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.Button,{size:`icon`,variant:`ghost`,className:`h-7 w-7`,onClick:C,disabled:!T,title:`Undo (Ctrl+Z)`,children:(0,a.jsx)(i.Undo2,{className:`h-4 w-4`})}),(0,a.jsx)(r.Button,{size:`icon`,variant:`ghost`,className:`h-7 w-7`,onClick:w,disabled:!E,title:`Redo (Ctrl+Y)`,children:(0,a.jsx)(i.Redo2,{className:`h-4 w-4`})}),(0,a.jsx)(r.Separator,{orientation:`vertical`,className:`h-5 mx-1`})]}),(0,a.jsx)(r.Button,{size:`icon`,variant:`ghost`,className:`h-7 w-7`,onClick:()=>K(e=>Math.min(2,e+.1)),title:`Zoom in`,children:(0,a.jsx)(i.ZoomIn,{className:`h-4 w-4`})}),(0,a.jsx)(r.Button,{size:`icon`,variant:`ghost`,className:`h-7 w-7`,onClick:()=>K(1),title:`Reset zoom`,children:(0,a.jsx)(i.RotateCcw,{className:`h-4 w-4`})}),(0,a.jsx)(r.Button,{size:`icon`,variant:`ghost`,className:`h-7 w-7`,onClick:()=>K(e=>Math.max(.3,e-.1)),title:`Zoom out`,children:(0,a.jsx)(i.ZoomOut,{className:`h-4 w-4`})}),(0,a.jsx)(r.Separator,{orientation:`vertical`,className:`h-5 mx-1`}),f.length>0&&(0,a.jsx)(r.Button,{size:`icon`,variant:H?`secondary`:`ghost`,className:`h-7 w-7`,onClick:()=>le(e=>!e),title:`Version history`,children:(0,a.jsx)(i.History,{className:`h-4 w-4`})}),(0,a.jsx)(r.Button,{size:`icon`,variant:`ghost`,className:`h-7 w-7`,onClick:ve,title:`Export BPMN`,children:(0,a.jsx)(i.Download,{className:`h-4 w-4`})}),!o&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.Button,{size:`icon`,variant:`ghost`,className:`h-7 w-7`,title:`Import BPMN (drag & drop)`,children:(0,a.jsx)(i.Upload,{className:`h-4 w-4`})}),(0,a.jsxs)(r.Button,{size:`sm`,variant:`default`,className:`h-7 text-xs gap-1`,onClick:$,title:`Save (Ctrl+S)`,children:[(0,a.jsx)(i.Save,{className:`h-3.5 w-3.5`}),` Save`]})]}),(0,a.jsx)(r.Button,{size:`icon`,variant:`ghost`,className:`h-7 w-7`,onClick:()=>V(e=>!e),title:B?`Hide properties`:`Show properties`,children:B?(0,a.jsx)(i.PanelRightClose,{className:`h-4 w-4`}):(0,a.jsx)(i.PanelRightOpen,{className:`h-4 w-4`})})]})]})}),(0,a.jsxs)(r.CardContent,{className:`flex flex-1 p-0 overflow-hidden`,children:[s&&!o&&(0,a.jsxs)(`div`,{className:`w-36 border-r bg-muted/30 shrink-0 overflow-y-auto py-2 px-2`,children:[(0,a.jsx)(`p`,{className:`text-[10px] font-semibold text-muted-foreground uppercase tracking-wide mb-2 px-1`,children:`Add Node`}),(0,a.jsx)(`div`,{className:`space-y-1`,children:ee.map(e=>(0,a.jsxs)(`button`,{className:`w-full flex items-center gap-2 text-xs px-2 py-1.5 rounded hover:bg-muted transition-colors text-left`,onClick:()=>fe(e),title:`Add ${P[e]}`,children:[F[e],(0,a.jsx)(`span`,{className:`truncate`,children:P[e]})]},e))}),N&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.Separator,{className:`my-2`}),(0,a.jsxs)(`div`,{className:`px-1`,children:[(0,a.jsx)(`p`,{className:`text-[10px] text-blue-600 font-medium`,children:`Connect mode`}),(0,a.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:`Click a target node port to connect.`}),(0,a.jsx)(r.Button,{size:`sm`,variant:`outline`,className:`h-6 text-xs mt-1 w-full`,onClick:()=>{I(!1),z(null)},children:`Cancel`})]})]})]}),(0,a.jsx)(`div`,{className:`flex-1 overflow-auto relative bg-dot-pattern`,children:(0,a.jsxs)(`div`,{ref:q,className:`relative`,style:{width:1200,height:700,transform:`scale(${G})`,transformOrigin:`top left`},onDrop:_e,onDragOver:e=>e.preventDefault(),onClick:e=>{e.target===q.current&&(A(null),M(null))},children:[(0,a.jsxs)(`svg`,{className:`absolute inset-0 pointer-events-none`,width:1200,height:700,style:{overflow:`visible`},children:[(0,a.jsxs)(`defs`,{children:[(0,a.jsx)(`marker`,{id:`fd-arrowhead`,markerWidth:`10`,markerHeight:`7`,refX:`9`,refY:`3.5`,orient:`auto`,children:(0,a.jsx)(`polygon`,{points:`0 0, 10 3.5, 0 7`,fill:`hsl(var(--foreground) / 0.5)`})}),(0,a.jsx)(`marker`,{id:`fd-arrowhead-selected`,markerWidth:`10`,markerHeight:`7`,refX:`9`,refY:`3.5`,orient:`auto`,children:(0,a.jsx)(`polygon`,{points:`0 0, 10 3.5, 0 7`,fill:`hsl(var(--primary))`})}),(0,a.jsx)(`marker`,{id:`fd-arrowhead-conditional`,markerWidth:`10`,markerHeight:`7`,refX:`9`,refY:`3.5`,orient:`auto`,children:(0,a.jsx)(`polygon`,{points:`0 0, 10 3.5, 0 7`,fill:`hsl(var(--foreground) / 0.6)`})})]}),O.map(e=>{let t=J.find(t=>t.id===e.source),n=J.find(t=>t.id===e.target);if(!t||!n)return null;let{d:r,labelX:i,labelY:o}=ae(t,n),s=e.id===j,c=e.type===`conditional`,l=e.isDefault;return(0,a.jsxs)(`g`,{className:`pointer-events-auto cursor-pointer`,onClick:t=>{t.stopPropagation(),M(e.id),A(null)},children:[(0,a.jsx)(`path`,{d:r,fill:`none`,stroke:s?`hsl(var(--primary))`:c?`hsl(var(--foreground) / 0.6)`:`hsl(var(--foreground) / 0.4)`,strokeWidth:s?2.5:2,strokeDasharray:c?`6 3`:l?`3 3`:void 0,markerEnd:`url(#fd-arrowhead${s?`-selected`:c?`-conditional`:``})`}),(e.label||l)&&(0,a.jsx)(`text`,{x:i,y:o,textAnchor:`middle`,className:`text-[10px] fill-muted-foreground`,style:{fontSize:10},children:e.label??(l?`(default)`:``)}),e.condition&&(0,a.jsx)(`text`,{x:i,y:o+12,textAnchor:`middle`,className:`text-[9px] fill-orange-500`,style:{fontSize:9},children:e.condition.length>24?e.condition.slice(0,24)+`…`:e.condition}),(0,a.jsx)(`path`,{d:r,fill:`none`,stroke:`transparent`,strokeWidth:12})]},e.id)})]}),J.map(e=>(0,a.jsx)(oe,{node:e,isSelected:k===e.id,isConnectSource:L===e.id,connectMode:N,readOnly:o,showExecutionOverlay:u,onSelect:(e,t)=>{t||M(null),A(e)},onDelete:Y,onDragStart:ge,onPortClick:he},e.id)),N&&L&&(0,a.jsxs)(`div`,{className:`absolute bottom-4 left-1/2 -translate-x-1/2 bg-blue-600 text-white text-xs px-3 py-1.5 rounded shadow-lg pointer-events-none`,children:[(0,a.jsx)(i.Link,{className:`h-3 w-3 inline mr-1`}),`Click a node port to complete the connection — Esc to cancel`]}),D.length===0&&(0,a.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center text-muted-foreground text-sm`,children:`No nodes yet. Use the toolbar to add nodes.`})]})}),H&&f.length>0&&(0,a.jsx)(`div`,{className:`w-48 border-l bg-background shrink-0 overflow-y-auto`,children:(0,a.jsx)(ce,{versions:f})}),B&&(0,a.jsxs)(`div`,{className:`w-52 border-l bg-background shrink-0 overflow-y-auto`,children:[(0,a.jsx)(se,{node:ue,edge:de,readOnly:o,onNodeChange:pe,onEdgeChange:me}),U&&(0,a.jsxs)(`div`,{className:`p-3 border-t`,children:[(0,a.jsx)(`p`,{className:`text-[10px] font-semibold text-muted-foreground uppercase tracking-wide mb-1`,children:`BPMN Export`}),(0,a.jsx)(r.Badge,{variant:U.success?`default`:`destructive`,className:`text-[10px]`,children:U.success?`Exported ${U.nodeCount} nodes`:`Export failed`}),U.warnings?.map((e,t)=>(0,a.jsx)(`p`,{className:`text-[10px] text-amber-600 mt-0.5`,children:e},t))]})]})]})]})};t.ComponentRegistry.register(`workflow-designer`,v,{label:`Workflow Designer`,category:`Enterprise`,inputs:[{name:`workflow`,type:`code`,label:`Initial Workflow Definition`},{name:`readOnly`,type:`boolean`,label:`Read Only`,defaultValue:!1},{name:`showToolbar`,type:`boolean`,label:`Show Toolbar`,defaultValue:!0},{name:`showMinimap`,type:`boolean`,label:`Show Minimap`,defaultValue:!1}]}),t.ComponentRegistry.register(`approval-process`,y,{label:`Approval Process`,category:`Enterprise`,inputs:[{name:`workflowId`,type:`string`,label:`Workflow ID`},{name:`instanceId`,type:`string`,label:`Instance ID`},{name:`currentNodeId`,type:`string`,label:`Current Node ID`},{name:`approvalRule`,type:`code`,label:`Approval Rule`},{name:`history`,type:`code`,label:`History`},{name:`showHistory`,type:`boolean`,label:`Show History`,defaultValue:!0},{name:`showComments`,type:`boolean`,label:`Show Comments`,defaultValue:!0}]}),t.ComponentRegistry.register(`automation-builder`,E,{label:`Automation Builder`,category:`Enterprise`,inputs:[{name:`automation`,type:`code`,label:`Automation Definition`},{name:`objects`,type:`code`,label:`Available Objects`}]}),t.ComponentRegistry.register(`automation-run-history`,A,{label:`Automation Run History`,category:`Enterprise`,inputs:[{name:`runs`,type:`code`,label:`Run History`}]}),t.ComponentRegistry.register(`flow-designer`,V,{label:`Flow Designer`,category:`Enterprise`,inputs:[{name:`nodes`,type:`code`,label:`Flow Nodes`},{name:`edges`,type:`code`,label:`Flow Edges`},{name:`title`,type:`string`,label:`Flow Title`},{name:`readOnly`,type:`boolean`,label:`Read Only`,defaultValue:!1},{name:`showToolbar`,type:`boolean`,label:`Show Toolbar`,defaultValue:!0},{name:`showMinimap`,type:`boolean`,label:`Show Minimap`,defaultValue:!1},{name:`showVersionHistory`,type:`boolean`,label:`Show Version History`,defaultValue:!1},{name:`showExecutionOverlay`,type:`boolean`,label:`Show Execution Overlay`,defaultValue:!1},{name:`concurrencyPolicy`,type:`string`,label:`Concurrency Policy`},{name:`versionHistory`,type:`code`,label:`Version History`},{name:`executionSteps`,type:`code`,label:`Execution Steps`}]}),e.ApprovalProcess=y,e.AutomationBuilder=E,e.AutomationRunHistory=A,e.FlowDesigner=V,e.WorkflowDesigner=v});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@object-ui/plugin-workflow",
3
- "version": "4.0.5",
3
+ "version": "4.0.6",
4
4
  "type": "module",
5
5
  "main": "dist/index.umd.cjs",
6
6
  "module": "dist/index.js",
@@ -26,10 +26,10 @@
26
26
  "clsx": "^2.1.1",
27
27
  "lucide-react": "^1.14.0",
28
28
  "tailwind-merge": "^3.5.0",
29
- "@object-ui/components": "4.0.5",
30
- "@object-ui/core": "4.0.5",
31
- "@object-ui/react": "4.0.5",
32
- "@object-ui/types": "4.0.5"
29
+ "@object-ui/components": "4.0.6",
30
+ "@object-ui/core": "4.0.6",
31
+ "@object-ui/react": "4.0.6",
32
+ "@object-ui/types": "4.0.6"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@types/node": "^25.6.0",