@tangle-network/agent-app 0.61.4 → 0.62.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (310) hide show
  1. package/dist/{DesignCanvas-L6J72JQ2.js → DesignCanvas-IQKYAEC4.js} +3 -2
  2. package/dist/{DesignCanvasEditor-QFQD63MR.js → DesignCanvasEditor-O7OCZTGC.js} +5 -4
  3. package/dist/{TimelineEditor-7KBPJQLT.js → TimelineEditor-VB2UJ34D.js} +4 -2
  4. package/dist/VaultPane-AYW7CO33.js +8 -0
  5. package/dist/agent-profiles/d1.js +1 -1
  6. package/dist/agent-profiles/index.d.ts +0 -82
  7. package/dist/agent-profiles/index.js +1 -21
  8. package/dist/agent-profiles/self-management.d.ts +0 -55
  9. package/dist/alerting/index.d.ts +1 -1
  10. package/dist/alerting/index.js +1 -3
  11. package/dist/alerting/slack.d.ts +6 -79
  12. package/dist/app-auth/drizzle.d.ts +17 -271
  13. package/dist/app-auth/drizzle.js +6 -2
  14. package/dist/app-auth/drizzle.js.map +1 -1
  15. package/dist/app-auth/index.js +3 -3
  16. package/dist/assets/types.d.ts +2 -1
  17. package/dist/assistant/AssistantPanel.d.ts +1 -1
  18. package/dist/assistant/index.js +635 -392
  19. package/dist/assistant/index.js.map +1 -1
  20. package/dist/billing/identity-locks.d.ts +5 -0
  21. package/dist/billing/index.js +1 -1
  22. package/dist/brand-extraction/index.js.map +1 -1
  23. package/dist/brand-extraction/types.d.ts +2 -1
  24. package/dist/chat-react/index.js +6 -5
  25. package/dist/chat-routes/attachment-write-safety.d.ts +4 -0
  26. package/dist/chat-routes/draft-persistence.d.ts +2 -14
  27. package/dist/chat-routes/index.d.ts +1 -0
  28. package/dist/chat-routes/index.js +853 -773
  29. package/dist/chat-routes/index.js.map +1 -1
  30. package/dist/chat-routes/sandbox-model-source.d.ts +20 -0
  31. package/dist/chat-routes/stored-attachments.d.ts +18 -0
  32. package/dist/chat-routes/turn-admission.d.ts +1 -1
  33. package/dist/chat-routes/turn-execution.d.ts +2 -2
  34. package/dist/chat-routes/turn-route-contracts.d.ts +3 -29
  35. package/dist/chat-store/core.d.ts +19 -1
  36. package/dist/chat-store/index.js.map +1 -1
  37. package/dist/chat-store/store.d.ts +3 -29
  38. package/dist/{chunk-ATQQCG4I.js → chunk-2VJLLRVV.js} +2 -2
  39. package/dist/{chunk-4LBCTFBP.js → chunk-4MD5PS4F.js} +5 -1
  40. package/dist/{chunk-4LBCTFBP.js.map → chunk-4MD5PS4F.js.map} +1 -1
  41. package/dist/{chunk-R4X5474U.js → chunk-52SDU43B.js} +12 -27
  42. package/dist/chunk-52SDU43B.js.map +1 -0
  43. package/dist/{chunk-MDRH3SDA.js → chunk-54YIL7WM.js} +3 -3
  44. package/dist/{chunk-6QJ3GB3A.js → chunk-5GSZGTPJ.js} +2 -2
  45. package/dist/{chunk-5IM2CLYX.js → chunk-6JEDSKFH.js} +232 -218
  46. package/dist/chunk-6JEDSKFH.js.map +1 -0
  47. package/dist/{chunk-6PRQ45QE.js → chunk-6OG4244Y.js} +1 -1
  48. package/dist/chunk-6OG4244Y.js.map +1 -0
  49. package/dist/{chunk-ZDPUC6CM.js → chunk-6ZVSMA4T.js} +3 -3
  50. package/dist/{chunk-TXUAGSFR.js → chunk-76MPX7JQ.js} +47 -1
  51. package/dist/chunk-76MPX7JQ.js.map +1 -0
  52. package/dist/{chunk-BOQ4HVVH.js → chunk-7ISHKBAD.js} +61 -52
  53. package/dist/chunk-7ISHKBAD.js.map +1 -0
  54. package/dist/chunk-7PULOECS.js +22 -0
  55. package/dist/chunk-7PULOECS.js.map +1 -0
  56. package/dist/{chunk-KJODHPWM.js → chunk-CPVGRQ43.js} +511 -339
  57. package/dist/chunk-CPVGRQ43.js.map +1 -0
  58. package/dist/{chunk-LO6VQ35O.js → chunk-CQZVJVME.js} +2 -2
  59. package/dist/{chunk-Y43PXON2.js → chunk-EFQUAWWF.js} +577 -546
  60. package/dist/chunk-EFQUAWWF.js.map +1 -0
  61. package/dist/{chunk-FPNZMIAW.js → chunk-ELX5YITO.js} +1 -1
  62. package/dist/chunk-ELX5YITO.js.map +1 -0
  63. package/dist/chunk-FGAROAUF.js +19 -0
  64. package/dist/chunk-FGAROAUF.js.map +1 -0
  65. package/dist/{chunk-HN6MZ2XL.js → chunk-FTNGGR37.js} +641 -466
  66. package/dist/chunk-FTNGGR37.js.map +1 -0
  67. package/dist/{chunk-G4F2NWZH.js → chunk-FZ3ZFVAC.js} +4 -4
  68. package/dist/{chunk-UCCSJX64.js → chunk-GIEUZBQQ.js} +1112 -644
  69. package/dist/chunk-GIEUZBQQ.js.map +1 -0
  70. package/dist/{chunk-MEKOWH5E.js → chunk-IVBREL7A.js} +785 -526
  71. package/dist/chunk-IVBREL7A.js.map +1 -0
  72. package/dist/{chunk-WSEXFTN4.js → chunk-JBXNU5WD.js} +26 -26
  73. package/dist/chunk-JBXNU5WD.js.map +1 -0
  74. package/dist/{chunk-F2VX6TTJ.js → chunk-JRCZHDRG.js} +2 -41
  75. package/dist/chunk-JRCZHDRG.js.map +1 -0
  76. package/dist/{chunk-LXYQOOXU.js → chunk-JRW6LCIA.js} +552 -302
  77. package/dist/chunk-JRW6LCIA.js.map +1 -0
  78. package/dist/{chunk-TVPH5T4F.js → chunk-KS4I7KVC.js} +16 -22
  79. package/dist/{chunk-TVPH5T4F.js.map → chunk-KS4I7KVC.js.map} +1 -1
  80. package/dist/{chunk-J2BBYVGF.js → chunk-MRZP65DZ.js} +1 -117
  81. package/dist/chunk-MRZP65DZ.js.map +1 -0
  82. package/dist/{chunk-L7LQRJGD.js → chunk-MVKMDROU.js} +48 -48
  83. package/dist/{chunk-L7LQRJGD.js.map → chunk-MVKMDROU.js.map} +1 -1
  84. package/dist/{chunk-4ZSLX3LY.js → chunk-OODZCBSM.js} +1 -1
  85. package/dist/chunk-OODZCBSM.js.map +1 -0
  86. package/dist/chunk-P4RRC4AO.js +47 -0
  87. package/dist/chunk-P4RRC4AO.js.map +1 -0
  88. package/dist/{chunk-ORQD4AUO.js → chunk-PCAY23GS.js} +1 -6
  89. package/dist/chunk-PCAY23GS.js.map +1 -0
  90. package/dist/{chunk-NMZUW6VJ.js → chunk-PEJ5OP5B.js} +3 -3
  91. package/dist/chunk-PEJ5OP5B.js.map +1 -0
  92. package/dist/{chunk-NHYRIM4I.js → chunk-PIPNDZ6H.js} +304 -194
  93. package/dist/chunk-PIPNDZ6H.js.map +1 -0
  94. package/dist/chunk-UHSUY6H6.js +79 -0
  95. package/dist/chunk-UHSUY6H6.js.map +1 -0
  96. package/dist/{chunk-PDD5A43Y.js → chunk-UTL6TEN6.js} +3 -3
  97. package/dist/{chunk-VJBFCNAU.js → chunk-UW2DKTEM.js} +123 -130
  98. package/dist/chunk-UW2DKTEM.js.map +1 -0
  99. package/dist/{chunk-S27DKRI6.js → chunk-VDYEVCQQ.js} +2 -2
  100. package/dist/{chunk-UFQM46NV.js → chunk-VK3F4N4U.js} +2 -2
  101. package/dist/{chunk-6ZIC6OG5.js → chunk-VYBTQK25.js} +126 -122
  102. package/dist/chunk-VYBTQK25.js.map +1 -0
  103. package/dist/{chunk-RL3Z747H.js → chunk-W2BV2XOC.js} +1491 -700
  104. package/dist/chunk-W2BV2XOC.js.map +1 -0
  105. package/dist/{chunk-FUZETA6Z.js → chunk-X6SZGQTK.js} +2 -2
  106. package/dist/{chunk-CD2LQXY6.js → chunk-XOHE6SKU.js} +14 -16
  107. package/dist/{chunk-CD2LQXY6.js.map → chunk-XOHE6SKU.js.map} +1 -1
  108. package/dist/{chunk-ZBB5KQ6B.js → chunk-Y3GO6SG3.js} +73 -66
  109. package/dist/chunk-Y3GO6SG3.js.map +1 -0
  110. package/dist/chunk-ZAMHLXNS.js +56 -0
  111. package/dist/chunk-ZAMHLXNS.js.map +1 -0
  112. package/dist/{chunk-RHFN7TUV.js → chunk-ZDHCV462.js} +47 -44
  113. package/dist/{chunk-RHFN7TUV.js.map → chunk-ZDHCV462.js.map} +1 -1
  114. package/dist/chunk-ZOS3D26Z.js +72 -0
  115. package/dist/chunk-ZOS3D26Z.js.map +1 -0
  116. package/dist/design-canvas/index.js +32 -32
  117. package/dist/design-canvas/index.js.map +1 -1
  118. package/dist/design-canvas-react/components/DesignCanvas.d.ts +1 -1
  119. package/dist/design-canvas-react/components/Workspace.d.ts +1 -1
  120. package/dist/design-canvas-react/components/glyphs.d.ts +31 -40
  121. package/dist/design-canvas-react/components/transform-math.d.ts +0 -8
  122. package/dist/design-canvas-react/components/use-workspace-keyboard.d.ts +2 -2
  123. package/dist/design-canvas-react/contracts.d.ts +2 -2
  124. package/dist/design-canvas-react/engine.js +1 -1
  125. package/dist/design-canvas-react/index.js +9 -7
  126. package/dist/design-canvas-react/index.js.map +1 -1
  127. package/dist/design-canvas-react/lazy.js +1 -1
  128. package/dist/eval/calibration.d.ts +1 -38
  129. package/dist/eval/index.d.ts +2 -4
  130. package/dist/eval/index.js +0 -84
  131. package/dist/eval/index.js.map +1 -1
  132. package/dist/harness/index.d.ts +1 -1
  133. package/dist/harness/index.js +1 -1
  134. package/dist/harness/session-selection.d.ts +2 -2
  135. package/dist/hub-approvals/index.js +1 -1
  136. package/dist/hub-approvals/result.d.ts +1 -1
  137. package/dist/hub-approvals-react/index.js +4 -4
  138. package/dist/hub-approvals-react/index.js.map +1 -1
  139. package/dist/hub-approvals-react/parts.d.ts +1 -1
  140. package/dist/launch-invariants/cli.js +4 -4
  141. package/dist/launch-invariants/index.js +3 -3
  142. package/dist/launch-invariants/testing.js +4 -4
  143. package/dist/legibility/cli.js +1 -1
  144. package/dist/legibility/index.js +1 -1
  145. package/dist/{mention-editor-B23OMFT2.js → mention-editor-4BKBMWIK.js} +83 -57
  146. package/dist/mention-editor-4BKBMWIK.js.map +1 -0
  147. package/dist/missions/index.js +144 -137
  148. package/dist/missions/index.js.map +1 -1
  149. package/dist/operator/index.js +1 -1
  150. package/dist/peer-floors/check.js +1 -1
  151. package/dist/peer-floors/cli.js +6 -14
  152. package/dist/peer-floors/cli.js.map +1 -1
  153. package/dist/peer-floors/source-entries.d.ts +6 -0
  154. package/dist/platform/index.js +10 -10
  155. package/dist/preset-cloudflare/index.js +2 -2
  156. package/dist/profile/index.d.ts +0 -1
  157. package/dist/profile/index.js +1 -422
  158. package/dist/profile/index.js.map +1 -1
  159. package/dist/profile-editor/server.d.ts +0 -1
  160. package/dist/profile-editor/server.js +0 -1
  161. package/dist/profile-editor/server.js.map +1 -1
  162. package/dist/public-consultation/index.d.ts +2 -2
  163. package/dist/public-consultation/index.js +6 -6
  164. package/dist/record/drizzle.js +156 -148
  165. package/dist/record/drizzle.js.map +1 -1
  166. package/dist/runtime/index.js +4 -4
  167. package/dist/runtime/router-turn.js +3 -3
  168. package/dist/sandbox/index.js +8 -6
  169. package/dist/sandbox/transient-failure.d.ts +2 -0
  170. package/dist/sequences/drizzle.js +5 -15
  171. package/dist/sequences/drizzle.js.map +1 -1
  172. package/dist/sequences/index.d.ts +1 -0
  173. package/dist/sequences/index.js +18 -14
  174. package/dist/sequences/index.js.map +1 -1
  175. package/dist/sequences/row-mapping.d.ts +7 -0
  176. package/dist/sequences-react/components/TimelineEditor.d.ts +0 -40
  177. package/dist/sequences-react/components/TimelineHistory.d.ts +31 -0
  178. package/dist/sequences-react/components/glyphs.d.ts +12 -21
  179. package/dist/sequences-react/components/index.d.ts +0 -2
  180. package/dist/sequences-react/components/interaction-math.d.ts +3 -3
  181. package/dist/sequences-react/contracts.d.ts +1 -1
  182. package/dist/sequences-react/engine/snap.d.ts +2 -2
  183. package/dist/sequences-react/index.js +4 -4
  184. package/dist/sequences-react/index.js.map +1 -1
  185. package/dist/settings-react/index.js +13 -30
  186. package/dist/settings-react/index.js.map +1 -1
  187. package/dist/settings-react/timezone-picker.d.ts +0 -6
  188. package/dist/signoff/browser-budget.d.ts +6 -1
  189. package/dist/signoff/cli.d.ts +0 -7
  190. package/dist/signoff/cli.js +1 -2
  191. package/dist/signoff/cli.js.map +1 -1
  192. package/dist/signoff/index.js +1 -1
  193. package/dist/skills/index.d.ts +1 -1
  194. package/dist/skills/index.js +5 -25
  195. package/dist/skills/marketplace.d.ts +1 -75
  196. package/dist/skills-placement/box.js +3 -4
  197. package/dist/skills-placement/box.js.map +1 -1
  198. package/dist/skills-placement/index.js +3 -4
  199. package/dist/spend/cli-args.d.ts +1 -1
  200. package/dist/spend/cli.js +3 -3
  201. package/dist/spend/cli.js.map +1 -1
  202. package/dist/spend/index.js +1 -1
  203. package/dist/stories/design-canvas/fixtures.d.ts +1 -14
  204. package/dist/stream/index.js +17 -17
  205. package/dist/studio/generation.d.ts +1 -1
  206. package/dist/studio/index.js +1 -1
  207. package/dist/studio-react/index.js +353 -184
  208. package/dist/studio-react/index.js.map +1 -1
  209. package/dist/studio-react/studio-composer.d.ts +1 -5
  210. package/dist/studio-react/studio-history-screen.d.ts +1 -1
  211. package/dist/teams/invitations-api.d.ts +3 -3
  212. package/dist/teams/invitations-api.js +74 -72
  213. package/dist/teams/invitations-api.js.map +1 -1
  214. package/dist/teams/member-sync.d.ts +2 -0
  215. package/dist/teams/members-api.d.ts +2 -2
  216. package/dist/teams/members-api.js +1 -1
  217. package/dist/teams-react/index.js +28 -45
  218. package/dist/teams-react/index.js.map +1 -1
  219. package/dist/tools/index.js +1 -1
  220. package/dist/tools/mcp-arguments.d.ts +1 -1
  221. package/dist/trace/index.d.ts +1 -18
  222. package/dist/trace/index.js +1 -36
  223. package/dist/trace/index.js.map +1 -1
  224. package/dist/trace/mission-flow.d.ts +1 -59
  225. package/dist/turn-health/index.d.ts +1 -1
  226. package/dist/turn-health/index.js +2 -2
  227. package/dist/turn-health/sink.d.ts +2 -1
  228. package/dist/turn-trace/index.js +2 -4
  229. package/dist/turn-trace/recorder.d.ts +0 -2
  230. package/dist/vault/VaultPane.d.ts +0 -20
  231. package/dist/vault/VaultPaneOperations.d.ts +318 -0
  232. package/dist/vault/index.js +2 -1
  233. package/dist/vault/index.js.map +1 -1
  234. package/dist/vault/lazy.js +1 -1
  235. package/dist/web-react/agent-profile-editor.d.ts +1 -2
  236. package/dist/web-react/agent-profile-editor.js +6 -5
  237. package/dist/web-react/chat-composer.d.ts +1 -1
  238. package/dist/web-react/durable-plan-flow.d.ts +6 -1
  239. package/dist/web-react/editor-glyphs.d.ts +12 -0
  240. package/dist/web-react/focus-navigation.d.ts +12 -0
  241. package/dist/web-react/history-controls.d.ts +37 -0
  242. package/dist/web-react/index.js +36 -34
  243. package/dist/web-react/interaction-question-card.d.ts +1 -1
  244. package/dist/web-react/record-grid-writes.d.ts +31 -0
  245. package/dist/web-react/record-grid.d.ts +1 -48
  246. package/dist/web-react/session-history-panel.d.ts +1 -9
  247. package/dist/web-react/use-document-dark.d.ts +1 -0
  248. package/dist/workspace-export/engine.d.ts +1 -6
  249. package/dist/workspace-export/index.js +198 -185
  250. package/dist/workspace-export/index.js.map +1 -1
  251. package/dist/workspace-export/routes.d.ts +1 -1
  252. package/dist/workspace-react/index.js +9 -8
  253. package/dist/workspace-react/index.js.map +1 -1
  254. package/package.json +1 -11
  255. package/dist/VaultPane-RXL3WLA2.js +0 -7
  256. package/dist/agent-profiles/reaper.d.ts +0 -31
  257. package/dist/agent-profiles/reaper.js +0 -29
  258. package/dist/agent-profiles/reaper.js.map +0 -1
  259. package/dist/chunk-4ZSLX3LY.js.map +0 -1
  260. package/dist/chunk-5IM2CLYX.js.map +0 -1
  261. package/dist/chunk-6OSJNJA2.js +0 -251
  262. package/dist/chunk-6OSJNJA2.js.map +0 -1
  263. package/dist/chunk-6PRQ45QE.js.map +0 -1
  264. package/dist/chunk-6ZIC6OG5.js.map +0 -1
  265. package/dist/chunk-BDEBQ4WO.js +0 -38
  266. package/dist/chunk-BDEBQ4WO.js.map +0 -1
  267. package/dist/chunk-BOQ4HVVH.js.map +0 -1
  268. package/dist/chunk-F2VX6TTJ.js.map +0 -1
  269. package/dist/chunk-FPNZMIAW.js.map +0 -1
  270. package/dist/chunk-HN6MZ2XL.js.map +0 -1
  271. package/dist/chunk-J2BBYVGF.js.map +0 -1
  272. package/dist/chunk-KJODHPWM.js.map +0 -1
  273. package/dist/chunk-LTWJYNEC.js +0 -100
  274. package/dist/chunk-LTWJYNEC.js.map +0 -1
  275. package/dist/chunk-LXYQOOXU.js.map +0 -1
  276. package/dist/chunk-MEKOWH5E.js.map +0 -1
  277. package/dist/chunk-NHYRIM4I.js.map +0 -1
  278. package/dist/chunk-NMZUW6VJ.js.map +0 -1
  279. package/dist/chunk-ORQD4AUO.js.map +0 -1
  280. package/dist/chunk-R4X5474U.js.map +0 -1
  281. package/dist/chunk-RL3Z747H.js.map +0 -1
  282. package/dist/chunk-TXUAGSFR.js.map +0 -1
  283. package/dist/chunk-UCCSJX64.js.map +0 -1
  284. package/dist/chunk-VJBFCNAU.js.map +0 -1
  285. package/dist/chunk-WSEXFTN4.js.map +0 -1
  286. package/dist/chunk-Y43PXON2.js.map +0 -1
  287. package/dist/chunk-ZBB5KQ6B.js.map +0 -1
  288. package/dist/eval/parity.d.ts +0 -74
  289. package/dist/mention-editor-B23OMFT2.js.map +0 -1
  290. package/dist/profile/humanizer-skill.d.ts +0 -23
  291. package/dist/profile/humanizer-skill.vendored.d.ts +0 -4
  292. package/dist/sequences-react/components/BrandMark.d.ts +0 -10
  293. package/dist/skills/marketplace-drizzle.d.ts +0 -121
  294. package/dist/skills/marketplace-drizzle.js +0 -34
  295. package/dist/skills/marketplace-drizzle.js.map +0 -1
  296. package/dist/teams-react/components/BrandMark.d.ts +0 -10
  297. /package/dist/{DesignCanvas-L6J72JQ2.js.map → DesignCanvas-IQKYAEC4.js.map} +0 -0
  298. /package/dist/{DesignCanvasEditor-QFQD63MR.js.map → DesignCanvasEditor-O7OCZTGC.js.map} +0 -0
  299. /package/dist/{TimelineEditor-7KBPJQLT.js.map → TimelineEditor-VB2UJ34D.js.map} +0 -0
  300. /package/dist/{VaultPane-RXL3WLA2.js.map → VaultPane-AYW7CO33.js.map} +0 -0
  301. /package/dist/{chunk-ATQQCG4I.js.map → chunk-2VJLLRVV.js.map} +0 -0
  302. /package/dist/{chunk-MDRH3SDA.js.map → chunk-54YIL7WM.js.map} +0 -0
  303. /package/dist/{chunk-6QJ3GB3A.js.map → chunk-5GSZGTPJ.js.map} +0 -0
  304. /package/dist/{chunk-ZDPUC6CM.js.map → chunk-6ZVSMA4T.js.map} +0 -0
  305. /package/dist/{chunk-LO6VQ35O.js.map → chunk-CQZVJVME.js.map} +0 -0
  306. /package/dist/{chunk-G4F2NWZH.js.map → chunk-FZ3ZFVAC.js.map} +0 -0
  307. /package/dist/{chunk-PDD5A43Y.js.map → chunk-UTL6TEN6.js.map} +0 -0
  308. /package/dist/{chunk-S27DKRI6.js.map → chunk-VDYEVCQQ.js.map} +0 -0
  309. /package/dist/{chunk-UFQM46NV.js.map → chunk-VK3F4N4U.js.map} +0 -0
  310. /package/dist/{chunk-FUZETA6Z.js.map → chunk-X6SZGQTK.js.map} +0 -0
