@universal-workflow/widget-react 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{useEffect as uo,useState as U,useCallback as W,useMemo as bo,useRef as mo}from"react";import go,{Background as yo,Controls as ho,MiniMap as fo,useNodesState as xo,useEdgesState as vo,addEdge as wo,BackgroundVariant as ko}from"reactflow";import"reactflow/dist/style.css";var Ye="http://localhost:3000/api/v1/license/validate",ae=class{constructor(e){this.config=e,this.validationResult=null}async validate(){if(this.validationResult)return this.validationResult;try{let e=this.config.validationEndpoint||Ye,t=await(await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({licenseKey:this.config.licenseKey,widgetVersion:this.config.widgetVersion,originUrl:typeof window!="undefined"?window.location.origin:""})})).json();return this.validationResult=t,t}catch(e){return console.error("License validation failed",e),{valid:!1,reason:"Network Error"}}}isFeatureEnabled(e){var t,r;return(t=this.validationResult)!=null&&t.valid?!!((r=this.validationResult.features)!=null&&r[e]):!1}},re=class{constructor(e){this.config=e}async request(e,t,r){let i={"Content-Type":"application/json",...this.config.headers},s=await fetch(e,{method:t,headers:i,body:r?JSON.stringify(r):void 0});if(!s.ok)throw new Error(`API Request failed: ${s.statusText}`);return s.json()}async getWorkflow(e){let t=`${this.config.baseUrl}${this.config.endpoints.get.replace(":id",e)}`;return this.request(t,"GET")}async createWorkflow(e){let t=`${this.config.baseUrl}${this.config.endpoints.create}`;return this.request(t,"POST",e)}async updateWorkflow(e,t){let r=`${this.config.baseUrl}${this.config.endpoints.update.replace(":id",e)}`;return this.request(r,"PUT",t)}},ie=class{static serialize(e,t,r){return JSON.stringify({nodes:e,edges:t,viewport:r})}static deserialize(e){try{let t=JSON.parse(e);return{nodes:t.nodes||[],edges:t.edges||[],viewport:t.viewport}}catch{return{nodes:[],edges:[]}}}},ne=ie.serialize,se=ie.deserialize;function le(e){return{type:e.id,label:e.label,description:`Integration with ${e.label}`,category:e.category,icon:e.icon,color:e.color,handles:[{id:"in",type:"target"},{id:"out",type:"source"}],inputs:[{key:"auth_token",label:"API Key / Token",type:"text",placeholder:e.auth.placeholder||"Enter API Key"},{key:"operation",label:"Action",type:"select",options:e.operations.map(t=>({label:t.label,value:t.id}))}]}}var Y=[{id:"google-sheets",label:"Google Sheets",category:"utility",icon:"Sheet",color:"emerald",baseUrl:"https://sheets.googleapis.com/v4/spreadsheets",auth:{type:"bearer",placeholder:"OAuth Token"},operations:[{id:"append_row",label:"Append Row",method:"POST",path:"/{spreadsheetId}/values/{range}:append",inputs:[{key:"spreadsheetId",label:"Spreadsheet ID",type:"text"},{key:"range",label:"Range (Sheet1!A1)",type:"text"},{key:"values",label:"Row Values (JSON Array)",type:"json"}]},{id:"get_values",label:"Get Row(s)",method:"GET",path:"/{spreadsheetId}/values/{range}",inputs:[{key:"spreadsheetId",label:"Spreadsheet ID",type:"text"},{key:"range",label:"Range",type:"text"}]}]},{id:"slack-connector",label:"Slack API",category:"action",icon:"MessageSquare",color:"blue",baseUrl:"https://slack.com/api",auth:{type:"bearer",placeholder:"xoxb-..."},operations:[{id:"post_message",label:"Post Message",method:"POST",path:"/chat.postMessage",inputs:[{key:"channel",label:"Channel ID",type:"text"},{key:"text",label:"Message Text",type:"text"}]}]},{id:"openai",label:"OpenAI",category:"action",icon:"Bot",color:"zinc",baseUrl:"https://api.openai.com/v1",auth:{type:"bearer",placeholder:"sk-..."},operations:[{id:"chat_completion",label:"Chat Completion",method:"POST",path:"/chat/completions",inputs:[{key:"model",label:"Model",type:"select",options:[{label:"GPT-4o",value:"gpt-4o"},{label:"GPT-3.5",value:"gpt-3.5-turbo"}]},{key:"messages",label:"Messages (JSON)",type:"json"}]}]}];function Io(e){Y.push(e)}var Ze=[{id:"triggers",nodes:[{type:"manual-trigger",label:"Manual Trigger",description:"Start flow on button click",category:"trigger",icon:"Play",color:"emerald",inputs:[]},{type:"cron-trigger",label:"Cron Schedule",description:"Trigger on a schedule",category:"trigger",icon:"Clock",color:"emerald",inputs:[{key:"expression",label:"Cron Expression",type:"text",placeholder:"0 9 * * 1 (Every Mon at 9am)"}]},{id:"github-trigger",label:"GitHub Trigger",category:"trigger",icon:"Github",color:"zinc",baseUrl:"https://api.github.com",auth:{type:"header",key:"X-GitHub-Token"},operations:[{id:"on_push",label:"On Push",method:"POST",path:"/repos/{owner}/{repo}/hooks",inputs:[{key:"owner",label:"Owner",type:"text"},{key:"repo",label:"Repository",type:"text"}]},{id:"on_star",label:"On New Star",method:"POST",path:"/repos/{owner}/{repo}/hooks",inputs:[{key:"owner",label:"Owner",type:"text"},{key:"repo",label:"Repository",type:"text"}]}]}]},{id:"logic",nodes:[{type:"switch",label:"Switch / Router",description:"Route based on value",category:"logic",icon:"GitFork",color:"orange",inputs:[{key:"property",label:"Property to Check",type:"text"},{key:"cases",label:"Cases (comma sep)",type:"text",placeholder:"marketing, sales, support"}]},{type:"ab-split",label:"A/B Split",description:"Randomly split traffic",category:"logic",icon:"Percent",color:"orange",inputs:[{key:"percentA",label:"Percentage for A",type:"text",placeholder:"50"}]},{type:"wait",label:"Wait / Delay",description:"Pause execution",category:"logic",icon:"Timer",color:"orange",inputs:[{key:"duration",label:"Duration",type:"text",placeholder:"5000"},{key:"unit",label:"Unit",type:"select",options:[{label:"Milliseconds",value:"ms"},{label:"Seconds",value:"s"}]}]}]},{id:"utilities",nodes:[{type:"text-transform",label:"Text Transform",description:"Modify text strings",category:"utility",icon:"Type",color:"zinc",inputs:[{key:"action",label:"Action",type:"select",options:[{label:"To Upper Case",value:"upper"},{label:"To Lower Case",value:"lower"},{label:"Trim",value:"trim"},{label:"Replace",value:"replace"}]},{key:"input",label:"Input Text",type:"text"}]},{type:"json-parser",label:"JSON Helper",description:"Parse or stringify JSON",category:"utility",icon:"Code",color:"zinc",inputs:[{key:"action",label:"Action",type:"select",options:[{label:"Parse (String to JSON)",value:"parse"},{label:"Stringify (JSON to String)",value:"stringify"}]},{key:"data",label:"Data",type:"json"}]},{type:"math-calc",label:"Math Calculator",description:"Perform calculations",category:"utility",icon:"Calculator",color:"zinc",inputs:[{key:"operation",label:"Operation",type:"select",options:[{label:"Add",value:"add"},{label:"Subtract",value:"sub"},{label:"Multiply",value:"mul"},{label:"Divide",value:"div"},{label:"Random Number",value:"random"}]},{key:"a",label:"Value A",type:"text"},{key:"b",label:"Value B",type:"text"}]},{type:"crypto",label:"Cryptography",description:"Hash or Encrypt data",category:"utility",icon:"Lock",color:"zinc",inputs:[{key:"algo",label:"Algorithm",type:"select",options:[{label:"MD5",value:"md5"},{label:"SHA-256",value:"sha256"},{label:"Base64 Encode",value:"base64_enc"},{label:"Base64 Decode",value:"base64_dec"}]},{key:"input",label:"value",type:"text"}]},{type:"date-time",label:"Date & Time",description:"Format or manipulate dates",category:"utility",icon:"Calendar",color:"zinc",inputs:[{key:"operation",label:"Action",type:"select",options:[{label:"Now (ISO)",value:"now"},{label:"Format Date",value:"format"},{label:"Add Time",value:"add"}]},{key:"date",label:"Date String",type:"text"},{key:"format",label:"Format Pattern",type:"text",placeholder:"YYYY-MM-DD"}]}]},{id:"integrations-productivity",nodes:[{id:"google-drive",label:"Google Drive",icon:"HardDrive",color:"blue",category:"action",baseUrl:"https://www.googleapis.com/drive/v3",auth:{type:"bearer",placeholder:"OAuth Token"},operations:[{id:"list",label:"List Files",method:"GET",path:"/files",inputs:[{key:"q",label:"Query",type:"text"}]},{id:"upload",label:"Upload File",method:"POST",path:"/files",inputs:[{key:"name",label:"Name",type:"text"},{key:"content",label:"Content",type:"text"}]}]},{id:"notion",label:"Notion",icon:"FileText",color:"zinc",category:"action",baseUrl:"https://api.notion.com/v1",auth:{type:"header",key:"Authorization",placeholder:"Bearer secret_..."},operations:[{id:"create_page",label:"Create Page",method:"POST",path:"/pages",inputs:[{key:"parent_id",label:"Parent DB ID",type:"text"},{key:"properties",label:"Properties JSON",type:"json"}]},{id:"query_db",label:"Query Database",method:"POST",path:"/databases/{id}/query",inputs:[{key:"id",label:"Database ID",type:"text"}]}]},{id:"airtable",label:"Airtable",icon:"Database",color:"amber",category:"action",baseUrl:"https://api.airtable.com/v0",auth:{type:"bearer",placeholder:"pat_..."},operations:[{id:"create_record",label:"Create Record",method:"POST",path:"/{baseId}/{tableId}",inputs:[{key:"baseId",label:"Base ID",type:"text"},{key:"tableId",label:"Table Name",type:"text"},{key:"fields",label:"Fields JSON",type:"json"}]},{id:"list_records",label:"List Records",method:"GET",path:"/{baseId}/{tableId}",inputs:[{key:"baseId",label:"Base ID",type:"text"},{key:"tableId",label:"Table Name",type:"text"}]}]}]},{id:"integrations-crm-marketing",nodes:[{id:"salesforce",label:"Salesforce",icon:"Cloud",color:"blue",category:"action",baseUrl:"https://{instance}.salesforce.com/services/data/vXX.X",auth:{type:"bearer"},operations:[{id:"create_lead",label:"Create Lead",method:"POST",path:"/sobjects/Lead",inputs:[{key:"instance",label:"Instance URL",type:"text"},{key:"LastName",label:"Last Name",type:"text"},{key:"Company",label:"Company",type:"text"}]}]},{id:"hubspot",label:"HubSpot",icon:"Users",color:"orange",category:"action",baseUrl:"https://api.hubapi.com",auth:{type:"bearer"},operations:[{id:"create_contact",label:"Create Contact",method:"POST",path:"/crm/v3/objects/contacts",inputs:[{key:"properties",label:"Properties JSON",type:"json"}]}]},{id:"mailchimp",label:"Mailchimp",icon:"Mail",color:"yellow",category:"action",baseUrl:"https://{dc}.api.mailchimp.com/3.0",auth:{type:"bearer"},operations:[{id:"add_member",label:"Add Subscriber",method:"POST",path:"/lists/{list_id}/members",inputs:[{key:"dc",label:"Data Center (usX)",type:"text"},{key:"list_id",label:"List ID",type:"text"},{key:"email_address",label:"Email",type:"text"},{key:"status",label:"Status",type:"select",options:[{label:"subscribed",value:"subscribed"}]}]}]}]},{id:"integrations-commerce",nodes:[{id:"shopify",label:"Shopify",icon:"ShoppingBag",color:"emerald",category:"action",baseUrl:"https://{shop}.myshopify.com/admin/api/2023-10",auth:{type:"header",key:"X-Shopify-Access-Token"},operations:[{id:"get_products",label:"Get Products",method:"GET",path:"/products.json",inputs:[{key:"shop",label:"Shop Name",type:"text"}]},{id:"create_order",label:"Create Order",method:"POST",path:"/orders.json",inputs:[{key:"shop",label:"Shop Name",type:"text"},{key:"order",label:"Order JSON",type:"json"}]}]},{id:"stripe",label:"Stripe",icon:"CreditCard",color:"indigo",category:"action",baseUrl:"https://api.stripe.com/v1",auth:{type:"bearer"},operations:[{id:"create_customer",label:"Create Customer",method:"POST",path:"/customers",inputs:[{key:"email",label:"Email",type:"text"}]},{id:"list_charges",label:"List Charges",method:"GET",path:"/charges",inputs:[{key:"limit",label:"Limit",type:"text"}]}]}]}];function Qe(){Ze.forEach(e=>{e.nodes.forEach(t=>{if(t.operations){let r={id:t.id,label:t.label,category:t.category,icon:t.icon,color:t.color,baseUrl:t.baseUrl,auth:t.auth,operations:t.operations};S[r.id]=le(r)}else{let r={type:t.type,label:t.label,description:t.description,category:t.category,icon:t.icon,color:t.color,handles:t.handles||[{id:"in",type:"target"},{id:"out",type:"source"}],inputs:t.inputs};S[r.type]=r}})})}var S={webhook:{type:"webhook",label:"Webhook",description:"Triggers when a URL is called",category:"trigger",icon:"Webhook",color:"emerald",handles:[{id:"out",type:"source"}],inputs:[{key:"method",label:"HTTP Method",type:"select",options:[{label:"GET",value:"GET"},{label:"POST",value:"POST"}]},{key:"path",label:"Path",type:"text",placeholder:"/webhook/..."}]},schedule:{type:"schedule",label:"Schedule",description:"Triggers on a specific interval",category:"trigger",icon:"Clock",color:"emerald",handles:[{id:"out",type:"source"}],inputs:[{key:"interval",label:"Interval",type:"select",options:[{label:"Every Minute",value:"1m"},{label:"Every Hour",value:"1h"},{label:"Every Day",value:"1d"}]},{key:"cron",label:"Cron Expression",type:"text",placeholder:"* * * * *"}]},"http-request":{type:"http-request",label:"HTTP Request",description:"Make an external API call",category:"action",icon:"Globe",color:"blue",handles:[{id:"in",type:"target"},{id:"out",type:"source"}],inputs:[{key:"url",label:"URL",type:"text",placeholder:"https://api.example.com"},{key:"method",label:"Method",type:"select",options:[{label:"GET",value:"GET"},{label:"POST",value:"POST"},{label:"PUT",value:"PUT"},{label:"DELETE",value:"DELETE"}]},{key:"headers",label:"Headers",type:"json"},{key:"body",label:"Body",type:"json"}]},email:{type:"email",label:"Send Email",description:"Send an email to a recipient",category:"action",icon:"Mail",color:"blue",handles:[{id:"in",type:"target"},{id:"out",type:"source"}],inputs:[{key:"to",label:"To",type:"text"},{key:"subject",label:"Subject",type:"text"},{key:"body",label:"Body",type:"text"}]},slack:{type:"slack",label:"Slack (Simple)",description:"Send a message to a channel",category:"action",icon:"MessageSquare",color:"blue",handles:[{id:"in",type:"target"},{id:"out",type:"source"}],inputs:[{key:"webhookUrl",label:"Webhook URL",type:"text"},{key:"message",label:"Message",type:"text"}]},"if-else":{type:"if-else",label:"If / Else",description:"Branch flow based on condition",category:"logic",icon:"Split",color:"orange",handles:[{id:"in",type:"target"},{id:"true",type:"source",label:"True"},{id:"false",type:"source",label:"False"}],inputs:[{key:"condition",label:"Condition",type:"code",description:"Javascript expression returning true/false"}]},merge:{type:"merge",label:"Merge",description:"Combine multiple branches",category:"logic",icon:"GitMerge",color:"orange",handles:[{id:"in-a",type:"target",label:"A"},{id:"in-b",type:"target",label:"B"},{id:"out",type:"source"}],inputs:[]}};Y.forEach(e=>{S[e.id]=le(e)});Qe();function de(e){return Y.find(t=>t.id===e)}import{memo as wt}from"react";import{Handle as kt,Position as $}from"reactflow";import{Webhook as Nt,Clock as zt,Globe as Ct,Mail as St,MessageSquare as Tt,Split as Pt,GitMerge as Rt,MoreHorizontal as Et,Zap as ue}from"lucide-react";import{clsx as et}from"clsx";import{twMerge as tt}from"tailwind-merge";function O(...e){return tt(et(e))}import{Sheet as ot,Bot as at,Type as rt,Code as it,Calculator as nt,Timer as st,GitFork as lt,Percent as dt,HardDrive as ct,Calendar as pt,Play as ut,Github as bt,Lock as mt,FileText as gt,Database as yt,Cloud as ht,Users as ft,ShoppingBag as xt,CreditCard as vt}from"lucide-react";var _={Sheet:ot,Bot:at,Type:rt,Code:it,Calculator:nt,Timer:st,GitFork:lt,Percent:dt,HardDrive:ct,Calendar:pt,Play:ut,Github:bt,Lock:mt,FileText:gt,Database:yt,Cloud:ht,Users:ft,ShoppingBag:xt,CreditCard:vt};import{jsx as T,jsxs as A}from"react/jsx-runtime";var It={Webhook:Nt,Clock:zt,Globe:Ct,Mail:St,MessageSquare:Tt,Split:Pt,GitMerge:Rt,Zap:ue,..._},ce={emerald:"text-emerald-600 bg-emerald-50 border-emerald-200",blue:"text-blue-600 bg-blue-50 border-blue-200",orange:"text-orange-600 bg-orange-50 border-orange-200",zinc:"text-zinc-600 bg-zinc-50 border-zinc-200"},pe={emerald:"ring-emerald-500/20",blue:"ring-blue-500/20",orange:"ring-orange-500/20",zinc:"ring-zinc-500/20"},Z=wt(({data:e,selected:t,type:r})=>{let i=S[e.type||r]||S.webhook;if(!i)return A("div",{className:"p-2 border border-red-500 rounded bg-red-50 text-red-600",children:["Unknown Node Type: ",r]});let s=It[i.icon]||ue,d=ce[i.color]||ce.zinc,a=pe[i.color]||pe.zinc,b=e.executionStatus,p="";return b==="running"?p="ring-4 ring-indigo-500/30 border-indigo-500 shadow-lg shadow-indigo-200 animate-pulse":b==="success"?p="ring-4 ring-emerald-500/40 border-emerald-500 shadow-lg shadow-emerald-200":b==="error"&&(p="ring-4 ring-red-500/40 border-red-500 shadow-lg shadow-red-200"),A("div",{className:O("min-w-[240px] bg-white rounded-lg shadow-sm border-2 transition-all duration-300",t?`border-indigo-500 shadow-xl ring-2 ${a}`:"border-zinc-200 hover:border-zinc-300",p),children:[A("div",{className:O("flex items-center justify-between p-3 border-b border-zinc-100/50 rounded-t-md bg-zinc-50/50"),children:[A("div",{className:"flex items-center gap-3",children:[T("div",{className:O("p-1.5 rounded-md border shadow-sm",d),children:T(s,{size:16,strokeWidth:2.5})}),A("div",{children:[T("span",{className:"block text-xs font-bold uppercase tracking-wider text-zinc-500",children:i.category}),T("span",{className:"block text-sm font-semibold text-zinc-900 leading-none mt-0.5",children:i.label})]})]}),T("button",{className:"text-zinc-400 hover:text-zinc-600 transition-colors",children:T(Et,{size:16})})]}),A("div",{className:"p-4 bg-white rounded-b-lg",children:[i.type==="http-request"&&A("div",{className:"flex items-center gap-2 font-mono text-xs text-zinc-600 bg-zinc-50 p-2 rounded border border-zinc-100",children:[T("span",{className:"font-bold text-blue-600",children:e.method||"GET"}),T("span",{className:"truncate max-w-[140px]",children:e.url||"https://..."})]}),i.type==="webhook"&&A("div",{className:"flex items-center gap-2 font-mono text-xs text-zinc-600",children:[T("span",{className:"font-bold text-emerald-600",children:e.method||"POST"}),T("span",{children:e.path||"/webhook/..."})]}),i.type==="if-else"&&T("div",{className:"text-xs font-mono text-orange-600 bg-orange-50 p-2 rounded border border-orange-100 truncate",children:e.condition||"x > 0"}),!["http-request","webhook","if-else"].includes(i.type)&&T("p",{className:"text-sm text-zinc-500",children:i.description})]}),i.handles.map(o=>{let m=o.type==="target"?$.Left:$.Right,g={};i.type==="if-else"&&o.type;let l=o.type==="source",n=i.handles.filter(v=>v.type===o.type).indexOf(o),y=i.handles.filter(v=>v.type===o.type).length,h=y>1?`${(n+1)*100/(y+1)}%`:"50%";return T(kt,{id:o.id,type:o.type,position:l?$.Right:$.Left,style:{top:h,...g},className:O("!w-3 !h-3 !border-2 !border-white transition-all duration-200 bg-zinc-400 group-hover:bg-indigo-500",l?"-right-1.5":"-left-1.5",o.id==="true"?"!bg-emerald-500":o.id==="false"?"!bg-red-500":""),children:o.label&&T("span",{className:O("absolute text-[10px] uppercase font-bold text-zinc-500 pointer-events-none w-max block mb-1",l?"right-4 mr-1 text-right":"left-4 ml-1 text-left","top-1/2 -translate-y-1/2"),children:o.label})},o.id)})]})});import{useRef as Ot}from"react";import{MousePointer2 as Mt,Save as Lt,Undo2 as Ut,Redo2 as Dt,Plus as At,Download as Wt,Upload as Gt,Layout as jt,Trash2 as Bt,Play as Ft}from"lucide-react";import{jsx as x,jsxs as j}from"react/jsx-runtime";function be({onSave:e,onExport:t,onImport:r,onAddNode:i,onAutoLayout:s,onClear:d,onRun:a,isSaving:b,isRunning:p,canUndo:o,canRedo:m,onUndo:g,onRedo:l}){let n=Ot(null);return j("div",{className:"absolute top-4 left-1/2 -translate-x-1/2 z-50 flex items-center gap-1 p-1 bg-white/90 backdrop-blur-md border border-zinc-200/50 shadow-xl rounded-full",children:[x("input",{type:"file",ref:n,onChange:h=>{var B;let v=(B=h.target.files)==null?void 0:B[0];v&&r(v),n.current&&(n.current.value="")},accept:".json",className:"hidden"}),j("div",{className:"flex items-center gap-1 px-1 border-r border-zinc-200",children:[x("button",{className:"p-2 text-zinc-500 hover:text-zinc-900 hover:bg-zinc-100 rounded-full transition-all",title:"Select",children:x(Mt,{size:18})}),x("button",{onClick:i,className:"p-2 text-zinc-500 hover:text-zinc-900 hover:bg-zinc-100 rounded-full transition-all",title:"Add Node",children:x(At,{size:18})})]}),j("div",{className:"flex items-center gap-1 px-1 border-r border-zinc-200",children:[x("button",{onClick:g,disabled:!o,className:"p-2 text-zinc-400 hover:text-zinc-900 hover:bg-zinc-100 rounded-full transition-all disabled:opacity-30 disabled:cursor-not-allowed",title:"Undo",children:x(Ut,{size:18})}),x("button",{onClick:l,disabled:!m,className:"p-2 text-zinc-400 hover:text-zinc-900 hover:bg-zinc-100 rounded-full transition-all disabled:opacity-30 disabled:cursor-not-allowed",title:"Redo",children:x(Dt,{size:18})})]}),j("div",{className:"flex items-center gap-1 px-1 border-r border-zinc-200",children:[x("button",{onClick:s,className:"p-2 text-zinc-600 hover:text-zinc-900 hover:bg-zinc-100 rounded-full transition-all",title:"Auto Layout",children:x(jt,{size:18})}),x("button",{onClick:d,className:"p-2 text-zinc-600 hover:text-red-600 hover:bg-red-50 rounded-full transition-all",title:"Clear Canvas",children:x(Bt,{size:18})})]}),j("div",{className:"flex items-center gap-1 px-1 border-r border-zinc-200",children:[x("button",{onClick:t,className:"p-2 text-zinc-600 hover:text-zinc-900 hover:bg-zinc-100 rounded-full transition-all",title:"Export JSON",children:x(Wt,{size:18})}),x("button",{onClick:()=>{var h;return(h=n.current)==null?void 0:h.click()},className:"p-2 text-zinc-600 hover:text-zinc-900 hover:bg-zinc-100 rounded-full transition-all",title:"Import JSON",children:x(Gt,{size:18})})]}),j("div",{className:"flex items-center gap-1 px-1",children:[x("button",{className:"flex items-center gap-2 px-3 py-2 bg-emerald-500 text-white rounded-full font-medium text-sm hover:bg-emerald-600 shadow-md shadow-emerald-200 transition-all mr-1",onClick:a,disabled:p,children:p?x("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):x(Ft,{size:16,fill:"currentColor"})}),j("button",{className:"flex items-center gap-2 px-4 py-2 bg-indigo-600 text-white rounded-full font-medium text-sm hover:bg-indigo-700 shadow-md shadow-indigo-200 transition-all disabled:opacity-70 disabled:cursor-not-allowed",onClick:e,disabled:b,children:[b?x("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):x(Lt,{size:16}),x("span",{children:"Save"})]})]})]})}import{Settings2 as Ht,X as ge,AlertCircle as _t,Trash2 as qt,Import as Jt}from"lucide-react";import{useReactFlow as Vt}from"reactflow";function me(e){if(!e.trim().toLowerCase().startsWith("curl"))return null;let t="GET",r={},i,s="",d=e.replace(/\\\n/g," ").replace(/\n/g," "),a=d.match(/'(http[^']*)'|"(http[^"]*)"|(http\S+)/);a&&(s=a[1]||a[2]||a[3]);let b=d.match(/-X\s+([A-Z]+)/);b&&(t=b[1]);let p=/-H\s+['"]([^'"]+)['"]/g,o;for(;(o=p.exec(d))!==null;){let[g,l]=o[1].split(/:\s?(.+)/);g&&l&&(r[g]=l)}let m=d.match(/(-d|--data|--data-raw)\s+['"]([^'"]+)['"]/);return m&&(i=m[2],t==="GET"&&(t="POST")),{method:t,url:s,headers:r,body:i}}import{jsx as N,jsxs as P}from"react/jsx-runtime";function ye({selectedNodeId:e,selectedNodeType:t,onClose:r}){var l;let{setNodes:i,getNodes:s,deleteElements:d}=Vt();if(!e)return null;let a=s().find(n=>n.id===e);if(!a)return null;let b=((l=a.data)==null?void 0:l.type)||a.type||t,p=S[b],o=de(b);if(o){p=JSON.parse(JSON.stringify(p));let n=a.data.operation;if(n){let y=o.operations.find(h=>h.id===n);y&&(p.inputs=[...p.inputs,...y.inputs])}}if(!p)return P("div",{className:"absolute top-4 right-4 w-80 bg-white p-4 rounded shadow border border-red-200 z-50",children:[P("div",{className:"flex items-center justify-between text-red-600 mb-2",children:[P("div",{className:"flex items-center gap-2",children:[N(_t,{size:16}),N("span",{className:"font-bold",children:"Unknown Node Type"})]}),N("button",{onClick:r,children:N(ge,{size:16})})]}),P("p",{className:"text-xs text-zinc-500 mt-1",children:["ID: ",b]})]});let m=(n,y)=>{i(h=>h.map(v=>v.id===e?{...v,data:{...v.data,[n]:y}}:v))},g=()=>{d({nodes:[{id:e}]}),r()};return P("div",{className:"absolute top-4 right-4 bottom-4 w-80 bg-white/95 backdrop-blur-md border border-zinc-200 shadow-2xl rounded-xl z-50 flex flex-col overflow-hidden animate-in slide-in-from-right duration-200",children:[P("div",{className:"p-4 border-b border-zinc-100 flex items-center justify-between bg-zinc-50/50",children:[P("div",{className:"flex items-center gap-2 text-zinc-700 font-semibold",children:[N(Ht,{size:16}),P("span",{children:[p.label," Properties"]})]}),P("div",{className:"flex items-center gap-1",children:[b==="http-request"&&P("button",{onClick:()=>{let n=prompt("Paste your cURL command here:");if(n){let y=me(n);y?i(h=>h.map(v=>v.id===e?{...v,data:{...v.data,method:y.method,url:y.url,headers:JSON.stringify(y.headers,null,2),body:y.body||"{}"}}:v)):alert("Could not parse cURL command.")}},className:"p-1.5 text-indigo-500 hover:text-indigo-700 hover:bg-indigo-50 rounded-md transition-colors flex items-center gap-1 text-xs font-medium mr-1",title:"Import cURL",children:[N(Jt,{size:14}),N("span",{children:"Import cURL"})]}),N("button",{onClick:g,className:"p-1.5 text-red-400 hover:text-red-600 hover:bg-red-50 rounded-md transition-colors",title:"Delete Node",children:N(qt,{size:16})}),N("button",{onClick:r,className:"p-1.5 text-zinc-400 hover:text-zinc-700 hover:bg-zinc-100 rounded-md transition-colors",children:N(ge,{size:16})})]})]}),P("div",{className:"p-4 space-y-5 flex-1 overflow-y-auto",children:[P("div",{className:"space-y-1 pb-4 border-b border-zinc-100",children:[N("label",{className:"text-xs font-bold uppercase tracking-wider text-zinc-400",children:"Description"}),N("p",{className:"text-sm text-zinc-600",children:p.description})]}),p.inputs.map(n=>{var y;return P("div",{className:"space-y-2",children:[N("label",{className:"block text-xs font-bold uppercase tracking-wider text-zinc-500",children:n.label}),n.type==="text"&&N("input",{type:"text",value:a.data[n.key]||"",onChange:h=>m(n.key,h.target.value),placeholder:n.placeholder,className:"w-full px-3 py-2 bg-white border border-zinc-200 rounded-md text-sm text-zinc-800 focus:outline-none focus:ring-2 focus:ring-indigo-500/20 focus:border-indigo-500 transition-all"}),n.type==="select"&&P("select",{value:a.data[n.key]||"",onChange:h=>m(n.key,h.target.value),className:"w-full px-3 py-2 bg-white border border-zinc-200 rounded-md text-sm text-zinc-800 focus:outline-none focus:ring-2 focus:ring-indigo-500/20 focus:border-indigo-500 transition-all",children:[N("option",{value:"",disabled:!0,children:"Select..."}),(y=n.options)==null?void 0:y.map(h=>N("option",{value:h.value,children:h.label},h.value))]}),(n.type==="json"||n.type==="code")&&N("textarea",{value:typeof a.data[n.key]=="object"?JSON.stringify(a.data[n.key],null,2):a.data[n.key]||"",onChange:h=>m(n.key,h.target.value),rows:5,className:"w-full px-3 py-2 bg-white border border-zinc-200 rounded-md text-sm font-mono text-zinc-800 focus:outline-none focus:ring-2 focus:ring-indigo-500/20 focus:border-indigo-500 transition-all resize-y"})]},n.key)})]})]})}import{useState as $t,useMemo as Xt}from"react";import{Search as Kt,X as Yt,Zap as Q,Globe as Zt,MessageSquare as Qt,Split as eo,GitMerge as to,Clock as oo,Mail as ao}from"lucide-react";import{jsx as z,jsxs as M}from"react/jsx-runtime";var ro={Webhook:Q,Clock:oo,Globe:Zt,Mail:ao,MessageSquare:Qt,Split:eo,GitMerge:to,Zap:Q,..._};function he({isOpen:e,onClose:t,onSelect:r}){let[i,s]=$t(""),d=Xt(()=>{let a={};Object.values(S).forEach(o=>{if(o.label.toLowerCase().includes(i.toLowerCase())||o.description&&o.description.toLowerCase().includes(i.toLowerCase())){let g=o.category||"other";a[g]||(a[g]=[]),a[g].push(o)}});let b=["trigger","logic","action","utility","integration"],p={};return b.forEach(o=>{a[o]&&(p[o]=a[o])}),Object.keys(a).forEach(o=>{b.includes(o)||(p[o]=a[o])}),p},[i]);return e?M("div",{className:"absolute inset-0 z-[100] bg-black/20 backdrop-blur-sm flex items-start justify-center pt-20 animate-in fade-in duration-200",children:[M("div",{className:"w-[600px] bg-white rounded-xl shadow-2xl border border-zinc-200 overflow-hidden flex flex-col max-h-[70vh] animate-in slide-in-from-bottom-4 duration-300",children:[M("div",{className:"p-4 border-b border-zinc-100 flex items-center gap-3 bg-zinc-50/50",children:[z(Kt,{className:"text-zinc-400",size:20}),z("input",{autoFocus:!0,type:"text",placeholder:"Search nodes...",className:"flex-1 bg-transparent border-none outline-none text-zinc-900 placeholder:text-zinc-400 text-lg",value:i,onChange:a=>s(a.target.value)}),z("div",{className:"px-2 py-1 bg-zinc-100 border border-zinc-200 rounded text-xs text-zinc-500 font-medium",children:"ESC"}),z("button",{onClick:t,className:"text-zinc-400 hover:text-zinc-700",children:z(Yt,{size:20})})]}),M("div",{className:"overflow-y-auto p-4 space-y-2",children:[Object.entries(d).map(([a,b])=>{if(b.length===0)return null;let p=i.length>0;return M("details",{open:!0,className:"group border border-zinc-200 rounded-lg bg-zinc-50/30 open:bg-white transition-all duration-200",children:[M("summary",{className:"flex items-center justify-between p-3 cursor-pointer list-none text-zinc-600 font-medium hover:bg-zinc-50 select-none",children:[M("div",{className:"flex items-center gap-2",children:[z("span",{className:"uppercase tracking-wider text-xs font-bold text-zinc-500",children:a}),z("span",{className:"text-xs bg-zinc-100 text-zinc-400 px-1.5 py-0.5 rounded-full",children:b.length})]}),z("div",{className:"text-zinc-400 group-open:rotate-180 transition-transform",children:z("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:z("path",{d:"m6 9 6 6 6-6"})})})]}),z("div",{className:"p-3 pt-0 border-t border-transparent group-open:border-zinc-100",children:z("div",{className:"grid grid-cols-2 gap-3 pt-2",children:b.map(o=>{let m=ro[o.icon]||_[o.icon]||Q;return M("button",{onClick:()=>r(o.type),className:"flex items-start gap-3 p-3 rounded-lg border border-zinc-100 bg-white hover:border-indigo-200 hover:shadow-md hover:bg-indigo-50/30 transition-all text-left group/btn",children:[z("div",{className:O("p-2 rounded-md transition-colors",`bg-${o.color}-50 text-${o.color}-600 group-hover/btn:bg-white`),children:z(m,{size:20})}),M("div",{children:[z("div",{className:"font-semibold text-zinc-900 text-sm",children:o.label}),z("div",{className:"text-xs text-zinc-500 line-clamp-2 leading-relaxed",children:o.description})]})]},o.type)})})})]},a)}),Object.values(d).every(a=>a.length===0)&&z("div",{className:"text-center py-12 text-zinc-400",children:M("p",{children:['No nodes found matching "',i,'"']})})]})]}),z("div",{className:"absolute inset-0 -z-10",onClick:t})]}):null}import{useEffect as io,useState as no}from"react";import{CheckCircle2 as so,AlertCircle as lo,X as co}from"lucide-react";import{jsx as q,jsxs as po}from"react/jsx-runtime";function fe({message:e,type:t,isVisible:r,onClose:i}){let[s,d]=no(!1);return io(()=>{if(r){d(!0);let a=setTimeout(()=>{i()},4e3);return()=>clearTimeout(a)}else setTimeout(()=>d(!1),300)},[r,i]),!s&&!r?null:po("div",{className:O("absolute bottom-6 left-1/2 -translate-x-1/2 z-[100] flex items-center gap-3 px-4 py-3 rounded-lg shadow-xl border transition-all duration-300 transform",t==="success"?"bg-white border-emerald-100 text-emerald-800":"bg-white border-red-100 text-red-800",r?"translate-y-0 opacity-100 scale-100":"translate-y-4 opacity-0 scale-95"),children:[t==="success"?q(so,{size:20,className:"text-emerald-500"}):q(lo,{size:20,className:"text-red-500"}),q("span",{className:"font-medium text-sm",children:e}),q("button",{onClick:i,className:"ml-2 hover:opacity-70",children:q(co,{size:16,className:"text-zinc-400"})})]})}import{ReactFlowProvider as No}from"reactflow";import we from"dagre";import{Position as X}from"reactflow";var H=new we.graphlib.Graph;H.setDefaultEdgeLabel(()=>({}));var xe=240,ve=150,ke=(e,t,r="LR")=>{let i=r==="LR";return H.setGraph({rankdir:r}),e.forEach(d=>{H.setNode(d.id,{width:xe,height:ve})}),t.forEach(d=>{H.setEdge(d.source,d.target)}),we.layout(H),{nodes:e.map(d=>{let a=H.node(d.id);return d.targetPosition=i?X.Left:X.Top,d.sourcePosition=i?X.Right:X.Bottom,d.position={x:a.x-xe/2,y:a.y-ve/2},d}),edges:t}};import{useState as Ne,useCallback as ee}from"react";function ze(e,t,r,i){let[s,d]=Ne([{nodes:e,edges:t}]),[a,b]=Ne(0),p=ee((g,l)=>{d(n=>{let y=n.slice(0,a+1);return y.push({nodes:g,edges:l}),y.length>50&&y.shift(),y}),b(n=>Math.min(n+1,50))},[a]),o=ee(()=>{if(a>0){let g=a-1,l=s[g];r(l.nodes),i(l.edges),b(g)}},[a,s,r,i]),m=ee(()=>{if(a<s.length-1){let g=a+1,l=s[g];r(l.nodes),i(l.edges),b(g)}},[a,s,r,i]);return{takeSnapshot:p,undo:o,redo:m,canUndo:a>0,canRedo:a<s.length-1}}function Ce(e,t){let r=[];if(e.length===0)return r.push({nodeId:"root",message:"Workflow is empty",severity:"warning"}),r;let i=new Set;return t.forEach(s=>{i.add(s.source),i.add(s.target)}),e.forEach(s=>{!i.has(s.id)&&e.length>1&&r.push({nodeId:s.id,message:"Node is disconnected",severity:"warning"}),s.type&&S[s.type],s.type==="http-request"&&(s.data.url||r.push({nodeId:s.id,field:"url",message:"URL is required",severity:"error"})),s.type}),r}import{jsx as C,jsxs as J}from"react/jsx-runtime";var Se=[{id:"1",type:"webhook",position:{x:100,y:100},data:{method:"POST",path:"/start"}},{id:"2",type:"http-request",position:{x:100,y:300},data:{method:"POST",url:"https://api.example.com/data"}},{id:"3",type:"slack",position:{x:400,y:200},data:{message:"Workflow completed",webhookUrl:"https://hooks.slack.com/..."}}],Te=[{id:"e1-2",source:"1",target:"2",type:"smoothstep",animated:!0,style:{stroke:"#6366f1",strokeWidth:2}},{id:"e2-3",source:"2",target:"3",type:"smoothstep",animated:!0,style:{stroke:"#6366f1",strokeWidth:2}}],Pe=e=>C(No,{children:C(zo,{...e})}),zo=({licenseKey:e,apiConfig:t,className:r,style:i})=>{let[s,d]=U(null),[a,b]=U(""),[p]=U(()=>new ae({licenseKey:e,widgetVersion:"1.0.0",validationEndpoint:"http://localhost:3000/api/v1/license/validate"})),[o,m,g]=xo(Se),[l,n,y]=vo(Te),[h,v]=U(!1),[B,oe]=U(!1),[G,D]=U(null),{takeSnapshot:E,undo:Ie,redo:Oe,canUndo:Me,canRedo:Le}=ze(Se,Te,u=>m([...u]),u=>n([...u])),Eo=W(()=>{E(o,l)},[o,l,E]),[Ue,V]=U(null),De=bo(()=>{let u={custom:Z};return Object.keys(S).forEach(c=>{u[c]=Z}),u},[]);uo(()=>{async function u(){let c=await p.validate();d(c.valid),c.valid||b(c.reason||"Invalid License")}u()},[p]);let Ae=W(u=>{n(c=>{let f=wo({...u,type:"smoothstep",animated:!0,style:{stroke:"#6366f1",strokeWidth:2}},c);return E(o,f),f})},[n,o,E]),We=W((u,c)=>{V(c.id)},[]),Ge=W(()=>{V(null)},[]),je=mo(null),[L,Be]=U(null),[Fe,K]=U(!1),He=W(u=>{let c=`node-${Date.now()}`,f={x:250,y:250};L&&(f={x:100+Math.random()*200,y:100+Math.random()*200});let w={id:c,type:u,position:f,data:{}},k=o.concat(w);m(k),E(k,l),K(!1),V(c)},[L,o,l,E,m]),_e=W(()=>{let{nodes:u,edges:c}=ke(o,l);m([...u]),n([...c]),E([...u],[...c]),setTimeout(()=>L==null?void 0:L.fitView(),100)},[o,l,m,n,E,L]),qe=W(()=>{confirm("Are you sure you want to clear the canvas?")&&(m([]),n([]),E([],[]))},[m,n,E]),Je=W(async()=>{if(B)return;oe(!0),D(null);let u=o.map(f=>({...f,data:{...f.data,executionStatus:void 0}}));m(u);let c=(f,w)=>{m(k=>k.map(I=>I.id===f?{...I,data:{...I.data,executionStatus:w}}:I))};try{let f={};l.forEach(k=>{f[k.source]||(f[k.source]=[]),f[k.source].push(k.target)});let w=o.filter(k=>["webhook","schedule","connector"].includes(k.type||"")||l.every(I=>I.target!==k.id)).map(k=>k.id);if(w.length===0&&o.length>0&&w.push(o[0].id),w.length===0)throw new Error("No start node found");for(let k of w){c(k,"running"),await new Promise(F=>setTimeout(F,800)),c(k,"success");let I=f[k]||[];for(let F of I)c(F,"running"),await new Promise(Ke=>setTimeout(Ke,800)),c(F,"success")}D({message:"Execution completed successfully",type:"success"})}catch(f){D({message:f.message||"Execution Success",type:"success"})}finally{oe(!1)}},[o,l,B,m]),Ve=async()=>{let u=Ce(o,l),c=u.filter(F=>F.severity==="error");if(c.length>0){D({message:`Cannot save: ${c[0].message}`,type:"error"});return}u.length>0&&D({message:`Saved with warnings: ${u[0].message}`,type:"success"}),v(!0);let f=new re(t),w={nodes:o,edges:l},I=!!await f.createWorkflow(w);v(!1),D(I?{message:"Workflow saved successfully",type:"success"}:{message:"Failed to save workflow",type:"error"})},$e=()=>{let u=ne(o,l),c=new Blob([u],{type:"application/json"}),f=URL.createObjectURL(c),w=document.createElement("a");w.href=f,w.download=`workflow-${Date.now()}.json`,document.body.appendChild(w),w.click(),document.body.removeChild(w)},Xe=async u=>{try{let c=await u.text(),{nodes:f,edges:w}=se(c);m(f),n(w),E(f,w),setTimeout(()=>{L==null||L.fitView({padding:.2})},50)}catch(c){alert("Failed to import workflow. Invalid file."),console.error(c)}};return s===null?C("div",{className:"flex items-center justify-center h-[600px] w-full bg-zinc-50 rounded-xl border border-zinc-200",children:J("div",{className:"flex flex-col items-center gap-3",children:[C("div",{className:"w-6 h-6 border-2 border-indigo-600 border-t-transparent rounded-full animate-spin"}),C("p",{className:"text-zinc-500 text-sm font-medium",children:"Verifying License..."})]})}):J("div",{style:i,className:`relative w-full h-[800px] rounded-xl border border-zinc-200 shadow-sm overflow-hidden bg-zinc-50/50 group ${r||""}`,children:[!s&&J("div",{className:"absolute inset-0 z-50 bg-white/80 backdrop-blur-md flex flex-col items-center justify-center p-8 text-center",children:[C("div",{className:"w-16 h-16 bg-red-100 rounded-full flex items-center justify-center mb-4",children:C("div",{className:"w-8 h-8 text-red-600",children:"\u26A0\uFE0F"})}),C("h2",{className:"text-2xl font-bold text-zinc-900 mb-2",children:"License Verification Failed"}),J("p",{className:"text-zinc-600 max-w-md",children:[a,". Please update your license key to access the builder."]})]}),C(be,{onSave:Ve,onExport:$e,onImport:Xe,onAddNode:()=>K(!0),onAutoLayout:_e,onClear:qe,onRun:Je,isSaving:h,isRunning:B,canUndo:Me,canRedo:Le,onUndo:Ie,onRedo:Oe}),C(ye,{selectedNodeId:Ue||void 0,onClose:()=>V(null)}),C(he,{isOpen:Fe,onClose:()=>K(!1),onSelect:He}),C(fe,{message:(G==null?void 0:G.message)||"",type:(G==null?void 0:G.type)||"success",isVisible:!!G,onClose:()=>D(null)}),C("div",{className:"w-full h-full",ref:je,children:J(go,{nodes:o,edges:l,onNodesChange:g,onEdgesChange:y,onConnect:Ae,onNodeClick:We,onPaneClick:Ge,onInit:Be,nodeTypes:De,fitView:!0,className:"bg-zinc-50",children:[C(yo,{variant:ko.Dots,gap:20,size:1,color:"#94a3b8",className:"bg-slate-50"}),C(ho,{className:"!bg-white !border-slate-200 !shadow-xl !rounded-lg overflow-hidden [&>button]:!border-b-slate-100 [&>button]:!text-slate-600 hover:[&>button]:!bg-indigo-50 hover:[&>button]:!text-indigo-600 transition-colors"}),C(fo,{className:"!bg-white !border-slate-200 !shadow-xl !rounded-lg !mb-8 !mr-8",maskColor:"rgba(241, 245, 249, 0.7)",nodeColor:u=>{var c;return(c=u.type)!=null&&c.includes("trigger")||u.type==="webhook"?"#818cf8":u.type==="action"?"#34d399":"#cbd5e1"},zoomable:!0,pannable:!0})]})})]})};import{jsx as Co}from"react/jsx-runtime";function Re(e){return Co(Pe,{...e})}import{useState as Ee}from"react";import{Settings as So,X as To,Maximize2 as Po,Minimize2 as Ro}from"lucide-react";import{jsx as R,jsxs as te}from"react/jsx-runtime";function mr({licenseKey:e,apiConfig:t,position:r="bottom-right",themeColor:i="#2563eb"}){let[s,d]=Ee(!1),[a,b]=Ee(!1),p=()=>d(!s),o=()=>b(!a),m={position:"fixed",bottom:"20px",[r==="bottom-right"?"right":"left"]:"20px",zIndex:9999,display:"flex",flexDirection:"column",alignItems:r==="bottom-right"?"flex-end":"flex-start",gap:"10px"},g=a?{position:"fixed",top:0,left:0,width:"100vw",height:"100vh",backgroundColor:"white",zIndex:1e4,boxShadow:"0 0 20px rgba(0,0,0,0.2)",display:"flex",flexDirection:"column"}:{width:"800px",height:"600px",backgroundColor:"white",borderRadius:"12px",boxShadow:"0 4px 20px rgba(0,0,0,0.15)",border:"1px solid #e5e7eb",display:"flex",flexDirection:"column",overflow:"hidden"};return s?R("div",{style:a?{position:"fixed",top:0,left:0,zIndex:1e4}:m,children:te("div",{style:g,children:[te("div",{style:{padding:"12px 16px",borderBottom:"1px solid #eee",display:"flex",justifyContent:"space-between",alignItems:"center",backgroundColor:"#f9fafb",color:"black"},children:[R("h3",{style:{margin:0,fontSize:"16px",fontWeight:600},children:"Workflow Builder"}),te("div",{style:{display:"flex",gap:"8px"},children:[R("button",{onClick:o,style:{background:"none",border:"none",cursor:"pointer",padding:4},children:a?R(Ro,{size:18}):R(Po,{size:18})}),R("button",{onClick:p,style:{background:"none",border:"none",cursor:"pointer",padding:4},children:R(To,{size:18})})]})]}),R("div",{style:{flex:1,position:"relative"},children:R(Re,{licenseKey:e,apiConfig:t})})]})}):R("div",{style:m,children:R("button",{onClick:p,style:{width:"60px",height:"60px",borderRadius:"50%",backgroundColor:i,color:"white",border:"none",cursor:"pointer",boxShadow:"0 4px 12px rgba(0,0,0,0.2)",display:"flex",alignItems:"center",justifyContent:"center",transition:"transform 0.2s"},onMouseEnter:l=>l.currentTarget.style.transform="scale(1.05)",onMouseLeave:l=>l.currentTarget.style.transform="scale(1)",children:R(So,{size:28})})})}export{re as ApiClient,mr as EmbeddableWidget,ae as LicenseManager,Pe as WorkflowBuilder,ie as WorkflowSerializer,Re as WorkflowWidget,le as createConnectorNode,se as deserialize,de as getConnectorDetails,S as nodeRegistry,Io as registerConnector,ne as serialize,Y as standardConnectors};
|
|
1
|
+
import{useEffect as bo,useState as U,useCallback as W,useMemo as mo,useRef as go}from"react";import yo,{Background as ho,Controls as fo,MiniMap as xo,useNodesState as vo,useEdgesState as wo,addEdge as ko,BackgroundVariant as No}from"reactflow";import"reactflow/dist/style.css";var Ze=typeof process!="undefined"&&process.env.NEXT_PUBLIC_LICENSE_VALIDATION_URL||"http://localhost:3000/api/v1/license/validate",re=class{constructor(e){this.config=e,this.validationResult=null}async validate(){if(this.validationResult)return this.validationResult;try{let e=this.config.validationEndpoint||Ze,t=await(await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({licenseKey:this.config.licenseKey,widgetVersion:this.config.widgetVersion,originUrl:typeof window!="undefined"?window.location.origin:""})})).json();return this.validationResult=t,t}catch(e){return console.error("License validation failed",e),{valid:!1,reason:"Network Error"}}}isFeatureEnabled(e){var t,a;return(t=this.validationResult)!=null&&t.valid?!!((a=this.validationResult.features)!=null&&a[e]):!1}},ie=class{constructor(e){this.config=e}async request(e,t,a){let r={"Content-Type":"application/json",...this.config.headers},s=await fetch(e,{method:t,headers:r,body:a?JSON.stringify(a):void 0});if(!s.ok)throw new Error(`API Request failed: ${s.statusText}`);return s.json()}async getWorkflow(e){let t=`${this.config.baseUrl}${this.config.endpoints.get.replace(":id",e)}`;return this.request(t,"GET")}async createWorkflow(e){let t=`${this.config.baseUrl}${this.config.endpoints.create}`;return this.request(t,"POST",e)}async updateWorkflow(e,t){let a=`${this.config.baseUrl}${this.config.endpoints.update.replace(":id",e)}`;return this.request(a,"PUT",t)}},ne=class{static serialize(e,t,a){return JSON.stringify({nodes:e,edges:t,viewport:a})}static deserialize(e){try{let t=JSON.parse(e);return{nodes:t.nodes||[],edges:t.edges||[],viewport:t.viewport}}catch{return{nodes:[],edges:[]}}}},se=ne.serialize,le=ne.deserialize;function de(e){return{type:e.id,label:e.label,description:`Integration with ${e.label}`,category:e.category,icon:e.icon,color:e.color,handles:[{id:"in",type:"target"},{id:"out",type:"source"}],inputs:[{key:"auth_token",label:"API Key / Token",type:"text",placeholder:e.auth.placeholder||"Enter API Key"},{key:"operation",label:"Action",type:"select",options:e.operations.map(t=>({label:t.label,value:t.id}))}]}}var Z=[{id:"google-sheets",label:"Google Sheets",category:"utility",icon:"Sheet",color:"emerald",baseUrl:"https://sheets.googleapis.com/v4/spreadsheets",auth:{type:"bearer",placeholder:"OAuth Token"},operations:[{id:"append_row",label:"Append Row",method:"POST",path:"/{spreadsheetId}/values/{range}:append",inputs:[{key:"spreadsheetId",label:"Spreadsheet ID",type:"text"},{key:"range",label:"Range (Sheet1!A1)",type:"text"},{key:"values",label:"Row Values (JSON Array)",type:"json"}]},{id:"get_values",label:"Get Row(s)",method:"GET",path:"/{spreadsheetId}/values/{range}",inputs:[{key:"spreadsheetId",label:"Spreadsheet ID",type:"text"},{key:"range",label:"Range",type:"text"}]}]},{id:"slack-connector",label:"Slack API",category:"action",icon:"MessageSquare",color:"blue",baseUrl:"https://slack.com/api",auth:{type:"bearer",placeholder:"xoxb-..."},operations:[{id:"post_message",label:"Post Message",method:"POST",path:"/chat.postMessage",inputs:[{key:"channel",label:"Channel ID",type:"text"},{key:"text",label:"Message Text",type:"text"}]}]},{id:"openai",label:"OpenAI",category:"action",icon:"Bot",color:"zinc",baseUrl:"https://api.openai.com/v1",auth:{type:"bearer",placeholder:"sk-..."},operations:[{id:"chat_completion",label:"Chat Completion",method:"POST",path:"/chat/completions",inputs:[{key:"model",label:"Model",type:"select",options:[{label:"GPT-4o",value:"gpt-4o"},{label:"GPT-3.5",value:"gpt-3.5-turbo"}]},{key:"messages",label:"Messages (JSON)",type:"json"}]}]}];function Oo(e){Z.push(e)}var Qe=[{id:"triggers",nodes:[{type:"manual-trigger",label:"Manual Trigger",description:"Start flow on button click",category:"trigger",icon:"Play",color:"emerald",inputs:[]},{type:"cron-trigger",label:"Cron Schedule",description:"Trigger on a schedule",category:"trigger",icon:"Clock",color:"emerald",inputs:[{key:"expression",label:"Cron Expression",type:"text",placeholder:"0 9 * * 1 (Every Mon at 9am)"}]},{id:"github-trigger",label:"GitHub Trigger",category:"trigger",icon:"Github",color:"zinc",baseUrl:"https://api.github.com",auth:{type:"header",key:"X-GitHub-Token"},operations:[{id:"on_push",label:"On Push",method:"POST",path:"/repos/{owner}/{repo}/hooks",inputs:[{key:"owner",label:"Owner",type:"text"},{key:"repo",label:"Repository",type:"text"}]},{id:"on_star",label:"On New Star",method:"POST",path:"/repos/{owner}/{repo}/hooks",inputs:[{key:"owner",label:"Owner",type:"text"},{key:"repo",label:"Repository",type:"text"}]}]}]},{id:"logic",nodes:[{type:"switch",label:"Switch / Router",description:"Route based on value",category:"logic",icon:"GitFork",color:"orange",inputs:[{key:"property",label:"Property to Check",type:"text"},{key:"cases",label:"Cases (comma sep)",type:"text",placeholder:"marketing, sales, support"}]},{type:"ab-split",label:"A/B Split",description:"Randomly split traffic",category:"logic",icon:"Percent",color:"orange",inputs:[{key:"percentA",label:"Percentage for A",type:"text",placeholder:"50"}]},{type:"wait",label:"Wait / Delay",description:"Pause execution",category:"logic",icon:"Timer",color:"orange",inputs:[{key:"duration",label:"Duration",type:"text",placeholder:"5000"},{key:"unit",label:"Unit",type:"select",options:[{label:"Milliseconds",value:"ms"},{label:"Seconds",value:"s"}]}]}]},{id:"utilities",nodes:[{type:"text-transform",label:"Text Transform",description:"Modify text strings",category:"utility",icon:"Type",color:"zinc",inputs:[{key:"action",label:"Action",type:"select",options:[{label:"To Upper Case",value:"upper"},{label:"To Lower Case",value:"lower"},{label:"Trim",value:"trim"},{label:"Replace",value:"replace"}]},{key:"input",label:"Input Text",type:"text"}]},{type:"json-parser",label:"JSON Helper",description:"Parse or stringify JSON",category:"utility",icon:"Code",color:"zinc",inputs:[{key:"action",label:"Action",type:"select",options:[{label:"Parse (String to JSON)",value:"parse"},{label:"Stringify (JSON to String)",value:"stringify"}]},{key:"data",label:"Data",type:"json"}]},{type:"math-calc",label:"Math Calculator",description:"Perform calculations",category:"utility",icon:"Calculator",color:"zinc",inputs:[{key:"operation",label:"Operation",type:"select",options:[{label:"Add",value:"add"},{label:"Subtract",value:"sub"},{label:"Multiply",value:"mul"},{label:"Divide",value:"div"},{label:"Random Number",value:"random"}]},{key:"a",label:"Value A",type:"text"},{key:"b",label:"Value B",type:"text"}]},{type:"crypto",label:"Cryptography",description:"Hash or Encrypt data",category:"utility",icon:"Lock",color:"zinc",inputs:[{key:"algo",label:"Algorithm",type:"select",options:[{label:"MD5",value:"md5"},{label:"SHA-256",value:"sha256"},{label:"Base64 Encode",value:"base64_enc"},{label:"Base64 Decode",value:"base64_dec"}]},{key:"input",label:"value",type:"text"}]},{type:"date-time",label:"Date & Time",description:"Format or manipulate dates",category:"utility",icon:"Calendar",color:"zinc",inputs:[{key:"operation",label:"Action",type:"select",options:[{label:"Now (ISO)",value:"now"},{label:"Format Date",value:"format"},{label:"Add Time",value:"add"}]},{key:"date",label:"Date String",type:"text"},{key:"format",label:"Format Pattern",type:"text",placeholder:"YYYY-MM-DD"}]}]},{id:"integrations-productivity",nodes:[{id:"google-drive",label:"Google Drive",icon:"HardDrive",color:"blue",category:"action",baseUrl:"https://www.googleapis.com/drive/v3",auth:{type:"bearer",placeholder:"OAuth Token"},operations:[{id:"list",label:"List Files",method:"GET",path:"/files",inputs:[{key:"q",label:"Query",type:"text"}]},{id:"upload",label:"Upload File",method:"POST",path:"/files",inputs:[{key:"name",label:"Name",type:"text"},{key:"content",label:"Content",type:"text"}]}]},{id:"notion",label:"Notion",icon:"FileText",color:"zinc",category:"action",baseUrl:"https://api.notion.com/v1",auth:{type:"header",key:"Authorization",placeholder:"Bearer secret_..."},operations:[{id:"create_page",label:"Create Page",method:"POST",path:"/pages",inputs:[{key:"parent_id",label:"Parent DB ID",type:"text"},{key:"properties",label:"Properties JSON",type:"json"}]},{id:"query_db",label:"Query Database",method:"POST",path:"/databases/{id}/query",inputs:[{key:"id",label:"Database ID",type:"text"}]}]},{id:"airtable",label:"Airtable",icon:"Database",color:"amber",category:"action",baseUrl:"https://api.airtable.com/v0",auth:{type:"bearer",placeholder:"pat_..."},operations:[{id:"create_record",label:"Create Record",method:"POST",path:"/{baseId}/{tableId}",inputs:[{key:"baseId",label:"Base ID",type:"text"},{key:"tableId",label:"Table Name",type:"text"},{key:"fields",label:"Fields JSON",type:"json"}]},{id:"list_records",label:"List Records",method:"GET",path:"/{baseId}/{tableId}",inputs:[{key:"baseId",label:"Base ID",type:"text"},{key:"tableId",label:"Table Name",type:"text"}]}]}]},{id:"integrations-crm-marketing",nodes:[{id:"salesforce",label:"Salesforce",icon:"Cloud",color:"blue",category:"action",baseUrl:"https://{instance}.salesforce.com/services/data/vXX.X",auth:{type:"bearer"},operations:[{id:"create_lead",label:"Create Lead",method:"POST",path:"/sobjects/Lead",inputs:[{key:"instance",label:"Instance URL",type:"text"},{key:"LastName",label:"Last Name",type:"text"},{key:"Company",label:"Company",type:"text"}]}]},{id:"hubspot",label:"HubSpot",icon:"Users",color:"orange",category:"action",baseUrl:"https://api.hubapi.com",auth:{type:"bearer"},operations:[{id:"create_contact",label:"Create Contact",method:"POST",path:"/crm/v3/objects/contacts",inputs:[{key:"properties",label:"Properties JSON",type:"json"}]}]},{id:"mailchimp",label:"Mailchimp",icon:"Mail",color:"yellow",category:"action",baseUrl:"https://{dc}.api.mailchimp.com/3.0",auth:{type:"bearer"},operations:[{id:"add_member",label:"Add Subscriber",method:"POST",path:"/lists/{list_id}/members",inputs:[{key:"dc",label:"Data Center (usX)",type:"text"},{key:"list_id",label:"List ID",type:"text"},{key:"email_address",label:"Email",type:"text"},{key:"status",label:"Status",type:"select",options:[{label:"subscribed",value:"subscribed"}]}]}]}]},{id:"integrations-commerce",nodes:[{id:"shopify",label:"Shopify",icon:"ShoppingBag",color:"emerald",category:"action",baseUrl:"https://{shop}.myshopify.com/admin/api/2023-10",auth:{type:"header",key:"X-Shopify-Access-Token"},operations:[{id:"get_products",label:"Get Products",method:"GET",path:"/products.json",inputs:[{key:"shop",label:"Shop Name",type:"text"}]},{id:"create_order",label:"Create Order",method:"POST",path:"/orders.json",inputs:[{key:"shop",label:"Shop Name",type:"text"},{key:"order",label:"Order JSON",type:"json"}]}]},{id:"stripe",label:"Stripe",icon:"CreditCard",color:"indigo",category:"action",baseUrl:"https://api.stripe.com/v1",auth:{type:"bearer"},operations:[{id:"create_customer",label:"Create Customer",method:"POST",path:"/customers",inputs:[{key:"email",label:"Email",type:"text"}]},{id:"list_charges",label:"List Charges",method:"GET",path:"/charges",inputs:[{key:"limit",label:"Limit",type:"text"}]}]}]}];function et(){Qe.forEach(e=>{e.nodes.forEach(t=>{if(t.operations){let a={id:t.id,label:t.label,category:t.category,icon:t.icon,color:t.color,baseUrl:t.baseUrl,auth:t.auth,operations:t.operations};S[a.id]=de(a)}else{let a={type:t.type,label:t.label,description:t.description,category:t.category,icon:t.icon,color:t.color,handles:t.handles||[{id:"in",type:"target"},{id:"out",type:"source"}],inputs:t.inputs};S[a.type]=a}})})}var S={webhook:{type:"webhook",label:"Webhook",description:"Triggers when a URL is called",category:"trigger",icon:"Webhook",color:"emerald",handles:[{id:"out",type:"source"}],inputs:[{key:"method",label:"HTTP Method",type:"select",options:[{label:"GET",value:"GET"},{label:"POST",value:"POST"}]},{key:"path",label:"Path",type:"text",placeholder:"/webhook/..."}]},schedule:{type:"schedule",label:"Schedule",description:"Triggers on a specific interval",category:"trigger",icon:"Clock",color:"emerald",handles:[{id:"out",type:"source"}],inputs:[{key:"interval",label:"Interval",type:"select",options:[{label:"Every Minute",value:"1m"},{label:"Every Hour",value:"1h"},{label:"Every Day",value:"1d"}]},{key:"cron",label:"Cron Expression",type:"text",placeholder:"* * * * *"}]},"http-request":{type:"http-request",label:"HTTP Request",description:"Make an external API call",category:"action",icon:"Globe",color:"blue",handles:[{id:"in",type:"target"},{id:"out",type:"source"}],inputs:[{key:"url",label:"URL",type:"text",placeholder:"https://api.example.com"},{key:"method",label:"Method",type:"select",options:[{label:"GET",value:"GET"},{label:"POST",value:"POST"},{label:"PUT",value:"PUT"},{label:"DELETE",value:"DELETE"}]},{key:"headers",label:"Headers",type:"json"},{key:"body",label:"Body",type:"json"}]},email:{type:"email",label:"Send Email",description:"Send an email to a recipient",category:"action",icon:"Mail",color:"blue",handles:[{id:"in",type:"target"},{id:"out",type:"source"}],inputs:[{key:"to",label:"To",type:"text"},{key:"subject",label:"Subject",type:"text"},{key:"body",label:"Body",type:"text"}]},slack:{type:"slack",label:"Slack (Simple)",description:"Send a message to a channel",category:"action",icon:"MessageSquare",color:"blue",handles:[{id:"in",type:"target"},{id:"out",type:"source"}],inputs:[{key:"webhookUrl",label:"Webhook URL",type:"text"},{key:"message",label:"Message",type:"text"}]},"if-else":{type:"if-else",label:"If / Else",description:"Branch flow based on condition",category:"logic",icon:"Split",color:"orange",handles:[{id:"in",type:"target"},{id:"true",type:"source",label:"True"},{id:"false",type:"source",label:"False"}],inputs:[{key:"condition",label:"Condition",type:"code",description:"Javascript expression returning true/false"}]},merge:{type:"merge",label:"Merge",description:"Combine multiple branches",category:"logic",icon:"GitMerge",color:"orange",handles:[{id:"in-a",type:"target",label:"A"},{id:"in-b",type:"target",label:"B"},{id:"out",type:"source"}],inputs:[]}};Z.forEach(e=>{S[e.id]=de(e)});et();function ce(e){return Z.find(t=>t.id===e)}import{memo as kt}from"react";import{Handle as Nt,Position as $}from"reactflow";import{Webhook as zt,Clock as Ct,Globe as St,Mail as Tt,MessageSquare as Pt,Split as Et,GitMerge as Rt,MoreHorizontal as It,Zap as be}from"lucide-react";import{clsx as tt}from"clsx";import{twMerge as ot}from"tailwind-merge";function O(...e){return ot(tt(e))}import{Sheet as at,Bot as rt,Type as it,Code as nt,Calculator as st,Timer as lt,GitFork as dt,Percent as ct,HardDrive as pt,Calendar as ut,Play as bt,Github as mt,Lock as gt,FileText as yt,Database as ht,Cloud as ft,Users as xt,ShoppingBag as vt,CreditCard as wt}from"lucide-react";var H={Sheet:at,Bot:rt,Type:it,Code:nt,Calculator:st,Timer:lt,GitFork:dt,Percent:ct,HardDrive:pt,Calendar:ut,Play:bt,Github:mt,Lock:gt,FileText:yt,Database:ht,Cloud:ft,Users:xt,ShoppingBag:vt,CreditCard:wt};import{jsx as T,jsxs as A}from"react/jsx-runtime";var Ot={Webhook:zt,Clock:Ct,Globe:St,Mail:Tt,MessageSquare:Pt,Split:Et,GitMerge:Rt,Zap:be,...H},pe={emerald:"text-emerald-600 bg-emerald-50 border-emerald-200",blue:"text-blue-600 bg-blue-50 border-blue-200",orange:"text-orange-600 bg-orange-50 border-orange-200",zinc:"text-zinc-600 bg-zinc-50 border-zinc-200"},ue={emerald:"ring-emerald-500/20",blue:"ring-blue-500/20",orange:"ring-orange-500/20",zinc:"ring-zinc-500/20"},Q=kt(({data:e,selected:t,type:a})=>{let r=S[e.type||a]||S.webhook;if(!r)return A("div",{className:"p-2 border border-red-500 rounded bg-red-50 text-red-600",children:["Unknown Node Type: ",a]});let s=Ot[r.icon]||be,d=pe[r.color]||pe.zinc,o=ue[r.color]||ue.zinc,g=e.executionStatus,b="";return g==="running"?b="ring-4 ring-indigo-500/30 border-indigo-500 shadow-lg shadow-indigo-200 animate-pulse":g==="success"?b="ring-4 ring-emerald-500/40 border-emerald-500 shadow-lg shadow-emerald-200":g==="error"&&(b="ring-4 ring-red-500/40 border-red-500 shadow-lg shadow-red-200"),A("div",{className:O("min-w-[240px] bg-white rounded-lg shadow-sm border-2 transition-all duration-300",t?`border-indigo-500 shadow-xl ring-2 ${o}`:"border-zinc-200 hover:border-zinc-300",b),children:[A("div",{className:O("flex items-center justify-between p-3 border-b border-zinc-100/50 rounded-t-md bg-zinc-50/50"),children:[A("div",{className:"flex items-center gap-3",children:[T("div",{className:O("p-1.5 rounded-md border shadow-sm",d),children:T(s,{size:16,strokeWidth:2.5})}),A("div",{children:[T("span",{className:"block text-xs font-bold uppercase tracking-wider text-zinc-500",children:r.category}),T("span",{className:"block text-sm font-semibold text-zinc-900 leading-none mt-0.5",children:r.label})]})]}),T("button",{className:"text-zinc-400 hover:text-zinc-600 transition-colors",children:T(It,{size:16})})]}),A("div",{className:"p-4 bg-white rounded-b-lg",children:[r.type==="http-request"&&A("div",{className:"flex items-center gap-2 font-mono text-xs text-zinc-600 bg-zinc-50 p-2 rounded border border-zinc-100",children:[T("span",{className:"font-bold text-blue-600",children:e.method||"GET"}),T("span",{className:"truncate max-w-[140px]",children:e.url||"https://..."})]}),r.type==="webhook"&&A("div",{className:"flex items-center gap-2 font-mono text-xs text-zinc-600",children:[T("span",{className:"font-bold text-emerald-600",children:e.method||"POST"}),T("span",{children:e.path||"/webhook/..."})]}),r.type==="if-else"&&T("div",{className:"text-xs font-mono text-orange-600 bg-orange-50 p-2 rounded border border-orange-100 truncate",children:e.condition||"x > 0"}),!["http-request","webhook","if-else"].includes(r.type)&&T("p",{className:"text-sm text-zinc-500",children:r.description})]}),r.handles.map(i=>{let l=i.type==="target"?$.Left:$.Right,c={};r.type==="if-else"&&i.type;let y=i.type==="source",n=r.handles.filter(k=>k.type===i.type).indexOf(i),u=r.handles.filter(k=>k.type===i.type).length,h=u>1?`${(n+1)*100/(u+1)}%`:"50%";return T(Nt,{id:i.id,type:i.type,position:y?$.Right:$.Left,style:{top:h,...c},className:O("!w-3 !h-3 !border-2 !border-white transition-all duration-200 bg-zinc-400 group-hover:bg-indigo-500",y?"-right-1.5":"-left-1.5",i.id==="true"?"!bg-emerald-500":i.id==="false"?"!bg-red-500":""),children:i.label&&T("span",{className:O("absolute text-[10px] uppercase font-bold text-zinc-500 pointer-events-none w-max block mb-1",y?"right-4 mr-1 text-right":"left-4 ml-1 text-left","top-1/2 -translate-y-1/2"),children:i.label})},i.id)})]})});import{useRef as Lt}from"react";import{MousePointer2 as Mt,Save as Ut,Undo2 as Dt,Redo2 as At,Plus as Wt,Download as Gt,Upload as _t,Layout as Bt,Trash2 as jt,Play as Ft}from"lucide-react";import{jsx as x,jsxs as _}from"react/jsx-runtime";function me({onSave:e,onExport:t,onImport:a,onAddNode:r,onAutoLayout:s,onClear:d,onRun:o,isSaving:g,isRunning:b,canUndo:i,canRedo:l,onUndo:c,onRedo:y}){let n=Lt(null);return _("div",{className:"absolute top-4 left-1/2 -translate-x-1/2 z-50 flex items-center gap-1 p-1 bg-white/90 backdrop-blur-md border border-zinc-200/50 shadow-xl rounded-full",children:[x("input",{type:"file",ref:n,onChange:h=>{var F;let k=(F=h.target.files)==null?void 0:F[0];k&&a(k),n.current&&(n.current.value="")},accept:".json",className:"hidden"}),_("div",{className:"flex items-center gap-1 px-1 border-r border-zinc-200",children:[x("button",{className:"p-2 text-zinc-500 hover:text-zinc-900 hover:bg-zinc-100 rounded-full transition-all",title:"Select",children:x(Mt,{size:18})}),x("button",{onClick:r,className:"p-2 text-zinc-500 hover:text-zinc-900 hover:bg-zinc-100 rounded-full transition-all",title:"Add Node",children:x(Wt,{size:18})})]}),_("div",{className:"flex items-center gap-1 px-1 border-r border-zinc-200",children:[x("button",{onClick:c,disabled:!i,className:"p-2 text-zinc-400 hover:text-zinc-900 hover:bg-zinc-100 rounded-full transition-all disabled:opacity-30 disabled:cursor-not-allowed",title:"Undo",children:x(Dt,{size:18})}),x("button",{onClick:y,disabled:!l,className:"p-2 text-zinc-400 hover:text-zinc-900 hover:bg-zinc-100 rounded-full transition-all disabled:opacity-30 disabled:cursor-not-allowed",title:"Redo",children:x(At,{size:18})})]}),_("div",{className:"flex items-center gap-1 px-1 border-r border-zinc-200",children:[x("button",{onClick:s,className:"p-2 text-zinc-600 hover:text-zinc-900 hover:bg-zinc-100 rounded-full transition-all",title:"Auto Layout",children:x(Bt,{size:18})}),x("button",{onClick:d,className:"p-2 text-zinc-600 hover:text-red-600 hover:bg-red-50 rounded-full transition-all",title:"Clear Canvas",children:x(jt,{size:18})})]}),_("div",{className:"flex items-center gap-1 px-1 border-r border-zinc-200",children:[x("button",{onClick:t,className:"p-2 text-zinc-600 hover:text-zinc-900 hover:bg-zinc-100 rounded-full transition-all",title:"Export JSON",children:x(Gt,{size:18})}),x("button",{onClick:()=>{var h;return(h=n.current)==null?void 0:h.click()},className:"p-2 text-zinc-600 hover:text-zinc-900 hover:bg-zinc-100 rounded-full transition-all",title:"Import JSON",children:x(_t,{size:18})})]}),_("div",{className:"flex items-center gap-1 px-1",children:[x("button",{className:"flex items-center gap-2 px-3 py-2 bg-emerald-500 text-white rounded-full font-medium text-sm hover:bg-emerald-600 shadow-md shadow-emerald-200 transition-all mr-1",onClick:o,disabled:b,children:b?x("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):x(Ft,{size:16,fill:"currentColor"})}),_("button",{className:"flex items-center gap-2 px-4 py-2 bg-indigo-600 text-white rounded-full font-medium text-sm hover:bg-indigo-700 shadow-md shadow-indigo-200 transition-all disabled:opacity-70 disabled:cursor-not-allowed",onClick:e,disabled:g,children:[g?x("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):x(Ut,{size:16}),x("span",{children:"Save"})]})]})]})}import{Settings2 as Ht,X as ye,AlertCircle as qt,Trash2 as Jt,Import as Vt}from"lucide-react";import{useReactFlow as $t}from"reactflow";function ge(e){if(!e.trim().toLowerCase().startsWith("curl"))return null;let t="GET",a={},r,s="",d=e.replace(/\\\n/g," ").replace(/\n/g," "),o=d.match(/'(http[^']*)'|"(http[^"]*)"|(http\S+)/);o&&(s=o[1]||o[2]||o[3]);let g=d.match(/-X\s+([A-Z]+)/);g&&(t=g[1]);let b=/-H\s+['"]([^'"]+)['"]/g,i;for(;(i=b.exec(d))!==null;){let[c,y]=i[1].split(/:\s?(.+)/);c&&y&&(a[c]=y)}let l=d.match(/(-d|--data|--data-raw)\s+['"]([^'"]+)['"]/);return l&&(r=l[2],t==="GET"&&(t="POST")),{method:t,url:s,headers:a,body:r}}import{jsx as N,jsxs as P}from"react/jsx-runtime";function he({selectedNodeId:e,selectedNodeType:t,onClose:a}){var y;let{setNodes:r,getNodes:s,deleteElements:d}=$t();if(!e)return null;let o=s().find(n=>n.id===e);if(!o)return null;let g=((y=o.data)==null?void 0:y.type)||o.type||t,b=S[g],i=ce(g);if(i){b=JSON.parse(JSON.stringify(b));let n=o.data.operation;if(n){let u=i.operations.find(h=>h.id===n);u&&(b.inputs=[...b.inputs,...u.inputs])}}if(!b)return P("div",{className:"absolute top-4 right-4 w-80 bg-white p-4 rounded shadow border border-red-200 z-50",children:[P("div",{className:"flex items-center justify-between text-red-600 mb-2",children:[P("div",{className:"flex items-center gap-2",children:[N(qt,{size:16}),N("span",{className:"font-bold",children:"Unknown Node Type"})]}),N("button",{onClick:a,children:N(ye,{size:16})})]}),P("p",{className:"text-xs text-zinc-500 mt-1",children:["ID: ",g]})]});let l=(n,u)=>{r(h=>h.map(k=>k.id===e?{...k,data:{...k.data,[n]:u}}:k))},c=()=>{d({nodes:[{id:e}]}),a()};return P("div",{className:"absolute top-4 right-4 bottom-4 w-80 bg-white/95 backdrop-blur-md border border-zinc-200 shadow-2xl rounded-xl z-50 flex flex-col overflow-hidden animate-in slide-in-from-right duration-200",children:[P("div",{className:"p-4 border-b border-zinc-100 flex items-center justify-between bg-zinc-50/50",children:[P("div",{className:"flex items-center gap-2 text-zinc-700 font-semibold",children:[N(Ht,{size:16}),P("span",{children:[b.label," Properties"]})]}),P("div",{className:"flex items-center gap-1",children:[g==="http-request"&&P("button",{onClick:()=>{let n=prompt("Paste your cURL command here:");if(n){let u=ge(n);u?r(h=>h.map(k=>k.id===e?{...k,data:{...k.data,method:u.method,url:u.url,headers:JSON.stringify(u.headers,null,2),body:u.body||"{}"}}:k)):alert("Could not parse cURL command.")}},className:"p-1.5 text-indigo-500 hover:text-indigo-700 hover:bg-indigo-50 rounded-md transition-colors flex items-center gap-1 text-xs font-medium mr-1",title:"Import cURL",children:[N(Vt,{size:14}),N("span",{children:"Import cURL"})]}),N("button",{onClick:c,className:"p-1.5 text-red-400 hover:text-red-600 hover:bg-red-50 rounded-md transition-colors",title:"Delete Node",children:N(Jt,{size:16})}),N("button",{onClick:a,className:"p-1.5 text-zinc-400 hover:text-zinc-700 hover:bg-zinc-100 rounded-md transition-colors",children:N(ye,{size:16})})]})]}),P("div",{className:"p-4 space-y-5 flex-1 overflow-y-auto",children:[P("div",{className:"space-y-1 pb-4 border-b border-zinc-100",children:[N("label",{className:"text-xs font-bold uppercase tracking-wider text-zinc-400",children:"Description"}),N("p",{className:"text-sm text-zinc-600",children:b.description})]}),b.inputs.map(n=>{var u;return P("div",{className:"space-y-2",children:[N("label",{className:"block text-xs font-bold uppercase tracking-wider text-zinc-500",children:n.label}),n.type==="text"&&N("input",{type:"text",value:o.data[n.key]||"",onChange:h=>l(n.key,h.target.value),placeholder:n.placeholder,className:"w-full px-3 py-2 bg-white border border-zinc-200 rounded-md text-sm text-zinc-800 focus:outline-none focus:ring-2 focus:ring-indigo-500/20 focus:border-indigo-500 transition-all"}),n.type==="select"&&P("select",{value:o.data[n.key]||"",onChange:h=>l(n.key,h.target.value),className:"w-full px-3 py-2 bg-white border border-zinc-200 rounded-md text-sm text-zinc-800 focus:outline-none focus:ring-2 focus:ring-indigo-500/20 focus:border-indigo-500 transition-all",children:[N("option",{value:"",disabled:!0,children:"Select..."}),(u=n.options)==null?void 0:u.map(h=>N("option",{value:h.value,children:h.label},h.value))]}),(n.type==="json"||n.type==="code")&&N("textarea",{value:typeof o.data[n.key]=="object"?JSON.stringify(o.data[n.key],null,2):o.data[n.key]||"",onChange:h=>l(n.key,h.target.value),rows:5,className:"w-full px-3 py-2 bg-white border border-zinc-200 rounded-md text-sm font-mono text-zinc-800 focus:outline-none focus:ring-2 focus:ring-indigo-500/20 focus:border-indigo-500 transition-all resize-y"})]},n.key)})]})]})}import{useState as Xt,useMemo as Kt}from"react";import{Search as Yt,X as Zt,Zap as ee,Globe as Qt,MessageSquare as eo,Split as to,GitMerge as oo,Clock as ao,Mail as ro}from"lucide-react";import{jsx as z,jsxs as L}from"react/jsx-runtime";var io={Webhook:ee,Clock:ao,Globe:Qt,Mail:ro,MessageSquare:eo,Split:to,GitMerge:oo,Zap:ee,...H};function fe({isOpen:e,onClose:t,onSelect:a}){let[r,s]=Xt(""),d=Kt(()=>{let o={};Object.values(S).forEach(i=>{if(i.label.toLowerCase().includes(r.toLowerCase())||i.description&&i.description.toLowerCase().includes(r.toLowerCase())){let c=i.category||"other";o[c]||(o[c]=[]),o[c].push(i)}});let g=["trigger","logic","action","utility","integration"],b={};return g.forEach(i=>{o[i]&&(b[i]=o[i])}),Object.keys(o).forEach(i=>{g.includes(i)||(b[i]=o[i])}),b},[r]);return e?L("div",{className:"absolute inset-0 z-[100] bg-black/20 backdrop-blur-sm flex items-start justify-center pt-20 animate-in fade-in duration-200",children:[L("div",{className:"w-[600px] bg-white rounded-xl shadow-2xl border border-zinc-200 overflow-hidden flex flex-col max-h-[70vh] animate-in slide-in-from-bottom-4 duration-300",children:[L("div",{className:"p-4 border-b border-zinc-100 flex items-center gap-3 bg-zinc-50/50",children:[z(Yt,{className:"text-zinc-400",size:20}),z("input",{autoFocus:!0,type:"text",placeholder:"Search nodes...",className:"flex-1 bg-transparent border-none outline-none text-zinc-900 placeholder:text-zinc-400 text-lg",value:r,onChange:o=>s(o.target.value)}),z("div",{className:"px-2 py-1 bg-zinc-100 border border-zinc-200 rounded text-xs text-zinc-500 font-medium",children:"ESC"}),z("button",{onClick:t,className:"text-zinc-400 hover:text-zinc-700",children:z(Zt,{size:20})})]}),L("div",{className:"overflow-y-auto p-4 space-y-2",children:[Object.entries(d).map(([o,g])=>{if(g.length===0)return null;let b=r.length>0;return L("details",{open:!0,className:"group border border-zinc-200 rounded-lg bg-zinc-50/30 open:bg-white transition-all duration-200",children:[L("summary",{className:"flex items-center justify-between p-3 cursor-pointer list-none text-zinc-600 font-medium hover:bg-zinc-50 select-none",children:[L("div",{className:"flex items-center gap-2",children:[z("span",{className:"uppercase tracking-wider text-xs font-bold text-zinc-500",children:o}),z("span",{className:"text-xs bg-zinc-100 text-zinc-400 px-1.5 py-0.5 rounded-full",children:g.length})]}),z("div",{className:"text-zinc-400 group-open:rotate-180 transition-transform",children:z("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:z("path",{d:"m6 9 6 6 6-6"})})})]}),z("div",{className:"p-3 pt-0 border-t border-transparent group-open:border-zinc-100",children:z("div",{className:"grid grid-cols-2 gap-3 pt-2",children:g.map(i=>{let l=io[i.icon]||H[i.icon]||ee;return L("button",{onClick:()=>a(i.type),className:"flex items-start gap-3 p-3 rounded-lg border border-zinc-100 bg-white hover:border-indigo-200 hover:shadow-md hover:bg-indigo-50/30 transition-all text-left group/btn",children:[z("div",{className:O("p-2 rounded-md transition-colors",`bg-${i.color}-50 text-${i.color}-600 group-hover/btn:bg-white`),children:z(l,{size:20})}),L("div",{children:[z("div",{className:"font-semibold text-zinc-900 text-sm",children:i.label}),z("div",{className:"text-xs text-zinc-500 line-clamp-2 leading-relaxed",children:i.description})]})]},i.type)})})})]},o)}),Object.values(d).every(o=>o.length===0)&&z("div",{className:"text-center py-12 text-zinc-400",children:L("p",{children:['No nodes found matching "',r,'"']})})]})]}),z("div",{className:"absolute inset-0 -z-10",onClick:t})]}):null}import{useEffect as no,useState as so}from"react";import{CheckCircle2 as lo,AlertCircle as co,X as po}from"lucide-react";import{jsx as q,jsxs as uo}from"react/jsx-runtime";function xe({message:e,type:t,isVisible:a,onClose:r}){let[s,d]=so(!1);return no(()=>{if(a){d(!0);let o=setTimeout(()=>{r()},4e3);return()=>clearTimeout(o)}else setTimeout(()=>d(!1),300)},[a,r]),!s&&!a?null:uo("div",{className:O("absolute bottom-6 left-1/2 -translate-x-1/2 z-[100] flex items-center gap-3 px-4 py-3 rounded-lg shadow-xl border transition-all duration-300 transform",t==="success"?"bg-white border-emerald-100 text-emerald-800":"bg-white border-red-100 text-red-800",a?"translate-y-0 opacity-100 scale-100":"translate-y-4 opacity-0 scale-95"),children:[t==="success"?q(lo,{size:20,className:"text-emerald-500"}):q(co,{size:20,className:"text-red-500"}),q("span",{className:"font-medium text-sm",children:e}),q("button",{onClick:r,className:"ml-2 hover:opacity-70",children:q(po,{size:16,className:"text-zinc-400"})})]})}import{ReactFlowProvider as zo}from"reactflow";import ke from"dagre";import{Position as X}from"reactflow";var j=new ke.graphlib.Graph;j.setDefaultEdgeLabel(()=>({}));var ve=240,we=150,Ne=(e,t,a="LR")=>{let r=a==="LR";return j.setGraph({rankdir:a}),e.forEach(d=>{j.setNode(d.id,{width:ve,height:we})}),t.forEach(d=>{j.setEdge(d.source,d.target)}),ke.layout(j),{nodes:e.map(d=>{let o=j.node(d.id);return d.targetPosition=r?X.Left:X.Top,d.sourcePosition=r?X.Right:X.Bottom,d.position={x:o.x-ve/2,y:o.y-we/2},d}),edges:t}};import{useState as ze,useCallback as te}from"react";function Ce(e,t,a,r){let[s,d]=ze([{nodes:e,edges:t}]),[o,g]=ze(0),b=te((c,y)=>{d(n=>{let u=n.slice(0,o+1);return u.push({nodes:c,edges:y}),u.length>50&&u.shift(),u}),g(n=>Math.min(n+1,50))},[o]),i=te(()=>{if(o>0){let c=o-1,y=s[c];a(y.nodes),r(y.edges),g(c)}},[o,s,a,r]),l=te(()=>{if(o<s.length-1){let c=o+1,y=s[c];a(y.nodes),r(y.edges),g(c)}},[o,s,a,r]);return{takeSnapshot:b,undo:i,redo:l,canUndo:o>0,canRedo:o<s.length-1}}function Se(e,t){let a=[];if(e.length===0)return a.push({nodeId:"root",message:"Workflow is empty",severity:"warning"}),a;let r=new Set;return t.forEach(s=>{r.add(s.source),r.add(s.target)}),e.forEach(s=>{!r.has(s.id)&&e.length>1&&a.push({nodeId:s.id,message:"Node is disconnected",severity:"warning"}),s.type&&S[s.type],s.type==="http-request"&&(s.data.url||a.push({nodeId:s.id,field:"url",message:"URL is required",severity:"error"})),s.type}),a}import{jsx as C,jsxs as J}from"react/jsx-runtime";var Te=[{id:"1",type:"webhook",position:{x:100,y:100},data:{method:"POST",path:"/start"}},{id:"2",type:"http-request",position:{x:100,y:300},data:{method:"POST",url:"https://api.example.com/data"}},{id:"3",type:"slack",position:{x:400,y:200},data:{message:"Workflow completed",webhookUrl:"https://hooks.slack.com/..."}}],Pe=[{id:"e1-2",source:"1",target:"2",type:"smoothstep",animated:!0,style:{stroke:"#6366f1",strokeWidth:2}},{id:"e2-3",source:"2",target:"3",type:"smoothstep",animated:!0,style:{stroke:"#6366f1",strokeWidth:2}}],Ee=e=>C(zo,{children:C(Co,{...e})}),Co=({licenseKey:e,apiConfig:t,validationEndpoint:a,className:r,style:s})=>{let[d,o]=U(null),[g,b]=U(""),[i]=U(()=>new re({licenseKey:e,widgetVersion:"1.0.0",validationEndpoint:a||process.env.NEXT_PUBLIC_LICENSE_VALIDATION_URL||"http://localhost:3000/api/v1/license/validate"})),[l,c,y]=vo(Te),[n,u,h]=wo(Pe),[k,F]=U(!1),[K,ae]=U(!1),[G,D]=U(null),{takeSnapshot:R,undo:Oe,redo:Le,canUndo:Me,canRedo:Ue}=Ce(Te,Pe,m=>c([...m]),m=>u([...m])),Io=W(()=>{R(l,n)},[l,n,R]),[De,V]=U(null),Ae=mo(()=>{let m={custom:Q};return Object.keys(S).forEach(p=>{m[p]=Q}),m},[]);bo(()=>{async function m(){let p=await i.validate();o(p.valid),p.valid||b(p.reason||"Invalid License")}m()},[i]);let We=W(m=>{u(p=>{let f=ko({...m,type:"smoothstep",animated:!0,style:{stroke:"#6366f1",strokeWidth:2}},p);return R(l,f),f})},[u,l,R]),Ge=W((m,p)=>{V(p.id)},[]),_e=W(()=>{V(null)},[]),Be=go(null),[M,je]=U(null),[Fe,Y]=U(!1),He=W(m=>{let p=`node-${Date.now()}`,f={x:250,y:250};M&&(f={x:100+Math.random()*200,y:100+Math.random()*200});let v={id:p,type:m,position:f,data:{}},w=l.concat(v);c(w),R(w,n),Y(!1),V(p)},[M,l,n,R,c]),qe=W(()=>{let{nodes:m,edges:p}=Ne(l,n);c([...m]),u([...p]),R([...m],[...p]),setTimeout(()=>M==null?void 0:M.fitView(),100)},[l,n,c,u,R,M]),Je=W(()=>{confirm("Are you sure you want to clear the canvas?")&&(c([]),u([]),R([],[]))},[c,u,R]),Ve=W(async()=>{if(K)return;ae(!0),D(null);let m=l.map(f=>({...f,data:{...f.data,executionStatus:void 0}}));c(m);let p=(f,v)=>{c(w=>w.map(I=>I.id===f?{...I,data:{...I.data,executionStatus:v}}:I))};try{let f={};n.forEach(w=>{f[w.source]||(f[w.source]=[]),f[w.source].push(w.target)});let v=l.filter(w=>["webhook","schedule","connector"].includes(w.type||"")||n.every(I=>I.target!==w.id)).map(w=>w.id);if(v.length===0&&l.length>0&&v.push(l[0].id),v.length===0)throw new Error("No start node found");for(let w of v){p(w,"running"),await new Promise(B=>setTimeout(B,800)),p(w,"success");let I=f[w]||[];for(let B of I)p(B,"running"),await new Promise(Ye=>setTimeout(Ye,800)),p(B,"success")}D({message:"Execution completed successfully",type:"success"})}catch(f){D({message:f.message||"Execution Success",type:"success"})}finally{ae(!1)}},[l,n,K,c]),$e=async()=>{let m=Se(l,n),p=m.filter(B=>B.severity==="error");if(p.length>0){D({message:`Cannot save: ${p[0].message}`,type:"error"});return}m.length>0&&D({message:`Saved with warnings: ${m[0].message}`,type:"success"}),F(!0);let f=new ie({...t,baseUrl:t.baseUrl||process.env.NEXT_PUBLIC_WIDGET_API_URL||""}),v={nodes:l,edges:n},I=!!await f.createWorkflow(v);F(!1),D(I?{message:"Workflow saved successfully",type:"success"}:{message:"Failed to save workflow",type:"error"})},Xe=()=>{let m=se(l,n),p=new Blob([m],{type:"application/json"}),f=URL.createObjectURL(p),v=document.createElement("a");v.href=f,v.download=`workflow-${Date.now()}.json`,document.body.appendChild(v),v.click(),document.body.removeChild(v)},Ke=async m=>{try{let p=await m.text(),{nodes:f,edges:v}=le(p);c(f),u(v),R(f,v),setTimeout(()=>{M==null||M.fitView({padding:.2})},50)}catch(p){alert("Failed to import workflow. Invalid file."),console.error(p)}};return d===null?C("div",{className:"flex items-center justify-center h-[600px] w-full bg-zinc-50 rounded-xl border border-zinc-200",children:J("div",{className:"flex flex-col items-center gap-3",children:[C("div",{className:"w-6 h-6 border-2 border-indigo-600 border-t-transparent rounded-full animate-spin"}),C("p",{className:"text-zinc-500 text-sm font-medium",children:"Verifying License..."})]})}):J("div",{style:s,className:`relative w-full h-[800px] rounded-xl border border-zinc-200 shadow-sm overflow-hidden bg-zinc-50/50 group ${r||""}`,children:[!d&&J("div",{className:"absolute inset-0 z-50 bg-white/80 backdrop-blur-md flex flex-col items-center justify-center p-8 text-center",children:[C("div",{className:"w-16 h-16 bg-red-100 rounded-full flex items-center justify-center mb-4",children:C("div",{className:"w-8 h-8 text-red-600",children:"\u26A0\uFE0F"})}),C("h2",{className:"text-2xl font-bold text-zinc-900 mb-2",children:"License Verification Failed"}),J("p",{className:"text-zinc-600 max-w-md",children:[g,". Please update your license key to access the builder."]})]}),C(me,{onSave:$e,onExport:Xe,onImport:Ke,onAddNode:()=>Y(!0),onAutoLayout:qe,onClear:Je,onRun:Ve,isSaving:k,isRunning:K,canUndo:Me,canRedo:Ue,onUndo:Oe,onRedo:Le}),C(he,{selectedNodeId:De||void 0,onClose:()=>V(null)}),C(fe,{isOpen:Fe,onClose:()=>Y(!1),onSelect:He}),C(xe,{message:(G==null?void 0:G.message)||"",type:(G==null?void 0:G.type)||"success",isVisible:!!G,onClose:()=>D(null)}),C("div",{className:"w-full h-full",ref:Be,children:J(yo,{nodes:l,edges:n,onNodesChange:y,onEdgesChange:h,onConnect:We,onNodeClick:Ge,onPaneClick:_e,onInit:je,nodeTypes:Ae,fitView:!0,className:"bg-zinc-50",children:[C(ho,{variant:No.Dots,gap:20,size:1,color:"#94a3b8",className:"bg-slate-50"}),C(fo,{className:"!bg-white !border-slate-200 !shadow-xl !rounded-lg overflow-hidden [&>button]:!border-b-slate-100 [&>button]:!text-slate-600 hover:[&>button]:!bg-indigo-50 hover:[&>button]:!text-indigo-600 transition-colors"}),C(xo,{className:"!bg-white !border-slate-200 !shadow-xl !rounded-lg !mb-8 !mr-8",maskColor:"rgba(241, 245, 249, 0.7)",nodeColor:m=>{var p;return(p=m.type)!=null&&p.includes("trigger")||m.type==="webhook"?"#818cf8":m.type==="action"?"#34d399":"#cbd5e1"},zoomable:!0,pannable:!0})]})})]})};import{jsx as So}from"react/jsx-runtime";function Re(e){return So(Ee,{...e})}import{useState as Ie}from"react";import{Settings as To,X as Po,Maximize2 as Eo,Minimize2 as Ro}from"lucide-react";import{jsx as E,jsxs as oe}from"react/jsx-runtime";function gr({licenseKey:e,apiConfig:t,position:a="bottom-right",themeColor:r="#2563eb"}){let[s,d]=Ie(!1),[o,g]=Ie(!1),b=()=>d(!s),i=()=>g(!o),l={position:"fixed",bottom:"20px",[a==="bottom-right"?"right":"left"]:"20px",zIndex:9999,display:"flex",flexDirection:"column",alignItems:a==="bottom-right"?"flex-end":"flex-start",gap:"10px"},c=o?{position:"fixed",top:0,left:0,width:"100vw",height:"100vh",backgroundColor:"white",zIndex:1e4,boxShadow:"0 0 20px rgba(0,0,0,0.2)",display:"flex",flexDirection:"column"}:{width:"800px",height:"600px",backgroundColor:"white",borderRadius:"12px",boxShadow:"0 4px 20px rgba(0,0,0,0.15)",border:"1px solid #e5e7eb",display:"flex",flexDirection:"column",overflow:"hidden"};return s?E("div",{style:o?{position:"fixed",top:0,left:0,zIndex:1e4}:l,children:oe("div",{style:c,children:[oe("div",{style:{padding:"12px 16px",borderBottom:"1px solid #eee",display:"flex",justifyContent:"space-between",alignItems:"center",backgroundColor:"#f9fafb",color:"black"},children:[E("h3",{style:{margin:0,fontSize:"16px",fontWeight:600},children:"Workflow Builder"}),oe("div",{style:{display:"flex",gap:"8px"},children:[E("button",{onClick:i,style:{background:"none",border:"none",cursor:"pointer",padding:4},children:o?E(Ro,{size:18}):E(Eo,{size:18})}),E("button",{onClick:b,style:{background:"none",border:"none",cursor:"pointer",padding:4},children:E(Po,{size:18})})]})]}),E("div",{style:{flex:1,position:"relative"},children:E(Re,{licenseKey:e,apiConfig:t})})]})}):E("div",{style:l,children:E("button",{onClick:b,style:{width:"60px",height:"60px",borderRadius:"50%",backgroundColor:r,color:"white",border:"none",cursor:"pointer",boxShadow:"0 4px 12px rgba(0,0,0,0.2)",display:"flex",alignItems:"center",justifyContent:"center",transition:"transform 0.2s"},onMouseEnter:y=>y.currentTarget.style.transform="scale(1.05)",onMouseLeave:y=>y.currentTarget.style.transform="scale(1)",children:E(To,{size:28})})})}export{ie as ApiClient,gr as EmbeddableWidget,re as LicenseManager,Ee as WorkflowBuilder,ne as WorkflowSerializer,Re as WorkflowWidget,de as createConnectorNode,le as deserialize,ce as getConnectorDetails,S as nodeRegistry,Oo as registerConnector,se as serialize,Z as standardConnectors};
|
|
2
2
|
//# sourceMappingURL=index.mjs.map
|