upfynai-code 2.5.0 → 2.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. package/README.md +131 -0
  2. package/client/dist/assets/{AppContent-CRld2UWX.js → AppContent-C0CyP3g5.js} +3 -3
  3. package/client/dist/assets/{CanvasPanel-CB4sweQq.js → CanvasPanel-0u9QR7U-.js} +5 -5
  4. package/client/dist/assets/DashboardPanel-Dgqw1yZk.js +1 -0
  5. package/client/dist/assets/{LoginModal-BwkvjfPR.js → LoginModal-CZDEzqjK.js} +1 -1
  6. package/client/dist/assets/Onboarding-DR6NZ4Vz.js +1 -0
  7. package/client/dist/assets/{SetupForm-CH5EA5W0.js → SetupForm-D49gtWY4.js} +1 -1
  8. package/client/dist/assets/{WorkflowsPanel-CO5g5yGG.js → WorkflowsPanel-CqlbEJA_.js} +1 -1
  9. package/client/dist/assets/{ar-SA-G6X2FPQ2-DoJuo98H.js → ar-SA-G6X2FPQ2-BWqa1yBH.js} +1 -1
  10. package/client/dist/assets/{arc-B0wBaTeh.js → arc-BegSKqEW.js} +1 -1
  11. package/client/dist/assets/{az-AZ-76LH7QW2-xdrt1Z13.js → az-AZ-76LH7QW2-DrVlbZDP.js} +1 -1
  12. package/client/dist/assets/{bg-BG-XCXSNQG7-D8NAiF6Y.js → bg-BG-XCXSNQG7-DdunjBgT.js} +1 -1
  13. package/client/dist/assets/{blockDiagram-38ab4fdb-DSnyKzK4.js → blockDiagram-38ab4fdb-BKMbwGHu.js} +1 -1
  14. package/client/dist/assets/{bn-BD-2XOGV67Q-B0qWv8_J.js → bn-BD-2XOGV67Q-_7DtmvwO.js} +1 -1
  15. package/client/dist/assets/{c4Diagram-3d4e48cf-DoZJ13XA.js → c4Diagram-3d4e48cf-hJuiHhSn.js} +1 -1
  16. package/client/dist/assets/{ca-ES-6MX7JW3Y-RgLhfbZZ.js → ca-ES-6MX7JW3Y-BFIrmojG.js} +1 -1
  17. package/client/dist/assets/channel-Bur-rRTp.js +1 -0
  18. package/client/dist/assets/{classDiagram-70f12bd4-GNyDrRCk.js → classDiagram-70f12bd4-BjiAf9cM.js} +1 -1
  19. package/client/dist/assets/{classDiagram-v2-f2320105-CxdGhHm2.js → classDiagram-v2-f2320105-pwBewejc.js} +1 -1
  20. package/client/dist/assets/clone-BtqXeoBJ.js +1 -0
  21. package/client/dist/assets/{createText-2e5e7dd3-DiPywQOa.js → createText-2e5e7dd3-Dq_acOWe.js} +1 -1
  22. package/client/dist/assets/{cs-CZ-2BRQDIVT-BAjmnuoC.js → cs-CZ-2BRQDIVT-B-x4F6TJ.js} +1 -1
  23. package/client/dist/assets/{da-DK-5WZEPLOC-JxKVGt8o.js → da-DK-5WZEPLOC-Btlc8Dgn.js} +1 -1
  24. package/client/dist/assets/{de-DE-XR44H4JA-CrnRlt4z.js → de-DE-XR44H4JA-BVu3ZIoD.js} +1 -1
  25. package/client/dist/assets/{edges-e0da2a9e-DDsXzXLJ.js → edges-e0da2a9e-DH0wVTXR.js} +1 -1
  26. package/client/dist/assets/{el-GR-BZB4AONW-DQd8iogq.js → el-GR-BZB4AONW-h2ll8_ZC.js} +1 -1
  27. package/client/dist/assets/{erDiagram-9861fffd-CBiCC4rl.js → erDiagram-9861fffd-BYezLIR7.js} +1 -1
  28. package/client/dist/assets/{es-ES-U4NZUMDT-vvUblc5i.js → es-ES-U4NZUMDT-Cveiulwt.js} +1 -1
  29. package/client/dist/assets/{eu-ES-A7QVB2H4-De4NNCc1.js → eu-ES-A7QVB2H4-DQluL2PY.js} +1 -1
  30. package/client/dist/assets/{fa-IR-HGAKTJCU-DFBXqIqq.js → fa-IR-HGAKTJCU-BJtcMBSv.js} +1 -1
  31. package/client/dist/assets/{fi-FI-Z5N7JZ37-DV9zESPg.js → fi-FI-Z5N7JZ37-D8NfbVXV.js} +1 -1
  32. package/client/dist/assets/{flowDb-956e92f1-BhdSHbdO.js → flowDb-956e92f1-scnUykhM.js} +1 -1
  33. package/client/dist/assets/{flowDiagram-66a62f08-M-fp1_Ie.js → flowDiagram-66a62f08-jVyWsfyU.js} +1 -1
  34. package/client/dist/assets/flowDiagram-v2-96b9c2cf-N6xgi25h.js +1 -0
  35. package/client/dist/assets/{flowchart-elk-definition-4a651766-Bp0SonQx.js → flowchart-elk-definition-4a651766-gKGX3HqR.js} +1 -1
  36. package/client/dist/assets/{fr-FR-RHASNOE6-CKTMXuGk.js → fr-FR-RHASNOE6-vdj42kC6.js} +1 -1
  37. package/client/dist/assets/{ganttDiagram-c361ad54-iA737GUS.js → ganttDiagram-c361ad54-C2CiWFUP.js} +1 -1
  38. package/client/dist/assets/{gitGraphDiagram-72cf32ee-BX-wj-PV.js → gitGraphDiagram-72cf32ee-C59Yz2LK.js} +1 -1
  39. package/client/dist/assets/{gl-ES-HMX3MZ6V-Cdiqq4jY.js → gl-ES-HMX3MZ6V-DQo0TzoP.js} +1 -1
  40. package/client/dist/assets/{graph-Rxkx3sEa.js → graph-Dx_H43Kv.js} +1 -1
  41. package/client/dist/assets/{he-IL-6SHJWFNN-gYmR5_KT.js → he-IL-6SHJWFNN-DKXK5e33.js} +1 -1
  42. package/client/dist/assets/{hi-IN-IWLTKZ5I-pyqK94AR.js → hi-IN-IWLTKZ5I-C2Qgqc0R.js} +1 -1
  43. package/client/dist/assets/{hu-HU-A5ZG7DT2-DpacJgJy.js → hu-HU-A5ZG7DT2-Ss-6vX0m.js} +1 -1
  44. package/client/dist/assets/{id-ID-SAP4L64H-CAvIX-mj.js → id-ID-SAP4L64H-D7Wsg1S2.js} +1 -1
  45. package/client/dist/assets/{index-3862675e-BX3Fpn6V.js → index-3862675e-u8Nv7hHC.js} +1 -1
  46. package/client/dist/assets/{index-BBlwbHq_.js → index-BVowJdZF.js} +4 -4
  47. package/client/dist/assets/{index-ClfzLIqY.js → index-ce18TYkg.js} +4 -4
  48. package/client/dist/assets/index-kQoJx-bc.css +1 -0
  49. package/client/dist/assets/{infoDiagram-f8f76790-Ckv8imiv.js → infoDiagram-f8f76790-LmoJYsxo.js} +1 -1
  50. package/client/dist/assets/{it-IT-JPQ66NNP-BtpNRSce.js → it-IT-JPQ66NNP-CAPTVl7M.js} +1 -1
  51. package/client/dist/assets/{ja-JP-DBVTYXUO-CwJRyY6M.js → ja-JP-DBVTYXUO-eNVPawR2.js} +1 -1
  52. package/client/dist/assets/{journeyDiagram-49397b02-DWWZssji.js → journeyDiagram-49397b02-BaJqehpR.js} +1 -1
  53. package/client/dist/assets/{kaa-6HZHGXH3-DIWQEb4A.js → kaa-6HZHGXH3-tpuNkKhS.js} +1 -1
  54. package/client/dist/assets/{kab-KAB-ZGHBKWFO-DjGbqhUg.js → kab-KAB-ZGHBKWFO-Dp83kx4x.js} +1 -1
  55. package/client/dist/assets/{kk-KZ-P5N5QNE5-B_VzJdWf.js → kk-KZ-P5N5QNE5-B9IlC6YN.js} +1 -1
  56. package/client/dist/assets/{km-KH-HSX4SM5Z-DUD5mi0o.js → km-KH-HSX4SM5Z-B_KMYaMj.js} +1 -1
  57. package/client/dist/assets/{ko-KR-MTYHY66A--sDB10db.js → ko-KR-MTYHY66A-yebnUNdb.js} +1 -1
  58. package/client/dist/assets/{ku-TR-6OUDTVRD-CKvKrkcX.js → ku-TR-6OUDTVRD-BR6fh6-5.js} +1 -1
  59. package/client/dist/assets/{layout-CkB7sSeq.js → layout-DLl5Jwcl.js} +1 -1
  60. package/client/dist/assets/{line-DC7MA9qY.js → line-FpB7omSK.js} +1 -1
  61. package/client/dist/assets/{linear-C1lBBthf.js → linear-CkXqUFJ8.js} +1 -1
  62. package/client/dist/assets/{lt-LT-XHIRWOB4-MSZf7xYG.js → lt-LT-XHIRWOB4-SutZSWtR.js} +1 -1
  63. package/client/dist/assets/{lv-LV-5QDEKY6T-C-gvvmBB.js → lv-LV-5QDEKY6T-DuAxdcZL.js} +1 -1
  64. package/client/dist/assets/{mindmap-definition-fc14e90a-B3O7hztq.js → mindmap-definition-fc14e90a-DyxXOExh.js} +1 -1
  65. package/client/dist/assets/{mr-IN-CRQNXWMA-XHtBUWQH.js → mr-IN-CRQNXWMA-DqDUWM_8.js} +1 -1
  66. package/client/dist/assets/{my-MM-5M5IBNSE-D9eD2edL.js → my-MM-5M5IBNSE-C40kMFMR.js} +1 -1
  67. package/client/dist/assets/{nb-NO-T6EIAALU-BlImC6gp.js → nb-NO-T6EIAALU-DVij32Ju.js} +1 -1
  68. package/client/dist/assets/{nl-NL-IS3SIHDZ-CPFhnaSP.js → nl-NL-IS3SIHDZ-rT84mDYq.js} +1 -1
  69. package/client/dist/assets/{nn-NO-6E72VCQL-BMvoJSKQ.js → nn-NO-6E72VCQL-BBZXBW8V.js} +1 -1
  70. package/client/dist/assets/{oc-FR-POXYY2M6-Buye63LS.js → oc-FR-POXYY2M6-DzjOugOf.js} +1 -1
  71. package/client/dist/assets/{pa-IN-N4M65BXN-D9uQ3niy.js → pa-IN-N4M65BXN-DD1iU8_F.js} +1 -1
  72. package/client/dist/assets/{percentages-BXMCSKIN-BzXIakGM.js → percentages-BXMCSKIN-WVlHS4wx.js} +6 -6
  73. package/client/dist/assets/{pieDiagram-8a3498a8-BU38mzx-.js → pieDiagram-8a3498a8-Dd_85qBH.js} +1 -1
  74. package/client/dist/assets/{pl-PL-T2D74RX3-BqM4xdcg.js → pl-PL-T2D74RX3-ukVXa48G.js} +1 -1
  75. package/client/dist/assets/{pt-BR-5N22H2LF-rAjrxGyI.js → pt-BR-5N22H2LF-BibawarT.js} +1 -1
  76. package/client/dist/assets/{pt-PT-UZXXM6DQ-DXsqcwLt.js → pt-PT-UZXXM6DQ-So3i9l9w.js} +1 -1
  77. package/client/dist/assets/{quadrantDiagram-120e2f19-HhK4H1WU.js → quadrantDiagram-120e2f19-C4dFVDEx.js} +1 -1
  78. package/client/dist/assets/{requirementDiagram-deff3bca-aDrcyj-A.js → requirementDiagram-deff3bca-DrTO7yFl.js} +1 -1
  79. package/client/dist/assets/{ro-RO-JPDTUUEW-D_F9UKer.js → ro-RO-JPDTUUEW-DY0Xq_Hd.js} +1 -1
  80. package/client/dist/assets/{ru-RU-B4JR7IUQ-MirqN29p.js → ru-RU-B4JR7IUQ-B7u_Zvkd.js} +1 -1
  81. package/client/dist/assets/{sankeyDiagram-04a897e0-C6ij7qbQ.js → sankeyDiagram-04a897e0-D24gfzuS.js} +1 -1
  82. package/client/dist/assets/{sequenceDiagram-704730f1-C0EKO3th.js → sequenceDiagram-704730f1-Dgji2XLQ.js} +1 -1
  83. package/client/dist/assets/{si-LK-N5RQ5JYF-DyZC3mkC.js → si-LK-N5RQ5JYF-OejsLzQ_.js} +1 -1
  84. package/client/dist/assets/{sk-SK-C5VTKIMK-D-ksz-WY.js → sk-SK-C5VTKIMK-_vy2Bt-M.js} +1 -1
  85. package/client/dist/assets/{sl-SI-NN7IZMDC-CknuYoQ1.js → sl-SI-NN7IZMDC-DKOl_u2M.js} +1 -1
  86. package/client/dist/assets/{stateDiagram-587899a1-CYoq2VjL.js → stateDiagram-587899a1-CJ8eBaiU.js} +1 -1
  87. package/client/dist/assets/{stateDiagram-v2-d93cdb3a-C5lbp5px.js → stateDiagram-v2-d93cdb3a-C5K3l-Nt.js} +1 -1
  88. package/client/dist/assets/{styles-6aaf32cf-Dkfsk8gt.js → styles-6aaf32cf-DAKE0jbx.js} +1 -1
  89. package/client/dist/assets/{styles-9a916d00-CMYqtcEN.js → styles-9a916d00-LFAJCgEy.js} +1 -1
  90. package/client/dist/assets/{styles-c10674c1-Bp-5OlRU.js → styles-c10674c1-CllKO8NG.js} +1 -1
  91. package/client/dist/assets/{subset-shared.chunk-kfIB1Zam.js → subset-shared.chunk-Uy-J87FQ.js} +1 -1
  92. package/client/dist/assets/{subset-worker.chunk-DwQBgc4z.js → subset-worker.chunk-dvgDvqt9.js} +1 -1
  93. package/client/dist/assets/{sv-SE-XGPEYMSR-DwN13se1.js → sv-SE-XGPEYMSR-CDCB2ZV5.js} +1 -1
  94. package/client/dist/assets/{svgDrawCommon-08f97a94-CEgCMqs4.js → svgDrawCommon-08f97a94-CObOzbFQ.js} +1 -1
  95. package/client/dist/assets/{ta-IN-2NMHFXQM-ejDfFhwa.js → ta-IN-2NMHFXQM-DHUNdO69.js} +1 -1
  96. package/client/dist/assets/{th-TH-HPSO5L25-Bqc90ZNn.js → th-TH-HPSO5L25-zI2hnBq3.js} +1 -1
  97. package/client/dist/assets/{timeline-definition-85554ec2-BmGdKqG0.js → timeline-definition-85554ec2-C2XHRmxK.js} +1 -1
  98. package/client/dist/assets/{tr-TR-DEFEU3FU-CJvlPbcW.js → tr-TR-DEFEU3FU-l-6Hu4-D.js} +1 -1
  99. package/client/dist/assets/{uk-UA-QMV73CPH-D26-cbWL.js → uk-UA-QMV73CPH-CqSOwrl7.js} +1 -1
  100. package/client/dist/assets/{vendor-icons-aNdOvTr_.js → vendor-icons-Lb69KSFJ.js} +136 -126
  101. package/client/dist/assets/{vi-VN-M7AON7JQ-MbqIIwYM.js → vi-VN-M7AON7JQ-CUL8-mBZ.js} +1 -1
  102. package/client/dist/assets/{xychartDiagram-e933f94c-gfcTauxU.js → xychartDiagram-e933f94c-1fmf6slj.js} +1 -1
  103. package/client/dist/assets/{zh-CN-LNUGB5OW-BZSmhUdL.js → zh-CN-LNUGB5OW-CB5y5VVU.js} +1 -1
  104. package/client/dist/assets/{zh-HK-E62DVLB3-BJqejpiX.js → zh-HK-E62DVLB3-BHcrrEeJ.js} +1 -1
  105. package/client/dist/assets/{zh-TW-RAJ6MFWO-BBXtV-Uz.js → zh-TW-RAJ6MFWO-DoDUdkaJ.js} +1 -1
  106. package/client/dist/index.html +3 -3
  107. package/package.json +17 -14
  108. package/server/cli.js +44 -0
  109. package/server/database/db.js +16 -2
  110. package/server/index.js +2738 -2621
  111. package/server/middleware/auth.js +10 -2
  112. package/server/relay-client.js +73 -20
  113. package/server/routes/agent.js +1226 -1266
  114. package/server/routes/auth.js +32 -29
  115. package/server/routes/commands.js +598 -601
  116. package/server/routes/cursor.js +806 -807
  117. package/server/routes/dashboard.js +154 -1
  118. package/server/routes/git.js +1151 -1165
  119. package/server/routes/mcp.js +534 -551
  120. package/server/routes/settings.js +261 -269
  121. package/server/routes/taskmaster.js +1927 -1963
  122. package/server/routes/vapi-chat.js +94 -0
  123. package/server/routes/voice.js +0 -4
  124. package/server/sandbox.js +120 -0
  125. package/client/dist/assets/DashboardPanel-BXaA-b9z.js +0 -1
  126. package/client/dist/assets/Onboarding-2A_5fPxy.js +0 -1
  127. package/client/dist/assets/channel-BmO6nY0W.js +0 -1
  128. package/client/dist/assets/clone-xuHMqFoD.js +0 -1
  129. package/client/dist/assets/flowDiagram-v2-96b9c2cf-C5eiN8Pg.js +0 -1
  130. package/client/dist/assets/index-Td4UdtLF.css +0 -1