@@ -1,3 +1,12 @@
1
+ import {
2
+ LockGlyph,
3
+ MagnetGlyph,
4
+ MinusGlyph,
5
+ PlusGlyph,
6
+ RedoGlyph,
7
+ UndoGlyph,
8
+ createEditorGlyph
9
+ } from "./chunk-P4RRC4AO.js";
1
10
  import {
2
11
  addPageCommand,
3
12
  bindSlotCommand,
@@ -194,56 +203,30 @@ import { useEffect, useRef, useState } from "react";
194
203
 
195
204
  // src/design-canvas-react/components/glyphs.tsx
196
205
  import { Fragment as Fragment2, jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
197
- function glyph(paths) {
198
- return function Glyph({ className }) {
199
- return /* @__PURE__ */ jsx3(
200
- "svg",
201
- {
202
- className,
203
- viewBox: "0 0 24 24",
204
- fill: "none",
205
- stroke: "currentColor",
206
- strokeWidth: "2",
207
- strokeLinecap: "round",
208
- strokeLinejoin: "round",
209
- "aria-hidden": true,
210
- children: paths
211
- }
212
- );
213
- };
214
- }
215
- var UndoGlyph = glyph(/* @__PURE__ */ jsx3("path", { d: "M3 7v6h6M3 13a9 9 0 1 0 3-7.7" }));
216
- var RedoGlyph = glyph(/* @__PURE__ */ jsx3("path", { d: "M21 7v6h-6M21 13a9 9 0 1 1-3-7.7" }));
217
- var SwapGlyph = glyph(/* @__PURE__ */ jsx3("path", { d: "M7 4 3 8l4 4M3 8h14M17 20l4-4-4-4M21 16H7" }));
218
- var EyeGlyph = glyph(
206
+ var SwapGlyph = createEditorGlyph(/* @__PURE__ */ jsx3("path", { d: "M7 4 3 8l4 4M3 8h14M17 20l4-4-4-4M21 16H7" }));
207
+ var EyeGlyph = createEditorGlyph(
219
208
  /* @__PURE__ */ jsxs2(Fragment2, { children: [
220
209
  /* @__PURE__ */ jsx3("path", { d: "M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7z" }),
221
210
  /* @__PURE__ */ jsx3("circle", { cx: "12", cy: "12", r: "3" })
222
211
  ] })
223
212
  );
224
- var EyeOffGlyph = glyph(
213
+ var EyeOffGlyph = createEditorGlyph(
225
214
  /* @__PURE__ */ jsxs2(Fragment2, { children: [
226
215
  /* @__PURE__ */ jsx3("path", { d: "M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94" }),
227
216
  /* @__PURE__ */ jsx3("path", { d: "M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19" }),
228
217
  /* @__PURE__ */ jsx3("path", { d: "m1 1 22 22" })
229
218
  ] })
230
219
  );
231
- var LockGlyph = glyph(
232
- /* @__PURE__ */ jsxs2(Fragment2, { children: [
233
- /* @__PURE__ */ jsx3("rect", { x: "5", y: "11", width: "14", height: "10", rx: "2" }),
234
- /* @__PURE__ */ jsx3("path", { d: "M8 11V7a4 4 0 0 1 8 0v4" })
235
- ] })
236
- );
237
- var UnlockGlyph = glyph(
220
+ var UnlockGlyph = createEditorGlyph(
238
221
  /* @__PURE__ */ jsxs2(Fragment2, { children: [
239
222
  /* @__PURE__ */ jsx3("rect", { x: "5", y: "11", width: "14", height: "10", rx: "2" }),
240
223
  /* @__PURE__ */ jsx3("path", { d: "M8 11V7a4 4 0 1 1 8 0" })
241
224
  ] })
242
225
  );
243
- var TrashGlyph = glyph(
226
+ var TrashGlyph = createEditorGlyph(
244
227
  /* @__PURE__ */ jsx3(Fragment2, { children: /* @__PURE__ */ jsx3("path", { d: "M3 6h18M19 6l-1 14H6L5 6M10 6V4h4v2" }) })
245
228
  );
246
- var GroupGlyph = glyph(
229
+ var GroupGlyph = createEditorGlyph(
247
230
  /* @__PURE__ */ jsxs2(Fragment2, { children: [
248
231
  /* @__PURE__ */ jsx3("rect", { x: "2", y: "2", width: "8", height: "8", rx: "1" }),
249
232
  /* @__PURE__ */ jsx3("rect", { x: "14", y: "2", width: "8", height: "8", rx: "1" }),
@@ -251,99 +234,91 @@ var GroupGlyph = glyph(
251
234
  /* @__PURE__ */ jsx3("rect", { x: "14", y: "14", width: "8", height: "8", rx: "1" })
252
235
  ] })
253
236
  );
254
- var UngroupGlyph = glyph(
237
+ var UngroupGlyph = createEditorGlyph(
255
238
  /* @__PURE__ */ jsx3(Fragment2, { children: /* @__PURE__ */ jsx3("path", { d: "M3 7V5a2 2 0 0 1 2-2h2M17 3h2a2 2 0 0 1 2 2v2M21 17v2a2 2 0 0 1-2 2h-2M7 21H5a2 2 0 0 1-2-2v-2" }) })
256
239
  );
257
- var BringFrontGlyph = glyph(
240
+ var BringFrontGlyph = createEditorGlyph(
258
241
  /* @__PURE__ */ jsxs2(Fragment2, { children: [
259
242
  /* @__PURE__ */ jsx3("rect", { x: "8", y: "8", width: "12", height: "12", rx: "1" }),
260
243
  /* @__PURE__ */ jsx3("path", { d: "M4 4h12v4H4z", opacity: ".4" })
261
244
  ] })
262
245
  );
263
- var SendBackGlyph = glyph(
246
+ var SendBackGlyph = createEditorGlyph(
264
247
  /* @__PURE__ */ jsxs2(Fragment2, { children: [
265
248
  /* @__PURE__ */ jsx3("rect", { x: "4", y: "4", width: "12", height: "12", rx: "1", opacity: ".4" }),
266
249
  /* @__PURE__ */ jsx3("path", { d: "M8 8h12v12H8z" })
267
250
  ] })
268
251
  );
269
- var AlignLeftGlyph = glyph(
252
+ var AlignLeftGlyph = createEditorGlyph(
270
253
  /* @__PURE__ */ jsx3(Fragment2, { children: /* @__PURE__ */ jsx3("path", { d: "M3 4v16M7 8h10M7 16h6" }) })
271
254
  );
272
- var AlignCenterGlyph = glyph(
255
+ var AlignCenterGlyph = createEditorGlyph(
273
256
  /* @__PURE__ */ jsx3(Fragment2, { children: /* @__PURE__ */ jsx3("path", { d: "M12 4v16M7 8h10M9 16h6" }) })
274
257
  );
275
- var AlignRightGlyph = glyph(
258
+ var AlignRightGlyph = createEditorGlyph(
276
259
  /* @__PURE__ */ jsx3(Fragment2, { children: /* @__PURE__ */ jsx3("path", { d: "M21 4v16M7 8h10M11 16h6" }) })
277
260
  );
278
- var BoldGlyph = glyph(/* @__PURE__ */ jsx3("path", { d: "M6 4h8a4 4 0 0 1 0 8H6zM6 12h9a4 4 0 0 1 0 8H6z", fill: "currentColor", stroke: "none" }));
279
- var ItalicGlyph = glyph(/* @__PURE__ */ jsx3("path", { d: "M11 4h6M7 20h6M14 4 8 20" }));
280
- var PlusGlyph = glyph(/* @__PURE__ */ jsx3("path", { d: "M12 5v14M5 12h14" }));
281
- var MinusGlyph = glyph(/* @__PURE__ */ jsx3("path", { d: "M5 12h14" }));
282
- var ChevronDownGlyph = glyph(/* @__PURE__ */ jsx3("path", { d: "m6 9 6 6 6-6" }));
283
- var RectGlyph = glyph(/* @__PURE__ */ jsx3("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2" }));
284
- var EllipseGlyph = glyph(/* @__PURE__ */ jsx3("ellipse", { cx: "12", cy: "12", rx: "10", ry: "7" }));
285
- var LineGlyph = glyph(/* @__PURE__ */ jsx3("path", { d: "M5 19 19 5" }));
286
- var TextGlyph = glyph(/* @__PURE__ */ jsx3("path", { d: "M4 7V4h16v3M9 20h6M12 4v16" }));
287
- var ImageGlyph = glyph(
261
+ var BoldGlyph = createEditorGlyph(/* @__PURE__ */ jsx3("path", { d: "M6 4h8a4 4 0 0 1 0 8H6zM6 12h9a4 4 0 0 1 0 8H6z", fill: "currentColor", stroke: "none" }));
262
+ var ItalicGlyph = createEditorGlyph(/* @__PURE__ */ jsx3("path", { d: "M11 4h6M7 20h6M14 4 8 20" }));
263
+ var ChevronDownGlyph = createEditorGlyph(/* @__PURE__ */ jsx3("path", { d: "m6 9 6 6 6-6" }));
264
+ var RectGlyph = createEditorGlyph(/* @__PURE__ */ jsx3("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2" }));
265
+ var EllipseGlyph = createEditorGlyph(/* @__PURE__ */ jsx3("ellipse", { cx: "12", cy: "12", rx: "10", ry: "7" }));
266
+ var LineGlyph = createEditorGlyph(/* @__PURE__ */ jsx3("path", { d: "M5 19 19 5" }));
267
+ var TextGlyph = createEditorGlyph(/* @__PURE__ */ jsx3("path", { d: "M4 7V4h16v3M9 20h6M12 4v16" }));
268
+ var ImageGlyph = createEditorGlyph(
288
269
  /* @__PURE__ */ jsxs2(Fragment2, { children: [
289
270
  /* @__PURE__ */ jsx3("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2" }),
290
271
  /* @__PURE__ */ jsx3("circle", { cx: "9", cy: "9", r: "2" }),
291
272
  /* @__PURE__ */ jsx3("path", { d: "m21 15-3.1-3.1a2 2 0 0 0-2.8 0L6 21" })
292
273
  ] })
293
274
  );
294
- var VideoGlyph = glyph(
275
+ var VideoGlyph = createEditorGlyph(
295
276
  /* @__PURE__ */ jsxs2(Fragment2, { children: [
296
277
  /* @__PURE__ */ jsx3("rect", { x: "2", y: "3", width: "20", height: "18", rx: "2" }),
297
278
  /* @__PURE__ */ jsx3("path", { d: "m10 8 6 4-6 4z", fill: "currentColor", stroke: "none" })
298
279
  ] })
299
280
  );
300
- var SlotGlyph = glyph(
281
+ var SlotGlyph = createEditorGlyph(
301
282
  /* @__PURE__ */ jsxs2(Fragment2, { children: [
302
283
  /* @__PURE__ */ jsx3("path", { d: "M3 4h6.5l2.5 3.5L14.5 4H21v16H3z" }),
303
284
  /* @__PURE__ */ jsx3("circle", { cx: "12", cy: "14", r: "2" })
304
285
  ] })
305
286
  );
306
- var PageGlyph = glyph(
287
+ var PageGlyph = createEditorGlyph(
307
288
  /* @__PURE__ */ jsxs2(Fragment2, { children: [
308
289
  /* @__PURE__ */ jsx3("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }),
309
290
  /* @__PURE__ */ jsx3("polyline", { points: "14 2 14 8 20 8" })
310
291
  ] })
311
292
  );
312
- var GridGlyph = glyph(
293
+ var GridGlyph = createEditorGlyph(
313
294
  /* @__PURE__ */ jsx3(Fragment2, { children: /* @__PURE__ */ jsx3("path", { d: "M3 3h18v18H3zM3 9h18M3 15h18M9 3v18M15 3v18" }) })
314
295
  );
315
- var RulerGlyph = glyph(
296
+ var RulerGlyph = createEditorGlyph(
316
297
  /* @__PURE__ */ jsxs2(Fragment2, { children: [
317
298
  /* @__PURE__ */ jsx3("path", { d: "M1 9v6l12 6V9L1 3z" }),
318
299
  /* @__PURE__ */ jsx3("path", { d: "m13 15 9-4.5V4.5L13 9" }),
319
300
  /* @__PURE__ */ jsx3("path", { d: "M5 12v3M8 13.5v2.5M11 15v3" })
320
301
  ] })
321
302
  );
322
- var MagnetGlyph = glyph(
323
- /* @__PURE__ */ jsxs2(Fragment2, { children: [
324
- /* @__PURE__ */ jsx3("path", { d: "m6 15-4-4 6.75-6.77a7.79 7.79 0 0 1 11 11L13 22l-4-4 6.39-6.36a2.14 2.14 0 0 0-3-3z" }),
325
- /* @__PURE__ */ jsx3("path", { d: "m5 8 4 4M12 15l4 4" })
326
- ] })
327
- );
328
- var BleedGlyph = glyph(
303
+ var BleedGlyph = createEditorGlyph(
329
304
  /* @__PURE__ */ jsxs2(Fragment2, { children: [
330
305
  /* @__PURE__ */ jsx3("rect", { x: "4", y: "4", width: "16", height: "16", strokeDasharray: "3 2" }),
331
306
  /* @__PURE__ */ jsx3("rect", { x: "7", y: "7", width: "10", height: "10" })
332
307
  ] })
333
308
  );
334
- var DuplicateGlyph = glyph(
309
+ var DuplicateGlyph = createEditorGlyph(
335
310
  /* @__PURE__ */ jsxs2(Fragment2, { children: [
336
311
  /* @__PURE__ */ jsx3("rect", { x: "8", y: "8", width: "12", height: "12", rx: "2" }),
337
312
  /* @__PURE__ */ jsx3("path", { d: "M4 16V4a2 2 0 0 1 2-2h12" })
338
313
  ] })
339
314
  );
340
- var ZoomFitGlyph = glyph(
315
+ var ZoomFitGlyph = createEditorGlyph(
341
316
  /* @__PURE__ */ jsx3(Fragment2, { children: /* @__PURE__ */ jsx3("path", { d: "M15 3h6v6M14 10l6.1-6.1M9 21H3v-6M10 14l-6.1 6.1" }) })
342
317
  );
343
- var ExportGlyph = glyph(
318
+ var CanvasExportGlyph = createEditorGlyph(
344
319
  /* @__PURE__ */ jsx3(Fragment2, { children: /* @__PURE__ */ jsx3("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3" }) })
345
320
  );
346
- var ShapesGlyph = glyph(
321
+ var ShapesGlyph = createEditorGlyph(
347
322
  /* @__PURE__ */ jsxs2(Fragment2, { children: [
348
323
  /* @__PURE__ */ jsx3("rect", { x: "3", y: "13", width: "8", height: "8", rx: "1" }),
349
324
  /* @__PURE__ */ jsx3("circle", { cx: "17", cy: "17", r: "4" }),
@@ -1709,7 +1684,7 @@ function ExportControl({ defaults, onExport, className }) {
1709
1684
  },
1710
1685
  className: "flex h-8 items-center gap-1.5 rounded-md border border-[var(--border-default)] px-2.5 text-xs font-medium text-[var(--text-primary)] transition-colors hover:border-[color-mix(in_srgb,var(--brand-primary)_40%,transparent)]",
1711
1686
  children: [
1712
- /* @__PURE__ */ jsx12(ExportGlyph, { className: "h-3.5 w-3.5" }),
1687
+ /* @__PURE__ */ jsx12(CanvasExportGlyph, { className: "h-3.5 w-3.5" }),
1713
1688
  "Export",
1714
1689
  /* @__PURE__ */ jsx12(ChevronDownGlyph, { className: "h-3 w-3 text-[var(--text-muted)]" })
1715
1690
  ]
@@ -1803,7 +1778,7 @@ function useCommitCommand(stack, onApplyOperations, canWrite, setError) {
1803
1778
  [stack, onApplyOperations, canWrite, setError]
1804
1779
  );
1805
1780
  }
1806
- function DesignCanvas({
1781
+ function useDesignCanvasViewState({
1807
1782
  document: initialDocument,
1808
1783
  rev: initialRev,
1809
1784
  canWrite,
@@ -1868,131 +1843,25 @@ function DesignCanvas({
1868
1843
  },
1869
1844
  [stack, editorState.selectedElementIds]
1870
1845
  );
1871
- const handleSetAttrs = useCallback2(
1872
- (elementId, attrs) => {
1873
- const page = requirePage(editorState.document, editorState.activePageId);
1874
- const found = findElement(page, elementId);
1875
- if (!found) return;
1876
- if (found.element.locked) return;
1877
- const priorAttrs = Object.fromEntries(
1878
- Object.keys(attrs).map((k) => [k, found.element[k]])
1879
- );
1880
- commit(
1881
- setAttrsCommand({
1882
- pageId: editorState.activePageId,
1883
- elementId,
1884
- attrs,
1885
- priorAttrs
1886
- })
1887
- );
1888
- },
1889
- [commit, editorState.activePageId, editorState.document]
1890
- );
1891
- const handleMultiSetAttrs = useCallback2(
1892
- (patches) => {
1893
- const page = requirePage(editorState.document, editorState.activePageId);
1894
- const entries = patches.flatMap(({ elementId, attrs }) => {
1895
- const found = findElement(page, elementId);
1896
- if (!found || found.element.locked) return [];
1897
- const priorAttrs = Object.fromEntries(
1898
- Object.keys(attrs).map((k) => [k, found.element[k]])
1899
- );
1900
- return [{ pageId: editorState.activePageId, elementId, attrs, priorAttrs }];
1901
- });
1902
- if (entries.length === 0) return;
1903
- commit(multiSetAttrsCommand(entries));
1904
- },
1905
- [commit, editorState.activePageId, editorState.document]
1906
- );
1907
- const handleReorder = useCallback2(
1908
- (elementId, toIndex, ownerLength, direction) => {
1909
- const page = requirePage(editorState.document, editorState.activePageId);
1910
- const found = findElement(page, elementId);
1911
- if (!found) return;
1912
- const currentIndex = found.index;
1913
- const target = direction === "front" ? topIndex(ownerLength) : direction === "back" ? 0 : direction === "forward" ? indexForward(currentIndex, ownerLength) : indexBackward(currentIndex);
1914
- const clamped = clampIndex(target, ownerLength);
1915
- if (clamped === currentIndex) return;
1916
- commit(reorderElementCommand({ pageId: editorState.activePageId, elementId, toIndex: clamped }));
1917
- },
1918
- [commit, editorState.activePageId, editorState.document]
1919
- );
1920
- const handleDelete = useCallback2(
1921
- (elementIds) => {
1922
- for (const elementId of elementIds) {
1923
- commit(
1924
- deleteElementCommand({
1925
- document: editorState.document,
1926
- pageId: editorState.activePageId,
1927
- elementId
1928
- })
1929
- );
1930
- }
1931
- },
1932
- [commit, editorState.document, editorState.activePageId]
1933
- );
1934
- const handleGroup = useCallback2(
1935
- (elementIds) => {
1936
- commit(
1937
- groupElementsCommand({
1938
- document: editorState.document,
1939
- pageId: editorState.activePageId,
1940
- elementIds,
1941
- groupId: mintId()
1942
- })
1943
- );
1944
- },
1945
- [commit, editorState.document, editorState.activePageId]
1946
- );
1947
- const handleUngroup = useCallback2(
1948
- (groupId) => {
1949
- commit(ungroupElementCommand({ document: editorState.document, pageId: editorState.activePageId, groupId }));
1950
- },
1951
- [commit, editorState.document, editorState.activePageId]
1952
- );
1953
- const handleBindSlot = useCallback2(
1954
- (elementId, slot) => {
1955
- commit(bindSlotCommand({ document: editorState.document, pageId: editorState.activePageId, elementId, slot }));
1956
- },
1957
- [commit, editorState.document, editorState.activePageId]
1958
- );
1959
- const handleSetPageProps = useCallback2(
1960
- (props) => {
1961
- commit(setPagePropsCommand({ document: editorState.document, pageId: editorState.activePageId, props }));
1962
- },
1963
- [commit, editorState.document, editorState.activePageId]
1964
- );
1965
- const handleSetPageGuides = useCallback2(
1966
- (guides) => {
1967
- commit(setPageGuidesCommand({ document: editorState.document, pageId: editorState.activePageId, guides }));
1968
- },
1969
- [commit, editorState.document, editorState.activePageId]
1970
- );
1971
- const handleAddPage = useCallback2(() => {
1972
- const pageId = mintId();
1973
- commit(addPageCommand({ pageId }));
1974
- setActivePage(pageId);
1975
- }, [commit, setActivePage]);
1976
- const handleDuplicatePage = useCallback2(
1977
- (sourcePageId) => {
1978
- const pageId = mintId();
1979
- commit(duplicatePageCommand({ document: editorState.document, sourcePageId, pageId }));
1980
- setActivePage(pageId);
1981
- },
1982
- [commit, editorState.document, setActivePage]
1983
- );
1984
- const handleDeletePage = useCallback2(
1985
- (pageId) => {
1986
- commit(deletePageCommand({ document: editorState.document, pageId }));
1987
- },
1988
- [commit, editorState.document]
1989
- );
1990
- const handleReorderPage = useCallback2(
1991
- (pageId, toIndex) => {
1992
- commit(reorderPageCommand({ pageId, toIndex }));
1993
- },
1994
- [commit]
1995
- );
1846
+ const {
1847
+ handleSetAttrs,
1848
+ handleMultiSetAttrs,
1849
+ handleReorder,
1850
+ handleDelete,
1851
+ handleGroup,
1852
+ handleUngroup,
1853
+ handleBindSlot,
1854
+ handleSetPageProps,
1855
+ handleSetPageGuides,
1856
+ handleAddPage,
1857
+ handleDuplicatePage,
1858
+ handleDeletePage,
1859
+ handleReorderPage
1860
+ } = useDesignCanvasCommands({
1861
+ editorState,
1862
+ commit,
1863
+ setActivePage
1864
+ });
1996
1865
  const handleUndo = useCallback2(() => {
1997
1866
  if (!canWrite || !stack.canUndo()) return;
1998
1867
  let command;
@@ -2064,6 +1933,103 @@ function DesignCanvas({
2064
1933
  return editorState.selectedElementIds.map((id) => activePage.elements.find((el) => el.id === id)).filter((el) => el !== void 0);
2065
1934
  }, [activePage, editorState.selectedElementIds]);
2066
1935
  const review = mode === "review";
1936
+ return {
1937
+ activePage,
1938
+ className,
1939
+ editorState,
1940
+ renderSidePanel,
1941
+ review,
1942
+ selectedElements,
1943
+ canWrite,
1944
+ mode,
1945
+ stack,
1946
+ handleUndo,
1947
+ handleRedo,
1948
+ handleSetAttrs,
1949
+ handleSetPageProps,
1950
+ handleSetPageGuides,
1951
+ handleReorder,
1952
+ handleGroup,
1953
+ handleUngroup,
1954
+ handleDelete,
1955
+ handleBindSlot,
1956
+ pageSizeLabel,
1957
+ enableBleedLabel,
1958
+ onExport,
1959
+ exportDefaults,
1960
+ exportRef,
1961
+ commitError,
1962
+ setCommitError,
1963
+ renderWorkspace,
1964
+ fitRef,
1965
+ fitOnMount,
1966
+ onReady,
1967
+ render,
1968
+ showEmptyState,
1969
+ onAskAgent,
1970
+ setZoom,
1971
+ setPan,
1972
+ setSelectedElements,
1973
+ renderThumbnail,
1974
+ setActivePage,
1975
+ handleAddPage,
1976
+ handleDuplicatePage,
1977
+ handleDeletePage,
1978
+ handleReorderPage,
1979
+ fitLabel,
1980
+ renderAgentPanel
1981
+ };
1982
+ }
1983
+ function DesignCanvas(props) {
1984
+ const view = useDesignCanvasViewState(props);
1985
+ return /* @__PURE__ */ jsx13(DesignCanvasView, { ...view });
1986
+ }
1987
+ function DesignCanvasView({
1988
+ activePage,
1989
+ className,
1990
+ editorState,
1991
+ renderSidePanel,
1992
+ review,
1993
+ selectedElements,
1994
+ canWrite,
1995
+ mode,
1996
+ stack,
1997
+ handleUndo,
1998
+ handleRedo,
1999
+ handleSetAttrs,
2000
+ handleSetPageProps,
2001
+ handleSetPageGuides,
2002
+ handleReorder,
2003
+ handleGroup,
2004
+ handleUngroup,
2005
+ handleDelete,
2006
+ handleBindSlot,
2007
+ pageSizeLabel,
2008
+ enableBleedLabel,
2009
+ onExport,
2010
+ exportDefaults,
2011
+ exportRef,
2012
+ commitError,
2013
+ setCommitError,
2014
+ renderWorkspace,
2015
+ fitRef,
2016
+ fitOnMount,
2017
+ onReady,
2018
+ render,
2019
+ showEmptyState,
2020
+ onAskAgent,
2021
+ setZoom,
2022
+ setPan,
2023
+ setSelectedElements,
2024
+ renderThumbnail,
2025
+ setActivePage,
2026
+ handleAddPage,
2027
+ handleDuplicatePage,
2028
+ handleDeletePage,
2029
+ handleReorderPage,
2030
+ fitLabel,
2031
+ renderAgentPanel
2032
+ }) {
2067
2033
  if (!activePage) {
2068
2034
  return /* @__PURE__ */ jsx13("div", { className: `flex h-full items-center justify-center bg-[var(--bg-input)] ${className ?? ""}`, children: /* @__PURE__ */ jsx13("p", { className: "text-xs text-[var(--text-muted)]", children: "This document has no pages." }) });
2069
2035
  }
@@ -2239,6 +2205,152 @@ function DesignCanvas({
2239
2205
  renderAgentPanel ? /* @__PURE__ */ jsx13("aside", { className: "hidden w-80 shrink-0 flex-col overflow-hidden border-l border-[var(--border-default)] lg:flex", children: renderAgentPanel({ selectedElements, activePageId: editorState.activePageId }) }) : null
2240
2206
  ] });
2241
2207
  }
2208
+ function useDesignCanvasCommands({
2209
+ editorState,
2210
+ commit,
2211
+ setActivePage
2212
+ }) {
2213
+ const handleSetAttrs = useCallback2(
2214
+ (elementId, attrs) => {
2215
+ const page = requirePage(editorState.document, editorState.activePageId);
2216
+ const found = findElement(page, elementId);
2217
+ if (!found) return;
2218
+ if (found.element.locked) return;
2219
+ const priorAttrs = Object.fromEntries(
2220
+ Object.keys(attrs).map((k) => [k, found.element[k]])
2221
+ );
2222
+ commit(
2223
+ setAttrsCommand({
2224
+ pageId: editorState.activePageId,
2225
+ elementId,
2226
+ attrs,
2227
+ priorAttrs
2228
+ })
2229
+ );
2230
+ },
2231
+ [commit, editorState.activePageId, editorState.document]
2232
+ );
2233
+ const handleMultiSetAttrs = useCallback2(
2234
+ (patches) => {
2235
+ const page = requirePage(editorState.document, editorState.activePageId);
2236
+ const entries = patches.flatMap(({ elementId, attrs }) => {
2237
+ const found = findElement(page, elementId);
2238
+ if (!found || found.element.locked) return [];
2239
+ const priorAttrs = Object.fromEntries(
2240
+ Object.keys(attrs).map((k) => [k, found.element[k]])
2241
+ );
2242
+ return [{ pageId: editorState.activePageId, elementId, attrs, priorAttrs }];
2243
+ });
2244
+ if (entries.length === 0) return;
2245
+ commit(multiSetAttrsCommand(entries));
2246
+ },
2247
+ [commit, editorState.activePageId, editorState.document]
2248
+ );
2249
+ const handleReorder = useCallback2(
2250
+ (elementId, toIndex, ownerLength, direction) => {
2251
+ const page = requirePage(editorState.document, editorState.activePageId);
2252
+ const found = findElement(page, elementId);
2253
+ if (!found) return;
2254
+ const currentIndex = found.index;
2255
+ const target = direction === "front" ? topIndex(ownerLength) : direction === "back" ? 0 : direction === "forward" ? indexForward(currentIndex, ownerLength) : indexBackward(currentIndex);
2256
+ const clamped = clampIndex(target, ownerLength);
2257
+ if (clamped === currentIndex) return;
2258
+ commit(reorderElementCommand({ pageId: editorState.activePageId, elementId, toIndex: clamped }));
2259
+ },
2260
+ [commit, editorState.activePageId, editorState.document]
2261
+ );
2262
+ const handleDelete = useCallback2(
2263
+ (elementIds) => {
2264
+ for (const elementId of elementIds) {
2265
+ commit(
2266
+ deleteElementCommand({
2267
+ document: editorState.document,
2268
+ pageId: editorState.activePageId,
2269
+ elementId
2270
+ })
2271
+ );
2272
+ }
2273
+ },
2274
+ [commit, editorState.document, editorState.activePageId]
2275
+ );
2276
+ const handleGroup = useCallback2(
2277
+ (elementIds) => {
2278
+ commit(
2279
+ groupElementsCommand({
2280
+ document: editorState.document,
2281
+ pageId: editorState.activePageId,
2282
+ elementIds,
2283
+ groupId: mintId()
2284
+ })
2285
+ );
2286
+ },
2287
+ [commit, editorState.document, editorState.activePageId]
2288
+ );
2289
+ const handleUngroup = useCallback2(
2290
+ (groupId) => {
2291
+ commit(ungroupElementCommand({ document: editorState.document, pageId: editorState.activePageId, groupId }));
2292
+ },
2293
+ [commit, editorState.document, editorState.activePageId]
2294
+ );
2295
+ const handleBindSlot = useCallback2(
2296
+ (elementId, slot) => {
2297
+ commit(bindSlotCommand({ document: editorState.document, pageId: editorState.activePageId, elementId, slot }));
2298
+ },
2299
+ [commit, editorState.document, editorState.activePageId]
2300
+ );
2301
+ const handleSetPageProps = useCallback2(
2302
+ (props) => {
2303
+ commit(setPagePropsCommand({ document: editorState.document, pageId: editorState.activePageId, props }));
2304
+ },
2305
+ [commit, editorState.document, editorState.activePageId]
2306
+ );
2307
+ const handleSetPageGuides = useCallback2(
2308
+ (guides) => {
2309
+ commit(setPageGuidesCommand({ document: editorState.document, pageId: editorState.activePageId, guides }));
2310
+ },
2311
+ [commit, editorState.document, editorState.activePageId]
2312
+ );
2313
+ const handleAddPage = useCallback2(() => {
2314
+ const pageId = mintId();
2315
+ commit(addPageCommand({ pageId }));
2316
+ setActivePage(pageId);
2317
+ }, [commit, setActivePage]);
2318
+ const handleDuplicatePage = useCallback2(
2319
+ (sourcePageId) => {
2320
+ const pageId = mintId();
2321
+ commit(duplicatePageCommand({ document: editorState.document, sourcePageId, pageId }));
2322
+ setActivePage(pageId);
2323
+ },
2324
+ [commit, editorState.document, setActivePage]
2325
+ );
2326
+ const handleDeletePage = useCallback2(
2327
+ (pageId) => {
2328
+ commit(deletePageCommand({ document: editorState.document, pageId }));
2329
+ },
2330
+ [commit, editorState.document]
2331
+ );
2332
+ const handleReorderPage = useCallback2(
2333
+ (pageId, toIndex) => {
2334
+ commit(reorderPageCommand({ pageId, toIndex }));
2335
+ },
2336
+ [commit]
2337
+ );
2338
+ return {
2339
+ handleSetAttrs,
2340
+ handleMultiSetAttrs,
2341
+ handleReorder,
2342
+ handleDelete,
2343
+ handleGroup,
2344
+ handleUngroup,
2345
+ handleBindSlot,
2346
+ handleSetPageProps,
2347
+ handleSetPageGuides,
2348
+ handleAddPage,
2349
+ handleDuplicatePage,
2350
+ handleDeletePage,
2351
+ handleReorderPage
2352
+ };
2353
+ }
2242
2354
 
2243
2355
  export {
2244
2356
  BrandKnot,
@@ -2248,10 +2360,8 @@ export {
2248
2360
  BleedTrimOverlay,
2249
2361
  EyeGlyph,
2250
2362
  EyeOffGlyph,
2251
- LockGlyph,
2252
2363
  UnlockGlyph,
2253
2364
  GroupGlyph,
2254
- PlusGlyph,
2255
2365
  RectGlyph,
2256
2366
  EllipseGlyph,
2257
2367
  LineGlyph,
@@ -2272,4 +2382,4 @@ export {
2272
2382
  ExportControl,
2273
2383
  DesignCanvas
2274
2384
  };
2275
- //# sourceMappingURL=chunk-NHYRIM4I.js.map
2385
+ //# sourceMappingURL=chunk-PIPNDZ6H.js.map