@@ -1,18 +1,18 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/percentages-BXMCSKIN-BzXIakGM.js","assets/vendor-syntax-DnmwQQJF.js","assets/vendor-react-9mUTKBHH.js","assets/vendor-markdown-BXEi_H3G.js","assets/AppContent-CRld2UWX.js","assets/index-ClfzLIqY.js","assets/vendor-icons-aNdOvTr_.js","assets/vendor-i18n-DCFGyhQR.js","assets/index-Td4UdtLF.css","assets/LoginModal-BwkvjfPR.js","assets/vendor-xterm-CZq1hqo1.js","assets/vendor-xterm-qxJ8_QYu.css","assets/vendor-codemirror-D_s0aGBu.js"])))=>i.map(i=>d[i]);
2
- import{b as ce}from"./vendor-syntax-DnmwQQJF.js";import{r as g,j as i,v as ge}from"./vendor-react-9mUTKBHH.js";import{q as xe,f as be,r as ye,s as ke,F as we,t as ve,u as Ie}from"./vendor-icons-aNdOvTr_.js";import"./vendor-markdown-BXEi_H3G.js";const X=240,le=120,G=32,Se=12,O={note:{bg:"#f8fafc",border:"#3b82f6",text:"#1e293b",accent:"#2563eb"},pdf:{bg:"#fef2f2",border:"#ef4444",text:"#1e293b",accent:"#dc2626"},summary:{bg:"#f0fdf4",border:"#22c55e",text:"#1e293b",accent:"#16a34a"},prompt:{bg:"#eff6ff",border:"#3b82f6",text:"#1e293b",accent:"#2563eb"},response:{bg:"#f5f3ff",border:"#8b5cf6",text:"#1e293b",accent:"#7c3aed"},research:{bg:"#f0fdfa",border:"#14b8a6",text:"#1e293b",accent:"#0d9488"},suggestion:{bg:"#fffbeb",border:"#f59e0b",text:"#1e293b",accent:"#d97706"}};function R(){return crypto.randomUUID()}function ie(n,e,t,r,a){return{id:a.id,type:"rectangle",x:n,y:e,width:t,height:r,angle:0,strokeColor:a.border,backgroundColor:a.bg,fillStyle:"solid",strokeWidth:2,roughness:0,opacity:100,groupIds:a.groupIds,roundness:{type:3,value:Se},isDeleted:!1,boundElements:null,locked:!1,customData:a.customData,version:1,versionNonce:Math.floor(Math.random()*1e9),seed:Math.floor(Math.random()*1e9)}}function H(n,e,t,r){const a=r.fontSize??14;return{id:r.id,type:"text",x:n,y:e,width:r.width??X-24,height:r.height??a+6,angle:0,strokeColor:r.color,backgroundColor:"transparent",fillStyle:"solid",strokeWidth:1,roughness:0,opacity:100,groupIds:r.groupIds,roundness:null,isDeleted:!1,boundElements:null,locked:!1,text:t,fontSize:a,fontFamily:1,textAlign:"left",verticalAlign:"top",containerId:null,originalText:t,autoResize:!1,lineHeight:1.25,customData:r.customData,version:1,versionNonce:Math.floor(Math.random()*1e9),seed:Math.floor(Math.random()*1e9)}}const Ce={note:"📝 Note",pdf:"📄 PDF",summary:"✨ Summary",prompt:"💬 Prompt",response:"🤖 Response",research:"🔍 Research",suggestion:"💡 Suggestion"};function z(n,e,t,r,a,l){const s=R(),m=R(),d=l??X,p=r.split(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/percentages-BXMCSKIN-WVlHS4wx.js","assets/vendor-syntax-DnmwQQJF.js","assets/vendor-react-9mUTKBHH.js","assets/vendor-markdown-BXEi_H3G.js","assets/AppContent-C0CyP3g5.js","assets/index-ce18TYkg.js","assets/vendor-icons-Lb69KSFJ.js","assets/vendor-i18n-DCFGyhQR.js","assets/index-kQoJx-bc.css","assets/LoginModal-CZDEzqjK.js","assets/vendor-xterm-CZq1hqo1.js","assets/vendor-xterm-qxJ8_QYu.css","assets/vendor-codemirror-D_s0aGBu.js"])))=>i.map(i=>d[i]);
2
+ import{b as ce}from"./vendor-syntax-DnmwQQJF.js";import{r as g,j as i,v as ge}from"./vendor-react-9mUTKBHH.js";import{t as xe,i as be,u as ye,v as ke,F as we,w as ve,x as Ie}from"./vendor-icons-Lb69KSFJ.js";import"./vendor-markdown-BXEi_H3G.js";const X=240,le=120,G=32,Se=12,O={note:{bg:"#f8fafc",border:"#3b82f6",text:"#1e293b",accent:"#2563eb"},pdf:{bg:"#fef2f2",border:"#ef4444",text:"#1e293b",accent:"#dc2626"},summary:{bg:"#f0fdf4",border:"#22c55e",text:"#1e293b",accent:"#16a34a"},prompt:{bg:"#eff6ff",border:"#3b82f6",text:"#1e293b",accent:"#2563eb"},response:{bg:"#f5f3ff",border:"#8b5cf6",text:"#1e293b",accent:"#7c3aed"},research:{bg:"#f0fdfa",border:"#14b8a6",text:"#1e293b",accent:"#0d9488"},suggestion:{bg:"#fffbeb",border:"#f59e0b",text:"#1e293b",accent:"#d97706"}};function R(){return crypto.randomUUID()}function ie(n,e,t,r,a){return{id:a.id,type:"rectangle",x:n,y:e,width:t,height:r,angle:0,strokeColor:a.border,backgroundColor:a.bg,fillStyle:"solid",strokeWidth:2,roughness:0,opacity:100,groupIds:a.groupIds,roundness:{type:3,value:Se},isDeleted:!1,boundElements:null,locked:!1,customData:a.customData,version:1,versionNonce:Math.floor(Math.random()*1e9),seed:Math.floor(Math.random()*1e9)}}function H(n,e,t,r){const a=r.fontSize??14;return{id:r.id,type:"text",x:n,y:e,width:r.width??X-24,height:r.height??a+6,angle:0,strokeColor:r.color,backgroundColor:"transparent",fillStyle:"solid",strokeWidth:1,roughness:0,opacity:100,groupIds:r.groupIds,roundness:null,isDeleted:!1,boundElements:null,locked:!1,text:t,fontSize:a,fontFamily:1,textAlign:"left",verticalAlign:"top",containerId:null,originalText:t,autoResize:!1,lineHeight:1.25,customData:r.customData,version:1,versionNonce:Math.floor(Math.random()*1e9),seed:Math.floor(Math.random()*1e9)}}const Ce={note:"📝 Note",pdf:"📄 PDF",summary:"✨ Summary",prompt:"💬 Prompt",response:"🤖 Response",research:"🔍 Research",suggestion:"💡 Suggestion"};function z(n,e,t,r,a,l){const s=R(),m=R(),d=l??X,p=r.split(`
3
3
  `),c=Math.max(le-G,p.length*18+16),f=G+c,x=O[n],D=ie(e,t,d,f,{id:m,groupIds:[s],bg:x.bg,border:x.border,customData:{blockType:n,blockId:m,content:r,...a}}),A=H(e+12,t+8,Ce[n],{id:R(),groupIds:[s],color:x.accent,fontSize:13,width:d-24}),w=H(e+12,t+G+4,r,{id:R(),groupIds:[s],color:x.text,fontSize:13,width:d-24,height:c-12});return{elements:[D,A,w],blockId:m,groupId:s,totalHeight:f}}function de(n,e,t="New note..."){return z("note",n,e,t)}function te(n,e,t){return z("prompt",n,e,t)}function je(n,e,t,r){return z("response",n,e,t,void 0,r)}function De(n,e,t,r){return z("research",n,e,t,void 0,r)}function Ee(n,e,t,r){return z("suggestion",n,e,t,void 0,r)}function ue(n,e,t,r,a,l){const s=R(),m=R(),d=t.length>28?t.slice(0,25)+"...":t,p=ie(n,e,X,le,{id:m,groupIds:[s],bg:O.pdf.bg,border:O.pdf.border,customData:{blockType:"pdf",blockId:m,fileName:t,pageCount:r,extractedText:a,thumbnail:l??null}}),c=H(n+12,e+8,`📄 ${d}`,{id:R(),groupIds:[s],color:O.pdf.accent,fontSize:13}),f=H(n+12,e+32,`${r} page${r!==1?"s":""}`,{id:R(),groupIds:[s],color:O.pdf.text,fontSize:12}),x=H(n+12,e+56,a.slice(0,80)+(a.length>80?"...":""),{id:R(),groupIds:[s],color:"#64748b",fontSize:11,height:48});return{elements:[p,c,f,x],blockId:m,groupId:s}}function me(n,e,t,r="Generating summary..."){return z("summary",n,e,r,{sourceIds:t,generatedContent:r})}function Y(n,e){const t=R();return{element:{id:t,type:"arrow",x:0,y:0,width:100,height:0,angle:0,strokeColor:"#6366f1",backgroundColor:"transparent",fillStyle:"solid",strokeWidth:2,roughness:0,opacity:80,groupIds:[],roundness:{type:2},isDeleted:!1,boundElements:null,locked:!1,points:[[0,0],[100,0]],startBinding:{elementId:n,focus:0,gap:4},endBinding:{elementId:e,focus:0,gap:4},startArrowhead:null,endArrowhead:"arrow",customData:{blockType:"context-link",sourceId:n,targetId:e},version:1,versionNonce:Math.floor(Math.random()*1e9),seed:Math.floor(Math.random()*1e9)},linkId:t}}async function Ne(n){try{const e=await ce(()=>import("./pdf-CE_K4jFx.js"),[]);e.GlobalWorkerOptions.workerSrc=new URL("/assets/pdf.worker-BA9kU3Pw.mjs",import.meta.url).toString();const t=await n.arrayBuffer(),r=await e.getDocument({data:t}).promise,a=r.numPages,l=[],s=Math.min(a,10);for(let d=1;d<=s;d++){const f=(await(await r.getPage(d)).getTextContent()).items.map(x=>x.str).join(" ");l.push(f)}let m=null;try{const d=await r.getPage(1),p=d.getViewport({scale:.5}),c=document.createElement("canvas");c.width=p.width,c.height=p.height;const f=c.getContext("2d");f&&(await d.render({canvasContext:f,viewport:p}).promise,m=c.toDataURL("image/png",.6))}catch{}return{text:l.join(`
4
4
 
5
5
  `),pageCount:a,thumbnail:m}}catch(e){return console.error("PDF extraction failed:",e),{text:"",pageCount:0,thumbnail:null}}}function K(n){const e=n.getAppState(),t=(-e.scrollX+e.width/2)/e.zoom.value,r=(-e.scrollY+e.height/2)/e.zoom.value;return{x:Math.round(t-120),y:Math.round(r-60)}}function U(n,e){const t=n.getSceneElements();n.updateScene({elements:[...t,...e]})}function Ae({api:n,onRun:e,onStop:t,onClearAi:r,isRunning:a}){const l=g.useRef(null),[s,m]=g.useState(!1),[d,p]=g.useState(!1),c=g.useCallback(()=>{if(!n)return;const{x:o,y:b}=K(n),v=de(o,b);U(n,v.elements)},[n]),f=g.useCallback(()=>{var o;(o=l.current)==null||o.click()},[]),x=g.useCallback(async o=>{var v;const b=(v=o.target.files)==null?void 0:v[0];if(!(!b||!n)){o.target.value="",p(!0);try{const{text:k,pageCount:I,thumbnail:T}=await Ne(b),{x:P,y:M}=K(n),$=ue(P,M,b.name,I,k,T);U(n,$.elements)}finally{p(!1)}}},[n]),D=g.useCallback(()=>{if(!n)return;const o=n.getAppState(),b=Object.keys(o.selectedElementIds||{}),k=n.getSceneElements().filter(M=>{var $;return b.includes(M.id)&&(($=M.customData)==null?void 0:$.blockId)}).map(M=>M.customData.blockId),{x:I,y:T}=K(n),P=me(I+280,T,k,k.length?"Summary of selected blocks":"Select blocks to summarize");U(n,P.elements)},[n]),A=g.useCallback(()=>{if(!n)return;const o=n.getAppState(),b=Object.keys(o.selectedElementIds||{}),k=n.getSceneElements().filter(I=>{var T;return b.includes(I.id)&&((T=I.customData)==null?void 0:T.blockId)});if(k.length===2){const I=Y(k[0].id,k[1].id);U(n,[I.element]),m(!1)}else m(!s)},[n,s]),w="flex items-center justify-center w-9 h-9 rounded-lg transition-colors text-muted-foreground hover:text-foreground hover:bg-black/5";return i.jsxs("div",{className:"canvas-block-toolbar",children:[a?i.jsx("button",{onClick:t,className:`${w} text-red-500 hover:text-red-600 hover:bg-red-50`,title:"Stop AI",children:i.jsx(xe,{className:"w-4 h-4"})}):i.jsx("button",{onClick:e,className:`${w} text-primary hover:text-primary hover:bg-primary/10`,title:"Run: Analyze canvas with AI",children:i.jsx(be,{className:"w-4 h-4"})}),i.jsx("button",{onClick:r,className:w,title:"Clear AI output blocks",children:i.jsx(ye,{className:"w-4 h-4"})}),i.jsx("div",{className:"w-5 border-t border-black/10 mx-auto"}),i.jsx("button",{onClick:c,className:w,title:"Add Note",children:i.jsx(ke,{className:"w-4 h-4"})}),i.jsx("button",{onClick:f,className:w,title:"Add PDF",disabled:d,children:i.jsx(we,{className:`w-4 h-4 ${d?"animate-pulse":""}`})}),i.jsx("button",{onClick:D,className:w,title:"Add Summary",children:i.jsx(ve,{className:"w-4 h-4"})}),i.jsx("div",{className:"w-5 border-t border-black/10 mx-auto"}),i.jsx("button",{onClick:A,className:`${w} ${s?"bg-indigo-500/10 text-indigo-500":""}`,title:"Connect Blocks (select 2)",children:i.jsx(Ie,{className:"w-4 h-4"})}),i.jsx("input",{ref:l,type:"file",accept:".pdf",onChange:x,className:"hidden"}),s&&i.jsx("div",{className:"absolute left-12 top-1/2 -translate-y-1/2 bg-background/90 border border-border rounded-md px-2 py-1 text-xs text-muted-foreground whitespace-nowrap",children:"Select 2 blocks, then click Connect"})]})}function L(){return window.__excalidrawAPI??null}function F(n){const e=L();if(!e)return;const t=e.getSceneElements();e.updateScene({elements:[...t,...n]})}function ne(){const n=L();if(!n)return{x:100,y:100};const e=n.getAppState(),t=(-e.scrollX+e.width/2)/e.zoom.value,r=(-e.scrollY+e.height/2)/e.zoom.value;return{x:Math.round(t-120),y:Math.round(r-60)}}const B={addNote(n,e,t){const r=n!=null&&e!=null?{x:n,y:e}:ne(),a=de(r.x,r.y,t);return F(a.elements),{blockId:a.blockId}},addPdf(n,e,t,r,a=0,l){const s=ue(n,e,t,a,r,l);return F(s.elements),{blockId:s.blockId}},addSummary(n,e,t,r){const a=t!=null&&r!=null?{x:t,y:r}:ne(),l=me(a.x,a.y,n,e);return F(l.elements),{blockId:l.blockId}},connectBlocks(n,e){const t=Y(n,e);return F([t.element]),{linkId:t.linkId}},getBlocks(){const n=L();return n?n.getSceneElements().filter(e=>{var t;return((t=e.customData)==null?void 0:t.blockType)&&e.customData.blockType!=="context-link"}).map(e=>({id:e.id,x:e.x,y:e.y,width:e.width,height:e.height,...e.customData})):[]},getConnections(){const n=L();return n?n.getSceneElements().filter(e=>{var t;return((t=e.customData)==null?void 0:t.blockType)==="context-link"}).map(e=>({id:e.id,sourceId:e.customData.sourceId,targetId:e.customData.targetId})):[]},updateBlockContent(n,e){const t=L();if(!t)return;const r=t.getSceneElements().map(a=>{var l;if(a.id===n&&a.customData)return{...a,customData:{...a.customData,content:e,generatedContent:e}};if(a.type==="text"&&((l=a.groupIds)!=null&&l.length)){const s=t.getSceneElements().find(m=>{var d;return m.id===n&&((d=m.groupIds)==null?void 0:d.some(p=>a.groupIds.includes(p)))});if(s&&a.y>s.y+28)return{...a,text:e,originalText:e}}return a});t.updateScene({elements:r})},removeBlock(n){const e=L();if(!e)return;const t=e.getSceneElements().find(l=>l.id===n);if(!t)return;const r=t.groupIds??[],a=e.getSceneElements().map(l=>{var s,m;return l.id===n||r.length&&((s=l.groupIds)!=null&&s.some(d=>r.includes(d)))?{...l,isDeleted:!0}:((m=l.customData)==null?void 0:m.blockType)==="context-link"&&(l.customData.sourceId===n||l.customData.targetId===n)?{...l,isDeleted:!0}:l});e.updateScene({elements:a})}};function Te(){window.__canvasBlockAPI=B}function Be(){delete window.__canvasBlockAPI}function Re(n){const{action:e,params:t}=n;switch(e){case"addNote":return B.addNote(t.x,t.y,t.content);case"addPdf":return B.addPdf(t.x,t.y,t.fileName,t.text,t.pageCount,t.thumbnail);case"addSummary":return B.addSummary(t.sourceIds,t.content,t.x,t.y);case"connectBlocks":return B.connectBlocks(t.sourceId,t.targetId);case"updateBlockContent":return B.updateBlockContent(t.blockId,t.content);case"removeBlock":return B.removeBlock(t.blockId);case"getBlocks":return B.getBlocks();case"getConnections":return B.getConnections();default:console.warn("Unknown canvas block command:",e)}}function _(n,e){return n.length<=e?n:n.slice(0,e)+"..."}function V(n,e){return`(${Math.round(n)}, ${Math.round(e)})`}function oe(n){var f,x,D,A,w;const e=n.getSceneElements().filter(o=>!o.isDeleted);if(e.length===0)return"Canvas is empty.";const t=[],r=[],a=[],l=[],s=[],m=new Set,d=new Set;for(const o of e)if((f=o.customData)!=null&&f.blockType&&o.customData.blockType!=="context-link"){if(m.add(o.id),o.groupIds)for(const b of o.groupIds)d.add(b);t.push({id:o.id,type:o.customData.blockType,x:o.x,y:o.y,content:o.customData.content||o.customData.extractedText||o.customData.generatedContent||"",label:o.customData.fileName||o.customData.blockType})}const p=new Map;for(const o of t){const b=o.content?_(o.content,40):o.type;p.set(o.id,b)}for(const o of e)if(!m.has(o.id)&&!((x=o.groupIds)!=null&&x.some(b=>d.has(b))))if(((D=o.customData)==null?void 0:D.blockType)==="context-link")l.push({sourceId:o.customData.sourceId,targetId:o.customData.targetId,sourceLabel:p.get(o.customData.sourceId)||"unknown",targetLabel:p.get(o.customData.targetId)||"unknown"});else if(o.type==="arrow"&&(o.startBinding||o.endBinding)){const b=(A=o.startBinding)==null?void 0:A.elementId,v=(w=o.endBinding)==null?void 0:w.elementId;b&&v&&l.push({sourceId:b,targetId:v,sourceLabel:p.get(b)||"element",targetLabel:p.get(v)||"element"})}else o.type==="text"?r.push({text:o.text||o.originalText||"",x:o.x,y:o.y}):o.type==="rectangle"||o.type==="ellipse"||o.type==="diamond"?a.push({type:o.type,x:o.x,y:o.y,width:o.width,height:o.height}):(o.type==="freedraw"||o.type==="line")&&s.push({type:o.type,x:o.x,y:o.y});const c=[`## Canvas Context
6
6
  `];if(t.length>0){c.push("### Blocks:");for(const o of t){const b=o.content?_(o.content,120):"(empty)";c.push(`- [${o.type} at ${V(o.x,o.y)}]: "${b}"`)}c.push("")}if(r.length>0){c.push("### Free Text:");for(const o of r)c.push(`- Text at ${V(o.x,o.y)}: "${_(o.text,100)}"`);c.push("")}if(a.length>0){c.push("### Shapes:");for(const o of a)c.push(`- ${o.type} at ${V(o.x,o.y)} (${Math.round(o.width)}x${Math.round(o.height)})`);c.push("")}if(s.length>0&&(c.push("### Drawings:"),c.push(`- ${s.length} hand-drawn element(s)`),c.push("")),l.length>0){c.push("### Connections:");for(const o of l)c.push(`- "${o.sourceLabel}" → "${o.targetLabel}"`);c.push("")}if(t.length>1){const o=[...t].sort((k,I)=>k.x-I.x||k.y-I.y),b=o[0],v=o[o.length-1];c.push("### Spatial Layout:"),c.push(`- Leftmost: ${b.type} ("${_(b.content,30)}")`),c.push(`- Rightmost: ${v.type} ("${_(v.content,30)}")`),c.push(`- Total blocks: ${t.length}`),c.push("")}return c.join(`
7
7
  `)}function Pe(n){var m,d,p;const e=n.getAppState(),t=new Set(Object.keys(e.selectedElementIds||{}));if(t.size===0)return null;const r=n.getSceneElements().filter(c=>!c.isDeleted),a=new Set(t);for(const c of r)if(t.has(c.id)&&c.groupIds)for(const f of c.groupIds)for(const x of r)(m=x.groupIds)!=null&&m.includes(f)&&a.add(x.id);const l=r.filter(c=>a.has(c.id));if(l.length===0)return null;const s=[`## Selected Items Context
8
8
  `];for(const c of l)if((d=c.customData)!=null&&d.blockType&&c.customData.blockType!=="context-link"){const f=c.customData.content||c.customData.extractedText||c.customData.generatedContent||"";s.push(`- [${c.customData.blockType}]: "${_(f,150)}"`)}else c.type==="text"?s.push(`- Text: "${_(c.text||"",150)}"`):c.type==="rectangle"||c.type==="ellipse"||c.type==="diamond"?s.push(`- Shape: ${c.type} (${Math.round(c.width)}x${Math.round(c.height)})`):((p=c.customData)==null?void 0:p.blockType)==="context-link"&&s.push("- Connection: linked elements");return s.join(`
9
- `)}function se(n){const e=n.getSceneElements().filter(a=>!a.isDeleted);if(e.length===0){const a=n.getAppState(),l=(-a.scrollX+a.width/2)/a.zoom.value,s=(-a.scrollY+a.height/2)/a.zoom.value;return{x:Math.round(l),y:Math.round(s)}}let t=-1/0,r=1/0;for(const a of e){const l=a.x+(a.width||0);l>t&&(t=l),a.y<r&&(r=a.y)}return{x:Math.round(t+60),y:Math.round(r)}}const q=320,re=20;function Me(n){const e=[],t=n.split(`
9
+ `)}function se(n){const e=n.getSceneElements().filter(a=>!a.isDeleted);if(e.length===0){const a=n.getAppState(),l=(-a.scrollX+a.width/2)/a.zoom.value,s=(-a.scrollY+a.height/2)/a.zoom.value;return{x:Math.round(l),y:Math.round(s)}}let t=-1/0,r=1/0;for(const a of e){const l=a.x+(a.width||0);l>t&&(t=l),a.y<r&&(r=a.y)}return{x:Math.round(t+60),y:Math.round(r)}}const J=320,re=20;function Me(n){const e=[],t=n.split(`
10
10
  `);let r="response",a="",l=[],s=!1,m=[];const d=()=>{const p=l.join(`
11
11
  `).trim();p&&e.push({type:r,heading:a,content:p}),l=[]};for(const p of t){if(p.trim().startsWith("```mermaid")){d(),s=!0,m=[];continue}if(s){if(p.trim()==="```"){s=!1;const c=m.join(`
12
12
  `).trim();c&&e.push({type:"mermaid",heading:"Flow Diagram",content:c})}else m.push(p);continue}if(p.startsWith("## ")||p.startsWith("### ")){d();const c=p.replace(/^#{2,3}\s+/,"").trim();a=c;const f=c.toLowerCase();f.includes("research")||f.includes("analysis")||f.includes("finding")?r="research":f.includes("suggestion")||f.includes("idea")||f.includes("recommendation")?r="suggestion":r="response";continue}if(p.startsWith("> ")){r!=="suggestion"&&(d(),r="suggestion",a=a||"Suggestion"),l.push(p.slice(2));continue}l.push(p)}return d(),e}function _e(n,e){const t=n.split(`
13
13
  `),r=[];for(const a of t)if(a.length<=e)r.push(a);else{const l=a.split(" ");let s="";for(const m of l)s.length+m.length+1>e?(s&&r.push(s),s=m):s=s?s+" "+m:m;s&&r.push(s)}return r.join(`
14
14
  `)}function $e(n,e,t,r){const a=Me(n),l=[],s=[];let m=t;for(const d of a){if(d.type==="mermaid"){s.push({content:d.content,x:e,y:m}),m+=200+re;continue}const p=_e(d.content,42),c=p.length>600?p.slice(0,600)+`
15
- ...`:p;let f;switch(d.type){case"research":f=De(e,m,c,q);break;case"suggestion":f=Ee(e,m,c,q);break;default:f=je(e,m,c,q);break}l.push({blockId:f.blockId,groupId:f.groupId,elements:f.elements,totalHeight:f.totalHeight}),m+=f.totalHeight+re}if(r&&l.length>0){const d=Y(r,l[0].blockId);l[0].elements.push(d.element)}for(let d=0;d<l.length-1;d++){const p=Y(l[d].blockId,l[d+1].blockId);l[d+1].elements.push(p.element)}return{blocks:l,mermaidSections:s}}const J="upfynai-excalidraw-scene",ae=`You are a visual AI assistant working on an infinite canvas. The user has drawn elements on the canvas and is asking you to analyze and respond.
15
+ ...`:p;let f;switch(d.type){case"research":f=De(e,m,c,J);break;case"suggestion":f=Ee(e,m,c,J);break;default:f=je(e,m,c,J);break}l.push({blockId:f.blockId,groupId:f.groupId,elements:f.elements,totalHeight:f.totalHeight}),m+=f.totalHeight+re}if(r&&l.length>0){const d=Y(r,l[0].blockId);l[0].elements.push(d.element)}for(let d=0;d<l.length-1;d++){const p=Y(l[d].blockId,l[d+1].blockId);l[d+1].elements.push(p.element)}return{blocks:l,mermaidSections:s}}const q="upfynai-excalidraw-scene",ae=`You are a visual AI assistant working on an infinite canvas. The user has drawn elements on the canvas and is asking you to analyze and respond.
16
16
 
17
17
  IMPORTANT: Structure your response using markdown headings so it can be rendered as visual blocks:
18
18
  - Use ## headings to separate major sections
@@ -25,7 +25,7 @@ IMPORTANT: Structure your response using markdown headings so it can be rendered
25
25
 
26
26
  Here is the current canvas context:
27
27
 
28
- `;function Le({selectedProject:n,ws:e,sendMessage:t,latestMessage:r}){const[a,l]=g.useState(null),[s,m]=g.useState(null),[d,p]=g.useState(!1),[c,f]=g.useState(""),[x,D]=g.useState(!1),[A,w]=g.useState([]),[o,b]=g.useState(0),v=g.useRef(null),k=g.useRef(""),I=g.useRef(null),T=g.useRef({x:0,y:0}),P=g.useRef(null);g.useEffect(()=>{const u="upfynai-canvas-v2-migrated";localStorage.getItem(u)||(localStorage.removeItem(J),localStorage.setItem(u,"1")),ce(()=>import("./percentages-BXMCSKIN-BzXIakGM.js").then(h=>h.i),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12])).then(h=>{l(()=>h.Excalidraw)})},[]);const M=g.useCallback(()=>{try{const u=localStorage.getItem(J);if(u)return{elements:JSON.parse(u).elements||[],appState:{viewModeEnabled:!1,gridModeEnabled:!0}}}catch{}return{elements:[],appState:{viewModeEnabled:!1,gridModeEnabled:!0}}},[]),$=g.useCallback((u,h)=>{try{localStorage.setItem(J,JSON.stringify({elements:u}))}catch{}const E=Object.keys((h==null?void 0:h.selectedElementIds)||{}).length;b(E)},[]);g.useEffect(()=>{if(!s)return;window.__excalidrawAPI=s,Te();const u=E=>{try{const S=JSON.parse(E.data);S.type==="canvas-update"&&S.elements&&s&&s.updateScene({elements:S.elements}),S.type==="canvas-block-command"&&S.action&&Re(S)}catch{}},h=window.__upfynWs;return h&&h.addEventListener("message",u),()=>{delete window.__excalidrawAPI,Be(),h&&h.removeEventListener("message",u)}},[s]),g.useEffect(()=>{if(!(!r||!x)){if(r.type==="claude-response"||r.type==="assistant"){const u=r.content||r.text||r.message||"";u&&(k.current+=u)}if(r.type==="claude-complete"||r.type==="message_stop"){const u=k.current.trim();u&&s&&(pe(u),w(h=>[...h,{role:"ai",text:u.slice(0,200)+(u.length>200?"...":"")}])),D(!1),k.current=""}}},[r,x,s]),g.useEffect(()=>{P.current&&(P.current.scrollTop=P.current.scrollHeight)},[A]);const pe=g.useCallback(u=>{if(!s)return;const h=T.current,E=h.x+300,S=h.y,{blocks:N,mermaidSections:y}=$e(u,E,S,I.current||void 0),C=[];for(const j of N)C.push(...j.elements);if(C.length>0){const j=s.getSceneElements();s.updateScene({elements:[...j,...C]}),s.scrollToContent(C)}for(const j of y)B.addNote(j.x,j.y,`[Flowchart]
28
+ `;function Le({selectedProject:n,ws:e,sendMessage:t,latestMessage:r}){const[a,l]=g.useState(null),[s,m]=g.useState(null),[d,p]=g.useState(!1),[c,f]=g.useState(""),[x,D]=g.useState(!1),[A,w]=g.useState([]),[o,b]=g.useState(0),v=g.useRef(null),k=g.useRef(""),I=g.useRef(null),T=g.useRef({x:0,y:0}),P=g.useRef(null);g.useEffect(()=>{const u="upfynai-canvas-v2-migrated";localStorage.getItem(u)||(localStorage.removeItem(q),localStorage.setItem(u,"1")),ce(()=>import("./percentages-BXMCSKIN-WVlHS4wx.js").then(h=>h.i),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12])).then(h=>{l(()=>h.Excalidraw)})},[]);const M=g.useCallback(()=>{try{const u=localStorage.getItem(q);if(u)return{elements:JSON.parse(u).elements||[],appState:{viewModeEnabled:!1,gridModeEnabled:!0}}}catch{}return{elements:[],appState:{viewModeEnabled:!1,gridModeEnabled:!0}}},[]),$=g.useCallback((u,h)=>{try{localStorage.setItem(q,JSON.stringify({elements:u}))}catch{}const E=Object.keys((h==null?void 0:h.selectedElementIds)||{}).length;b(E)},[]);g.useEffect(()=>{if(!s)return;window.__excalidrawAPI=s,Te();const u=E=>{try{const S=JSON.parse(E.data);S.type==="canvas-update"&&S.elements&&s&&s.updateScene({elements:S.elements}),S.type==="canvas-block-command"&&S.action&&Re(S)}catch{}},h=window.__upfynWs;return h&&h.addEventListener("message",u),()=>{delete window.__excalidrawAPI,Be(),h&&h.removeEventListener("message",u)}},[s]),g.useEffect(()=>{if(!(!r||!x)){if(r.type==="claude-response"||r.type==="assistant"){const u=r.content||r.text||r.message||"";u&&(k.current+=u)}if(r.type==="claude-complete"||r.type==="message_stop"){const u=k.current.trim();u&&s&&(pe(u),w(h=>[...h,{role:"ai",text:u.slice(0,200)+(u.length>200?"...":"")}])),D(!1),k.current=""}}},[r,x,s]),g.useEffect(()=>{P.current&&(P.current.scrollTop=P.current.scrollHeight)},[A]);const pe=g.useCallback(u=>{if(!s)return;const h=T.current,E=h.x+300,S=h.y,{blocks:N,mermaidSections:y}=$e(u,E,S,I.current||void 0),C=[];for(const j of N)C.push(...j.elements);if(C.length>0){const j=s.getSceneElements();s.updateScene({elements:[...j,...C]}),s.scrollToContent(C)}for(const j of y)B.addNote(j.x,j.y,`[Flowchart]
29
29
  ${j.content}`)},[s]),Q=g.useCallback(()=>{if(!s||!t||x)return;const u=oe(s),h=se(s),S=te(h.x,h.y,"Analyzing canvas..."),N=s.getSceneElements();s.updateScene({elements:[...N,...S.elements]}),I.current=S.blockId,T.current={x:h.x,y:h.y};const y=ae+u+`
30
30
 
31
31
  Analyze the canvas and provide a structured visual response.`;k.current="",D(!0),w(C=>[...C,{role:"user",text:"Run: Analyze canvas context"}]),t({type:"claude-command",command:y,options:{canvasMode:!0}})},[s,t,x]),Z=g.useCallback(()=>{t&&t({type:"cancel-command"}),D(!1),k.current=""},[t]),ee=g.useCallback(()=>{const u=c.trim();if(!u||!s||!t||x)return;const h=Pe(s),E=h||oe(s),S=h?"Selected items context":"Full canvas context",N=se(s),y=te(N.x,N.y,u),C=s.getSceneElements();s.updateScene({elements:[...C,...y.elements]}),I.current=y.blockId,T.current={x:N.x,y:N.y};const j=ae+`[${S}]
@@ -0,0 +1 @@
1
+ import{r as n,j as e}from"./vendor-react-9mUTKBHH.js";import{a as f,I as x}from"./index-ce18TYkg.js";import{e as j,f as N,g as v,Z as u,R as w,T as y,d as k,B as C,E as S,A as I}from"./vendor-icons-Lb69KSFJ.js";import"./vendor-syntax-DnmwQQJF.js";import"./vendor-markdown-BXEi_H3G.js";import"./vendor-i18n-DCFGyhQR.js";function B({selectedProject:s}){const[t,o]=n.useState(null),[r,l]=n.useState(null),[a,m]=n.useState(!0),[R,p]=n.useState(null),i=n.useCallback(async()=>{m(!0),p(null);try{const c=await f("/api/dashboard/stats");if(c.ok){const b=await c.json();o(b)}}catch{}m(!1)},[]);return n.useEffect(()=>{i()},[i]),e.jsxs("div",{className:"h-full overflow-y-auto p-4 sm:p-6 space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs("h2",{className:"text-lg font-semibold text-foreground flex items-center gap-2",children:[e.jsx(j,{className:"w-5 h-5 text-blue-500"}),"Dashboard"]}),e.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:s?`Project: ${s.displayName||s.name}`:"Overview"})]}),e.jsx("button",{onClick:i,disabled:a,className:"p-2 rounded-lg hover:bg-muted/60 text-muted-foreground hover:text-foreground transition-colors",title:"Refresh stats",children:e.jsx(N,{className:`w-4 h-4 ${a?"animate-spin":""}`})})]}),e.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3",children:[e.jsx(g,{icon:v,label:"Sessions",value:(t==null?void 0:t.total)??"—",subtext:t!=null&&t.today?`${t.today} today`:void 0,color:"blue"}),e.jsx(g,{icon:u,label:"AI Providers",value:t!=null&&t.providers?Object.keys(t.providers).length:"—",subtext:t!=null&&t.providers?Object.keys(t.providers).join(", "):void 0,color:"purple"}),x]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground mb-3 uppercase tracking-wider",children:"Quick Actions"}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-2",children:[e.jsx(h,{label:"Install CLI",description:"npm install -g upfynai-code",onClick:()=>navigator.clipboard.writeText("npm install -g upfynai-code")}),e.jsx(h,{label:"Connect Machine",description:"uc connect",onClick:()=>navigator.clipboard.writeText("uc connect")}),x]})]}),x,s&&e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground mb-3 uppercase tracking-wider",children:"Project Info"}),e.jsxs("div",{className:"rounded-lg bg-muted/30 border border-border/50 p-4 space-y-2",children:[e.jsx(d,{label:"Name",value:s.displayName||s.name}),e.jsx(d,{label:"Path",value:s.fullPath||s.path||"—"}),s.sessions&&e.jsx(d,{label:"Claude Sessions",value:String(s.sessions.length)}),s.cursorSessions&&e.jsx(d,{label:"Cursor Sessions",value:String(s.cursorSessions.length)}),s.codexSessions&&e.jsx(d,{label:"Codex Sessions",value:String(s.codexSessions.length)})]})]}),!s&&e.jsxs("div",{children:[e.jsxs("h3",{className:"text-sm font-medium text-muted-foreground mb-3 uppercase tracking-wider flex items-center gap-2",children:[e.jsx(w,{className:"w-3.5 h-3.5"}),"Getting Started"]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[e.jsxs("div",{className:"rounded-lg border border-border/50 bg-card/50 p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(y,{className:"w-4 h-4 text-blue-500"}),e.jsx("span",{className:"text-sm font-medium text-foreground",children:"1. Install the CLI"})]}),e.jsxs("p",{className:"text-xs text-muted-foreground mb-2",children:["Install globally, then run ",e.jsx("code",{className:"bg-muted px-1 rounded",children:"uc"})," to launch."]}),e.jsx("code",{className:"text-xs bg-muted/50 px-2 py-1 rounded block text-foreground/80",children:"npm install -g upfynai-code"})]}),e.jsxs("div",{className:"rounded-lg border border-border/50 bg-card/50 p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(u,{className:"w-4 h-4 text-yellow-500"}),e.jsx("span",{className:"text-sm font-medium text-foreground",children:"2. Connect Your Machine"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"Bridge your local dev environment to this web UI."}),e.jsx("code",{className:"text-xs bg-muted/50 px-2 py-1 rounded block text-foreground/80",children:"uc connect --key your_relay_token"})]}),e.jsxs("div",{className:"rounded-lg border border-border/50 bg-card/50 p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(k,{className:"w-4 h-4 text-indigo-500"}),e.jsx("span",{className:"text-sm font-medium text-foreground",children:"3. Use the Canvas"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Switch to the Canvas tab to create visual workspaces with code blocks, diagrams, and notes."})]}),e.jsxs("div",{className:"rounded-lg border border-border/50 bg-card/50 p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(C,{className:"w-4 h-4 text-emerald-500"}),e.jsx("span",{className:"text-sm font-medium text-foreground",children:"4. Chat with AI"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Use the Chat tab to talk to Claude, Cursor, or Codex. Bring your own API keys in Settings."})]})]})]})]})}function g({icon:s,label:t,value:o,subtext:r,color:l}){const a={blue:"text-blue-500 bg-blue-500/10",purple:"text-purple-500 bg-purple-500/10",amber:"text-amber-500 bg-amber-500/10",emerald:"text-emerald-500 bg-emerald-500/10"};return e.jsxs("div",{className:"rounded-lg border border-border/50 bg-card/50 p-3 sm:p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("div",{className:`w-7 h-7 rounded-md flex items-center justify-center ${a[l]}`,children:e.jsx(s,{className:"w-3.5 h-3.5"})}),e.jsx("span",{className:"text-xs text-muted-foreground",children:t})]}),e.jsx("p",{className:"text-xl font-semibold text-foreground",children:o}),r&&e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:r})]})}function h({label:s,description:t,onClick:o,href:r}){const l=r?"a":"button",a=r?{href:r,target:"_blank",rel:"noopener noreferrer"}:{onClick:o};return e.jsxs(l,{...a,className:"flex items-center justify-between p-3 rounded-lg border border-border/50 bg-card/50 hover:bg-muted/60 transition-colors text-left group",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:s}),e.jsx("p",{className:"text-xs text-muted-foreground",children:t})]}),r?e.jsx(S,{className:"w-3.5 h-3.5 text-muted-foreground group-hover:text-foreground"}):e.jsx(I,{className:"w-3.5 h-3.5 text-muted-foreground group-hover:text-foreground"})]})}function d({label:s,value:t}){return e.jsxs("div",{className:"flex items-center justify-between text-sm",children:[e.jsx("span",{className:"text-muted-foreground",children:s}),e.jsx("span",{className:"text-foreground font-mono text-xs truncate max-w-[60%] text-right",children:t})]})}export{B as default};
@@ -1,4 +1,4 @@
1
- import{a as ye,r as s,j as e}from"./vendor-react-9mUTKBHH.js";import{b as be,R as we,g as ve,c as Ne,d as de}from"./index-ClfzLIqY.js";import{x as je,a as ke,b as Ce,c as Se}from"./vendor-xterm-CZq1hqo1.js";import{X as Le}from"./vendor-icons-aNdOvTr_.js";const Re=(t,r,o,g)=>{var n,w,N,d;const y=[o,{code:r,...g||{}}];if((w=(n=t==null?void 0:t.services)==null?void 0:n.logger)!=null&&w.forward)return t.services.logger.forward(y,"warn","react-i18next::",!0);z(y[0])&&(y[0]=`react-i18next:: ${y[0]}`),(d=(N=t==null?void 0:t.services)==null?void 0:N.logger)!=null&&d.warn?t.services.logger.warn(...y):console!=null&&console.warn&&console.warn(...y)},se={},fe=(t,r,o,g)=>{z(o)&&se[o]||(z(o)&&(se[o]=new Date),Re(t,r,o,g))},xe=(t,r)=>()=>{if(t.isInitialized)r();else{const o=()=>{setTimeout(()=>{t.off("initialized",o)},0),r()};t.on("initialized",o)}},ee=(t,r,o)=>{t.loadNamespaces(r,xe(t,o))},ae=(t,r,o,g)=>{if(z(o)&&(o=[o]),t.options.preload&&t.options.preload.indexOf(r)>-1)return ee(t,o,g);o.forEach(y=>{t.options.ns.indexOf(y)<0&&t.options.ns.push(y)}),t.loadLanguages(r,xe(t,g))},Ee=(t,r,o={})=>!r.languages||!r.languages.length?(fe(r,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:r.languages}),!0):r.hasLoadedNamespace(t,{lng:o.lng,precheck:(g,y)=>{if(o.bindI18n&&o.bindI18n.indexOf("languageChanging")>-1&&g.services.backendConnector.backend&&g.isLanguageChangingTo&&!y(g.isLanguageChangingTo,t))return!1}}),z=t=>typeof t=="string",Te=t=>typeof t=="object"&&t!==null;var Y={exports:{}},Q={};/**
1
+ import{a as ye,r as s,j as e}from"./vendor-react-9mUTKBHH.js";import{b as be,R as we,g as ve,c as Ne,d as de}from"./index-ce18TYkg.js";import{x as je,a as ke,b as Ce,c as Se}from"./vendor-xterm-CZq1hqo1.js";import{X as Le}from"./vendor-icons-Lb69KSFJ.js";const Re=(t,r,o,g)=>{var n,w,N,d;const y=[o,{code:r,...g||{}}];if((w=(n=t==null?void 0:t.services)==null?void 0:n.logger)!=null&&w.forward)return t.services.logger.forward(y,"warn","react-i18next::",!0);z(y[0])&&(y[0]=`react-i18next:: ${y[0]}`),(d=(N=t==null?void 0:t.services)==null?void 0:N.logger)!=null&&d.warn?t.services.logger.warn(...y):console!=null&&console.warn&&console.warn(...y)},se={},fe=(t,r,o,g)=>{z(o)&&se[o]||(z(o)&&(se[o]=new Date),Re(t,r,o,g))},xe=(t,r)=>()=>{if(t.isInitialized)r();else{const o=()=>{setTimeout(()=>{t.off("initialized",o)},0),r()};t.on("initialized",o)}},ee=(t,r,o)=>{t.loadNamespaces(r,xe(t,o))},ae=(t,r,o,g)=>{if(z(o)&&(o=[o]),t.options.preload&&t.options.preload.indexOf(r)>-1)return ee(t,o,g);o.forEach(y=>{t.options.ns.indexOf(y)<0&&t.options.ns.push(y)}),t.loadLanguages(r,xe(t,g))},Ee=(t,r,o={})=>!r.languages||!r.languages.length?(fe(r,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:r.languages}),!0):r.hasLoadedNamespace(t,{lng:o.lng,precheck:(g,y)=>{if(o.bindI18n&&o.bindI18n.indexOf("languageChanging")>-1&&g.services.backendConnector.backend&&g.isLanguageChangingTo&&!y(g.isLanguageChangingTo,t))return!1}}),z=t=>typeof t=="string",Te=t=>typeof t=="object"&&t!==null;var Y={exports:{}},Q={};/**
2
2
  * @license React
3
3
  * use-sync-external-store-shim.production.js
4
4
  *
@@ -0,0 +1 @@
1
+ import{r as a,j as e,v as W}from"./vendor-react-9mUTKBHH.js";import{L as Z,C as _,a as D,b as H}from"./LoginModal-CZDEzqjK.js";import{u as K,a as m}from"./index-ce18TYkg.js";import{R as P,G,L as Q,C as x,a as X,b as R,c as ee,U as te,M as se,T as re,d as ae,Z as ne}from"./vendor-icons-Lb69KSFJ.js";import"./vendor-xterm-CZq1hqo1.js";import"./vendor-syntax-DnmwQQJF.js";import"./vendor-markdown-BXEi_H3G.js";import"./vendor-i18n-DCFGyhQR.js";const ge=({onComplete:y})=>{const[r,g]=a.useState(0),[h,C]=a.useState(""),[u,k]=a.useState(""),[i,f]=a.useState(!1),[S,o]=a.useState(""),[n,b]=a.useState(null),[q]=a.useState({name:"default",fullPath:""}),[l,j]=a.useState({authenticated:!1,email:null,loading:!0,error:null}),[d,N]=a.useState({authenticated:!1,email:null,loading:!0,error:null}),[c,v]=a.useState({authenticated:!1,email:null,loading:!0,error:null}),{user:p}=K(),A=a.useRef(void 0);a.useEffect(()=>{$()},[]);const $=async()=>{try{const t=await m("/api/user/git-config");if(t.ok){const s=await t.json();s.gitName&&C(s.gitName),s.gitEmail&&k(s.gitEmail)}}catch(t){console.error("Error loading git config:",t)}};a.useEffect(()=>{const t=A.current;A.current=n,(t===void 0||t!==null&&n===null)&&(L(),E(),F())},[n]);const L=async()=>{try{const t=await m("/api/cli/claude/status");if(t.ok){const s=await t.json();j({authenticated:s.authenticated,email:s.email,loading:!1,error:s.error||null})}else j({authenticated:!1,email:null,loading:!1,error:"Failed to check authentication status"})}catch(t){console.error("Error checking Claude auth status:",t),j({authenticated:!1,email:null,loading:!1,error:t.message})}},E=async()=>{try{const t=await m("/api/cli/cursor/status");if(t.ok){const s=await t.json();N({authenticated:s.authenticated,email:s.email,loading:!1,error:s.error||null})}else N({authenticated:!1,email:null,loading:!1,error:"Failed to check authentication status"})}catch(t){console.error("Error checking Cursor auth status:",t),N({authenticated:!1,email:null,loading:!1,error:t.message})}},F=async()=>{try{const t=await m("/api/cli/codex/status");if(t.ok){const s=await t.json();v({authenticated:s.authenticated,email:s.email,loading:!1,error:s.error||null})}else v({authenticated:!1,email:null,loading:!1,error:"Failed to check authentication status"})}catch(t){console.error("Error checking Codex auth status:",t),v({authenticated:!1,email:null,loading:!1,error:t.message})}},M=()=>b("claude"),T=()=>b("cursor"),O=()=>b("codex"),U=t=>{t===0&&(n==="claude"?L():n==="cursor"?E():n==="codex"&&F())},B=async()=>{if(o(""),r===0){g(1);return}if(r===1){if(!h.trim()||!u.trim()){o("Both git name and email are required");return}if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(u)){o("Please enter a valid email address");return}f(!0);try{const s=await m("/api/user/git-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({gitName:h,gitEmail:u})});if(!s.ok){const I=await s.json();throw new Error(I.error||"Failed to save git configuration")}g(2)}catch(s){o(s.message)}finally{f(!1)}return}g(r+1)},Y=()=>{o(""),g(r-1)},z=async()=>{f(!0),o("");try{const t=await m("/api/user/complete-onboarding",{method:"POST"});if(!t.ok){const s=await t.json();throw new Error(s.error||"Failed to complete onboarding")}y&&y()}catch(t){o(t.message)}finally{f(!1)}},w=[{title:"Welcome",description:"Get to know Upfyn-Code",icon:P,required:!1},{title:"Git Configuration",description:"Set up your git identity for commits",icon:G,required:!0},{title:"Connect Agents",description:"Connect your AI coding assistants",icon:Q,required:!1}],J=()=>{switch(r){case 0:return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"text-center mb-6",children:[e.jsx("div",{className:"w-20 h-20 bg-gradient-to-br from-blue-500 to-indigo-600 rounded-2xl flex items-center justify-center mx-auto mb-5 shadow-lg shadow-blue-500/20",children:e.jsx(P,{className:"w-10 h-10 text-white"})}),e.jsxs("h2",{className:"text-2xl font-bold text-foreground mb-2",children:["Welcome to Upfyn-Code",p!=null&&p.first_name?`, ${p.first_name}`:"","!"]}),e.jsx("p",{className:"text-muted-foreground max-w-md mx-auto",children:"Your visual AI coding interface. Let's get you set up in under a minute."})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[e.jsxs("div",{className:"border border-border rounded-lg p-4 text-center bg-card",children:[e.jsx("div",{className:"w-10 h-10 bg-blue-100 dark:bg-blue-900/30 rounded-lg flex items-center justify-center mx-auto mb-2",children:e.jsx(re,{className:"w-5 h-5 text-blue-500"})}),e.jsx("p",{className:"text-sm font-medium text-foreground",children:"AI Agents"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Claude, Cursor, Codex — all in one place"})]}),e.jsxs("div",{className:"border border-border rounded-lg p-4 text-center bg-card",children:[e.jsx("div",{className:"w-10 h-10 bg-indigo-100 dark:bg-indigo-900/30 rounded-lg flex items-center justify-center mx-auto mb-2",children:e.jsx(ae,{className:"w-5 h-5 text-indigo-500"})}),e.jsx("p",{className:"text-sm font-medium text-foreground",children:"Canvas"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Visual workspace with code, diagrams & notes"})]}),e.jsxs("div",{className:"border border-border rounded-lg p-4 text-center bg-card",children:[e.jsx("div",{className:"w-10 h-10 bg-yellow-100 dark:bg-yellow-900/30 rounded-lg flex items-center justify-center mx-auto mb-2",children:e.jsx(ne,{className:"w-5 h-5 text-yellow-500"})}),e.jsx("p",{className:"text-sm font-medium text-foreground",children:"Relay"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Bridge your local machine to the web UI"})]})]}),e.jsx("div",{className:"text-center pt-2",children:e.jsx("p",{className:"text-xs text-muted-foreground",children:"Two quick steps ahead: git identity + optional agent connections"})})]});case 1:return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"text-center mb-8",children:[e.jsx("div",{className:"w-16 h-16 bg-blue-100 dark:bg-blue-900/30 rounded-full flex items-center justify-center mx-auto mb-4",children:e.jsx(G,{className:"w-8 h-8 text-blue-600 dark:text-blue-400"})}),e.jsx("h2",{className:"text-2xl font-bold text-foreground mb-2",children:"Git Configuration"}),e.jsx("p",{className:"text-muted-foreground",children:"Configure your git identity to ensure proper attribution for your commits"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"gitName",className:"flex items-center gap-2 text-sm font-medium text-foreground mb-2",children:[e.jsx(te,{className:"w-4 h-4"}),"Git Name ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx("input",{type:"text",id:"gitName",value:h,onChange:t=>C(t.target.value),className:"w-full px-4 py-3 border border-border rounded-lg bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"John Doe",required:!0,disabled:i}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"This will be used as: git config --global user.name"})]}),e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"gitEmail",className:"flex items-center gap-2 text-sm font-medium text-foreground mb-2",children:[e.jsx(se,{className:"w-4 h-4"}),"Git Email ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx("input",{type:"email",id:"gitEmail",value:u,onChange:t=>k(t.target.value),className:"w-full px-4 py-3 border border-border rounded-lg bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"john@example.com",required:!0,disabled:i}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"This will be used as: git config --global user.email"})]})]})]});case 2:return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"text-center mb-6",children:[e.jsx("h2",{className:"text-2xl font-bold text-foreground mb-2",children:"Connect Your AI Agents"}),e.jsx("p",{className:"text-muted-foreground",children:"Login to one or more AI coding assistants. All are optional."})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:`border rounded-lg p-4 transition-colors ${l.authenticated?"bg-blue-50 dark:bg-blue-900/20 border-blue-200 dark:border-blue-800":"border-border bg-card"}`,children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 bg-blue-100 dark:bg-blue-900/30 rounded-full flex items-center justify-center",children:e.jsx(_,{size:20})}),e.jsxs("div",{children:[e.jsxs("div",{className:"font-medium text-foreground flex items-center gap-2",children:["Claude Code",l.authenticated&&e.jsx(x,{className:"w-4 h-4 text-green-500"})]}),e.jsx("div",{className:"text-xs text-muted-foreground",children:l.loading?"Checking...":l.authenticated?l.email||"Connected":"Not connected"})]})]}),!l.authenticated&&!l.loading&&e.jsx("button",{onClick:M,className:"bg-blue-600 hover:bg-blue-700 text-white text-sm font-medium py-2 px-4 rounded-lg transition-colors",children:"Login"})]})}),e.jsx("div",{className:`border rounded-lg p-4 transition-colors ${d.authenticated?"bg-purple-50 dark:bg-purple-900/20 border-purple-200 dark:border-purple-800":"border-border bg-card"}`,children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 bg-purple-100 dark:bg-purple-900/30 rounded-full flex items-center justify-center",children:e.jsx(D,{size:20})}),e.jsxs("div",{children:[e.jsxs("div",{className:"font-medium text-foreground flex items-center gap-2",children:["Cursor",d.authenticated&&e.jsx(x,{className:"w-4 h-4 text-green-500"})]}),e.jsx("div",{className:"text-xs text-muted-foreground",children:d.loading?"Checking...":d.authenticated?d.email||"Connected":"Not connected"})]})]}),!d.authenticated&&!d.loading&&e.jsx("button",{onClick:T,className:"bg-purple-600 hover:bg-purple-700 text-white text-sm font-medium py-2 px-4 rounded-lg transition-colors",children:"Login"})]})}),e.jsx("div",{className:`border rounded-lg p-4 transition-colors ${c.authenticated?"bg-gray-100 dark:bg-gray-800/50 border-gray-300 dark:border-gray-600":"border-border bg-card"}`,children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 bg-gray-100 dark:bg-gray-800 rounded-full flex items-center justify-center",children:e.jsx(H,{className:"w-5 h-5"})}),e.jsxs("div",{children:[e.jsxs("div",{className:"font-medium text-foreground flex items-center gap-2",children:["OpenAI Codex",c.authenticated&&e.jsx(x,{className:"w-4 h-4 text-green-500"})]}),e.jsx("div",{className:"text-xs text-muted-foreground",children:c.loading?"Checking...":c.authenticated?c.email||"Connected":"Not connected"})]})]}),!c.authenticated&&!c.loading&&e.jsx("button",{onClick:O,className:"bg-gray-800 hover:bg-gray-900 dark:bg-gray-700 dark:hover:bg-gray-600 text-white text-sm font-medium py-2 px-4 rounded-lg transition-colors",children:"Login"})]})})]}),e.jsx("div",{className:"text-center text-sm text-muted-foreground pt-2",children:e.jsx("p",{children:"You can configure these later in Settings."})})]});default:return null}},V=()=>{switch(r){case 0:return!0;case 1:return h.trim()&&u.trim()&&/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(u);case 2:return!0;default:return!1}};return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center p-4",children:e.jsxs("div",{className:"w-full max-w-2xl",children:[e.jsx("div",{className:"mb-8",children:e.jsx("div",{className:"flex items-center justify-between",children:w.map((t,s)=>e.jsxs(W.Fragment,{children:[e.jsxs("div",{className:"flex flex-col items-center flex-1",children:[e.jsx("div",{className:`w-12 h-12 rounded-full flex items-center justify-center border-2 transition-colors duration-200 ${s<r?"bg-green-500 border-green-500 text-white":s===r?"bg-blue-600 border-blue-600 text-white":"bg-background border-border text-muted-foreground"}`,children:s<r?e.jsx(x,{className:"w-6 h-6"}):typeof t.icon=="function"?e.jsx(t.icon,{}):e.jsx(t.icon,{className:"w-6 h-6"})}),e.jsxs("div",{className:"mt-2 text-center",children:[e.jsx("p",{className:`text-sm font-medium ${s===r?"text-foreground":"text-muted-foreground"}`,children:t.title}),t.required&&e.jsx("span",{className:"text-xs text-red-500",children:"Required"})]})]}),s<w.length-1&&e.jsx("div",{className:`flex-1 h-0.5 mx-2 transition-colors duration-200 ${s<r?"bg-green-500":"bg-border"}`})]},s))})}),e.jsxs("div",{className:"bg-card rounded-lg shadow-lg border border-border p-8",children:[J(),S&&e.jsx("div",{className:"mt-6 p-4 bg-red-100 dark:bg-red-900/20 border border-red-300 dark:border-red-800 rounded-lg",children:e.jsx("p",{className:"text-sm text-red-700 dark:text-red-400",children:S})}),e.jsxs("div",{className:"flex items-center justify-between mt-8 pt-6 border-t border-border",children:[e.jsxs("button",{onClick:Y,disabled:r===0||i,className:"flex items-center gap-2 px-4 py-2 text-sm font-medium text-muted-foreground hover:text-foreground disabled:opacity-50 disabled:cursor-not-allowed transition-colors duration-200",children:[e.jsx(X,{className:"w-4 h-4"}),"Previous"]}),e.jsx("div",{className:"flex items-center gap-3",children:r<w.length-1?e.jsx("button",{onClick:B,disabled:!V()||i,className:"flex items-center gap-2 px-6 py-3 bg-blue-600 hover:bg-blue-700 disabled:bg-blue-400 disabled:cursor-not-allowed text-white font-medium rounded-lg transition-colors duration-200",children:i?e.jsxs(e.Fragment,{children:[e.jsx(R,{className:"w-4 h-4 animate-spin"}),"Saving..."]}):e.jsxs(e.Fragment,{children:["Next",e.jsx(ee,{className:"w-4 h-4"})]})}):e.jsx("button",{onClick:z,disabled:i,className:"flex items-center gap-2 px-6 py-3 bg-green-600 hover:bg-green-700 disabled:bg-green-400 disabled:cursor-not-allowed text-white font-medium rounded-lg transition-colors duration-200",children:i?e.jsxs(e.Fragment,{children:[e.jsx(R,{className:"w-4 h-4 animate-spin"}),"Completing..."]}):e.jsxs(e.Fragment,{children:[e.jsx(x,{className:"w-4 h-4"}),"Complete Setup"]})})})]})]})]})}),n&&e.jsx(Z,{isOpen:!!n,onClose:()=>b(null),provider:n,project:q,onComplete:U,isOnboarding:!0})]})};export{ge as default};
@@ -1 +1 @@
1
- import{r as t,j as e}from"./vendor-react-9mUTKBHH.js";import{u as y}from"./index-ClfzLIqY.js";import"./vendor-syntax-DnmwQQJF.js";import"./vendor-markdown-BXEi_H3G.js";import"./vendor-icons-aNdOvTr_.js";import"./vendor-i18n-DCFGyhQR.js";const q=()=>{const[a,f]=t.useState(""),[d,p]=t.useState(""),[l,x]=t.useState(""),[n,g]=t.useState(""),[u,h]=t.useState(""),[s,i]=t.useState(!1),[c,o]=t.useState(""),{register:j}=y(),N=async r=>{if(r.preventDefault(),o(""),n!==u){o("Passwords do not match");return}if(!a.trim()||a.trim().length<2){o("Name must be at least 2 characters");return}if(!d.trim()||!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(d)){o("Please enter a valid email address");return}if(n.length<6){o("Password must be at least 6 characters");return}i(!0);const m=a.trim().split(" "),w=m[0]||a.trim(),v=m.slice(1).join(" ")||"",b=await j(w,v,n,d.trim(),l.trim()||null);b.success||o(b.error),i(!1)};return e.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center p-4",children:e.jsx("div",{className:"w-full max-w-md",children:e.jsxs("div",{className:"bg-card rounded-lg shadow-lg border border-border p-8 space-y-6",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"flex justify-center mb-4",children:e.jsx("img",{src:"/logo.svg",alt:"Upfyn-Code",className:"w-16 h-16",onError:r=>{r.target.style.display="none"}})}),e.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Create Your Account"}),e.jsx("p",{className:"text-muted-foreground mt-2",children:"Sign up to start using Upfyn-Code"})]}),e.jsxs("form",{onSubmit:N,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"name",className:"block text-sm font-medium text-foreground mb-1",children:"Full Name"}),e.jsx("input",{type:"text",id:"name",value:a,onChange:r=>f(r.target.value),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"Your full name",required:!0,disabled:s})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"email",className:"block text-sm font-medium text-foreground mb-1",children:"Email"}),e.jsx("input",{type:"email",id:"email",value:d,onChange:r=>p(r.target.value),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"you@example.com",required:!0,disabled:s})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"phone",className:"block text-sm font-medium text-foreground mb-1",children:"Mobile Number"}),e.jsx("input",{type:"tel",id:"phone",value:l,onChange:r=>x(r.target.value),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"+91 9876543210",disabled:s})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"password",className:"block text-sm font-medium text-foreground mb-1",children:"Password"}),e.jsx("input",{type:"password",id:"password",value:n,onChange:r=>g(r.target.value),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"At least 6 characters",required:!0,disabled:s})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"confirmPassword",className:"block text-sm font-medium text-foreground mb-1",children:"Confirm Password"}),e.jsx("input",{type:"password",id:"confirmPassword",value:u,onChange:r=>h(r.target.value),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"Confirm your password",required:!0,disabled:s})]}),c&&e.jsx("div",{className:"p-3 bg-red-100 dark:bg-red-900/20 border border-red-300 dark:border-red-800 rounded-md",children:e.jsx("p",{className:"text-sm text-red-700 dark:text-red-400",children:c})}),e.jsx("button",{type:"submit",disabled:s,className:"w-full bg-blue-600 hover:bg-blue-700 disabled:bg-blue-400 text-white font-medium py-2 px-4 rounded-md transition-colors duration-200",children:s?"Creating account...":"Create Account"})]})]})})})};export{q as default};
1
+ import{r as t,j as e}from"./vendor-react-9mUTKBHH.js";import{u as y}from"./index-ce18TYkg.js";import"./vendor-syntax-DnmwQQJF.js";import"./vendor-markdown-BXEi_H3G.js";import"./vendor-icons-Lb69KSFJ.js";import"./vendor-i18n-DCFGyhQR.js";const q=()=>{const[a,f]=t.useState(""),[d,p]=t.useState(""),[l,x]=t.useState(""),[n,g]=t.useState(""),[u,h]=t.useState(""),[s,i]=t.useState(!1),[c,o]=t.useState(""),{register:j}=y(),N=async r=>{if(r.preventDefault(),o(""),n!==u){o("Passwords do not match");return}if(!a.trim()||a.trim().length<2){o("Name must be at least 2 characters");return}if(!d.trim()||!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(d)){o("Please enter a valid email address");return}if(n.length<6){o("Password must be at least 6 characters");return}i(!0);const m=a.trim().split(" "),w=m[0]||a.trim(),v=m.slice(1).join(" ")||"",b=await j(w,v,n,d.trim(),l.trim()||null);b.success||o(b.error),i(!1)};return e.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center p-4",children:e.jsx("div",{className:"w-full max-w-md",children:e.jsxs("div",{className:"bg-card rounded-lg shadow-lg border border-border p-8 space-y-6",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"flex justify-center mb-4",children:e.jsx("img",{src:"/logo.svg",alt:"Upfyn-Code",className:"w-16 h-16",onError:r=>{r.target.style.display="none"}})}),e.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Create Your Account"}),e.jsx("p",{className:"text-muted-foreground mt-2",children:"Sign up to start using Upfyn-Code"})]}),e.jsxs("form",{onSubmit:N,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"name",className:"block text-sm font-medium text-foreground mb-1",children:"Full Name"}),e.jsx("input",{type:"text",id:"name",value:a,onChange:r=>f(r.target.value),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"Your full name",required:!0,disabled:s})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"email",className:"block text-sm font-medium text-foreground mb-1",children:"Email"}),e.jsx("input",{type:"email",id:"email",value:d,onChange:r=>p(r.target.value),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"you@example.com",required:!0,disabled:s})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"phone",className:"block text-sm font-medium text-foreground mb-1",children:"Mobile Number"}),e.jsx("input",{type:"tel",id:"phone",value:l,onChange:r=>x(r.target.value),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"+91 9876543210",disabled:s})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"password",className:"block text-sm font-medium text-foreground mb-1",children:"Password"}),e.jsx("input",{type:"password",id:"password",value:n,onChange:r=>g(r.target.value),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"At least 6 characters",required:!0,disabled:s})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"confirmPassword",className:"block text-sm font-medium text-foreground mb-1",children:"Confirm Password"}),e.jsx("input",{type:"password",id:"confirmPassword",value:u,onChange:r=>h(r.target.value),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"Confirm your password",required:!0,disabled:s})]}),c&&e.jsx("div",{className:"p-3 bg-red-100 dark:bg-red-900/20 border border-red-300 dark:border-red-800 rounded-md",children:e.jsx("p",{className:"text-sm text-red-700 dark:text-red-400",children:c})}),e.jsx("button",{type:"submit",disabled:s,className:"w-full bg-blue-600 hover:bg-blue-700 disabled:bg-blue-400 text-white font-medium py-2 px-4 rounded-md transition-colors duration-200",children:s?"Creating account...":"Create Account"})]})]})})})};export{q as default};
@@ -1 +1 @@
1
- import{r as s,j as e,v as ee}from"./vendor-react-9mUTKBHH.js";import{a as C}from"./index-ClfzLIqY.js";import{P as A,Z as M,T as te,b as Z,f as V,H as K,g as X,h as q,i as z,j as J,k as B,e as se,G as re,l as oe,S as ae,m as ne,n as le,o as Y,X as de,C as ce,p as ie}from"./vendor-icons-aNdOvTr_.js";import"./vendor-syntax-DnmwQQJF.js";import"./vendor-markdown-BXEi_H3G.js";import"./vendor-i18n-DCFGyhQR.js";function ue({onEdit:a,onCreate:E,refreshKey:y}){const[f,T]=s.useState([]),[k,j]=s.useState(!0),[x,b]=s.useState(null),[m,N]=s.useState(null),[d,S]=s.useState(null),[p,L]=s.useState([]),[D,W]=s.useState(!1),w=s.useCallback(async()=>{try{const o=await C("/api/workflows");if(o.ok){const r=await o.json();T(r.workflows||[])}}catch{}j(!1)},[]);s.useEffect(()=>{w()},[w,y]);const P=async o=>{if(d===o){S(null);return}S(o),W(!0);try{const r=await C(`/api/workflows/${o}/runs`);if(r.ok){const g=await r.json();L(g.runs||[])}}catch{L([])}W(!1)},$=async o=>{try{await C(`/api/workflows/${o}`,{method:"DELETE"}),w()}catch{}},v=async o=>{var r;b(o),N(null);try{const u=await(await C(`/api/workflows/${o}/run`,{method:"POST"})).json();N({id:o,success:u.success,message:u.success?`Completed ${((r=u.results)==null?void 0:r.length)||0} steps`:u.error||"Failed",results:u.results}),w()}catch{N({id:o,success:!1,message:"Network error"})}b(null)};return k?e.jsx("div",{className:"flex items-center justify-center py-12 text-muted-foreground text-sm",children:"Loading workflows..."}):e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Workflows"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Natural language automation with webhook integrations"})]}),e.jsxs("button",{onClick:E,className:"flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium bg-primary text-primary-foreground rounded-lg hover:bg-primary/90 transition-colors",children:[e.jsx(A,{className:"w-3.5 h-3.5"}),"New Workflow"]})]}),f.length===0?e.jsxs("div",{className:"text-center py-16",children:[e.jsx("div",{className:"w-14 h-14 mx-auto mb-4 bg-muted/50 rounded-full flex items-center justify-center",children:e.jsx(M,{className:"w-7 h-7 text-muted-foreground/40"})}),e.jsx("h4",{className:"text-sm font-medium text-foreground mb-1",children:"No workflows yet"}),e.jsx("p",{className:"text-xs text-muted-foreground/60 max-w-xs mx-auto",children:"Create a workflow to automate tasks. Chain AI prompts, webhook calls, and conditions together."}),e.jsxs("button",{onClick:E,className:"mt-4 flex items-center gap-1.5 px-4 py-2 text-xs font-medium bg-primary text-primary-foreground rounded-lg hover:bg-primary/90 transition-colors mx-auto",children:[e.jsx(A,{className:"w-3.5 h-3.5"}),"Create Your First Workflow"]})]}):e.jsx("div",{className:"space-y-2",children:f.map(o=>e.jsxs("div",{className:"bg-muted/20 border border-border/30 rounded-xl p-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h4",{className:"text-sm font-semibold text-foreground",children:o.name}),o.description&&e.jsx("p",{className:"text-xs text-muted-foreground/70 mt-0.5",children:o.description}),e.jsxs("div",{className:"flex items-center gap-1 mt-2 flex-wrap",children:[o.steps.map((r,g)=>e.jsxs(ee.Fragment,{children:[e.jsx("span",{className:`inline-flex items-center gap-1 text-[10px] px-1.5 py-0.5 rounded ${r.type==="ai-prompt"?"bg-blue-500/10 text-blue-400":r.type==="webhook"?"bg-yellow-500/10 text-yellow-400":r.type==="delay"?"bg-purple-500/10 text-purple-400":"bg-green-500/10 text-green-400"}`,children:r.label}),g<o.steps.length-1&&e.jsx("span",{className:"text-[10px] text-muted-foreground/30",children:"→"})]},r.id||g)),o.steps.length===0&&e.jsx("span",{className:"text-[10px] text-muted-foreground/40",children:"No steps"})]}),e.jsxs("div",{className:"flex items-center gap-3 mt-2 text-[10px] text-muted-foreground/40 flex-wrap",children:[e.jsxs("span",{children:[o.steps.length," step",o.steps.length!==1?"s":""]}),o.schedule&&o.schedule_enabled?e.jsxs("span",{className:"flex items-center gap-1 text-primary/70",children:[e.jsx(te,{className:"w-2.5 h-2.5"}),o.schedule]}):null,o.last_run&&e.jsxs("span",{children:["Last run: ",new Date(o.last_run).toLocaleString()]})]})]}),e.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[e.jsxs("button",{onClick:()=>v(o.id),disabled:x===o.id||o.steps.length===0,className:"flex items-center gap-1 px-2.5 py-1.5 text-xs font-medium bg-green-500/10 text-green-400 hover:bg-green-500/20 rounded-lg transition-colors disabled:opacity-40",title:"Run workflow",children:[x===o.id?e.jsx(Z,{className:"w-3 h-3 animate-spin"}):e.jsx(V,{className:"w-3 h-3"}),"Run"]}),e.jsx("button",{onClick:()=>P(o.id),className:`p-1.5 transition-colors ${d===o.id?"text-primary":"text-muted-foreground hover:text-foreground"}`,title:"Execution history",children:e.jsx(K,{className:"w-3.5 h-3.5"})}),e.jsx("button",{onClick:()=>a(o),className:"p-1.5 text-muted-foreground hover:text-foreground transition-colors",title:"Edit",children:e.jsx(X,{className:"w-3.5 h-3.5"})}),e.jsx("button",{onClick:()=>$(o.id),className:"p-1.5 text-muted-foreground hover:text-red-400 transition-colors",title:"Delete",children:e.jsx(q,{className:"w-3.5 h-3.5"})})]})]}),(m==null?void 0:m.id)===o.id&&e.jsxs("div",{className:`mt-3 p-2.5 rounded-lg text-xs ${m.success?"bg-green-500/5 border border-green-500/20":"bg-red-500/5 border border-red-500/20"}`,children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[m.success?e.jsx(z,{className:"w-3.5 h-3.5 text-green-400"}):e.jsx(J,{className:"w-3.5 h-3.5 text-red-400"}),e.jsx("span",{className:m.success?"text-green-400":"text-red-400",children:m.message})]}),m.results&&e.jsx("div",{className:"space-y-1 mt-2",children:m.results.map((r,g)=>{var u;return e.jsxs("div",{className:"flex items-center gap-1.5 text-[10px]",children:[r.success?e.jsx(z,{className:"w-2.5 h-2.5 text-green-400/60"}):e.jsx(J,{className:"w-2.5 h-2.5 text-red-400/60"}),e.jsx("span",{className:"text-muted-foreground",children:r.label}),((u=r.result)==null?void 0:u.status)&&e.jsxs("span",{className:"text-muted-foreground/40",children:["(",r.result.status,")"]}),r.error&&e.jsx("span",{className:"text-red-400/60",children:r.error})]},g)})})]}),d===o.id&&e.jsxs("div",{className:"mt-3 border-t border-border/20 pt-3",children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-2",children:[e.jsx(K,{className:"w-3 h-3 text-muted-foreground"}),e.jsx("span",{className:"text-[11px] font-medium text-foreground",children:"Execution History"})]}),D?e.jsx("div",{className:"text-[10px] text-muted-foreground/50 py-2",children:"Loading..."}):p.length===0?e.jsx("div",{className:"text-[10px] text-muted-foreground/40 py-2",children:"No runs yet"}):e.jsx("div",{className:"space-y-1.5 max-h-48 overflow-y-auto",children:p.map(r=>e.jsxs("div",{className:"flex items-start gap-2 text-[10px] bg-muted/10 rounded-lg p-2",children:[e.jsx("div",{className:"shrink-0 mt-0.5",children:r.status==="completed"?e.jsx(z,{className:"w-3 h-3 text-green-400"}):r.status==="failed"?e.jsx(J,{className:"w-3 h-3 text-red-400"}):r.status==="running"?e.jsx(Z,{className:"w-3 h-3 text-yellow-400 animate-spin"}):e.jsx(B,{className:"w-3 h-3 text-muted-foreground"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:`font-medium ${r.status==="completed"?"text-green-400":r.status==="failed"?"text-red-400":"text-muted-foreground"}`,children:r.status==="completed"?"Success":r.status==="failed"?"Failed":r.status}),e.jsxs("span",{className:"text-muted-foreground/30",children:[r.steps_completed,"/",r.total_steps," steps"]}),e.jsx("span",{className:"text-muted-foreground/30",children:new Date(r.started_at).toLocaleString()})]}),r.error&&e.jsx("p",{className:"text-red-400/70 mt-0.5 truncate",children:r.error}),r.completed_at&&e.jsxs("span",{className:"text-muted-foreground/20",children:["Duration: ",Math.round((new Date(r.completed_at).getTime()-new Date(r.started_at).getTime())/1e3),"s"]})]})]},r.id))})]})]},o.id))})]})}const G=[{value:"ai-prompt",label:"AI Prompt",icon:se,color:"text-blue-400 bg-blue-500/10"},{value:"webhook",label:"Webhook",icon:M,color:"text-yellow-400 bg-yellow-500/10"},{value:"delay",label:"Delay",icon:B,color:"text-purple-400 bg-purple-500/10"},{value:"condition",label:"Condition",icon:re,color:"text-green-400 bg-green-500/10"}];let xe=0;const me=()=>`step_${Date.now()}_${++xe}`,he=[{label:"Every minute",cron:"* * * * *"},{label:"Every 5 minutes",cron:"*/5 * * * *"},{label:"Every 15 minutes",cron:"*/15 * * * *"},{label:"Every hour",cron:"0 * * * *"},{label:"Every 6 hours",cron:"0 */6 * * *"},{label:"Daily at midnight",cron:"0 0 * * *"},{label:"Daily at 9 AM",cron:"0 9 * * *"},{label:"Weekly (Monday)",cron:"0 9 * * 1"},{label:"Monthly (1st)",cron:"0 0 1 * *"}];function pe({workflow:a,onSave:E,onCancel:y}){const[f,T]=s.useState((a==null?void 0:a.name)||""),[k,j]=s.useState((a==null?void 0:a.description)||""),[x,b]=s.useState((a==null?void 0:a.steps)||[]),[m,N]=s.useState((a==null?void 0:a.schedule)||""),[d,S]=s.useState(!!(a!=null&&a.schedule_enabled)),[p,L]=s.useState((a==null?void 0:a.schedule_timezone)||Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"),[D,W]=s.useState([]),[w,P]=s.useState(!1),[$,v]=s.useState(""),[o,r]=s.useState(null),[g,u]=s.useState(!1);s.useEffect(()=>{C("/api/webhooks").then(t=>t.json()).then(t=>{W(t.webhooks||[])}).catch(()=>{})},[]);const F=s.useCallback(t=>{const i=G.find(c=>c.value===t),n={id:me(),type:t,label:(i==null?void 0:i.label)||t,config:t==="delay"?{seconds:5}:{},order:x.length};b(c=>[...c,n]),r(n.id),u(!1)},[x.length]),_=s.useCallback(t=>{b(i=>i.filter(n=>n.id!==t).map((n,c)=>({...n,order:c}))),o===t&&r(null)},[o]),O=s.useCallback((t,i)=>{b(n=>{const c=n.findIndex(H=>H.id===t);if(c<0)return n;const h=i==="up"?c-1:c+1;if(h<0||h>=n.length)return n;const l=[...n];return[l[c],l[h]]=[l[h],l[c]],l.map((H,Q)=>({...H,order:Q}))})},[]),I=s.useCallback((t,i,n)=>{b(c=>c.map(h=>h.id===t?{...h,config:{...h.config,[i]:n}}:h))},[]),R=s.useCallback((t,i)=>{b(n=>n.map(c=>c.id===t?{...c,label:i}:c))},[]),U=async()=>{if(v(""),!f.trim()){v("Workflow name is required");return}if(x.length===0){v("Add at least one step");return}P(!0);try{const t={name:f,description:k,steps:x,schedule:m||null,schedule_enabled:d,schedule_timezone:p},i=a!=null&&a.id?`/api/workflows/${a.id}`:"/api/workflows",n=a!=null&&a.id?"PUT":"POST",c=await C(i,{method:n,headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!c.ok){const h=await c.json();v(h.error||"Failed to save"),P(!1);return}E()}catch{v("Network error")}P(!1)};return e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-border/30",children:[e.jsx("button",{onClick:y,className:"text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(oe,{className:"w-4 h-4"})}),e.jsx("span",{className:"text-sm font-semibold text-foreground",children:a!=null&&a.id?"Edit Workflow":"New Workflow"}),e.jsx("div",{className:"flex-1"}),e.jsxs("button",{onClick:U,disabled:w,className:"flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium bg-primary text-primary-foreground rounded-lg hover:bg-primary/90 transition-colors disabled:opacity-50",children:[e.jsx(ae,{className:"w-3.5 h-3.5"}),w?"Saving...":"Save"]})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-[11px] text-muted-foreground mb-1 block",children:"Workflow Name"}),e.jsx("input",{value:f,onChange:t=>T(t.target.value),placeholder:"My Workflow",className:"w-full px-3 py-2 text-sm bg-background border border-border/50 rounded-lg text-foreground placeholder-muted-foreground/50 focus:outline-none focus:border-primary/50"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-[11px] text-muted-foreground mb-1 block",children:"Description"}),e.jsx("textarea",{value:k,onChange:t=>j(t.target.value),placeholder:"What does this workflow do?",rows:2,className:"w-full px-3 py-2 text-xs bg-background border border-border/50 rounded-lg text-foreground placeholder-muted-foreground/50 focus:outline-none focus:border-primary/50 resize-none"})]})]}),e.jsxs("div",{className:"bg-muted/20 border border-border/30 rounded-xl p-3 space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-xs font-semibold text-foreground flex items-center gap-1.5",children:[e.jsx(B,{className:"w-3.5 h-3.5"}),"Schedule (Cron Job)"]}),e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("span",{className:"text-[10px] text-muted-foreground",children:d?"Enabled":"Disabled"}),e.jsx("div",{onClick:()=>S(!d),className:`relative w-8 h-4 rounded-full transition-colors cursor-pointer ${d?"bg-primary":"bg-muted"}`,children:e.jsx("div",{className:`absolute top-0.5 w-3 h-3 rounded-full bg-white transition-transform ${d?"translate-x-4":"translate-x-0.5"}`})})]})]}),d&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] text-muted-foreground mb-0.5 block",children:"Cron Expression"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{value:m,onChange:t=>N(t.target.value),placeholder:"*/15 * * * *",className:"flex-1 px-2 py-1 text-xs bg-background border border-border/50 rounded text-foreground placeholder-muted-foreground/50 focus:outline-none focus:border-primary/50 font-mono"}),e.jsxs("select",{value:m,onChange:t=>N(t.target.value),className:"px-2 py-1 text-xs bg-background border border-border/50 rounded text-foreground focus:outline-none focus:border-primary/50",children:[e.jsx("option",{value:"",children:"Presets..."}),he.map(t=>e.jsx("option",{value:t.cron,children:t.label},t.cron))]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] text-muted-foreground mb-0.5 block",children:"Timezone"}),e.jsx("input",{value:p,onChange:t=>L(t.target.value),placeholder:"UTC",className:"w-48 px-2 py-1 text-xs bg-background border border-border/50 rounded text-foreground placeholder-muted-foreground/50 focus:outline-none focus:border-primary/50"})]}),e.jsx("p",{className:"text-[10px] text-muted-foreground/50",children:'Runs automatically when the server is online. Missed runs while offline appear as "missed" in execution history.'})]})]}),e.jsxs("div",{children:[e.jsx("div",{className:"flex items-center justify-between mb-2",children:e.jsxs("span",{className:"text-xs font-semibold text-foreground",children:["Steps (",x.length,")"]})}),x.length===0?e.jsx("div",{className:"text-center py-8 border border-dashed border-border/40 rounded-xl",children:e.jsx("p",{className:"text-xs text-muted-foreground/60",children:"No steps yet. Add your first step below."})}):e.jsx("div",{className:"space-y-2",children:x.map((t,i)=>{const n=G.find(l=>l.value===t.type),c=(n==null?void 0:n.icon)||M,h=o===t.id;return e.jsxs("div",{className:"bg-muted/20 border border-border/30 rounded-xl overflow-hidden",children:[e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 cursor-pointer hover:bg-muted/30 transition-colors",onClick:()=>r(h?null:t.id),children:[e.jsx("span",{className:"text-xs text-muted-foreground/50 w-5 text-center font-mono",children:i+1}),e.jsx("div",{className:`p-1 rounded ${(n==null?void 0:n.color)||"bg-muted text-muted-foreground"}`,children:e.jsx(c,{className:"w-3 h-3"})}),e.jsx("span",{className:"text-xs font-medium text-foreground flex-1 min-w-0 truncate",children:t.label}),e.jsx("span",{className:"text-[10px] text-muted-foreground/50",children:n==null?void 0:n.label}),e.jsxs("div",{className:"flex items-center gap-0.5",children:[e.jsx("button",{onClick:l=>{l.stopPropagation(),O(t.id,"up")},disabled:i===0,className:"p-0.5 text-muted-foreground/40 hover:text-foreground disabled:opacity-20",children:e.jsx(ne,{className:"w-3 h-3"})}),e.jsx("button",{onClick:l=>{l.stopPropagation(),O(t.id,"down")},disabled:i===x.length-1,className:"p-0.5 text-muted-foreground/40 hover:text-foreground disabled:opacity-20",children:e.jsx(le,{className:"w-3 h-3"})}),e.jsx("button",{onClick:l=>{l.stopPropagation(),_(t.id)},className:"p-0.5 text-muted-foreground/40 hover:text-red-400",children:e.jsx(q,{className:"w-3 h-3"})})]})]}),h&&e.jsxs("div",{className:"px-3 pb-3 pt-1 border-t border-border/20 space-y-2",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] text-muted-foreground mb-0.5 block",children:"Step Label"}),e.jsx("input",{value:t.label,onChange:l=>R(t.id,l.target.value),className:"w-full px-2 py-1 text-xs bg-background border border-border/50 rounded text-foreground focus:outline-none focus:border-primary/50"})]}),t.type==="ai-prompt"&&e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] text-muted-foreground mb-0.5 block",children:"Prompt"}),e.jsx("textarea",{value:t.config.prompt||"",onChange:l=>I(t.id,"prompt",l.target.value),placeholder:"Describe what the AI should do...",rows:3,className:"w-full px-2 py-1 text-xs bg-background border border-border/50 rounded text-foreground placeholder-muted-foreground/50 focus:outline-none focus:border-primary/50 resize-none"})]}),t.type==="webhook"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] text-muted-foreground mb-0.5 block",children:"Webhook"}),e.jsxs("select",{value:t.config.webhookId||"",onChange:l=>I(t.id,"webhookId",l.target.value),className:"w-full px-2 py-1 text-xs bg-background border border-border/50 rounded text-foreground focus:outline-none focus:border-primary/50",children:[e.jsx("option",{value:"",children:"Select a webhook..."}),D.map(l=>e.jsxs("option",{value:l.id,children:[l.name," (",l.method," ",l.url,")"]},l.id))]}),D.length===0&&e.jsx("p",{className:"text-[10px] text-muted-foreground/50 mt-1",children:"No webhooks created yet. Go to the Webhooks tab to create one."})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] text-muted-foreground mb-0.5 block",children:"Payload Template (JSON, optional)"}),e.jsx("textarea",{value:t.config.payloadTemplate||"",onChange:l=>I(t.id,"payloadTemplate",l.target.value),placeholder:'{"key": "value"}',rows:2,className:"w-full px-2 py-1 text-xs bg-background border border-border/50 rounded text-foreground placeholder-muted-foreground/50 focus:outline-none focus:border-primary/50 resize-none font-mono"})]})]}),t.type==="delay"&&e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] text-muted-foreground mb-0.5 block",children:"Delay (seconds, max 30)"}),e.jsx("input",{type:"number",min:1,max:30,value:t.config.seconds||5,onChange:l=>I(t.id,"seconds",Math.min(30,Math.max(1,parseInt(l.target.value)||1))),className:"w-24 px-2 py-1 text-xs bg-background border border-border/50 rounded text-foreground focus:outline-none focus:border-primary/50"})]}),t.type==="condition"&&e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] text-muted-foreground mb-0.5 block",children:"Condition Expression"}),e.jsx("input",{value:t.config.expression||"",onChange:l=>I(t.id,"expression",l.target.value),placeholder:"e.g. response.status === 200",className:"w-full px-2 py-1 text-xs bg-background border border-border/50 rounded text-foreground placeholder-muted-foreground/50 focus:outline-none focus:border-primary/50 font-mono"}),e.jsx("p",{className:"text-[10px] text-muted-foreground/40 mt-0.5",children:"Condition evaluation coming soon"})]})]})]},t.id)})}),e.jsxs("div",{className:"relative mt-3",children:[e.jsxs("button",{onClick:()=>u(!g),className:"w-full flex items-center justify-center gap-1.5 py-2 text-xs text-muted-foreground hover:text-foreground border border-dashed border-border/40 hover:border-border/60 rounded-xl transition-colors",children:[e.jsx(A,{className:"w-3.5 h-3.5"}),"Add Step"]}),g&&e.jsx("div",{className:"absolute left-1/2 -translate-x-1/2 bottom-full mb-1 z-10 bg-card border border-border/50 rounded-xl shadow-xl p-1.5 min-w-[180px]",children:G.map(t=>{const i=t.icon;return e.jsxs("button",{onClick:()=>F(t.value),className:"w-full text-left px-3 py-1.5 text-xs text-foreground hover:bg-muted/50 rounded-lg flex items-center gap-2",children:[e.jsx("div",{className:`p-1 rounded ${t.color}`,children:e.jsx(i,{className:"w-3 h-3"})}),t.label]},t.value)})})]})]}),$&&e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-red-400",children:[e.jsx(Y,{className:"w-3.5 h-3.5"}),$]})]})]})}const be=["GET","POST","PUT","PATCH","DELETE"];function ge({onWebhooksChange:a}){const[E,y]=s.useState([]),[f,T]=s.useState(!0),[k,j]=s.useState(!1),[x,b]=s.useState(null),[m,N]=s.useState(null),[d,S]=s.useState(null),[p,L]=s.useState(""),[D,W]=s.useState(""),[w,P]=s.useState("POST"),[$,v]=s.useState("{}"),[o,r]=s.useState(""),[g,u]=s.useState(""),F=s.useCallback(async()=>{try{const t=await C("/api/webhooks");if(t.ok){const i=await t.json();y(i.webhooks||[])}}catch{}T(!1)},[]);s.useEffect(()=>{F()},[F]);const _=()=>{L(""),W(""),P("POST"),v("{}"),r(""),u(""),b(null),j(!1)},O=t=>{L(t.name),W(t.url),P(t.method),v(t.headers||"{}"),r(t.description||""),b(t.id),j(!0),u("")},I=async()=>{if(u(""),!p.trim()){u("Name is required");return}if(!D.trim()){u("URL is required");return}try{new URL(D)}catch{u("Invalid URL");return}try{JSON.parse($)}catch{u("Headers must be valid JSON");return}try{const t={name:p,url:D,method:w,headers:$,description:o},i=x?`/api/webhooks/${x}`:"/api/webhooks",c=await C(i,{method:x?"PUT":"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!c.ok){const h=await c.json();u(h.error||"Failed to save");return}_(),F(),a==null||a()}catch{u("Network error")}},R=async t=>{try{await C(`/api/webhooks/${t}`,{method:"DELETE"}),F(),a==null||a()}catch{}},U=async t=>{N(t),S(null);try{const n=await(await C(`/api/webhooks/${t}/test`,{method:"POST"})).json();S({id:t,result:n.result,success:n.success})}catch{S({id:t,result:{error:"Network error"},success:!1})}N(null)};return f?e.jsx("div",{className:"flex items-center justify-center py-12 text-muted-foreground text-sm",children:"Loading webhooks..."}):e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Webhooks"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Endpoints that workflows can call during execution"})]}),!k&&e.jsxs("button",{onClick:()=>{_(),j(!0)},className:"flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium bg-primary text-primary-foreground rounded-lg hover:bg-primary/90 transition-colors",children:[e.jsx(A,{className:"w-3.5 h-3.5"}),"Add Webhook"]})]}),k&&e.jsxs("div",{className:"bg-muted/30 border border-border/50 rounded-xl p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs font-medium text-foreground",children:x?"Edit Webhook":"New Webhook"}),e.jsx("button",{onClick:_,className:"text-muted-foreground hover:text-foreground",children:e.jsx(de,{className:"w-4 h-4"})})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-[11px] text-muted-foreground mb-1 block",children:"Name"}),e.jsx("input",{value:p,onChange:t=>L(t.target.value),placeholder:"My Webhook",className:"w-full px-3 py-1.5 text-xs bg-background border border-border/50 rounded-lg text-foreground placeholder-muted-foreground/50 focus:outline-none focus:border-primary/50"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-[11px] text-muted-foreground mb-1 block",children:"Method"}),e.jsx("select",{value:w,onChange:t=>P(t.target.value),className:"w-full px-3 py-1.5 text-xs bg-background border border-border/50 rounded-lg text-foreground focus:outline-none focus:border-primary/50",children:be.map(t=>e.jsx("option",{value:t,children:t},t))})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-[11px] text-muted-foreground mb-1 block",children:"URL"}),e.jsx("input",{value:D,onChange:t=>W(t.target.value),placeholder:"https://example.com/webhook",className:"w-full px-3 py-1.5 text-xs bg-background border border-border/50 rounded-lg text-foreground placeholder-muted-foreground/50 focus:outline-none focus:border-primary/50"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-[11px] text-muted-foreground mb-1 block",children:"Headers (JSON)"}),e.jsx("textarea",{value:$,onChange:t=>v(t.target.value),placeholder:'{"Authorization": "Bearer ..."}',rows:2,className:"w-full px-3 py-1.5 text-xs bg-background border border-border/50 rounded-lg text-foreground placeholder-muted-foreground/50 focus:outline-none focus:border-primary/50 font-mono resize-none"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-[11px] text-muted-foreground mb-1 block",children:"Description"}),e.jsx("input",{value:o,onChange:t=>r(t.target.value),placeholder:"Optional description...",className:"w-full px-3 py-1.5 text-xs bg-background border border-border/50 rounded-lg text-foreground placeholder-muted-foreground/50 focus:outline-none focus:border-primary/50"})]}),g&&e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-red-400",children:[e.jsx(Y,{className:"w-3.5 h-3.5"}),g]}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx("button",{onClick:_,className:"px-3 py-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors",children:"Cancel"}),e.jsxs("button",{onClick:I,className:"flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium bg-primary text-primary-foreground rounded-lg hover:bg-primary/90 transition-colors",children:[e.jsx(ce,{className:"w-3.5 h-3.5"}),x?"Update":"Create"]})]})]}),E.length===0&&!k?e.jsxs("div",{className:"text-center py-12",children:[e.jsx("div",{className:"w-12 h-12 mx-auto mb-3 bg-muted/50 rounded-full flex items-center justify-center",children:e.jsx(M,{className:"w-6 h-6 text-muted-foreground/50"})}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"No webhooks yet"}),e.jsx("p",{className:"text-xs text-muted-foreground/60 mt-1",children:"Create a webhook to use in your workflows"})]}):e.jsx("div",{className:"space-y-2",children:E.map(t=>e.jsxs("div",{className:"bg-muted/20 border border-border/30 rounded-xl p-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs font-semibold text-foreground",children:t.name}),e.jsx("span",{className:`text-[10px] px-1.5 py-0.5 rounded font-mono ${t.method==="GET"?"bg-green-500/10 text-green-400":t.method==="POST"?"bg-blue-500/10 text-blue-400":t.method==="PUT"?"bg-yellow-500/10 text-yellow-400":t.method==="DELETE"?"bg-red-500/10 text-red-400":"bg-muted text-muted-foreground"}`,children:t.method})]}),e.jsx("p",{className:"text-[11px] text-muted-foreground font-mono mt-0.5 truncate",children:t.url}),t.description&&e.jsx("p",{className:"text-[11px] text-muted-foreground/60 mt-0.5",children:t.description}),t.last_triggered&&e.jsxs("p",{className:"text-[10px] text-muted-foreground/40 mt-1",children:["Last triggered: ",new Date(t.last_triggered).toLocaleString()]})]}),e.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[e.jsx("button",{onClick:()=>U(t.id),disabled:m===t.id,className:"p-1.5 text-muted-foreground hover:text-green-400 transition-colors disabled:opacity-50",title:"Test webhook",children:m===t.id?e.jsx("div",{className:"w-3.5 h-3.5 border-2 border-muted-foreground/30 border-t-muted-foreground rounded-full animate-spin"}):e.jsx(V,{className:"w-3.5 h-3.5"})}),e.jsx("button",{onClick:()=>O(t),className:"p-1.5 text-muted-foreground hover:text-foreground transition-colors",title:"Edit",children:e.jsx(X,{className:"w-3.5 h-3.5"})}),e.jsx("button",{onClick:()=>R(t.id),className:"p-1.5 text-muted-foreground hover:text-red-400 transition-colors",title:"Delete",children:e.jsx(q,{className:"w-3.5 h-3.5"})})]})]}),(d==null?void 0:d.id)===t.id&&e.jsx("div",{className:`mt-2 p-2 rounded-lg text-xs ${d.success?"bg-green-500/5 border border-green-500/20":"bg-red-500/5 border border-red-500/20"}`,children:d.result.error?e.jsx("span",{className:"text-red-400",children:d.result.error}):e.jsxs("div",{children:[e.jsxs("span",{className:d.result.status&&d.result.status<400?"text-green-400":"text-red-400",children:[d.result.status," ",d.result.statusText]}),d.result.body&&e.jsx("pre",{className:"mt-1 text-[10px] text-muted-foreground font-mono overflow-x-auto max-h-24 overflow-y-auto",children:typeof d.result.body=="string"?d.result.body:JSON.stringify(d.result.body,null,2)})]})})]},t.id))})]})}function Se({selectedProject:a}){const[E,y]=s.useState("list"),[f,T]=s.useState("workflows"),[k,j]=s.useState(null),[x,b]=s.useState(0),m=s.useCallback(p=>{j(p),y("editor")},[]),N=s.useCallback(()=>{j(null),y("editor")},[]),d=s.useCallback(()=>{y("list"),T("workflows"),j(null),b(p=>p+1)},[]),S=s.useCallback(()=>{y("list"),j(null)},[]);return E==="editor"?e.jsx("div",{className:"h-full",children:e.jsx(pe,{workflow:k,onSave:d,onCancel:S})}):e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsx("div",{className:"flex-shrink-0 px-4 pt-3 pb-0",children:e.jsxs("div",{className:"inline-flex items-center bg-muted/40 rounded-lg p-[3px] gap-[2px]",children:[e.jsxs("button",{onClick:()=>T("workflows"),className:`flex items-center gap-1.5 px-3 py-[5px] text-xs font-medium rounded-md transition-all duration-150 ${f==="workflows"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[e.jsx(M,{className:"w-3 h-3"}),"Workflows"]}),e.jsxs("button",{onClick:()=>T("webhooks"),className:`flex items-center gap-1.5 px-3 py-[5px] text-xs font-medium rounded-md transition-all duration-150 ${f==="webhooks"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[e.jsx(ie,{className:"w-3 h-3"}),"Webhooks"]})]})}),e.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:f==="workflows"?e.jsx(ue,{onEdit:m,onCreate:N,refreshKey:x}):e.jsx(ge,{onWebhooksChange:()=>b(p=>p+1)})})]})}export{Se as default};
1
+ import{r as s,j as e,v as ee}from"./vendor-react-9mUTKBHH.js";import{a as C}from"./index-ce18TYkg.js";import{P as A,Z as M,h as te,b as Z,i as V,H as K,j as X,k as G,l as z,m as J,n as B,g as se,G as re,o as oe,S as ae,p as ne,q as le,r as Y,X as de,C as ce,s as ie}from"./vendor-icons-Lb69KSFJ.js";import"./vendor-syntax-DnmwQQJF.js";import"./vendor-markdown-BXEi_H3G.js";import"./vendor-i18n-DCFGyhQR.js";function ue({onEdit:a,onCreate:E,refreshKey:y}){const[f,T]=s.useState([]),[k,j]=s.useState(!0),[x,b]=s.useState(null),[m,N]=s.useState(null),[d,S]=s.useState(null),[p,L]=s.useState([]),[D,W]=s.useState(!1),w=s.useCallback(async()=>{try{const o=await C("/api/workflows");if(o.ok){const r=await o.json();T(r.workflows||[])}}catch{}j(!1)},[]);s.useEffect(()=>{w()},[w,y]);const P=async o=>{if(d===o){S(null);return}S(o),W(!0);try{const r=await C(`/api/workflows/${o}/runs`);if(r.ok){const g=await r.json();L(g.runs||[])}}catch{L([])}W(!1)},$=async o=>{try{await C(`/api/workflows/${o}`,{method:"DELETE"}),w()}catch{}},v=async o=>{var r;b(o),N(null);try{const u=await(await C(`/api/workflows/${o}/run`,{method:"POST"})).json();N({id:o,success:u.success,message:u.success?`Completed ${((r=u.results)==null?void 0:r.length)||0} steps`:u.error||"Failed",results:u.results}),w()}catch{N({id:o,success:!1,message:"Network error"})}b(null)};return k?e.jsx("div",{className:"flex items-center justify-center py-12 text-muted-foreground text-sm",children:"Loading workflows..."}):e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Workflows"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Natural language automation with webhook integrations"})]}),e.jsxs("button",{onClick:E,className:"flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium bg-primary text-primary-foreground rounded-lg hover:bg-primary/90 transition-colors",children:[e.jsx(A,{className:"w-3.5 h-3.5"}),"New Workflow"]})]}),f.length===0?e.jsxs("div",{className:"text-center py-16",children:[e.jsx("div",{className:"w-14 h-14 mx-auto mb-4 bg-muted/50 rounded-full flex items-center justify-center",children:e.jsx(M,{className:"w-7 h-7 text-muted-foreground/40"})}),e.jsx("h4",{className:"text-sm font-medium text-foreground mb-1",children:"No workflows yet"}),e.jsx("p",{className:"text-xs text-muted-foreground/60 max-w-xs mx-auto",children:"Create a workflow to automate tasks. Chain AI prompts, webhook calls, and conditions together."}),e.jsxs("button",{onClick:E,className:"mt-4 flex items-center gap-1.5 px-4 py-2 text-xs font-medium bg-primary text-primary-foreground rounded-lg hover:bg-primary/90 transition-colors mx-auto",children:[e.jsx(A,{className:"w-3.5 h-3.5"}),"Create Your First Workflow"]})]}):e.jsx("div",{className:"space-y-2",children:f.map(o=>e.jsxs("div",{className:"bg-muted/20 border border-border/30 rounded-xl p-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h4",{className:"text-sm font-semibold text-foreground",children:o.name}),o.description&&e.jsx("p",{className:"text-xs text-muted-foreground/70 mt-0.5",children:o.description}),e.jsxs("div",{className:"flex items-center gap-1 mt-2 flex-wrap",children:[o.steps.map((r,g)=>e.jsxs(ee.Fragment,{children:[e.jsx("span",{className:`inline-flex items-center gap-1 text-[10px] px-1.5 py-0.5 rounded ${r.type==="ai-prompt"?"bg-blue-500/10 text-blue-400":r.type==="webhook"?"bg-yellow-500/10 text-yellow-400":r.type==="delay"?"bg-purple-500/10 text-purple-400":"bg-green-500/10 text-green-400"}`,children:r.label}),g<o.steps.length-1&&e.jsx("span",{className:"text-[10px] text-muted-foreground/30",children:"→"})]},r.id||g)),o.steps.length===0&&e.jsx("span",{className:"text-[10px] text-muted-foreground/40",children:"No steps"})]}),e.jsxs("div",{className:"flex items-center gap-3 mt-2 text-[10px] text-muted-foreground/40 flex-wrap",children:[e.jsxs("span",{children:[o.steps.length," step",o.steps.length!==1?"s":""]}),o.schedule&&o.schedule_enabled?e.jsxs("span",{className:"flex items-center gap-1 text-primary/70",children:[e.jsx(te,{className:"w-2.5 h-2.5"}),o.schedule]}):null,o.last_run&&e.jsxs("span",{children:["Last run: ",new Date(o.last_run).toLocaleString()]})]})]}),e.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[e.jsxs("button",{onClick:()=>v(o.id),disabled:x===o.id||o.steps.length===0,className:"flex items-center gap-1 px-2.5 py-1.5 text-xs font-medium bg-green-500/10 text-green-400 hover:bg-green-500/20 rounded-lg transition-colors disabled:opacity-40",title:"Run workflow",children:[x===o.id?e.jsx(Z,{className:"w-3 h-3 animate-spin"}):e.jsx(V,{className:"w-3 h-3"}),"Run"]}),e.jsx("button",{onClick:()=>P(o.id),className:`p-1.5 transition-colors ${d===o.id?"text-primary":"text-muted-foreground hover:text-foreground"}`,title:"Execution history",children:e.jsx(K,{className:"w-3.5 h-3.5"})}),e.jsx("button",{onClick:()=>a(o),className:"p-1.5 text-muted-foreground hover:text-foreground transition-colors",title:"Edit",children:e.jsx(X,{className:"w-3.5 h-3.5"})}),e.jsx("button",{onClick:()=>$(o.id),className:"p-1.5 text-muted-foreground hover:text-red-400 transition-colors",title:"Delete",children:e.jsx(G,{className:"w-3.5 h-3.5"})})]})]}),(m==null?void 0:m.id)===o.id&&e.jsxs("div",{className:`mt-3 p-2.5 rounded-lg text-xs ${m.success?"bg-green-500/5 border border-green-500/20":"bg-red-500/5 border border-red-500/20"}`,children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[m.success?e.jsx(z,{className:"w-3.5 h-3.5 text-green-400"}):e.jsx(J,{className:"w-3.5 h-3.5 text-red-400"}),e.jsx("span",{className:m.success?"text-green-400":"text-red-400",children:m.message})]}),m.results&&e.jsx("div",{className:"space-y-1 mt-2",children:m.results.map((r,g)=>{var u;return e.jsxs("div",{className:"flex items-center gap-1.5 text-[10px]",children:[r.success?e.jsx(z,{className:"w-2.5 h-2.5 text-green-400/60"}):e.jsx(J,{className:"w-2.5 h-2.5 text-red-400/60"}),e.jsx("span",{className:"text-muted-foreground",children:r.label}),((u=r.result)==null?void 0:u.status)&&e.jsxs("span",{className:"text-muted-foreground/40",children:["(",r.result.status,")"]}),r.error&&e.jsx("span",{className:"text-red-400/60",children:r.error})]},g)})})]}),d===o.id&&e.jsxs("div",{className:"mt-3 border-t border-border/20 pt-3",children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-2",children:[e.jsx(K,{className:"w-3 h-3 text-muted-foreground"}),e.jsx("span",{className:"text-[11px] font-medium text-foreground",children:"Execution History"})]}),D?e.jsx("div",{className:"text-[10px] text-muted-foreground/50 py-2",children:"Loading..."}):p.length===0?e.jsx("div",{className:"text-[10px] text-muted-foreground/40 py-2",children:"No runs yet"}):e.jsx("div",{className:"space-y-1.5 max-h-48 overflow-y-auto",children:p.map(r=>e.jsxs("div",{className:"flex items-start gap-2 text-[10px] bg-muted/10 rounded-lg p-2",children:[e.jsx("div",{className:"shrink-0 mt-0.5",children:r.status==="completed"?e.jsx(z,{className:"w-3 h-3 text-green-400"}):r.status==="failed"?e.jsx(J,{className:"w-3 h-3 text-red-400"}):r.status==="running"?e.jsx(Z,{className:"w-3 h-3 text-yellow-400 animate-spin"}):e.jsx(B,{className:"w-3 h-3 text-muted-foreground"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:`font-medium ${r.status==="completed"?"text-green-400":r.status==="failed"?"text-red-400":"text-muted-foreground"}`,children:r.status==="completed"?"Success":r.status==="failed"?"Failed":r.status}),e.jsxs("span",{className:"text-muted-foreground/30",children:[r.steps_completed,"/",r.total_steps," steps"]}),e.jsx("span",{className:"text-muted-foreground/30",children:new Date(r.started_at).toLocaleString()})]}),r.error&&e.jsx("p",{className:"text-red-400/70 mt-0.5 truncate",children:r.error}),r.completed_at&&e.jsxs("span",{className:"text-muted-foreground/20",children:["Duration: ",Math.round((new Date(r.completed_at).getTime()-new Date(r.started_at).getTime())/1e3),"s"]})]})]},r.id))})]})]},o.id))})]})}const q=[{value:"ai-prompt",label:"AI Prompt",icon:se,color:"text-blue-400 bg-blue-500/10"},{value:"webhook",label:"Webhook",icon:M,color:"text-yellow-400 bg-yellow-500/10"},{value:"delay",label:"Delay",icon:B,color:"text-purple-400 bg-purple-500/10"},{value:"condition",label:"Condition",icon:re,color:"text-green-400 bg-green-500/10"}];let xe=0;const me=()=>`step_${Date.now()}_${++xe}`,he=[{label:"Every minute",cron:"* * * * *"},{label:"Every 5 minutes",cron:"*/5 * * * *"},{label:"Every 15 minutes",cron:"*/15 * * * *"},{label:"Every hour",cron:"0 * * * *"},{label:"Every 6 hours",cron:"0 */6 * * *"},{label:"Daily at midnight",cron:"0 0 * * *"},{label:"Daily at 9 AM",cron:"0 9 * * *"},{label:"Weekly (Monday)",cron:"0 9 * * 1"},{label:"Monthly (1st)",cron:"0 0 1 * *"}];function pe({workflow:a,onSave:E,onCancel:y}){const[f,T]=s.useState((a==null?void 0:a.name)||""),[k,j]=s.useState((a==null?void 0:a.description)||""),[x,b]=s.useState((a==null?void 0:a.steps)||[]),[m,N]=s.useState((a==null?void 0:a.schedule)||""),[d,S]=s.useState(!!(a!=null&&a.schedule_enabled)),[p,L]=s.useState((a==null?void 0:a.schedule_timezone)||Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"),[D,W]=s.useState([]),[w,P]=s.useState(!1),[$,v]=s.useState(""),[o,r]=s.useState(null),[g,u]=s.useState(!1);s.useEffect(()=>{C("/api/webhooks").then(t=>t.json()).then(t=>{W(t.webhooks||[])}).catch(()=>{})},[]);const F=s.useCallback(t=>{const i=q.find(c=>c.value===t),n={id:me(),type:t,label:(i==null?void 0:i.label)||t,config:t==="delay"?{seconds:5}:{},order:x.length};b(c=>[...c,n]),r(n.id),u(!1)},[x.length]),_=s.useCallback(t=>{b(i=>i.filter(n=>n.id!==t).map((n,c)=>({...n,order:c}))),o===t&&r(null)},[o]),O=s.useCallback((t,i)=>{b(n=>{const c=n.findIndex(H=>H.id===t);if(c<0)return n;const h=i==="up"?c-1:c+1;if(h<0||h>=n.length)return n;const l=[...n];return[l[c],l[h]]=[l[h],l[c]],l.map((H,Q)=>({...H,order:Q}))})},[]),I=s.useCallback((t,i,n)=>{b(c=>c.map(h=>h.id===t?{...h,config:{...h.config,[i]:n}}:h))},[]),R=s.useCallback((t,i)=>{b(n=>n.map(c=>c.id===t?{...c,label:i}:c))},[]),U=async()=>{if(v(""),!f.trim()){v("Workflow name is required");return}if(x.length===0){v("Add at least one step");return}P(!0);try{const t={name:f,description:k,steps:x,schedule:m||null,schedule_enabled:d,schedule_timezone:p},i=a!=null&&a.id?`/api/workflows/${a.id}`:"/api/workflows",n=a!=null&&a.id?"PUT":"POST",c=await C(i,{method:n,headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!c.ok){const h=await c.json();v(h.error||"Failed to save"),P(!1);return}E()}catch{v("Network error")}P(!1)};return e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-border/30",children:[e.jsx("button",{onClick:y,className:"text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(oe,{className:"w-4 h-4"})}),e.jsx("span",{className:"text-sm font-semibold text-foreground",children:a!=null&&a.id?"Edit Workflow":"New Workflow"}),e.jsx("div",{className:"flex-1"}),e.jsxs("button",{onClick:U,disabled:w,className:"flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium bg-primary text-primary-foreground rounded-lg hover:bg-primary/90 transition-colors disabled:opacity-50",children:[e.jsx(ae,{className:"w-3.5 h-3.5"}),w?"Saving...":"Save"]})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-[11px] text-muted-foreground mb-1 block",children:"Workflow Name"}),e.jsx("input",{value:f,onChange:t=>T(t.target.value),placeholder:"My Workflow",className:"w-full px-3 py-2 text-sm bg-background border border-border/50 rounded-lg text-foreground placeholder-muted-foreground/50 focus:outline-none focus:border-primary/50"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-[11px] text-muted-foreground mb-1 block",children:"Description"}),e.jsx("textarea",{value:k,onChange:t=>j(t.target.value),placeholder:"What does this workflow do?",rows:2,className:"w-full px-3 py-2 text-xs bg-background border border-border/50 rounded-lg text-foreground placeholder-muted-foreground/50 focus:outline-none focus:border-primary/50 resize-none"})]})]}),e.jsxs("div",{className:"bg-muted/20 border border-border/30 rounded-xl p-3 space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-xs font-semibold text-foreground flex items-center gap-1.5",children:[e.jsx(B,{className:"w-3.5 h-3.5"}),"Schedule (Cron Job)"]}),e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("span",{className:"text-[10px] text-muted-foreground",children:d?"Enabled":"Disabled"}),e.jsx("div",{onClick:()=>S(!d),className:`relative w-8 h-4 rounded-full transition-colors cursor-pointer ${d?"bg-primary":"bg-muted"}`,children:e.jsx("div",{className:`absolute top-0.5 w-3 h-3 rounded-full bg-white transition-transform ${d?"translate-x-4":"translate-x-0.5"}`})})]})]}),d&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] text-muted-foreground mb-0.5 block",children:"Cron Expression"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{value:m,onChange:t=>N(t.target.value),placeholder:"*/15 * * * *",className:"flex-1 px-2 py-1 text-xs bg-background border border-border/50 rounded text-foreground placeholder-muted-foreground/50 focus:outline-none focus:border-primary/50 font-mono"}),e.jsxs("select",{value:m,onChange:t=>N(t.target.value),className:"px-2 py-1 text-xs bg-background border border-border/50 rounded text-foreground focus:outline-none focus:border-primary/50",children:[e.jsx("option",{value:"",children:"Presets..."}),he.map(t=>e.jsx("option",{value:t.cron,children:t.label},t.cron))]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] text-muted-foreground mb-0.5 block",children:"Timezone"}),e.jsx("input",{value:p,onChange:t=>L(t.target.value),placeholder:"UTC",className:"w-48 px-2 py-1 text-xs bg-background border border-border/50 rounded text-foreground placeholder-muted-foreground/50 focus:outline-none focus:border-primary/50"})]}),e.jsx("p",{className:"text-[10px] text-muted-foreground/50",children:'Runs automatically when the server is online. Missed runs while offline appear as "missed" in execution history.'})]})]}),e.jsxs("div",{children:[e.jsx("div",{className:"flex items-center justify-between mb-2",children:e.jsxs("span",{className:"text-xs font-semibold text-foreground",children:["Steps (",x.length,")"]})}),x.length===0?e.jsx("div",{className:"text-center py-8 border border-dashed border-border/40 rounded-xl",children:e.jsx("p",{className:"text-xs text-muted-foreground/60",children:"No steps yet. Add your first step below."})}):e.jsx("div",{className:"space-y-2",children:x.map((t,i)=>{const n=q.find(l=>l.value===t.type),c=(n==null?void 0:n.icon)||M,h=o===t.id;return e.jsxs("div",{className:"bg-muted/20 border border-border/30 rounded-xl overflow-hidden",children:[e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 cursor-pointer hover:bg-muted/30 transition-colors",onClick:()=>r(h?null:t.id),children:[e.jsx("span",{className:"text-xs text-muted-foreground/50 w-5 text-center font-mono",children:i+1}),e.jsx("div",{className:`p-1 rounded ${(n==null?void 0:n.color)||"bg-muted text-muted-foreground"}`,children:e.jsx(c,{className:"w-3 h-3"})}),e.jsx("span",{className:"text-xs font-medium text-foreground flex-1 min-w-0 truncate",children:t.label}),e.jsx("span",{className:"text-[10px] text-muted-foreground/50",children:n==null?void 0:n.label}),e.jsxs("div",{className:"flex items-center gap-0.5",children:[e.jsx("button",{onClick:l=>{l.stopPropagation(),O(t.id,"up")},disabled:i===0,className:"p-0.5 text-muted-foreground/40 hover:text-foreground disabled:opacity-20",children:e.jsx(ne,{className:"w-3 h-3"})}),e.jsx("button",{onClick:l=>{l.stopPropagation(),O(t.id,"down")},disabled:i===x.length-1,className:"p-0.5 text-muted-foreground/40 hover:text-foreground disabled:opacity-20",children:e.jsx(le,{className:"w-3 h-3"})}),e.jsx("button",{onClick:l=>{l.stopPropagation(),_(t.id)},className:"p-0.5 text-muted-foreground/40 hover:text-red-400",children:e.jsx(G,{className:"w-3 h-3"})})]})]}),h&&e.jsxs("div",{className:"px-3 pb-3 pt-1 border-t border-border/20 space-y-2",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] text-muted-foreground mb-0.5 block",children:"Step Label"}),e.jsx("input",{value:t.label,onChange:l=>R(t.id,l.target.value),className:"w-full px-2 py-1 text-xs bg-background border border-border/50 rounded text-foreground focus:outline-none focus:border-primary/50"})]}),t.type==="ai-prompt"&&e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] text-muted-foreground mb-0.5 block",children:"Prompt"}),e.jsx("textarea",{value:t.config.prompt||"",onChange:l=>I(t.id,"prompt",l.target.value),placeholder:"Describe what the AI should do...",rows:3,className:"w-full px-2 py-1 text-xs bg-background border border-border/50 rounded text-foreground placeholder-muted-foreground/50 focus:outline-none focus:border-primary/50 resize-none"})]}),t.type==="webhook"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] text-muted-foreground mb-0.5 block",children:"Webhook"}),e.jsxs("select",{value:t.config.webhookId||"",onChange:l=>I(t.id,"webhookId",l.target.value),className:"w-full px-2 py-1 text-xs bg-background border border-border/50 rounded text-foreground focus:outline-none focus:border-primary/50",children:[e.jsx("option",{value:"",children:"Select a webhook..."}),D.map(l=>e.jsxs("option",{value:l.id,children:[l.name," (",l.method," ",l.url,")"]},l.id))]}),D.length===0&&e.jsx("p",{className:"text-[10px] text-muted-foreground/50 mt-1",children:"No webhooks created yet. Go to the Webhooks tab to create one."})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] text-muted-foreground mb-0.5 block",children:"Payload Template (JSON, optional)"}),e.jsx("textarea",{value:t.config.payloadTemplate||"",onChange:l=>I(t.id,"payloadTemplate",l.target.value),placeholder:'{"key": "value"}',rows:2,className:"w-full px-2 py-1 text-xs bg-background border border-border/50 rounded text-foreground placeholder-muted-foreground/50 focus:outline-none focus:border-primary/50 resize-none font-mono"})]})]}),t.type==="delay"&&e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] text-muted-foreground mb-0.5 block",children:"Delay (seconds, max 30)"}),e.jsx("input",{type:"number",min:1,max:30,value:t.config.seconds||5,onChange:l=>I(t.id,"seconds",Math.min(30,Math.max(1,parseInt(l.target.value)||1))),className:"w-24 px-2 py-1 text-xs bg-background border border-border/50 rounded text-foreground focus:outline-none focus:border-primary/50"})]}),t.type==="condition"&&e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] text-muted-foreground mb-0.5 block",children:"Condition Expression"}),e.jsx("input",{value:t.config.expression||"",onChange:l=>I(t.id,"expression",l.target.value),placeholder:"e.g. response.status === 200",className:"w-full px-2 py-1 text-xs bg-background border border-border/50 rounded text-foreground placeholder-muted-foreground/50 focus:outline-none focus:border-primary/50 font-mono"}),e.jsx("p",{className:"text-[10px] text-muted-foreground/40 mt-0.5",children:"Condition evaluation coming soon"})]})]})]},t.id)})}),e.jsxs("div",{className:"relative mt-3",children:[e.jsxs("button",{onClick:()=>u(!g),className:"w-full flex items-center justify-center gap-1.5 py-2 text-xs text-muted-foreground hover:text-foreground border border-dashed border-border/40 hover:border-border/60 rounded-xl transition-colors",children:[e.jsx(A,{className:"w-3.5 h-3.5"}),"Add Step"]}),g&&e.jsx("div",{className:"absolute left-1/2 -translate-x-1/2 bottom-full mb-1 z-10 bg-card border border-border/50 rounded-xl shadow-xl p-1.5 min-w-[180px]",children:q.map(t=>{const i=t.icon;return e.jsxs("button",{onClick:()=>F(t.value),className:"w-full text-left px-3 py-1.5 text-xs text-foreground hover:bg-muted/50 rounded-lg flex items-center gap-2",children:[e.jsx("div",{className:`p-1 rounded ${t.color}`,children:e.jsx(i,{className:"w-3 h-3"})}),t.label]},t.value)})})]})]}),$&&e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-red-400",children:[e.jsx(Y,{className:"w-3.5 h-3.5"}),$]})]})]})}const be=["GET","POST","PUT","PATCH","DELETE"];function ge({onWebhooksChange:a}){const[E,y]=s.useState([]),[f,T]=s.useState(!0),[k,j]=s.useState(!1),[x,b]=s.useState(null),[m,N]=s.useState(null),[d,S]=s.useState(null),[p,L]=s.useState(""),[D,W]=s.useState(""),[w,P]=s.useState("POST"),[$,v]=s.useState("{}"),[o,r]=s.useState(""),[g,u]=s.useState(""),F=s.useCallback(async()=>{try{const t=await C("/api/webhooks");if(t.ok){const i=await t.json();y(i.webhooks||[])}}catch{}T(!1)},[]);s.useEffect(()=>{F()},[F]);const _=()=>{L(""),W(""),P("POST"),v("{}"),r(""),u(""),b(null),j(!1)},O=t=>{L(t.name),W(t.url),P(t.method),v(t.headers||"{}"),r(t.description||""),b(t.id),j(!0),u("")},I=async()=>{if(u(""),!p.trim()){u("Name is required");return}if(!D.trim()){u("URL is required");return}try{new URL(D)}catch{u("Invalid URL");return}try{JSON.parse($)}catch{u("Headers must be valid JSON");return}try{const t={name:p,url:D,method:w,headers:$,description:o},i=x?`/api/webhooks/${x}`:"/api/webhooks",c=await C(i,{method:x?"PUT":"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!c.ok){const h=await c.json();u(h.error||"Failed to save");return}_(),F(),a==null||a()}catch{u("Network error")}},R=async t=>{try{await C(`/api/webhooks/${t}`,{method:"DELETE"}),F(),a==null||a()}catch{}},U=async t=>{N(t),S(null);try{const n=await(await C(`/api/webhooks/${t}/test`,{method:"POST"})).json();S({id:t,result:n.result,success:n.success})}catch{S({id:t,result:{error:"Network error"},success:!1})}N(null)};return f?e.jsx("div",{className:"flex items-center justify-center py-12 text-muted-foreground text-sm",children:"Loading webhooks..."}):e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Webhooks"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Endpoints that workflows can call during execution"})]}),!k&&e.jsxs("button",{onClick:()=>{_(),j(!0)},className:"flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium bg-primary text-primary-foreground rounded-lg hover:bg-primary/90 transition-colors",children:[e.jsx(A,{className:"w-3.5 h-3.5"}),"Add Webhook"]})]}),k&&e.jsxs("div",{className:"bg-muted/30 border border-border/50 rounded-xl p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs font-medium text-foreground",children:x?"Edit Webhook":"New Webhook"}),e.jsx("button",{onClick:_,className:"text-muted-foreground hover:text-foreground",children:e.jsx(de,{className:"w-4 h-4"})})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-[11px] text-muted-foreground mb-1 block",children:"Name"}),e.jsx("input",{value:p,onChange:t=>L(t.target.value),placeholder:"My Webhook",className:"w-full px-3 py-1.5 text-xs bg-background border border-border/50 rounded-lg text-foreground placeholder-muted-foreground/50 focus:outline-none focus:border-primary/50"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-[11px] text-muted-foreground mb-1 block",children:"Method"}),e.jsx("select",{value:w,onChange:t=>P(t.target.value),className:"w-full px-3 py-1.5 text-xs bg-background border border-border/50 rounded-lg text-foreground focus:outline-none focus:border-primary/50",children:be.map(t=>e.jsx("option",{value:t,children:t},t))})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-[11px] text-muted-foreground mb-1 block",children:"URL"}),e.jsx("input",{value:D,onChange:t=>W(t.target.value),placeholder:"https://example.com/webhook",className:"w-full px-3 py-1.5 text-xs bg-background border border-border/50 rounded-lg text-foreground placeholder-muted-foreground/50 focus:outline-none focus:border-primary/50"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-[11px] text-muted-foreground mb-1 block",children:"Headers (JSON)"}),e.jsx("textarea",{value:$,onChange:t=>v(t.target.value),placeholder:'{"Authorization": "Bearer ..."}',rows:2,className:"w-full px-3 py-1.5 text-xs bg-background border border-border/50 rounded-lg text-foreground placeholder-muted-foreground/50 focus:outline-none focus:border-primary/50 font-mono resize-none"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-[11px] text-muted-foreground mb-1 block",children:"Description"}),e.jsx("input",{value:o,onChange:t=>r(t.target.value),placeholder:"Optional description...",className:"w-full px-3 py-1.5 text-xs bg-background border border-border/50 rounded-lg text-foreground placeholder-muted-foreground/50 focus:outline-none focus:border-primary/50"})]}),g&&e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-red-400",children:[e.jsx(Y,{className:"w-3.5 h-3.5"}),g]}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx("button",{onClick:_,className:"px-3 py-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors",children:"Cancel"}),e.jsxs("button",{onClick:I,className:"flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium bg-primary text-primary-foreground rounded-lg hover:bg-primary/90 transition-colors",children:[e.jsx(ce,{className:"w-3.5 h-3.5"}),x?"Update":"Create"]})]})]}),E.length===0&&!k?e.jsxs("div",{className:"text-center py-12",children:[e.jsx("div",{className:"w-12 h-12 mx-auto mb-3 bg-muted/50 rounded-full flex items-center justify-center",children:e.jsx(M,{className:"w-6 h-6 text-muted-foreground/50"})}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"No webhooks yet"}),e.jsx("p",{className:"text-xs text-muted-foreground/60 mt-1",children:"Create a webhook to use in your workflows"})]}):e.jsx("div",{className:"space-y-2",children:E.map(t=>e.jsxs("div",{className:"bg-muted/20 border border-border/30 rounded-xl p-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs font-semibold text-foreground",children:t.name}),e.jsx("span",{className:`text-[10px] px-1.5 py-0.5 rounded font-mono ${t.method==="GET"?"bg-green-500/10 text-green-400":t.method==="POST"?"bg-blue-500/10 text-blue-400":t.method==="PUT"?"bg-yellow-500/10 text-yellow-400":t.method==="DELETE"?"bg-red-500/10 text-red-400":"bg-muted text-muted-foreground"}`,children:t.method})]}),e.jsx("p",{className:"text-[11px] text-muted-foreground font-mono mt-0.5 truncate",children:t.url}),t.description&&e.jsx("p",{className:"text-[11px] text-muted-foreground/60 mt-0.5",children:t.description}),t.last_triggered&&e.jsxs("p",{className:"text-[10px] text-muted-foreground/40 mt-1",children:["Last triggered: ",new Date(t.last_triggered).toLocaleString()]})]}),e.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[e.jsx("button",{onClick:()=>U(t.id),disabled:m===t.id,className:"p-1.5 text-muted-foreground hover:text-green-400 transition-colors disabled:opacity-50",title:"Test webhook",children:m===t.id?e.jsx("div",{className:"w-3.5 h-3.5 border-2 border-muted-foreground/30 border-t-muted-foreground rounded-full animate-spin"}):e.jsx(V,{className:"w-3.5 h-3.5"})}),e.jsx("button",{onClick:()=>O(t),className:"p-1.5 text-muted-foreground hover:text-foreground transition-colors",title:"Edit",children:e.jsx(X,{className:"w-3.5 h-3.5"})}),e.jsx("button",{onClick:()=>R(t.id),className:"p-1.5 text-muted-foreground hover:text-red-400 transition-colors",title:"Delete",children:e.jsx(G,{className:"w-3.5 h-3.5"})})]})]}),(d==null?void 0:d.id)===t.id&&e.jsx("div",{className:`mt-2 p-2 rounded-lg text-xs ${d.success?"bg-green-500/5 border border-green-500/20":"bg-red-500/5 border border-red-500/20"}`,children:d.result.error?e.jsx("span",{className:"text-red-400",children:d.result.error}):e.jsxs("div",{children:[e.jsxs("span",{className:d.result.status&&d.result.status<400?"text-green-400":"text-red-400",children:[d.result.status," ",d.result.statusText]}),d.result.body&&e.jsx("pre",{className:"mt-1 text-[10px] text-muted-foreground font-mono overflow-x-auto max-h-24 overflow-y-auto",children:typeof d.result.body=="string"?d.result.body:JSON.stringify(d.result.body,null,2)})]})})]},t.id))})]})}function Se({selectedProject:a}){const[E,y]=s.useState("list"),[f,T]=s.useState("workflows"),[k,j]=s.useState(null),[x,b]=s.useState(0),m=s.useCallback(p=>{j(p),y("editor")},[]),N=s.useCallback(()=>{j(null),y("editor")},[]),d=s.useCallback(()=>{y("list"),T("workflows"),j(null),b(p=>p+1)},[]),S=s.useCallback(()=>{y("list"),j(null)},[]);return E==="editor"?e.jsx("div",{className:"h-full",children:e.jsx(pe,{workflow:k,onSave:d,onCancel:S})}):e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsx("div",{className:"flex-shrink-0 px-4 pt-3 pb-0",children:e.jsxs("div",{className:"inline-flex items-center bg-muted/40 rounded-lg p-[3px] gap-[2px]",children:[e.jsxs("button",{onClick:()=>T("workflows"),className:`flex items-center gap-1.5 px-3 py-[5px] text-xs font-medium rounded-md transition-all duration-150 ${f==="workflows"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[e.jsx(M,{className:"w-3 h-3"}),"Workflows"]}),e.jsxs("button",{onClick:()=>T("webhooks"),className:`flex items-center gap-1.5 px-3 py-[5px] text-xs font-medium rounded-md transition-all duration-150 ${f==="webhooks"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[e.jsx(ie,{className:"w-3 h-3"}),"Webhooks"]})]})}),e.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:f==="workflows"?e.jsx(ue,{onEdit:m,onCreate:N,refreshKey:x}):e.jsx(ge,{onWebhooksChange:()=>b(p=>p+1)})})]})}export{Se as default};
@@ -1,4 +1,4 @@
1
- import"./percentages-BXMCSKIN-BzXIakGM.js";import"./vendor-syntax-DnmwQQJF.js";import"./vendor-react-9mUTKBHH.js";import"./vendor-markdown-BXEi_H3G.js";import"./AppContent-CRld2UWX.js";import"./index-ClfzLIqY.js";import"./vendor-icons-aNdOvTr_.js";import"./vendor-i18n-DCFGyhQR.js";import"./LoginModal-BwkvjfPR.js";import"./vendor-xterm-CZq1hqo1.js";import"./vendor-codemirror-D_s0aGBu.js";var u={paste:"لصق",pasteAsPlaintext:"اللصق كنص عادي",pasteCharts:"لصق الرسوم البيانية",selectAll:"تحديد الكل",multiSelect:"إضافة عنصر للتحديد",moveCanvas:"نقل لوح الرسم",cut:"قص",copy:"نسخ",copyAsPng:"نسخ إلى الحافظة بصيغة PNG",copyAsSvg:"نسخ إلى الحافظة بصيغة SVG",copyText:"نسخ إلى الحافظة كنص",copySource:"",convertToCode:"",bringForward:"جلب للأمام",sendToBack:"أرسل للخلف",bringToFront:"أحضر للأمام",sendBackward:"أرسل للخلف",delete:"حذف",copyStyles:"نسخ الأنماط",pasteStyles:"لصق الأنماط",stroke:"الخط",background:"الخلفية",fill:"التعبئة",strokeWidth:"سُمك الخط",strokeStyle:"نمط الخط",strokeStyle_solid:"متصل",strokeStyle_dashed:"متقطع",strokeStyle_dotted:"منقط",sloppiness:"الإمالة",opacity:"الشفافية",textAlign:"محاذاة النص",edges:"الحواف",sharp:"حادة",round:"دائرية",arrowheads:"رؤوس الأسهم",arrowhead_none:"لا شيء",arrowhead_arrow:"سهم",arrowhead_bar:"شريط",arrowhead_circle:"",arrowhead_circle_outline:"",arrowhead_triangle:"مثلث",arrowhead_triangle_outline:"",arrowhead_diamond:"",arrowhead_diamond_outline:"",fontSize:"حجم الخط",fontFamily:"نوع الخط",addWatermark:'إضافة "مصنوعة بواسطة Excalidraw"',handDrawn:"رسم باليد",normal:"عادي",code:"رمز",small:"صغير",medium:"متوسط",large:"كبير",veryLarge:"كبير جدا",solid:"كامل",hachure:"خطوط",zigzag:"متعرج",crossHatch:"خطوط متقطعة",thin:"نحيف",bold:"داكن",left:"الـيسار",center:"وسط",right:"يمين",extraBold:"عريض",architect:"معماري",artist:"رسام",cartoonist:"كرتوني",fileTitle:"إسم الملف",colorPicker:"منتقي اللون",canvasColors:"تستخدم على القماش",canvasBackground:"خلفية اللوحة",drawingCanvas:"لوحة الرسم",layers:"الطبقات",actions:"الإجراءات",language:"اللغة",liveCollaboration:"التعاون المباشر...",duplicateSelection:"تكرار",untitled:"غير معنون",name:"الاسم",yourName:"اسمك",madeWithExcalidraw:"مصنوعة بواسطة Excalidraw",group:"تحديد مجموعة",ungroup:"إلغاء تحديد مجموعة",collaborators:"المتعاونون",showGrid:"إظهار الشبكة",addToLibrary:"أضف إلى المكتبة",removeFromLibrary:"حذف من المكتبة",libraryLoadingMessage:"جارٍ تحميل المكتبة…",libraries:"تصفح المكتبات",loadingScene:"جاري تحميل المشهد…",align:"محاذاة",alignTop:"محاذاة إلى اﻷعلى",alignBottom:"محاذاة إلى اﻷسفل",alignLeft:"محاذاة إلى اليسار",alignRight:"محاذاة إلى اليمين",centerVertically:"توسيط عمودي",centerHorizontally:"توسيط أفقي",distributeHorizontally:"التوزيع الأفقي",distributeVertically:"التوزيع عمودياً",flipHorizontal:"قلب عامودي",flipVertical:"قلب أفقي",viewMode:"نمط العرض",share:"مشاركة",showStroke:"إظهار منتقي لون الخط",showBackground:"إظهار منتقي لون الخلفية",toggleTheme:"غير النمط",personalLib:"المكتبة الشخصية",excalidrawLib:"مكتبتنا",decreaseFontSize:"تصغير حجم الخط",increaseFontSize:"تكبير حجم الخط",unbindText:"فك ربط النص",bindText:"ربط النص بالحاوية",createContainerFromText:"نص مغلف في حاوية",link:{edit:"تعديل الرابط",editEmbed:"تحرير الرابط وإدراجه",create:"إنشاء رابط",createEmbed:"إنشاء رابط و إدراجه",label:"رابط",labelEmbed:"رابط و إدراج",empty:"لم يتم تعيين رابط"},lineEditor:{edit:"تحرير السطر",exit:"الخروج من المُحرر"},elementLock:{lock:"قفل",unlock:"فتح",lockAll:"قفل الكل",unlockAll:"فتح الكل"},statusPublished:"نُشر",sidebarLock:"إبقاء الشريط الجانبي مفتوح",selectAllElementsInFrame:"تحديد جميع العناصر في الإطار",removeAllElementsFromFrame:"إزالة جميع العناصر من الإطار",eyeDropper:"اختيار اللون من القماش",textToDiagram:"",prompt:""},A={noItems:"لا توجد عناصر أضيفت بعد...",hint_emptyLibrary:"حدد عنصر على القماش لإضافته هنا، أو تثبيت مكتبة من المستودع العام أدناه.",hint_emptyPrivateLibrary:"حدد عنصر على القماش لإضافته هنا."},e={clearReset:"إعادة تعيين اللوحة",exportJSON:"صدر الملف",exportImage:"تصدير الصورة...",export:"حفظ إلى...",copyToClipboard:"نسخ إلى الحافظة",save:"احفظ للملف الحالي",saveAs:"حفظ كـ",load:"فتح",getShareableLink:"احصل على رابط المشاركة",close:"غلق",selectLanguage:"اختر اللغة",scrollBackToContent:"الرجوع إلى المحتوى",zoomIn:"تكبير",zoomOut:"تصغير",resetZoom:"إعادة تعيين الشاشة",menu:"القائمة",done:"تم",edit:"تعديل",undo:"تراجع",redo:"إعادة تنفيذ",resetLibrary:"إعادة ضبط المكتبة",createNewRoom:"إنشاء غرفة جديدة",fullScreen:"شاشة كاملة",darkMode:"الوضع المظلم",lightMode:"الوضع المضيء",zenMode:"وضع التأمل",objectsSnapMode:"التقط إلى العناصر",exitZenMode:"إلغاء الوضع الليلى",cancel:"إلغاء",clear:"مسح",remove:"إزالة",embed:"تبديل الإدراج",publishLibrary:"انشر",submit:"أرسل",confirm:"تأكيد",embeddableInteractionButton:"اضغط للتفاعل"},r={clearReset:"هذا سيُزيل كامل اللوحة. هل أنت متأكد؟",couldNotCreateShareableLink:"تعذر إنشاء رابطة المشاركة.",couldNotCreateShareableLinkTooBig:"تعذر إنشاء رابط قابل للمشاركة: المشهد كبير جدًا",couldNotLoadInvalidFile:"تعذر التحميل، الملف غير صالح",importBackendFailed:"فشل الاستيراد من الخادوم.",cannotExportEmptyCanvas:"لا يمكن تصدير لوحة فارغة.",couldNotCopyToClipboard:"تعذر النسخ إلى الحافظة.",decryptFailed:"تعذر فك تشفير البيانات.",uploadedSecurly:"تم تأمين التحميل بتشفير النهاية إلى النهاية، مما يعني أن خادوم Excalidraw والأطراف الثالثة لا يمكنها قراءة المحتوى.",loadSceneOverridePrompt:"تحميل الرسم الخارجي سيحل محل المحتوى الموجود لديك. هل ترغب في المتابعة؟",collabStopOverridePrompt:`إيقاف الجلسة سيؤدي إلى الكتابة فوق رسومك السابقة المخزنة داخليا. هل أنت متأكد؟
1
+ import"./percentages-BXMCSKIN-WVlHS4wx.js";import"./vendor-syntax-DnmwQQJF.js";import"./vendor-react-9mUTKBHH.js";import"./vendor-markdown-BXEi_H3G.js";import"./AppContent-C0CyP3g5.js";import"./index-ce18TYkg.js";import"./vendor-icons-Lb69KSFJ.js";import"./vendor-i18n-DCFGyhQR.js";import"./LoginModal-CZDEzqjK.js";import"./vendor-xterm-CZq1hqo1.js";import"./vendor-codemirror-D_s0aGBu.js";var u={paste:"لصق",pasteAsPlaintext:"اللصق كنص عادي",pasteCharts:"لصق الرسوم البيانية",selectAll:"تحديد الكل",multiSelect:"إضافة عنصر للتحديد",moveCanvas:"نقل لوح الرسم",cut:"قص",copy:"نسخ",copyAsPng:"نسخ إلى الحافظة بصيغة PNG",copyAsSvg:"نسخ إلى الحافظة بصيغة SVG",copyText:"نسخ إلى الحافظة كنص",copySource:"",convertToCode:"",bringForward:"جلب للأمام",sendToBack:"أرسل للخلف",bringToFront:"أحضر للأمام",sendBackward:"أرسل للخلف",delete:"حذف",copyStyles:"نسخ الأنماط",pasteStyles:"لصق الأنماط",stroke:"الخط",background:"الخلفية",fill:"التعبئة",strokeWidth:"سُمك الخط",strokeStyle:"نمط الخط",strokeStyle_solid:"متصل",strokeStyle_dashed:"متقطع",strokeStyle_dotted:"منقط",sloppiness:"الإمالة",opacity:"الشفافية",textAlign:"محاذاة النص",edges:"الحواف",sharp:"حادة",round:"دائرية",arrowheads:"رؤوس الأسهم",arrowhead_none:"لا شيء",arrowhead_arrow:"سهم",arrowhead_bar:"شريط",arrowhead_circle:"",arrowhead_circle_outline:"",arrowhead_triangle:"مثلث",arrowhead_triangle_outline:"",arrowhead_diamond:"",arrowhead_diamond_outline:"",fontSize:"حجم الخط",fontFamily:"نوع الخط",addWatermark:'إضافة "مصنوعة بواسطة Excalidraw"',handDrawn:"رسم باليد",normal:"عادي",code:"رمز",small:"صغير",medium:"متوسط",large:"كبير",veryLarge:"كبير جدا",solid:"كامل",hachure:"خطوط",zigzag:"متعرج",crossHatch:"خطوط متقطعة",thin:"نحيف",bold:"داكن",left:"الـيسار",center:"وسط",right:"يمين",extraBold:"عريض",architect:"معماري",artist:"رسام",cartoonist:"كرتوني",fileTitle:"إسم الملف",colorPicker:"منتقي اللون",canvasColors:"تستخدم على القماش",canvasBackground:"خلفية اللوحة",drawingCanvas:"لوحة الرسم",layers:"الطبقات",actions:"الإجراءات",language:"اللغة",liveCollaboration:"التعاون المباشر...",duplicateSelection:"تكرار",untitled:"غير معنون",name:"الاسم",yourName:"اسمك",madeWithExcalidraw:"مصنوعة بواسطة Excalidraw",group:"تحديد مجموعة",ungroup:"إلغاء تحديد مجموعة",collaborators:"المتعاونون",showGrid:"إظهار الشبكة",addToLibrary:"أضف إلى المكتبة",removeFromLibrary:"حذف من المكتبة",libraryLoadingMessage:"جارٍ تحميل المكتبة…",libraries:"تصفح المكتبات",loadingScene:"جاري تحميل المشهد…",align:"محاذاة",alignTop:"محاذاة إلى اﻷعلى",alignBottom:"محاذاة إلى اﻷسفل",alignLeft:"محاذاة إلى اليسار",alignRight:"محاذاة إلى اليمين",centerVertically:"توسيط عمودي",centerHorizontally:"توسيط أفقي",distributeHorizontally:"التوزيع الأفقي",distributeVertically:"التوزيع عمودياً",flipHorizontal:"قلب عامودي",flipVertical:"قلب أفقي",viewMode:"نمط العرض",share:"مشاركة",showStroke:"إظهار منتقي لون الخط",showBackground:"إظهار منتقي لون الخلفية",toggleTheme:"غير النمط",personalLib:"المكتبة الشخصية",excalidrawLib:"مكتبتنا",decreaseFontSize:"تصغير حجم الخط",increaseFontSize:"تكبير حجم الخط",unbindText:"فك ربط النص",bindText:"ربط النص بالحاوية",createContainerFromText:"نص مغلف في حاوية",link:{edit:"تعديل الرابط",editEmbed:"تحرير الرابط وإدراجه",create:"إنشاء رابط",createEmbed:"إنشاء رابط و إدراجه",label:"رابط",labelEmbed:"رابط و إدراج",empty:"لم يتم تعيين رابط"},lineEditor:{edit:"تحرير السطر",exit:"الخروج من المُحرر"},elementLock:{lock:"قفل",unlock:"فتح",lockAll:"قفل الكل",unlockAll:"فتح الكل"},statusPublished:"نُشر",sidebarLock:"إبقاء الشريط الجانبي مفتوح",selectAllElementsInFrame:"تحديد جميع العناصر في الإطار",removeAllElementsFromFrame:"إزالة جميع العناصر من الإطار",eyeDropper:"اختيار اللون من القماش",textToDiagram:"",prompt:""},A={noItems:"لا توجد عناصر أضيفت بعد...",hint_emptyLibrary:"حدد عنصر على القماش لإضافته هنا، أو تثبيت مكتبة من المستودع العام أدناه.",hint_emptyPrivateLibrary:"حدد عنصر على القماش لإضافته هنا."},e={clearReset:"إعادة تعيين اللوحة",exportJSON:"صدر الملف",exportImage:"تصدير الصورة...",export:"حفظ إلى...",copyToClipboard:"نسخ إلى الحافظة",save:"احفظ للملف الحالي",saveAs:"حفظ كـ",load:"فتح",getShareableLink:"احصل على رابط المشاركة",close:"غلق",selectLanguage:"اختر اللغة",scrollBackToContent:"الرجوع إلى المحتوى",zoomIn:"تكبير",zoomOut:"تصغير",resetZoom:"إعادة تعيين الشاشة",menu:"القائمة",done:"تم",edit:"تعديل",undo:"تراجع",redo:"إعادة تنفيذ",resetLibrary:"إعادة ضبط المكتبة",createNewRoom:"إنشاء غرفة جديدة",fullScreen:"شاشة كاملة",darkMode:"الوضع المظلم",lightMode:"الوضع المضيء",zenMode:"وضع التأمل",objectsSnapMode:"التقط إلى العناصر",exitZenMode:"إلغاء الوضع الليلى",cancel:"إلغاء",clear:"مسح",remove:"إزالة",embed:"تبديل الإدراج",publishLibrary:"انشر",submit:"أرسل",confirm:"تأكيد",embeddableInteractionButton:"اضغط للتفاعل"},r={clearReset:"هذا سيُزيل كامل اللوحة. هل أنت متأكد؟",couldNotCreateShareableLink:"تعذر إنشاء رابطة المشاركة.",couldNotCreateShareableLinkTooBig:"تعذر إنشاء رابط قابل للمشاركة: المشهد كبير جدًا",couldNotLoadInvalidFile:"تعذر التحميل، الملف غير صالح",importBackendFailed:"فشل الاستيراد من الخادوم.",cannotExportEmptyCanvas:"لا يمكن تصدير لوحة فارغة.",couldNotCopyToClipboard:"تعذر النسخ إلى الحافظة.",decryptFailed:"تعذر فك تشفير البيانات.",uploadedSecurly:"تم تأمين التحميل بتشفير النهاية إلى النهاية، مما يعني أن خادوم Excalidraw والأطراف الثالثة لا يمكنها قراءة المحتوى.",loadSceneOverridePrompt:"تحميل الرسم الخارجي سيحل محل المحتوى الموجود لديك. هل ترغب في المتابعة؟",collabStopOverridePrompt:`إيقاف الجلسة سيؤدي إلى الكتابة فوق رسومك السابقة المخزنة داخليا. هل أنت متأكد؟
2
2
 
3
3
  (إذا كنت ترغب في الاحتفاظ برسمك المخزن داخليا، ببساطة أغلق علامة تبويب المتصفح بدلاً من ذلك.)`,errorAddingToLibrary:"تعذر إضافة العنصر للمكتبة",errorRemovingFromLibrary:"تعذر إزالة العنصر من المكتبة",confirmAddLibrary:"هذا سيضيف {{numShapes}} شكل إلى مكتبتك. هل أنت متأكد؟",imageDoesNotContainScene:"يبدو أن هذه الصورة لا تحتوي على أي بيانات مشهد. هل قمت بتمكين تضمين المشهد أثناء التصدير؟",cannotRestoreFromImage:"تعذر استعادة المشهد من ملف الصورة",invalidSceneUrl:"تعذر استيراد المشهد من عنوان URL المتوفر. إما أنها مشوهة، أو لا تحتوي على بيانات Excalidraw JSON صالحة.",resetLibrary:"هذا سوف يمسح مكتبتك. هل أنت متأكد؟",removeItemsFromsLibrary:"حذف {{count}} عنصر (عناصر) من المكتبة؟",invalidEncryptionKey:"مفتاح التشفير يجب أن يكون من 22 حرفاً. التعاون المباشر معطل.",collabOfflineWarning:`لا يوجد اتصال بالانترنت.
4
4
  لن يتم حفظ التغييرات التي قمت بها!`},a={unsupportedFileType:"نوع الملف غير مدعوم.",imageInsertError:"تعذر إدراج الصورة. حاول مرة أخرى لاحقاً...",fileTooBig:"الملف كبير جداً. الحد الأقصى المسموح به للحجم هو {{maxSize}}.",svgImageInsertError:"تعذر إدراج صورة SVG. يبدو أن ترميز SVG غير صحيح.",failedToFetchImage:"",invalidSVGString:"SVG غير صالح.",cannotResolveCollabServer:"تعذر الاتصال بخادم التعاون. الرجاء إعادة تحميل الصفحة والمحاولة مرة أخرى.",importLibraryError:"تعذر تحميل المكتبة",collabSaveFailed:"تعذر الحفظ في قاعدة البيانات. إذا استمرت المشاكل، يفضل أن تحفظ ملفك محليا كي لا تفقد عملك.",collabSaveFailed_sizeExceeded:"تعذر الحفظ في قاعدة البيانات، يبدو أن القماش كبير للغاية، يفضّل حفظ الملف محليا كي لا تفقد عملك.",imageToolNotSupported:"",brave_measure_text_error:{line1:"يبدو أنك تستخدم متصفح Brave مع إعداد <bold>حظر صارم لتتبع البصمة</bold>.",line2:"قد يؤدي هذا إلى كسر <bold>عناصر النص</bold> في الرسومات الخاصة بك.",line3:"من المستحسن إلغاء تفعيل هذا الإعداد. يمكنك اتباع <link>هذه الخطوات</link> لفعل ذلك.",line4:"إذا لم يصلح تعطيل هذا الإعداد طريقة عرض النصوص، الرجاء كتابة <issueLink>بلاغ</issueLink> على حسابنا في GitHub، أو راسلنا على <discordLink>Discord</discordLink>"},libraryElementTypeError:{embeddable:"لا يمكن إضافة العناصر القابلة للتضمين في المكتبة.",iframe:"",image:"سوف يتم دعم إضافة صور إلى المكتبة قريباً!"},asyncPasteFailedOnRead:"",asyncPasteFailedOnParse:"",copyToSystemClipboardFailed:""},o={selection:"تحديد",image:"إدراج صورة",rectangle:"مستطيل",diamond:"مضلع",ellipse:"دائرة",arrow:"سهم",line:"خط",freedraw:"رسم",text:"نص",library:"مكتبة",lock:"الحفاظ على أداة التحديد نشطة بعد الرسم",penMode:"وضع القلم - امنع اللمس",link:"إضافة/تحديث الرابط للشكل المحدد",eraser:"ممحاة",frame:"أداة الإطار",magicframe:"",embeddable:"تضمين ويب",laser:"مؤشر ليزر",hand:"يد (أداة الإزاحة)",extraTools:"المزيد من أﻷدوات",mermaidToExcalidraw:"",magicSettings:""},t={canvasActions:"إجراءات اللوحة",selectedShapeActions:"إجراءات الشكل المحدد",shapes:"الأشكال"},i={canvasPanning:"لتحريك القماش، اضغط على عجلة الفأرة أو مفتاح المسافة أثناء السحب، أو استخدم أداة اليد",linearElement:"انقر لبدء نقاط متعددة، اسحب لخط واحد",freeDraw:"انقر واسحب، افرج عند الانتهاء",text:"نصيحة: يمكنك أيضًا إضافة نص بالنقر المزدوج في أي مكان بأداة الاختيار",embeddable:"اضغط مع السحب لإنشاء موقع ويب مضمّن",text_selected:"انقر نقراً مزدوجاً أو اضغط ادخال لتعديل النص",text_editing:"اضغط على Esc أو (Ctrl أو Cmd) + Enter لإنهاء التعديل",linearElementMulti:"انقر فوق النقطة الأخيرة أو اضغط على Esc أو Enter للإنهاء",lockAngle:"يمكنك تقييد الزاوية بالضغط على SHIFT",resize:`يمكنك تقييد النسب بالضغط على SHIFT أثناء تغيير الحجم،
@@ -1 +1 @@
1
- import{w as ln,c as J}from"./path-CbwjOpE9.js";import{D as rn,E as N,F as D,G as an,H as y,I as on,J as z,K as _,L as un,M as t,N as tn,O as sn,P as fn}from"./index-BBlwbHq_.js";function cn(l){return l.innerRadius}function yn(l){return l.outerRadius}function gn(l){return l.startAngle}function mn(l){return l.endAngle}function pn(l){return l&&l.padAngle}function dn(l,h,O,E,v,A,K,r){var q=O-l,i=E-h,n=K-v,m=r-A,a=m*q-n*i;if(!(a*a<y))return a=(n*(h-A)-m*(l-v))/a,[l+a*q,h+a*i]}function W(l,h,O,E,v,A,K){var r=l-O,q=h-E,i=(K?A:-A)/z(r*r+q*q),n=i*q,m=-i*r,a=l+n,s=h+m,f=O+n,c=E+m,L=(a+f)/2,o=(s+c)/2,p=f-a,g=c-s,R=p*p+g*g,T=v-A,P=a*c-f*s,F=(g<0?-1:1)*z(tn(0,T*T*R-P*P)),G=(P*g-p*F)/R,H=(-P*p-g*F)/R,w=(P*g+p*F)/R,d=(-P*p+g*F)/R,x=G-L,e=H-o,u=w-L,M=d-o;return x*x+e*e>u*u+M*M&&(G=w,H=d),{cx:G,cy:H,x01:-n,y01:-m,x11:G*(v/T-1),y11:H*(v/T-1)}}function vn(){var l=cn,h=yn,O=J(0),E=null,v=gn,A=mn,K=pn,r=null,q=ln(i);function i(){var n,m,a=+l.apply(this,arguments),s=+h.apply(this,arguments),f=v.apply(this,arguments)-an,c=A.apply(this,arguments)-an,L=un(c-f),o=c>f;if(r||(r=n=q()),s<a&&(m=s,s=a,a=m),!(s>y))r.moveTo(0,0);else if(L>on-y)r.moveTo(s*N(f),s*D(f)),r.arc(0,0,s,f,c,!o),a>y&&(r.moveTo(a*N(c),a*D(c)),r.arc(0,0,a,c,f,o));else{var p=f,g=c,R=f,T=c,P=L,F=L,G=K.apply(this,arguments)/2,H=G>y&&(E?+E.apply(this,arguments):z(a*a+s*s)),w=_(un(s-a)/2,+O.apply(this,arguments)),d=w,x=w,e,u;if(H>y){var M=sn(H/a*D(G)),B=sn(H/s*D(G));(P-=M*2)>y?(M*=o?1:-1,R+=M,T-=M):(P=0,R=T=(f+c)/2),(F-=B*2)>y?(B*=o?1:-1,p+=B,g-=B):(F=0,p=g=(f+c)/2)}var S=s*N(p),j=s*D(p),C=a*N(T),Q=a*D(T);if(w>y){var U=s*N(g),V=s*D(g),X=a*N(R),Y=a*D(R),I;if(L<rn)if(I=dn(S,j,X,Y,U,V,C,Q)){var Z=S-I[0],$=j-I[1],k=U-I[0],b=V-I[1],nn=1/D(fn((Z*k+$*b)/(z(Z*Z+$*$)*z(k*k+b*b)))/2),en=z(I[0]*I[0]+I[1]*I[1]);d=_(w,(a-en)/(nn-1)),x=_(w,(s-en)/(nn+1))}else d=x=0}F>y?x>y?(e=W(X,Y,S,j,s,x,o),u=W(U,V,C,Q,s,x,o),r.moveTo(e.cx+e.x01,e.cy+e.y01),x<w?r.arc(e.cx,e.cy,x,t(e.y01,e.x01),t(u.y01,u.x01),!o):(r.arc(e.cx,e.cy,x,t(e.y01,e.x01),t(e.y11,e.x11),!o),r.arc(0,0,s,t(e.cy+e.y11,e.cx+e.x11),t(u.cy+u.y11,u.cx+u.x11),!o),r.arc(u.cx,u.cy,x,t(u.y11,u.x11),t(u.y01,u.x01),!o))):(r.moveTo(S,j),r.arc(0,0,s,p,g,!o)):r.moveTo(S,j),!(a>y)||!(P>y)?r.lineTo(C,Q):d>y?(e=W(C,Q,U,V,a,-d,o),u=W(S,j,X,Y,a,-d,o),r.lineTo(e.cx+e.x01,e.cy+e.y01),d<w?r.arc(e.cx,e.cy,d,t(e.y01,e.x01),t(u.y01,u.x01),!o):(r.arc(e.cx,e.cy,d,t(e.y01,e.x01),t(e.y11,e.x11),!o),r.arc(0,0,a,t(e.cy+e.y11,e.cx+e.x11),t(u.cy+u.y11,u.cx+u.x11),o),r.arc(u.cx,u.cy,d,t(u.y11,u.x11),t(u.y01,u.x01),!o))):r.arc(0,0,a,T,R,o)}if(r.closePath(),n)return r=null,n+""||null}return i.centroid=function(){var n=(+l.apply(this,arguments)+ +h.apply(this,arguments))/2,m=(+v.apply(this,arguments)+ +A.apply(this,arguments))/2-rn/2;return[N(m)*n,D(m)*n]},i.innerRadius=function(n){return arguments.length?(l=typeof n=="function"?n:J(+n),i):l},i.outerRadius=function(n){return arguments.length?(h=typeof n=="function"?n:J(+n),i):h},i.cornerRadius=function(n){return arguments.length?(O=typeof n=="function"?n:J(+n),i):O},i.padRadius=function(n){return arguments.length?(E=n==null?null:typeof n=="function"?n:J(+n),i):E},i.startAngle=function(n){return arguments.length?(v=typeof n=="function"?n:J(+n),i):v},i.endAngle=function(n){return arguments.length?(A=typeof n=="function"?n:J(+n),i):A},i.padAngle=function(n){return arguments.length?(K=typeof n=="function"?n:J(+n),i):K},i.context=function(n){return arguments.length?(r=n??null,i):r},i}export{vn as a};
1
+ import{w as ln,c as J}from"./path-CbwjOpE9.js";import{D as rn,E as N,F as D,G as an,H as y,I as on,J as z,K as _,L as un,M as t,N as tn,O as sn,P as fn}from"./index-BVowJdZF.js";function cn(l){return l.innerRadius}function yn(l){return l.outerRadius}function gn(l){return l.startAngle}function mn(l){return l.endAngle}function pn(l){return l&&l.padAngle}function dn(l,h,O,E,v,A,K,r){var q=O-l,i=E-h,n=K-v,m=r-A,a=m*q-n*i;if(!(a*a<y))return a=(n*(h-A)-m*(l-v))/a,[l+a*q,h+a*i]}function W(l,h,O,E,v,A,K){var r=l-O,q=h-E,i=(K?A:-A)/z(r*r+q*q),n=i*q,m=-i*r,a=l+n,s=h+m,f=O+n,c=E+m,L=(a+f)/2,o=(s+c)/2,p=f-a,g=c-s,R=p*p+g*g,T=v-A,P=a*c-f*s,F=(g<0?-1:1)*z(tn(0,T*T*R-P*P)),G=(P*g-p*F)/R,H=(-P*p-g*F)/R,w=(P*g+p*F)/R,d=(-P*p+g*F)/R,x=G-L,e=H-o,u=w-L,M=d-o;return x*x+e*e>u*u+M*M&&(G=w,H=d),{cx:G,cy:H,x01:-n,y01:-m,x11:G*(v/T-1),y11:H*(v/T-1)}}function vn(){var l=cn,h=yn,O=J(0),E=null,v=gn,A=mn,K=pn,r=null,q=ln(i);function i(){var n,m,a=+l.apply(this,arguments),s=+h.apply(this,arguments),f=v.apply(this,arguments)-an,c=A.apply(this,arguments)-an,L=un(c-f),o=c>f;if(r||(r=n=q()),s<a&&(m=s,s=a,a=m),!(s>y))r.moveTo(0,0);else if(L>on-y)r.moveTo(s*N(f),s*D(f)),r.arc(0,0,s,f,c,!o),a>y&&(r.moveTo(a*N(c),a*D(c)),r.arc(0,0,a,c,f,o));else{var p=f,g=c,R=f,T=c,P=L,F=L,G=K.apply(this,arguments)/2,H=G>y&&(E?+E.apply(this,arguments):z(a*a+s*s)),w=_(un(s-a)/2,+O.apply(this,arguments)),d=w,x=w,e,u;if(H>y){var M=sn(H/a*D(G)),B=sn(H/s*D(G));(P-=M*2)>y?(M*=o?1:-1,R+=M,T-=M):(P=0,R=T=(f+c)/2),(F-=B*2)>y?(B*=o?1:-1,p+=B,g-=B):(F=0,p=g=(f+c)/2)}var S=s*N(p),j=s*D(p),C=a*N(T),Q=a*D(T);if(w>y){var U=s*N(g),V=s*D(g),X=a*N(R),Y=a*D(R),I;if(L<rn)if(I=dn(S,j,X,Y,U,V,C,Q)){var Z=S-I[0],$=j-I[1],k=U-I[0],b=V-I[1],nn=1/D(fn((Z*k+$*b)/(z(Z*Z+$*$)*z(k*k+b*b)))/2),en=z(I[0]*I[0]+I[1]*I[1]);d=_(w,(a-en)/(nn-1)),x=_(w,(s-en)/(nn+1))}else d=x=0}F>y?x>y?(e=W(X,Y,S,j,s,x,o),u=W(U,V,C,Q,s,x,o),r.moveTo(e.cx+e.x01,e.cy+e.y01),x<w?r.arc(e.cx,e.cy,x,t(e.y01,e.x01),t(u.y01,u.x01),!o):(r.arc(e.cx,e.cy,x,t(e.y01,e.x01),t(e.y11,e.x11),!o),r.arc(0,0,s,t(e.cy+e.y11,e.cx+e.x11),t(u.cy+u.y11,u.cx+u.x11),!o),r.arc(u.cx,u.cy,x,t(u.y11,u.x11),t(u.y01,u.x01),!o))):(r.moveTo(S,j),r.arc(0,0,s,p,g,!o)):r.moveTo(S,j),!(a>y)||!(P>y)?r.lineTo(C,Q):d>y?(e=W(C,Q,U,V,a,-d,o),u=W(S,j,X,Y,a,-d,o),r.lineTo(e.cx+e.x01,e.cy+e.y01),d<w?r.arc(e.cx,e.cy,d,t(e.y01,e.x01),t(u.y01,u.x01),!o):(r.arc(e.cx,e.cy,d,t(e.y01,e.x01),t(e.y11,e.x11),!o),r.arc(0,0,a,t(e.cy+e.y11,e.cx+e.x11),t(u.cy+u.y11,u.cx+u.x11),o),r.arc(u.cx,u.cy,d,t(u.y11,u.x11),t(u.y01,u.x01),!o))):r.arc(0,0,a,T,R,o)}if(r.closePath(),n)return r=null,n+""||null}return i.centroid=function(){var n=(+l.apply(this,arguments)+ +h.apply(this,arguments))/2,m=(+v.apply(this,arguments)+ +A.apply(this,arguments))/2-rn/2;return[N(m)*n,D(m)*n]},i.innerRadius=function(n){return arguments.length?(l=typeof n=="function"?n:J(+n),i):l},i.outerRadius=function(n){return arguments.length?(h=typeof n=="function"?n:J(+n),i):h},i.cornerRadius=function(n){return arguments.length?(O=typeof n=="function"?n:J(+n),i):O},i.padRadius=function(n){return arguments.length?(E=n==null?null:typeof n=="function"?n:J(+n),i):E},i.startAngle=function(n){return arguments.length?(v=typeof n=="function"?n:J(+n),i):v},i.endAngle=function(n){return arguments.length?(A=typeof n=="function"?n:J(+n),i):A},i.padAngle=function(n){return arguments.length?(K=typeof n=="function"?n:J(+n),i):K},i.context=function(n){return arguments.length?(r=n??null,i):r},i}export{vn as a};
@@ -1 +1 @@
1
- import"./percentages-BXMCSKIN-BzXIakGM.js";import"./vendor-syntax-DnmwQQJF.js";import"./vendor-react-9mUTKBHH.js";import"./vendor-markdown-BXEi_H3G.js";import"./AppContent-CRld2UWX.js";import"./index-ClfzLIqY.js";import"./vendor-icons-aNdOvTr_.js";import"./vendor-i18n-DCFGyhQR.js";import"./LoginModal-BwkvjfPR.js";import"./vendor-xterm-CZq1hqo1.js";import"./vendor-codemirror-D_s0aGBu.js";var e={paste:"Yapışdır",pasteAsPlaintext:"Düz mətn kimi yapışdırın",pasteCharts:"Diaqramları yapışdırın",selectAll:"Hamısını seç",multiSelect:"Seçimə element əlavə edin",moveCanvas:"Kanvası köçürün",cut:"Kəs",copy:"Kopyala",copyAsPng:"PNG olaraq panoya kopyala",copyAsSvg:"SVG olaraq panoya kopyala",copyText:"Mətn olaraq panoya kopyala",copySource:"",convertToCode:"",bringForward:"Önə daşı",sendToBack:"Geriyə göndərin",bringToFront:"Önə gətirin",sendBackward:"Geriyə göndərin",delete:"Sil",copyStyles:"Stilləri kopyalayın",pasteStyles:"Stilləri yapışdırın",stroke:"Strok rəngi",background:"Arxa fon",fill:"Doldur",strokeWidth:"Strok eni",strokeStyle:"Strok stili",strokeStyle_solid:"Solid",strokeStyle_dashed:"Kəsik",strokeStyle_dotted:"Nöqtəli",sloppiness:"Səliqəsizlik",opacity:"Şəffaflıq",textAlign:"Mətni uyğunlaşdır",edges:"Kənarlar",sharp:"Kəskin",round:"Dəyirmi",arrowheads:"Ox ucları",arrowhead_none:"Heç biri",arrowhead_arrow:"Ox",arrowhead_bar:"Çubuq",arrowhead_circle:"",arrowhead_circle_outline:"",arrowhead_triangle:"Üçbucaq",arrowhead_triangle_outline:"",arrowhead_diamond:"",arrowhead_diamond_outline:"",fontSize:"Şrift ölçüsü",fontFamily:"Şrift qrupu",addWatermark:'"Made with Excalidraw" əlavə et',handDrawn:"Əllə çəkilmiş",normal:"Normal",code:"Kod",small:"Kiçik",medium:"Orta",large:"Böyük",veryLarge:"Çox böyük",solid:"Solid",hachure:"Ştrix",zigzag:"Ziqzaq",crossHatch:"Çarpaz dəlik",thin:"İncə",bold:"Qalın",left:"Sol",center:"Mərkəz",right:"Sağ",extraBold:"Ekstra qalın",architect:"Memar",artist:"Rəssam",cartoonist:"Karikaturaçı",fileTitle:"Fayl adı",colorPicker:"Rəng seçən",canvasColors:"Kanvas üzərində istifadə olunur",canvasBackground:"Kanvas arxa fonu",drawingCanvas:"Kanvas çəkmək",layers:"Qatlar",actions:"Hərəkətlər",language:"Dil",liveCollaboration:"Canlı əməkdaşlıq...",duplicateSelection:"Dublikat",untitled:"Başlıqsız",name:"Ad",yourName:"Adınız",madeWithExcalidraw:"Excalidraw ilə hazırlanmışdır",group:"Qrup şəklində seçim",ungroup:"Qrupsuz seçim",collaborators:"",showGrid:"",addToLibrary:"",removeFromLibrary:"",libraryLoadingMessage:"",libraries:"",loadingScene:"",align:"",alignTop:"",alignBottom:"",alignLeft:"",alignRight:"",centerVertically:"",centerHorizontally:"",distributeHorizontally:"",distributeVertically:"",flipHorizontal:"",flipVertical:"",viewMode:"",share:"",showStroke:"",showBackground:"",toggleTheme:"",personalLib:"",excalidrawLib:"",decreaseFontSize:"",increaseFontSize:"",unbindText:"",bindText:"",createContainerFromText:"",link:{edit:"",editEmbed:"",create:"",createEmbed:"",label:"",labelEmbed:"",empty:""},lineEditor:{edit:"",exit:""},elementLock:{lock:"",unlock:"",lockAll:"",unlockAll:""},statusPublished:"",sidebarLock:"",selectAllElementsInFrame:"",removeAllElementsFromFrame:"",eyeDropper:"",textToDiagram:"",prompt:""},a={noItems:"",hint_emptyLibrary:"",hint_emptyPrivateLibrary:""},r={clearReset:"",exportJSON:"",exportImage:"",export:"",copyToClipboard:"",save:"",saveAs:"",load:"",getShareableLink:"",close:"",selectLanguage:"",scrollBackToContent:"",zoomIn:"",zoomOut:"",resetZoom:"",menu:"",done:"",edit:"",undo:"",redo:"",resetLibrary:"",createNewRoom:"",fullScreen:"",darkMode:"",lightMode:"",zenMode:"",objectsSnapMode:"",exitZenMode:"",cancel:"",clear:"",remove:"",embed:"",publishLibrary:"",submit:"",confirm:"",embeddableInteractionButton:""},o={clearReset:"",couldNotCreateShareableLink:"",couldNotCreateShareableLinkTooBig:"",couldNotLoadInvalidFile:"",importBackendFailed:"",cannotExportEmptyCanvas:"",couldNotCopyToClipboard:"",decryptFailed:"",uploadedSecurly:"",loadSceneOverridePrompt:"",collabStopOverridePrompt:"",errorAddingToLibrary:"",errorRemovingFromLibrary:"",confirmAddLibrary:"",imageDoesNotContainScene:"",cannotRestoreFromImage:"",invalidSceneUrl:"",resetLibrary:"",removeItemsFromsLibrary:"",invalidEncryptionKey:"",collabOfflineWarning:""},t={unsupportedFileType:"",imageInsertError:"",fileTooBig:"",svgImageInsertError:"",failedToFetchImage:"",invalidSVGString:"",cannotResolveCollabServer:"",importLibraryError:"",collabSaveFailed:"",collabSaveFailed_sizeExceeded:"",imageToolNotSupported:"",brave_measure_text_error:{line1:"",line2:"",line3:"",line4:""},libraryElementTypeError:{embeddable:"",iframe:"",image:""},asyncPasteFailedOnRead:"",asyncPasteFailedOnParse:"",copyToSystemClipboardFailed:""},i={selection:"",image:"",rectangle:"",diamond:"",ellipse:"",arrow:"",line:"",freedraw:"",text:"",library:"",lock:"",penMode:"",link:"",eraser:"",frame:"",magicframe:"",embeddable:"",laser:"",hand:"",extraTools:"",mermaidToExcalidraw:"",magicSettings:""},l={canvasActions:"",selectedShapeActions:"",shapes:""},n={canvasPanning:"",linearElement:"",freeDraw:"",text:"",embeddable:"",text_selected:"",text_editing:"",linearElementMulti:"",lockAngle:"",resize:"",resizeImage:"",rotate:"",lineEditor_info:"",lineEditor_pointSelected:"",lineEditor_nothingSelected:"",placeImage:"",publishLibrary:"",bindTextToElement:"",deepBoxSelect:"",eraserRevert:"",firefox_clipboard_write:"",disableSnapping:""},s={cannotShowPreview:"",canvasTooBig:"",canvasTooBigTip:""},d={headingMain:"",clearCanvasMessage:"",clearCanvasCaveat:"",trackedToSentry:"",openIssueMessage:"",sceneContent:""},u={desc_intro:"",desc_privacy:"",button_startSession:"",button_stopSession:"",desc_inProgressIntro:"",desc_shareLink:"",desc_exitSession:"",shareTitle:""},c={title:""},m={disk_title:"",disk_details:"",disk_button:"",link_title:"",link_details:"",link_button:"",excalidrawplus_description:"",excalidrawplus_button:"",excalidrawplus_exportError:""},p={blog:"",click:"",deepSelect:"",deepBoxSelect:"",curvedArrow:"",curvedLine:"",documentation:"",doubleClick:"",drag:"",editor:"",editLineArrowPoints:"",editText:"",github:"",howto:"",or:"",preventBinding:"",tools:"",shortcuts:"",textFinish:"",textNewLine:"",title:"",view:"",zoomToFit:"",zoomToSelection:"",toggleElementLock:"",movePageUpDown:"",movePageLeftRight:""},g={title:""},b={title:"",itemName:"",authorName:"",githubUsername:"",twitterUsername:"",libraryName:"",libraryDesc:"",website:"",placeholder:{authorName:"",libraryName:"",libraryDesc:"",githubHandle:"",twitterHandle:"",website:""},errors:{required:"",website:""},noteDescription:"",noteGuidelines:"",noteLicense:"",noteItems:"",atleastOneLibItem:"",republishWarning:""},y={title:"",content:""},x={resetLibrary:"",removeItemsFromLib:""},h={header:"",label:{withBackground:"",onlySelected:"",darkMode:"",embedScene:"",scale:"",padding:""},tooltip:{embedScene:""},title:{exportToPng:"",exportToSvg:"",copyPngToClipboard:""},button:{exportToPng:"",exportToSvg:"",copyPngToClipboard:""}},k={tooltip:"",link:""},S={angle:"",element:"",elements:"",height:"",scene:"",selected:"",storage:"",title:"",total:"",version:"",versionCopy:"",versionNotAvailable:"",width:""},v={addedToLibrary:"",copyStyles:"",copyToClipboard:"",copyToClipboardAsPng:"",fileSaved:"",fileSavedToFilename:"",canvas:"",selection:"",pasteAsSingleElement:"",unableToEmbed:"",unrecognizedLinkFormat:""},F={transparent:"",black:"",white:"",red:"",pink:"",grape:"",violet:"",gray:"",blue:"",cyan:"",teal:"",green:"",yellow:"",orange:"",bronze:""},w={app:{center_heading:"",center_heading_plus:"",menuHint:""},defaults:{menuHint:"",center_heading:"",toolbarHint:"",helpHint:""}},E={mostUsedCustomColors:"",colors:"",shades:"",hexCode:"",noShades:""},T={action:{exportToImage:{title:"",button:"",description:""},saveToDisk:{title:"",button:"",description:""},excalidrawPlus:{title:"",button:"",description:""}},modal:{loadFromFile:{title:"",button:"",description:""},shareableLink:{title:"",button:"",description:""}}},_={title:"",button:"",description:"",syntax:"",preview:""},q={labels:e,library:a,buttons:r,alerts:o,errors:t,toolBar:i,headings:l,hints:n,canvasError:s,errorSplash:d,roomDialog:u,errorDialog:c,exportDialog:m,helpDialog:p,clearCanvasDialog:g,publishDialog:b,publishSuccessDialog:y,confirmDialog:x,imageExportDialog:h,encrypted:k,stats:S,toast:v,colors:F,welcomeScreen:w,colorPicker:E,overwriteConfirm:T,mermaid:_};export{o as alerts,r as buttons,s as canvasError,g as clearCanvasDialog,E as colorPicker,F as colors,x as confirmDialog,q as default,k as encrypted,c as errorDialog,d as errorSplash,t as errors,m as exportDialog,l as headings,p as helpDialog,n as hints,h as imageExportDialog,e as labels,a as library,_ as mermaid,T as overwriteConfirm,b as publishDialog,y as publishSuccessDialog,u as roomDialog,S as stats,v as toast,i as toolBar,w as welcomeScreen};
1
+ import"./percentages-BXMCSKIN-WVlHS4wx.js";import"./vendor-syntax-DnmwQQJF.js";import"./vendor-react-9mUTKBHH.js";import"./vendor-markdown-BXEi_H3G.js";import"./AppContent-C0CyP3g5.js";import"./index-ce18TYkg.js";import"./vendor-icons-Lb69KSFJ.js";import"./vendor-i18n-DCFGyhQR.js";import"./LoginModal-CZDEzqjK.js";import"./vendor-xterm-CZq1hqo1.js";import"./vendor-codemirror-D_s0aGBu.js";var e={paste:"Yapışdır",pasteAsPlaintext:"Düz mətn kimi yapışdırın",pasteCharts:"Diaqramları yapışdırın",selectAll:"Hamısını seç",multiSelect:"Seçimə element əlavə edin",moveCanvas:"Kanvası köçürün",cut:"Kəs",copy:"Kopyala",copyAsPng:"PNG olaraq panoya kopyala",copyAsSvg:"SVG olaraq panoya kopyala",copyText:"Mətn olaraq panoya kopyala",copySource:"",convertToCode:"",bringForward:"Önə daşı",sendToBack:"Geriyə göndərin",bringToFront:"Önə gətirin",sendBackward:"Geriyə göndərin",delete:"Sil",copyStyles:"Stilləri kopyalayın",pasteStyles:"Stilləri yapışdırın",stroke:"Strok rəngi",background:"Arxa fon",fill:"Doldur",strokeWidth:"Strok eni",strokeStyle:"Strok stili",strokeStyle_solid:"Solid",strokeStyle_dashed:"Kəsik",strokeStyle_dotted:"Nöqtəli",sloppiness:"Səliqəsizlik",opacity:"Şəffaflıq",textAlign:"Mətni uyğunlaşdır",edges:"Kənarlar",sharp:"Kəskin",round:"Dəyirmi",arrowheads:"Ox ucları",arrowhead_none:"Heç biri",arrowhead_arrow:"Ox",arrowhead_bar:"Çubuq",arrowhead_circle:"",arrowhead_circle_outline:"",arrowhead_triangle:"Üçbucaq",arrowhead_triangle_outline:"",arrowhead_diamond:"",arrowhead_diamond_outline:"",fontSize:"Şrift ölçüsü",fontFamily:"Şrift qrupu",addWatermark:'"Made with Excalidraw" əlavə et',handDrawn:"Əllə çəkilmiş",normal:"Normal",code:"Kod",small:"Kiçik",medium:"Orta",large:"Böyük",veryLarge:"Çox böyük",solid:"Solid",hachure:"Ştrix",zigzag:"Ziqzaq",crossHatch:"Çarpaz dəlik",thin:"İncə",bold:"Qalın",left:"Sol",center:"Mərkəz",right:"Sağ",extraBold:"Ekstra qalın",architect:"Memar",artist:"Rəssam",cartoonist:"Karikaturaçı",fileTitle:"Fayl adı",colorPicker:"Rəng seçən",canvasColors:"Kanvas üzərində istifadə olunur",canvasBackground:"Kanvas arxa fonu",drawingCanvas:"Kanvas çəkmək",layers:"Qatlar",actions:"Hərəkətlər",language:"Dil",liveCollaboration:"Canlı əməkdaşlıq...",duplicateSelection:"Dublikat",untitled:"Başlıqsız",name:"Ad",yourName:"Adınız",madeWithExcalidraw:"Excalidraw ilə hazırlanmışdır",group:"Qrup şəklində seçim",ungroup:"Qrupsuz seçim",collaborators:"",showGrid:"",addToLibrary:"",removeFromLibrary:"",libraryLoadingMessage:"",libraries:"",loadingScene:"",align:"",alignTop:"",alignBottom:"",alignLeft:"",alignRight:"",centerVertically:"",centerHorizontally:"",distributeHorizontally:"",distributeVertically:"",flipHorizontal:"",flipVertical:"",viewMode:"",share:"",showStroke:"",showBackground:"",toggleTheme:"",personalLib:"",excalidrawLib:"",decreaseFontSize:"",increaseFontSize:"",unbindText:"",bindText:"",createContainerFromText:"",link:{edit:"",editEmbed:"",create:"",createEmbed:"",label:"",labelEmbed:"",empty:""},lineEditor:{edit:"",exit:""},elementLock:{lock:"",unlock:"",lockAll:"",unlockAll:""},statusPublished:"",sidebarLock:"",selectAllElementsInFrame:"",removeAllElementsFromFrame:"",eyeDropper:"",textToDiagram:"",prompt:""},a={noItems:"",hint_emptyLibrary:"",hint_emptyPrivateLibrary:""},r={clearReset:"",exportJSON:"",exportImage:"",export:"",copyToClipboard:"",save:"",saveAs:"",load:"",getShareableLink:"",close:"",selectLanguage:"",scrollBackToContent:"",zoomIn:"",zoomOut:"",resetZoom:"",menu:"",done:"",edit:"",undo:"",redo:"",resetLibrary:"",createNewRoom:"",fullScreen:"",darkMode:"",lightMode:"",zenMode:"",objectsSnapMode:"",exitZenMode:"",cancel:"",clear:"",remove:"",embed:"",publishLibrary:"",submit:"",confirm:"",embeddableInteractionButton:""},o={clearReset:"",couldNotCreateShareableLink:"",couldNotCreateShareableLinkTooBig:"",couldNotLoadInvalidFile:"",importBackendFailed:"",cannotExportEmptyCanvas:"",couldNotCopyToClipboard:"",decryptFailed:"",uploadedSecurly:"",loadSceneOverridePrompt:"",collabStopOverridePrompt:"",errorAddingToLibrary:"",errorRemovingFromLibrary:"",confirmAddLibrary:"",imageDoesNotContainScene:"",cannotRestoreFromImage:"",invalidSceneUrl:"",resetLibrary:"",removeItemsFromsLibrary:"",invalidEncryptionKey:"",collabOfflineWarning:""},t={unsupportedFileType:"",imageInsertError:"",fileTooBig:"",svgImageInsertError:"",failedToFetchImage:"",invalidSVGString:"",cannotResolveCollabServer:"",importLibraryError:"",collabSaveFailed:"",collabSaveFailed_sizeExceeded:"",imageToolNotSupported:"",brave_measure_text_error:{line1:"",line2:"",line3:"",line4:""},libraryElementTypeError:{embeddable:"",iframe:"",image:""},asyncPasteFailedOnRead:"",asyncPasteFailedOnParse:"",copyToSystemClipboardFailed:""},i={selection:"",image:"",rectangle:"",diamond:"",ellipse:"",arrow:"",line:"",freedraw:"",text:"",library:"",lock:"",penMode:"",link:"",eraser:"",frame:"",magicframe:"",embeddable:"",laser:"",hand:"",extraTools:"",mermaidToExcalidraw:"",magicSettings:""},l={canvasActions:"",selectedShapeActions:"",shapes:""},n={canvasPanning:"",linearElement:"",freeDraw:"",text:"",embeddable:"",text_selected:"",text_editing:"",linearElementMulti:"",lockAngle:"",resize:"",resizeImage:"",rotate:"",lineEditor_info:"",lineEditor_pointSelected:"",lineEditor_nothingSelected:"",placeImage:"",publishLibrary:"",bindTextToElement:"",deepBoxSelect:"",eraserRevert:"",firefox_clipboard_write:"",disableSnapping:""},s={cannotShowPreview:"",canvasTooBig:"",canvasTooBigTip:""},d={headingMain:"",clearCanvasMessage:"",clearCanvasCaveat:"",trackedToSentry:"",openIssueMessage:"",sceneContent:""},u={desc_intro:"",desc_privacy:"",button_startSession:"",button_stopSession:"",desc_inProgressIntro:"",desc_shareLink:"",desc_exitSession:"",shareTitle:""},c={title:""},m={disk_title:"",disk_details:"",disk_button:"",link_title:"",link_details:"",link_button:"",excalidrawplus_description:"",excalidrawplus_button:"",excalidrawplus_exportError:""},p={blog:"",click:"",deepSelect:"",deepBoxSelect:"",curvedArrow:"",curvedLine:"",documentation:"",doubleClick:"",drag:"",editor:"",editLineArrowPoints:"",editText:"",github:"",howto:"",or:"",preventBinding:"",tools:"",shortcuts:"",textFinish:"",textNewLine:"",title:"",view:"",zoomToFit:"",zoomToSelection:"",toggleElementLock:"",movePageUpDown:"",movePageLeftRight:""},g={title:""},b={title:"",itemName:"",authorName:"",githubUsername:"",twitterUsername:"",libraryName:"",libraryDesc:"",website:"",placeholder:{authorName:"",libraryName:"",libraryDesc:"",githubHandle:"",twitterHandle:"",website:""},errors:{required:"",website:""},noteDescription:"",noteGuidelines:"",noteLicense:"",noteItems:"",atleastOneLibItem:"",republishWarning:""},y={title:"",content:""},x={resetLibrary:"",removeItemsFromLib:""},h={header:"",label:{withBackground:"",onlySelected:"",darkMode:"",embedScene:"",scale:"",padding:""},tooltip:{embedScene:""},title:{exportToPng:"",exportToSvg:"",copyPngToClipboard:""},button:{exportToPng:"",exportToSvg:"",copyPngToClipboard:""}},k={tooltip:"",link:""},S={angle:"",element:"",elements:"",height:"",scene:"",selected:"",storage:"",title:"",total:"",version:"",versionCopy:"",versionNotAvailable:"",width:""},v={addedToLibrary:"",copyStyles:"",copyToClipboard:"",copyToClipboardAsPng:"",fileSaved:"",fileSavedToFilename:"",canvas:"",selection:"",pasteAsSingleElement:"",unableToEmbed:"",unrecognizedLinkFormat:""},F={transparent:"",black:"",white:"",red:"",pink:"",grape:"",violet:"",gray:"",blue:"",cyan:"",teal:"",green:"",yellow:"",orange:"",bronze:""},w={app:{center_heading:"",center_heading_plus:"",menuHint:""},defaults:{menuHint:"",center_heading:"",toolbarHint:"",helpHint:""}},E={mostUsedCustomColors:"",colors:"",shades:"",hexCode:"",noShades:""},T={action:{exportToImage:{title:"",button:"",description:""},saveToDisk:{title:"",button:"",description:""},excalidrawPlus:{title:"",button:"",description:""}},modal:{loadFromFile:{title:"",button:"",description:""},shareableLink:{title:"",button:"",description:""}}},_={title:"",button:"",description:"",syntax:"",preview:""},q={labels:e,library:a,buttons:r,alerts:o,errors:t,toolBar:i,headings:l,hints:n,canvasError:s,errorSplash:d,roomDialog:u,errorDialog:c,exportDialog:m,helpDialog:p,clearCanvasDialog:g,publishDialog:b,publishSuccessDialog:y,confirmDialog:x,imageExportDialog:h,encrypted:k,stats:S,toast:v,colors:F,welcomeScreen:w,colorPicker:E,overwriteConfirm:T,mermaid:_};export{o as alerts,r as buttons,s as canvasError,g as clearCanvasDialog,E as colorPicker,F as colors,x as confirmDialog,q as default,k as encrypted,c as errorDialog,d as errorSplash,t as errors,m as exportDialog,l as headings,p as helpDialog,n as hints,h as imageExportDialog,e as labels,a as library,_ as mermaid,T as overwriteConfirm,b as publishDialog,y as publishSuccessDialog,u as roomDialog,S as stats,v as toast,i as toolBar,w as welcomeScreen};