@1agh/maude 1.9.1 → 2.0.0-rc.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 (1986) hide show
  1. package/README.md +4 -4
  2. package/apps/hub/src/project-transactions/baseline.mjs +276 -0
  3. package/apps/hub/src/project-transactions/kernel.mjs +1756 -0
  4. package/apps/hub/src/project-transactions/lanes.mjs +287 -0
  5. package/apps/hub/src/project-transactions/runs-core.mjs +639 -0
  6. package/apps/hub/src/project-transactions/store-core.mjs +831 -0
  7. package/apps/studio/access/closure.ts +1075 -0
  8. package/apps/studio/access/filters.ts +1193 -0
  9. package/apps/studio/access/frame.ts +365 -0
  10. package/apps/studio/access/known-canvases.ts +82 -0
  11. package/apps/studio/access/request.ts +637 -0
  12. package/apps/studio/access/roles.ts +187 -0
  13. package/apps/studio/access/scope.ts +407 -0
  14. package/apps/studio/access/share-map.ts +434 -0
  15. package/apps/studio/acp/adapter-stderr.ts +22 -0
  16. package/apps/studio/acp/agent-path.ts +39 -0
  17. package/apps/studio/acp/ask-queue.ts +238 -0
  18. package/apps/studio/acp/audience.ts +615 -0
  19. package/apps/studio/acp/bootstrap-brief.ts +32 -15
  20. package/apps/studio/acp/bridge.ts +890 -114
  21. package/apps/studio/acp/chat-search.ts +195 -0
  22. package/apps/studio/acp/connected-fact.ts +83 -0
  23. package/apps/studio/acp/design-write-verb.ts +71 -0
  24. package/apps/studio/acp/env.ts +86 -0
  25. package/apps/studio/acp/index.ts +775 -58
  26. package/apps/studio/acp/login-state.ts +15 -1
  27. package/apps/studio/acp/may-scope.ts +771 -0
  28. package/apps/studio/acp/plugin-bootstrap.ts +90 -5
  29. package/apps/studio/acp/probe.ts +18 -4
  30. package/apps/studio/acp/repo-private.ts +73 -0
  31. package/apps/studio/acp/running.ts +50 -5
  32. package/apps/studio/acp/transcript.ts +356 -21
  33. package/apps/studio/acp/write-scope.ts +141 -11
  34. package/apps/studio/actions/agents.ts +2068 -0
  35. package/apps/studio/actions/canvas-keys.ts +41 -0
  36. package/apps/studio/actions/ctx.ts +118 -0
  37. package/apps/studio/actions/defs/_v1.ts +55 -0
  38. package/apps/studio/actions/defs/ai-runs.ts +56 -0
  39. package/apps/studio/actions/defs/annotation.ts +164 -0
  40. package/apps/studio/actions/defs/app.ts +269 -0
  41. package/apps/studio/actions/defs/canvas.ts +281 -0
  42. package/apps/studio/actions/defs/chat.ts +158 -0
  43. package/apps/studio/actions/defs/diagnostics.ts +52 -0
  44. package/apps/studio/actions/defs/ds.ts +139 -0
  45. package/apps/studio/actions/defs/edit.ts +986 -0
  46. package/apps/studio/actions/defs/export.ts +221 -0
  47. package/apps/studio/actions/defs/history.ts +175 -0
  48. package/apps/studio/actions/defs/native.ts +264 -0
  49. package/apps/studio/actions/defs/presence.ts +53 -0
  50. package/apps/studio/actions/defs/search.ts +90 -0
  51. package/apps/studio/actions/defs/sync.ts +47 -0
  52. package/apps/studio/actions/defs/timeline.ts +254 -0
  53. package/apps/studio/actions/defs/tool.ts +152 -0
  54. package/apps/studio/actions/defs/ui.ts +38 -0
  55. package/apps/studio/actions/defs/video.ts +115 -0
  56. package/apps/studio/actions/defs/view.ts +556 -0
  57. package/apps/studio/actions/documents.ts +32 -0
  58. package/apps/studio/actions/forward.ts +48 -0
  59. package/apps/studio/actions/help.ts +115 -0
  60. package/apps/studio/actions/index.ts +51 -0
  61. package/apps/studio/actions/keymap.gen.ts +1170 -0
  62. package/apps/studio/actions/keys.ts +271 -0
  63. package/apps/studio/actions/legacy.ts +250 -0
  64. package/apps/studio/actions/manifest-version.ts +18 -0
  65. package/apps/studio/actions/menu.ts +203 -0
  66. package/apps/studio/actions/native-menu.ts +132 -0
  67. package/apps/studio/actions/resolve.ts +118 -0
  68. package/apps/studio/actions/types.ts +266 -0
  69. package/apps/studio/actions/uniqueness.ts +119 -0
  70. package/apps/studio/actions/verbs.ts +306 -0
  71. package/apps/studio/actions.manifest.json +7826 -0
  72. package/apps/studio/actions.parity.json +268 -0
  73. package/apps/studio/activity.ts +4 -31
  74. package/apps/studio/agent-runs.ts +676 -0
  75. package/apps/studio/ai/attach-grants.ts +497 -0
  76. package/apps/studio/ai/copy-meta.ts +204 -0
  77. package/apps/studio/ai/create-claim.ts +88 -0
  78. package/apps/studio/ai/lease-home.ts +202 -0
  79. package/apps/studio/ai/run-doing.ts +106 -0
  80. package/apps/studio/ai/run-lifecycle.ts +320 -0
  81. package/apps/studio/ai/run-progress.ts +154 -0
  82. package/apps/studio/ai/runs.ts +1180 -0
  83. package/apps/studio/ai/save-hold.ts +565 -0
  84. package/apps/studio/ai/watch-progress.ts +182 -0
  85. package/apps/studio/ai/write-claim-scope.ts +39 -0
  86. package/apps/studio/ai/write-claim.ts +193 -0
  87. package/apps/studio/ai-banner.tsx +8 -14
  88. package/apps/studio/annotations/ai-read.ts +289 -1
  89. package/apps/studio/annotations/ai-write.ts +281 -23
  90. package/apps/studio/annotations/artboard-members.ts +86 -0
  91. package/apps/studio/annotations/board-ops.ts +358 -0
  92. package/apps/studio/annotations/board-schema.ts +81 -0
  93. package/apps/studio/annotations/constants.ts +2 -0
  94. package/apps/studio/annotations/elements/_shared.ts +290 -1
  95. package/apps/studio/annotations/elements/arrow.model.ts +29 -2
  96. package/apps/studio/annotations/elements/ballot.model.ts +110 -0
  97. package/apps/studio/annotations/elements/media.model.ts +11 -1
  98. package/apps/studio/annotations/elements/section.model.ts +3 -1
  99. package/apps/studio/annotations/elements/stamp.model.ts +83 -0
  100. package/apps/studio/annotations/elements/sticky.model.ts +235 -0
  101. package/apps/studio/annotations/elements/vote.model.ts +71 -0
  102. package/apps/studio/annotations/fields.ts +51 -0
  103. package/apps/studio/annotations/figjam-into.ts +119 -0
  104. package/apps/studio/annotations/hosts.ts +231 -0
  105. package/apps/studio/annotations/migrate-v1.ts +21 -2
  106. package/apps/studio/annotations/ops.ts +23 -0
  107. package/apps/studio/annotations/registry.ts +154 -16
  108. package/apps/studio/annotations/route.ts +268 -0
  109. package/apps/studio/annotations/run-tag.ts +150 -0
  110. package/apps/studio/annotations/stamp-kinds.ts +66 -0
  111. package/apps/studio/annotations/templates.ts +154 -0
  112. package/apps/studio/annotations/text-steps.ts +253 -0
  113. package/apps/studio/annotations/time-marks.ts +140 -0
  114. package/apps/studio/annotations/types.ts +22 -0
  115. package/apps/studio/annotations/ui/ai-marks.tsx +64 -0
  116. package/apps/studio/annotations/ui/ai-seen.tsx +117 -0
  117. package/apps/studio/annotations/ui/arrow-bind.ts +347 -0
  118. package/apps/studio/annotations/ui/arrow-cards.tsx +396 -0
  119. package/apps/studio/annotations/ui/arrow-kinds.ts +90 -0
  120. package/apps/studio/annotations/ui/bar-place.ts +18 -0
  121. package/apps/studio/annotations/ui/element-node.tsx +300 -52
  122. package/apps/studio/annotations/ui/host-view.ts +99 -0
  123. package/apps/studio/annotations/ui/locked.tsx +83 -0
  124. package/apps/studio/annotations/ui/lod.tsx +246 -0
  125. package/apps/studio/annotations/ui/placement.tsx +270 -0
  126. package/apps/studio/annotations/ui/pointer-pipeline.ts +10 -0
  127. package/apps/studio/annotations/ui/posture.ts +124 -0
  128. package/apps/studio/annotations/ui/quiet-tip.ts +28 -0
  129. package/apps/studio/annotations/ui/render-model.ts +27 -2
  130. package/apps/studio/annotations/ui/rest-route.ts +152 -0
  131. package/apps/studio/annotations/ui/ride.ts +957 -0
  132. package/apps/studio/annotations/ui/scene.tsx +59 -11
  133. package/apps/studio/annotations/ui/section-fold.ts +95 -0
  134. package/apps/studio/annotations/ui/shell-asks.ts +62 -0
  135. package/apps/studio/annotations/ui/stamps.ts +221 -0
  136. package/apps/studio/annotations/ui/stamps.tsx +272 -0
  137. package/apps/studio/annotations/ui/sticker-drop.ts +147 -0
  138. package/apps/studio/annotations/ui/sticker-preview.ts +41 -0
  139. package/apps/studio/annotations/ui/sticky-resolve.ts +106 -0
  140. package/apps/studio/annotations/ui/template-place.ts +108 -0
  141. package/apps/studio/annotations/ui/text-editor.tsx +6 -4
  142. package/apps/studio/annotations/ui/text-session.ts +63 -1
  143. package/apps/studio/annotations/ui/text-style.ts +11 -3
  144. package/apps/studio/annotations/ui/time-pins.tsx +134 -0
  145. package/apps/studio/annotations/ui/tool-prefs.ts +242 -0
  146. package/apps/studio/annotations/ui/tool-state.ts +211 -0
  147. package/apps/studio/annotations/ui/visibility.ts +76 -0
  148. package/apps/studio/annotations/ui/vote-dots.tsx +283 -0
  149. package/apps/studio/annotations/v1-adapter.ts +88 -5
  150. package/apps/studio/annotations/validate-board.ts +257 -0
  151. package/apps/studio/annotations/vote-guard.ts +48 -0
  152. package/apps/studio/annotations/votes-local.ts +481 -0
  153. package/apps/studio/annotations-bindings.ts +54 -8
  154. package/apps/studio/annotations-context-toolbar.tsx +612 -150
  155. package/apps/studio/annotations-layer.tsx +1768 -674
  156. package/apps/studio/annotations-model.ts +80 -5
  157. package/apps/studio/api.ts +1522 -454
  158. package/apps/studio/artboard-activity-overlay.tsx +530 -3
  159. package/apps/studio/artboard-ai-copies.tsx +187 -0
  160. package/apps/studio/artboard-convert-marks.tsx +142 -0
  161. package/apps/studio/artboard-gap-mark.tsx +177 -0
  162. package/apps/studio/artboard-ghosts-overlay.tsx +106 -0
  163. package/apps/studio/artboard-growth-memory.ts +56 -0
  164. package/apps/studio/artboard-growth-tag.tsx +115 -0
  165. package/apps/studio/artboard-guides-overlay.tsx +86 -26
  166. package/apps/studio/artboard-marquee.tsx +21 -6
  167. package/apps/studio/artboard-new-section.tsx +188 -0
  168. package/apps/studio/artboard-warn-mark.tsx +330 -0
  169. package/apps/studio/asset-details.ts +339 -0
  170. package/apps/studio/asset-generated.ts +99 -0
  171. package/apps/studio/asset-origins.ts +147 -0
  172. package/apps/studio/asset-placeholder.tsx +481 -0
  173. package/apps/studio/asset-rename.ts +171 -0
  174. package/apps/studio/asset-trash.ts +176 -0
  175. package/apps/studio/asset-upload-bars.tsx +167 -0
  176. package/apps/studio/asset-upload.ts +145 -1
  177. package/apps/studio/attribute-artboards.ts +327 -0
  178. package/apps/studio/bin/_ab-headless.sh +35 -0
  179. package/apps/studio/bin/_ab-park.sh +83 -0
  180. package/apps/studio/bin/_agent-browser-safe.mjs +36 -3
  181. package/apps/studio/bin/_annotate-post.mjs +137 -0
  182. package/apps/studio/bin/_assets.mjs +213 -0
  183. package/apps/studio/bin/_brand-colours.mjs +189 -0
  184. package/apps/studio/bin/_brand-fonts.mjs +158 -0
  185. package/apps/studio/bin/_brand-site.mjs +309 -0
  186. package/apps/studio/bin/_canvas-errors.mjs +143 -0
  187. package/apps/studio/bin/_canvas-rects-playwright.mjs +6 -3
  188. package/apps/studio/bin/_canvas-rects-static.mjs +1 -1
  189. package/apps/studio/bin/_check.mjs +122 -0
  190. package/apps/studio/bin/_comments.mjs +274 -0
  191. package/apps/studio/bin/_curl-local.mjs +122 -3
  192. package/apps/studio/bin/_decode-webaudio.mjs +120 -0
  193. package/apps/studio/bin/_describe.mjs +220 -0
  194. package/apps/studio/bin/_ds-check.mjs +26 -0
  195. package/apps/studio/bin/_ds-prove-playwright.mjs +327 -0
  196. package/apps/studio/bin/_ds-upgrade.mjs +14 -0
  197. package/apps/studio/bin/_ds.mjs +82 -0
  198. package/apps/studio/bin/_enumerate-artboards-playwright.mjs +6 -3
  199. package/apps/studio/bin/_exports.mjs +244 -0
  200. package/apps/studio/bin/_fetch-asset.mjs +209 -15
  201. package/apps/studio/bin/_history.mjs +509 -0
  202. package/apps/studio/bin/_html-playwright.mjs +10 -3
  203. package/apps/studio/bin/_import-asset.mjs +446 -15
  204. package/apps/studio/bin/_import-brand.mjs +40 -156
  205. package/apps/studio/bin/_import-figma.mjs +878 -20
  206. package/apps/studio/bin/_import-tokens.mjs +8 -118
  207. package/apps/studio/bin/_index-cli.mjs +126 -0
  208. package/apps/studio/bin/_layout-check.mjs +35 -0
  209. package/apps/studio/bin/_logs.mjs +130 -0
  210. package/apps/studio/bin/_motion-sample-playwright.mjs +6 -3
  211. package/apps/studio/bin/_no-egress.sh +36 -0
  212. package/apps/studio/bin/_pdf-playwright.mjs +9 -3
  213. package/apps/studio/bin/_perf-probe-safari.mjs +327 -37
  214. package/apps/studio/bin/_perf-probe-studio.mjs +259 -0
  215. package/apps/studio/bin/_perf-probe.mjs +35 -1
  216. package/apps/studio/bin/_perf-shared.mjs +377 -12
  217. package/apps/studio/bin/_place.mjs +35 -0
  218. package/apps/studio/bin/_png-playwright.mjs +27 -7
  219. package/apps/studio/bin/_pptx-playwright.mjs +4 -3
  220. package/apps/studio/bin/_pw-launch.mjs +124 -2
  221. package/apps/studio/bin/_record-shot.sh +65 -0
  222. package/apps/studio/bin/_rects-input.mjs +69 -0
  223. package/apps/studio/bin/_reel-place.mjs +160 -0
  224. package/apps/studio/bin/_region.mjs +37 -1
  225. package/apps/studio/bin/_runs.mjs +178 -0
  226. package/apps/studio/bin/_screenshot-playwright.mjs +6 -3
  227. package/apps/studio/bin/_studio-verb.mjs +220 -0
  228. package/apps/studio/bin/_svg-playwright.mjs +4 -3
  229. package/apps/studio/bin/_sync.mjs +179 -0
  230. package/apps/studio/bin/_thumbs-playwright.mjs +704 -0
  231. package/apps/studio/bin/_tile-draw.mjs +74 -0
  232. package/apps/studio/bin/_transcribe-local.mjs +243 -0
  233. package/apps/studio/bin/_transcribe.mjs +48 -56
  234. package/apps/studio/bin/_trash.mjs +287 -0
  235. package/apps/studio/bin/_url-guard.mjs +88 -0
  236. package/apps/studio/bin/_url-guard.sh +16 -0
  237. package/apps/studio/bin/_video-playwright.mjs +9 -3
  238. package/apps/studio/bin/_video-verbs.mjs +403 -0
  239. package/apps/studio/bin/_write-claim.mjs +124 -0
  240. package/apps/studio/bin/annotate.mjs +348 -330
  241. package/apps/studio/bin/assets.sh +28 -0
  242. package/apps/studio/bin/beats.mjs +237 -0
  243. package/apps/studio/bin/beats.sh +24 -0
  244. package/apps/studio/bin/bootstrap-check.sh +2 -1
  245. package/apps/studio/bin/canvas-edit.sh +17 -9
  246. package/apps/studio/bin/canvas-errors.sh +18 -0
  247. package/apps/studio/bin/canvas-rects.sh +14 -0
  248. package/apps/studio/bin/canvas-source.sh +18 -0
  249. package/apps/studio/bin/captions.sh +13 -0
  250. package/apps/studio/bin/chat-open.sh +2 -2
  251. package/apps/studio/bin/check.sh +27 -0
  252. package/apps/studio/bin/comments.sh +20 -0
  253. package/apps/studio/bin/cut-to-beat.sh +13 -0
  254. package/apps/studio/bin/cut-words.sh +13 -0
  255. package/apps/studio/bin/describe.sh +28 -0
  256. package/apps/studio/bin/draw-proof.sh +41 -8
  257. package/apps/studio/bin/ds-check.sh +30 -0
  258. package/apps/studio/bin/ds-upgrade.sh +30 -0
  259. package/apps/studio/bin/ds.sh +29 -0
  260. package/apps/studio/bin/exports.sh +19 -0
  261. package/apps/studio/bin/generate.sh +45 -3
  262. package/apps/studio/bin/handoff.sh +60 -1
  263. package/apps/studio/bin/history.sh +24 -0
  264. package/apps/studio/bin/import-brand.sh +5 -3
  265. package/apps/studio/bin/index.sh +26 -0
  266. package/apps/studio/bin/layout-check.sh +20 -0
  267. package/apps/studio/bin/logs.sh +17 -0
  268. package/apps/studio/bin/perf.sh +93 -3
  269. package/apps/studio/bin/photo-bg-remove.sh +49 -7
  270. package/apps/studio/bin/place.sh +20 -0
  271. package/apps/studio/bin/read-annotations.mjs +52 -1
  272. package/apps/studio/bin/reel-place.sh +15 -0
  273. package/apps/studio/bin/runs.sh +19 -0
  274. package/apps/studio/bin/screenshot.sh +37 -21
  275. package/apps/studio/bin/server-up.sh +50 -13
  276. package/apps/studio/bin/smoke.sh +10 -0
  277. package/apps/studio/bin/sync.sh +18 -0
  278. package/apps/studio/bin/to-lottie.sh +1 -1
  279. package/apps/studio/bin/transcribe-local.sh +27 -0
  280. package/apps/studio/bin/trash.sh +23 -0
  281. package/apps/studio/bin/visual-sanity.sh +1 -0
  282. package/apps/studio/bridge/canvas-mode-store.ts +301 -0
  283. package/apps/studio/bridge/canvas-modes.ts +548 -0
  284. package/apps/studio/bridge/dgn-protocol.ts +2671 -0
  285. package/apps/studio/bridge/esc-ladder.ts +98 -0
  286. package/apps/studio/bridge/link-target.ts +157 -0
  287. package/apps/studio/bridge/mode-shows.ts +167 -0
  288. package/apps/studio/bridge/occlusion.ts +108 -0
  289. package/apps/studio/bridge/paste-data.ts +101 -0
  290. package/apps/studio/build.ts +12 -1
  291. package/apps/studio/bunfig.toml +4 -0
  292. package/apps/studio/canvas-build-sandbox.ts +34 -5
  293. package/apps/studio/canvas-build-worker.ts +23 -1
  294. package/apps/studio/canvas-build.ts +419 -15
  295. package/apps/studio/canvas-comment-mount.tsx +113 -25
  296. package/apps/studio/canvas-create.ts +285 -49
  297. package/apps/studio/canvas-cursors.ts +12 -0
  298. package/apps/studio/canvas-ds-icons.tsx +241 -0
  299. package/apps/studio/canvas-edit.ts +1188 -172
  300. package/apps/studio/canvas-hud-tokens.gen.ts +120 -0
  301. package/apps/studio/canvas-icons.tsx +47 -0
  302. package/apps/studio/canvas-lib-inline.ts +57 -3
  303. package/apps/studio/canvas-lib.tsx +1033 -263
  304. package/apps/studio/canvas-list-watch.ts +73 -2
  305. package/apps/studio/canvas-meta.schema.json +11 -0
  306. package/apps/studio/canvas-notifications.tsx +28 -3
  307. package/apps/studio/canvas-pipeline.ts +43 -8
  308. package/apps/studio/canvas-replay-keys.ts +65 -0
  309. package/apps/studio/canvas-rows.ts +116 -0
  310. package/apps/studio/canvas-shell.tsx +784 -698
  311. package/apps/studio/canvas-source/errors.ts +315 -0
  312. package/apps/studio/canvas-source/source-map.ts +69 -0
  313. package/apps/studio/canvas-theme-pill.tsx +164 -0
  314. package/apps/studio/canvas-theme.ts +133 -0
  315. package/apps/studio/canvas-top-level.ts +69 -0
  316. package/apps/studio/check/ids.ts +28 -0
  317. package/apps/studio/check/index.ts +586 -0
  318. package/apps/studio/check/link-resolver.ts +75 -0
  319. package/apps/studio/check/meta.ts +79 -0
  320. package/apps/studio/check/video.ts +352 -0
  321. package/apps/studio/client/actions/shell-key-handlers.js +450 -0
  322. package/apps/studio/client/app.jsx +2914 -1203
  323. package/apps/studio/client/canvas-url.js +241 -5
  324. package/apps/studio/client/clipboard-relay.ts +144 -0
  325. package/apps/studio/client/command-palette-match.js +4 -2
  326. package/apps/studio/client/comments-overlay.css +529 -144
  327. package/apps/studio/client/dialogs/asset-picker.jsx +77 -32
  328. package/apps/studio/client/dialogs/command-palette.jsx +453 -67
  329. package/apps/studio/client/dialogs/export-dialog.jsx +6 -781
  330. package/apps/studio/client/dialogs/help-modal.jsx +31 -2
  331. package/apps/studio/client/dialogs/shortcuts-overlay.jsx +201 -106
  332. package/apps/studio/client/edit-op-relay.ts +77 -0
  333. package/apps/studio/client/embed-view.jsx +25 -5
  334. package/apps/studio/client/export-bridge-scope.js +72 -0
  335. package/apps/studio/client/export-center.jsx +179 -369
  336. package/apps/studio/client/export-lane.js +117 -0
  337. package/apps/studio/client/export-region.ts +25 -0
  338. package/apps/studio/client/file-tree.jsx +4 -4
  339. package/apps/studio/client/frame-cap.js +132 -0
  340. package/apps/studio/client/generate-dialog.jsx +38 -36
  341. package/apps/studio/client/github.js +85 -26
  342. package/apps/studio/client/home/HomeAsk.jsx +220 -0
  343. package/apps/studio/client/home/InviteSheet.jsx +150 -0
  344. package/apps/studio/client/home/Shelves.jsx +216 -0
  345. package/apps/studio/client/home/Starters.jsx +42 -0
  346. package/apps/studio/client/home/TargetChip.jsx +152 -0
  347. package/apps/studio/client/home/home-api.js +275 -0
  348. package/apps/studio/client/home/home-app.jsx +1884 -0
  349. package/apps/studio/client/home/home-icons.jsx +143 -0
  350. package/apps/studio/client/home/home-menu.js +43 -0
  351. package/apps/studio/client/home/home-model.js +514 -0
  352. package/apps/studio/client/home/home-starters.js +136 -0
  353. package/apps/studio/client/home/home.css +1681 -0
  354. package/apps/studio/client/home/invite-flow.js +422 -0
  355. package/apps/studio/client/home/shell-mode.js +49 -0
  356. package/apps/studio/client/hooks/annotations-hidden-toast.js +21 -0
  357. package/apps/studio/client/hooks/canvas-origin-probe.js +26 -0
  358. package/apps/studio/client/hooks/edit-scope-query.js +16 -0
  359. package/apps/studio/client/hooks/use-action-keys.jsx +121 -0
  360. package/apps/studio/client/hooks/use-canvas-bridge.jsx +881 -247
  361. package/apps/studio/client/hooks/use-git-actions.jsx +33 -12
  362. package/apps/studio/client/hooks/use-palette-and-panels.jsx +722 -287
  363. package/apps/studio/client/hooks/use-photo-and-timeline.jsx +268 -307
  364. package/apps/studio/client/hooks/use-project-data.jsx +23 -2
  365. package/apps/studio/client/hooks/use-shell-core.jsx +582 -126
  366. package/apps/studio/client/hooks/use-tabs.jsx +268 -126
  367. package/apps/studio/client/index-loader.ts +3 -1
  368. package/apps/studio/client/inspector/color-picker.jsx +29 -18
  369. package/apps/studio/client/inspector/css-knobs.jsx +765 -436
  370. package/apps/studio/client/inspector/css-vocab.jsx +37 -4
  371. package/apps/studio/client/inspector/ds-tokens.js +127 -15
  372. package/apps/studio/client/inspector/grid-tracks-editor.jsx +21 -15
  373. package/apps/studio/client/inspector/inspect-computed.jsx +17 -15
  374. package/apps/studio/client/inspector/inspector-panel.jsx +314 -207
  375. package/apps/studio/client/inspector/layers.jsx +90 -65
  376. package/apps/studio/client/inspector/selection.js +20 -0
  377. package/apps/studio/client/inspector/token-popover.jsx +42 -28
  378. package/apps/studio/client/inspector-controls.jsx +453 -106
  379. package/apps/studio/client/panels/BrandUploadPanel.jsx +8 -229
  380. package/apps/studio/client/panels/ChatPanel.jsx +391 -1674
  381. package/apps/studio/client/panels/CloudBar.jsx +548 -252
  382. package/apps/studio/client/panels/CollabModelInfographic.jsx +77 -20
  383. package/apps/studio/client/panels/CreateProject.jsx +224 -40
  384. package/apps/studio/client/panels/DiffView.jsx +27 -10
  385. package/apps/studio/client/panels/ElicitationPrompt.jsx +4 -3
  386. package/apps/studio/client/panels/FigmaImportPanel.jsx +12 -263
  387. package/apps/studio/client/panels/IdentityBar.jsx +262 -74
  388. package/apps/studio/client/panels/IntroVideoDialog.jsx +6 -1
  389. package/apps/studio/client/panels/PermissionPrompt.jsx +85 -9
  390. package/apps/studio/client/panels/ReadinessList.jsx +71 -46
  391. package/apps/studio/client/panels/RepoBranchSwitcher.jsx +124 -745
  392. package/apps/studio/client/panels/SettingsPanel.jsx +492 -608
  393. package/apps/studio/client/panels/SetupChecklist.jsx +10 -3
  394. package/apps/studio/client/panels/SourceConflictPanel.jsx +96 -20
  395. package/apps/studio/client/panels/SyncConsentDialog.jsx +14 -13
  396. package/apps/studio/client/panels/TeamProjects.jsx +365 -119
  397. package/apps/studio/client/panels/ToolGroup.jsx +6 -2
  398. package/apps/studio/client/panels/acp-runtime.js +127 -22
  399. package/apps/studio/client/panels/acp-usage.js +4 -1
  400. package/apps/studio/client/panels/chat-context.js +74 -5
  401. package/apps/studio/client/panels/chat-header.jsx +67 -0
  402. package/apps/studio/client/panels/chat-markdown.jsx +6 -2
  403. package/apps/studio/client/panels/file-deep-link-dialog.jsx +88 -17
  404. package/apps/studio/client/panels/file-preview.jsx +50 -24
  405. package/apps/studio/client/panels/git-grouping.js +9 -2
  406. package/apps/studio/client/panels/slash-commands.gen.js +171 -0
  407. package/apps/studio/client/panels/slash-commands.js +65 -25
  408. package/apps/studio/client/panels/timeline-media-cache.js +68 -2
  409. package/apps/studio/client/panels/timeline-parse.js +62 -22
  410. package/apps/studio/client/panels/timeline-snap.js +4 -1
  411. package/apps/studio/client/panels/transcript-view.js +9 -0
  412. package/apps/studio/client/photo-knobs.jsx +225 -46
  413. package/apps/studio/client/prefs-migrate.js +79 -0
  414. package/apps/studio/client/report-bug.jsx +59 -26
  415. package/apps/studio/client/selection-scope.js +215 -0
  416. package/apps/studio/client/share-link.js +104 -8
  417. package/apps/studio/client/shell/account-tone.js +28 -0
  418. package/apps/studio/client/shell/banners.jsx +21 -188
  419. package/apps/studio/client/shell/comments-panel.jsx +5 -176
  420. package/apps/studio/client/shell/constants.js +1 -0
  421. package/apps/studio/client/shell/dock.jsx +217 -31
  422. package/apps/studio/client/shell/drop-guard.js +52 -0
  423. package/apps/studio/client/shell/icons.jsx +165 -23
  424. package/apps/studio/client/shell/util.js +20 -33
  425. package/apps/studio/client/shell/viewport.jsx +249 -95
  426. package/apps/studio/client/shell-bus.js +82 -0
  427. package/apps/studio/client/shell-events.js +251 -0
  428. package/apps/studio/client/stamp-follow.js +62 -0
  429. package/apps/studio/client/stores/shell-store.jsx +15 -0
  430. package/apps/studio/client/styles/0-reset.css +79 -16
  431. package/apps/studio/client/styles/1-tokens-maude-v2.css +367 -0
  432. package/apps/studio/client/styles/1-tokens-shell.css +374 -0
  433. package/apps/studio/client/styles/2-layout.css +404 -24
  434. package/apps/studio/client/styles/3-kit-maude-v2.css +683 -0
  435. package/apps/studio/client/styles/_index.css +183 -18
  436. package/apps/studio/client/system/system-view.jsx +52 -6
  437. package/apps/studio/client/tour/collab-tour.js +43 -38
  438. package/apps/studio/client/tour/overlay.jsx +61 -19
  439. package/apps/studio/client/tour/quick-setup-tour.js +27 -20
  440. package/apps/studio/client/tour/tour-model.js +36 -0
  441. package/apps/studio/client/tour/usage-tour.js +43 -24
  442. package/apps/studio/client/tree/tree.jsx +661 -409
  443. package/apps/studio/client/tree-expansion.js +5 -2
  444. package/apps/studio/client/tree-row-menu.jsx +43 -29
  445. package/apps/studio/client/ui-open.js +104 -0
  446. package/apps/studio/client/use-tree-drag.js +2 -0
  447. package/apps/studio/client/v2/access/access-card.jsx +54 -0
  448. package/apps/studio/client/v2/access/access-client.js +525 -0
  449. package/apps/studio/client/v2/access/access-host.jsx +328 -0
  450. package/apps/studio/client/v2/access/access.css +163 -0
  451. package/apps/studio/client/v2/access/ask-to-edit.jsx +97 -0
  452. package/apps/studio/client/v2/access/disabled-reason.js +50 -0
  453. package/apps/studio/client/v2/access/link-off-card.jsx +37 -0
  454. package/apps/studio/client/v2/access/trashed-banner.jsx +123 -0
  455. package/apps/studio/client/v2/advanced/where-matrix.js +231 -0
  456. package/apps/studio/client/v2/ai/AChip.jsx +158 -0
  457. package/apps/studio/client/v2/ai/Advanced.jsx +640 -0
  458. package/apps/studio/client/v2/ai/AiChatIsland.jsx +108 -0
  459. package/apps/studio/client/v2/ai/AskSelectionHost.jsx +173 -0
  460. package/apps/studio/client/v2/ai/AttachMenu.jsx +190 -0
  461. package/apps/studio/client/v2/ai/BigChat.jsx +195 -0
  462. package/apps/studio/client/v2/ai/ChatList.jsx +614 -0
  463. package/apps/studio/client/v2/ai/ChatUndo.jsx +164 -0
  464. package/apps/studio/client/v2/ai/ChoiceCard.jsx +178 -0
  465. package/apps/studio/client/v2/ai/Composer.jsx +655 -0
  466. package/apps/studio/client/v2/ai/ConnectSheet.jsx +118 -0
  467. package/apps/studio/client/v2/ai/Consent.jsx +66 -0
  468. package/apps/studio/client/v2/ai/DropOverlay.jsx +113 -0
  469. package/apps/studio/client/v2/ai/Feed.jsx +589 -0
  470. package/apps/studio/client/v2/ai/FoldNeeds.jsx +23 -0
  471. package/apps/studio/client/v2/ai/NeedsYouSlot.jsx +250 -0
  472. package/apps/studio/client/v2/ai/NotReady.jsx +110 -0
  473. package/apps/studio/client/v2/ai/OfferCard.jsx +165 -0
  474. package/apps/studio/client/v2/ai/PermissionCard.jsx +168 -0
  475. package/apps/studio/client/v2/ai/PickedShots.jsx +33 -0
  476. package/apps/studio/client/v2/ai/ProblemCard.jsx +41 -0
  477. package/apps/studio/client/v2/ai/QuitDialog.jsx +127 -0
  478. package/apps/studio/client/v2/ai/RawLog.jsx +68 -0
  479. package/apps/studio/client/v2/ai/Result.jsx +144 -0
  480. package/apps/studio/client/v2/ai/RunList.jsx +352 -0
  481. package/apps/studio/client/v2/ai/RunSurface.jsx +248 -0
  482. package/apps/studio/client/v2/ai/ScopeChip.jsx +239 -0
  483. package/apps/studio/client/v2/ai/SentStrip.jsx +70 -0
  484. package/apps/studio/client/v2/ai/StoppedDivider.jsx +84 -0
  485. package/apps/studio/client/v2/ai/Suggest.jsx +153 -0
  486. package/apps/studio/client/v2/ai/TurnResult.jsx +95 -0
  487. package/apps/studio/client/v2/ai/WaitingCard.jsx +133 -0
  488. package/apps/studio/client/v2/ai/WillChange.jsx +40 -0
  489. package/apps/studio/client/v2/ai/Working.jsx +74 -0
  490. package/apps/studio/client/v2/ai/advanced-handlers.js +56 -0
  491. package/apps/studio/client/v2/ai/advanced-model.js +214 -0
  492. package/apps/studio/client/v2/ai/ai-list-advanced.css +625 -0
  493. package/apps/studio/client/v2/ai/ai-may.js +75 -0
  494. package/apps/studio/client/v2/ai/ai-offer.js +178 -0
  495. package/apps/studio/client/v2/ai/ai-run.css +281 -0
  496. package/apps/studio/client/v2/ai/ai-send.js +164 -0
  497. package/apps/studio/client/v2/ai/ai.css +261 -0
  498. package/apps/studio/client/v2/ai/answer-note.js +44 -0
  499. package/apps/studio/client/v2/ai/ask-frame.js +131 -0
  500. package/apps/studio/client/v2/ai/ask-selection-lane.js +100 -0
  501. package/apps/studio/client/v2/ai/ask-selection.css +142 -0
  502. package/apps/studio/client/v2/ai/ask-selection.js +84 -0
  503. package/apps/studio/client/v2/ai/attach.css +366 -0
  504. package/apps/studio/client/v2/ai/attach.js +186 -0
  505. package/apps/studio/client/v2/ai/chat-list-model.js +333 -0
  506. package/apps/studio/client/v2/ai/chat-store-api.js +93 -0
  507. package/apps/studio/client/{styles/6-acp-chat.css → v2/ai/chat.css} +1152 -797
  508. package/apps/studio/client/v2/ai/connect-flow.js +75 -0
  509. package/apps/studio/client/v2/ai/gate-lines.js +121 -0
  510. package/apps/studio/client/v2/ai/icons.jsx +66 -0
  511. package/apps/studio/client/v2/ai/jump-model.js +61 -0
  512. package/apps/studio/client/v2/ai/made-by-ai.js +179 -0
  513. package/apps/studio/client/v2/ai/needs-you-store.js +112 -0
  514. package/apps/studio/client/v2/ai/needs-you-toast.js +104 -0
  515. package/apps/studio/client/v2/ai/needs-you.css +554 -0
  516. package/apps/studio/client/v2/ai/needs-you.js +391 -0
  517. package/apps/studio/client/v2/ai/panel-focus.js +71 -0
  518. package/apps/studio/client/v2/ai/panel.css +88 -0
  519. package/apps/studio/client/v2/ai/paste-chips.jsx +108 -0
  520. package/apps/studio/client/v2/ai/picked-shots.js +48 -0
  521. package/apps/studio/client/v2/ai/quit.css +64 -0
  522. package/apps/studio/client/v2/ai/result-shown.js +50 -0
  523. package/apps/studio/client/v2/ai/ring-relay.js +143 -0
  524. package/apps/studio/client/v2/ai/row-slots-lane.js +67 -0
  525. package/apps/studio/client/v2/ai/run-api.js +137 -0
  526. package/apps/studio/client/v2/ai/run-cards.js +31 -0
  527. package/apps/studio/client/v2/ai/run-compare.js +60 -0
  528. package/apps/studio/client/v2/ai/run-icons.jsx +53 -0
  529. package/apps/studio/client/v2/ai/run-model.js +348 -0
  530. package/apps/studio/client/v2/ai/runs-model.js +568 -0
  531. package/apps/studio/client/v2/ai/runs-store.js +161 -0
  532. package/apps/studio/client/v2/ai/runs.css +226 -0
  533. package/apps/studio/client/v2/ai/scope.js +298 -0
  534. package/apps/studio/client/v2/ai/seen-relay.js +95 -0
  535. package/apps/studio/client/v2/ai/sent-attachments.js +77 -0
  536. package/apps/studio/client/v2/ai/stopped.js +69 -0
  537. package/apps/studio/client/v2/ai/suggest-why.js +200 -0
  538. package/apps/studio/client/v2/ai/use-ai-scope.js +198 -0
  539. package/apps/studio/client/v2/ai/use-ask-ai.js +63 -0
  540. package/apps/studio/client/v2/ai/use-ask-selection.js +41 -0
  541. package/apps/studio/client/v2/ai/use-attachments.js +239 -0
  542. package/apps/studio/client/v2/ai/use-chat-runs.js +32 -0
  543. package/apps/studio/client/v2/ai/use-run-versions.js +39 -0
  544. package/apps/studio/client/v2/ai/video/ClipsAttached.jsx +23 -0
  545. package/apps/studio/client/v2/ai/video/LeftOut.jsx +29 -0
  546. package/apps/studio/client/v2/ai/video/WatchProgress.jsx +65 -0
  547. package/apps/studio/client/v2/ai/video/card-model.js +107 -0
  548. package/apps/studio/client/v2/ai/video/cards.jsx +51 -0
  549. package/apps/studio/client/v2/ai/video/clip-pic.js +12 -0
  550. package/apps/studio/client/v2/ai/video/video-cards.css +168 -0
  551. package/apps/studio/client/v2/annotations/annotation-asks.js +171 -0
  552. package/apps/studio/client/v2/annotations/annotation-list-model.js +238 -0
  553. package/apps/studio/client/v2/annotations/annotation-list.css +277 -0
  554. package/apps/studio/client/v2/annotations/annotation-list.jsx +433 -0
  555. package/apps/studio/client/v2/annotations/recent-stickers.js +64 -0
  556. package/apps/studio/client/v2/annotations/stamp-row.jsx +66 -0
  557. package/apps/studio/client/v2/annotations/stamps-glyphs.jsx +35 -0
  558. package/apps/studio/client/v2/annotations/sticker-preload.js +44 -0
  559. package/apps/studio/client/v2/annotations/sticker-search.js +155 -0
  560. package/apps/studio/client/v2/annotations/stickers-gallery.css +295 -0
  561. package/apps/studio/client/v2/annotations/stickers-gallery.jsx +454 -0
  562. package/apps/studio/client/v2/annotations/templates-panel.css +344 -0
  563. package/apps/studio/client/v2/annotations/templates-panel.jsx +240 -0
  564. package/apps/studio/client/v2/annotations/v2-scope.js +20 -0
  565. package/apps/studio/client/v2/annotations/vote-bar.jsx +212 -0
  566. package/apps/studio/client/v2/annotations/vote-sheet.jsx +200 -0
  567. package/apps/studio/client/v2/annotations/vote-store.js +392 -0
  568. package/apps/studio/client/v2/annotations/vote.css +153 -0
  569. package/apps/studio/client/v2/assets/ask-once.js +65 -0
  570. package/apps/studio/client/v2/assets/asset-drop-session.js +238 -0
  571. package/apps/studio/client/v2/assets/asset-state-lane.js +267 -0
  572. package/apps/studio/client/v2/assets/assets-bus.js +109 -0
  573. package/apps/studio/client/v2/assets/browse-model.js +90 -0
  574. package/apps/studio/client/v2/assets/browse-view.jsx +202 -0
  575. package/apps/studio/client/v2/assets/canvas-drop-catcher.jsx +114 -0
  576. package/apps/studio/client/v2/assets/connect-key-sheet.jsx +69 -0
  577. package/apps/studio/client/v2/assets/copy-asset.js +37 -0
  578. package/apps/studio/client/v2/assets/describe-client.js +156 -0
  579. package/apps/studio/client/v2/assets/describe-consent.jsx +184 -0
  580. package/apps/studio/client/v2/assets/describe.css +72 -0
  581. package/apps/studio/client/v2/assets/details-advanced.jsx +76 -0
  582. package/apps/studio/client/v2/assets/details-model.js +233 -0
  583. package/apps/studio/client/v2/assets/details.jsx +292 -0
  584. package/apps/studio/client/v2/assets/generate-ask.jsx +506 -0
  585. package/apps/studio/client/v2/assets/generated.js +83 -0
  586. package/apps/studio/client/v2/assets/import-lines.js +228 -0
  587. package/apps/studio/client/v2/assets/import-offline.js +32 -0
  588. package/apps/studio/client/v2/assets/import-toast.js +56 -0
  589. package/apps/studio/client/v2/assets/just-added.js +32 -0
  590. package/apps/studio/client/v2/assets/kinds-chip.jsx +77 -0
  591. package/apps/studio/client/v2/assets/library-foot.js +42 -0
  592. package/apps/studio/client/v2/assets/missing-frame.css +60 -0
  593. package/apps/studio/client/v2/assets/missing-frame.jsx +218 -0
  594. package/apps/studio/client/v2/assets/multi-select.js +58 -0
  595. package/apps/studio/client/v2/assets/place-asset.js +128 -0
  596. package/apps/studio/client/v2/assets/relink.js +96 -0
  597. package/apps/studio/client/v2/assets/rename-asset.js +83 -0
  598. package/apps/studio/client/v2/assets/search-marks.jsx +75 -0
  599. package/apps/studio/client/v2/assets/takes-overlay.jsx +86 -0
  600. package/apps/studio/client/v2/assets/takes.css +177 -0
  601. package/apps/studio/client/v2/assets/takes.js +224 -0
  602. package/apps/studio/client/v2/assets/tidy.jsx +144 -0
  603. package/apps/studio/client/v2/assets/tile-drag.js +53 -0
  604. package/apps/studio/client/v2/assets/tile-menu.jsx +119 -0
  605. package/apps/studio/client/v2/assets/tile.jsx +131 -0
  606. package/apps/studio/client/v2/assets/trash-assets.js +98 -0
  607. package/apps/studio/client/v2/assets/use-asset-details.js +58 -0
  608. package/apps/studio/client/v2/assets/use-assets.js +121 -0
  609. package/apps/studio/client/v2/assets/use-takes-lane.js +150 -0
  610. package/apps/studio/client/v2/canvases/canvas-icons.jsx +107 -0
  611. package/apps/studio/client/v2/canvases/canvases-panel.jsx +1466 -0
  612. package/apps/studio/client/v2/canvases/canvases.css +699 -0
  613. package/apps/studio/client/v2/canvases/covers.js +32 -0
  614. package/apps/studio/client/v2/canvases/inline-rename.jsx +122 -0
  615. package/apps/studio/client/v2/canvases/jump-list.jsx +100 -0
  616. package/apps/studio/client/v2/canvases/jump-model.js +102 -0
  617. package/apps/studio/client/v2/canvases/kept-on-this-mac.jsx +192 -0
  618. package/apps/studio/client/v2/canvases/last-canvas.js +36 -0
  619. package/apps/studio/client/v2/canvases/move-model.js +45 -0
  620. package/apps/studio/client/v2/canvases/move-sheet.jsx +91 -0
  621. package/apps/studio/client/v2/canvases/open-link.js +154 -0
  622. package/apps/studio/client/v2/canvases/panel-search.js +156 -0
  623. package/apps/studio/client/v2/canvases/rename-model.js +134 -0
  624. package/apps/studio/client/v2/canvases/row-menu.jsx +145 -0
  625. package/apps/studio/client/v2/canvases/row-slots.js +224 -0
  626. package/apps/studio/client/v2/canvases/sort.js +132 -0
  627. package/apps/studio/client/v2/canvases/support-model.js +68 -0
  628. package/apps/studio/client/v2/canvases/trash-canvas.js +120 -0
  629. package/apps/studio/client/v2/canvases/tree-model.js +760 -0
  630. package/apps/studio/client/v2/canvases/use-canvas-index.js +50 -0
  631. package/apps/studio/client/v2/canvases/use-canvases-sort.js +59 -0
  632. package/apps/studio/client/v2/canvases/use-move.js +61 -0
  633. package/apps/studio/client/v2/canvases/use-pins.js +80 -0
  634. package/apps/studio/client/v2/cloud/browser-door.js +152 -0
  635. package/apps/studio/client/v2/cloud/cloud-name.js +38 -0
  636. package/apps/studio/client/v2/code/canvas-error-card.jsx +407 -0
  637. package/apps/studio/client/v2/code/canvas-imports-card.jsx +31 -0
  638. package/apps/studio/client/v2/code/code-bus.js +63 -0
  639. package/apps/studio/client/v2/code/code-view.jsx +277 -0
  640. package/apps/studio/client/v2/code/code.css +373 -0
  641. package/apps/studio/client/v2/code/highlight.js +163 -0
  642. package/apps/studio/client/v2/code/use-canvas-source.js +338 -0
  643. package/apps/studio/client/v2/comments/comment-bridge.js +154 -0
  644. package/apps/studio/client/v2/comments/comment-client.js +84 -0
  645. package/apps/studio/client/v2/comments/comment-tool.js +18 -0
  646. package/apps/studio/client/v2/comments/comments-model.js +213 -0
  647. package/apps/studio/client/v2/comments/comments-panel.jsx +400 -0
  648. package/apps/studio/client/v2/comments/comments.css +305 -0
  649. package/apps/studio/client/v2/comments/mention-callouts.jsx +90 -0
  650. package/apps/studio/client/v2/comments/mention-model.js +118 -0
  651. package/apps/studio/client/v2/comments/native-mention-notice.js +73 -0
  652. package/apps/studio/client/v2/comments/reply-focus.js +30 -0
  653. package/apps/studio/client/v2/comments/use-comments-shell.jsx +176 -0
  654. package/apps/studio/client/v2/create/NameDialog.jsx +95 -0
  655. package/apps/studio/client/v2/create/NameDialogHost.jsx +141 -0
  656. package/apps/studio/client/v2/create/create-project.css +260 -0
  657. package/apps/studio/client/v2/create/duplicate-done.js +45 -0
  658. package/apps/studio/client/v2/create/empty-project.css +113 -0
  659. package/apps/studio/client/v2/create/empty-project.jsx +162 -0
  660. package/apps/studio/client/v2/create/first-draft.js +30 -0
  661. package/apps/studio/client/v2/create/intent-host.jsx +40 -0
  662. package/apps/studio/client/v2/create/name-dialog-bus.js +41 -0
  663. package/apps/studio/client/v2/create/name-dialog.css +36 -0
  664. package/apps/studio/client/v2/create/new-canvas.js +64 -0
  665. package/apps/studio/client/v2/create/open-sizes.js +41 -0
  666. package/apps/studio/client/v2/create/render-error.css +29 -0
  667. package/apps/studio/client/v2/create/render-error.jsx +107 -0
  668. package/apps/studio/client/v2/create/repair-offer.js +36 -0
  669. package/apps/studio/client/v2/create/take-intent.js +154 -0
  670. package/apps/studio/client/v2/create/use-project-empty.js +85 -0
  671. package/apps/studio/client/v2/create/use-render-error.js +116 -0
  672. package/apps/studio/client/v2/diagnostics/diagnostics-bus.js +47 -0
  673. package/apps/studio/client/v2/diagnostics/diagnostics-handlers.js +108 -0
  674. package/apps/studio/client/v2/diagnostics/diagnostics-host.jsx +196 -0
  675. package/apps/studio/client/v2/diagnostics/diagnostics-model.js +253 -0
  676. package/apps/studio/client/v2/diagnostics/diagnostics-sheet.jsx +557 -0
  677. package/apps/studio/client/v2/diagnostics/diagnostics.css +612 -0
  678. package/apps/studio/client/v2/diagnostics/resync-model.js +51 -0
  679. package/apps/studio/client/v2/diagnostics/resync-run.js +79 -0
  680. package/apps/studio/client/v2/diagnostics/sync-actions.js +38 -0
  681. package/apps/studio/client/v2/diagnostics/sync-details/sync-details-model.js +241 -0
  682. package/apps/studio/client/v2/diagnostics/sync-details/sync-details.jsx +392 -0
  683. package/apps/studio/client/v2/diagnostics/use-diagnostics-menu.js +58 -0
  684. package/apps/studio/client/v2/ds/advanced-bus.js +40 -0
  685. package/apps/studio/client/v2/ds/advanced-host.jsx +228 -0
  686. package/apps/studio/client/v2/ds/advanced-model.js +110 -0
  687. package/apps/studio/client/v2/ds/advanced-store.js +47 -0
  688. package/apps/studio/client/v2/ds/advanced.css +277 -0
  689. package/apps/studio/client/v2/ds/advanced.jsx +203 -0
  690. package/apps/studio/client/v2/ds/check-card.jsx +80 -0
  691. package/apps/studio/client/v2/ds/colour-picker.jsx +121 -0
  692. package/apps/studio/client/v2/ds/colour-words.js +48 -0
  693. package/apps/studio/client/v2/ds/conflict-pick.jsx +151 -0
  694. package/apps/studio/client/v2/ds/contrast-warning.jsx +80 -0
  695. package/apps/studio/client/v2/ds/contrast.js +137 -0
  696. package/apps/studio/client/v2/ds/convert-dialog.jsx +133 -0
  697. package/apps/studio/client/v2/ds/convert-host.jsx +143 -0
  698. package/apps/studio/client/v2/ds/convert-model.js +221 -0
  699. package/apps/studio/client/v2/ds/default-write.js +69 -0
  700. package/apps/studio/client/v2/ds/direction-bar.jsx +287 -0
  701. package/apps/studio/client/v2/ds/door-write.js +163 -0
  702. package/apps/studio/client/v2/ds/edge-model.js +151 -0
  703. package/apps/studio/client/v2/ds/edge-write.js +91 -0
  704. package/apps/studio/client/v2/ds/edges.css +152 -0
  705. package/apps/studio/client/v2/ds/follower-swap.js +88 -0
  706. package/apps/studio/client/v2/ds/go-to.js +71 -0
  707. package/apps/studio/client/v2/ds/kinds/master.jsx +214 -0
  708. package/apps/studio/client/v2/ds/kinds/token.jsx +546 -0
  709. package/apps/studio/client/v2/ds/library-bus.js +43 -0
  710. package/apps/studio/client/v2/ds/library-card.jsx +379 -0
  711. package/apps/studio/client/v2/ds/library-host.jsx +436 -0
  712. package/apps/studio/client/v2/ds/library-model.js +305 -0
  713. package/apps/studio/client/v2/ds/library-store.js +45 -0
  714. package/apps/studio/client/v2/ds/library.css +148 -0
  715. package/apps/studio/client/v2/ds/make-host.jsx +244 -0
  716. package/apps/studio/client/v2/ds/make-model.js +208 -0
  717. package/apps/studio/client/v2/ds/make-sheet.jsx +264 -0
  718. package/apps/studio/client/v2/ds/make-write.js +90 -0
  719. package/apps/studio/client/v2/ds/make.css +242 -0
  720. package/apps/studio/client/v2/ds/master-write.js +145 -0
  721. package/apps/studio/client/v2/ds/new-canvas-default.js +89 -0
  722. package/apps/studio/client/v2/ds/off-system-host.jsx +107 -0
  723. package/apps/studio/client/v2/ds/off-system.jsx +101 -0
  724. package/apps/studio/client/v2/ds/outside-banner.jsx +153 -0
  725. package/apps/studio/client/v2/ds/pinned-rows.js +138 -0
  726. package/apps/studio/client/v2/ds/pins.js +102 -0
  727. package/apps/studio/client/v2/ds/preview-bar.jsx +220 -0
  728. package/apps/studio/client/v2/ds/preview-doors.js +47 -0
  729. package/apps/studio/client/v2/ds/preview-mode.js +163 -0
  730. package/apps/studio/client/v2/ds/reach-data.js +68 -0
  731. package/apps/studio/client/v2/ds/reach-model.js +184 -0
  732. package/apps/studio/client/v2/ds/reach-view.jsx +577 -0
  733. package/apps/studio/client/v2/ds/reach.css +298 -0
  734. package/apps/studio/client/v2/ds/rename-write.js +88 -0
  735. package/apps/studio/client/v2/ds/review-bus.js +41 -0
  736. package/apps/studio/client/v2/ds/review-host.jsx +438 -0
  737. package/apps/studio/client/v2/ds/review-model.js +307 -0
  738. package/apps/studio/client/v2/ds/review-sheet.jsx +390 -0
  739. package/apps/studio/client/v2/ds/review.css +894 -0
  740. package/apps/studio/client/v2/ds/row-dots.js +41 -0
  741. package/apps/studio/client/v2/ds/switch-bus.js +56 -0
  742. package/apps/studio/client/v2/ds/switch-host.jsx +241 -0
  743. package/apps/studio/client/v2/ds/switch-model.js +254 -0
  744. package/apps/studio/client/v2/ds/switch-sheet.jsx +364 -0
  745. package/apps/studio/client/v2/ds/switch.css +263 -0
  746. package/apps/studio/client/v2/ds/system-menu.jsx +81 -0
  747. package/apps/studio/client/v2/ds/system-rename.jsx +102 -0
  748. package/apps/studio/client/v2/ds/token-write.js +241 -0
  749. package/apps/studio/client/v2/ds/token.css +185 -0
  750. package/apps/studio/client/v2/ds/trash-token-sheet.jsx +112 -0
  751. package/apps/studio/client/v2/ds/truth-card.jsx +85 -0
  752. package/apps/studio/client/v2/ds/truth-host.jsx +239 -0
  753. package/apps/studio/client/v2/ds/truth-model.js +315 -0
  754. package/apps/studio/client/v2/ds/truth-store.js +45 -0
  755. package/apps/studio/client/v2/ds/truth.css +143 -0
  756. package/apps/studio/client/v2/ds/update-available.jsx +261 -0
  757. package/apps/studio/client/v2/ds/update-dots.js +103 -0
  758. package/apps/studio/client/v2/ds/update-model.js +295 -0
  759. package/apps/studio/client/v2/ds/upgrade-bus.js +40 -0
  760. package/apps/studio/client/v2/ds/upgrade-host.jsx +185 -0
  761. package/apps/studio/client/v2/ds/upgrade-model.js +266 -0
  762. package/apps/studio/client/v2/ds/upgrade-offers.js +34 -0
  763. package/apps/studio/client/v2/ds/upgrade-sheet.jsx +277 -0
  764. package/apps/studio/client/v2/ds/upgrade.css +166 -0
  765. package/apps/studio/client/v2/ds/use-covers.js +27 -0
  766. package/apps/studio/client/v2/ds/use-ds-frames.js +165 -0
  767. package/apps/studio/client/v2/ds/use-ds-model.js +61 -0
  768. package/apps/studio/client/v2/ds/use-ds-search.js +61 -0
  769. package/apps/studio/client/v2/ds/use-ds-state.js +65 -0
  770. package/apps/studio/client/v2/ds/uses-link.jsx +58 -0
  771. package/apps/studio/client/v2/empty/all-trashed-model.js +321 -0
  772. package/apps/studio/client/v2/empty/all-trashed-relay.js +65 -0
  773. package/apps/studio/client/v2/empty/all-trashed.jsx +229 -0
  774. package/apps/studio/client/v2/empty/arriving.jsx +180 -0
  775. package/apps/studio/client/v2/empty/artboard-hint.jsx +47 -0
  776. package/apps/studio/client/v2/empty/ask-button.jsx +35 -0
  777. package/apps/studio/client/v2/empty/confetti.jsx +46 -0
  778. package/apps/studio/client/v2/empty/empty-canvas.jsx +96 -0
  779. package/apps/studio/client/v2/empty/empty-copy.js +265 -0
  780. package/apps/studio/client/v2/empty/empty-hint-store.js +31 -0
  781. package/apps/studio/client/v2/empty/empty-host.jsx +168 -0
  782. package/apps/studio/client/v2/empty/empty.css +440 -0
  783. package/apps/studio/client/v2/empty/empty.jsx +162 -0
  784. package/apps/studio/client/v2/empty/fill-ask.js +22 -0
  785. package/apps/studio/client/v2/empty/free-centre.js +11 -0
  786. package/apps/studio/client/v2/empty/index.js +40 -0
  787. package/apps/studio/client/v2/empty/layers-empty.jsx +22 -0
  788. package/apps/studio/client/v2/empty/not-local.jsx +111 -0
  789. package/apps/studio/client/v2/empty/select-new-artboard.js +32 -0
  790. package/apps/studio/client/v2/empty/skeleton.jsx +51 -0
  791. package/apps/studio/client/v2/empty/spot-art.jsx +923 -0
  792. package/apps/studio/client/v2/empty/spot.jsx +96 -0
  793. package/apps/studio/client/v2/empty/suggestions.jsx +18 -0
  794. package/apps/studio/client/v2/empty/use-empty-canvas.js +251 -0
  795. package/apps/studio/client/v2/export/access-line.jsx +48 -0
  796. package/apps/studio/client/v2/export/advanced/advanced-copy.js +77 -0
  797. package/apps/studio/client/v2/export/advanced/advanced.css +252 -0
  798. package/apps/studio/client/v2/export/advanced/advanced.jsx +148 -0
  799. package/apps/studio/client/v2/export/advanced/command.js +128 -0
  800. package/apps/studio/client/v2/export/advanced/command.jsx +50 -0
  801. package/apps/studio/client/v2/export/advanced/fields.jsx +132 -0
  802. package/apps/studio/client/v2/export/advanced/image.jsx +124 -0
  803. package/apps/studio/client/v2/export/advanced/model.js +199 -0
  804. package/apps/studio/client/v2/export/advanced/names.jsx +65 -0
  805. package/apps/studio/client/v2/export/advanced/print.jsx +99 -0
  806. package/apps/studio/client/v2/export/advanced/render.jsx +63 -0
  807. package/apps/studio/client/v2/export/advanced/video.jsx +76 -0
  808. package/apps/studio/client/v2/export/annotations-policy.js +28 -0
  809. package/apps/studio/client/v2/export/cloud-queue.js +69 -0
  810. package/apps/studio/client/v2/export/copy-command.js +72 -0
  811. package/apps/studio/client/v2/export/copy-png.js +144 -0
  812. package/apps/studio/client/v2/export/done-toast.jsx +89 -0
  813. package/apps/studio/client/v2/export/edges.css +74 -0
  814. package/apps/studio/client/v2/export/export-copy.js +352 -0
  815. package/apps/studio/client/v2/export/export-sheet.jsx +804 -0
  816. package/apps/studio/client/v2/export/export-sizes.js +217 -0
  817. package/apps/studio/client/v2/export/export.css +832 -0
  818. package/apps/studio/client/v2/export/exports-model.js +383 -0
  819. package/apps/studio/client/v2/export/exports-panel.css +192 -0
  820. package/apps/studio/client/v2/export/exports-panel.jsx +164 -0
  821. package/apps/studio/client/v2/export/file-rows.jsx +84 -0
  822. package/apps/studio/client/v2/export/inspector-export.jsx +335 -0
  823. package/apps/studio/client/v2/export/job-row.jsx +358 -0
  824. package/apps/studio/client/v2/export/last-finished.js +34 -0
  825. package/apps/studio/client/v2/export/native-save.js +160 -0
  826. package/apps/studio/client/v2/export/other-formats.jsx +199 -0
  827. package/apps/studio/client/v2/export/parts.jsx +117 -0
  828. package/apps/studio/client/v2/export/preflight/fonts.js +27 -0
  829. package/apps/studio/client/v2/export/preflight/paper.jsx +177 -0
  830. package/apps/studio/client/v2/export/preflight/safe-margin.js +24 -0
  831. package/apps/studio/client/v2/export/preflight/use-preflight.js +74 -0
  832. package/apps/studio/client/v2/export/preview.jsx +79 -0
  833. package/apps/studio/client/v2/export/print.css +219 -0
  834. package/apps/studio/client/v2/export/run-export.js +177 -0
  835. package/apps/studio/client/v2/export/scope-bar.jsx +70 -0
  836. package/apps/studio/client/v2/export/sections/batch-model.js +224 -0
  837. package/apps/studio/client/v2/export/sections/batch.jsx +235 -0
  838. package/apps/studio/client/v2/export/sections/image.jsx +93 -0
  839. package/apps/studio/client/v2/export/sections/print-copy.js +41 -0
  840. package/apps/studio/client/v2/export/sections/print.jsx +285 -0
  841. package/apps/studio/client/v2/export/sections/render-row.jsx +81 -0
  842. package/apps/studio/client/v2/export/sections/version.jsx +176 -0
  843. package/apps/studio/client/v2/export/sections/video-copy.js +92 -0
  844. package/apps/studio/client/v2/export/sections/video-model.js +127 -0
  845. package/apps/studio/client/v2/export/sections/video.jsx +397 -0
  846. package/apps/studio/client/v2/export/sections/web.jsx +151 -0
  847. package/apps/studio/client/v2/export/share-hint.jsx +51 -0
  848. package/apps/studio/client/v2/export/use-export-spec.js +546 -0
  849. package/apps/studio/client/v2/export/video-content.js +75 -0
  850. package/apps/studio/client/v2/export/video.css +221 -0
  851. package/apps/studio/client/v2/fold/advanced-fold.jsx +96 -0
  852. package/apps/studio/client/v2/fold/fold-store.js +151 -0
  853. package/apps/studio/client/v2/fold/fold.css +59 -0
  854. package/apps/studio/client/v2/fold/use-fold.js +36 -0
  855. package/apps/studio/client/v2/handoff/edges.jsx +74 -0
  856. package/apps/studio/client/v2/handoff/handoff-sheet.jsx +469 -0
  857. package/apps/studio/client/v2/handoff/handoff.css +181 -0
  858. package/apps/studio/client/v2/handoff/ready-card.jsx +84 -0
  859. package/apps/studio/client/v2/handoff/targets.js +111 -0
  860. package/apps/studio/client/v2/help/add-guides.js +43 -0
  861. package/apps/studio/client/v2/help/help.css +995 -0
  862. package/apps/studio/client/v2/history/blame.js +161 -0
  863. package/apps/studio/client/v2/history/branch-actions.js +214 -0
  864. package/apps/studio/client/v2/history/change-list.jsx +102 -0
  865. package/apps/studio/client/v2/history/clear-band.js +144 -0
  866. package/apps/studio/client/v2/history/compare-store.js +80 -0
  867. package/apps/studio/client/v2/history/compare-view.jsx +318 -0
  868. package/apps/studio/client/v2/history/compare-words.js +8 -0
  869. package/apps/studio/client/v2/history/git-advanced.jsx +580 -0
  870. package/apps/studio/client/v2/history/git-io.js +58 -0
  871. package/apps/studio/client/v2/history/git-model.js +526 -0
  872. package/apps/studio/client/v2/history/git-parts.jsx +662 -0
  873. package/apps/studio/client/v2/history/history-host.jsx +78 -0
  874. package/apps/studio/client/v2/history/history-panel.jsx +599 -0
  875. package/apps/studio/client/v2/history/history.css +1477 -0
  876. package/apps/studio/client/v2/history/name-dialog.jsx +109 -0
  877. package/apps/studio/client/v2/history/object-filter.js +143 -0
  878. package/apps/studio/client/v2/history/object-history-ask.js +62 -0
  879. package/apps/studio/client/v2/history/object-view.jsx +236 -0
  880. package/apps/studio/client/v2/history/rows.ts +445 -0
  881. package/apps/studio/client/v2/history/use-versions.js +391 -0
  882. package/apps/studio/client/v2/history/view-bar.jsx +80 -0
  883. package/apps/studio/client/v2/import/brand-model.js +145 -0
  884. package/apps/studio/client/v2/import/brand-result.jsx +197 -0
  885. package/apps/studio/client/v2/import/brand-sheet.jsx +434 -0
  886. package/apps/studio/client/v2/import/brand.css +378 -0
  887. package/apps/studio/client/v2/import/figma-artboard.jsx +121 -0
  888. package/apps/studio/client/v2/import/figma-model.js +237 -0
  889. package/apps/studio/client/v2/import/figma-prefill.js +23 -0
  890. package/apps/studio/client/v2/import/figma-sheet.jsx +525 -0
  891. package/apps/studio/client/v2/import/figma-summary.jsx +62 -0
  892. package/apps/studio/client/v2/import/figma.css +179 -0
  893. package/apps/studio/client/v2/import/frame-picker.jsx +57 -0
  894. package/apps/studio/client/v2/inspect/inspect-host.jsx +53 -0
  895. package/apps/studio/client/v2/inspect/inspect-model.js +132 -0
  896. package/apps/studio/client/v2/inspect/inspect-panel.jsx +214 -0
  897. package/apps/studio/client/v2/inspect/inspect.css +87 -0
  898. package/apps/studio/client/v2/inspector/advanced-rows-default.jsx +773 -0
  899. package/apps/studio/client/v2/inspector/advanced-rows.js +106 -0
  900. package/apps/studio/client/v2/inspector/advanced.jsx +286 -0
  901. package/apps/studio/client/v2/inspector/blocks.js +57 -0
  902. package/apps/studio/client/v2/inspector/colour-groups.js +129 -0
  903. package/apps/studio/client/v2/inspector/component-picker.css +133 -0
  904. package/apps/studio/client/v2/inspector/component-picker.jsx +367 -0
  905. package/apps/studio/client/v2/inspector/crumbs.jsx +89 -0
  906. package/apps/studio/client/v2/inspector/css-text.js +179 -0
  907. package/apps/studio/client/v2/inspector/css-write.js +204 -0
  908. package/apps/studio/client/v2/inspector/element-code.js +39 -0
  909. package/apps/studio/client/v2/inspector/element-id.js +70 -0
  910. package/apps/studio/client/v2/inspector/formats-ui.js +101 -0
  911. package/apps/studio/client/v2/inspector/formats-write.js +60 -0
  912. package/apps/studio/client/v2/inspector/frame.jsx +336 -0
  913. package/apps/studio/client/v2/inspector/inspector-actions.js +60 -0
  914. package/apps/studio/client/v2/inspector/inspector.css +2872 -0
  915. package/apps/studio/client/v2/inspector/jsx-slice.js +219 -0
  916. package/apps/studio/client/v2/inspector/kinds/add-width.js +55 -0
  917. package/apps/studio/client/v2/inspector/kinds/artboard-advanced-rows.jsx +89 -0
  918. package/apps/studio/client/v2/inspector/kinds/artboard-advanced.jsx +62 -0
  919. package/apps/studio/client/v2/inspector/kinds/artboard-fixed.jsx +111 -0
  920. package/apps/studio/client/v2/inspector/kinds/artboard-kinds-model.js +171 -0
  921. package/apps/studio/client/v2/inspector/kinds/artboard-model.js +155 -0
  922. package/apps/studio/client/v2/inspector/kinds/artboard-multi.jsx +142 -0
  923. package/apps/studio/client/v2/inspector/kinds/artboard-print-advanced.jsx +210 -0
  924. package/apps/studio/client/v2/inspector/kinds/artboard-print-model.js +112 -0
  925. package/apps/studio/client/v2/inspector/kinds/artboard-print.jsx +268 -0
  926. package/apps/studio/client/v2/inspector/kinds/artboard-rows.jsx +124 -0
  927. package/apps/studio/client/v2/inspector/kinds/artboard-video.jsx +144 -0
  928. package/apps/studio/client/v2/inspector/kinds/artboard-web.jsx +170 -0
  929. package/apps/studio/client/v2/inspector/kinds/artboard.jsx +168 -0
  930. package/apps/studio/client/v2/inspector/kinds/caption.jsx +203 -0
  931. package/apps/studio/client/v2/inspector/kinds/clip-model.js +190 -0
  932. package/apps/studio/client/v2/inspector/kinds/clip.css +157 -0
  933. package/apps/studio/client/v2/inspector/kinds/clip.jsx +447 -0
  934. package/apps/studio/client/v2/inspector/kinds/frame.jsx +118 -0
  935. package/apps/studio/client/v2/inspector/kinds/image.jsx +267 -0
  936. package/apps/studio/client/v2/inspector/kinds/index.js +180 -0
  937. package/apps/studio/client/v2/inspector/kinds/instance.jsx +377 -0
  938. package/apps/studio/client/v2/inspector/kinds/multi-artboard.jsx +129 -0
  939. package/apps/studio/client/v2/inspector/kinds/multi.jsx +220 -0
  940. package/apps/studio/client/v2/inspector/kinds/music.jsx +294 -0
  941. package/apps/studio/client/v2/inspector/kinds/path.jsx +174 -0
  942. package/apps/studio/client/v2/inspector/kinds/shape.jsx +59 -0
  943. package/apps/studio/client/v2/inspector/kinds/text.jsx +518 -0
  944. package/apps/studio/client/v2/inspector/kinds/title-rows.jsx +135 -0
  945. package/apps/studio/client/v2/inspector/kinds/video-facts.js +142 -0
  946. package/apps/studio/client/v2/inspector/layers-row-tools.jsx +93 -0
  947. package/apps/studio/client/v2/inspector/layers-slot.jsx +93 -0
  948. package/apps/studio/client/v2/inspector/link-write.js +52 -0
  949. package/apps/studio/client/v2/inspector/live-size.js +96 -0
  950. package/apps/studio/client/v2/inspector/model.js +228 -0
  951. package/apps/studio/client/v2/inspector/path-point.js +104 -0
  952. package/apps/studio/client/v2/inspector/print-write.js +85 -0
  953. package/apps/studio/client/v2/inspector/safe-zones-write.js +88 -0
  954. package/apps/studio/client/v2/inspector/sections/add-requests.js +35 -0
  955. package/apps/studio/client/v2/inspector/sections/border.jsx +141 -0
  956. package/apps/studio/client/v2/inspector/sections/color-control.jsx +246 -0
  957. package/apps/studio/client/v2/inspector/sections/colour-custom.jsx +826 -0
  958. package/apps/studio/client/v2/inspector/sections/colour-model.js +404 -0
  959. package/apps/studio/client/v2/inspector/sections/colour-popover.jsx +631 -0
  960. package/apps/studio/client/v2/inspector/sections/colour-words.js +131 -0
  961. package/apps/studio/client/v2/inspector/sections/corners.jsx +177 -0
  962. package/apps/studio/client/v2/inspector/sections/effects.jsx +67 -0
  963. package/apps/studio/client/v2/inspector/sections/export-slot.jsx +60 -0
  964. package/apps/studio/client/v2/inspector/sections/fill.jsx +187 -0
  965. package/apps/studio/client/v2/inspector/sections/formats.jsx +209 -0
  966. package/apps/studio/client/v2/inspector/sections/index.js +74 -0
  967. package/apps/studio/client/v2/inspector/sections/interaction.jsx +204 -0
  968. package/apps/studio/client/v2/inspector/sections/layout.jsx +314 -0
  969. package/apps/studio/client/v2/inspector/sections/opacity-row.jsx +37 -0
  970. package/apps/studio/client/v2/inspector/sections/point.jsx +102 -0
  971. package/apps/studio/client/v2/inspector/sections/position.jsx +259 -0
  972. package/apps/studio/client/v2/inspector/sections/recent-colours.js +106 -0
  973. package/apps/studio/client/v2/inspector/sections/row.jsx +91 -0
  974. package/apps/studio/client/v2/inspector/sections/safe-zones.jsx +174 -0
  975. package/apps/studio/client/v2/inspector/sections/sections.css +1474 -0
  976. package/apps/studio/client/v2/inspector/sections/size.jsx +104 -0
  977. package/apps/studio/client/v2/inspector/sections/type.jsx +168 -0
  978. package/apps/studio/client/v2/inspector/sections/warnings.css +44 -0
  979. package/apps/studio/client/v2/inspector/sections/warnings.jsx +137 -0
  980. package/apps/studio/client/v2/inspector/sections.js +226 -0
  981. package/apps/studio/client/v2/inspector/slots.js +110 -0
  982. package/apps/studio/client/v2/inspector/token-chip.jsx +315 -0
  983. package/apps/studio/client/v2/inspector/view-mode.jsx +193 -0
  984. package/apps/studio/client/v2/inspector/warning-fix.js +111 -0
  985. package/apps/studio/client/v2/kinds/ConvertDialog.jsx +183 -0
  986. package/apps/studio/client/v2/kinds/KindChips.jsx +60 -0
  987. package/apps/studio/client/v2/kinds/KindDimHost.jsx +35 -0
  988. package/apps/studio/client/v2/kinds/LayersKindFilter.jsx +108 -0
  989. package/apps/studio/client/v2/kinds/SizePicker.jsx +566 -0
  990. package/apps/studio/client/v2/kinds/SizePickerHost.jsx +104 -0
  991. package/apps/studio/client/v2/kinds/advanced-rows.js +40 -0
  992. package/apps/studio/client/v2/kinds/convert-api.js +116 -0
  993. package/apps/studio/client/v2/kinds/convert.css +87 -0
  994. package/apps/studio/client/v2/kinds/kind-dim-relay.js +93 -0
  995. package/apps/studio/client/v2/kinds/kind-filter-model.js +106 -0
  996. package/apps/studio/client/v2/kinds/kind-filter-store.js +71 -0
  997. package/apps/studio/client/v2/kinds/kind-filter.css +105 -0
  998. package/apps/studio/client/v2/kinds/layers-kind-model.js +99 -0
  999. package/apps/studio/client/v2/kinds/size-picker-model.js +189 -0
  1000. package/apps/studio/client/v2/kinds/size-picker.css +393 -0
  1001. package/apps/studio/client/v2/layers/artboard-layers.jsx +105 -0
  1002. package/apps/studio/client/v2/layers/layers.css +94 -0
  1003. package/apps/studio/client/v2/left-panel/advanced-model.js +98 -0
  1004. package/apps/studio/client/v2/left-panel/assets-panel.jsx +1203 -0
  1005. package/apps/studio/client/v2/left-panel/canvas-file-menu.js +115 -0
  1006. package/apps/studio/client/v2/left-panel/canvases-advanced.jsx +270 -0
  1007. package/apps/studio/client/v2/left-panel/canvases-pinned.jsx +274 -0
  1008. package/apps/studio/client/v2/left-panel/layers-advanced.jsx +179 -0
  1009. package/apps/studio/client/v2/left-panel/left-panel-bus.js +83 -0
  1010. package/apps/studio/client/v2/left-panel/left-panel-model.js +184 -0
  1011. package/apps/studio/client/v2/left-panel/left-panel.css +1846 -0
  1012. package/apps/studio/client/v2/left-panel/selector-scope.js +42 -0
  1013. package/apps/studio/client/v2/left-panel/trash-model.js +282 -0
  1014. package/apps/studio/client/v2/left-panel/trash-view.jsx +257 -0
  1015. package/apps/studio/client/v2/left-panel/use-trash.js +172 -0
  1016. package/apps/studio/client/v2/left-panel/view-prefs.js +84 -0
  1017. package/apps/studio/client/v2/onboarding/AdvSheet.jsx +114 -0
  1018. package/apps/studio/client/v2/onboarding/AdvancedSheets.jsx +239 -0
  1019. package/apps/studio/client/v2/onboarding/CliSheet.jsx +101 -0
  1020. package/apps/studio/client/v2/onboarding/ConnectAiSheet.jsx +60 -0
  1021. package/apps/studio/client/v2/onboarding/FigmaSheet.jsx +96 -0
  1022. package/apps/studio/client/v2/onboarding/FolderGithubSheet.jsx +77 -0
  1023. package/apps/studio/client/v2/onboarding/GithubSegment.jsx +241 -0
  1024. package/apps/studio/client/v2/onboarding/HubSheet.jsx +244 -0
  1025. package/apps/studio/client/v2/onboarding/connect-ai-home.js +94 -0
  1026. package/apps/studio/client/v2/onboarding/github-home.js +84 -0
  1027. package/apps/studio/client/v2/onboarding/onboarding-model.js +106 -0
  1028. package/apps/studio/client/v2/onboarding/onboarding.css +546 -0
  1029. package/apps/studio/client/v2/photo/apply-every-use-sheet.jsx +196 -0
  1030. package/apps/studio/client/v2/photo/canvas-rel.js +20 -0
  1031. package/apps/studio/client/v2/photo/looks.js +129 -0
  1032. package/apps/studio/client/v2/photo/photo-section.jsx +625 -0
  1033. package/apps/studio/client/v2/photo/photo.css +218 -0
  1034. package/apps/studio/client/v2/portal-scope.jsx +14 -0
  1035. package/apps/studio/client/v2/presence/faces.jsx +356 -0
  1036. package/apps/studio/client/v2/presence/presence.css +187 -0
  1037. package/apps/studio/client/v2/presence/use-presence-host.js +83 -0
  1038. package/apps/studio/client/v2/present/audience-window.js +63 -0
  1039. package/apps/studio/client/v2/present/canvas-pill.jsx +55 -0
  1040. package/apps/studio/client/v2/present/copy-link.js +82 -0
  1041. package/apps/studio/client/v2/present/follow-location.js +82 -0
  1042. package/apps/studio/client/v2/present/follow-model.js +68 -0
  1043. package/apps/studio/client/v2/present/follow-view.jsx +354 -0
  1044. package/apps/studio/client/v2/present/follow.css +91 -0
  1045. package/apps/studio/client/v2/present/order-map.jsx +64 -0
  1046. package/apps/studio/client/v2/present/order-notes-artboards.js +88 -0
  1047. package/apps/studio/client/v2/present/order-notes-model.js +141 -0
  1048. package/apps/studio/client/v2/present/order-notes-mount.jsx +26 -0
  1049. package/apps/studio/client/v2/present/order-notes-sheet.jsx +293 -0
  1050. package/apps/studio/client/v2/present/order-notes.css +150 -0
  1051. package/apps/studio/client/v2/present/present-chrome-host.jsx +95 -0
  1052. package/apps/studio/client/v2/present/present-controls-model.js +114 -0
  1053. package/apps/studio/client/v2/present/present-controls.jsx +263 -0
  1054. package/apps/studio/client/v2/present/present-zoom-store.js +33 -0
  1055. package/apps/studio/client/v2/present/present.css +258 -0
  1056. package/apps/studio/client/v2/present/presenter-button.jsx +25 -0
  1057. package/apps/studio/client/v2/present/presenter-host.jsx +246 -0
  1058. package/apps/studio/client/v2/present/presenter-model.js +167 -0
  1059. package/apps/studio/client/v2/present/presenter-store.js +140 -0
  1060. package/apps/studio/client/v2/present/presenter-view.css +298 -0
  1061. package/apps/studio/client/v2/present/presenter-view.jsx +241 -0
  1062. package/apps/studio/client/v2/present/video-present-model.js +92 -0
  1063. package/apps/studio/client/v2/present/video-present.css +164 -0
  1064. package/apps/studio/client/v2/present/video-present.jsx +331 -0
  1065. package/apps/studio/client/v2/preview/external-link-confirm.jsx +245 -0
  1066. package/apps/studio/client/v2/preview/link-follow.js +109 -0
  1067. package/apps/studio/client/v2/preview/open-in-app.jsx +46 -0
  1068. package/apps/studio/client/v2/preview/preview-back.js +21 -0
  1069. package/apps/studio/client/v2/preview/preview-bar.jsx +86 -0
  1070. package/apps/studio/client/v2/preview/preview-chrome-host.jsx +234 -0
  1071. package/apps/studio/client/v2/preview/preview-history.js +61 -0
  1072. package/apps/studio/client/v2/preview/preview.css +262 -0
  1073. package/apps/studio/client/v2/preview/zoom-only.jsx +58 -0
  1074. package/apps/studio/client/v2/search/help-model.js +275 -0
  1075. package/apps/studio/client/v2/search/moved-keys.js +74 -0
  1076. package/apps/studio/client/v2/search/palette-icons.js +45 -0
  1077. package/apps/studio/client/v2/search/search-ds.js +142 -0
  1078. package/apps/studio/client/v2/search/search-env.js +110 -0
  1079. package/apps/studio/client/v2/search/search-keywords.js +162 -0
  1080. package/apps/studio/client/v2/search/search-model.js +623 -0
  1081. package/apps/studio/client/v2/search/search-projects.js +214 -0
  1082. package/apps/studio/client/v2/search/search-recent.js +94 -0
  1083. package/apps/studio/client/v2/search/search-remote.js +30 -0
  1084. package/apps/studio/client/v2/search/search.css +519 -0
  1085. package/apps/studio/client/v2/settings/account.jsx +164 -0
  1086. package/apps/studio/client/v2/settings/advanced-prefs.js +91 -0
  1087. package/apps/studio/client/v2/settings/advanced-section.jsx +308 -0
  1088. package/apps/studio/client/v2/settings/connection-row.jsx +79 -0
  1089. package/apps/studio/client/v2/settings/connections-model.js +138 -0
  1090. package/apps/studio/client/v2/settings/connections-section.jsx +663 -0
  1091. package/apps/studio/client/v2/settings/general-section.jsx +155 -0
  1092. package/apps/studio/client/v2/settings/parts.jsx +48 -0
  1093. package/apps/studio/client/v2/settings/prefs-migrate.js +141 -0
  1094. package/apps/studio/client/v2/settings/project-sync-settings.jsx +255 -0
  1095. package/apps/studio/client/v2/settings/reset-section.jsx +164 -0
  1096. package/apps/studio/client/v2/settings/settings-handlers.js +46 -0
  1097. package/apps/studio/client/v2/settings/settings-model.js +523 -0
  1098. package/apps/studio/client/v2/settings/settings-sheet.jsx +204 -0
  1099. package/apps/studio/client/v2/settings/settings.css +975 -0
  1100. package/apps/studio/client/v2/settings/theme-auto.js +75 -0
  1101. package/apps/studio/client/v2/settings/use-advanced-prefs.js +32 -0
  1102. package/apps/studio/client/v2/settings/use-connections.js +485 -0
  1103. package/apps/studio/client/v2/share/glyphs.jsx +92 -0
  1104. package/apps/studio/client/v2/share/invite-row.jsx +68 -0
  1105. package/apps/studio/client/v2/share/link-dialog.js +53 -0
  1106. package/apps/studio/client/v2/share/link-row.jsx +38 -0
  1107. package/apps/studio/client/v2/share/move-to-cloud.jsx +88 -0
  1108. package/apps/studio/client/v2/share/people-list.jsx +151 -0
  1109. package/apps/studio/client/v2/share/person.jsx +26 -0
  1110. package/apps/studio/client/v2/share/role-menu.jsx +145 -0
  1111. package/apps/studio/client/v2/share/share-advanced.jsx +411 -0
  1112. package/apps/studio/client/v2/share/share-model.js +469 -0
  1113. package/apps/studio/client/v2/share/share-sheet.jsx +602 -0
  1114. package/apps/studio/client/v2/share/share.css +828 -0
  1115. package/apps/studio/client/v2/shell/account-card-model.js +114 -0
  1116. package/apps/studio/client/v2/shell/account-card.jsx +177 -0
  1117. package/apps/studio/client/v2/shell/annotation-prefs-store.js +105 -0
  1118. package/apps/studio/client/v2/shell/ask-to-edit.js +33 -0
  1119. package/apps/studio/client/v2/shell/callouts-host.jsx +151 -0
  1120. package/apps/studio/client/v2/shell/callouts-model.js +358 -0
  1121. package/apps/studio/client/v2/shell/callouts.css +164 -0
  1122. package/apps/studio/client/v2/shell/callouts.jsx +162 -0
  1123. package/apps/studio/client/v2/shell/canvas-mode.js +393 -0
  1124. package/apps/studio/client/v2/shell/contrast.css +37 -0
  1125. package/apps/studio/client/v2/shell/corner-icons.jsx +153 -0
  1126. package/apps/studio/client/v2/shell/dock-rail-homes.js +106 -0
  1127. package/apps/studio/client/v2/shell/f6-cycle.js +124 -0
  1128. package/apps/studio/client/v2/shell/floating-panels.css +2858 -0
  1129. package/apps/studio/client/v2/shell/fold-ghost.js +70 -0
  1130. package/apps/studio/client/v2/shell/format-update.css +43 -0
  1131. package/apps/studio/client/v2/shell/format-update.js +487 -0
  1132. package/apps/studio/client/v2/shell/format-update.jsx +479 -0
  1133. package/apps/studio/client/v2/shell/held-conflict.js +51 -0
  1134. package/apps/studio/client/v2/shell/image-pick.js +140 -0
  1135. package/apps/studio/client/v2/shell/insets-now.js +35 -0
  1136. package/apps/studio/client/v2/shell/inspector-follow.js +113 -0
  1137. package/apps/studio/client/v2/shell/menu-runner.js +711 -0
  1138. package/apps/studio/client/v2/shell/modal-focus.js +259 -0
  1139. package/apps/studio/client/v2/shell/mode-switch.jsx +418 -0
  1140. package/apps/studio/client/v2/shell/native-doors.js +121 -0
  1141. package/apps/studio/client/v2/shell/occlusion-insets.js +116 -0
  1142. package/apps/studio/client/v2/shell/panel-availability.js +27 -0
  1143. package/apps/studio/client/v2/shell/panel-layout.js +144 -0
  1144. package/apps/studio/client/v2/shell/panel-sizes.js +150 -0
  1145. package/apps/studio/client/v2/shell/paste-forward.js +43 -0
  1146. package/apps/studio/client/v2/shell/present-from-label.js +19 -0
  1147. package/apps/studio/client/v2/shell/project-menu-model.js +216 -0
  1148. package/apps/studio/client/v2/shell/project-pill.css +214 -0
  1149. package/apps/studio/client/v2/shell/project-pill.jsx +456 -0
  1150. package/apps/studio/client/v2/shell/recovery-store.js +139 -0
  1151. package/apps/studio/client/v2/shell/role-denial.js +73 -0
  1152. package/apps/studio/client/v2/shell/role-gate.js +29 -0
  1153. package/apps/studio/client/v2/shell/save-hold-notice.js +69 -0
  1154. package/apps/studio/client/v2/shell/save-status.js +191 -0
  1155. package/apps/studio/client/v2/shell/scroll-lock.js +49 -0
  1156. package/apps/studio/client/v2/shell/share-cluster-host.jsx +389 -0
  1157. package/apps/studio/client/v2/shell/share-cluster.css +608 -0
  1158. package/apps/studio/client/v2/shell/share-cluster.jsx +255 -0
  1159. package/apps/studio/client/v2/shell/shell-error-boundary.jsx +81 -0
  1160. package/apps/studio/client/v2/shell/shell-panels-relay.js +95 -0
  1161. package/apps/studio/client/v2/shell/shell-parity.js +457 -0
  1162. package/apps/studio/client/v2/shell/shell-parity.json +2106 -0
  1163. package/apps/studio/client/v2/shell/single-keys-store.js +49 -0
  1164. package/apps/studio/client/v2/shell/tool-panels.css +39 -0
  1165. package/apps/studio/client/v2/shell/tool-panels.js +156 -0
  1166. package/apps/studio/client/v2/shell/use-account.js +59 -0
  1167. package/apps/studio/client/v2/shell/use-annotation-prefs.js +77 -0
  1168. package/apps/studio/client/v2/shell/use-canvas-mode-lane.js +388 -0
  1169. package/apps/studio/client/v2/shell/use-dismiss-outside.js +35 -0
  1170. package/apps/studio/client/v2/shell/use-fit-on-ai-pin.js +42 -0
  1171. package/apps/studio/client/v2/shell/use-fit-while-ai-drafts.js +37 -0
  1172. package/apps/studio/client/v2/shell/use-occluded-insets.js +107 -0
  1173. package/apps/studio/client/v2/shell/use-panel-layout.js +45 -0
  1174. package/apps/studio/client/v2/shell/use-single-keys.js +56 -0
  1175. package/apps/studio/client/v2/shell/use-tool-panels.js +205 -0
  1176. package/apps/studio/client/v2/signin/CreateLocalSheet.jsx +155 -0
  1177. package/apps/studio/client/v2/signin/SignInCard.jsx +284 -0
  1178. package/apps/studio/client/v2/signin/SignInToast.jsx +22 -0
  1179. package/apps/studio/client/v2/signin/WhatsNewLine.jsx +64 -0
  1180. package/apps/studio/client/v2/signin/advanced-rows.js +40 -0
  1181. package/apps/studio/client/v2/signin/signin-model.js +138 -0
  1182. package/apps/studio/client/v2/signin/signin.css +484 -0
  1183. package/apps/studio/client/v2/signin/use-signin.js +209 -0
  1184. package/apps/studio/client/v2/signin/use-whats-new-line.js +94 -0
  1185. package/apps/studio/client/v2/sync-states/back-online.jsx +61 -0
  1186. package/apps/studio/client/v2/sync-states/conflict-card.jsx +326 -0
  1187. package/apps/studio/client/v2/sync-states/offline-foot.jsx +79 -0
  1188. package/apps/studio/client/v2/sync-states/row-words.js +83 -0
  1189. package/apps/studio/client/v2/sync-states/sync-states-model.js +264 -0
  1190. package/apps/studio/client/v2/sync-states/sync-states.css +232 -0
  1191. package/apps/studio/client/v2/timeline/Timeline.jsx +3194 -0
  1192. package/apps/studio/client/v2/timeline/TimelineHost.jsx +360 -0
  1193. package/apps/studio/client/v2/timeline/advanced/actions.js +27 -0
  1194. package/apps/studio/client/v2/timeline/advanced/advanced-store.js +116 -0
  1195. package/apps/studio/client/v2/timeline/advanced/advanced.css +323 -0
  1196. package/apps/studio/client/v2/timeline/advanced/cut-as-code.jsx +127 -0
  1197. package/apps/studio/client/v2/timeline/advanced/easing-curve.jsx +200 -0
  1198. package/apps/studio/client/v2/timeline/advanced/foot.jsx +210 -0
  1199. package/apps/studio/client/v2/timeline/advanced/model.js +121 -0
  1200. package/apps/studio/client/v2/timeline/advanced/render-settings.jsx +62 -0
  1201. package/apps/studio/client/v2/timeline/advanced/video-cap.js +174 -0
  1202. package/apps/studio/client/v2/timeline/ai-edge-model.js +111 -0
  1203. package/apps/studio/client/v2/timeline/ai-edge.css +104 -0
  1204. package/apps/studio/client/v2/timeline/ai-edge.jsx +113 -0
  1205. package/apps/studio/client/v2/timeline/anchor-lane.js +80 -0
  1206. package/apps/studio/client/v2/timeline/anchor.js +80 -0
  1207. package/apps/studio/client/v2/timeline/assemble-video.js +64 -0
  1208. package/apps/studio/client/v2/timeline/clip-search.js +88 -0
  1209. package/apps/studio/client/v2/timeline/clip-verb.js +224 -0
  1210. package/apps/studio/client/v2/timeline/comment-strip-host.jsx +93 -0
  1211. package/apps/studio/client/v2/timeline/comment-strip-model.js +103 -0
  1212. package/apps/studio/client/v2/timeline/comment-strip.jsx +82 -0
  1213. package/apps/studio/client/v2/timeline/edit/clip-menu.js +118 -0
  1214. package/apps/studio/client/v2/timeline/edit/clip-menu.jsx +48 -0
  1215. package/apps/studio/client/v2/timeline/edit/drop.jsx +101 -0
  1216. package/apps/studio/client/v2/timeline/edit/move.jsx +43 -0
  1217. package/apps/studio/client/v2/timeline/edit/ripple.js +43 -0
  1218. package/apps/studio/client/v2/timeline/edit/trim.jsx +52 -0
  1219. package/apps/studio/client/v2/timeline/edit/words.js +65 -0
  1220. package/apps/studio/client/v2/timeline/fit-fill.jsx +172 -0
  1221. package/apps/studio/client/v2/timeline/fit-model.js +137 -0
  1222. package/apps/studio/client/v2/timeline/fold.js +128 -0
  1223. package/apps/studio/client/v2/timeline/footage-rows.jsx +46 -0
  1224. package/apps/studio/client/v2/timeline/footage-state.js +135 -0
  1225. package/apps/studio/client/v2/timeline/glyphs.jsx +118 -0
  1226. package/apps/studio/client/v2/timeline/island-context.js +29 -0
  1227. package/apps/studio/client/v2/timeline/island-controls.jsx +83 -0
  1228. package/apps/studio/client/v2/timeline/island.jsx +54 -0
  1229. package/apps/studio/client/v2/timeline/joins/join-model.js +133 -0
  1230. package/apps/studio/client/v2/timeline/joins/joins.css +277 -0
  1231. package/apps/studio/client/v2/timeline/joins/transition-picker.jsx +240 -0
  1232. package/apps/studio/client/v2/timeline/keys.js +74 -0
  1233. package/apps/studio/client/v2/timeline/lanes/caption-lane.jsx +149 -0
  1234. package/apps/studio/client/v2/timeline/lanes/music-lane.jsx +294 -0
  1235. package/apps/studio/client/v2/timeline/lanes/music-media.js +200 -0
  1236. package/apps/studio/client/v2/timeline/lanes/music-model.js +190 -0
  1237. package/apps/studio/client/v2/timeline/loop-handle.jsx +70 -0
  1238. package/apps/studio/client/v2/timeline/marker-store.js +117 -0
  1239. package/apps/studio/client/v2/timeline/markers.js +79 -0
  1240. package/apps/studio/client/v2/timeline/marks.jsx +152 -0
  1241. package/apps/studio/client/v2/timeline/music-hint.jsx +98 -0
  1242. package/apps/studio/client/v2/timeline/other-takes-model.js +103 -0
  1243. package/apps/studio/client/v2/timeline/other-takes-store.js +49 -0
  1244. package/apps/studio/client/v2/timeline/other-takes.css +98 -0
  1245. package/apps/studio/client/v2/timeline/other-takes.jsx +269 -0
  1246. package/apps/studio/client/v2/timeline/peers.jsx +246 -0
  1247. package/apps/studio/client/v2/timeline/playhead.js +97 -0
  1248. package/apps/studio/client/v2/timeline/poster.js +109 -0
  1249. package/apps/studio/client/v2/timeline/reframe-island.jsx +478 -0
  1250. package/apps/studio/client/v2/timeline/reframe-model.js +135 -0
  1251. package/apps/studio/client/v2/timeline/reframe.css +150 -0
  1252. package/apps/studio/client/v2/timeline/ruler.js +61 -0
  1253. package/apps/studio/client/v2/timeline/selection.js +110 -0
  1254. package/apps/studio/client/v2/timeline/timeline-empty.jsx +108 -0
  1255. package/apps/studio/client/v2/timeline/timeline-store.js +147 -0
  1256. package/apps/studio/client/v2/timeline/timeline.css +2879 -0
  1257. package/apps/studio/client/v2/timeline/together.css +85 -0
  1258. package/apps/studio/client/v2/timeline/track-toggle.js +56 -0
  1259. package/apps/studio/client/v2/timeline/tracks.js +68 -0
  1260. package/apps/studio/client/v2/timeline/transport.js +66 -0
  1261. package/apps/studio/client/v2/timeline/zoom.js +37 -0
  1262. package/apps/studio/client/v2/transcript/TranscriptHost.jsx +162 -0
  1263. package/apps/studio/client/v2/transcript/TranscriptPanel.jsx +358 -0
  1264. package/apps/studio/client/v2/transcript/captions-api.js +297 -0
  1265. package/apps/studio/client/v2/transcript/captions-file-flag.js +38 -0
  1266. package/apps/studio/client/v2/transcript/comp-media-store.js +89 -0
  1267. package/apps/studio/client/v2/transcript/transcript-model.js +240 -0
  1268. package/apps/studio/client/v2/transcript/transcript.css +262 -0
  1269. package/apps/studio/client/v2/undo/projection.js +291 -0
  1270. package/apps/studio/client/v2/undo/undo-history.jsx +286 -0
  1271. package/apps/studio/client/v2/undo/undo.css +81 -0
  1272. package/apps/studio/client/v2/undo/use-undo-mode-lane.js +96 -0
  1273. package/apps/studio/client/v2/undo/use-undo-projection.jsx +460 -0
  1274. package/apps/studio/client/v2/undo/zoom-undo.jsx +79 -0
  1275. package/apps/studio/client/whats-new-seen.js +40 -0
  1276. package/apps/studio/client/whats-new.jsx +65 -62
  1277. package/apps/studio/clip-ops.ts +38 -6
  1278. package/apps/studio/cloud/config-path.ts +42 -0
  1279. package/apps/studio/cloud/endpoints.ts +212 -50
  1280. package/apps/studio/cloud/renew.ts +29 -16
  1281. package/apps/studio/collab/ai-activity.ts +19 -0
  1282. package/apps/studio/collab/awareness-bridge.ts +131 -4
  1283. package/apps/studio/collab/git-lifecycle.ts +52 -20
  1284. package/apps/studio/collab/holds.ts +69 -0
  1285. package/apps/studio/collab/index.ts +25 -0
  1286. package/apps/studio/collab/protocol.ts +64 -0
  1287. package/apps/studio/collab/registry.ts +59 -6
  1288. package/apps/studio/collab/room.ts +374 -16
  1289. package/apps/studio/collab/timeline-awareness.ts +123 -0
  1290. package/apps/studio/collab/timeline-presence.tsx +219 -0
  1291. package/apps/studio/commands/move-artboards-command.ts +45 -4
  1292. package/apps/studio/comments/anchors.ts +147 -0
  1293. package/apps/studio/comments/author-face.ts +41 -0
  1294. package/apps/studio/comments/from-line.ts +43 -0
  1295. package/apps/studio/comments/imported-from.ts +113 -0
  1296. package/apps/studio/comments/local-author.ts +41 -0
  1297. package/apps/studio/comments/mentions.ts +115 -0
  1298. package/apps/studio/comments/mine-stamp.ts +78 -0
  1299. package/apps/studio/comments/ops.ts +293 -0
  1300. package/apps/studio/comments/people.ts +66 -0
  1301. package/apps/studio/comments/where.ts +136 -0
  1302. package/apps/studio/comments-overlay.tsx +1220 -253
  1303. package/apps/studio/config.schema.json +33 -0
  1304. package/apps/studio/context-menu.tsx +126 -42
  1305. package/apps/studio/context.ts +178 -13
  1306. package/apps/studio/cursors-overlay.tsx +28 -11
  1307. package/apps/studio/debug-bundle.ts +21 -5
  1308. package/apps/studio/describe/batch.ts +414 -0
  1309. package/apps/studio/describe/budget.ts +147 -0
  1310. package/apps/studio/describe/claude.ts +273 -0
  1311. package/apps/studio/describe/consent.ts +120 -0
  1312. package/apps/studio/describe/validate.ts +192 -0
  1313. package/apps/studio/design-setup-readiness.ts +2 -2
  1314. package/apps/studio/diagnostics/store.ts +220 -0
  1315. package/apps/studio/dist/client.bundle.js +2429 -2329
  1316. package/apps/studio/dist/comment-mount.js +12 -9
  1317. package/apps/studio/dist/styles.css +1 -1
  1318. package/apps/studio/dom-selection.ts +239 -23
  1319. package/apps/studio/drag-bus.ts +211 -0
  1320. package/apps/studio/draw/serialize-animate.ts +4 -4
  1321. package/apps/studio/ds/board/board-specimen.css +199 -0
  1322. package/apps/studio/ds/board/board.css +674 -0
  1323. package/apps/studio/ds/board/brand-notes.ts +92 -0
  1324. package/apps/studio/ds/board/build-model.ts +418 -0
  1325. package/apps/studio/ds/board/component-states.ts +111 -0
  1326. package/apps/studio/ds/board/directions-model.ts +145 -0
  1327. package/apps/studio/ds/board/directions.css +169 -0
  1328. package/apps/studio/ds/board/directions.tsx +100 -0
  1329. package/apps/studio/ds/board/ds-bar.tsx +107 -0
  1330. package/apps/studio/ds/board/index.tsx +71 -0
  1331. package/apps/studio/ds/board/logo-paint.ts +118 -0
  1332. package/apps/studio/ds/board/outline.tsx +127 -0
  1333. package/apps/studio/ds/board/parts.tsx +160 -0
  1334. package/apps/studio/ds/board/section-brand.tsx +148 -0
  1335. package/apps/studio/ds/board/section-colour.tsx +160 -0
  1336. package/apps/studio/ds/board/section-components.tsx +146 -0
  1337. package/apps/studio/ds/board/section-motion.tsx +106 -0
  1338. package/apps/studio/ds/board/section-patterns.tsx +89 -0
  1339. package/apps/studio/ds/board/section-space.tsx +109 -0
  1340. package/apps/studio/ds/board/section-type.tsx +129 -0
  1341. package/apps/studio/ds/board/specimen.tsx +61 -0
  1342. package/apps/studio/ds/board/state.ts +105 -0
  1343. package/apps/studio/ds/board/template.ts +152 -0
  1344. package/apps/studio/ds/board/types.ts +346 -0
  1345. package/apps/studio/ds/canvas-check.ts +914 -0
  1346. package/apps/studio/ds/canvas-cli.ts +346 -0
  1347. package/apps/studio/ds/check-system-verb.ts +88 -0
  1348. package/apps/studio/ds/check-system.ts +293 -0
  1349. package/apps/studio/ds/check.ts +541 -0
  1350. package/apps/studio/ds/cli.ts +348 -0
  1351. package/apps/studio/ds/component-list.ts +150 -0
  1352. package/apps/studio/ds/contrast.ts +438 -0
  1353. package/apps/studio/ds/convert-map.ts +126 -0
  1354. package/apps/studio/ds/convert.ts +603 -0
  1355. package/apps/studio/ds/css-scan.ts +292 -0
  1356. package/apps/studio/ds/default-components.tsx +377 -0
  1357. package/apps/studio/ds/default.ts +58 -0
  1358. package/apps/studio/ds/design-system.tsx.tpl +40 -0
  1359. package/apps/studio/ds/ds-resolver.ts +205 -0
  1360. package/apps/studio/ds/ds-verb.ts +563 -0
  1361. package/apps/studio/ds/edges.ts +412 -0
  1362. package/apps/studio/ds/emit.ts +217 -0
  1363. package/apps/studio/ds/engine.ts +1652 -0
  1364. package/apps/studio/ds/fallbacks.ts +116 -0
  1365. package/apps/studio/ds/generate.ts +746 -0
  1366. package/apps/studio/ds/head.ts +372 -0
  1367. package/apps/studio/ds/instance-info.ts +90 -0
  1368. package/apps/studio/ds/library.ts +1137 -0
  1369. package/apps/studio/ds/make.ts +726 -0
  1370. package/apps/studio/ds/migrate-emitter.ts +42 -0
  1371. package/apps/studio/ds/nearest.ts +163 -0
  1372. package/apps/studio/ds/outside.ts +343 -0
  1373. package/apps/studio/ds/override-map.ts +213 -0
  1374. package/apps/studio/ds/pairing-css.ts +145 -0
  1375. package/apps/studio/ds/pin-scope.ts +268 -0
  1376. package/apps/studio/ds/registry.ts +228 -0
  1377. package/apps/studio/ds/rename.ts +104 -0
  1378. package/apps/studio/ds/render-rev.ts +144 -0
  1379. package/apps/studio/ds/revision.ts +268 -0
  1380. package/apps/studio/ds/shell-fallbacks.ts +84 -0
  1381. package/apps/studio/ds/switch.ts +426 -0
  1382. package/apps/studio/ds/system-files.ts +251 -0
  1383. package/apps/studio/ds/system.ts +312 -0
  1384. package/apps/studio/ds/undo-hook.ts +46 -0
  1385. package/apps/studio/ds/upgrade-apply.ts +258 -0
  1386. package/apps/studio/ds/upgrade-cli.ts +216 -0
  1387. package/apps/studio/ds/upgrade-codemod.ts +116 -0
  1388. package/apps/studio/ds/upgrade-progress.ts +153 -0
  1389. package/apps/studio/ds/upgrade-prove.ts +429 -0
  1390. package/apps/studio/ds/upgrade-stage.ts +387 -0
  1391. package/apps/studio/ds/upgrade.ts +394 -0
  1392. package/apps/studio/ds/value-types.ts +190 -0
  1393. package/apps/studio/edit-ops/align.ts +43 -0
  1394. package/apps/studio/edit-ops/arrange.ts +93 -0
  1395. package/apps/studio/edit-ops/artboard-facts.ts +70 -0
  1396. package/apps/studio/edit-ops/artboard-resize.ts +50 -0
  1397. package/apps/studio/edit-ops/artboard-trash.ts +77 -0
  1398. package/apps/studio/edit-ops/clear-link.ts +16 -0
  1399. package/apps/studio/edit-ops/clip/captions.ts +154 -0
  1400. package/apps/studio/edit-ops/clip/comp.ts +124 -0
  1401. package/apps/studio/edit-ops/clip/cut-source-range.ts +100 -0
  1402. package/apps/studio/edit-ops/clip/cut-to-beat.ts +136 -0
  1403. package/apps/studio/edit-ops/clip/duck.ts +123 -0
  1404. package/apps/studio/edit-ops/clip/easing.ts +76 -0
  1405. package/apps/studio/edit-ops/clip/formats.ts +163 -0
  1406. package/apps/studio/edit-ops/clip/gestures.ts +161 -0
  1407. package/apps/studio/edit-ops/clip/index.ts +543 -0
  1408. package/apps/studio/edit-ops/clip/jsx.ts +251 -0
  1409. package/apps/studio/edit-ops/clip/place.ts +127 -0
  1410. package/apps/studio/edit-ops/clip/reframe.ts +194 -0
  1411. package/apps/studio/edit-ops/clip/take-swap.ts +53 -0
  1412. package/apps/studio/edit-ops/clip/title-motion.ts +103 -0
  1413. package/apps/studio/edit-ops/clip/title-style.ts +177 -0
  1414. package/apps/studio/edit-ops/clip/track.ts +102 -0
  1415. package/apps/studio/edit-ops/clipboard.ts +482 -0
  1416. package/apps/studio/edit-ops/combine.ts +264 -0
  1417. package/apps/studio/edit-ops/constraints.ts +148 -0
  1418. package/apps/studio/edit-ops/convert-kind.ts +203 -0
  1419. package/apps/studio/edit-ops/corner-radius.ts +86 -0
  1420. package/apps/studio/edit-ops/crop.ts +303 -0
  1421. package/apps/studio/edit-ops/czech-ties.ts +84 -0
  1422. package/apps/studio/edit-ops/detach-instance.ts +119 -0
  1423. package/apps/studio/edit-ops/dispatch.ts +552 -0
  1424. package/apps/studio/edit-ops/distribute.ts +31 -0
  1425. package/apps/studio/edit-ops/ds-instance-update.ts +46 -0
  1426. package/apps/studio/edit-ops/ds-use-nearest.ts +72 -0
  1427. package/apps/studio/edit-ops/duplicate-at-width.ts +241 -0
  1428. package/apps/studio/edit-ops/frame.ts +68 -0
  1429. package/apps/studio/edit-ops/guides.ts +67 -0
  1430. package/apps/studio/edit-ops/hide.ts +30 -0
  1431. package/apps/studio/edit-ops/hover-rules.ts +94 -0
  1432. package/apps/studio/edit-ops/image-fit.ts +571 -0
  1433. package/apps/studio/edit-ops/insert-component.ts +344 -0
  1434. package/apps/studio/edit-ops/insert-preset.ts +151 -0
  1435. package/apps/studio/edit-ops/insert-shape.ts +326 -0
  1436. package/apps/studio/edit-ops/instance-model.ts +286 -0
  1437. package/apps/studio/edit-ops/instance-tree.ts +215 -0
  1438. package/apps/studio/edit-ops/layout-patch.ts +81 -0
  1439. package/apps/studio/edit-ops/lock.ts +30 -0
  1440. package/apps/studio/edit-ops/op-label.ts +155 -0
  1441. package/apps/studio/edit-ops/path-model.ts +671 -0
  1442. package/apps/studio/edit-ops/path.ts +172 -0
  1443. package/apps/studio/edit-ops/photo-every-use.ts +64 -0
  1444. package/apps/studio/edit-ops/photo-use.ts +41 -0
  1445. package/apps/studio/edit-ops/place-freely.ts +47 -0
  1446. package/apps/studio/edit-ops/place-plan.ts +60 -0
  1447. package/apps/studio/edit-ops/print.ts +104 -0
  1448. package/apps/studio/edit-ops/references.ts +231 -0
  1449. package/apps/studio/edit-ops/relink.ts +49 -0
  1450. package/apps/studio/edit-ops/reorder.ts +104 -0
  1451. package/apps/studio/edit-ops/reset-overrides.ts +75 -0
  1452. package/apps/studio/edit-ops/revert.ts +63 -0
  1453. package/apps/studio/edit-ops/rotate.ts +58 -0
  1454. package/apps/studio/edit-ops/safe-zones.ts +38 -0
  1455. package/apps/studio/edit-ops/scope-names.ts +151 -0
  1456. package/apps/studio/edit-ops/select-matching.ts +48 -0
  1457. package/apps/studio/edit-ops/set-gap.ts +65 -0
  1458. package/apps/studio/edit-ops/set-id.ts +42 -0
  1459. package/apps/studio/edit-ops/set-link.ts +39 -0
  1460. package/apps/studio/edit-ops/siblings.ts +105 -0
  1461. package/apps/studio/edit-ops/slot-defaults.ts +48 -0
  1462. package/apps/studio/edit-ops/stamp.ts +27 -0
  1463. package/apps/studio/edit-ops/swap-variant.ts +163 -0
  1464. package/apps/studio/edit-ops/text-copy.ts +146 -0
  1465. package/apps/studio/edit-ops/text-detach.ts +62 -0
  1466. package/apps/studio/edit-ops/text-style-ops.ts +131 -0
  1467. package/apps/studio/edit-ops/text-style.ts +141 -0
  1468. package/apps/studio/edit-ops/tidy.ts +72 -0
  1469. package/apps/studio/edit-ops/types.ts +229 -0
  1470. package/apps/studio/edit-ops/unframe.ts +53 -0
  1471. package/apps/studio/edit-ops/words-css.ts +487 -0
  1472. package/apps/studio/edit-ops/words-paint.ts +521 -0
  1473. package/apps/studio/edit-ops/z-order.ts +81 -0
  1474. package/apps/studio/editing/ai-point-ring.tsx +158 -0
  1475. package/apps/studio/editing/ai-scope-outline.tsx +180 -0
  1476. package/apps/studio/editing/align-bar.tsx +510 -0
  1477. package/apps/studio/editing/anchor-report.ts +123 -0
  1478. package/apps/studio/editing/anchor-reporter.tsx +64 -0
  1479. package/apps/studio/editing/aria-live.tsx +162 -0
  1480. package/apps/studio/editing/arrange.ts +345 -0
  1481. package/apps/studio/editing/artboard-actions.ts +275 -0
  1482. package/apps/studio/editing/artboard-commands.tsx +232 -0
  1483. package/apps/studio/editing/artboard-guides.tsx +265 -0
  1484. package/apps/studio/editing/artboard-handles.tsx +524 -0
  1485. package/apps/studio/editing/artboard-menu.tsx +153 -0
  1486. package/apps/studio/editing/artboard-resize.ts +306 -0
  1487. package/apps/studio/editing/ask-bubble.tsx +161 -0
  1488. package/apps/studio/editing/asset-drag.ts +70 -0
  1489. package/apps/studio/editing/click-to-type.ts +207 -0
  1490. package/apps/studio/editing/clipboard-actions.ts +91 -0
  1491. package/apps/studio/editing/clipboard.ts +194 -0
  1492. package/apps/studio/editing/clipped-grab.ts +45 -0
  1493. package/apps/studio/editing/corner-dots.tsx +394 -0
  1494. package/apps/studio/editing/crop-geometry.ts +128 -0
  1495. package/apps/studio/editing/crop-mode.tsx +522 -0
  1496. package/apps/studio/editing/crumbs.ts +158 -0
  1497. package/apps/studio/editing/draw-geometry.ts +151 -0
  1498. package/apps/studio/editing/draw-tools.tsx +490 -0
  1499. package/apps/studio/editing/drop-chip.tsx +105 -0
  1500. package/apps/studio/editing/duplicate-rhythm.ts +166 -0
  1501. package/apps/studio/editing/edit-chrome-gate.tsx +58 -0
  1502. package/apps/studio/editing/edit-op.ts +90 -0
  1503. package/apps/studio/editing/empty-report.ts +182 -0
  1504. package/apps/studio/editing/empty-reporter.tsx +74 -0
  1505. package/apps/studio/editing/figma-paste.ts +71 -0
  1506. package/apps/studio/editing/finder-drop-model.ts +130 -0
  1507. package/apps/studio/editing/finder-drop.tsx +400 -0
  1508. package/apps/studio/editing/focus-model.tsx +429 -0
  1509. package/apps/studio/editing/gap-bands.tsx +257 -0
  1510. package/apps/studio/editing/hold-rings.tsx +461 -0
  1511. package/apps/studio/editing/image-drop.tsx +193 -0
  1512. package/apps/studio/editing/index.tsx +402 -0
  1513. package/apps/studio/editing/instance-actions.ts +152 -0
  1514. package/apps/studio/editing/kids-summary.ts +75 -0
  1515. package/apps/studio/editing/kind-dim.tsx +54 -0
  1516. package/apps/studio/editing/layout-actions.ts +159 -0
  1517. package/apps/studio/editing/lock-badge.tsx +178 -0
  1518. package/apps/studio/editing/long-page.ts +102 -0
  1519. package/apps/studio/editing/minimap-context.tsx +161 -0
  1520. package/apps/studio/editing/nudge.tsx +212 -0
  1521. package/apps/studio/editing/object-actions.ts +156 -0
  1522. package/apps/studio/editing/object-keys.ts +58 -0
  1523. package/apps/studio/editing/object-menu.tsx +216 -0
  1524. package/apps/studio/editing/object-ops.ts +114 -0
  1525. package/apps/studio/editing/paste-bar.tsx +388 -0
  1526. package/apps/studio/editing/pen/combine-run.ts +113 -0
  1527. package/apps/studio/editing/pen/draw.tsx +364 -0
  1528. package/apps/studio/editing/pen/index.tsx +48 -0
  1529. package/apps/studio/editing/pen/overlay.tsx +147 -0
  1530. package/apps/studio/editing/pen/pen-geometry.ts +234 -0
  1531. package/apps/studio/editing/pen/point-store.ts +64 -0
  1532. package/apps/studio/editing/pen/points.tsx +421 -0
  1533. package/apps/studio/editing/place-freely.tsx +389 -0
  1534. package/apps/studio/editing/place-ghost.tsx +418 -0
  1535. package/apps/studio/editing/place-image.tsx +219 -0
  1536. package/apps/studio/editing/preset-ruler.tsx +218 -0
  1537. package/apps/studio/editing/rename-order.ts +58 -0
  1538. package/apps/studio/editing/reorder-slot.tsx +567 -0
  1539. package/apps/studio/editing/rotate-handle.tsx +353 -0
  1540. package/apps/studio/editing/selection.tsx +319 -0
  1541. package/apps/studio/editing/set-gap.ts +55 -0
  1542. package/apps/studio/editing/size-ghost.tsx +343 -0
  1543. package/apps/studio/editing/space-tap.ts +56 -0
  1544. package/apps/studio/editing/sticky-name.tsx +112 -0
  1545. package/apps/studio/editing/tab-order.tsx +298 -0
  1546. package/apps/studio/editing/take-keys.ts +115 -0
  1547. package/apps/studio/editing/text-actions.ts +214 -0
  1548. package/apps/studio/editing/text-in-place.tsx +187 -0
  1549. package/apps/studio/editing/tidy-preview.tsx +83 -0
  1550. package/apps/studio/editing/token-ruler.tsx +231 -0
  1551. package/apps/studio/editing/type-role.ts +122 -0
  1552. package/apps/studio/editing/undo-preview.tsx +120 -0
  1553. package/apps/studio/editing/video-label.ts +66 -0
  1554. package/apps/studio/editing/video-play.ts +65 -0
  1555. package/apps/studio/editing/world-menu.ts +36 -0
  1556. package/apps/studio/element-ids.ts +1030 -0
  1557. package/apps/studio/equal-spacing-handles.tsx +1 -1
  1558. package/apps/studio/exporters/_runtime.ts +64 -24
  1559. package/apps/studio/exporters/audio.ts +136 -0
  1560. package/apps/studio/exporters/door-fingerprint.ts +202 -0
  1561. package/apps/studio/exporters/estimate.ts +314 -0
  1562. package/apps/studio/exporters/file-names.ts +197 -0
  1563. package/apps/studio/exporters/format-scopes.ts +7 -1
  1564. package/apps/studio/exporters/hub-render-door.ts +368 -0
  1565. package/apps/studio/exporters/index.ts +53 -7
  1566. package/apps/studio/exporters/jobs.ts +484 -80
  1567. package/apps/studio/exporters/jpg.ts +21 -0
  1568. package/apps/studio/exporters/pdf-fonts.ts +102 -0
  1569. package/apps/studio/exporters/pdf.ts +133 -14
  1570. package/apps/studio/exporters/png.ts +136 -9
  1571. package/apps/studio/exporters/print-back.ts +92 -0
  1572. package/apps/studio/exporters/print-preflight.ts +373 -0
  1573. package/apps/studio/exporters/rects-runner.ts +130 -0
  1574. package/apps/studio/exporters/remote.ts +726 -3
  1575. package/apps/studio/exporters/render-seconds.ts +57 -0
  1576. package/apps/studio/exporters/replay.ts +48 -0
  1577. package/apps/studio/exporters/scope.ts +560 -15
  1578. package/apps/studio/exporters/spec-run.ts +270 -0
  1579. package/apps/studio/exporters/spec-v2.ts +408 -0
  1580. package/apps/studio/exporters/video-cap.ts +280 -0
  1581. package/apps/studio/exporters/wait-ai.ts +192 -0
  1582. package/apps/studio/figma/client.ts +67 -0
  1583. package/apps/studio/figma/comments-to-pins.ts +249 -0
  1584. package/apps/studio/figma/comments-to-strokes.ts +6 -1
  1585. package/apps/studio/figma/into-board.ts +141 -0
  1586. package/apps/studio/figma/to-strokes.ts +54 -0
  1587. package/apps/studio/format.ts +172 -30
  1588. package/apps/studio/fs-watch.ts +28 -1
  1589. package/apps/studio/generation/adapters/gemini.ts +3 -0
  1590. package/apps/studio/generation/adapters/stub.ts +133 -0
  1591. package/apps/studio/generation/gen-sidecar.ts +108 -0
  1592. package/apps/studio/generation/registry.ts +16 -5
  1593. package/apps/studio/generation/takes.ts +398 -0
  1594. package/apps/studio/generation/types.ts +7 -0
  1595. package/apps/studio/git/service.ts +143 -14
  1596. package/apps/studio/github/endpoints.ts +1 -1
  1597. package/apps/studio/github/identity-cache.ts +53 -14
  1598. package/apps/studio/handoff/blockers.ts +120 -0
  1599. package/apps/studio/handoff/run.ts +233 -0
  1600. package/apps/studio/handoff/targets.ts +334 -0
  1601. package/apps/studio/handoff/write-scopes.ts +57 -0
  1602. package/apps/studio/handoff.ts +24 -5
  1603. package/apps/studio/history/changes.ts +199 -0
  1604. package/apps/studio/history/describe-annotations.ts +216 -0
  1605. package/apps/studio/history/describe-css.ts +592 -0
  1606. package/apps/studio/history/describe-match.ts +866 -0
  1607. package/apps/studio/history/describe-meta.ts +281 -0
  1608. package/apps/studio/history/describe-version.ts +89 -0
  1609. package/apps/studio/history/describe-words.ts +513 -0
  1610. package/apps/studio/history/describe.ts +1452 -0
  1611. package/apps/studio/history/last-good.ts +123 -0
  1612. package/apps/studio/history/links.ts +112 -0
  1613. package/apps/studio/history/object-history.ts +535 -0
  1614. package/apps/studio/history/render-ok-signal.ts +81 -0
  1615. package/apps/studio/history/restore-artboard-action.ts +183 -0
  1616. package/apps/studio/history/restore-artboard.ts +607 -0
  1617. package/apps/studio/history/restore-object.ts +168 -0
  1618. package/apps/studio/history/run-label.ts +18 -0
  1619. package/apps/studio/history/surface-requests.ts +115 -0
  1620. package/apps/studio/history/titles.ts +259 -0
  1621. package/apps/studio/history/trash.ts +314 -0
  1622. package/apps/studio/history/version-lanes.ts +115 -0
  1623. package/apps/studio/history/versions.ts +458 -0
  1624. package/apps/studio/hmr-broadcast.ts +55 -1
  1625. package/apps/studio/home/ai.ts +79 -0
  1626. package/apps/studio/home/cli.ts +221 -0
  1627. package/apps/studio/home/cloud.ts +297 -0
  1628. package/apps/studio/home/create-local.ts +164 -0
  1629. package/apps/studio/home/github.ts +99 -0
  1630. package/apps/studio/home/hub.ts +340 -0
  1631. package/apps/studio/home/index-gc.ts +288 -0
  1632. package/apps/studio/home/index-reader.ts +338 -0
  1633. package/apps/studio/home/invite.ts +204 -0
  1634. package/apps/studio/home/main.ts +159 -0
  1635. package/apps/studio/home/pid.ts +12 -0
  1636. package/apps/studio/home/routes.ts +591 -0
  1637. package/apps/studio/home/signin.ts +285 -0
  1638. package/apps/studio/home/user-state.ts +177 -0
  1639. package/apps/studio/home/whats-new.ts +42 -0
  1640. package/apps/studio/http.ts +2589 -947
  1641. package/apps/studio/index/assets-response.ts +34 -0
  1642. package/apps/studio/index/assets.ts +335 -0
  1643. package/apps/studio/index/ds-usage.ts +983 -0
  1644. package/apps/studio/index/extract.ts +348 -0
  1645. package/apps/studio/index/extractors/asset-usage.ts +349 -0
  1646. package/apps/studio/index/extractors/attribution-cache.ts +225 -0
  1647. package/apps/studio/index/history-refs.ts +301 -0
  1648. package/apps/studio/index/history-source.ts +39 -0
  1649. package/apps/studio/index/match.ts +307 -0
  1650. package/apps/studio/index/scan-kick.ts +47 -0
  1651. package/apps/studio/index/service.ts +367 -0
  1652. package/apps/studio/index/snapshot.ts +135 -0
  1653. package/apps/studio/index/types.ts +139 -0
  1654. package/apps/studio/index/version-feed.ts +71 -0
  1655. package/apps/studio/input-router.tsx +522 -55
  1656. package/apps/studio/inspect-canvas.ts +86 -0
  1657. package/apps/studio/inspect-overlay.tsx +192 -0
  1658. package/apps/studio/inspect.ts +96 -33
  1659. package/apps/studio/kinds/convert.ts +175 -0
  1660. package/apps/studio/kinds/export-defaults.ts +42 -0
  1661. package/apps/studio/kinds/meta.ts +237 -0
  1662. package/apps/studio/kinds/physical.ts +84 -0
  1663. package/apps/studio/kinds/presets.ts +452 -0
  1664. package/apps/studio/kinds/print-custom.ts +165 -0
  1665. package/apps/studio/kinds/print-edit.ts +130 -0
  1666. package/apps/studio/kinds/print-guides.ts +23 -0
  1667. package/apps/studio/kinds/safe-zones.ts +250 -0
  1668. package/apps/studio/kinds/warnings.ts +422 -0
  1669. package/apps/studio/layer-name.ts +148 -0
  1670. package/apps/studio/layout/free-space.ts +131 -0
  1671. package/apps/studio/link-chip-overlay.tsx +175 -0
  1672. package/apps/studio/link-import.ts +617 -0
  1673. package/apps/studio/loopback-listen.ts +105 -0
  1674. package/apps/studio/macro-guard.ts +67 -0
  1675. package/apps/studio/managed-projects.ts +63 -14
  1676. package/apps/studio/marquee-overlay.tsx +2 -2
  1677. package/apps/studio/measure-overlay.tsx +10 -4
  1678. package/apps/studio/migrate/cli.ts +164 -0
  1679. package/apps/studio/migrate/ds-registry.ts +42 -0
  1680. package/apps/studio/migrate/engine.ts +926 -0
  1681. package/apps/studio/migrate/hub.ts +219 -0
  1682. package/apps/studio/migrate/steps.ts +627 -0
  1683. package/apps/studio/notifications.tsx +197 -52
  1684. package/apps/studio/outbox/content.ts +139 -0
  1685. package/apps/studio/outbox/drain.ts +269 -0
  1686. package/apps/studio/outbox/hub-reachability.ts +58 -0
  1687. package/apps/studio/outbox/index.ts +57 -0
  1688. package/apps/studio/outbox/policy.ts +859 -0
  1689. package/apps/studio/outbox/senders/export-cloud.ts +116 -0
  1690. package/apps/studio/outbox/store.ts +336 -0
  1691. package/apps/studio/outbox/types.ts +160 -0
  1692. package/apps/studio/participants-chrome.tsx +178 -60
  1693. package/apps/studio/paths.ts +8 -0
  1694. package/apps/studio/photo-store.ts +230 -1
  1695. package/apps/studio/port.ts +93 -0
  1696. package/apps/studio/presence/canvas-presence.tsx +522 -0
  1697. package/apps/studio/presence/fields.ts +93 -0
  1698. package/apps/studio/presence/model.ts +296 -0
  1699. package/apps/studio/presence/tones.ts +39 -0
  1700. package/apps/studio/present/fit.ts +138 -0
  1701. package/apps/studio/present/follow.ts +142 -0
  1702. package/apps/studio/present/media-presence.ts +105 -0
  1703. package/apps/studio/present/meta-schema.ts +612 -0
  1704. package/apps/studio/present/order.ts +153 -0
  1705. package/apps/studio/present/pointer-dot.tsx +379 -0
  1706. package/apps/studio/present/pointer-point.ts +24 -0
  1707. package/apps/studio/present/present-media.ts +446 -0
  1708. package/apps/studio/present/present-stage.tsx +1018 -0
  1709. package/apps/studio/present/present-zoom.ts +63 -0
  1710. package/apps/studio/present/relay-strip.ts +136 -0
  1711. package/apps/studio/preview/preview-camera.tsx +442 -0
  1712. package/apps/studio/preview/wheel-scroll.ts +85 -0
  1713. package/apps/studio/print/units.ts +3 -0
  1714. package/apps/studio/print-overlay-content.tsx +127 -10
  1715. package/apps/studio/read-only-mode.ts +83 -0
  1716. package/apps/studio/readiness.ts +18 -3
  1717. package/apps/studio/ripple.ts +19 -1
  1718. package/apps/studio/routes/agent.ts +1025 -0
  1719. package/apps/studio/routes/ai.ts +422 -0
  1720. package/apps/studio/routes/annotations.ts +649 -0
  1721. package/apps/studio/routes/asset-details.ts +87 -0
  1722. package/apps/studio/routes/asset-rename.ts +60 -0
  1723. package/apps/studio/routes/asset-state.ts +137 -0
  1724. package/apps/studio/routes/asset-trash.ts +77 -0
  1725. package/apps/studio/routes/assets.ts +217 -0
  1726. package/apps/studio/routes/availability.ts +94 -0
  1727. package/apps/studio/routes/canvas-meta-rider.ts +304 -0
  1728. package/apps/studio/routes/canvas-origin.ts +88 -0
  1729. package/apps/studio/routes/canvas-source.ts +315 -0
  1730. package/apps/studio/routes/chat-attach.ts +335 -0
  1731. package/apps/studio/routes/chat.ts +137 -0
  1732. package/apps/studio/routes/cloud-move.ts +364 -0
  1733. package/apps/studio/routes/cloud-plan.ts +36 -0
  1734. package/apps/studio/routes/comments.ts +118 -0
  1735. package/apps/studio/routes/connections.ts +132 -0
  1736. package/apps/studio/routes/describe.ts +122 -0
  1737. package/apps/studio/routes/diagnostics.ts +118 -0
  1738. package/apps/studio/routes/ds-check.ts +124 -0
  1739. package/apps/studio/routes/ds-convert.ts +55 -0
  1740. package/apps/studio/routes/ds-edges.ts +136 -0
  1741. package/apps/studio/routes/ds-library.ts +194 -0
  1742. package/apps/studio/routes/ds-make.ts +91 -0
  1743. package/apps/studio/routes/ds-switch.ts +68 -0
  1744. package/apps/studio/routes/ds-upgrade.ts +139 -0
  1745. package/apps/studio/routes/ds.ts +808 -0
  1746. package/apps/studio/routes/edit.ts +658 -0
  1747. package/apps/studio/routes/element-links.ts +155 -0
  1748. package/apps/studio/routes/export.ts +486 -0
  1749. package/apps/studio/routes/figma.ts +200 -0
  1750. package/apps/studio/routes/generate.ts +443 -0
  1751. package/apps/studio/routes/handoff.ts +319 -0
  1752. package/apps/studio/routes/help-guides.ts +37 -0
  1753. package/apps/studio/routes/history.ts +739 -0
  1754. package/apps/studio/routes/import-link.ts +186 -0
  1755. package/apps/studio/routes/index.ts +293 -0
  1756. package/apps/studio/routes/kinds.ts +257 -0
  1757. package/apps/studio/routes/links.ts +72 -0
  1758. package/apps/studio/routes/outbox.ts +87 -0
  1759. package/apps/studio/routes/photo-every-use.ts +241 -0
  1760. package/apps/studio/routes/pins.ts +66 -0
  1761. package/apps/studio/routes/present.ts +187 -0
  1762. package/apps/studio/routes/project-format.ts +148 -0
  1763. package/apps/studio/routes/project-undo.ts +497 -0
  1764. package/apps/studio/routes/settings.ts +179 -0
  1765. package/apps/studio/routes/share.ts +463 -0
  1766. package/apps/studio/routes/shell.ts +137 -0
  1767. package/apps/studio/routes/sync-conflicts.ts +150 -0
  1768. package/apps/studio/routes/sync.ts +172 -0
  1769. package/apps/studio/routes/table.ts +224 -0
  1770. package/apps/studio/routes/trash.ts +393 -0
  1771. package/apps/studio/routes/video.ts +395 -0
  1772. package/apps/studio/routes/votes.ts +486 -0
  1773. package/apps/studio/safe-zones-overlay.tsx +269 -0
  1774. package/apps/studio/scaffold-design.ts +72 -124
  1775. package/apps/studio/schema/annotations.v2.schema.json +2303 -0
  1776. package/apps/studio/schema/beats.v1.schema.json +94 -0
  1777. package/apps/studio/schema/canvas-meta.v2.schema.json +264 -0
  1778. package/apps/studio/schema/canvas-tsx.md +357 -0
  1779. package/apps/studio/schema/comments.v2.schema.json +125 -0
  1780. package/apps/studio/schema/ds-components-v1.schema.json +96 -0
  1781. package/apps/studio/schema/ds-formats.md +146 -0
  1782. package/apps/studio/schema/ds-head-v1.schema.json +67 -0
  1783. package/apps/studio/schema/ds-revision-v1.schema.json +31 -0
  1784. package/apps/studio/schema/ds-schema-v1.fallbacks.css +118 -0
  1785. package/apps/studio/schema/ds-schema-v1.json +2029 -0
  1786. package/apps/studio/schema/ds-schema-v1.schema.json +663 -0
  1787. package/apps/studio/schema/ds-tokens-v1.schema.json +210 -0
  1788. package/apps/studio/schema/edl.v1.schema.json +124 -0
  1789. package/apps/studio/schema/formats.ts +175 -0
  1790. package/apps/studio/schema/gen.v1.schema.json +33 -0
  1791. package/apps/studio/schema/transcript.v1.schema.json +133 -0
  1792. package/apps/studio/server.ts +454 -166
  1793. package/apps/studio/shell/info-file.ts +54 -0
  1794. package/apps/studio/shell/parent-watch.ts +97 -0
  1795. package/apps/studio/shell/profile.ts +61 -0
  1796. package/apps/studio/shell-canvas-file.ts +36 -0
  1797. package/apps/studio/skip-dirs.ts +455 -0
  1798. package/apps/studio/spoof-chars.ts +17 -0
  1799. package/apps/studio/static-lane.ts +212 -0
  1800. package/apps/studio/sync/accepted-cold-start.ts +35 -13
  1801. package/apps/studio/sync/accepted-link.ts +524 -27
  1802. package/apps/studio/sync/access-notices.ts +143 -0
  1803. package/apps/studio/sync/action-feed.ts +145 -0
  1804. package/apps/studio/sync/action-stage.ts +831 -165
  1805. package/apps/studio/sync/asset-push.ts +24 -2
  1806. package/apps/studio/sync/asset-state.ts +391 -0
  1807. package/apps/studio/sync/atomic-write.ts +42 -1
  1808. package/apps/studio/sync/availability.ts +185 -0
  1809. package/apps/studio/sync/canvas-path.ts +70 -6
  1810. package/apps/studio/sync/cell-pairing.ts +5 -24
  1811. package/apps/studio/sync/comment-door.ts +104 -0
  1812. package/apps/studio/sync/conflict-record.ts +186 -0
  1813. package/apps/studio/sync/create-collision.ts +297 -0
  1814. package/apps/studio/sync/ctl-provider.ts +13 -1
  1815. package/apps/studio/sync/file-membership.ts +95 -10
  1816. package/apps/studio/sync/file-plane.ts +76 -7
  1817. package/apps/studio/sync/format-sync.ts +13 -7
  1818. package/apps/studio/sync/history-fields.ts +61 -0
  1819. package/apps/studio/sync/hub-link.ts +24 -4
  1820. package/apps/studio/sync/hub-text-undo.ts +178 -0
  1821. package/apps/studio/sync/hubs-config.ts +122 -20
  1822. package/apps/studio/sync/index.ts +1444 -127
  1823. package/apps/studio/sync/journal-client.ts +44 -0
  1824. package/apps/studio/sync/keep-both.ts +187 -0
  1825. package/apps/studio/sync/link-consent.ts +390 -0
  1826. package/apps/studio/sync/local-kernel.ts +2725 -0
  1827. package/apps/studio/sync/media-gate.ts +97 -0
  1828. package/apps/studio/sync/object-conflict.ts +199 -0
  1829. package/apps/studio/sync/poke.ts +20 -0
  1830. package/apps/studio/sync/presentation.ts +14 -1
  1831. package/apps/studio/sync/project-config-push.ts +5 -2
  1832. package/apps/studio/sync/projection.ts +201 -34
  1833. package/apps/studio/sync/resync-trace.ts +220 -0
  1834. package/apps/studio/sync/status.ts +8 -1
  1835. package/apps/studio/sync/supervisor.ts +20 -2
  1836. package/apps/studio/sync/transaction-client.ts +364 -34
  1837. package/apps/studio/sync/trash-clear-copies.ts +120 -0
  1838. package/apps/studio/sync/trash-watch.ts +157 -0
  1839. package/apps/studio/sync/trash.ts +50 -2
  1840. package/apps/studio/sync/undo-target.ts +110 -0
  1841. package/apps/studio/sync/workspace-signin.ts +14 -3
  1842. package/apps/studio/sync/write-hold.ts +238 -0
  1843. package/apps/studio/sync/writer-registry.ts +380 -5
  1844. package/apps/studio/sync-name-key.ts +59 -0
  1845. package/apps/studio/thumbs/keys.ts +147 -0
  1846. package/apps/studio/thumbs/routes.ts +68 -0
  1847. package/apps/studio/thumbs/service.ts +884 -0
  1848. package/apps/studio/thumbs/store.ts +114 -0
  1849. package/apps/studio/thumbs/validate.ts +62 -0
  1850. package/apps/studio/tool-palette.tsx +782 -563
  1851. package/apps/studio/toolbars/marker-tip.ts +22 -0
  1852. package/apps/studio/toolbars/shell-panels.ts +55 -0
  1853. package/apps/studio/toolbars/tool-panel.ts +89 -0
  1854. package/apps/studio/toolbars/toolbar-css.ts +283 -0
  1855. package/apps/studio/toolbars/toolbar-icons.tsx +135 -0
  1856. package/apps/studio/toolbars/toolbar-rect.ts +82 -0
  1857. package/apps/studio/ui-prefs-migrate.ts +467 -0
  1858. package/apps/studio/ui-prefs.ts +305 -3
  1859. package/apps/studio/undo-stack.ts +10 -0
  1860. package/apps/studio/use-annotation-resize.tsx +23 -17
  1861. package/apps/studio/use-artboard-drag.tsx +156 -15
  1862. package/apps/studio/use-canvas-keys.ts +58 -0
  1863. package/apps/studio/use-chrome-visibility.tsx +13 -0
  1864. package/apps/studio/use-collab.tsx +556 -56
  1865. package/apps/studio/use-element-resize.tsx +13 -9
  1866. package/apps/studio/use-governed-mode.ts +23 -0
  1867. package/apps/studio/use-keyboard-discipline.tsx +114 -49
  1868. package/apps/studio/use-selection-set.tsx +110 -9
  1869. package/apps/studio/use-snap-guides.tsx +74 -5
  1870. package/apps/studio/use-spacing-handles.tsx +90 -27
  1871. package/apps/studio/use-tool-mode.tsx +204 -10
  1872. package/apps/studio/use-undo-stack.tsx +19 -23
  1873. package/apps/studio/video/beats.ts +484 -0
  1874. package/apps/studio/video/decode-webaudio.ts +115 -0
  1875. package/apps/studio/video/decode.ts +288 -0
  1876. package/apps/studio/video/derive.ts +647 -0
  1877. package/apps/studio/video/format-ids.ts +158 -0
  1878. package/apps/studio/video/framing.ts +246 -0
  1879. package/apps/studio/video/inject.ts +324 -0
  1880. package/apps/studio/video/keyframes.ts +356 -0
  1881. package/apps/studio/video/link-groups.ts +40 -0
  1882. package/apps/studio/video/linked-formats.ts +142 -0
  1883. package/apps/studio/video/mask-comments.ts +36 -0
  1884. package/apps/studio/video/media-analysis.ts +169 -0
  1885. package/apps/studio/video/reel-place.ts +286 -0
  1886. package/apps/studio/video/reframe-read.ts +90 -0
  1887. package/apps/studio/video/schema.ts +422 -0
  1888. package/apps/studio/video/speech.ts +129 -0
  1889. package/apps/studio/video/title-motion.ts +85 -0
  1890. package/apps/studio/video/transcript-cut.ts +91 -0
  1891. package/apps/studio/video/whisper-parse.ts +123 -0
  1892. package/apps/studio/video/words-run.ts +210 -0
  1893. package/apps/studio/video/words-timing.ts +222 -0
  1894. package/apps/studio/video-comp.tsx +238 -9
  1895. package/apps/studio/video-links-overlay.tsx +272 -0
  1896. package/apps/studio/video-natural.ts +73 -0
  1897. package/apps/studio/video-play-chrome.tsx +229 -0
  1898. package/apps/studio/video-play-overlay.tsx +190 -0
  1899. package/apps/studio/video-vocab.tsx +460 -0
  1900. package/apps/studio/view-only-gesture.tsx +101 -0
  1901. package/apps/studio/viewport-fit.ts +28 -0
  1902. package/apps/studio/web-overlay-content.tsx +4 -2
  1903. package/apps/studio/whats-new.json +55 -20
  1904. package/apps/studio/whats-new.schema.json +10 -0
  1905. package/apps/studio/whats-new.ts +4 -0
  1906. package/apps/studio/workspace-mode.ts +10 -0
  1907. package/apps/studio/ws.ts +299 -8
  1908. package/cli/bin/maude.mjs +2 -0
  1909. package/cli/commands/design.mjs +401 -72
  1910. package/cli/commands/flow.mjs +73 -0
  1911. package/cli/commands/help.mjs +14 -1
  1912. package/cli/commands/init.mjs +1 -1
  1913. package/cli/commands/migrate.mjs +55 -0
  1914. package/cli/lib/bash-guard.mjs +1691 -0
  1915. package/cli/lib/cache.mjs +1 -1
  1916. package/cli/lib/confine-out.mjs +150 -0
  1917. package/cli/lib/confine-read.mjs +179 -0
  1918. package/cli/lib/confine-root.mjs +157 -0
  1919. package/cli/lib/ddr-to-kgai.mjs +2 -2
  1920. package/cli/lib/design-help.gen.mjs +119 -0
  1921. package/cli/lib/design-hook.mjs +1764 -0
  1922. package/cli/lib/design-link.mjs +68 -4
  1923. package/cli/lib/design-open.mjs +238 -0
  1924. package/cli/lib/export-spec.mjs +394 -0
  1925. package/cli/lib/finding-text.mjs +63 -0
  1926. package/cli/lib/flow-usage.mjs +133 -0
  1927. package/cli/lib/gitignore-block.mjs +1 -0
  1928. package/cli/lib/handoff.mjs +285 -0
  1929. package/cli/lib/handoff.schema.json +336 -0
  1930. package/cli/lib/hubs-config.mjs +10 -0
  1931. package/cli/lib/json-schema-lite.mjs +260 -0
  1932. package/cli/lib/project-links.mjs +88 -0
  1933. package/cli/lib/studio-locate.mjs +83 -0
  1934. package/cli/lib/sub-verbs.mjs +111 -0
  1935. package/cli/lib/workspace-plan.mjs +16 -3
  1936. package/package.json +30 -11
  1937. package/plugins/design/README.md +46 -0
  1938. package/plugins/design/templates/_shell.html +749 -69
  1939. package/plugins/design/templates/blank-canvas.tsx.template +26 -0
  1940. package/plugins/design/templates/brief-board.tsx.template +12 -11
  1941. package/plugins/design/templates/canvas.tsx.template +3 -3
  1942. package/plugins/design/templates/design-system-inspiration/core/README.philosophy.md.tpl +104 -0
  1943. package/plugins/design/templates/design-system-inspiration/core/colors_and_type.css.tpl +38 -3
  1944. package/plugins/design/templates/design-system-inspiration/core/components.json.tpl +127 -0
  1945. package/plugins/design/templates/design-system-inspiration/core/config.json.tpl +1 -0
  1946. package/plugins/design/templates/design-system-inspiration/core/preview/_components.css.tpl +111 -0
  1947. package/plugins/flow/.claude-plugin/config.schema.json +170 -9
  1948. package/plugins/flow/README.md +18 -17
  1949. package/plugins/flow/dependencies.json +25 -26
  1950. package/plugins/flow/templates/ai-skeleton/INDEX.md +3 -3
  1951. package/plugins/flow/templates/ai-skeleton/README.md +5 -5
  1952. package/plugins/flow/templates/ai-skeleton/context/README.md +1 -1
  1953. package/plugins/flow/templates/ai-skeleton/logs/README.md +1 -1
  1954. package/plugins/flow/templates/ai-skeleton/plans/README.md +1 -1
  1955. package/plugins/flow/templates/ai-skeleton/reviews/README.md +2 -2
  1956. package/plugins/flow/templates/ai-skeleton/scenario-guide.md +4 -4
  1957. package/plugins/flow/templates/ai-skeleton/scenarios/README.md +2 -2
  1958. package/plugins/flow/templates/ai-skeleton/templates/HANDOFF.md +1 -1
  1959. package/apps/studio/annotations/ui/edit-actions.ts +0 -551
  1960. package/apps/studio/canvas-header.ts +0 -165
  1961. package/apps/studio/client/hmr.mjs +0 -113
  1962. package/apps/studio/client/hooks/use-keyboard-shortcuts.jsx +0 -297
  1963. package/apps/studio/client/iframe-lazy.mjs +0 -121
  1964. package/apps/studio/client/inspector/artboard-knobs.jsx +0 -456
  1965. package/apps/studio/client/menus/menubar.jsx +0 -856
  1966. package/apps/studio/client/panels/CapabilityBar.jsx +0 -101
  1967. package/apps/studio/client/panels/ClipInspector.jsx +0 -409
  1968. package/apps/studio/client/panels/GitPanel.jsx +0 -1026
  1969. package/apps/studio/client/panels/OnboardingWizard.jsx +0 -642
  1970. package/apps/studio/client/panels/StickerPicker.jsx +0 -160
  1971. package/apps/studio/client/panels/SyncPanel.jsx +0 -1190
  1972. package/apps/studio/client/panels/TimelinePanel.jsx +0 -2259
  1973. package/apps/studio/client/share-dialog.jsx +0 -91
  1974. package/apps/studio/client/shell/collapsed-rail.jsx +0 -23
  1975. package/apps/studio/client/shell/status-bar.jsx +0 -215
  1976. package/apps/studio/client/styles/1-tokens-maude.css +0 -296
  1977. package/apps/studio/client/styles/1-tokens.css +0 -304
  1978. package/apps/studio/client/styles/3-shell-maude.css +0 -3158
  1979. package/apps/studio/client/styles/3-shell.css +0 -1036
  1980. package/apps/studio/client/styles/4-components-maude.css +0 -134
  1981. package/apps/studio/client/styles/4-components.css +0 -2204
  1982. package/apps/studio/client/styles/5-maude-overrides.css +0 -162
  1983. package/apps/studio/client/styles.css +0 -1264
  1984. package/apps/studio/contextual-toolbar.tsx +0 -512
  1985. package/apps/studio/export-dialog.tsx +0 -827
  1986. package/apps/studio/undo-hud.tsx +0 -16
@@ -1,11 +1,14 @@
1
- import{Component as eo,createElement as $e,useCallback as ze,useEffect as Q,useMemo as to,useRef as F,useState as ie}from"react";import{createRoot as no}from"react-dom/client";var Kt=/^[A-Za-z0-9_-]{1,64}$/;function j(e){return typeof e==="string"&&Kt.test(e)}function Ye(e){if(!e||typeof e!=="object")return!1;let{x:t,y:n}=e;return typeof t==="number"&&typeof n==="number"&&Number.isFinite(t)&&Number.isFinite(n)&&Math.abs(t)<=1e7&&Math.abs(n)<=1e7}function Be(){if(typeof window>"u"||typeof document>"u")return null;let e=window.__maudeViewport?.()??null;if(!e||!(e.zoom>0))return null;let t=document.querySelector(".dc-canvas");if(!t)return null;let n=t.getBoundingClientRect();return{vp:e,left:n.left,top:n.top}}function We(e,t){let n=Be();if(!n)return null;let{vp:o}=n;return{x:(e-n.left-o.x)/o.zoom,y:(t-n.top-o.y)/o.zoom}}function qe(e){let t=Be();if(!t)return null;let{vp:n}=t;return{x:t.left+n.x+e.x*n.zoom,y:t.top+n.y+e.y*n.zoom}}function le(e){if(typeof document>"u"||!j(e))return null;return document.querySelector(`[data-id="${e}"][data-tool]`)}function Xe(e,t){if(typeof document>"u")return null;let n=null;for(let o of Array.from(document.querySelectorAll("[data-id][data-tool]"))){if(o.getAttribute("data-tool")==="section")continue;let r=o.getAttribute("data-id");if(!j(r))continue;let s=o.getBoundingClientRect();if(s.width<=0&&s.height<=0)continue;if(e<s.left||e>s.right||t<s.top||t>s.bottom)continue;let a=Math.max(1,s.width)*Math.max(1,s.height);if(!n||a<=n.area)n={id:r,area:a}}return n?.id??null}import{useCallback as A,useEffect as H,useMemo as J,useRef as P,useState as z}from"react";function we(){if(typeof window>"u")return;try{let e=window.location.pathname;if(e==="/_canvas-shell.html"||e==="/_canvas-shell"){let t=new URLSearchParams(window.location.search),n=t.get("canvas")??"",o=(t.get("designRel")??".design").replace(/^\/+|\/+$/g,"");return n?`${o}/${n}`:void 0}return decodeURIComponent(e).replace(/^\//,"")}catch{return}}function ae(e){if(!e)return"";return(e.getAttribute("class")??"").trim().split(/\s+/).filter((t)=>t&&!t.startsWith("dgn-")&&!t.startsWith("dc-cv-")).join(" ")}function $t(e,t){if(!e)return"";let n=(e.innerText||e.textContent||"").replace(/\s+/g," ").trim();return n.length>t?`${n.slice(0,t-1)}…`:n}function Qt(e){if(!e)return"";let t=[],n=e;while(n&&n.nodeType===1&&t.length<8){let o=n.getAttribute?.("data-dc-element");if(o){t.unshift(`[data-dc-element="${o}"]`);break}let r=n.getAttribute?.("data-dc-screen");if(r){t.unshift(`[data-dc-screen="${r}"]`);break}let s=n.nodeName.toLowerCase();if(n.id){s=`#${n.id}`,t.unshift(s);break}let a=ae(n).split(/\s+/).filter(Boolean).slice(0,2);if(a.length)s+=`.${a.join(".")}`;let c=1,m=n.previousElementSibling;while(m)c++,m=m.previousElementSibling;s+=`:nth-child(${c})`,t.unshift(s),n=n.parentElement}return t.join(" > ")}function je(e){let t=[],n=e;while(n&&n.nodeType===1&&t.length<8){let o=n.nodeName.toLowerCase(),r=n.getAttribute?.("data-dc-element"),s=n.getAttribute?.("data-dc-screen");if(r)o+=`[data-dc-element="${r}"]`;else if(s)o+=`[data-dc-screen="${s}"]`;else if(n.id)o+=`#${n.id}`;let a=ae(n).split(/\s+/).filter(Boolean).slice(0,2);if(a.length&&!r&&!s)o+=`.${a.join(".")}`;t.unshift(o),n=n.parentElement}return t}function Ft(e){return e.replace(/[^a-zA-Z0-9_-]/g,(t)=>`\\${t}`)}function Ge(e,t){return t?`[data-dc-screen="${t}"] [data-cd-id="${e}"]`:`[data-cd-id="${e}"]`}function Ze(e,t,n){if(!n)return 0;try{let o=e.querySelectorAll(t);for(let r=0;r<o.length;r++)if(o[r]===n)return r}catch{}return 0}function Je(e,t,n){if(!t||!n)return 0;return Ze(e,`[data-cd-id="${Ft(t)}"]`,n)}function ve(e,t){let n=(o)=>{try{let r=e.querySelectorAll(o);if(!r.length)return null;let s=t.index&&t.index>0&&t.index<r.length?t.index:0;return r[s]??r[0]}catch{return null}};if(t.id){let o=n(Ge(t.id,t.artboardId));if(o)return o}if(t.selector)return n(t.selector);return null}function Ut(e,t){let n=0,o=Math.min(e.length,t.length);for(let r=1;r<=o;r++){if(e[e.length-r]!==t[t.length-r])break;n++}return n}function et(e,t){let n=t.dom_path,o=(t.tag||"").toLowerCase();if(!n||n.length===0||!o)return null;let r=e;if(t.artboardId){let m=e.querySelector(`[data-dc-screen="${t.artboardId}"]`);if(m)r=m}let s=(t.classes||"").split(/\s+/).filter(Boolean),a=null,c=0;for(let m of Array.from(r.querySelectorAll("[data-cd-id]"))){if(m.tagName.toLowerCase()!==o)continue;let v=Ut(je(m),n);if(v===0)continue;let x=ae(m).split(/\s+/).filter(Boolean),f=s.filter((h)=>x.includes(h)).length,u=v*10+f;if(u>c)c=u,a=m}return a}var Ve=["display","flex-direction","flex-wrap","align-items","justify-content","gap","flex","flex-grow","flex-shrink","flex-basis","align-self","font-family","color","font-size","font-weight","line-height","letter-spacing","text-align","margin","margin-top","margin-right","margin-bottom","margin-left","padding","padding-top","padding-right","padding-bottom","padding-left","width","height","min-width","min-height","max-width","max-height","background-color","border-radius","border-top-left-radius","border-top-right-radius","border-bottom-left-radius","border-bottom-right-radius","border-width","border-style","border-color","box-shadow","opacity","position","top","right","bottom","left","z-index","transform","transform-origin","font-style","text-transform","text-decoration","white-space","overflow","object-fit","aspect-ratio","object-position"],Yt=/^(style|class|data-cd-id|data-dc-|data-dcid$)/;function Bt(e){if(!e||typeof window>"u"||!window.getComputedStyle)return{authored:{},computed:{},customStyles:{},attrs:{}};try{let t=e.style,n=window.getComputedStyle(e),o={},r={},s=new Set(Ve);for(let u of Ve){let h=t.getPropertyValue(u);if(h)o[u]=h.trim();let d=n.getPropertyValue(u);if(d)r[u]=d.trim()}let a=/^(margin|padding|border)(-|$)/,c={};for(let u=0;u<t.length;u++){let h=t.item(u);if(!h||s.has(h)||a.test(h))continue;let d=t.getPropertyValue(h);if(d)c[h]=d.trim()}let m={};for(let u of Array.from(e.attributes)){if(Yt.test(u.name))continue;m[u.name]=u.value}if(e.hasAttribute("data-dc-screen")){for(let u of Array.from(e.attributes))if(u.name.startsWith("data-dc-")&&u.name!=="data-dcid")m[u.name]=u.value}let v=e.parentElement,x=v?window.getComputedStyle(v).display:"",f=v&&(x==="flex"||x==="inline-flex")?window.getComputedStyle(v).flexDirection:"";return{authored:o,computed:r,customStyles:c,attrs:m,parentDisplay:x,parentFlexDirection:f}}catch{return{authored:{},computed:{},customStyles:{},attrs:{}}}}function xe(e,t){let n=e.el,o=n&&n.getBoundingClientRect?n.getBoundingClientRect():null,r=e.cdId,s=r?Ge(r,e.artboardId):e.artboardId?`[data-dc-screen="${e.artboardId}"]`:Qt(n),a=r&&typeof document<"u"?Ze(document,s,n):0;return{file:t??we(),id:r??void 0,selector:s,artboardId:e.artboardId,index:a,tag:n?.tagName.toLowerCase()??"",classes:ae(n),text:$t(n,240),dom_path:je(n),bounds:o?{x:Math.round(o.left),y:Math.round(o.top),w:Math.round(o.width),h:Math.round(o.height)}:null,worldW:n instanceof HTMLElement?Math.round(n.offsetWidth):void 0,worldH:n instanceof HTMLElement?Math.round(n.offsetHeight):void 0,html:n?(n.outerHTML??"").slice(0,4000):"",...(()=>{if(n?.tagName?.toLowerCase()!=="img")return{};let c=/assets\/[0-9a-f]{8}\.[a-z0-9]+/i,m=n.getAttribute?.("data-photo-asset");if(m&&c.test(m))return{photoKind:"artboard-img",photoAsset:m};let v=n.getAttribute?.("src")||"",x=c.exec(v);return x?{photoKind:"artboard-img",photoAsset:x[0]}:{}})(),...Bt(n)}}var ce=null;function G(){if(typeof window>"u")return!1;if(ce===null)try{ce=new URLSearchParams(window.location.search).get("ro")==="1"}catch{ce=!1}return ce}var ue=null;function tt(){if(typeof window>"u")return!1;if(ue===null)try{ue=new URLSearchParams(window.location.search).get("embed")==="1"}catch{ue=!1}return ue}import*as Ee from"lib0/decoding";import*as Z from"lib0/encoding";import{createContext as Xt,useCallback as So,useContext as Vt,useEffect as Co,useMemo as To,useReducer as Lo,useRef as ko,useState as Ro}from"react";import{Awareness as Ao,applyAwarenessUpdate as _o,encodeAwarenessUpdate as Io}from"y-protocols/awareness";import{readSyncMessage as Oo,writeSyncStep1 as Do,writeUpdate as Ho}from"y-protocols/sync";import*as jt from"yjs";import*as Wt from"yjs";var qt=new WeakSet;function nt(e){return qt.add(e),e}var yo=nt(Object.freeze({maudeOrigin:"shell-edit"})),bo=nt(Object.freeze({maudeOrigin:"sync-agent"}));var Gt=Xt(null);function ot(){return Vt(Gt)}import{createContext as Zt,useCallback as q,useContext as Ce,useEffect as Jt,useMemo as en,useRef as rt,useState as tn}from"react";import{jsx as Se,Fragment as rn}from"react/jsx-runtime";var de=Zt(null);function X(e){return e.id?`id:${e.id}`:`sel:${e.selector}`}function it(e){let t=[],n=new Set;for(let o of e){let r=X(o);if(n.has(r))continue;n.add(r),t.push(o)}return t}var nn=50;function on({children:e,postTarget:t}){let[n,o]=tn([]),r=rt(null),s=rt(null),a=q((h)=>{if(r.current)clearTimeout(r.current);s.current=()=>{r.current=null,s.current=null;let d=t??(typeof window<"u"?window.parent:null);if(!d)return;let w=h.length===0?null:h.length===1?h[0]??null:h;try{d.postMessage({dgn:"select-set",selection:w},"*")}catch{}},r.current=setTimeout(()=>s.current?.(),nn)},[t]);Jt(()=>()=>{if(r.current)clearTimeout(r.current);s.current?.()},[]);let c=q((h)=>{let d=it(Array.isArray(h)?h:[h]);o(d),a(d)},[a]),m=q((h)=>{let d=Array.isArray(h)?h:[h];o((w)=>{let S=it([...w,...d]);return a(S),S})},[a]),v=q((h)=>{let d=X(h);o((w)=>{let S=w.filter((i)=>X(i)!==d);return a(S),S})},[a]),x=q((h)=>{let d=X(h);o((w)=>{let S=w.some((i)=>X(i)===d)?w.filter((i)=>X(i)!==d):[...w,h];return a(S),S})},[a]),f=q(()=>{o([]),a([])},[a]),u=en(()=>({selected:n,replace:c,add:m,remove:v,toggle:x,clear:f}),[n,c,m,v,x,f]);return Se(de.Provider,{value:u,children:e})}function st({children:e}){if(Ce(de))return Se(rn,{children:e});return Se(on,{children:e})}function me(){let e=Ce(de);if(!e)throw Error("useSelectionSet must be used inside <SelectionSetProvider>");return e}function lt(){return Ce(de)}import{jsx as R,jsxs as _,Fragment as En}from"react/jsx-runtime";var sn="/_client/comments-overlay.css";function ln(){if(typeof document>"u")return;if(document.getElementById("cm-overlay-css"))return;let e=document.createElement("link");e.id="cm-overlay-css",e.rel="stylesheet",e.href=sn,document.head.appendChild(e)}function an(){if(typeof window>"u")return null;try{let e=window.location.pathname;if(e==="/_canvas-shell.html"||e==="/_canvas-shell"){let t=new URLSearchParams(window.location.search),n=t.get("canvas")??"",o=(t.get("designRel")??".design").replace(/^\/+|\/+$/g,"");return n?`${o}/${n}`:null}return decodeURIComponent(e).replace(/^\//,"")}catch{return null}}function cn(e){if(j(e.annotationId))return le(e.annotationId);if(!e.selector)return null;let t=null;try{let n=document.querySelectorAll(e.selector),o=e.index&&e.index>0&&e.index<n.length?e.index:0;t=n[o]??n[0]??null}catch{t=null}if(t&&e.tag&&t.tagName.toLowerCase()!==e.tag.toLowerCase())t=null;if(!t&&e.dom_path?.length){let n=e.selector.match(/data-dc-screen="([^"]+)"/)?.[1];t=et(document,{artboardId:n,tag:e.tag,classes:e.classes,dom_path:e.dom_path})}return t}function ke(e){let t=cn(e);if(!t?.isConnected)return null;let n=t.getBoundingClientRect();if(n.width===0&&n.height===0)return null;return{x:n.left,y:n.top,w:n.width,h:n.height}}function mt(e,t){let o=typeof window<"u"?window.innerWidth:e.x+t.w,r=typeof window<"u"?window.innerHeight:e.y+t.h,s=e.x;if(s+t.w+8>o){let c=e.x-t.w;s=c>=8?c:Math.max(8,o-t.w-8)}let a=e.y;if(a+t.h+8>r){let c=e.y-t.h;a=c>=8?c:Math.max(8,r-t.h-8)}return{x:s,y:a}}function ft(){ln();let e=lt(),[t,n]=z([]),[o,r]=z(null),[s,a]=z(null),c=J(()=>an(),[]);H(()=>{if(typeof document>"u")return;let g=document.getElementById("dgn-pin-layer");if(!g)return;let l=g.style.display;return g.style.display="none",()=>{g.style.display=l}},[]);let m=A((g)=>{if(!e)return;if(!g?.selector){e.clear();return}let l=g.selector.match(/data-cd-id="([^"]+)"/),y=l?l[1]:void 0,T,b;try{let C=document.querySelector(g.selector);if(C)T=C.tagName.toLowerCase(),b=(C.getAttribute("class")??"").split(/\s+/).filter((k)=>k&&!k.startsWith("dgn-")&&!k.startsWith("dc-cv-")).join(" ")}catch{}e.replace({file:c??void 0,id:y,selector:g.selector,tag:T,classes:b,bounds:g.bounds??void 0})},[e,c]),v=P(t);v.current=t;let x=ot(),f=yn();H(()=>{if(!x)return;let g=x.doc.getArray("comments"),l=()=>{n(g.toArray())};if(g.length>0)l();return g.observe(l),()=>{try{g.unobserve(l)}catch{}}},[x]),H(()=>{if(typeof window>"u")return;let g=(l)=>{let y=l.data;if(!y||typeof y!=="object"||!y.dgn)return;if(y.dgn==="comments-set"&&Array.isArray(y.comments))n(y.comments);else if(y.dgn==="comment-focus"){let T=typeof y.id==="string"?y.id:null;r(T);let b=T?v.current.find((C)=>C.id===T):void 0;m(b)}};return window.addEventListener("message",g),()=>window.removeEventListener("message",g)},[m]),H(()=>{if(typeof document>"u")return;let g=(l)=>{let y=l.detail;if(!y?.selection)return;a({selection:y.selection,clientX:typeof y.clientX==="number"?y.clientX:0,clientY:typeof y.clientY==="number"?y.clientY:0})};return document.addEventListener("cm:open-composer",g),()=>document.removeEventListener("cm:open-composer",g)},[]);let u=A(()=>{if(a(null),typeof window>"u")return;try{window.parent.postMessage({dgn:"force-clear"},"*")}catch{}},[]),h=A((g)=>{if(!s)return;let l=s.selection,y={file:l.file,selector:l.selector,index:l.index,dom_path:l.dom_path,tag:l.tag,classes:l.classes,bounds:l.bounds,html_excerpt:l.html,...l.annotationId?{annotationId:l.annotationId}:{},...l.world?{world:l.world}:{},text:g};if(typeof window>"u")return;try{window.parent.postMessage({dgn:"comment-submit",payload:y},"*")}catch{}u()},[s,u]);H(()=>{if(!c)return;let g=!1;return(async()=>{try{let l=await fetch(`/_comments?file=${encodeURIComponent(c)}`);if(!l.ok)return;let y=await l.json();if(g)return;if(Array.isArray(y.comments))n((T)=>T.length===0?y.comments??[]:T)}catch{}})(),()=>{g=!0}},[c]);let d=J(()=>t.slice().sort((l,y)=>l.created.localeCompare(y.created)).filter((l)=>l.status!=="resolved"),[t]),w=J(()=>{let g=new Map;return t.slice().sort((y,T)=>y.created.localeCompare(T.created)).forEach((y,T)=>{g.set(y.id,T+1)}),g},[t]),S=A((g)=>{if(r(g),m(t.find((l)=>l.id===g)),typeof window>"u")return;try{window.parent.postMessage({dgn:"comment-click",id:g},"*")}catch{}},[t,m]),i=A((g,l)=>{if(typeof window>"u")return;try{window.parent.postMessage({dgn:"comment-patch",id:g,patch:l},"*")}catch{}},[]),p=A((g)=>{if(typeof window>"u")return;try{window.parent.postMessage({dgn:"comment-delete",id:g},"*")}catch{}r((l)=>l===g?null:l)},[]),E=A(async(g,l)=>{if(typeof fetch>"u")return!1;try{let y=await fetch(`/_api/comments/${encodeURIComponent(g)}/reply`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({body:l})});if(!y.ok)return!1;let T=await y.json();return n((b)=>b.map((C)=>C.id===T.id?T:C)),!0}catch{return!1}},[]);return _("div",{className:"cm-layer","aria-hidden":!1,children:[d.map((g)=>{let l=w.get(g.id)??0;return R(hn,{comment:g,sequence:l,focused:o===g.id,onClick:S},g.id)}),s?R(gn,{state:s,onSubmit:h,onCancel:u}):null,(()=>{if(!o)return null;let g=d.find((l)=>l.id===o);if(!g)return null;return R(bn,{comment:g,sequence:w.get(g.id)??0,onClose:()=>{r(null),e?.clear()},onPatch:(l)=>i(g.id,l),onDelete:()=>p(g.id),onReply:(l)=>E(g.id,l),mine:!G()&&!!(f??x?.myName)&&(g.author??"").trim()===(f??x?.myName??"").trim()})})()]})}var Te=null;async function un(){if(!Te)Te=(async()=>{try{let e=await fetch("/_api/git-committers");if(!e.ok)return[];let t=await e.json();return Array.isArray(t.committers)?t.committers:[]}catch{return[]}})();return Te}function at(e){return(e.trim().split(/\s+/)[0]??"").replace(/[^\w.-]/g,"").toLowerCase()}function dn(e,t){if(t<=0||t>e.length)return null;let n=t-1;while(n>=0){let o=e[n]??"";if(o==="@"){let r=n>0?e[n-1]:"";if(n===0||/\s/.test(r??"")){let s=e.slice(n+1,t);return{start:n,end:t,query:s}}return null}if(!/[\w.-]/.test(o))return null;n-=1}return null}function Le({className:e,value:t,onChange:n,onKeyDown:o,placeholder:r,rows:s,disabled:a,textareaRef:c,ariaLabel:m}){let v=P(null),x=A((b)=>{if(v.current=b,c)c.current=b},[c]),[f,u]=z([]),[h,d]=z(null),[w,S]=z(0),i=A(()=>{if(f.length>0)return;un().then((b)=>u(b))},[f.length]),p=J(()=>{if(!h)return[];let b=h.query.toLowerCase();return(!b?f:f.filter((k)=>k.name.toLowerCase().includes(b)||(k.email??"").toLowerCase().includes(b))).slice(0,8)},[h,f]),E=A((b)=>{let C=b.selectionStart??b.value.length,k=dn(b.value,C);d(k),S(0)},[]),g=A((b)=>{n(b.target.value),E(b.target)},[n,E]),l=A((b)=>{if(!h)return;let C=v.current;if(!C)return;let k=`@${at(b.name)}`,L=`${t.slice(0,h.start)}${k} ${t.slice(h.end)}`;n(L),d(null);let M=h.start+k.length+1;requestAnimationFrame(()=>{C.focus(),C.setSelectionRange(M,M)})},[h,t,n]),y=A((b)=>{if(h&&p.length>0){if(b.key==="ArrowDown"){b.preventDefault(),S((C)=>(C+1)%p.length);return}if(b.key==="ArrowUp"){b.preventDefault(),S((C)=>(C-1+p.length)%p.length);return}if(b.key==="Enter"||b.key==="Tab"){b.preventDefault();let C=p[w]??p[0];if(C)l(C);return}if(b.key==="Escape"){b.preventDefault(),d(null);return}}o?.(b)},[h,p,w,l,o]),T=A((b)=>{E(b.currentTarget)},[E]);return _("div",{style:{position:"relative"},children:[R("textarea",{ref:x,className:e,value:t,placeholder:r,rows:s,disabled:a,"aria-label":m,onChange:g,onKeyDown:y,onFocus:i,onSelect:T,onClick:T}),h&&p.length>0?R("ul",{className:"cm-mention-popup",role:"listbox","aria-label":"Mention suggestions",style:{left:0,top:"100%"},children:p.map((b,C)=>_("li",{role:"option","aria-selected":C===w,className:"cm-mention-popup__item",onMouseEnter:()=>S(C),onMouseDown:(L)=>{L.preventDefault(),l(b)},children:[_("span",{className:"cm-mention-popup__name",children:["@",at(b.name)]}),b.email?R("span",{className:"cm-mention-popup__email",children:b.email}):null]},`${b.name}-${b.email??""}`))}):null]})}var mn=3000;function fn(e){return{x:e.x-12,y:e.y-12,w:24,h:24}}function pn(e){let t=!!e.selector||j(e.annotationId);if(t){let r=ke(e);if(r)return{pos:r,missing:!1}}let n=Ye(e.world)?qe(e.world):null;return{pos:n?fn(n):e.bounds??null,missing:t}}function hn({comment:e,sequence:t,focused:n,onClick:o}){let r=P(null),s=P(null),a=P(null),[c,m]=z(!1),v=P(!1);H(()=>{let u=()=>{s.current=null;let h=r.current;if(!h)return;let{pos:d,missing:w}=pn(e),S=!1;if(w){if(a.current==null)a.current=Date.now();S=Date.now()-a.current>mn}else a.current=null;if(S!==v.current)v.current=S,m(S);if(!d){h.style.display="none",s.current=requestAnimationFrame(u);return}h.style.display="grid";let i=Math.round(d.x+d.w-12),p=Math.round(d.y-12);h.style.left=`${i}px`,h.style.top=`${p}px`,s.current=requestAnimationFrame(u)};return s.current=requestAnimationFrame(u),()=>{if(s.current!=null)cancelAnimationFrame(s.current)}},[e]);let x=e.author?.trim()||"unknown",f=`Comment ${t} by ${x}${c?" (detached: its target is gone)":""}`;return R("button",{ref:r,type:"button",className:"cm-pin","data-resolved":e.status==="resolved"?"true":"false","data-focused":n?"true":"false","data-detached":c?"true":"false","data-comment-pin":e.id,"aria-label":f,"aria-expanded":n,title:e.text.slice(0,200),onClick:(u)=>{u.preventDefault(),u.stopPropagation(),o(e.id)},children:t})}function gn({state:e,onSubmit:t,onCancel:n}){let[o,r]=z(""),s=P(null),a=P(null),c=P(null);H(()=>{let f=()=>{c.current=null;let u=a.current;if(!u)return;let h=xn(e),d=mt(h,{w:u.offsetWidth,h:u.offsetHeight});u.style.left=`${Math.round(d.x)}px`,u.style.top=`${Math.round(d.y)}px`,c.current=requestAnimationFrame(f)};return c.current=requestAnimationFrame(f),()=>{if(c.current!=null)cancelAnimationFrame(c.current)}},[e]),H(()=>{s.current?.focus()},[]);let m=A(()=>{let f=o.trim();if(!f)return;t(f)},[o,t]),v=A((f)=>{if(f.key==="Escape"){f.preventDefault(),n();return}if((f.metaKey||f.ctrlKey)&&f.key==="Enter")f.preventDefault(),m()},[n,m]),x=J(()=>{let f=e.selection.selector||"";if(!f)return e.selection.tag||(e.selection.annotationId?"annotation":"canvas");let u=f.match(/data-cd-id="([^"]+)"/);if(u)return`cd:${u[1]}`;return f.length>36?`${f.slice(0,33)}…`:f},[e.selection]);return _("div",{ref:a,className:"cm-composer",role:"dialog","aria-label":"New comment",onClick:(f)=>f.stopPropagation(),onPointerDown:(f)=>f.stopPropagation(),children:[_("div",{className:"cm-composer__head",children:[R("span",{children:"New comment"}),R("span",{className:"cm-composer__selector",children:x})]}),R(Le,{textareaRef:s,className:"cm-composer__textarea",value:o,placeholder:"Type a comment. ⌘↵ to save · Esc to cancel · @name to tag",onChange:r,onKeyDown:v,rows:3,ariaLabel:"Comment body"}),_("div",{className:"cm-composer__actions",children:[R("button",{type:"button",className:"cm-btn",onClick:n,children:"Cancel"}),R("button",{type:"button",className:"cm-btn cm-btn--primary",disabled:!o.trim(),onClick:m,children:"Save"})]})]})}var ct=null;function yn(){let[e,t]=z(null);return H(()=>{if(typeof fetch>"u")return;ct??=fetch("/_api/git-user").then((o)=>o.ok?o.json():null).then((o)=>typeof o?.name==="string"&&o.name.trim()?o.name.trim():null).catch(()=>null);let n=!0;return ct.then((o)=>n&&t(o)),()=>{n=!1}},[]),e}function bn({comment:e,sequence:t,onClose:n,onPatch:o,onDelete:r,onReply:s,mine:a=!1}){let c=P(null),m=P(null),v=P(null),[x,f]=z(""),[u,h]=z(!1),[d,w]=z(null),S=A(()=>{let l=(d??"").trim();if(!l)return;if(l!==e.text)o({text:l});w(null)},[d,e.text,o]);H(()=>{let l=()=>{v.current=null;let y=c.current;if(!y)return;let T=vn(e),b=mt(T,{w:y.offsetWidth,h:y.offsetHeight});y.style.left=`${Math.round(b.x)}px`,y.style.top=`${Math.round(b.y)}px`,v.current=requestAnimationFrame(l)};return v.current=requestAnimationFrame(l),()=>{if(v.current!=null)cancelAnimationFrame(v.current)}},[e]),H(()=>{c.current?.focus();let l=e.id;return()=>{document.querySelector(`[data-comment-pin="${l}"]`)?.focus()}},[e.id]),H(()=>{if(typeof document>"u")return;let l=(y)=>{if(y.key!=="Escape")return;let T=c.current;if(!T)return;if(T.contains(y.target)||document.activeElement===T)y.preventDefault(),n()};return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[n]);let i=A(async()=>{let l=x.trim();if(!l||u)return;h(!0);let y=await s(l);if(h(!1),y)f(""),m.current?.focus()},[x,u,s]),p=A((l)=>{if((l.metaKey||l.ctrlKey)&&l.key==="Enter")l.preventDefault(),i()},[i]),E=`cm-thread-head-${e.id}`,g=wn(e.selector,"");return _("div",{ref:c,className:"cm-thread",role:"dialog","aria-labelledby":E,tabIndex:-1,onClick:(l)=>l.stopPropagation(),onPointerDown:(l)=>l.stopPropagation(),children:[_("div",{className:"cm-thread__head",id:E,children:[_("div",{className:"cm-thread__head-row",children:[R("span",{className:"cm-thread__seq","aria-hidden":"true",children:t}),R("span",{className:"cm-thread__author",children:e.author?.trim()||"unknown"}),R("span",{className:"cm-thread__time",children:dt(e.created)}),R("button",{type:"button",className:"cm-thread__close","aria-label":"Close thread",title:"Close · Esc",onClick:n,children:"×"})]}),g?R("code",{className:"cm-thread__selector",children:g}):null]}),d===null?R("div",{className:"cm-thread__body",children:ut(e.text)}):_("div",{className:"cm-thread__reply-form",children:[R(Le,{className:"cm-thread__reply-textarea",value:d,placeholder:"Edit your comment… ⌘↵ to save",onChange:w,onKeyDown:(l)=>{if((l.metaKey||l.ctrlKey)&&l.key==="Enter")l.preventDefault(),S()},rows:3,ariaLabel:"Edit comment"}),_("div",{className:"cm-thread__reply-actions",children:[R("button",{type:"button",className:"cm-btn",onClick:()=>w(null),children:"Cancel"}),R("button",{type:"button",className:"cm-btn cm-btn--primary","data-testid":"comment-edit-save",disabled:!d.trim(),onClick:S,children:"Save"})]})]}),(e.thread??[]).map((l)=>_("div",{className:"cm-thread__reply",children:[_("div",{className:"cm-thread__reply-head",children:[R("span",{className:"cm-thread__reply-author",children:l.author?.trim()||"unknown"}),R("span",{className:"cm-thread__reply-time",children:dt(l.created)})]}),R("div",{className:"cm-thread__reply-body",children:ut(l.body)})]},l.id)),!G()&&_(En,{children:[_("div",{className:"cm-thread__reply-form",children:[R(Le,{textareaRef:m,className:"cm-thread__reply-textarea",value:x,placeholder:"Reply… ⌘↵ to send · @name to tag",onChange:f,onKeyDown:p,rows:2,ariaLabel:"Reply",disabled:u}),R("div",{className:"cm-thread__reply-actions",children:R("button",{type:"button",className:"cm-btn cm-btn--primary",disabled:!x.trim()||u,onClick:()=>void i(),children:"Send"})})]}),_("div",{className:"cm-thread__actions",children:[a&&d===null?R("button",{type:"button",className:"cm-btn","data-testid":"comment-edit",onClick:()=>w(e.text),children:"Edit"}):null,e.status==="resolved"?R("button",{type:"button",className:"cm-btn",onClick:()=>o({status:"open"}),children:"↺ Reopen"}):R("button",{type:"button",className:"cm-btn cm-btn--primary",onClick:()=>{o({status:"resolved"}),n()},children:"✓ Resolve"}),R("button",{type:"button",className:"cm-btn cm-btn--danger",onClick:()=>{r(),n()},children:"Delete"})]})]})]})}function ut(e){if(!e)return null;let t=/(@[\w][\w.-]*)/g;return e.split(t).map((o,r)=>{let s=`${r}:${o}`;if(r%2===1)return R("strong",{"data-mention":"true",children:o},s);return R("span",{children:o},s)})}function dt(e){if(!e)return"";let t=Date.parse(e);if(!Number.isFinite(t))return"";let n=Math.round((Date.now()-t)/1000);if(n<60)return`${Math.max(n,0)}s ago`;if(n<3600)return`${Math.round(n/60)}m ago`;if(n<86400)return`${Math.round(n/3600)}h ago`;return`${Math.round(n/86400)}d ago`}function wn(e,t){if(!e)return t;let n=e.match(/data-cd-id="([^"]+)"/);if(n)return`cd:${n[1]}`;return e.length>36?`${e.slice(0,33)}…`:e}function vn(e){let t=e.selector?ke(e):null;if(t)return{x:t.x+t.w-12,y:t.y+16};if(e.bounds)return{x:e.bounds.x+e.bounds.w-12,y:e.bounds.y+16};return{x:16,y:16}}function xn(e){if(e.clientX||e.clientY)return{x:e.clientX,y:e.clientY+8};if(e.selection.selector){let t=ke(e.selection);if(t)return{x:t.x,y:t.y+t.h+8}}return{x:16,y:16}}import{useEffect as Sn}from"react";var Cn=new Set(["pen","highlighter","shape","rect","ellipse","arrow","sticky","text","section","eraser"]);function Re(e){return Cn.has(e)}var ee=(e)=>!!(e.metaKey||e.ctrlKey);function te(e){if(e.type==="keydown"){if(e.isEditable)return{kind:"no-op"};if(e.metaKey||e.ctrlKey||e.altKey){if(e.key==="Escape")return{kind:"escape"};let n=(e.key||"").toLowerCase();if(!e.altKey&&(e.metaKey||e.ctrlKey)){if(n==="z"&&e.shiftKey)return{kind:"redo"};if(n==="z")return{kind:"undo"};if(n==="y"&&!e.shiftKey)return{kind:"redo"}}return{kind:"no-op"}}let t=(e.key||"").toLowerCase();if(t==="v")return{kind:"tool",tool:"move"};if(t==="h")return{kind:"tool",tool:"hand"};if(t==="c")return{kind:"tool",tool:"comment"};if(t==="b")return{kind:"tool",tool:"pen"};if(t==="i")return{kind:"tool",tool:"highlighter"};if(t==="r"||t==="o")return{kind:"tool",tool:"shape"};if(t==="a")return{kind:"tool",tool:"arrow"};if(t==="n")return{kind:"tool",tool:"sticky"};if(t==="t")return{kind:"tool",tool:"text"};if(t==="s"&&e.shiftKey)return{kind:"tool",tool:"section"};if(t==="e")return{kind:"tool",tool:"eraser"};if(e.key==="Escape")return{kind:"escape"};return{kind:"no-op"}}if(e.type==="contextmenu")return{kind:"context-menu",clientX:e.clientX??0,clientY:e.clientY??0};if(e.type==="pointermove"){if(Re(e.activeTool))return{kind:"no-op"};if(e.activeTool==="hand")return{kind:"no-op"};if(e.activeTool==="browse"){if(!ee(e))return{kind:"no-op"};return{kind:"hover",deep:!0,clientX:e.clientX??0,clientY:e.clientY??0}}if(e.activeTool==="comment")return{kind:"hover",deep:!0,clientX:e.clientX??0,clientY:e.clientY??0};return{kind:"hover",deep:ee(e),clientX:e.clientX??0,clientY:e.clientY??0}}if(e.type==="pointerdown"){if(e.button===2)return{kind:"context-menu",clientX:e.clientX??0,clientY:e.clientY??0};if(e.button===1||e.spaceHeld)return{kind:"no-op"};if(e.button!==0)return{kind:"no-op"};if(Re(e.activeTool)&&!ee(e))return{kind:"no-op"};if(e.activeTool==="comment")return{kind:"drop-comment",clientX:e.clientX??0,clientY:e.clientY??0};if(e.activeTool==="hand")return{kind:"no-op"};if(e.activeTool==="browse"){if(!ee(e))return{kind:"no-op"};return{kind:"select",mode:e.shiftKey?"add":"replace",deep:!0,clientX:e.clientX??0,clientY:e.clientY??0}}let t=ee(e);return{kind:"select",mode:!!e.shiftKey?"add":"replace",deep:t,clientX:e.clientX??0,clientY:e.clientY??0}}return{kind:"no-op"}}function fe(e){if(!e||!e.tagName)return!1;let t=e,n=t.tagName;if(n==="INPUT"||n==="TEXTAREA"||n==="SELECT")return!0;if(t.isContentEditable)return!0;let o=t.getAttribute?.("contenteditable");if(o==="true"||o==="plaintext-only"||o==="")return!0;return!1}function ne(e){if(!e||!e.closest)return!1;let t=e;if(t.closest(".dc-world"))return!1;return!!t.closest(".cm-composer, .cm-thread, .cm-mention-popup, .cm-pin, [data-mediaref-player], .dc-tool-palette, .dc-zoom-tb, .dc-mm, .dc-context-menu")}function ht(e){if(!e||typeof e.closest!=="function")return!1;let t=e;return!!t.closest("[data-dc-screen]")&&!t.closest(".dc-artboard-body")}function pt(e,t,n){return e.kind==="select"&&!n.metaKey&&!n.ctrlKey&&ht(t)}function Tn(e,t,n){return e==="select"&&!n.metaKey&&!n.ctrlKey&&ht(t)}function gt(e){let{hostRef:t,getActiveTool:n,isSpaceHeld:o,callbacks:r,enabled:s=!0,claimableActions:a}=e;Sn(()=>{if(!s)return;let c=t.current;if(!c)return;let m=(i)=>a&&i.kind!=="no-op"&&!a.has(i.kind)?{kind:"no-op"}:i,v=(i)=>{switch(i.kind){case"hover":r.onHover?.(i);break;case"select":r.onSelect?.(i);break;case"drop-comment":r.onDropComment?.(i);break;case"context-menu":r.onContextMenu?.(i);break;case"tool":r.onTool?.(i);break;case"escape":r.onEscape?.();break;case"undo":r.onUndo?.();break;case"redo":r.onRedo?.();break;case"no-op":break}},x=(i)=>{let p=m(te({type:"pointermove",button:i.button,metaKey:i.metaKey,ctrlKey:i.ctrlKey,shiftKey:i.shiftKey,altKey:i.altKey,clientX:i.clientX,clientY:i.clientY,spaceHeld:o?.()??!1,activeTool:n()}));v(p)},f=(i)=>{if(ne(i.target))return;if(fe(i.target))return;let p=m(te({type:"pointerdown",button:i.button,metaKey:i.metaKey,ctrlKey:i.ctrlKey,shiftKey:i.shiftKey,altKey:i.altKey,clientX:i.clientX,clientY:i.clientY,spaceHeld:o?.()??!1,activeTool:n()})),E=pt(p,i.target,i);if(p.kind!=="no-op"){if(i.preventDefault(),!E)i.stopImmediatePropagation()}v(p)},u=(i)=>{if(ne(i.target))return;if(fe(i.target))return;let p=m(te({type:"pointerdown",button:i.button,metaKey:i.metaKey,ctrlKey:i.ctrlKey,shiftKey:i.shiftKey,altKey:i.altKey,clientX:i.clientX,clientY:i.clientY,spaceHeld:o?.()??!1,activeTool:n()})),E=pt(p,i.target,i);if(p.kind!=="no-op"){if(i.preventDefault(),!E)i.stopImmediatePropagation();if(p.kind==="select")try{window.focus()}catch{}}},h=(i)=>{if(ne(i.target))return;if(fe(i.target))return;let p=n(),E=i.metaKey||i.ctrlKey,g=p==="comment"?"drop-comment":p==="move"&&i.button===0?"select":(Re(p)||p==="browse")&&E&&i.button===0?"select":i.button===2?"context-menu":null;if(g&&(!a||a.has(g))){let l=Tn(g,i.target,i);if(i.preventDefault(),!l)i.stopImmediatePropagation()}},d=(i)=>{let p=m(te({type:"contextmenu",clientX:i.clientX,clientY:i.clientY,metaKey:i.metaKey,ctrlKey:i.ctrlKey,shiftKey:i.shiftKey,altKey:i.altKey,activeTool:n()}));if(p.kind==="no-op")return;i.preventDefault(),i.stopImmediatePropagation(),v(p)},w=(i)=>{let p=m(te({type:"keydown",key:i.key,metaKey:i.metaKey,ctrlKey:i.ctrlKey,shiftKey:i.shiftKey,altKey:i.altKey,isEditable:fe(i.target),activeTool:n()}));if(p.kind==="tool"||p.kind==="escape"&&!tt()||p.kind==="undo"||p.kind==="redo")i.preventDefault();v(p)};c.addEventListener("pointermove",x,{passive:!0}),c.addEventListener("pointerdown",f,{capture:!0}),c.addEventListener("mousedown",u,{capture:!0}),c.addEventListener("click",h,{capture:!0}),c.addEventListener("contextmenu",d,{capture:!0});let S=c.ownerDocument??document;return S.addEventListener("keydown",w,!0),()=>{c.removeEventListener("pointermove",x),c.removeEventListener("pointerdown",f,{capture:!0}),c.removeEventListener("mousedown",u,{capture:!0}),c.removeEventListener("click",h,{capture:!0}),c.removeEventListener("contextmenu",d,{capture:!0}),S.removeEventListener("keydown",w,!0)}},[s,t,n,o,r,a])}function Me(e,t,n,o){let r=e.elementFromPoint(t,n);if(!r)return null;if(r.closest?.(".dc-mm, .dc-zoom-tb, .dc-tool-palette, .dc-context-menu, .dc-cv-group-bbox"))return null;let s=r.closest?.("[data-dc-screen]")??null,a=s?.getAttribute("data-dc-screen")??null,c=r.closest?.(".dc-artboard-body")??null;if(!c){if(s&&a)return{el:s,cdId:null,artboardId:a};return null}if(r===c){if(s&&a)return{el:s,cdId:null,artboardId:a};return null}if(o.deep){let u=r.getAttribute?.("data-cd-id")??null;return{el:r,cdId:u,artboardId:a}}let m=r,v=null;while(m&&m!==c){if(m.hasAttribute?.("data-cd-id"))v=m;m=m.parentElement}let x=v??r,f=x.getAttribute?.("data-cd-id")??null;return{el:x,cdId:f,artboardId:a}}import{useCallback as Qn,useEffect as Ct,useRef as ge}from"react";var Ln=!1;function yt(){return Ln}import{createContext as Dn,useCallback as re,useContext as Et,useEffect as Ne,useMemo as wt,useRef as Oe,useState as pe}from"react";function U(e,t,n,o){return`url("data:image/svg+xml,${encodeURIComponent(e.trim())}") ${t} ${n}, ${o}`}var _e="width='24' height='24' viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'",Ie="#1f1f1f",Ae="stroke='#ffffff' stroke-linejoin='round' stroke-linecap='round'";function B(e,t,n){let o=n?`<g transform='${n}'>`:"";return`<svg ${_e}>${o}<path fill='#ffffff' d='${e}'/><path fill='${Ie}' d='${t}'/>${n?"</g>":""}</svg>`}var bt="translate(0,32) scale(1,-1)",kn=U(B("M10.25 8.25 L10.05 8.65 10 9 10 23.1 10.05 23.4 10.25 23.75 10.8 24 11.45 23.85 11.6 23.7 11.75 23.45 14.65 19.8 14.85 19.65 14.95 19.5 15.4 19.2 15.95 19.1 21.05 19.1 21.2 19.1 21.35 19.05 21.65 18.9 21.9 18.6 22 18.3 22 17.9 21.9 17.65 21.75 17.35 21.65 17.3 21.55 17.15 11.5 8.25 11.25 8.05 10.95 8 10.6 8.05 10.25 8.25 M9.15 6.6 L9.7 6.25 10 6.15 10.95 6 11.9 6.15 13 6.9 22.9 15.65 23 15.8 23.2 15.95 23.75 16.75 24 17.9 24 18.3 23.9 18.95 23.8 19.25 23.6 19.7 23.1 20.35 22.75 20.6 22.1 20.9 22.05 20.95 22 20.95 21.2 21.1 21.05 21.1 16.2 21.1 16.1 21.25 16.05 21.25 13.4 24.6 13.05 25.15 12.9 25.3 12.55 25.55 Q11.6 26.15 10.55 26 L10.5 26 Q9.65 25.85 9 25.3 L8.45 24.65 8.4 24.5 8.15 24.05 8 23.1 8 9 Q8 8.45 8.15 8.05 L8.25 7.75 8.45 7.35 9.15 6.6","M10.25 8.25 L10.6 8.05 10.95 8 11.25 8.05 11.5 8.25 21.55 17.15 21.65 17.3 21.75 17.35 21.9 17.65 22 17.9 22 18.3 21.9 18.6 21.65 18.9 21.35 19.05 21.2 19.1 21.05 19.1 15.95 19.1 15.4 19.2 14.95 19.5 14.85 19.65 14.65 19.8 11.75 23.45 11.6 23.7 11.45 23.85 10.8 24 10.25 23.75 10.05 23.4 10 23.1 10 9 10.05 8.65 10.25 8.25"),8,5,"default"),Rn=U(B("M28.55 17.8 Q29.4 20.3 28.75 22.8 L28.7 23 28.15 24.55 28.05 24.75 Q26.4 28.2 22.75 29.4 L22.45 29.5 18 29.9 17.75 29.85 Q15.8 29.25 13.8 28.1 L13.45 27.95 Q12 27.05 10.35 26.8 L10.25 26.75 7.9 26.7 7.8 26.7 Q6.1 26.9 4.8 25.8 L4.75 25.8 4.65 25.7 4.6 25.65 Q3.25 24.5 3.05 22.85 L3 22.75 Q2.8 20.95 4 19.5 5.05 18.15 6.75 17.95 L8.4 17.9 7.5 15.55 7.3 15.2 7.2 15 5 10.95 Q3.9 9.15 4.3 7.75 L4.4 7.5 Q4.75 6.15 6.45 5.2 9 3.65 11 5 11.05 4.1 11.5 3.45 12.15 2.1 14.2 1.6 L14.35 1.6 Q18.05 0.6 19.6 4.4 L19.65 4.55 Q20.75 3.65 22.7 3.75 L22.75 3.75 Q26.75 4 27 8.15 L27 8.25 27 8.35 27 8.45 Q26.9 10.75 27.1 12.6 27.15 14.65 28.2 16.75 L28.55 17.8 M26.65 18.4 L26.1 16.8 26.1 16.85 Q24.8 13.7 25 8.35 L25 8.25 Q24.85 5.9 22.6 5.75 20.7 5.65 20.4 7.35 L20.1 7.95 19.5 8.2 18.85 8.05 18.45 7.5 17.75 5.15 Q16.85 2.95 14.7 3.55 L14.65 3.55 Q12.55 4.05 13.15 6.15 L13.85 8.75 13.75 9.45 13.25 9.95 12.55 9.95 12 9.55 10.9 7.7 Q9.5 5.7 7.45 6.9 6.5 7.45 6.25 8.15 6.1 8.9 6.7 9.85 9.2 13.9 10.8 18.65 L10.8 19.3 10.4 19.8 9.75 19.95 Q8.35 19.8 6.95 19.95 6.1 20.05 5.55 20.75 4.9 21.55 5 22.55 5.15 23.55 6 24.2 L6.05 24.25 Q6.75 24.85 7.65 24.7 L7.7 24.7 10.65 24.8 Q12.7 25.15 14.45 26.2 L14.5 26.2 Q16.4 27.35 18.3 27.9 L22.05 27.5 22.1 27.5 Q24.95 26.55 26.25 23.85 L26.8 22.3 Q27.3 20.35 26.65 18.4","M26.65 18.4 Q27.3 20.35 26.8 22.3 L26.25 23.85 Q24.95 26.55 22.1 27.5 L22.05 27.5 18.3 27.9 Q16.4 27.35 14.5 26.2 L14.45 26.2 Q12.7 25.15 10.65 24.8 L7.7 24.7 7.65 24.7 Q6.75 24.85 6.05 24.25 L6 24.2 Q5.15 23.55 5 22.55 4.9 21.55 5.55 20.75 6.1 20.05 6.95 19.95 8.35 19.8 9.75 19.95 L10.4 19.8 10.8 19.3 10.8 18.65 Q9.2 13.9 6.7 9.85 6.1 8.9 6.25 8.15 6.5 7.45 7.45 6.9 9.5 5.7 10.9 7.7 L12 9.55 12.55 9.95 13.25 9.95 13.75 9.45 13.85 8.75 13.15 6.15 Q12.55 4.05 14.65 3.55 L14.7 3.55 Q16.85 2.95 17.75 5.15 L18.45 7.5 18.85 8.05 19.5 8.2 20.1 7.95 20.4 7.35 Q20.7 5.65 22.6 5.75 24.85 5.9 25 8.25 L25 8.35 Q24.8 13.7 26.1 16.85 L26.1 16.8 26.65 18.4"),12,12,"grab"),Mn=U(B("M28 14 Q28 9.85 24.45 6.9 20.95 4 16 4 11.05 4 7.5 6.9 L7.45 7 Q4 9.9 4 14 4 18.15 7.55 21.05 L7.5 21.05 Q9.2 22.45 11.2 23.2 L15.3 27.3 16 27.6 16.7 27.3 20.85 23.2 Q22.7 22.45 24.3 21.15 L24.45 21.05 Q28 18.15 28 14 M25.75 5.35 Q30.05 8.95 30 14 30.05 19.05 25.75 22.6 L25.4 22.85 Q23.8 24.1 22 24.9 L18.1 28.75 18.15 28.75 Q17.2 29.6 16 29.6 14.8 29.6 13.85 28.75 L13.9 28.75 10 24.9 6.6 22.85 6.25 22.6 Q1.95 19.05 2 14 1.95 8.95 6.25 5.35 10.3 2 16 2 21.7 2 25.75 5.35","M28 14 Q28 18.15 24.45 21.05 L24.3 21.15 Q22.7 22.45 20.85 23.2 L16.7 27.3 16 27.6 15.3 27.3 11.2 23.2 Q9.2 22.45 7.5 21.05 L7.55 21.05 Q4 18.15 4 14 4 9.9 7.45 7 L7.5 6.9 Q11.05 4 16 4 20.95 4 24.45 6.9 28 9.85 28 14"),12,21,"crosshair"),An=U(B("M4 13.1 L4 6 Q4 5.15 4.6 4.6 5.15 4 6 4 L13.1 4 Q13.95 4 14.55 4.6 L28.65 18.75 Q29.8 19.9 29.75 21.45 L29.75 21.6 29.75 21.7 Q29.75 23.2 28.7 24.35 L24.45 28.65 24.35 28.75 Q23.15 29.85 21.65 29.8 L21.55 29.8 21.4 29.8 Q20.2 29.8 19.25 29.15 L18 29.35 Q16.6 29.4 15.25 28 L15.2 27.95 8.2 20.95 Q7.6 20.35 7.6 19.55 7.6 18.7 8.2 18.1 L4.6 14.5 Q4 13.9 4 13.1 M19.5 26.65 L20.1 27.25 Q20.7 27.85 21.5 27.8 22.35 27.85 23 27.25 L27.25 22.95 Q27.8 22.35 27.75 21.55 27.8 20.75 27.2 20.15 L13.1 6 6 6 6 13.1 12.35 19.45 9.6 19.5 16.65 26.55 Q18.05 28.05 19.5 26.65 M8.05 12.3 L8 8 12.25 8.05 13.8 9.6 9.6 13.85 8.05 12.3 M15.25 11.05 L23 18.8 18.8 23.05 11.05 15.3 15.25 11.05","M15.25 11.05 L11.05 15.3 18.8 23.05 23 18.8 15.25 11.05 M12.35 19.45 L6 13.1 6 6 13.1 6 27.2 20.15 Q27.8 20.75 27.75 21.55 27.8 22.35 27.25 22.95 L23 27.25 Q22.35 27.85 21.5 27.8 20.7 27.85 20.1 27.25 L19.5 26.65 12.35 19.45 M8.05 12.3 L9.6 13.85 13.8 9.6 12.25 8.05 8 8 8.05 12.3",bt),6,18,"crosshair"),_n=U(B("M5.15 10.85 Q4 9.65 4 8.1 L4 7.95 4 7.85 Q3.95 6.2 5.1 5.15 6.25 4 7.85 4 L7.95 4 8.1 4 Q9.65 4 10.85 5.15 L11 5.3 14.3 5.25 Q15.15 5.25 15.75 5.85 L29.9 20 Q31 21.15 31 22.75 L31 22.85 31 23 Q31.05 24.5 29.9 25.7 L29.55 25.95 25.65 29.9 25.65 29.95 Q24.45 31.1 22.75 31.1 21.2 31.15 20 29.95 L5.85 15.8 Q5.25 15.2 5.25 14.35 L5.25 10.95 5.15 10.85 M19.95 24.2 L18.55 22.8 22.8 18.55 24.2 19.95 19.95 24.2 M28.45 21.4 L14.3 7.25 10.15 7.3 9.4 6.55 Q8.8 5.95 7.95 6 7.1 5.95 6.5 6.55 5.95 7.1 6 7.95 5.95 8.8 6.55 9.4 L7.25 10.1 7.25 14.35 21.4 28.5 Q22 29.1 22.75 29.1 23.6 29.1 24.2 28.5 L28.45 24.25 Q29.05 23.65 29 22.85 29.05 22 28.45 21.4 M9.25 13.5 L9.25 9.3 13.5 9.25 14.3 10.05 10.05 14.3 9.25 13.5 M17.15 21.4 L11.5 15.75 15.75 11.5 21.4 17.15 17.15 21.4","M17.15 21.4 L21.4 17.15 15.75 11.5 11.5 15.75 17.15 21.4 M28.45 21.4 Q29.05 22 29 22.85 29.05 23.65 28.45 24.25 L24.2 28.5 Q23.6 29.1 22.75 29.1 22 29.1 21.4 28.5 L7.25 14.35 7.25 10.1 6.55 9.4 Q5.95 8.8 6 7.95 5.95 7.1 6.5 6.55 7.1 5.95 7.95 6 8.8 5.95 9.4 6.55 L10.15 7.3 14.3 7.25 28.45 21.4 M19.95 24.2 L24.2 19.95 22.8 18.55 18.55 22.8 19.95 24.2 M9.25 13.5 L10.05 14.3 14.3 10.05 13.5 9.25 9.25 9.3 9.25 13.5",bt),6,18,"crosshair"),oe=U(B("M17 2 Q18.2 2 19.15 2.9 20 3.8 20 5 L20 12 27 12 Q28.2 12 29.15 12.9 30 13.8 30 15 L30 17 Q30 18.2 29.15 19.15 28.2 20 27 20 L20 20 20 27 Q20 28.2 19.15 29.15 18.2 30 17 30 L15 30 Q13.8 30 12.9 29.15 12 28.2 12 27 L12 20 5 20 Q3.8 20 2.9 19.15 2 18.2 2 17 L2 15 Q2 13.8 2.9 12.9 3.8 12 5 12 L12 12 12 5 Q12 3.8 12.9 2.9 13.8 2 15 2 L17 2 M14 27 L14.3 27.7 Q14.6 28 15 28 L17 28 17.7 27.7 18 27 18 18.05 18.05 18 27 18 Q27.4 18 27.7 17.7 L28 17 28 15 27.7 14.3 Q27.4 14 27 14 L18 14 18 5 17.7 4.3 17 4 15 4 Q14.6 4 14.3 4.3 14 4.6 14 5 L14 14 5 14 Q4.6 14 4.3 14.3 4 14.6 4 15 L4 17 Q4 17.4 4.3 17.7 4.6 18 5 18 L14 18 14 27","M14 27 L14 18 5 18 Q4.6 18 4.3 17.7 4 17.4 4 17 L4 15 Q4 14.6 4.3 14.3 4.6 14 5 14 L14 14 14 5 Q14 4.6 14.3 4.3 14.6 4 15 4 L17 4 17.7 4.3 18 5 18 14 27 14 Q27.4 14 27.7 14.3 L28 15 28 17 27.7 17.7 Q27.4 18 27 18 L18.05 18 18 18.05 18 27 17.7 27.7 17 28 15 28 Q14.6 28 14.3 27.7 L14 27"),12,12,"crosshair"),In=U(B("M3.9 11.35 Q2.3 12.5 3.7 13.9 L16.4 26.65 Q17.85 28.05 19.45 26.9 L27.65 21.15 Q29.3 20 27.85 18.6 L15.15 5.85 Q13.75 4.45 12.1 5.6 L3.9 11.35 M1.05 12.4 Q1 10.95 2.75 9.75 L10.95 4 10.95 3.95 Q14 1.85 16.6 4.45 L29.3 17.2 Q30.8 18.65 30.55 20.1 30.55 21.55 28.8 22.8 L20.6 28.55 20.65 28.55 Q17.7 30.65 15 28.1 L15 28.05 2.3 15.3 2.3 15.35 Q0.8 13.85 1.05 12.4 M13.5 7 L19.85 13.35 11.65 19.15 5.3 12.75 13.5 7","M13.5 7 L5.3 12.75 11.65 19.15 19.85 13.35 13.5 7 M3.9 11.35 L12.1 5.6 Q13.75 4.45 15.15 5.85 L27.85 18.6 Q29.3 20 27.65 21.15 L19.45 26.9 Q17.85 28.05 16.4 26.65 L3.7 13.9 Q2.3 12.5 3.9 11.35"),6,14,"cell"),Nn=U(`<svg ${_e}><path d='M16 4V28M11 4H21M11 28H21' fill='none' ${Ae} stroke-width='5'/><path d='M16 4V28M11 4H21M11 28H21' fill='none' stroke='${Ie}' stroke-width='2.25' stroke-linecap='round'/></svg>`,12,12,"text"),On=U(`<svg ${_e}><path d='M6 5H21L26 10V27H6Z' fill='${Ie}' ${Ae} stroke-width='2.5'/><path d='M21 5V11H26' fill='none' ${Ae} stroke-width='2.25'/></svg>`,5,5,"crosshair"),O=Object.freeze({browse:"default",move:kn,hand:Rn,comment:Mn,pen:An,section:oe,highlighter:_n,shape:oe,rect:oe,ellipse:oe,sticky:On,arrow:oe,text:Nn,eraser:In});import{jsx as He,Fragment as $n}from"react/jsx-runtime";var De="maude:tool-sync",vt=Object.freeze({preview:"browse",edit:"move"});function xt(e){if(e==="browse")return"preview";if(e==="move")return"edit";return null}var Hn=Object.freeze([{id:"browse",label:"Browse",shortcut:"",cursor:O.browse},{id:"move",label:"Select",shortcut:"V",cursor:O.move},{id:"hand",label:"Hand",shortcut:"H",cursor:O.hand},{id:"comment",label:"Comment",shortcut:"C",cursor:O.comment},{id:"pen",label:"Pen",shortcut:"B",cursor:O.pen},{id:"highlighter",label:"Highlighter",shortcut:"I",cursor:O.highlighter},{id:"shape",label:"Shape",shortcut:"R",cursor:O.shape},{id:"sticky",label:"Sticky",shortcut:"N",cursor:O.sticky},{id:"section",label:"Section",shortcut:"⇧S",cursor:O.shape},{id:"arrow",label:"Arrow",shortcut:"A",cursor:O.arrow},{id:"text",label:"Text",shortcut:"T",cursor:O.text},{id:"eraser",label:"Eraser",shortcut:"E",cursor:O.eraser}]),Pn=new Set(["browse","move","hand"]);function zn(e,t){return t?e.filter((n)=>Pn.has(n.id)):e}var Pe=Dn(null);function Kn({children:e,tools:t=Hn,initial:n,initialMode:o}){let r=G(),s=wt(()=>zn(t,r),[t,r]),a=n??(r?"browse":"move"),c=o??xt(a)??(r?"preview":"edit"),[m,v]=pe(a),[x,f]=pe(c),[u,h]=pe(()=>({tool:null,locked:!1})),d=re((C)=>{if(!s.some((L)=>L.id===C))return;v(C);let k=xt(C);if(k)f(k);h((L)=>L.locked&&L.tool===C?L:{tool:null,locked:!1})},[s]),w=re((C)=>{let k=vt[C];if(!s.some((L)=>L.id===k))return;f(C),v(k),h((L)=>L.locked&&L.tool===k?L:{tool:null,locked:!1})},[s]),S=re(()=>{d(vt[x])},[x,d]),i=re((C)=>{h((k)=>{if(k.locked&&k.tool===C)return{tool:null,locked:!1};return{tool:C,locked:!0}}),v(C)},[]),p=re(()=>{h({tool:null,locked:!1})},[]),[E,g]=pe("rounded"),l=Oe(Math.random().toString(36).slice(2)),y=Oe(m);y.current=m;let T=Oe(!1);Ne(()=>{if(!T.current){T.current=!0;return}if(typeof document>"u")return;document.dispatchEvent(new CustomEvent(De,{detail:{tool:m,from:l.current}}))},[m]),Ne(()=>{if(typeof document>"u")return;let C=(k)=>{let L=k.detail;if(!L||L.from===l.current||typeof L.tool!=="string")return;if(L.tool===y.current)return;d(L.tool)};return document.addEventListener(De,C),()=>document.removeEventListener(De,C)},[d]),Ne(()=>{if(typeof document>"u")return;let C=s.find((M)=>M.id===m);if(!C)return;let k=document.body.style.cursor,L=document.getElementById("dc-tool-cursor");if(!L)L=document.createElement("style"),L.id="dc-tool-cursor",document.head.appendChild(L);if(m==="browse"){if(document.body.style.cursor="",L.textContent="",typeof window<"u"&&window.parent&&window.parent!==window)try{window.parent.postMessage({dgn:"tool-cursor",tool:m},"*")}catch{}return()=>{document.body.style.cursor=k}}if(document.body.style.cursor=C.cursor,L.textContent=`* { cursor: ${C.cursor} !important; }`,typeof window<"u"&&window.parent&&window.parent!==window)try{window.parent.postMessage({dgn:"tool-cursor",tool:m},"*")}catch{}return()=>{document.body.style.cursor=k;let M=document.getElementById("dc-tool-cursor");if(M)M.textContent=""}},[m,s]);let b=wt(()=>({tool:m,setTool:d,tools:s,mode:x,setMode:w,resetTool:S,sticky:u,toggleSticky:i,clearSticky:p,shapeKind:E,setShapeKind:g}),[m,d,s,x,w,S,u,i,p,E]);return He(Pe.Provider,{value:b,children:e})}function St({children:e,initial:t,initialMode:n}){if(Et(Pe))return He($n,{children:e});return He(Kn,{initial:t,initialMode:n,children:e})}function he(){let e=Et(Pe);if(!e)throw Error("useToolMode must be used inside <ToolProvider>");return e}import{jsx as Jn}from"react/jsx-runtime";var Fn=`
1
+ import{Component as Xc,createElement as Jn,useCallback as Gn,useEffect as ye,useMemo as Qc,useRef as we,useState as Ze}from"react";import{createRoot as Yc}from"react-dom/client";function Os(e,t){if(e==="present")return t?.kind==="artboards"?"present-artboards":"present-canvas";return e}var fe=(e,t,n,o,r)=>Object.freeze({edit:e,preview:t,"present-artboards":n,"present-canvas":o,viewing:r}),Ns=Object.freeze({clicks:fe("tool","live","next-artboard","pan-zoom","specs"),toolbar:fe("edit","preview","none","none","viewing"),annotations:fe("quiet","drawn","hidden","hidden","read-only"),"comment-pins":fe("shown","shown","hidden","hidden","shown"),measure:fe("on","on","off","off","on"),"ai-changes":fe("live","live","held","live-unmarked","live"),"left-panels":fe("shown","folded","hidden","hidden","shown"),"ai-panel":fe("shown","folded","hidden","hidden","none"),"share-cluster":fe("full","full","hidden","hidden","full-access"),inspect:fe("inspector","panel-on-cmd-click","hidden","hidden","panel-on-click"),"project-menu":fe("pill","pill","esc-first","esc-first","pill"),esc:fe("steps-back","steps-back","settles-back","same-view","deselect")});function Ne(e,t,n){return Ns[e][Os(t,n)]}var Ds=Object.freeze({measure:(e,t)=>Ne("measure",e,t)==="on","inspect-panel":(e,t)=>Ne("inspect",e,t).startsWith("panel"),"comment-pins":(e,t)=>Ne("comment-pins",e,t)==="shown","object-tools":(e,t)=>Ne("clicks",e,t)==="tool","live-design":(e,t)=>Ne("clicks",e,t)==="live","annotations-editable":(e,t)=>Ne("annotations",e,t)==="drawn",chrome:(e,t)=>Ne("share-cluster",e,t)!=="hidden"});function pt(e,t,n){if(!e)return t==="measure"||t==="comment-pins"||t==="object-tools";return Ds[t](e,n)}var Bt=["edit","viewing","preview","present"],oo=["artboards","canvas"],Xt=["browse","move","hand","comment","pen","highlighter","eraser","shape","sticky","section","arrow","text"],Ks=["inspect","frame","el-shape","el-pen","el-text","image","component","line","ellipse","polygon","crop","slice","pointer"],Qt=[...Xt,...Ks],md=new Set(Bt),zs=new Set(Qt);var Vs=(e)=>typeof e==="string"&&zs.has(e),fd=Object.freeze({edit:!1,annotate:!1,comment:!1}),ro=Object.freeze({edit:!0,annotate:!0,comment:!0}),so=(e)=>e.edit?"edit":"viewing";function io(e,t){if(e==="edit"&&!t.edit)return"viewing";if(e==="viewing"&&t.edit)return"edit";return e}var ao=Object.freeze({edit:"edit",viewing:"edit",preview:"preview",present:"preview"}),Yt=Object.freeze({edit:"move",viewing:"inspect",preview:"browse",present:"browse"}),to=Object.freeze({view:0,comment:1,edit:2});function Hs(e){if(e.edit||e.annotate)return"edit";return e.comment?"comment":"view"}var J=(e)=>Object.freeze(e),Je=Object.freeze({edit:Object.freeze({rest:"move",slots:Object.freeze([J({key:"V",label:"Select",tool:"move",minRole:"edit"}),J({key:"H",label:"Hand",tool:"hand",minRole:"edit"}),J({key:"F",label:"Artboard / Frame",tool:"frame",minRole:"edit"}),J({key:"R",label:"Shape",tool:"el-shape",minRole:"edit"}),J({key:"P",label:"Pen",tool:"el-pen",minRole:"edit"}),J({key:"T",label:"Text",tool:"el-text",minRole:"edit"}),J({key:"I",label:"Image",tool:"image",minRole:"edit",panel:"image",panelFirst:!0}),J({key:"⇧I",label:"Component",tool:null,minRole:"edit",panel:"components"}),J({key:"",label:"More",tool:null,minRole:"edit",popover:"more",more:Object.freeze([J({key:"",label:"Line",tool:"line",minRole:"edit"}),J({key:"",label:"Ellipse",tool:"ellipse",minRole:"edit"}),J({key:"",label:"Polygon",tool:"polygon",minRole:"edit"}),J({key:"",label:"Crop",tool:"crop",minRole:"edit"}),J({key:"",label:"Export area",tool:"slice",minRole:"edit"})])})])}),preview:Object.freeze({rest:"browse",slots:Object.freeze([J({key:"V",label:"Select",tool:"browse",minRole:"view"}),J({key:"H",label:"Hand",tool:"hand",minRole:"view"}),J({key:"N",label:"Sticky",tool:"sticky",minRole:"edit",popover:"sticky-colours"}),J({key:"C",label:"Comment",tool:"comment",minRole:"comment"}),J({key:"M",label:"Marker",tool:"pen",minRole:"edit",popover:"marker-tips",tips:["pen","highlighter","eraser"]}),J({key:"A",label:"Arrow",tool:"arrow",minRole:"edit"}),J({key:"R",label:"Shape",tool:"shape",minRole:"edit",popover:"shape-kinds"}),J({key:"T",label:"Text",tool:"text",minRole:"edit"}),J({key:"E",label:"Stickers",tool:null,minRole:"edit",panel:"stickers"}),J({key:"S",label:"Section",tool:"section",minRole:"edit",panel:"templates"})])}),viewing:Object.freeze({rest:"inspect",slots:Object.freeze([J({key:"H",label:"Hand",tool:"inspect",minRole:"view"}),J({key:"C",label:"Comment",tool:"comment",minRole:"comment"})])}),present:Object.freeze({rest:"browse",hidden:!0,slots:Object.freeze([J({key:"L",label:"Pointer",tool:"pointer",minRole:"view"})])})}),Gt=Object.freeze({});function lo(e,t){if(t(e))return e;let n=Gt[e];return n&&t(n)?n:null}var Fs=Object.freeze({edit:["preview"],preview:["edit"],viewing:["preview","edit"],present:[]});function $s(e,t){for(let n of[e,...Fs[e]]){let o=Je[n].slots.find((r)=>r.key===t);if(o)return{mode:n,slot:o}}return null}function co(e,t,n,o){let r=$s(e,t);if(!r||r.slot.pending)return null;let{slot:s}=r,a=!!s.panel&&(s.tool===null||!!s.panelFirst),c=s.insert||s.panelFirst?null:s.tips&&o&&s.tips.includes(o)?o:s.tool,p=Hs(n);if(to[p]<to[s.minRole]||r.mode==="edit"&&!n.edit){if(c)return{kind:"deny",mode:r.mode,tool:c};return a&&s.panel?{kind:"deny",mode:r.mode,panel:s.panel}:{kind:"deny",mode:r.mode}}if(r.mode!==e){let f={kind:"request",mode:r.mode};if(c)f.tool=c;if(a&&s.panel)f.panel=s.panel;return f}if(s.insert)return{kind:"insert",insert:s.insert};if(c)return{kind:"arm",tool:c};return s.panel?{kind:"panel",panel:s.panel}:null}var qs=new Set(["hand"]);function no(e,t){return Je[e].slots.some((n)=>n.tool===t||n.tool!==null&&Gt[n.tool]===t||!!n.tips?.includes(t)||!!n.lights?.includes(t)||!!n.more?.some((o)=>o.tool===t))}function et(e,t,n){if(!Vs(e)||qs.has(e))return null;if(no(n,e))return n;if(e==="move")return t.edit?"edit":"viewing";for(let o of["preview","edit"])if(no(o,e))return o;return null}function Zt(e,t){if(e==="present")return"back";let n=Je[e].rest;if(t!==n&&Gt[n]!==t)return"rest";return"stay"}var Jt=Object.freeze({top:0,right:0,bottom:0,left:0});function uo(e,t,n){let o=e-n.left-n.right,r=t-n.top-n.bottom,s=o>=240,a=r>=240;return{x:s?n.left:0,y:a?n.top:0,w:s?o:e,h:a?r:t}}function po(e){if(!e||typeof e!=="object"||Array.isArray(e))return null;let t=e,n={top:0,right:0,bottom:0,left:0};for(let o of["top","right","bottom","left"]){let r=t[o];if(typeof r!=="number"||!Number.isFinite(r)||r<0||r>8192)return null;n[o]=Math.round(r)}return n}var js=["image/png","image/jpeg","image/gif","image/webp"],Us=new Set(["dgn","v","text","html","image"]),mo=(e)=>typeof e==="string"&&e.length<=1e6,Ws=(e)=>typeof Blob<"u"&&e instanceof Blob&&js.includes(e.type)&&e.size>0&&e.size<=20971520;function fo(e){if(!e||typeof e!=="object"||Array.isArray(e))return null;let t=e;for(let o of Object.keys(t))if(!Us.has(o))return null;if(t.v!==1)return null;let n={v:1};if(t.text!==void 0){if(!mo(t.text))return null;n.text=t.text}if(t.html!==void 0){if(!mo(t.html))return null;n.html=t.html}if(t.image!==void 0){if(!Ws(t.image))return null;n.image=t.image}return n.text||n.html||n.image?n:null}var Bs=/^data:image\/(?:png|webp|jpeg|gif);base64,[A-Za-z0-9+/]+={0,2}$/;function go(e){return typeof e==="string"&&e.length<=400000&&Bs.test(e)}var Xs=["frame","text","image","path","shape","instance","artboard","multi"],v=Symbol("dgn.bad"),bt=4000,He=1e4,Qs=16,be=(e)=>!!e&&typeof e==="object"&&!Array.isArray(e),u=(e)=>typeof e==="string"&&e.length<=bt?e:v,C=(e)=>typeof e==="number"&&Number.isFinite(e)?e:v,Ys=(e)=>typeof e==="number"&&Number.isFinite(e)&&e>=0&&e<=1?e:v,P=(e)=>typeof e==="boolean"?e:v,Gs=(e)=>go(e)?e:v,ho=(e)=>typeof e==="number"&&Number.isFinite(e)&&e>=0&&e<=86400?e:v,Zs=(e)=>{if(!Array.isArray(e)||e.length>8)return v;for(let t of e)if(typeof t!=="string"||t.length>400)return v;return[...e]},U=(...e)=>(t)=>e.includes(t)?t:v,d=(e)=>(t)=>t===void 0?void 0:e(t),Js=(e)=>typeof e==="string"&&e.length<=48&&/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/.test(e)&&!/^[0-9a-f]{8}$/.test(e)?e:v,Ke=(e)=>typeof e==="string"&&/^[A-Za-z0-9_-]{1,64}$/.test(e)?e:v,_=(e)=>(t)=>t===null?null:e(t),H=(e)=>(t)=>{if(!Array.isArray(t)||t.length>He)return v;let n=[];for(let o of t){let r=e(o);if(r===v)return v;n.push(r)}return n},ge=(e)=>nn(e,0);function nn(e,t){if(e===null||typeof e==="boolean")return e;if(typeof e==="number")return Number.isFinite(e)?e:v;if(typeof e==="string")return e.length<=bt?e:v;if(t>=Qs||typeof e!=="object")return v;if(Array.isArray(e)){if(e.length>He)return v;let r=[];for(let s of e){let a=nn(s,t+1);if(a===v)return v;r.push(a)}return r}let n={},o=0;for(let r of Object.keys(e)){if(++o>He||r.length>bt)return v;let s=nn(e[r],t+1);if(s===v)return v;if(s!==void 0)n[r]=s}return n}var se=(e)=>be(e)?ge(e):v,bo=(e)=>{if(!be(e))return v;let t={},n=Object.keys(e);if(n.length>He)return v;for(let o of n){let r=u(e[o]);if(r===v||o.length>bt)return v;t[o]=r}return t},ei=256,mt=(e,t=ei)=>(n)=>{if(!be(n))return v;let o=Object.keys(n);if(o.length>t)return v;let r=Object.create(null);for(let s of o){if(s.length>200||s==="__proto__"||s==="constructor"||s==="prototype")return v;let a=e(n[s]);if(a===v)return v;r[s]=a}return r},ft=(e)=>typeof e==="string"&&/^[A-Za-z0-9_-]{1,64}$/.test(e)?e:v,q=(e)=>(t)=>typeof t==="string"&&t.length<=e?t:v,ti=(e)=>typeof e==="string"&&/^[A-Z][A-Za-z0-9]{0,63}$/.test(e)?e:v,yo=(e)=>typeof e==="string"&&/^[a-z][a-z0-9-]{0,40}$/.test(e)?e:v,gt=(e)=>typeof e==="number"&&Number.isSafeInteger(e)&&e>=0&&e<=9999?e:v,X=(e)=>(t)=>{if(!be(t))return v;let n={};for(let o of Object.keys(e)){let r=e[o](t[o]);if(r===v)return v;if(r!==void 0)n[o]=r}return n},de=(e,t)=>(n)=>typeof n==="number"&&Number.isInteger(n)&&n>=e&&n<=t?n:v,on=(e)=>typeof e==="string"&&/^[\w-]{1,64}$/.test(e)?e:v,De=X({x:C,y:C,w:C,h:C}),ni=512,ko=(e)=>{if(typeof e!=="string"||e.length<5||e.length>ni)return v;if(/[\u0000-\u001f\u007f]/.test(e)||e.split("|").length<3)return v;return e},oi=(e)=>{if(!Array.isArray(e)||e.length>Ro)return v;let t=X({clientID:de(0,Number.MAX_SAFE_INTEGER),name:(o)=>typeof o==="string"&&o.length<=Co?o:v,artboardId:Ke,frame:d(de(0,1e7)),word:d(ko)}),n=[];for(let o of e){if(!be(o))return v;let r=t(o);if(r===v)return v;n.push(r)}return n},en=(e)=>typeof e==="string"&&/^#[0-9a-fA-F]{6}([0-9a-fA-F]{2})?$/.test(e)?e:v,So=X({stickyColor:d(en),ink:d(en),thickness:d(U(3,6)),tip:d(U("pen","highlighter","eraser")),highlighterColor:d(en),highlighterWidth:d(de(1,64))}),ht=U(...Bt),rn=U(...Qt),sn=X({kind:U(...oo),from:d(u),only:d(U("formats"))}),ri=X({edit:P,annotate:P,comment:P,present:d(P)}),si=/^[a-z0-9]{8,32}$/,an=(e)=>typeof e==="string"&&si.test(e)?e:v,ii=64,ai=(e)=>typeof e==="string"&&e.length<=ii?e:v,li=(e)=>po(e)??v,ci=/^(?!\/)(?!.*\.\.)[A-Za-z0-9_][A-Za-z0-9 ._/-]{0,255}\.css$/,yt=(e)=>typeof e==="string"&&ci.test(e)?e:v,di=/^(?:head|[0-9a-f]{64})$/,Eo=16,To=(e)=>typeof e==="string"&&di.test(e)?e:v,ui=(e)=>Array.isArray(e)&&e.length<=Eo?H(To)(e):v,pi=200,mi=/^[A-Za-z0-9_.:-]{1,128}$/,wt=(e)=>typeof e==="string"&&mi.test(e)?e:v,fi=(e)=>Array.isArray(e)&&e.length<=pi?H(wt)(e):v,gi=U("light","dark"),hi=200,bi=/^--[A-Za-z0-9_-]{1,128}$/,yi=(e)=>typeof e==="string"&&bi.test(e)?e:v,wo=(e)=>Array.isArray(e)&&e.length<=hi?H(yi)(e):v,wi=["brand","colour","type","space","motion","components","patterns"],vi=U("waiting","drawing","done"),xi=(e)=>{if(!be(e))return v;let t={};for(let n of Object.keys(e)){if(!wi.includes(n))return v;let o=vi(e[n]);if(o===v)return v;t[n]=o}return t},Mo=500,ki=(e)=>Array.isArray(e)&&e.length<=Mo?H(wt)(e):v,Ao=de(0,1e6),Si=(e)=>e===null||wt(e)!==v?e:v,Ei=(e)=>Array.isArray(e)&&e.length<=Mo?H(X({id:wt,x:C,y:C,w:C,h:C}))(e):v,Ti=X({tokens:yt,components:_(yt)}),Mi=(e)=>{if(!be(e))return v;let t=Object.keys(e);if(t.length>Eo)return v;let n=Object.create(null);for(let o of t){if(To(o)===v)return v;let r=Ti(e[o]);if(r===v)return v;n[o]=r}return n},Ai=(e)=>typeof e==="string"&&/^[A-Za-z_][\w-]{0,63}$/.test(e)?e:v,Ri=2000,Ci=X({id:q(200),label:q(200),x:C,y:C,w:C,h:C}),Ii=(e)=>Array.isArray(e)&&e.length<=Ri?H(Ci)(e):v,Pi=500,Ro=32,Co=64,_i=/^(#[0-9a-f]{3,8}|oklch\([0-9.%\s/-]{1,40}\))$/i,Li=/^[A-Za-z0-9_-]{1,64}$/,Oi=["owner","member","viewer","observer"],Ni=(e)=>{if(!Array.isArray(e)||e.length>Ro)return v;let t=[];for(let n of e){if(!be(n))return v;let{clientID:o,name:r,color:s,following:a,artboard:c,idleSince:p,surface:f,inComments:x,role:g}=n;if(typeof o!=="number"||!Number.isSafeInteger(o)||o<0)return v;if(typeof r!=="string"||r.length>Co)return v;if(s!==void 0&&(typeof s!=="string"||!_i.test(s)))return v;if(a!==void 0&&typeof a!=="boolean")return v;if(c!==void 0&&(typeof c!=="string"||!Li.test(c)))return v;if(p!==void 0&&(typeof p!=="number"||!Number.isSafeInteger(p)||p<=0))return v;if(f!==void 0&&f!=="browser")return v;if(x!==void 0&&typeof x!=="boolean")return v;let w={clientID:o,name:r};if(s!==void 0)w.color=s;if(a===!0)w.following=!0;if(c!==void 0)w.artboard=c;if(p!==void 0)w.idleSince=p;if(f==="browser")w.surface="browser";if(x===!0)w.inComments=!0;if(Oi.includes(g))w.role=g;t.push(w)}return t},Di=120,Ki=256,je=(e)=>typeof e==="string"&&e.length<=Di?e:v,zi=(e)=>Array.isArray(e)&&e.length<=Ki?H(X({artboard:je,element:je,occurrence:d((t)=>typeof t==="number"&&Number.isInteger(t)&&t>=0&&t<1e4?t:v),tag:je,mine:P,scope:d(P),point:d(P)}))(e):v,Vi=8,Hi=40,tn="[A-Za-z0-9_.:-]{1,128}",Fi=new RegExp(`^(?:ab:${tn}|el:${tn}/${tn})$`),$i=20,qi=(e)=>Array.isArray(e)&&e.length<=$i?H(X({from:on,to:on}))(e):v,ji=(e)=>Array.isArray(e)&&e.length<=Vi?H(X({ref:(t)=>typeof t==="string"&&Fi.test(t)?t:v,tag:(t)=>typeof t==="string"&&t.length<=Hi?t:v}))(e):v,Ui=["add","reply","resolve","reopen","edit-own","delete-own"],Wi=["to-sticky","convert-undo","convert-undoable"],tt=(e)=>typeof e==="string"&&e.length>0&&e.length<=64||typeof e==="number"&&Number.isSafeInteger(e)?e:v,Bi=(e)=>{if(!be(e))return v;if(Wi.includes(e.op))return typeof e.commentId==="string"&&/^[A-Za-z0-9_]{1,64}$/.test(e.commentId)?{op:e.op,commentId:e.commentId}:v;if(!Ui.includes(e.op))return v;return ge(e)},Xi=X({id:q(200),name:q(120),role:d(q(40))}),Qi=256,Yi=64,Gi=X({name:_((e)=>typeof e==="string"&&e.length<=Yi&&!e.includes("@")?e:v),kind:_(U("mac","pc","linux")),self:P}),Zi=X({rel:q(512),state:U("here","uploading","waiting","missing"),who:d(Gi),syncing:d(P),progress:d(Ys)}),Ji=(e)=>Array.isArray(e)&&e.length<=Qi?H(Zi)(e):v,ea=256,ta=/^assets\/[0-9a-f]{8}\.[A-Za-z0-9]{1,8}$/,na=(e)=>Array.isArray(e)&&e.length<=ea&&e.every((t)=>typeof t==="string"&&ta.test(t))?e.slice():v;function l(e){let t=X(e);return(n)=>{let o=t(n);return o===v?null:o}}var ue=(e)=>be(e)?{}:null,vo={refId:d(u),refIndex:d(C),artboardId:d(_(u)),position:d(u)},xe={id:d(u)},Ve=X({artboard:u,element:u,occurrence:d(C)}),oa=X({kind:U("picture","frame","artboard"),artboard:q(200),element:d(q(200)),occurrence:d(de(1,He))}),ze=(e,t)=>(n)=>Array.isArray(n)&&n.length<=e?t(n):v,ra=X({id:d(q(128)),tag:d(q(24)),text:d(q(160)),selector:d(q(200)),index:d(C)}),sa=X({label:u,ref:_(Ve)}),ia=["held-by-ai","locked","stale","invalid","forbidden"],V="h/use-canvas-bridge",ae="canvas-shell",ln={loaded:{gate:"any",status:"live",owner:V,parse:l({file:u})},"canvas-rendered":{gate:"active",status:"live",owner:V,parse:l({file:u})},"canvas-failed":{gate:"active",status:"live",owner:V,parse:l({file:u})},"canvas-mounted":{gate:"any",status:"legacy",owner:"tpl/_shell.html (probe)",orphan:"no-handler",parse:l({file:u,children:C})},"render-error":{gate:"frame",status:"live",owner:"v2/create/use-render-error",parse:l({file:u,message:q(600)})},"render-ok":{gate:"frame",status:"live",owner:"v2/create/use-render-error",parse:l({file:u})},"ds-review":{gate:"active",status:"live",owner:"h/use-ds-frames",parse:ue},"ds-rects-result":{gate:"frame",status:"live",owner:"v2/ds/reach-view",parse:l({seq:Ao,view:X({w:C,h:C}),label:d(q(120)),rects:Ei})},"ds-pins-want":{gate:"active",status:"live",owner:"v2/ds/pins",parse:l({revs:ui})},"canvas-expired":{gate:"frame",status:"live",owner:"h/use-shell-core",parse:ue},"annotations-changed":{gate:"active",status:"live",orphan:"no-handler",owner:"annotations-layer (S4.9) → annotation-list (S4.17)",parse:l({file:u})},"annotation-to-comment":{gate:"active",status:"live",owner:"annotations-layer (S4.12) → shell convert (routes/annotations.ts, S4.7)",parse:l({id:ft})},"annotation-selection":{gate:"active",status:"live",owner:"annotations-layer (S4.12) → AI scope chip (S4.15, S5.8)",parse:l({ids:ze(500,H(ft)),kinds:mt(gt,16),artboards:ze(200,H(q(128)))})},"annotation-toast":{gate:"active",status:"live",owner:"annotations-layer (S4.12) → shell toast",parse:l({v:U(1),message:q(300),undo:P})},"annotation-ask-ai":{gate:"active",status:"live",owner:"annotations-layer (S4.12) → shell AI chat",parse:l({v:U(1)})},"object-history":{gate:"active",status:"live",owner:"editing/object-menu.tsx + annotations-layer (sticky menu) → shell history.object",parse:l({artboard:d(Ke),element:d(q(128)),annotation:d(ft)})},"view-only-gesture":{gate:"active",status:"live",owner:"view-only-gesture (S9.21b) → shell access host tip",parse:l({v:U(1),x:d(de(0,16384)),y:d(de(0,16384))})},"vote-cast":{gate:"active",status:"live",owner:"annotations/ui/vote-dots (S4.14) → shell vote store (routes/votes.ts)",parse:l({artboard:Ke,remove:d(P)})},"vote-board":{gate:"active",status:"live",owner:"annotations/ui/vote-dots + editing/artboard-menu (S4.14) → shell vote sheet",parse:l({artboards:ze(200,H(X({id:Ke,label:q(120),x:C,y:C,w:C,h:C}))),open:d(P),focus:d(Ke)})},"annotations-visibility":{gate:"active",status:"live",owner:"annotations-layer ⇧P (S4.18) → shell use-photo-and-timeline",parse:l({v:U(1),visible:P})},"canvas-notice":{gate:"active",status:"live",owner:"canvas-notice-message",parse:l({message:u,kind:U("info","success","error","warning","undo")})},"embed-escape":{gate:"active",status:"live",owner:"c/embed-view",parse:ue},"select-set":{gate:"active",status:"live",owner:V,parse:l({selection:_((e)=>Array.isArray(e)?H(se)(e):se(e)),refs:d(H(Ve)),crumbs:d(H(sa)),kind:d(U(...Xs))})},"edit-text":{gate:"active",status:"live",owner:V,parse:l({id:u,file:u,text:u,occurrence:d(C),before:d(u)})},"apply-edit":{gate:"active",status:"live",owner:"client/apply-edit-request",parse:l({requestId:u,op:ge,canvas:d(ge),id:d(ge),key:d(ge),value:d(ge),from:d(ge),occurrence:d(ge)})},"undo-barrier":{gate:"active",status:"live",owner:V,parse:l({requestId:u})},"undo-key":{gate:"active",status:"live",owner:"v2/undo/use-undo-mode-lane (S2.20b)",parse:l({redo:P})},"take-step":{gate:"active",status:"live",owner:"v2/assets/takes (S8.16)",parse:l({dir:U("next","prev")})},"edit-op":{gate:"active",status:"live",owner:"editing (S2.1)",parse:l({requestId:u,op:u,targets:H(Ve),params:d(se),expectRev:d(u)})},"asset-drop-target":{gate:"active",status:"live",owner:"client/v2/assets/canvas-drop-catcher (r3)",parse:l({requestId:q(64),target:_(oa)})},"active-artboard":{gate:"active",status:"live",owner:V,parse:l({id:_(u)})},"reorder-slot":{gate:"active",status:"live",owner:"editing/reorder-slot",parse:(e)=>{let t=l({index:de(0,He),total:de(0,He),parentId:d(on)})(e);if(!t||t.index>t.total)return null;if(t.index>0&&t.parentId===void 0)return null;return t}},"layers-tree":{gate:"active",status:"live",owner:V,parse:l({artboardId:_(u),tree:H(se)})},"open-inspector":{gate:"active",status:"live",owner:V,parse:l({tab:d(u)})},"copy-style":{gate:"active",status:"live",owner:V,parse:ue},"paste-style":{gate:"active",status:"live",owner:V,parse:l({id:u})},"insert-request":{gate:"active",status:"live",owner:V,parse:l({...vo,kind:U("div","text","image"),src:d(u)})},"insert-image-request":{gate:"active",status:"live",owner:V,parse:l(vo)},"delete-request":{gate:"active",status:"live",owner:V,parse:l({id:u,idIndex:d(C)})},"duplicate-request":{gate:"active",status:"live",owner:V,parse:l({id:u,idIndex:d(C)})},"reorder-request":{gate:"active",status:"live",owner:V,parse:l({id:u,refId:u,position:u,idIndex:d(C),refIndex:d(C)})},"reorder-revert":{gate:"active",status:"live",owner:V,parse:l({seq:C,dir:U("undo","redo")})},"reposition-request":{gate:"active",status:"live",owner:V,parse:l({id:u,left:u,top:u,beforeLeft:d(u),beforeTop:d(u),idIndex:d(C)})},"resize-request":{gate:"active",status:"live",owner:V,parse:l({id:u,patch:bo,before:d(bo),idIndex:d(C)})},"replace-media-request":{gate:"active",status:"live",owner:V,parse:l({id:u,before:d(u)})},"convert-to-absolute-request":{gate:"active",status:"live",owner:V,parse:l({artboardId:d(u),allowShared:d(P),containers:d(H(ge)),dissolve:d(H(ge)),containerId:d(u),children:d(H(ge)),containerSetRelative:d(P)})},"delete-artboard-request":{gate:"active",status:"live",owner:V,parse:l({artboardId:u})},"duplicate-artboard-request":{gate:"active",status:"live",owner:V,parse:l({artboardId:u,width:d(C)})},"rename-artboard-request":{gate:"active",status:"live",owner:V,parse:l({artboardId:u,label:u})},"resize-artboard-request":{gate:"active",status:"live",owner:V,parse:l({artboardId:u,width:C,height:C})},"set-artboard-kind-request":{gate:"active",status:"live",owner:V,parse:l({artboardId:u,kind:_(u)})},"open-timeline-request":{gate:"active",status:"live",owner:V,parse:l({artboardId:u})},"replace-annotation-media-request":{gate:"active",status:"live",owner:V,parse:l({id:u,before:d(u)})},"edit-annotation-photo-request":{gate:"active",status:"live",owner:V,parse:l({id:u,asset:u})},"comment-compose":{gate:"active",status:"live",owner:V,parse:l({selection:se})},"comment-submit":{gate:"active",status:"live",owner:V,parse:l({payload:se})},"comment-patch":{gate:"active",status:"live",owner:V,parse:l({id:u,patch:se})},"comment-delete":{gate:"active",status:"live",owner:V,parse:l({id:u})},"comment-click":{gate:"active",status:"live",owner:V,parse:l({id:u})},"comment-op":{gate:"active",status:"live",owner:"v2/comments/comment-bridge (S9.22)",parse:l({reqId:tt,op:Bi})},"comment-people-request":{gate:"active",status:"live",owner:"v2/comments/comment-bridge (S9.22)",parse:l({reqId:tt})},"export-request":{gate:"active",status:"live",owner:V,orphan:"no-sender",parse:l({id:u,payload:se})},"export-history-request":{gate:"active",status:"live",owner:V,orphan:"no-sender",parse:l({id:u})},"open-export":{gate:"active",status:"legacy",owner:V,parse:l({detail:se})},"export-capture-progress":{gate:"asked",status:"live",owner:"h/use-shell-core",parse:l({id:u,current:C,total:C})},"export-capture-done":{gate:"asked",status:"live",owner:"h/use-shell-core",parse:l({id:u,items:H(se)})},"export-capture-error":{gate:"asked",status:"live",owner:"h/use-shell-core",parse:l({id:u,message:u})},"export-selection":{gate:"asked",status:"live",owner:"c/app",parse:l({id:u,selectors:H(u)})},"timeline-comps":{gate:"active",status:"live",owner:V,parse:l({comps:H(se)})},"timeline-frame":{gate:"active",status:"live",owner:V,parse:l({...xe,frame:C})},"timeline-ended":{gate:"active",status:"live",owner:V,parse:l(xe)},"timeline-playing":{gate:"active",status:"live",owner:"v2/timeline (S7.8)",parse:l({...xe,playing:P})},key:{gate:"active",status:"live",owner:"actions/registry (V2-1.3)",parse:l({v:U(1),chord:u,hint:d(X({artboardId:d(u)}))})},"tool-cursor":{gate:"active",status:"live",owner:V,parse:l({tool:u})},peers:{gate:"active",status:"live",owner:"v2/shell/use-canvas-mode-lane (V2-4.3b)",parse:l({peers:Ni})},"hold-view":{gate:"active",status:"live",owner:"v2/inspector/view-mode (S2.18)",parse:l({person:_(X({name:je})),label:je,ai:_(X({label:je,held:P,mine:P}))})},select:{gate:"active",status:"legacy",owner:V,orphan:"no-sender",parse:l({selection:se})},"clear-select":{gate:"active",status:"legacy",owner:V,orphan:"no-sender",parse:ue},artboards:{gate:"active",status:"live",owner:"v2/empty (S11.2); the shell bridge keeps the Layers count",parse:l({count:C})},"artboard-empty":{gate:"active",status:"live",owner:"v2/empty (S11.2)",parse:l({artboardId:_(u),rect:_(De),label:d(u),from:d(u)})},"artboard-anchor":{gate:"active",status:"live",owner:"v2/timeline (S7.7)",parse:l({artboardId:_(u),kind:d(u),label:d(u),rect:d(_(De))})},"artboard-live-size":{gate:"active",status:"live",owner:"v2/inspector live size (P8 c6)",parse:l({id:_(u),w:d(C),h:d(C),preset:d(_(u))})},"space-tap":{gate:"active",status:"live",owner:"v2/timeline (S7.8)",parse:ue},"timeline-peers":{gate:"active",status:"live",owner:"v2/timeline/peers (S7.17)",parse:l({peers:oi})},"ask-selection":{gate:"active",status:"live",owner:"editing/ask-bubble (S2.19)",parse:l({refs:ze(200,H(Ve)),selection:d(ze(12,H(ra))),rect:De,artboard:d(u)})},"ask-selection-rect":{gate:"active",status:"live",owner:"editing/ai-scope-outline (S2.19)",parse:l({rect:_(De)})},"insert-artboard-request":{gate:"active",status:"legacy",owner:V,orphan:"no-sender",parse:l({id:d(u),label:d(u),width:d(C),height:d(C)})},"mode-changed":{gate:"active",status:"live",owner:"v2/shell/use-canvas-mode-lane (V2-4.3b)",parse:l({seq:C,mode:ht,tool:rn,present:_(sn),cause:U("set-mode","tool","clamp","boot")})},"mode-request":{gate:"active",status:"live",owner:"v2/shell/use-canvas-mode-lane (V2-4.3b)",parse:l({mode:(e)=>e==="back"?e:ht(e),tool:d(rn),present:d(sn),cause:U("key","esc","inspect","toolbar","link")})},"toolbar-rect":{gate:"active",status:"live",owner:"tool-palette (V2-4.5a); shell tool panels (V2-4.5c)",parse:l({mode:ht,rect:_(De)})},"tool-panel-open":{gate:"active",status:"live",owner:"tool-palette (V2-4.5c); shell tool panels (V2-4.5c)",parse:l({panel:U("stickers","components","templates","assets","sizes","image","generate"),anchor:_(De),replace:d(u)})},"size-place":{gate:"active",status:"live",owner:"editing/size-ghost (S7.20); client/v2/kinds",parse:l({presetId:q(40),world:X({x:C,y:C})})},"stamp-disarmed":{gate:"active",status:"live",owner:"annotations/ui/placement (15 an-stamps); shell tool panels (use-tool-panels.js)",parse:l({})},"annotation-prefs-set":{gate:"active",status:"live",owner:"annotations/ui/tool-state (S4.8); shell v2/shell/use-annotation-prefs (S4.8)",parse:l({prefs:So})},"viewport-zoom":{gate:"active",status:"live",owner:"present/present-zoom.ts (S3.2b) + v2/preview/zoom-only (S3.9) ← canvas-lib ViewportZoomReporter",parse:l({zoom:C,fit:d(P)})},"present-position":{gate:"active",status:"live",owner:"v2/shell/use-canvas-mode-lane (S3.1)",parse:l({index:C,total:C,artboardId:u,sid:d(an),seq:d(de(0,2147483647))})},"present-run":{gate:"active",status:"live",owner:"present/present-stage.tsx (S3.6b)",parse:l({artboards:Ii})},"present-follow-state":{gate:"active",status:"live",owner:"v2/present/follow-view (S3.7a)",parse:l({live:P,sid:_(an),presenterName:ai,presenterIndex:de(0,2000),index:de(0,2000),total:de(0,2000),watchers:de(0,1e5),ended:P})},"present-media":{gate:"active",status:"live",owner:"present/present-media (S3.3)",parse:l({playing:P,t:ho,duration:ho,muted:P,sources:d(Zs),missing:d(P)})},"link-follow":{gate:"active",status:"live",owner:"S3 links (client/v2/preview/link-follow.js)",parse:l({elementId:Js,artboardId:_(Ke)})},"asset-relink-request":{gate:"active",status:"live",owner:"client/v2/assets/asset-state-lane (S8.19)",parse:l({rel:q(512)})}},xo={theme:{gate:"any",target:"parent",status:"live",owner:ae,parse:l({theme:U("light","dark")})},"view-chrome":{gate:"any",target:"parent",status:"live",owner:ae,parse:l({minimap:d(P),zoom:d(P),present:d(P),guides:d(P),print:d(P),safeZones:d(P),zen:d(P)})},"view-annotations":{gate:"parent",status:"live",owner:"annotations-layer",parse:l({visible:P})},"canvas-cap":{gate:"parent",status:"live",owner:"tpl/_shell.html",parse:l({t:u})},"ds-css":{gate:"parent",status:"live",owner:"tpl/_shell.html",parse:l({tokens:d(_(yt)),components:d(_(yt))})},"ds-pins":{gate:"parent",status:"live",owner:"tpl/_shell.html",parse:l({revs:Mi,rootClass:_(Ai)})},"ds-update-dots":{gate:"parent",status:"live",owner:"tpl/_shell.html",parse:l({ids:fi})},"ds-theme-preview":{gate:"parent",status:"live",owner:"ds/board/state",parse:l({mode:gi})},"ds-marks":{gate:"parent",status:"live",owner:"ds/board/state",parse:l({outside:wo,conflicts:wo})},"ds-make-states":{gate:"parent",status:"live",owner:"ds/board/outline",parse:l({sections:xi})},"ds-rects":{gate:"parent",status:"live",owner:"tpl/_shell.html",parse:l({seq:Ao,artboard:Si,ids:ki})},"ai-activity":{gate:"parent",status:"live",owner:"ai-banner",parse:l({file:u,entry:_(se)})},"select-by-id":{gate:"parent",status:"live",owner:ae,parse:l({id:d(u),artboardId:d(_(u)),index:d(C),add:d(P)})},"select-by-selector":{gate:"parent",status:"live",owner:ae,parse:l({selector:u})},highlight:{gate:"any",target:"parent",status:"live",owner:ae,parse:l({id:_(u),artboardId:d(_(u)),index:d(C)})},"request-layers":{gate:"any",target:"parent",status:"live",owner:ae,parse:l({artboardId:_(u)})},"force-clear":{gate:"any",target:"parent|self",status:"live",owner:ae,parse:ue},"select-clear":{gate:"any",target:"parent|self",status:"legacy",owner:ae,orphan:"no-sender",parse:ue},"locked-set":{gate:"parent",status:"live",owner:ae,parse:l({locked:H(u)})},"apply-style":{gate:"parent",status:"live",owner:ae,parse:l({id:u,artboardId:d(_(u)),index:d(C),prop:u,value:_(u)})},"record-edit":{gate:"parent",status:"live",owner:ae,parse:l({payload:se})},"apply-edit-result":{gate:"parent",status:"live",owner:ae,parse:l({requestId:u,ok:P,error:d(u),conflict:d(P)})},"undo-barrier-ok":{gate:"parent",status:"live",owner:ae,parse:l({requestId:u})},"edit-op-result":{gate:"parent",status:"live",owner:"editing (S2.1)",parse:l({requestId:u,ok:P,actionId:d(_(u)),writeId:d(u),rev:d(u),refs:d(H(Ve)),created:d(H(Ve)),code:d(U(...ia)),message:d(u)})},"edit-reverted":{gate:"parent",status:"live",owner:ae,parse:l({op:u,id:d(u),reason:d(u)})},"reorder-failed":{gate:"parent",status:"live",owner:ae,parse:ue},"reposition-failed":{gate:"parent",status:"live",owner:ae,parse:ue},"resize-failed":{gate:"parent",status:"live",owner:"use-element-resize",parse:ue},"resize-artboard-failed":{gate:"parent",status:"live",owner:"use-element-resize",parse:ue},"freeze-and-set-kind":{gate:"parent",status:"live",owner:ae,parse:l({artboardId:u,kind:_(u),ask:d(P),freeze:d(P)})},"op-toast":{gate:"any",target:"parent",status:"live",owner:ae,parse:l({message:u})},"tool-set":{gate:"parent",status:"live",owner:"use-tool-mode",orphan:"no-sender",parse:l({tool:u})},"insert-sticker":{gate:"parent",status:"live",owner:"annotations-layer",parse:l({path:u,follow:d(P),preview:d(Gs),sticker:d(X({pack:u,id:u,flip:d(P)}))})},"reveal-artboard":{gate:"parent",status:"live",owner:"canvas-lib",parse:l({artboardId:u,glide:P,flash:P})},"convert-marks":{gate:"parent",status:"live",owner:"artboard-convert-marks",parse:l({v:U(1),from:u,to:u,extraPct:C,fill:_(q(40))})},"shell-panels":{gate:"parent",status:"live",owner:"shell-panels",parse:l({v:U(1),open:_(U("stickers","assets","components"))})},"ai-copies":{gate:"parent",status:"live",owner:"artboard-ai-copies",parse:l({v:U(1),copies:qi})},"ai-runs":{gate:"parent",status:"live",owner:"artboard-activity-overlay",parse:l({artboards:mt(X({state:U("running","needs-you","done"),who:q(200),tag:q(120),waiting:gt}))})},"insert-template":{gate:"parent",status:"live",owner:"annotations-layer",parse:l({id:u,follow:d(P)})},"trashed-artboards":{gate:"parent",status:"live",owner:"artboard-ghosts-overlay (S11.5)",parse:l({canvas:q(1024),items:H(X({id:q(128),label:q(200),rect:_(De)}))})},"place-component":{gate:"parent",status:"live",owner:"editing/place-ghost",parse:l({component:ti,label:d(q(64)),variant:d(yo),glyph:d(yo),mode:U("ghost","selection","preview","cancel")})},"place-image":{gate:"parent",status:"live",owner:"editing/place-image (r2-p1 TD10); client/v2/shell/image-pick.js",parse:l({asset:q(512),natural:d(_(X({w:C,h:C}))),label:d(q(200))})},"asset-drag-over":{gate:"parent",status:"live",owner:"editing/image-drop (r3)",parse:l({x:_(C),y:d(C)})},"asset-drop-at":{gate:"parent",status:"live",owner:"editing/image-drop (r3)",parse:l({requestId:q(64),x:C,y:C})},"asset-drop-done":{gate:"parent",status:"live",owner:"editing/image-drop (r3)",parse:l({requestId:q(64),ok:P,created:d(H(Ve)),message:d(q(400))})},"timeline-drop-hint":{gate:"parent",status:"live",owner:"editing/drop-chip (S7.9)",parse:l({artboardId:u,on:P})},"timeline-word":{gate:"parent",status:"live",owner:"collab/timeline-presence (S7.17)",parse:l({artboardId:_(Ke),wordKey:d(ko)})},"dim-artboards":{gate:"parent",status:"live",owner:"editing/kind-dim (S7.24b) ← client/v2/kinds/kind-dim-relay",parse:l({ids:_(ze(Pi,H(q(128))))})},"size-ghost":{gate:"parent",status:"live",owner:"editing/size-ghost (S7.20)",parse:l({preset:_(X({id:q(40),label:q(80),sizeText:q(40),w:C,h:C}))})},"insert-annotation-media":{gate:"parent",status:"live",owner:"annotations-layer",parse:l({paths:H(u)})},"replace-annotation-media":{gate:"parent",status:"live",owner:"annotations-layer",parse:l({id:u,path:u,sticker:d(X({pack:u,id:u,flip:d(P)}))})},"photo-preview":{gate:"any",target:"parent",status:"live",owner:"canvas-lib (photo)",parse:l({asset:u,edit:_(se),use:d(u)})},"photo-busy":{gate:"any",target:"parent",status:"live",owner:"canvas-lib (photo)",parse:l({asset:u,busy:P})},"comments-set":{gate:"any",target:"parent",status:"live",owner:"comments-overlay",parse:l({comments:H(se)})},"comment-focus":{gate:"any",target:"parent",status:"live",owner:"comments-overlay",parse:l({id:_(u),reply:d(U(!0))})},"comment-op-ack":{gate:"parent",status:"live",owner:"comments-overlay (S9.22)",parse:l({reqId:_(tt)})},"comment-op-result":{gate:"parent",status:"live",owner:"comments-overlay (S9.22)",parse:l({reqId:_(tt),ok:P,comment:d(_(se)),status:d(C),error:d(u)})},"comment-people":{gate:"parent",status:"live",owner:"comments-overlay (S9.22)",parse:l({reqId:_(tt),people:_(H(Xi))})},"annotation-select":{gate:"parent",status:"live",owner:"annotations-layer (S4.9)",parse:l({v:U(1),ids:H(q(200))})},"annotation-filter":{gate:"parent",status:"live",owner:"annotations-layer (S4.9)",parse:l({v:U(1),authors:H(q(200))})},"export-capture":{gate:"parent",status:"live",owner:"canvas-lib (export)",parse:l({id:u,format:u,artboardIds:H(u),scale:C})},"export-selection-query":{gate:"parent",status:"live",owner:"canvas-lib (export)",parse:l({id:u})},"export-result":{gate:"parent",status:"live",owner:"export-dialog",orphan:"no-handler",parse:l({id:u,ok:P,browser:d(P),jobId:d(u),error:d(u)})},"export-history-result":{gate:"parent",status:"live",owner:"export-dialog",orphan:"no-handler",parse:l({id:u,history:H(se)})},"timeline-play":{gate:"any",target:"parent",status:"live",owner:"video-comp",parse:l(xe)},"timeline-pause":{gate:"any",target:"parent",status:"live",owner:"video-comp",parse:l(xe)},"timeline-seek":{gate:"any",target:"parent",status:"live",owner:"video-comp",parse:l({...xe,frame:C})},"timeline-loop":{gate:"any",target:"parent",status:"live",owner:"video-comp",parse:l({...xe,loop:P})},"timeline-mute":{gate:"any",target:"parent",status:"live",owner:"video-comp",parse:l({...xe,muted:P})},"timeline-volume":{gate:"any",target:"parent",status:"live",owner:"video-comp",parse:l({...xe,volume:C})},"timeline-request-comps":{gate:"any",target:"parent",status:"live",owner:"video-comp",parse:ue},"run-action":{gate:"parent",status:"live",owner:"actions/registry (V2-1.3)",parse:l({v:U(1),id:u,params:d(se)})},"paste-data":{gate:"parent",status:"live",owner:"bridge/paste-data (p8-sweep-leftovers)",parse:(e)=>{let t=fo(e);return t?{...t}:null}},"git-lifecycle":{gate:"parent",status:"legacy",owner:"c/app",orphan:"no-handler",parse:l({payload:se})},"set-mode":{gate:"parent",status:"live",owner:"bridge/canvas-mode-store (V2-4.3b)",parse:l({v:U(2),seq:C,mode:ht,present:_(sn),tool:d(rn),caps:ri})},"occluded-insets":{gate:"parent",status:"new",owner:"bridge/canvas-mode-store",parse:l({seq:C,insets:li})},"present-step":{gate:"parent",status:"live",owner:"bridge/canvas-mode-store (S3.1)",parse:l({to:(e)=>e==="next"||e==="prev"?e:C(e)})},"present-follow":{gate:"parent",status:"live",owner:"bridge/canvas-mode-store (S3.7a)",parse:l({sid:_(an),live:P,locked:P})},"present-media-cmd":{gate:"parent",status:"live",owner:"present/present-media (S3.3)",parse:l({op:U("play","pause","mute","unmute","captions-on","captions-off")})},"key-prefs":{gate:"parent",status:"live",owner:"bridge/canvas-mode-store (V2-4 gate)",parse:l({singleKeys:P})},"annotation-prefs":{gate:"parent",status:"live",owner:"annotations/ui/tool-state (S4.8)",parse:l({prefs:So})},"vote-state":{gate:"parent",status:"live",owner:"annotations/ui/vote-dots (S4.14)",parse:l({vote:_(X({id:ft,targets:ze(32,H(q(200))),state:U("open","ended"),perVoter:de(1,99),tallies:d(mt(gt,32))})),mine:mt(gt,32)})},"hold-intent":{gate:"parent",status:"live",owner:"editing/hold-rings (S2.18)",parse:l({field:P,app:P,gesture:d(P)})},"ai-holds":{gate:"parent",status:"live",owner:"editing/hold-rings (S2.18)",parse:l({holds:zi})},"ai-seen":{gate:"parent",status:"live",owner:"annotations/ui/ai-seen (S4.15); sent by v2/ai/seen-relay.js",parse:l({targets:ji})},"undo-preview":{gate:"parent",status:"live",owner:"editing/undo-preview (S2.20)",parse:l({artboards:H(u),tag:_(u)})},"asset-state":{gate:"parent",status:"live",owner:"canvas-lib asset placeholder frame (S8.19, L1)",parse:l({items:Ji})},"gen-takes":{gate:"parent",status:"live",owner:"editing/take-keys (S8.16, L1)",parse:l({assets:na})}};var aa="dgn",la=(e,t)=>Object.assign({},e,{[aa]:t}),Io=(e,t)=>Object.hasOwn(e,t),ca=(e)=>be(e)&&typeof e.dgn==="string"?e.dgn:null;function da(e){return Io(ln,e)?ln[e]:null}function ua(e){return Io(xo,e)?xo[e]:null}function pa(e,t,n){if(e==="any")return!0;let o=t.source;if(o===n.parent)return!0;return e==="parent|self"&&o===n}var Sd=new Set(Object.keys(ln).filter((e)=>da(e)?.gate==="active"));function vt(e,t){let n=ca(e.data),o=n?ua(n):null;if(!n||!o||!pa(o.gate,e,t))return null;let r=o.parse(e.data);return r?la(r,n):null}var ma=/^[A-Za-z0-9_-]{1,64}$/;function nt(e){return typeof e==="string"&&ma.test(e)}function Po(e){if(!e||typeof e!=="object")return!1;let{x:t,y:n}=e;return typeof t==="number"&&typeof n==="number"&&Number.isFinite(t)&&Number.isFinite(n)&&Math.abs(t)<=1e7&&Math.abs(n)<=1e7}function _o(){if(typeof window>"u"||typeof document>"u")return null;let e=window.__maudeViewport?.()??null;if(!e||!(e.zoom>0))return null;let t=document.querySelector(".dc-canvas");if(!t)return null;let n=t.getBoundingClientRect();return{vp:e,left:n.left,top:n.top}}function Lo(e,t){let n=_o();if(!n)return null;let{vp:o}=n;return{x:(e-n.left-o.x)/o.zoom,y:(t-n.top-o.y)/o.zoom}}function Oo(e){let t=_o();if(!t)return null;let{vp:n}=t;return{x:t.left+n.x+e.x*n.zoom,y:t.top+n.y+e.y*n.zoom}}function xt(e){if(typeof document>"u"||!nt(e))return null;return document.querySelector(`[data-id="${e}"][data-tool]`)}function No(e,t){if(typeof document>"u")return null;let n=null;for(let o of Array.from(document.querySelectorAll("[data-id][data-tool]"))){if(o.getAttribute("data-tool")==="section")continue;let r=o.getAttribute("data-id");if(!nt(r))continue;let s=o.getBoundingClientRect();if(s.width<=0&&s.height<=0)continue;if(e<s.left||e>s.right||t<s.top||t>s.bottom)continue;let a=Math.max(1,s.width)*Math.max(1,s.height);if(!n||a<=n.area)n={id:r,area:a}}return n?.id??null}import{useCallback as ie,useEffect as ce,useMemo as Fe,useRef as pe,useState as re}from"react";var kt=null;function Re(){if(typeof window>"u")return!1;if(kt===null)try{kt=new URLSearchParams(window.location.search).get("ro")==="1"}catch{kt=!1}return kt}var St=null;function Ue(){if(typeof window>"u")return!1;if(St===null)try{St=new URLSearchParams(window.location.search).get("cm")==="1"}catch{St=!1}return St}var Et=null;function cn(){if(typeof window>"u")return!1;if(Et===null)try{Et=new URLSearchParams(window.location.search).get("cg")==="1"}catch{Et=!1}return Et}var ot="Comments are paused while this project is view only.",Tt=null;function dn(){if(typeof window>"u")return!1;if(Tt===null)try{Tt=new URLSearchParams(window.location.search).get("embed")==="1"}catch{Tt=!1}return Tt}function un(){if(typeof window>"u")return!1;try{return new URLSearchParams(window.location.search).get("follow")==="1"}catch{return!1}}function Do(){if(typeof window>"u")return!1;try{return!!new URLSearchParams(window.location.search).get("sha")}catch{return!1}}var Ko=Symbol.for("maude.canvasMode.v2");function ve(e){let t=e,n=t[Ko];if(n&&n.doc===e.document)return n;let o={insets:Jt,insetsSeq:-1,mode:null,present:null,caps:null,modeSeq:-1,tool:null,prevMode:null,clamped:!1,singleKeys:!0,step:null,follow:null},r=0,s=0,a=-1,c=new Map,p=new Set,f={get:()=>o,subscribe(x){return p.add(x),()=>{p.delete(x)}},claimEcho(x){if(x!==o.modeSeq||x<=a)return!1;return a=x,!0},claimRequest(x){let g=Date.now(),w=c.get(x);if(w!==void 0&&g-w<250)return!1;return c.set(x,g),!0}};return e.addEventListener("message",(x)=>{let g=vt(x,e);if(g?.dgn==="set-mode"){if(g.seq<=o.modeSeq)return;c=new Map;let w=g.caps.present===!0&&!un(),A=Re()?{edit:!1,annotate:!1,comment:g.caps.comment,present:w}:{...g.caps,present:w},m=io(g.mode,A),h=g.tool?et(g.tool,A,m):null,S=g.tool&&(h===null||h===m)?g.tool:null;o={...o,mode:m,present:m==="present"?g.present??{kind:"canvas"}:null,caps:Object.freeze(A),modeSeq:g.seq,tool:S,prevMode:o.mode,clamped:m!==g.mode,step:m==="present"?o.step:null};for(let y of p)y(o);return}if(g?.dgn==="present-step"){if(o.mode!=="present")return;r+=1,o={...o,step:Object.freeze({to:g.to,n:r})};for(let w of p)w(o);return}if(g?.dgn==="present-follow"){if(!un())return;s+=1,o={...o,follow:Object.freeze({sid:g.sid,live:g.live,locked:g.locked,n:s})};for(let w of p)w(o);return}if(g?.dgn==="key-prefs"){if(g.singleKeys===o.singleKeys)return;o={...o,singleKeys:g.singleKeys};for(let w of p)w(o);return}if(g?.dgn!=="occluded-insets")return;if(g.seq<=o.insetsSeq)return;o={...o,insets:Object.freeze({...g.insets}),insetsSeq:g.seq};for(let w of p)w(o)}),Object.defineProperty(f,"doc",{value:e.document}),t[Ko]=f,f}function zo(){return typeof window>"u"?Jt:ve(window).get().insets}if(typeof window<"u"&&typeof window.addEventListener==="function")ve(window);var Ce=["sky","green","yellow","lilac","grey"],Vo="yellow",pn=Object.freeze({sky:"oklch(0.78 0.10 230)",green:"oklch(0.74 0.13 152)",yellow:"oklch(0.82 0.14 95)",lilac:"oklch(0.76 0.10 290)",grey:"oklch(0.70 0.01 250)"});function Ho(e){if(!e)return Ce[0];let t=5381;for(let o=0;o<e.length;o++)t=(t<<5)+t+e.charCodeAt(o)|0;let n=(t%Ce.length+Ce.length)%Ce.length;return Ce[n]??Ce[0]}var mn=(e)=>pn[e];var fa="Someone",ga=(e)=>{if(typeof e!=="string")return!0;let t=e.trim().toLowerCase();return t===""||t==="unknown"};function rt(e,t){if(ga(e))return{name:fa,letter:"S",tone:"grey",you:!1};let n=e.trim(),o=!!t&&t.trim()===n;return{name:o?"You":n,letter:n.charAt(0).toUpperCase(),tone:o?Vo:Ho(n),you:o}}var ha=(e)=>e.trim().split(/\s+/)[0]||"";function st(e){let t=typeof e.author==="string"?e.author.trim():"";if(t==="AI")return{name:t,ai:!0,first:t};return{name:t,ai:!1,first:ha(t)}}function Fo(e){let t=st(e);return t.first?`From ${t.first}’s sticky`:"From a sticky"}var ba=/^[A-Za-z0-9._-]{1,40}$/;var ya={figma:"Figma"},wa=/[\p{Cc}\p{Cf}\p{Cs}\p{Co}\p{Cn}\p{Zl}\p{Zp}]/gu;function va(e){if(typeof e!=="string")return"";let n=e.normalize("NFC").replace(/\s+/gu," ").replace(wa,"").replace(/\s+/gu," ").trim();return Array.from(n).slice(0,80).join("").trim()}var $o=(e)=>!!e&&typeof e==="object"&&!Array.isArray(e);function xa(e){if(typeof e!=="string"||e.length>40)return;let t=Date.parse(e);return Number.isFinite(t)?new Date(t).toISOString():void 0}function fn(e){if(!$o(e)||e.source!=="figma")return;let t=$o(e.author)?e.author:{},n={source:"figma",author:{name:va(t.name)||"Someone"}};if(typeof t.handle==="string"&&t.handle.length<=40&&ba.test(t.handle))n.author.handle=t.handle;let o=xa(e.at);if(o)n.at=o;return n}function gn(e){return e?`${e.author.name} · from ${ya[e.source]}`:""}function qo(e){return(String(e??"").trim().split(/\s+/)[0]??"").replace(/[^\w.-]/g,"").toLowerCase()}function jo(e,t){let{mine:n,...o}=e;return t?{...o,mine:!0}:o}function ka(e,t){return(Array.isArray(e)?e:[]).map((n)=>{let o=jo(n,t(n));if(Array.isArray(n.thread))o.thread=n.thread.map((r)=>r&&typeof r==="object"?jo(r,t(r)):r);return o})}function Uo(e){let t=new Set;for(let n of Array.isArray(e)?e:[]){if(n?.mine===!0&&typeof n.id==="string")t.add(n.id);if(Array.isArray(n?.thread)){for(let o of n.thread)if(o?.mine===!0&&typeof o.id==="string")t.add(o.id)}}return t}function Wo(e,t){return ka(e,(n)=>typeof n.id==="string"&&t.has(n.id))}function We(e,t){return e?.mine===!0&&typeof e.author==="string"?e.author:t}var Bo=Object.freeze({observer:"Can view",viewer:"Can comment",member:"Can edit",owner:"Owner"}),Sa=(e)=>typeof e==="string"&&Object.hasOwn(Bo,e)?Bo[e]:void 0;function Ea(e,t){if(!Array.isArray(e))return[];let n=[],o=new Set,r=(t??"").trim().toLowerCase();for(let s of e.slice(0,200)){if(!s||typeof s!=="object")continue;let a=s;if(a.state!==void 0&&a.state!==null&&a.state!=="")continue;if(typeof a.name!=="string"||!a.name.trim())continue;let c=a.name.trim().slice(0,120);if(r&&c.toLowerCase()===r)continue;let p=typeof a.id==="string"&&a.id?a.id:c;if(o.has(p))continue;o.add(p);let f=Sa(a.role);n.push(f?{id:p,name:c,role:f}:{id:p,name:c})}return n}function Xo(e,t){if(!Array.isArray(e))return[];return Ea(e.map((n)=>({name:n?.name})),t)}function Ta(e,t=96){return e*t/25.4}function Qo(e,t=96){return e*25.4/t}var Ma=[{id:"a6",label:"A6",category:"iso",unit:"mm",width:105,height:148},{id:"a5",label:"A5",category:"iso",unit:"mm",width:148,height:210},{id:"a4",label:"A4",category:"iso",unit:"mm",width:210,height:297},{id:"a3",label:"A3",category:"iso",unit:"mm",width:297,height:420},{id:"a2",label:"A2",category:"iso",unit:"mm",width:420,height:594},{id:"a1",label:"A1",category:"iso",unit:"mm",width:594,height:841},{id:"a0",label:"A0",category:"iso",unit:"mm",width:841,height:1189},{id:"letter",label:"Letter",category:"us",unit:"in",width:8.5,height:11},{id:"legal",label:"Legal",category:"us",unit:"in",width:8.5,height:14},{id:"tabloid",label:"Tabloid",category:"us",unit:"in",width:11,height:17},{id:"dl",label:"DL envelope",category:"envelope",unit:"mm",width:110,height:220},{id:"c5",label:"C5 envelope",category:"envelope",unit:"mm",width:162,height:229},{id:"card-eu",label:"Business card (EU)",category:"card",unit:"mm",width:85,height:55},{id:"card-us",label:"Business card (US)",category:"card",unit:"in",width:3.5,height:2},{id:"poster-18x24",label:'Poster 18×24"',category:"poster",unit:"in",width:18,height:24},{id:"poster-24x36",label:'Poster 24×36"',category:"poster",unit:"in",width:24,height:36}];function Aa(e){return Ma.find((t)=>t.id===e)}function Ra(e,t){let n=e.unit==="mm"?e.width:e.width*25.4,o=e.unit==="mm"?e.height:e.height*25.4;return t==="landscape"?{widthMm:o,heightMm:n}:{widthMm:n,heightMm:o}}function Ca(e){return e.unit==="mm"?3:3.175}var Mt=5,Ia=200;function At(e){if(!Number.isFinite(e))return 0;return Math.min(Math.max(e,0),Ia)}function Pa(e){let t=e??{};return{top:typeof t.top==="number"?At(t.top):Mt,right:typeof t.right==="number"?At(t.right):Mt,bottom:typeof t.bottom==="number"?At(t.bottom):Mt,left:typeof t.left==="number"?At(t.left):Mt}}function hn(e,t=96){return Math.round(Ta(e,t))}function bn(e){let t=Aa(e.paper);if(!t)throw Error(`unknown paper preset: ${e.paper}`);let n=e.orientation??"portrait",{widthMm:o,heightMm:r}=Ra(t,n),s=e.bleedMm??Ca(t),a=Pa(e.marginsMm),c=hn(s),p=hn(o),f=hn(r);return{paper:t.id,orientation:n,trimWidthMm:o,trimHeightMm:r,bleedMm:s,widthPx:p+2*c,heightPx:f+2*c,trimWidthPx:p,trimHeightPx:f,bleedPx:c,marginsMm:a}}function _a(e){let t=Math.max(0,Math.floor(Number.isFinite(e)?e:0)),n=Math.floor(t/3600),o=Math.floor(t%3600/60),r=t%60,s=(a)=>String(a).padStart(2,"0");return n>0?`${n}:${s(o)}:${s(r)}`:`${o}:${s(r)}`}var La=(e)=>`at ${_a(e)}`,Oa=0.5;function Yo(e,t,n=Oa){if(t===null||t===void 0||!Number.isFinite(t))return!0;return Math.abs(t-e)<=n}function yn(e){if(!e||typeof e!=="object")return null;let t=e;if(typeof t.paper!=="string")return null;try{let n=bn({paper:t.paper,orientation:t.orientation==="landscape"?"landscape":"portrait",...typeof t.bleedMm==="number"?{bleedMm:t.bleedMm}:{}});return{wMm:n.trimWidthMm,hMm:n.trimHeightMm}}catch{return null}}function Go(e,t){if(!e||typeof e!=="object")return null;let n=e;if(typeof n.paper!=="string")return null;try{let o=bn({paper:n.paper,orientation:n.orientation==="landscape"?"landscape":"portrait",...typeof n.bleedMm==="number"?{bleedMm:n.bleedMm}:{}}),r=(s)=>Math.round(Qo(s)*10)/10;return{x:r(t.x-o.bleedPx),y:r(t.y-o.bleedPx)}}catch{return null}}var Rt=(e)=>`${Math.round(e)} mm`;function Na(e,t){if(t&&(e.x<0||e.y<0||e.x>t.wMm||e.y>t.hMm))return"In the bleed";let n=!!t&&e.x>t.wMm/2,o=!!t&&e.y>t.hMm/2,r=n?`${Rt(t.wMm-e.x)} from the right`:`${Rt(e.x)} from the left`,s=o?`${Rt(t.hMm-e.y)} above the trim`:`${Rt(e.y)} from the top`;return`${r} · ${s}`}function wn(e,t){let n=typeof e.artboard==="string"&&e.artboard?e.artboard:null;if(typeof e.t==="number"&&Number.isFinite(e.t))return{artboard:n,chip:La(e.t),kind:"video"};let o=e.mm;if(o&&typeof o.x==="number"&&typeof o.y==="number")return{artboard:n,chip:Na({x:o.x,y:o.y},t),kind:"print"};return{artboard:n,chip:null,kind:n?"artboard":"canvas"}}class Ie extends Error{}var vn=(e,t)=>Math.abs(e.x-t.x)<0.000001&&Math.abs(e.y-t.y)<0.000001,le=(e,t)=>({x:e,y:t}),Ct=/([MmLlHhVvCcSsQqTtZzAa])|(-?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?)/g,Da={M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2,Z:0};function Ka(e){let t=[];Ct.lastIndex=0;let n=0;for(let o=Ct.exec(e);o;o=Ct.exec(e)){if(/[^\s,]/.test(e.slice(n,o.index)))throw new Ie("not a path");t.push(o[1]??Number(o[2])),n=Ct.lastIndex}if(/[^\s,]/.test(e.slice(n)))throw new Ie("not a path");return t}function Zo(e){let t=Ka(e),n=[],o=null,r=le(0,0),s=le(0,0),a=null,c=null,p=0,f="",x=(m)=>{let h=[];for(let S=0;S<m;S++){let y=t[p++];if(typeof y!=="number")throw new Ie("not a path");h.push(y)}return h},g=(m)=>{o={closed:!1,points:[{...m}]},n.push(o),r=m,s=m},w=(m,h,S)=>{if(!o)g(r);let y=o,i=y.points[y.points.length-1];if(!vn(m,i))i.out=m;let b={...S};if(!vn(h,S))b.in=h;y.points.push(b),r=S,a=h,c="c"},A=(m)=>{if(!o)g(r);o.points.push({...m}),r=m,c=null};while(p<t.length){let m=t[p];if(typeof m==="string"){if(f=m,p++,m==="A"||m==="a")throw new Ie("arc")}else if(!f||f==="Z"||f==="z")throw new Ie("not a path");else if(f==="M")f="L";else if(f==="m")f="l";let h=f===f.toLowerCase(),S=f.toUpperCase(),y=h?r.x:0,i=h?r.y:0,b=Da[S];if(b===void 0)throw new Ie("not a path");let E=x(b);switch(S){case"M":g(le(E[0]+y,E[1]+i)),c=null;break;case"L":A(le(E[0]+y,E[1]+i));break;case"H":A(le(E[0]+y,r.y));break;case"V":A(le(r.x,E[0]+i));break;case"C":w(le(E[0]+y,E[1]+i),le(E[2]+y,E[3]+i),le(E[4]+y,E[5]+i));break;case"S":{let L=c==="c"&&a?le(2*r.x-a.x,2*r.y-a.y):r;w(L,le(E[0]+y,E[1]+i),le(E[2]+y,E[3]+i));break}case"Q":case"T":{let L=r,O,z;if(S==="Q")O=le(E[0]+y,E[1]+i),z=le(E[2]+y,E[3]+i);else O=c==="q"&&a?le(2*r.x-a.x,2*r.y-a.y):r,z=le(E[0]+y,E[1]+i);w(le(L.x+0.6666666666666666*(O.x-L.x),L.y+0.6666666666666666*(O.y-L.y)),le(z.x+0.6666666666666666*(O.x-z.x),z.y+0.6666666666666666*(O.y-z.y)),z),a=O,c="q";break}case"Z":{if(o){let L=o;L.closed=!0;let O=L.points[0],z=L.points[L.points.length-1];if(L.points.length>1&&vn(O,z)){if(z.in)O.in=z.in;L.points.pop()}}r=s,c=null;break}}}if(n.length===0)throw new Ie("empty");return{subs:n}}var Jo=(e)=>e.subs.reduce((t,n)=>t+n.points.length,0);function er(e,t){return(t?.flexDirection||"row").trim().startsWith("row")?e==="width":e==="height"}var za=new Set(["fit-content","max-content","min-content","auto"]),Va=new Set(["100%","fill","-webkit-fill-available","stretch"]),Ha=(e)=>e==="flex"||e==="inline-flex";function Fa(e,t){let n=t.width.trim().toLowerCase();if(Va.has(n))return"fill";if(za.has(n))return"hug";if(/^-?\d/.test(n))return"fixed";if(er("width",e))return Number.parseFloat(t.flexGrow||"0")>=1?"fill":"hug";let o=t.alignSelf.trim()||"auto",r=(e.alignItems||"normal").trim();return o==="stretch"||o==="auto"&&(r==="normal"||r==="stretch")?"fill":"hug"}function tr(e,t){if(!Ha(e.display)||t.length<2)return;let n=new Set(t.map((r)=>Fa(e,r))),o=new Set(t.map((r)=>r.tag.toLowerCase()));return{count:t.length,tag:o.size===1?[...o][0]:"",width:n.size===1?[...n][0]:"mixed"}}var $a=new WeakMap;var nr=(e)=>$a.get(e)??null;var or=(e)=>e?`${e.sub},${e.i},${e.kind},${e.x},${e.y}`:"";var xn=["font-family","font-size","font-weight","line-height","letter-spacing","text-transform","font-style"];var qa=/^t-[a-z][a-z0-9-]*$/,ja=(e)=>(e??"").split(/\s+/).filter(Boolean),rr=(e)=>ja(e).filter((t)=>qa.test(t));var Jd=Object.freeze({"font-family":"font","font-size":"size","font-weight":"weight","line-height":"line height","letter-spacing":"letter spacing","text-transform":"case","font-style":"italic"});var eu=Object.freeze([{tag:"cs",label:"Čeština"},{tag:"en",label:"English"},{tag:"sk",label:"Slovenčina"},{tag:"de",label:"Deutsch"},{tag:"pl",label:"Polski"}]);var sr=(e,t)=>{let n=t.getComputedStyle(e),o={};for(let r of xn)o[r]=n.getPropertyValue(r).trim();return o},Ua=(e)=>e.closest?.("[lang]")?.getAttribute("lang")?.trim()??"";function ir(e){let n=e.ownerDocument?.defaultView;if(!n||typeof n.getComputedStyle!=="function")return null;let o=rr(e.getAttribute("class"))[0]??null,r=sr(e,n),s={role:o,values:{},differs:[],lang:Ua(e),upper:(n.getComputedStyle(e).getPropertyValue("text-transform")??"").trim()==="uppercase"};if(!o)return s;let a=e,c=e.hasAttribute("style"),p=e.getAttribute("style")??"";try{let f=`${p};transition:none`;a.setAttribute("style",f),a.setAttribute("style","transition:none"),s.values=sr(e,n),a.setAttribute("style",f),n.getComputedStyle(e).getPropertyValue("font-size")}finally{if(c)a.setAttribute("style",p);else a.removeAttribute("style")}return s.differs=xn.filter((f)=>r[f]!==s.values[f]),s}function Wa(e,t){if(e==="/_canvas-shell.html"||e==="/_canvas-shell"){let n=new URLSearchParams(t),o=(n.get("designRel")??".design").replace(/^\/+|\/+$/g,""),r=(n.get("canvas")??"").replace(/^\/+/,"");if(o&&r.startsWith(`${o}/`))r=r.slice(o.length+1);if(!r)return null;return o?`${o}/${r}`:r}return decodeURIComponent(e).replace(/^\//,"")}function It(){if(typeof window>"u")return null;try{return Wa(window.location.pathname,window.location.search)}catch{return null}}function Sn(){return It()??void 0}function Pt(e){if(!e)return"";return(e.getAttribute("class")??"").trim().split(/\s+/).filter((t)=>t&&!t.startsWith("dgn-")&&!t.startsWith("dc-cv-")).join(" ")}var Ba=/^$|^(inline|contents|ruby|ruby-text)$|^inline-/;function Xa(e){let t="",n=(o)=>{if(o.nodeType===3){t+=o.nodeValue??"";return}if(o.nodeType!==1)return;let r=o,s=r.nodeName;if(s==="SCRIPT"||s==="STYLE"||s==="TEMPLATE"||s==="NOSCRIPT")return;if(s==="BR"){t+=" ";return}let a=getComputedStyle(r).display;if(a==="none"&&r!==e)return;let c=!Ba.test(a);if(c)t+=" ";for(let p=r.firstChild;p;p=p.nextSibling)n(p);if(c)t+=" "};return n(e),t}function Qa(e,t){if(!e)return"";let o=(e.innerText||(e.textContent?Xa(e):"")).replace(/\s+/g," ").trim();return o.length>t?`${o.slice(0,t-1)}…`:o}function Ya(e){if(!e)return"";let t=[],n=e;while(n&&n.nodeType===1&&t.length<8){let o=n.getAttribute?.("data-dc-element");if(o){t.unshift(`[data-dc-element="${o}"]`);break}let r=n.getAttribute?.("data-dc-screen");if(r){t.unshift(`[data-dc-screen="${r}"]`);break}let s=n.nodeName.toLowerCase();if(n.id){s=`#${n.id}`,t.unshift(s);break}let a=Pt(n).split(/\s+/).filter(Boolean).slice(0,2);if(a.length)s+=`.${a.join(".")}`;let c=1,p=n.previousElementSibling;while(p)c++,p=p.previousElementSibling;s+=`:nth-child(${c})`,t.unshift(s),n=n.parentElement}return t.join(" > ")}function lr(e){let t=[],n=e;while(n&&n.nodeType===1&&t.length<8){let o=n.nodeName.toLowerCase(),r=n.getAttribute?.("data-dc-element"),s=n.getAttribute?.("data-dc-screen");if(r)o+=`[data-dc-element="${r}"]`;else if(s)o+=`[data-dc-screen="${s}"]`;else if(n.id)o+=`#${n.id}`;let a=Pt(n).split(/\s+/).filter(Boolean).slice(0,2);if(a.length&&!r&&!s)o+=`.${a.join(".")}`;t.unshift(o),n=n.parentElement}return t}function Ga(e){return e.replace(/[^a-zA-Z0-9_-]/g,(t)=>`\\${t}`)}function cr(e,t){return t?`[data-dc-screen="${t}"] [data-cd-id="${e}"]`:`[data-cd-id="${e}"]`}function dr(e,t,n){if(!n)return 0;try{let o=e.querySelectorAll(t);for(let r=0;r<o.length;r++)if(o[r]===n)return r}catch{}return 0}function ur(e,t,n){if(!t||!n)return 0;return dr(e,`[data-cd-id="${Ga(t)}"]`,n)}function En(e,t){let n=(o)=>{try{let r=e.querySelectorAll(o);if(!r.length)return null;let s=t.index&&t.index>0&&t.index<r.length?t.index:0;return r[s]??r[0]}catch{return null}};if(t.id){let o=n(cr(t.id,t.artboardId));if(o)return o}if(t.selector)return n(t.selector);return null}function Za(e,t){let n=0,o=Math.min(e.length,t.length);for(let r=1;r<=o;r++){if(e[e.length-r]!==t[t.length-r])break;n++}return n}function pr(e,t){let n=t.dom_path,o=(t.tag||"").toLowerCase();if(!n||n.length===0||!o)return null;let r=e;if(t.artboardId){let p=e.querySelector(`[data-dc-screen="${t.artboardId}"]`);if(p)r=p}let s=(t.classes||"").split(/\s+/).filter(Boolean),a=null,c=0;for(let p of Array.from(r.querySelectorAll("[data-cd-id]"))){if(p.tagName.toLowerCase()!==o)continue;let f=Za(lr(p),n);if(f===0)continue;let x=Pt(p).split(/\s+/).filter(Boolean),g=s.filter((A)=>x.includes(A)).length,w=f*10+g;if(w>c)c=w,a=p}return a}var ar=["display","flex-direction","flex-wrap","align-items","justify-content","gap","flex","flex-grow","flex-shrink","flex-basis","align-self","font-family","color","font-size","font-weight","line-height","letter-spacing","text-align","margin","margin-top","margin-right","margin-bottom","margin-left","padding","padding-top","padding-right","padding-bottom","padding-left","width","height","min-width","min-height","max-width","max-height","background-color","border-radius","border-top-left-radius","border-top-right-radius","border-bottom-left-radius","border-bottom-right-radius","border-width","border-style","border-color","box-shadow","opacity","position","top","right","bottom","left","z-index","transform","transform-origin","font-style","text-transform","text-decoration","white-space","overflow","stroke","stroke-width","stroke-linecap","stroke-linejoin","object-fit","aspect-ratio","object-position"],Ja=/^(style|class|data-cd-id|data-dc-|data-dcid$)/;function el(e){if(!e||typeof window>"u"||!window.getComputedStyle)return{authored:{},computed:{},customStyles:{},attrs:{}};try{let t=e.style,n=window.getComputedStyle(e),o={},r={},s=new Set(ar);for(let m of ar){let h=t.getPropertyValue(m);if(h)o[m]=h.trim();let S=n.getPropertyValue(m);if(S)r[m]=S.trim()}let a=/^(margin|padding|border)(-|$)/,c={};for(let m=0;m<t.length;m++){let h=t.item(m);if(!h||s.has(h)||a.test(h))continue;let S=t.getPropertyValue(h);if(S)c[h]=S.trim()}let p={};for(let m of Array.from(e.attributes)){if(Ja.test(m.name))continue;p[m.name]=m.value}if(e.tagName.toLowerCase()==="svg"&&e.getAttribute("data-shape")==="path"){let m=e.querySelector("path")?.getAttribute("d");if(m)try{p["data-dc-pen-points"]=String(Jo(Zo(m)))}catch{}let h=or(nr(e));if(h)p["data-dc-pen-point"]=h}if(e.hasAttribute("data-dc-screen")){for(let h of Array.from(e.attributes))if(h.name.startsWith("data-dc-")&&h.name!=="data-dcid")p[h.name]=h.value;let m=al(e);if(m)p["data-dc-web-longest"]=String(m)}let f=e.parentElement,x=f?window.getComputedStyle(f).display:"",g=f&&(x==="flex"||x==="inline-flex")?window.getComputedStyle(f).flexDirection:"",w={},A=t.getPropertyValue("background").trim();if(A)w.background=A;return{authored:o,computed:r,customStyles:c,attrs:p,declared:w,parentDisplay:x,parentFlexDirection:g}}catch{return{authored:{},computed:{},customStyles:{},attrs:{}}}}function tl(e){let t=e.offsetParent;return{x:Math.round(e.offsetLeft),y:Math.round(e.offsetTop),w:Math.round(e.offsetWidth),h:Math.round(e.offsetHeight),parentW:Math.round(t?.clientWidth??0),parentH:Math.round(t?.clientHeight??0)}}var nl=/^--[A-Za-z0-9_-]{1,128}$/,ol=/^[A-Za-z][A-Za-z0-9]{0,63}$/;function rl(e){let t=e.getAttribute?.("data-ds-token");if(t&&nl.test(t))return`[data-ds-token="${t}"]`;let n=e.getAttribute?.("data-ds-master");if(n&&ol.test(n))return`[data-ds-master="${n}"]`;return null}function Tn(e,t){let n=e.el,o=n&&n.getBoundingClientRect?n.getBoundingClientRect():null,r=e.cdId,s=!r&&n?rl(n):null,a=r?cr(r,e.artboardId):s?e.artboardId?`[data-dc-screen="${e.artboardId}"] ${s}`:s:e.artboardId?`[data-dc-screen="${e.artboardId}"]`:Ya(n),c=r&&typeof document<"u"?dr(document,a,n):0;return{file:t??Sn(),id:r??void 0,selector:a,artboardId:s?null:e.artboardId,index:c,tag:n?.tagName.toLowerCase()??"",classes:Pt(n),text:Qa(n,240),dom_path:lr(n),bounds:o?{x:Math.round(o.left),y:Math.round(o.top),w:Math.round(o.width),h:Math.round(o.height)}:null,worldW:n instanceof HTMLElement?Math.round(fr(n)):void 0,worldH:n instanceof HTMLElement?Math.round(kn(n)):void 0,geometry:n instanceof HTMLElement?tl(n):void 0,html:n?(n.outerHTML??"").slice(0,4000):"",...(()=>{if(n?.tagName?.toLowerCase()!=="img")return{};let p=/assets\/[0-9a-f]{8}\.[a-z0-9]+/i,f=n.getAttribute?.("data-photo-asset");if(f&&p.test(f))return{photoKind:"artboard-img",photoAsset:f};let x=n.getAttribute?.("src")||"",g=p.exec(x);return g?{photoKind:"artboard-img",photoAsset:g[0]}:{}})(),...el(n),...il(n),...sl(n)}}function sl(e){if(!e||typeof window>"u"||!window.getComputedStyle||!e.children?.length)return{};try{let t=window.getComputedStyle(e),n=t.display;if(n!=="flex"&&n!=="inline-flex")return{};let o=Array.from(e.children).filter((s)=>s instanceof HTMLElement).map((s)=>{let a=s.style,c=a.getPropertyValue("flex-grow").trim();return{tag:s.tagName.toLowerCase(),width:a.getPropertyValue("width").trim(),flexGrow:c||window.getComputedStyle(s).flexGrow||"",alignSelf:a.getPropertyValue("align-self").trim()}}),r=tr({display:n,flexDirection:t.flexDirection,alignItems:t.alignItems},o);return r?{kids:r}:{}}catch{return{}}}function il(e){if(!e||e.children.length>0)return{};if(!(e.textContent??"").trim()&&!e.getAttribute("class"))return{};let t=ir(e);return t?{textInfo:t}:{}}function mr(e){if(!e.hasAttribute("data-dc-screen"))return null;let t=Array.from(e.children).find((n)=>n.classList.contains("dc-artboard-body"));return t&&t.offsetWidth?t:null}function fr(e){return mr(e)?.offsetWidth??e.offsetWidth}function al(e){let t=(a)=>a.getAttribute("data-dc-kind")==="web"&&a.getAttribute("data-dc-fixed")!=="true";if(!e.hasAttribute("data-dc-screen")||!t(e))return null;let n=e.closest("[data-dc-section]")??e.ownerDocument,o=Array.from(n.querySelectorAll("[data-dc-screen]")).filter(t);if(o.length<2||!o.includes(e))return null;if(new Set(o.map((a)=>Math.round(fr(a)))).size!==o.length)return null;let s=kn(e);return o.every((a)=>a===e||kn(a)<s)?o.length:null}function kn(e){let t=mr(e);if(t)return t.offsetHeight;if(e.getAttribute("data-dc-fixed")!=="true"||!e.hasAttribute("data-dc-screen"))return e.offsetHeight;let n=Array.from(e.children).find((o)=>o.classList.contains("dc-artboard-label"));return e.offsetHeight-(n?n.offsetHeight:0)}import*as An from"lib0/decoding";import*as it from"lib0/encoding";import{createContext as dl,useCallback as Ku,useContext as ul,useEffect as zu,useMemo as Vu,useReducer as Hu,useRef as Fu,useState as $u}from"react";import{Awareness as ju,applyAwarenessUpdate as Uu,encodeAwarenessUpdate as Wu}from"y-protocols/awareness";import{readSyncMessage as Xu,writeSyncStep1 as Qu,writeUpdate as Yu}from"y-protocols/sync";import*as Rn from"yjs";import*as ll from"yjs";var cl=new WeakSet;function gr(e){return cl.add(e),e}var uu=gr(Object.freeze({maudeOrigin:"shell-edit"})),pu=gr(Object.freeze({maudeOrigin:"sync-agent"}));import*as _t from"lib0/decoding";import*as Be from"lib0/encoding";import*as hr from"y-protocols/awareness";import*as Mn from"y-protocols/sync";var gu=Object.freeze(["timeline","editing","holding"]),hu=Object.freeze(["editing","holding"]);var op=Ce.map((e)=>pn[e]);var pl=dl(null);function br(){return ul(pl)}var rp=Object.freeze({maudeOrigin:"collab-epoch-resync"});import{createContext as ml,useCallback as ke,useContext as In,useEffect as fl,useMemo as gl,useRef as Lt,useState as hl}from"react";import{jsx as Cn,Fragment as kl}from"react/jsx-runtime";var Nt=ml(null);function Pe(e){return e.id?`id:${e.id}`:`sel:${e.selector}`}function Ot(e){let t=[],n=new Set;for(let o of e){let r=Pe(o);if(n.has(r))continue;n.add(r),t.push(o)}return t}var bl=50,yl=500,wl=(e,t)=>e.length===t.length&&e.every((n,o)=>Pe(n)===Pe(t[o]));function yr(e,t,n,o=Date.now()){return o-e<yl&&!wl(n,t)}var wr=null;function vl(e){if(!wr||e.length===0)return null;try{return wr(e)}catch{return null}}function xl({children:e,postTarget:t}){let[n,o]=hl([]),r=Lt([]),s=Lt(Number.NEGATIVE_INFINITY),a=Lt(null),c=Lt(null),p=ke((i)=>{if(a.current)clearTimeout(a.current);c.current=()=>{a.current=null,c.current=null;let b=t??(typeof window<"u"?window.parent:null);if(!b)return;let E=i.length===0?null:i.length===1?i[0]??null:i;try{b.postMessage({dgn:"select-set",selection:E,...vl(i)},"*")}catch{}},a.current=setTimeout(()=>c.current?.(),bl)},[t]);fl(()=>()=>{if(a.current)clearTimeout(a.current);c.current?.()},[]);let f=ke((i)=>{r.current=i,o(i),p(i)},[p]),x=ke((i)=>{s.current=Date.now(),f(Ot(Array.isArray(i)?i:[i]))},[f]),g=ke((i)=>{let b=Ot(Array.isArray(i)?i:[i]);if(yr(s.current,r.current,b))return!1;return f(b),!0},[f]),w=ke((i)=>{let b=Ot([...r.current,...Array.isArray(i)?i:[i]]);if(yr(s.current,r.current,b))return!1;return f(b),!0},[f]),A=ke((i)=>{let b=Array.isArray(i)?i:[i];s.current=Date.now(),o((E)=>{let L=Ot([...E,...b]);return r.current=L,p(L),L})},[p]),m=ke((i)=>{let b=Pe(i);s.current=Date.now(),o((E)=>{let L=E.filter((O)=>Pe(O)!==b);return r.current=L,p(L),L})},[p]),h=ke((i)=>{let b=Pe(i);s.current=Date.now(),o((E)=>{let L=E.some((O)=>Pe(O)===b)?E.filter((O)=>Pe(O)!==b):[...E,i];return r.current=L,p(L),L})},[p]),S=ke(()=>{s.current=Date.now(),f([])},[f]),y=gl(()=>({selected:n,replace:x,add:A,remove:m,toggle:h,clear:S,replaceFromShell:g,addFromShell:w}),[n,x,A,m,h,S,g,w]);return Cn(Nt.Provider,{value:y,children:e})}function vr({children:e}){if(In(Nt))return Cn(kl,{children:e});return Cn(xl,{children:e})}function Dt(){let e=In(Nt);if(!e)throw Error("useSelectionSet must be used inside <SelectionSetProvider>");return e}function xr(){return In(Nt)}import{jsx as R,jsxs as B,Fragment as Yl}from"react/jsx-runtime";var Sl=800,El=20000,_e=new Map,Pr=0;function Tl(e){if(e.source!==window.parent)return;let t=e.data;if(!t||typeof t!=="object"||typeof t.dgn!=="string")return;if(t.dgn!=="comment-op-ack"&&t.dgn!=="comment-op-result"&&t.dgn!=="comment-people")return;let n=`${t.dgn==="comment-op-ack"?"ack":"res"}:${String(t.reqId)}`;_e.get(n)?.(t)}function _r(){if(typeof window>"u")return;window.addEventListener("message",Tl)}var Lr=()=>typeof window<"u"&&window.parent!==window;function _n(e,t){return new Promise((n)=>{let o=setTimeout(()=>{_e.delete(e),n(null)},t);_e.set(e,(r)=>{clearTimeout(o),_e.delete(e),n(r)})})}async function Xe(e){if(!Lr())return null;_r();let t=`cm${++Pr}`,n=_n(`ack:${t}`,Sl),o=_n(`res:${t}`,El);try{window.parent.postMessage({dgn:"comment-op",reqId:t,op:e},"*")}catch{return _e.delete(`ack:${t}`),_e.delete(`res:${t}`),null}if(!await n)return _e.delete(`res:${t}`),null;let r=await o;if(!r)return{ok:!1,error:"That did not go through."};return r.ok?{ok:!0,comment:r.comment??null}:{ok:!1,error:r.error||"That did not go through."}}async function Ml(){if(!Lr())return null;_r();let e=`cm${++Pr}`,t=_n(`res:${e}`,2500);try{window.parent.postMessage({dgn:"comment-people-request",reqId:e},"*")}catch{return _e.delete(`res:${e}`),null}let n=await t;return Array.isArray(n?.people)?n.people:null}function Dn(e){if(typeof document>"u")return null;for(let t of document.querySelectorAll("[data-dc-screen]"))if(t.getAttribute("data-dc-screen")===e)return t;return null}function kr(e){let n=Dn(e)?.querySelector(".dc-artboard-label");return(n instanceof HTMLInputElement?n.value:n?.textContent)?.trim()||e}function Or(e){return(e.querySelector(".dc-artboard-body")??e).getBoundingClientRect()}function Al(e,t){if(typeof document>"u")return null;for(let n of document.querySelectorAll("[data-dc-screen]")){let o=Or(n);if(e>=o.left&&e<=o.right&&t>=o.top&&t<=o.bottom)return n.getAttribute("data-dc-screen")}return null}function Kn(e){let t=Dn(e)?.getAttribute("data-dc-print");if(!t)return null;try{return JSON.parse(t)}catch{return null}}function Nr(e){let t=globalThis.__maudeVideoComps;if(!t)return null;for(let n of t.values()){if(n.artboardId!==e)continue;try{let o=n.ref.current?.getCurrentFrame?.();if(typeof o==="number"&&n.fps>0)return o/n.fps}catch{}}return null}function Rl(e,t){let n=globalThis.__maudeVideoComps;if(!n)return!1;for(let o of n.values()){if(o.artboardId!==e)continue;let r=o.ref.current;if(!r?.seekTo)continue;try{return r.pause?.(),r.seekTo(Math.max(0,Math.round(t*o.fps))),!0}catch{}}return!1}function Cl(e,t,n){let o=e||Al(t,n),r=o?Dn(o):null;if(!o||!r)return{};let s={artboard:o},a=r.getAttribute("data-dc-kind");if(a==="video"){let c=Nr(o);if(c!==null)s.t=Math.round(c*1000)/1000}else if(a==="print"){let c=Or(r),p=r.querySelector(".dc-artboard-body"),f=p&&c.width>0?p.offsetWidth/c.width:1,x=Go(Kn(o),{x:(t-c.left)*(f||1),y:(n-c.top)*(f||1)});if(x)s.mm=x}return s}var Il="/_client/comments-overlay.css";function Pl(){if(typeof document>"u")return;if(document.getElementById("cm-overlay-css"))return;let e=document.createElement("link");e.id="cm-overlay-css",e.rel="stylesheet",e.href=Il,document.head.appendChild(e)}function zn(){return It()}function _l(e){if(nt(e.annotationId))return xt(e.annotationId);if(!e.selector)return null;let t=null;try{let n=document.querySelectorAll(e.selector),o=e.index&&e.index>0&&e.index<n.length?e.index:0;t=n[o]??n[0]??null}catch{t=null}if(t&&e.tag&&t.tagName.toLowerCase()!==e.tag.toLowerCase())t=null;if(!t&&e.dom_path?.length){let n=e.selector.match(/data-dc-screen="([^"]+)"/)?.[1];t=pr(document,{artboardId:n,tag:e.tag,classes:e.classes,dom_path:e.dom_path})}return t}function Ln(e){let t=_l(e);if(!t?.isConnected)return null;let n=t.getBoundingClientRect();if(n.width===0&&n.height===0)return null;return{x:n.left,y:n.top,w:n.width,h:n.height}}function Dr(e,t,n=zo()){let r=typeof window<"u"?window.innerWidth:e.x+t.w,s=typeof window<"u"?window.innerHeight:e.y+t.h,a=uo(r,s,n),c=a.x+8,p=a.y+8,f=a.x+a.w,x=a.y+a.h,g=e.x;if(g+t.w+8>f){let A=e.x-t.w;g=A>=c?A:Math.max(c,f-t.w-8)}if(g<c)g=c;let w=e.y;if(w+t.h+8>x){let A=e.y-t.h;w=A>=p?A:Math.max(p,x-t.h-8)}if(w<p)w=p;return{x:g,y:w}}function Kr(){Pl();let e=xr(),[t,n]=re([]),[o,r]=re(null),[s,a]=re(0),[c,p]=re(null),f=Fe(()=>zn(),[]),[x,g]=re(!1),[w,A]=re(null),m=ie((k)=>{n((T)=>T.some((I)=>I.id===k.id)?T.map((I)=>I.id===k.id?k:I):[...T,k])},[]);ce(()=>{if(typeof document>"u")return;let k=document.getElementById("dgn-pin-layer");if(!k)return;let T=k.style.display;return k.style.display="none",()=>{k.style.display=T}},[]);let h=ie((k)=>{if(!e)return;if(!k?.selector){e.clear();return}let T=k.selector.match(/data-cd-id="([^"]+)"/),I=T?T[1]:void 0,M,K;try{let F=document.querySelector(k.selector);if(F)M=F.tagName.toLowerCase(),K=(F.getAttribute("class")??"").split(/\s+/).filter((j)=>j&&!j.startsWith("dgn-")&&!j.startsWith("dc-cv-")).join(" ")}catch{}e.replace({file:f??void 0,id:I,selector:k.selector,tag:M,classes:K,bounds:k.bounds??void 0})},[e,f]),S=pe(t),y=pe(new Set);S.current=t;let i=br(),b=ql();ce(()=>{if(!i)return;let k=i.doc.getArray("comments"),T=()=>{n(Wo(k.toArray(),y.current))};if(k.length>0)T();return k.observe(T),()=>{try{k.unobserve(T)}catch{}}},[i]),ce(()=>{if(typeof window>"u")return;let k=(T)=>{let I=T.data;if(!I||typeof I!=="object"||!I.dgn)return;if(I.dgn==="comments-set"&&Array.isArray(I.comments))y.current=Uo(I.comments),n(I.comments);else if(I.dgn==="comment-focus"){let M=typeof I.id==="string"?I.id:null;if(r(M),M&&I.reply===!0)a((F)=>F+1);else a(0);let K=M?S.current.find((F)=>F.id===M):void 0;h(K)}};return window.addEventListener("message",k),()=>window.removeEventListener("message",k)},[h]),ce(()=>{if(typeof document>"u")return;let k=(T)=>{let I=T.detail;if(!I?.selection)return;let M=typeof I.clientX==="number"?I.clientX:0,K=typeof I.clientY==="number"?I.clientY:0;p({selection:I.selection,clientX:M,clientY:K,anchors:Cl(I.selection.artboardId,M,K)})};return document.addEventListener("cm:open-composer",k),()=>document.removeEventListener("cm:open-composer",k)},[]);let E=ie(()=>{if(p(null),typeof window>"u")return;try{window.parent.postMessage({dgn:"force-clear"},"*")}catch{}},[]),L=ie((k)=>{if(!c)return;let T=c.selection,I={file:T.file,selector:T.selector,index:T.index,dom_path:T.dom_path,tag:T.tag,classes:T.classes,bounds:T.bounds,html_excerpt:T.html,...T.annotationId?{annotationId:T.annotationId}:{},...T.world?{world:T.world}:{},text:k};if(typeof window>"u")return;g(!0),(async()=>{let M=await Xe({op:"add",...I,...c.anchors});if(g(!1),M===null){try{window.parent.postMessage({dgn:"comment-submit",payload:I},"*")}catch{}E();return}if(!M.ok){A(M.error??"That did not go through.");return}if(A(null),M.comment)m(M.comment);E()})()},[c,E,m]);ce(()=>{if(!f)return;let k=!1;return(async()=>{try{let T=await fetch(`/_comments?file=${encodeURIComponent(f)}`);if(!T.ok){await T.body?.cancel().catch(()=>{});return}let I=await T.json();if(k)return;if(Array.isArray(I.comments))n((M)=>M.length===0?I.comments??[]:M)}catch{}})(),()=>{k=!0}},[f]);let O=Fe(()=>[...new Set(t.filter((k)=>typeof k.t==="number"&&k.artboard).map((k)=>k.artboard))],[t]),[z,G]=re({});ce(()=>{if(O.length===0)return;let k=()=>{let I={};for(let M of O){let K=Nr(M);I[M]=K===null?null:Math.round(K*4)/4}G((M)=>O.every((K)=>M[K]===I[K])?M:I)};k();let T=setInterval(k,125);return()=>clearInterval(T)},[O]);let D=Fe(()=>t.slice().sort((T,I)=>T.created.localeCompare(I.created)).filter((T)=>T.status!=="resolved"&&(typeof T.t!=="number"||!T.artboard||T.id===o||Yo(T.t,z[T.artboard]??null))),[t,z,o]),W=Fe(()=>{let k=new Map;return t.slice().sort((I,M)=>I.created.localeCompare(M.created)).forEach((I,M)=>{k.set(I.id,M+1)}),k},[t]),Q=ie((k)=>{if(r(k),h(t.find((T)=>T.id===k)),typeof window>"u")return;try{window.parent.postMessage({dgn:"comment-click",id:k},"*")}catch{}},[t,h]),ee=ie((k,T)=>{if(typeof window>"u")return;let I=()=>{try{window.parent.postMessage({dgn:"comment-patch",id:k,patch:T},"*")}catch{}},M=T.status==="resolved"?{op:"resolve",id:k}:T.status==="open"?{op:"reopen",id:k}:typeof T.text==="string"?{op:"edit-own",id:k,text:T.text}:null;if(!M)return I();Xe(M).then((K)=>{if(K===null)return I();if(!K.ok)return A(K.error??"That did not go through.");if(A(null),K.comment)m(K.comment)})},[m]),oe=ie((k)=>{if(typeof window>"u")return;r((T)=>T===k?null:T),Xe({op:"delete-own",id:k}).then((T)=>{if(T===null){try{window.parent.postMessage({dgn:"comment-delete",id:k},"*")}catch{}return}if(!T.ok)return A(T.error??"That did not go through.");A(null),n((I)=>I.filter((M)=>M.id!==k))})},[]),te=ie(async(k,T)=>{if(typeof fetch>"u")return!1;let I=await Xe({op:"reply",id:k,body:T});if(I){if(!I.ok)return A(I.error??"That did not go through."),!1;if(A(null),I.comment)m(I.comment);return!0}try{let M=await fetch(`/_api/comments/${encodeURIComponent(k)}/reply`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({body:T})});if(!M.ok)return!1;let K=await M.json();return n((F)=>F.map((j)=>j.id===K.id?K:j)),!0}catch{return!1}},[m]);return B("div",{className:"cm-layer","aria-hidden":!1,children:[D.map((k)=>{let T=W.get(k.id)??0;return R(Vl,{comment:k,sequence:T,focused:o===k.id,viewer:b??i?.myName,onClick:Q},k.id)}),c?R(Hl,{state:c,busy:x,onSubmit:L,onCancel:E}):null,w?B("div",{className:"cm-notice",role:"status","data-testid":"comment-notice",children:[R("span",{children:w}),R("button",{type:"button",className:"cm-notice__x","aria-label":"Dismiss",onClick:()=>A(null),children:"×"})]}):null,(()=>{if(!o)return null;let k=D.find((T)=>T.id===o);if(!k)return null;return R(jl,{comment:k,sequence:W.get(k.id)??0,onClose:()=>{r(null),e?.clear()},onPatch:(T)=>ee(k.id,T),onDelete:()=>oe(k.id),onReply:(T)=>te(k.id,T),focusReply:s,mine:(!Re()||Ue())&&(k.mine===!0||!!(b??i?.myName)&&(k.author??"").trim()===(b??i?.myName??"").trim()),me:(b??i?.myName)||void 0})})()]})}var Pn=null,Sr=0,Ll=60000;async function Ol(){try{let e=await fetch("/_api/git-committers");if(!e.ok)return[];let t=await e.json();return Xo(t.committers)}catch{return[]}}function Nl(){if(!(Pn&&Date.now()-Sr<Ll))Sr=Date.now(),Pn=(async()=>await Ml()??await Ol())();return Pn}function Er(e){return qo(e)}function Dl(e,t){if(t<=0||t>e.length)return null;let n=t-1;while(n>=0){let o=e[n]??"";if(o==="@"){let r=n>0?e[n-1]:"";if(n===0||/\s/.test(r??"")){let s=e.slice(n+1,t);return{start:n,end:t,query:s}}return null}if(!/[\w.-]/.test(o))return null;n-=1}return null}function zr(e,t){ce(()=>{let n=e.current;if(!n)return;n.style.height="auto",n.style.height=`${Math.min(n.scrollHeight,160)}px`},[e,t])}function On({className:e,value:t,onChange:n,onKeyDown:o,placeholder:r,rows:s,disabled:a,textareaRef:c,ariaLabel:p,title:f}){let x=pe(null),g=ie((D)=>{if(x.current=D,c)c.current=D},[c]),[w,A]=re([]),[m,h]=re(null),[S,y]=re(0),i=ie(()=>{if(w.length>0)return;Nl().then((D)=>A(D))},[w.length]),b=Fe(()=>{if(!m)return[];let D=m.query.toLowerCase();return(!D?w:w.filter((Q)=>Q.name.toLowerCase().includes(D))).slice(0,8)},[m,w]),E=ie((D)=>{let W=D.selectionStart??D.value.length,Q=Dl(D.value,W);h(Q),y(0)},[]),L=ie((D)=>{n(D.target.value),E(D.target)},[n,E]),O=ie((D)=>{if(!m)return;let W=x.current;if(!W)return;let Q=`@${Er(D.name)}`,ee=`${t.slice(0,m.start)}${Q} ${t.slice(m.end)}`;n(ee),h(null);let oe=m.start+Q.length+1;requestAnimationFrame(()=>{W.focus(),W.setSelectionRange(oe,oe)})},[m,t,n]),z=ie((D)=>{if(m&&b.length>0){if(D.key==="ArrowDown"){D.preventDefault(),y((W)=>(W+1)%b.length);return}if(D.key==="ArrowUp"){D.preventDefault(),y((W)=>(W-1+b.length)%b.length);return}if(D.key==="Enter"||D.key==="Tab"){D.preventDefault();let W=b[S]??b[0];if(W)O(W);return}if(D.key==="Escape"){D.preventDefault(),h(null);return}}o?.(D)},[m,b,S,O,o]),G=ie((D)=>{E(D.currentTarget)},[E]);return B("div",{style:{position:"relative"},children:[R("textarea",{ref:g,className:e,value:t,placeholder:r,rows:s,disabled:a,"aria-label":p,title:f,onChange:L,onKeyDown:z,onFocus:i,onSelect:G,onClick:G}),m&&b.length>0?R("ul",{className:"cm-mention-popup",role:"listbox","aria-label":"Mention suggestions",style:{left:0,top:"100%"},children:b.map((D,W)=>B("li",{role:"option","aria-selected":W===S,className:"cm-mention-popup__item",onMouseEnter:()=>y(W),onMouseDown:(ee)=>{ee.preventDefault(),O(D)},children:[R(Nn,{name:D.name}),B("span",{className:"cm-mention-popup__name",children:["@",Er(D.name)]}),D.role?R("span",{className:"cm-mention-popup__role",children:D.role}):null]},D.id))}):null]})}var Kl=3000;function zl(e){return{x:e.x-12,y:e.y-12,w:24,h:24}}function Vr(e){let t=!!e.selector||nt(e.annotationId);if(t){let r=Ln(e);if(r)return{pos:r,missing:!1}}let n=Po(e.world)?Oo(e.world):null;return{pos:n?zl(n):e.bounds??null,missing:t}}function Vl({comment:e,sequence:t,focused:n,viewer:o,onClick:r}){let s=pe(null),a=pe(null),c=pe(null),[p,f]=re(!1),x=pe(!1);ce(()=>{let m=()=>{a.current=null;let h=s.current;if(!h)return;let{pos:S,missing:y}=Vr(e),i=!1;if(y){if(c.current==null)c.current=Date.now();i=Date.now()-c.current>Kl}else c.current=null;if(i!==x.current)x.current=i,f(i);if(!S){h.style.display="none",a.current=requestAnimationFrame(m);return}h.style.display="grid";let b=Math.round(S.x+S.w-14),E=Math.round(S.y-14);h.style.left=`${b}px`,h.style.top=`${E}px`,a.current=requestAnimationFrame(m)};return a.current=requestAnimationFrame(m),()=>{if(a.current!=null)cancelAnimationFrame(a.current)}},[e]);let g=rt(e.author,We(e,o)),w=1+(e.thread?.length??0),A=`Comment ${t} by ${g.name}${w>1?`, ${w} messages`:""}${p?" (detached: its target is gone)":""}`;return B("button",{ref:s,type:"button",className:"cm-pin","data-resolved":e.status==="resolved"?"true":"false","data-focused":n?"true":"false","data-detached":p?"true":"false","data-comment-pin":e.id,"aria-label":A,"aria-expanded":n,title:e.text.slice(0,200),"data-seq":t,style:{["--cm-pin-tone"]:mn(g.tone)},onClick:(m)=>{m.preventDefault(),m.stopPropagation(),r(e.id)},children:[g.letter,w>1?R("span",{className:"cm-pin__n","data-testid":`comment-pin-count-${e.id}`,"aria-hidden":"true",children:w}):null]})}function Hl({state:e,busy:t=!1,paused:n=cn(),onSubmit:o,onCancel:r}){let[s,a]=re(""),c=pe(null);zr(c,s);let p=pe(null),f=pe(null);ce(()=>{let m=()=>{f.current=null;let h=p.current;if(!h)return;let S=Ql(e),y=Dr(S,{w:h.offsetWidth,h:h.offsetHeight});h.style.left=`${Math.round(y.x)}px`,h.style.top=`${Math.round(y.y)}px`,f.current=requestAnimationFrame(m)};return f.current=requestAnimationFrame(m),()=>{if(f.current!=null)cancelAnimationFrame(f.current)}},[e]),ce(()=>{c.current?.focus()},[]);let x=ie(()=>{let m=s.trim();if(!m||t||n)return;o(m)},[s,t,n,o]),g=ie((m)=>{if(m.key==="Escape"){m.preventDefault(),r();return}if((m.metaKey||m.ctrlKey)&&m.key==="Enter")m.preventDefault(),x()},[r,x]),w=Fe(()=>Hr({artboard:e.anchors?.artboard,selector:e.selection.selector}),[e.anchors,e.selection]),A=Fe(()=>{let m=e.anchors;if(!m?.artboard)return null;return wn(m,yn(Kn(m.artboard))).chip},[e.anchors]);return B("div",{ref:p,className:"cm-composer",role:"dialog","aria-label":"New comment",onClick:(m)=>m.stopPropagation(),onPointerDown:(m)=>m.stopPropagation(),children:[B("div",{className:"cm-composer__head",children:[R("span",{className:"cm-composer__where","data-testid":A?"comment-composer-place":"comment-composer-where",children:w}),R("button",{type:"button",className:"cm-thread__close","data-testid":"comment-composer-cancel","aria-label":"Cancel",title:"Cancel · esc",onClick:r,children:"×"})]}),A?R("span",{className:"cm-chip cm-composer__chip","data-testid":"comment-composer-where",children:A}):null,n?R("p",{className:"cm-composer__paused",role:"status","data-testid":"comment-composer-paused",children:ot}):null,B("div",{className:"cm-composer__field",children:[R(On,{textareaRef:c,className:"cm-composer__textarea",value:s,placeholder:"Add a comment — @ mentions someone",onChange:a,onKeyDown:g,rows:1,ariaLabel:"Comment body",disabled:n,title:n?ot:void 0}),R("button",{type:"button",className:"cm-btn cm-btn--primary cm-composer__send","data-testid":"comment-composer-send","aria-label":"Send",title:n?ot:"Send · ⌘↵",disabled:!s.trim()||t||n,onClick:x,children:R("svg",{width:"14",height:"14",viewBox:"0 0 16 16","aria-hidden":"true",children:R("path",{d:"M6 3.5 10.5 8 6 12.5",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})})]})]})}function Fl(e){if(e.artboard)return kr(e.artboard);let t=null;try{t=e.selector&&typeof document<"u"?document.querySelector(e.selector):null}catch{t=null}let n=t?.closest?.("[data-dc-screen]")?.getAttribute("data-dc-screen");if(n)return kr(n);let o=t?.getAttribute?.("data-dc-element");if(o)return o.replace(/[-_]+/g," ");return"On the canvas"}function $l(e=zn()){let t=(e??"").split("/").pop()??"";if(!/\.[a-z0-9]+$/i.test(t))return"";return t.replace(/\.[a-z0-9]+$/i,"").replace(/[-_]+/g," ").trim()}function Hr(e,t=zn()){let n=Fl(e),o=$l(t);if(!o)return n;return n==="On the canvas"?o:`${o} · ${n}`}var Tr=null;function ql(){let[e,t]=re(null);return ce(()=>{if(typeof fetch>"u")return;Tr??=fetch("/_api/git-user").then((o)=>o.ok?o.json():null).then((o)=>typeof o?.name==="string"&&o.name.trim()?o.name.trim():null).catch(()=>null);let n=!0;return Tr.then((o)=>n&&t(o)),()=>{n=!1}},[]),e}function jl({comment:e,sequence:t,onClose:n,onPatch:o,onDelete:r,onReply:s,focusReply:a=0,mine:c=!1,me:p}){let f=pe(null),x=pe(null),g=pe(null),[w,A]=re("");zr(x,w);let[m,h]=re(!1),[S,y]=re(null),i=ie(()=>{let N=(S??"").trim();if(!N)return;if(N!==e.text)o({text:N});y(null)},[S,e.text,o]);ce(()=>{let N=()=>{g.current=null;let Z=f.current;if(!Z)return;let Ae=Xl(e),ut=Dr(Ae,{w:Z.offsetWidth,h:Z.offsetHeight});Z.style.left=`${Math.round(ut.x)}px`,Z.style.top=`${Math.round(ut.y)}px`,g.current=requestAnimationFrame(N)};return g.current=requestAnimationFrame(N),()=>{if(g.current!=null)cancelAnimationFrame(g.current)}},[e]),ce(()=>{f.current?.focus();let N=e.id;return()=>{document.querySelector(`[data-comment-pin="${N}"]`)?.focus()}},[e.id]),ce(()=>{if(a>0)x.current?.focus()},[a,e.id]),ce(()=>{if(typeof document>"u")return;let N=(Z)=>{if(Z.key!=="Escape")return;let Ae=f.current;if(!Ae)return;if(Ae.contains(Z.target)||document.activeElement===Ae)Z.preventDefault(),n()};return document.addEventListener("keydown",N),()=>document.removeEventListener("keydown",N)},[n]);let b=ie(async()=>{let N=w.trim();if(!N||m)return;h(!0);let Z=await s(N);if(h(!1),Z)A(""),x.current?.focus()},[w,m,s]),E=ie((N)=>{if((N.metaKey||N.ctrlKey)&&N.key==="Enter")N.preventDefault(),b()},[b]),L=`cm-thread-head-${e.id}`,O=cn(),z=(!Re()||Ue())&&!O,G=wn(e,e.artboard?yn(Kn(e.artboard)):null),D=Hr({artboard:e.artboard,selector:e.selector}),W=e.from,Q=fn(e.importedFrom),ee=(p??"").trim(),oe=W?ee?(W.convertedBy??"").trim()===ee:c:!1,te=W?(e.thread??[]).find((N)=>(N.author??"").trim()!==(ee||(W.convertedBy??"").trim())):void 0,k=te?`${Mr(te.author??"")||"Someone"} replied — resolve the thread instead.`:null,T=!!W&&!Re(),[I,M]=re(!1),K=!!W,[F,j]=re(!1);ce(()=>{if(F)x.current?.focus()},[F]);let[Y,Ee]=re(null),[Te,Me]=re(!1);ce(()=>{if(!W||!oe){Me(!1);return}let N=!0;return Xe({op:"convert-undoable",commentId:e.id}).then((Z)=>{if(N)Me(!!Z?.ok)}),()=>{N=!1}},[e.id,W,oe]);let Oe=async(N)=>{M(!1),Ee(null);let Z=await Xe({op:N,commentId:e.id});if(Z?.ok)n();else Ee(Z?.error||"That did not go through.")};return B("div",{ref:f,className:"cm-thread","data-seq":t,role:"dialog","data-esc-owner":"focus","aria-labelledby":L,tabIndex:-1,onClick:(N)=>N.stopPropagation(),onPointerDown:(N)=>N.stopPropagation(),children:[B("div",{className:"cm-thread__head",id:L,children:[K?null:B("div",{className:"cm-thread__head-row",children:[R("span",{className:"cm-thread__where","data-testid":`comment-where-${e.id}`,children:D}),B("span",{className:"cm-thread__head-end",children:[z?B("span",{className:"cm-thread__actions",children:[c&&S===null&&!Q?R("button",{type:"button",className:"cm-btn","data-testid":"comment-edit",onClick:()=>y(e.text),children:"Edit"}):null,e.status==="resolved"?B("button",{type:"button",className:"cm-btn cm-btn--ghost","data-testid":`comment-reopen-${e.id}`,onClick:()=>o({status:"open"}),children:[R(Qe,{d:"M3.5 8a4.5 4.5 0 1 0 1.4-3.3M3.5 2.5v2.6h2.6"}),"Reopen"]}):B("button",{type:"button",className:"cm-btn cm-btn--ghost","data-testid":`comment-resolve-${e.id}`,onClick:()=>{o({status:"resolved"}),n()},children:[R(Qe,{d:"M3 8.4 6.4 11.8 13 4.6"}),"Resolve"]}),c?R(Bl,{id:e.id,onConfirm:()=>{r(),n()}}):null]}):null,R("button",{type:"button",className:"cm-thread__close","aria-label":"Close thread",title:"Close · esc",onClick:n,children:"×"})]})]}),!K&&G.chip?G.kind==="video"&&typeof e.t==="number"&&e.artboard?R("button",{type:"button",className:"cm-chip cm-chip--seek","data-testid":`comment-chip-${e.id}`,title:"Go to this moment",onClick:()=>Rl(e.artboard,e.t),children:G.chip}):R("span",{className:"cm-chip","data-testid":`comment-chip-${e.id}`,children:G.chip}):null,e.from?B("div",{className:"cm-thread__from","data-testid":`comment-from-${e.id}`,children:[R("svg",{width:"14",height:"14",viewBox:"0 0 16 16","aria-hidden":"true",className:"cm-thread__from-ic",children:R("path",{d:"M3 2.5h10v8l-3 3H3zM10 13.5v-3h3",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinejoin:"round"})}),B("span",{children:[Fo(e.from)," · turned into a comment by"," ",oe?"You":Mr(e.from.convertedBy||e.author||""),oe&&Te&&!k?B(Yl,{children:[" · ",R("button",{type:"button",className:"cm-link","data-testid":`comment-from-undo-${e.id}`,onClick:()=>void Oe("convert-undo"),children:"Undo"})]}):null]})]}):null,Y?R("div",{className:"cm-thread__convert-line",role:"alert",children:Y}):null]}),S===null?B("div",{className:"cm-msg cm-msg--root",children:[Q?R(Ar,{}):R(Nn,{name:e.from?st(e.from).name:e.author,ai:e.from?st(e.from).ai:e.authorKind==="ai",viewer:e.from?p:We(e,p)}),B("div",{className:"cm-msg__main",children:[B("div",{className:"cm-msg__head",children:[R("span",{className:"cm-thread__author","data-testid":Q?`comment-imported-${e.id}`:void 0,children:Q?gn(Q):e.from?st(e.from).name:rt(e.author,We(e,p)).name}),R("span",{className:"cm-thread__time",children:Ir(Q?.at??e.created)})]}),R("div",{className:"cm-thread__body",children:Q?e.text:Cr(e.text)}),e.queued?R(Rr,{id:e.id}):null]})]}):B("div",{className:"cm-thread__reply-form",children:[R(On,{className:"cm-thread__reply-textarea",value:S,placeholder:"Edit your comment… ⌘↵ to save",onChange:y,onKeyDown:(N)=>{if((N.metaKey||N.ctrlKey)&&N.key==="Enter")N.preventDefault(),i()},rows:3,ariaLabel:"Edit comment"}),B("div",{className:"cm-thread__reply-actions",children:[R("button",{type:"button",className:"cm-btn",onClick:()=>y(null),children:"Cancel"}),R("button",{type:"button",className:"cm-btn cm-btn--primary","data-testid":"comment-edit-save",disabled:!S.trim(),onClick:i,children:"Save"})]})]}),(e.thread??[]).map((N)=>{let Z=fn(N.importedFrom);return B("div",{className:"cm-msg cm-thread__reply",children:[Z?R(Ar,{}):R(Nn,{name:N.author,ai:N.authorKind==="ai",viewer:We(N,p)}),B("div",{className:"cm-msg__main",children:[B("div",{className:"cm-thread__reply-head",children:[R("span",{className:"cm-thread__reply-author",children:Z?gn(Z):rt(N.author,We(N,p)).name}),R("span",{className:"cm-thread__reply-time",children:Ir(Z?.at??N.created)})]}),R("div",{className:"cm-thread__reply-body",children:Z?N.body:Cr(N.body)}),N.queued?R(Rr,{id:N.id}):null]})]},N.id)}),K&&z?B("div",{className:"cm-thread__foot","data-testid":`comment-foot-${e.id}`,children:[e.status==="resolved"?B("button",{type:"button",className:"cm-btn cm-btn--ghost","data-testid":`comment-reopen-${e.id}`,onClick:()=>o({status:"open"}),children:[R(Qe,{d:"M3.5 8a4.5 4.5 0 1 0 1.4-3.3M3.5 2.5v2.6h2.6"}),"Reopen"]}):B("button",{type:"button",className:"cm-btn cm-btn--ghost","data-testid":`comment-resolve-${e.id}`,onClick:()=>{o({status:"resolved"}),n()},children:[R(Qe,{d:"M3 8.4 6.4 11.8 13 4.6"}),"Resolve"]}),B("span",{className:"cm-thread__more",children:[R("button",{type:"button",className:"cm-btn cm-btn--icon","aria-label":"More","aria-haspopup":"menu","aria-expanded":I,"data-testid":`comment-menu-${e.id}`,onClick:()=>M((N)=>!N),children:"⋯"}),I?B("span",{className:"cm-thread__menu",role:"menu",children:[R("button",{type:"button",role:"menuitem",className:"cm-thread__menu-item","data-testid":`comment-menu-reply-${e.id}`,onClick:()=>{M(!1),j(!0)},children:"Reply…"}),c&&S===null&&!Q?R("button",{type:"button",role:"menuitem",className:"cm-thread__menu-item","data-testid":"comment-edit",onClick:()=>{M(!1),y(e.text)},children:"Edit"}):null,T?R("button",{type:"button",role:"menuitem",className:"cm-thread__menu-item","data-testid":`comment-menu-to-sticky-${e.id}`,disabled:!!k,onClick:()=>void Oe("to-sticky"),children:"Turn back into a sticky"}):null,c?R("button",{type:"button",role:"menuitem",className:"cm-thread__menu-item cm-thread__menu-item--danger","data-testid":`comment-delete-${e.id}`,onClick:()=>{r(),n()},children:"Delete comment"}):null,k?R("span",{className:"cm-thread__menu-note",children:k}):null]}):null]})]}):null,O&&Ue()?R("p",{className:"cm-thread__paused",role:"status","data-testid":`comment-paused-${e.id}`,children:ot}):null,z&&(!K||F||a>0)&&B("div",{className:"cm-thread__reply-form cm-thread__reply-form--field",children:[R(On,{textareaRef:x,className:"cm-thread__reply-textarea",value:w,placeholder:"Reply…",title:"⌘↵ to send · @name to tag",onChange:A,onKeyDown:E,rows:1,ariaLabel:"Reply",disabled:m}),R("div",{className:"cm-thread__reply-actions",children:R("button",{type:"button",className:"cm-btn cm-btn--primary cm-thread__send","aria-label":"Send",title:"Send · ⌘↵",disabled:!w.trim()||m,onClick:()=>void b(),children:R("svg",{width:"14",height:"14",viewBox:"0 0 16 16","aria-hidden":"true",children:R("path",{d:"M6 3.5 10.5 8 6 12.5",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})})})]})]})}function Mr(e){return e.trim().split(/\s+/)[0]||e}function Ar(){return R("span",{className:"cm-av cm-av--imported","aria-hidden":"true"})}var Ul="M3 4.5h10M6.5 4.5V3h3v1.5M4.5 4.5l.6 8.1a1 1 0 0 0 1 .9h3.8a1 1 0 0 0 1-.9l.6-8.1",Wl=4000;function Bl({id:e,onConfirm:t}){let[n,o]=re(!1);return ce(()=>{if(!n)return;let r=setTimeout(()=>o(!1),Wl);return()=>clearTimeout(r)},[n]),R("button",{type:"button",className:`cm-btn cm-btn--ghost cm-btn--danger cm-btn--trash${n?" is-armed":""}`,"aria-label":n?"Confirm delete comment":"Delete comment",title:n?"Press again to delete":"Delete comment","data-testid":`comment-delete-${e}`,"data-armed":n?"true":void 0,onBlur:()=>o(!1),onKeyDown:(r)=>{if(r.key==="Escape"&&n)r.stopPropagation(),o(!1)},onClick:(r)=>{if(!n)return o(!0);if(r.detail>1)return;o(!1),t()},children:R(Qe,{d:Ul})})}function Rr({id:e}){return B("span",{className:"cm-queued","data-testid":`comment-queued-${e}`,children:[R(Qe,{d:"M8 3.2v5l3 1.8M14 8A6 6 0 1 1 2 8a6 6 0 0 1 12 0Z"}),"Queued — sends when this Mac is online."]})}function Qe({d:e}){return R("svg",{width:"13",height:"13",viewBox:"0 0 16 16","aria-hidden":"true",className:"cm-glyph",children:R("path",{d:e,fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function Nn({name:e,ai:t=!1,viewer:n}){let o=rt(e,n);return R("span",{className:`cm-av${t?" cm-av--ai":""}`,style:t?void 0:{["--cm-av-tone"]:mn(o.tone)},"aria-hidden":"true",children:t?"AI":o.letter})}function Cr(e){if(!e)return null;let t=/(@[\w][\w.-]*)/g;return e.split(t).map((o,r)=>{let s=`${r}:${o}`;if(r%2===1)return R("strong",{"data-mention":"true",children:o},s);return R("span",{children:o},s)})}function Ir(e){if(!e)return"";let t=Date.parse(e);if(!Number.isFinite(t))return"";let n=Math.round((Date.now()-t)/1000);if(n<60)return`${Math.max(n,0)}s ago`;if(n<3600)return`${Math.round(n/60)}m ago`;if(n<86400)return`${Math.round(n/3600)}h ago`;return`${Math.round(n/86400)}d ago`}function Xl(e){let{pos:t}=Vr(e);if(t){if(e.from)return{x:t.x+t.w+8,y:t.y-28};return{x:t.x+t.w-12,y:t.y+16}}return{x:16,y:16}}function Ql(e){if(e.clientX||e.clientY){let t=e.selection.selector?Ln(e.selection):null,n=t&&t.h<=200?Math.max(e.clientY,t.y+t.h):e.clientY;return{x:e.clientX,y:n+8}}if(e.selection.selector){let t=Ln(e.selection);if(t)return{x:t.x,y:t.y+t.h+8}}return{x:16,y:16}}import{useEffect as lc}from"react";function Vn(e){return{role:e.readOnly?"comment":"owner",shell:"browser",mode:e.mode??"edit",focus:e.typing?"text":"canvas",selection:e.selection??"none",facts:new Set([...e.toolArmed?["toolArmed"]:[],...e.selectionHasTakes?["selectionHasTakes"]:[]]),...e.singleKeys===!1?{singleKeys:!1}:{}}}var Kt=["⌃","⌥","⇧","⌘"],zt={Enter:"↵",Return:"↵","↩":"↵",Escape:"esc",Esc:"esc",esc:"esc"," ":"Space",Space:"Space",Spacebar:"Space",ArrowLeft:"←",ArrowRight:"→",ArrowUp:"↑",ArrowDown:"↓",Backspace:"⌫",Delete:"⌦",Del:"⌦",Tab:"tab",tab:"tab",Home:"Home",End:"End",PageUp:"PageUp",PageDown:"PageDown","-":"−","–":"−"},Fr=new Set(["↵","esc","Space","tab","⌫","⌦","←","→","↑","↓","Home","End","PageUp","PageDown"]),Gl={cmd:"⌘",command:"⌘",meta:"⌘",ctrl:"⌃",control:"⌃",alt:"⌥",opt:"⌥",option:"⌥",shift:"⇧"};function Zl(e){if(e===" ")return"Space";let t=String(e).trim();if(!t||/\b(click|hover|drag|scroll)\b/i.test(t))return null;let n=new Set;t=t.replace(/\b(cmd|command|meta|ctrl|control|alt|opt|option|shift)\s*\+\s*/gi,(r,s)=>(n.add(Gl[s.toLowerCase()]),""));for(;;){t=t.replace(/^\s+/,"");let r=Kt.find((s)=>t.startsWith(s));if(!r||t.trim().length===r.length)break;n.add(r),t=t.slice(r.length)}let o=t.trim();if(zt[o])o=zt[o];else if(/^[a-z]$/i.test(o))o=o.toUpperCase();else if(/^f\d{1,2}$/i.test(o))o=o.toUpperCase();if(!o)return null;return Kt.filter((r)=>n.has(r)).join("")+o}function $r(e){let t=Zl(e);if(!t)throw Error(`actions/keys: '${e}' is not a key chord`);return t}var Jl={Minus:"−",Equal:"=",Slash:"/",Backslash:"\\",BracketLeft:"[",BracketRight:"]",Comma:",",Period:".",Semicolon:";",Quote:"'",Backquote:"`",Space:"Space"};function Hn(e){let t=new Set;if(e.metaKey||e.ctrlKey)t.add("⌘");if(e.altKey)t.add("⌥");let n=e.key??"";if(zt[n])n=zt[n];else if(/^F\d{1,2}$/.test(n));else if(/^[\x21-\x7e]$/.test(n)){if(/^[a-z]$/i.test(n))n=n.toUpperCase();else if(n==="/"&&e.shiftKey&&e.code==="Slash"&&!e.altKey)n="?"}else if(e.code){let s=/^Key([A-Z])$/.exec(e.code)??/^Digit(\d)$/.exec(e.code);n=s?s[1]:Jl[e.code]??n}let o=e.shiftKey&&t.size===0?/^Digit(\d)$/.exec(e.code??""):null;if(o)n=o[1];let r=!!o||/^[A-Z]$/.test(n)||Fr.has(n)||/^F\d/.test(n);if(e.shiftKey&&r)t.add("⇧");return Kt.filter((s)=>t.has(s)).join("")+n}function qr(e){let{mods:t,key:n}=ec(e);if(t.some((o)=>o!=="⇧"))return!1;if(Fr.has(n)||/^F\d{1,2}$/.test(n))return!1;return n.length===1}function jr(e){return e.includes("⌘")||e.includes("⌃")}function ec(e){let t=[],n=e;for(;;){let o=Kt.find((r)=>n.startsWith(r)&&n.length>r.length);if(!o)break;t.push(o),n=n.slice(o.length)}return{mods:t,key:n}}var Ur=new Set(["⌘Z","⇧⌘Z","⌘Y","⌘A","⌘C","⌘X","⌘V","⇧⌘V","⌥⇧⌘V","⌘B","⌘I","⌘U","⌘←","⌘→","⌘↑","⌘↓","⇧⌘←","⇧⌘→","⌥←","⌥→","⌘⌫","⌥⌫"].map($r)),Cp=new Set(["⌘N","⇧⌘N","⌘T","⌘W","⌘Q","⌘L"].map($r));var Fn={view:0,comment:1,edit:2,owner:3},Wr=["timeline","selection","tools","global"];function $n(e,t){if(!e)return!0;if(e.minRole&&Fn[t.role]<Fn[e.minRole])return!1;if(e.shell&&!e.shell.includes(t.shell))return!1;if(e.notShell?.includes(t.shell))return!1;if(e.mode&&!e.mode.includes(t.mode))return!1;if(e.focus&&!e.focus.includes(t.focus))return!1;if(e.selection&&!e.selection.includes(t.selection))return!1;if(e.facts&&!e.facts.every((n)=>t.facts.has(n)))return!1;if(e.notFacts?.some((n)=>t.facts.has(n)))return!1;if(e.any&&!e.any.some((n)=>$n(n,t)))return!1;return!0}function tc(e,t){return $n(e.visible,t)}function Br(e,t=()=>!0){let n=new Map;for(let o of e)for(let r of o.keys??[]){if(!t(o,r))continue;let s=n.get(r.chord)??[];s.push({action:o,binding:r}),n.set(r.chord,s)}return n}function nc(e){return e.inText??(jr(e.chord)&&!Ur.has(e.chord))}function oc(e,t){if(t.focus==="text"&&!nc(e.binding))return!1;if(t.focus==="modal"&&!e.binding.inModal)return!1;if(e.binding.layer==="timeline"&&t.focus!=="timeline")return!1;return tc(e.action,t)&&$n(e.binding.when,t)}function qn(e,t,n,o="tap"){if(n.singleKeys===!1&&qr(t))return null;let r=e.get(t);if(!r?.length)return null;let s=r.filter((a)=>o==="hold"===!!a.binding.hold&&oc(a,n));if(!s.length)return null;for(let a of Wr){let c=s.filter((p)=>p.binding.layer===a);if(c.length)return{action:c[0].action,binding:c[0].binding,ambiguous:c.slice(1)}}return null}function rc(e,t){let n=e.when?.focus;if(t==="shell")return e.layer==="timeline"||!n||n.some((o)=>o==="chrome"||o==="timeline"||o==="modal");return e.layer!=="timeline"&&(!n||n.includes("canvas"))}function Xr(e,t,n){return Br(e,(o,r)=>n(o.id)&&rc(r,t))}var Vt=[{id:"search.open",exec:"shell",fromCanvas:!0,keys:[{chord:"⌘K",layer:"global",inText:!0,when:{notShell:["home"]}}]},{id:"canvas.new",exec:"shell",visible:{minRole:"edit"},keys:[{chord:"⌘N",layer:"global",inText:!0,when:{shell:["desktop"]}}]},{id:"canvas.reload",exec:"shell",fromCanvas:!0,keys:[{chord:"⌘R",layer:"global",inText:!0}]},{id:"edit.undo",exec:"canvas",enabled:{minRole:"edit"},keys:[{chord:"⌘Z",layer:"global",when:{focus:["canvas"]}}]},{id:"edit.redo",exec:"canvas",enabled:{minRole:"edit"},keys:[{chord:"⇧⌘Z",layer:"global",when:{focus:["canvas"]}},{chord:"⌘Y",layer:"global",alias:!0,when:{focus:["canvas"]}}]},{id:"select.all",exec:"canvas",visible:{minRole:"comment"},keys:[{chord:"⌘A",layer:"selection",when:{focus:["canvas"]}}]},{id:"select.all-annotations",exec:"canvas",visible:{minRole:"edit"},keys:[{chord:"⇧⌘A",layer:"global",inText:!1,when:{focus:["canvas"]}}]},{id:"object.duplicate",exec:"canvas",keys:[{chord:"⌘D",layer:"selection",when:{focus:["canvas"],selection:["object"]}}]},{id:"object.copy",exec:"canvas",enabled:{minRole:"edit",selection:["object"]},keys:[{chord:"⌘C",layer:"selection",when:{focus:["canvas"],mode:["edit"],selection:["object"]}}]},{id:"object.cut",exec:"canvas",enabled:{minRole:"edit",selection:["object"]},keys:[{chord:"⌘X",layer:"selection",when:{focus:["canvas"],mode:["edit"],selection:["object"]}}]},{id:"artboard.copy",exec:"canvas",enabled:{minRole:"edit",selection:["artboard"]},keys:[{chord:"⌘C",layer:"selection",when:{focus:["canvas"],mode:["edit"],selection:["artboard"]}}]},{id:"edit.copy-properties",exec:"canvas",visible:{minRole:"comment"},keys:[{chord:"⌥⌘C",layer:"selection",when:{focus:["canvas"],selection:["object"]}},{chord:"⌥⇧⌘C",layer:"selection",when:{focus:["canvas"],selection:["object"]},alias:!0}]},{id:"edit.paste-properties",exec:"canvas",visible:{minRole:"comment"},enabled:{minRole:"edit"},keys:[{chord:"⌥⌘V",layer:"selection",when:{focus:["canvas"],selection:["object"]}},{chord:"⌥⇧⌘V",layer:"selection",when:{focus:["canvas"],selection:["object"]},alias:!0}]},{id:"object.enter",exec:"canvas",keys:[{chord:"↵",layer:"selection",when:{focus:["canvas"],mode:["edit"],selection:["object"],notFacts:["toolArmed"]}}]},{id:"object.select-parent",exec:"canvas",keys:[{chord:"⇧↵",layer:"selection",when:{focus:["canvas"],selection:["object"]}}]},{id:"object.select-next",exec:"canvas",keys:[{chord:"tab",layer:"selection",when:{focus:["canvas"],mode:["edit"]}}]},{id:"object.select-prev",exec:"canvas",keys:[{chord:"⇧tab",layer:"selection",when:{focus:["canvas"],mode:["edit"]}}]},{id:"object.remove",exec:"canvas",keys:[{chord:"⌫",layer:"selection",when:{focus:["canvas"],selection:["object"]}},{chord:"⇧⌫",layer:"selection",when:{focus:["canvas"],selection:["object"]},alias:!0},{chord:"⌦",layer:"selection",when:{focus:["canvas"],selection:["object"]}},{chord:"⇧⌦",layer:"selection",when:{focus:["canvas"],selection:["object"]},alias:!0}]},{id:"object.nudge",exec:"canvas",keys:[{chord:"←",layer:"selection",when:{focus:["canvas"],selection:["object","artboard"],notFacts:["selectionHasTakes"]}},{chord:"⇧←",layer:"selection",when:{focus:["canvas"],selection:["object","artboard"]},alias:!0},{chord:"→",layer:"selection",when:{focus:["canvas"],selection:["object","artboard"],notFacts:["selectionHasTakes"]}},{chord:"⇧→",layer:"selection",when:{focus:["canvas"],selection:["object","artboard"]},alias:!0},{chord:"↑",layer:"selection",when:{focus:["canvas"],selection:["object","artboard"]}},{chord:"⇧↑",layer:"selection",when:{focus:["canvas"],selection:["object","artboard"]},alias:!0},{chord:"↓",layer:"selection",when:{focus:["canvas"],selection:["object","artboard"]}},{chord:"⇧↓",layer:"selection",when:{focus:["canvas"],selection:["object","artboard"]},alias:!0}]},{id:"object.frame",exec:"canvas",enabled:{minRole:"edit",selection:["object"]},keys:[{chord:"⌥⌘G",layer:"selection",when:{focus:["canvas"],mode:["edit"],selection:["object"]}},{chord:"⌘G",layer:"selection",when:{focus:["canvas"],mode:["edit"],selection:["object"]},alias:!0}]},{id:"object.unframe",exec:"canvas",enabled:{minRole:"edit",selection:["object"]},keys:[{chord:"⇧⌘G",layer:"selection",when:{focus:["canvas"],mode:["edit"],selection:["object"]}}]},{id:"object.bring-front",exec:"canvas",enabled:{minRole:"edit",selection:["object"]},keys:[{chord:"⌘]",layer:"selection",when:{focus:["canvas"],mode:["edit"],selection:["object"]}}]},{id:"object.bring-forward",exec:"canvas",enabled:{minRole:"edit",selection:["object"]},keys:[{chord:"]",layer:"selection",when:{focus:["canvas"],mode:["edit"],selection:["object"]}}]},{id:"object.send-backward",exec:"canvas",enabled:{minRole:"edit",selection:["object"]},keys:[{chord:"[",layer:"selection",when:{focus:["canvas"],mode:["edit"],selection:["object"]}}]},{id:"object.send-back",exec:"canvas",enabled:{minRole:"edit",selection:["object"]},keys:[{chord:"⌘[",layer:"selection",when:{focus:["canvas"],mode:["edit"],selection:["object"]}}]},{id:"object.lock",exec:"canvas",enabled:{minRole:"edit",selection:["object"]},keys:[{chord:"⇧⌘L",layer:"selection",when:{focus:["canvas"],mode:["edit"],selection:["object"]}}]},{id:"artboard.duplicate",exec:"canvas",enabled:{minRole:"edit",selection:["artboard"]},keys:[{chord:"⌘D",layer:"selection",when:{focus:["canvas"],mode:["edit"],selection:["artboard"]}}]},{id:"artboard.trash",exec:"canvas",enabled:{minRole:"edit",selection:["artboard"]},keys:[{chord:"⌫",layer:"selection",when:{focus:["canvas"],selection:["artboard"]}},{chord:"⇧⌫",layer:"selection",when:{focus:["canvas"],selection:["artboard"]},alias:!0},{chord:"⌦",layer:"selection",when:{focus:["canvas"],selection:["artboard"]}},{chord:"⇧⌦",layer:"selection",when:{focus:["canvas"],selection:["artboard"]},alias:!0}]},{id:"ai.ask-selection",exec:"canvas",visible:{minRole:"edit"},enabled:{minRole:"edit",selection:["object"]},keys:[{chord:"⌘/",layer:"selection",when:{focus:["canvas"],mode:["edit"],selection:["object"]}}]},{id:"inspect.edit",exec:"canvas",enabled:{minRole:"edit",mode:["preview","viewing"],selection:["object"]},keys:[{chord:"↵",layer:"selection",when:{focus:["canvas"],mode:["preview","viewing"],selection:["object"]}}]},{id:"mode.preview",exec:"canvas",keys:[{chord:"⌥⌘P",layer:"global",inText:!0,when:{mode:["edit","preview","viewing"]}}]},{id:"view.panels",exec:"shell",fromCanvas:!0,keys:[{chord:"⌘\\",layer:"global",inText:!0}]},{id:"view.comments",exec:"shell",fromCanvas:!0,keys:[{chord:"⇧⌘M",layer:"global",inText:!0}]},{id:"history.open",exec:"shell",fromCanvas:!0,keys:[{chord:"⌥⌘H",layer:"global",inText:!0}]},{id:"view.inspector",exec:"shell",fromCanvas:!0,keys:[{chord:"⇧⌘I",layer:"global",inText:!0}]},{id:"view.timeline-keep-open",exec:"shell",fromCanvas:!0,keys:[{chord:"⇧⌘T",layer:"global",inText:!0}]},{id:"view.annotations",exec:"canvas",keys:[{chord:"⇧P",layer:"global",inText:!1,when:{focus:["canvas"]}}]},{id:"present.from-selection",exec:"shell",fromCanvas:!0,keys:[{chord:"⌥⌘↵",layer:"global",when:{mode:["edit","viewing","preview"]}}]},{id:"present.from-start",exec:"shell",fromCanvas:!0,keys:[{chord:"⌥⇧⌘↵",layer:"global",when:{mode:["edit","viewing","preview"]}}]},{id:"present.next",exec:"shell",keys:[{chord:"→",layer:"global",when:{mode:["present"]}},{chord:"Space",layer:"global",when:{mode:["present"]}}]},{id:"present.prev",exec:"shell",keys:[{chord:"←",layer:"global",when:{mode:["present"]}},{chord:"⇧Space",layer:"global",when:{mode:["present"]}}]},{id:"view.zoom-in",exec:"canvas",keys:[{chord:"⌘=",layer:"global",inText:!0,when:{focus:["canvas","text"]}},{chord:"⌘+",layer:"global",inText:!0,alias:!0,when:{focus:["canvas","text"]}}]},{id:"view.zoom-out",exec:"canvas",keys:[{chord:"⌘−",layer:"global",inText:!0,when:{focus:["canvas","text"]}}]},{id:"view.zoom-fit",exec:"canvas",keys:[{chord:"⌘0",layer:"global",inText:!0,when:{focus:["canvas","text"]}}]},{id:"view.zoom-actual",exec:"canvas",keys:[{chord:"⇧0",layer:"global",inText:!1,when:{focus:["canvas","text"]}}]},{id:"view.jump-artboard",exec:"canvas",keys:[{chord:"⌥⌘1",layer:"global",inText:!0,alias:!1,when:{focus:["canvas","text"]}},{chord:"⌥⌘2",layer:"global",inText:!0,alias:!0,when:{focus:["canvas","text"]}},{chord:"⌥⌘3",layer:"global",inText:!0,alias:!0,when:{focus:["canvas","text"]}},{chord:"⌥⌘4",layer:"global",inText:!0,alias:!0,when:{focus:["canvas","text"]}},{chord:"⌥⌘5",layer:"global",inText:!0,alias:!0,when:{focus:["canvas","text"]}},{chord:"⌥⌘6",layer:"global",inText:!0,alias:!0,when:{focus:["canvas","text"]}},{chord:"⌥⌘7",layer:"global",inText:!0,alias:!0,when:{focus:["canvas","text"]}},{chord:"⌥⌘8",layer:"global",inText:!0,alias:!0,when:{focus:["canvas","text"]}},{chord:"⌥⌘9",layer:"global",inText:!0,alias:!0,when:{focus:["canvas","text"]}}]},{id:"tool.select",exec:"canvas",keys:[{chord:"V",layer:"tools",when:{focus:["canvas","chrome"],mode:["edit"]}}]},{id:"tool.hand",exec:"canvas",keys:[{chord:"H",layer:"tools",when:{focus:["canvas","chrome"],mode:["edit","preview"]}}]},{id:"tool.frame",exec:"canvas",keys:[{chord:"F",layer:"tools",when:{focus:["canvas","chrome"],mode:["edit","preview","viewing"]}}]},{id:"tool.el-shape",exec:"canvas",keys:[{chord:"R",layer:"tools",when:{focus:["canvas","chrome"],mode:["edit"]}}]},{id:"tool.el-pen",exec:"canvas",keys:[{chord:"P",layer:"tools",when:{focus:["canvas","chrome"],mode:["edit","preview","viewing"]}}]},{id:"tool.el-text",exec:"canvas",keys:[{chord:"T",layer:"tools",when:{focus:["canvas","chrome"],mode:["edit"]}}]},{id:"tool.image",exec:"canvas",keys:[{chord:"I",layer:"tools",when:{focus:["canvas","chrome"],mode:["edit","preview","viewing"]}}]},{id:"tool.components",exec:"canvas",keys:[{chord:"⇧I",layer:"tools",when:{focus:["canvas","chrome"],mode:["edit","preview","viewing"]}}]},{id:"tool.browse",exec:"canvas",keys:[{chord:"V",layer:"tools",when:{focus:["canvas","chrome"],mode:["preview","viewing"]}}]},{id:"tool.sticky",exec:"canvas",keys:[{chord:"N",layer:"tools",when:{focus:["canvas","chrome"],mode:["edit","preview","viewing"]}}]},{id:"tool.comment",exec:"canvas",keys:[{chord:"C",layer:"tools",when:{focus:["canvas","chrome"],mode:["edit","preview","viewing"]}}]},{id:"tool.pen",exec:"canvas",keys:[{chord:"M",layer:"tools",when:{focus:["canvas","chrome"],mode:["edit","preview","viewing"]}}]},{id:"tool.arrow",exec:"canvas",keys:[{chord:"A",layer:"tools",when:{focus:["canvas","chrome"],mode:["edit","preview","viewing"]}}]},{id:"tool.shape",exec:"canvas",keys:[{chord:"R",layer:"tools",when:{focus:["canvas","chrome"],mode:["preview","viewing"]}}]},{id:"tool.text",exec:"canvas",keys:[{chord:"T",layer:"tools",when:{focus:["canvas","chrome"],mode:["preview","viewing"]}}]},{id:"tool.stickers",exec:"canvas",keys:[{chord:"E",layer:"tools",when:{focus:["canvas","chrome"],mode:["edit","preview","viewing"]}}]},{id:"tool.section",exec:"canvas",keys:[{chord:"S",layer:"tools",when:{focus:["canvas","chrome"],mode:["edit","preview","viewing"]}}]},{id:"tool.inspect",exec:"canvas",keys:[{chord:"H",layer:"tools",when:{focus:["canvas","chrome"],mode:["viewing"]}}]},{id:"tool.pointer",exec:"canvas",keys:[{chord:"L",layer:"tools",when:{focus:["canvas","chrome"],mode:["present"]}}]},{id:"tool.hand-hold",exec:"canvas",keys:[{chord:"Space",layer:"tools",hold:!0,when:{focus:["canvas"]}},{chord:"⌥Space",layer:"tools",hold:!0,when:{focus:["canvas"]},alias:!0},{chord:"⇧Space",layer:"tools",hold:!0,when:{focus:["canvas"]},alias:!0},{chord:"⌥⇧Space",layer:"tools",hold:!0,when:{focus:["canvas"]},alias:!0},{chord:"⌘Space",layer:"tools",hold:!0,when:{focus:["canvas"]},alias:!0},{chord:"⌥⌘Space",layer:"tools",hold:!0,when:{focus:["canvas"]},alias:!0},{chord:"⇧⌘Space",layer:"tools",hold:!0,when:{focus:["canvas"]},alias:!0},{chord:"⌥⇧⌘Space",layer:"tools",hold:!0,when:{focus:["canvas"]},alias:!0}]},{id:"tool.create-default",exec:"canvas",enabled:{minRole:"edit"},keys:[{chord:"↵",layer:"tools",when:{focus:["canvas"],mode:["edit","preview"],facts:["toolArmed"]}}]},{id:"ui.step-back",exec:"shell",keys:[{chord:"esc",layer:"selection",inText:!1,when:{focus:["canvas"]}},{chord:"⌥esc",layer:"selection",inText:!1,when:{focus:["canvas"]},alias:!0},{chord:"⇧esc",layer:"selection",inText:!1,when:{focus:["canvas"]},alias:!0},{chord:"⌥⇧esc",layer:"selection",inText:!1,when:{focus:["canvas"]},alias:!0},{chord:"⌘esc",layer:"selection",inText:!1,when:{focus:["canvas"]},alias:!0},{chord:"⌥⌘esc",layer:"selection",inText:!1,when:{focus:["canvas"]},alias:!0},{chord:"⇧⌘esc",layer:"selection",inText:!1,when:{focus:["canvas"]},alias:!0},{chord:"⌥⇧⌘esc",layer:"selection",inText:!1,when:{focus:["canvas"]},alias:!0}]},{id:"ui.cycle-region",exec:"shell",fromCanvas:!0,keys:[{chord:"F6",layer:"global",inText:!0},{chord:"⇧F6",layer:"global",inText:!0,alias:!0}]},{id:"timeline.split",exec:"shell",keys:[{chord:"⌘B",layer:"global",when:{facts:["timelineVisible"]},inText:!1,alias:!0}]},{id:"export.open",exec:"shell",visible:{minRole:"comment"},fromCanvas:!0,keys:[{chord:"⇧⌘E",layer:"global",inText:!0}]},{id:"export.copy-png",exec:"shell",visible:{minRole:"comment"},enabled:{facts:["canvasOpen"]},fromCanvas:!0,keys:[{chord:"⇧⌘C",layer:"selection",inText:!1,when:{selection:["artboard","object","video-artboard","generated-image"]}}]},{id:"handoff.open",exec:"shell",visible:{minRole:"comment"},enabled:{minRole:"edit",facts:["canvasOpen"]},fromCanvas:!0,keys:[{chord:"⇧⌘H",layer:"global",inText:!0}]},{id:"settings.open",exec:"shell",fromCanvas:!0,keys:[{chord:"⌘,",layer:"global",inText:!0,when:{focus:["chrome","timeline","text","canvas"]}}]},{id:"help.shortcuts",exec:"shell",fromCanvas:!0,keys:[{chord:"?",layer:"global",inText:!1,when:{focus:["chrome","timeline","canvas"],notFacts:["rangeFocused"]}},{chord:"⌘?",layer:"global",inText:!1,alias:!0,when:{focus:["chrome","timeline","canvas"],notFacts:["rangeFocused"]}}]},{id:"annotation.group",exec:"canvas",keys:[{chord:"⌘G",layer:"selection",when:{focus:["canvas"],selection:["annotation"],mode:["preview"]}}]},{id:"annotation.ungroup",exec:"canvas",keys:[{chord:"⇧⌘G",layer:"selection",when:{focus:["canvas"],selection:["annotation"],mode:["preview"]}}]},{id:"annotation.lock",exec:"canvas",keys:[{chord:"⇧⌘L",layer:"selection",when:{focus:["canvas"],selection:["annotation"],mode:["preview"]}}]},{id:"annotation.duplicate",exec:"canvas",keys:[{chord:"⌘D",layer:"selection",when:{focus:["canvas"],selection:["annotation"]}}]},{id:"annotation.to-front",exec:"canvas",keys:[{chord:"]",layer:"selection",when:{focus:["canvas"],selection:["annotation"],mode:["preview"]}}]},{id:"annotation.forward",exec:"canvas",keys:[{chord:"⌘]",layer:"selection",when:{focus:["canvas"],selection:["annotation"],mode:["preview"]}}]},{id:"annotation.to-back",exec:"canvas",keys:[{chord:"[",layer:"selection",when:{focus:["canvas"],selection:["annotation"],mode:["preview"]}}]},{id:"annotation.backward",exec:"canvas",keys:[{chord:"⌘[",layer:"selection",when:{focus:["canvas"],selection:["annotation"],mode:["preview"]}}]},{id:"annotation.copy",exec:"canvas",keys:[{chord:"⌘C",layer:"selection",when:{focus:["canvas"],selection:["annotation"]}}]},{id:"annotation.cut",exec:"canvas",keys:[{chord:"⌘X",layer:"selection",when:{focus:["canvas"],selection:["annotation"]}}]},{id:"annotation.chain",exec:"canvas",keys:[{chord:"⌘↵",layer:"selection",when:{focus:["canvas"],selection:["annotation"]}}]},{id:"annotation.edit-text",exec:"canvas",keys:[{chord:"↵",layer:"selection",when:{focus:["canvas"],selection:["annotation"]}}]},{id:"annotation.nudge",exec:"canvas",keys:[{chord:"←",layer:"selection",when:{focus:["canvas"],selection:["annotation"]}},{chord:"⇧←",layer:"selection",when:{focus:["canvas"],selection:["annotation"]},alias:!0},{chord:"→",layer:"selection",when:{focus:["canvas"],selection:["annotation"]}},{chord:"⇧→",layer:"selection",when:{focus:["canvas"],selection:["annotation"]},alias:!0},{chord:"↑",layer:"selection",when:{focus:["canvas"],selection:["annotation"]}},{chord:"⇧↑",layer:"selection",when:{focus:["canvas"],selection:["annotation"]},alias:!0},{chord:"↓",layer:"selection",when:{focus:["canvas"],selection:["annotation"]}},{chord:"⇧↓",layer:"selection",when:{focus:["canvas"],selection:["annotation"]},alias:!0}]},{id:"annotation.remove",exec:"canvas",keys:[{chord:"⌫",layer:"selection",when:{focus:["canvas"],selection:["annotation"]}},{chord:"⇧⌫",layer:"selection",when:{focus:["canvas"],selection:["annotation"]},alias:!0},{chord:"⌦",layer:"selection",when:{focus:["canvas"],selection:["annotation"]}},{chord:"⇧⌦",layer:"selection",when:{focus:["canvas"],selection:["annotation"]},alias:!0}]},{id:"annotation.ask-ai",exec:"canvas",enabled:{minRole:"edit",selection:["annotation"]},keys:[{chord:"⌘/",layer:"selection",when:{focus:["canvas"],selection:["annotation"],mode:["preview"]}}]},{id:"project.new",exec:"shell",visible:{minRole:"comment"},keys:[{chord:"⇧⌘N",layer:"global",inText:!0,when:{shell:["desktop"]}}]},{id:"project.open",exec:"native",visible:{minRole:"comment"},keys:[{chord:"⌘O",layer:"global",inText:!0,when:{shell:["desktop"]}}]},{id:"home.open",exec:"native",keys:[{chord:"⌘T",layer:"global",inText:!0,when:{shell:["desktop"]}}]},{id:"home.search",exec:"shell",visible:{shell:["home"]},keys:[{chord:"⌘K",layer:"global",inText:!0,when:{shell:["home"]}}]},{id:"tab.close",exec:"native",keys:[{chord:"⌘W",layer:"global",inText:!0,when:{shell:["desktop"]}}]},{id:"tab.next",exec:"native",keys:[{chord:"⌃tab",layer:"global",inText:!0,when:{shell:["desktop"]}},{chord:"⇧⌘]",layer:"global",inText:!0,alias:!0,when:{shell:["desktop"]}}]},{id:"tab.prev",exec:"native",keys:[{chord:"⌃⇧tab",layer:"global",inText:!0,when:{shell:["desktop"]}},{chord:"⇧⌘[",layer:"global",inText:!0,alias:!0,when:{shell:["desktop"]}}]},{id:"tab.overview",exec:"native",keys:[{chord:"⇧⌘\\",layer:"global",inText:!0,when:{shell:["desktop"]}}]},{id:"tab.select-1",exec:"native",keys:[{chord:"⌘1",layer:"global",inText:!0,when:{shell:["desktop"]}}]},{id:"tab.select-2",exec:"native",keys:[{chord:"⌘2",layer:"global",inText:!0,when:{shell:["desktop"]}}]},{id:"tab.select-3",exec:"native",keys:[{chord:"⌘3",layer:"global",inText:!0,when:{shell:["desktop"]}}]},{id:"tab.select-4",exec:"native",keys:[{chord:"⌘4",layer:"global",inText:!0,when:{shell:["desktop"]}}]},{id:"tab.select-5",exec:"native",keys:[{chord:"⌘5",layer:"global",inText:!0,when:{shell:["desktop"]}}]},{id:"tab.select-6",exec:"native",keys:[{chord:"⌘6",layer:"global",inText:!0,when:{shell:["desktop"]}}]},{id:"tab.select-7",exec:"native",keys:[{chord:"⌘7",layer:"global",inText:!0,when:{shell:["desktop"]}}]},{id:"tab.select-8",exec:"native",keys:[{chord:"⌘8",layer:"global",inText:!0,when:{shell:["desktop"]}}]},{id:"tab.select-last",exec:"native",keys:[{chord:"⌘9",layer:"global",inText:!0,when:{shell:["desktop"]}}]}];function Qr(e){let t=new Set(e);return Xr(Vt,"canvas",(n)=>t.has(n))}var Up=Object.freeze({edit:["stroke","selection","tool"],preview:["stroke","tool","selection"],viewing:["stroke","tool","selection"],present:[]}),Wp=Object.freeze({edit:"stay",preview:"stay",viewing:"stay",present:"back"}),Yr="data-esc-owner";function Gr(e){let t=e?.querySelectorAll?.(`[${Yr}]`);if(!t)return!1;for(let n of Array.from(t)){if(n.getAttribute(Yr)!=="focus")return!0;let o=e?.activeElement??null;if(o&&(n===o||n.contains(o)))return!0}return!1}var sc=["pen","highlighter","eraser"],ic=Symbol.for("maude.markerTip.v2"),ac=(e)=>typeof e==="string"&&sc.includes(e);function Zr(){let e=globalThis[ic];return ac(e)?e:"pen"}function Jr(e){let t=(n)=>Number.isFinite(n)?Math.max(0,Math.round(n)):0;return{x:t(e.left),y:t(e.top),w:t(e.width),h:t(e.height)}}function jn(e,t){let n=null;if(t){let o=Jr(t.getBoundingClientRect());n=o.w>0&&o.h>0?o:null}return{dgn:"tool-panel-open",panel:e,anchor:n}}var es=!1,ts=!1;function Un(e=globalThis.document){if(es=!0,ts||!e)return;ts=!0,e.addEventListener("pointerdown",()=>{es=!1},!0)}function ns(e,t){try{if(typeof window>"u"||window.parent===window)return;Un(),window.parent.postMessage(jn(e,t),"*")}catch{}}function os(e,t){return t==="section"&&e!=="section"?"templates":null}var cc=new Set(["pen","highlighter","shape","rect","ellipse","arrow","sticky","text","el-text","frame","el-shape","line","polygon","slice","el-pen","section","eraser"]);function us(e){return cc.has(e)}var ps={"ui.step-back":{kind:"escape"},"edit.undo":{kind:"undo"},"edit.redo":{kind:"redo"}},dc=Qr(Vt.filter((e)=>e.id.startsWith("tool.")&&e.id!=="tool.hand-hold"||e.id==="mode.preview").map((e)=>e.id).concat(Object.keys(ps))),uc=new Set([...Xt,"el-text","frame","el-shape","ellipse","line","polygon","slice","el-pen","crop","inspect"]),rs=(e)=>lo(e,(t)=>uc.has(t));function pc(e,t,n){let o=!!n.mode;if(!o&&e==="V")return{kind:"tool",tool:"move"};let r=co(t,e,n.caps??ro,n.markerTip??"pen");if(!r)return{kind:"no-op"};if(r.kind==="insert")return{kind:"insert",insert:r.insert};if(r.kind==="panel")return{kind:"panel",panel:r.panel};if(r.kind==="arm"){let a=rs(r.tool);return a?{kind:"tool",tool:a}:{kind:"no-op"}}if(o){if(r.kind==="deny"&&r.panel)return{kind:"panel",panel:r.panel};let a={kind:"mode-request",mode:r.mode,cause:"key"};if(r.tool)a.tool=r.tool;if(r.kind==="request"&&r.panel)a.panel=r.panel;return a}if(r.kind==="request"&&r.panel)return{kind:"panel",panel:r.panel};let s=rs(r.tool??Je[r.mode].rest);return s?{kind:"tool",tool:s}:{kind:"no-op"}}function mc(e){let t=Hn({key:e.key??"",code:e.code,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,shiftKey:e.shiftKey}),n=e.mode??null,o=n??(e.activeTool==="browse"?"preview":"edit"),r=qn(dc,t,Vn({typing:!!e.isEditable,readOnly:!1,mode:o,singleKeys:e.singleKeys}));if(!r)return{kind:"no-op"};let s=r.action.id;if(s==="mode.preview"){if(n)return{kind:"mode-request",mode:n==="preview"?"back":"preview",cause:"key"};return{kind:"tool",tool:e.activeTool==="browse"?"move":"browse"}}if(s.startsWith("tool."))return pc(r.binding.chord,o,e);let a=ps[s];if(!a)return{kind:"no-op"};if(a.kind==="escape"&&n&&!dn()){if(Zt(n,e.activeTool)==="back")return{kind:"escape",back:!0};if(Do())return{kind:"escape",back:!0}}return{...a}}var at=(e)=>!!(e.metaKey||e.ctrlKey);function ss(e){if(!us(e.activeTool))return!1;return!e.mode||pt(e.mode,"annotations-editable")}function lt(e){if(e.type==="keydown")return mc(e);if(e.type==="contextmenu")return{kind:"context-menu",clientX:e.clientX??0,clientY:e.clientY??0};if(e.type==="pointermove"){if(ss(e))return{kind:"no-op"};if(e.activeTool==="hand")return{kind:"no-op"};if(e.activeTool==="browse"){if(!at(e))return{kind:"no-op"};return{kind:"hover",deep:!0,clientX:e.clientX??0,clientY:e.clientY??0}}if(e.activeTool==="inspect")return{kind:"hover",deep:!0,clientX:e.clientX??0,clientY:e.clientY??0};if(e.activeTool==="comment")return{kind:"hover",deep:!0,clientX:e.clientX??0,clientY:e.clientY??0};return{kind:"hover",deep:at(e),clientX:e.clientX??0,clientY:e.clientY??0}}if(e.type==="pointerdown"){if(e.button===2)return{kind:"context-menu",clientX:e.clientX??0,clientY:e.clientY??0};if(e.button===1||e.spaceHeld)return{kind:"no-op"};if(e.button!==0)return{kind:"no-op"};if(ss(e)&&!at(e))return{kind:"no-op"};if(e.activeTool==="comment")return{kind:"drop-comment",clientX:e.clientX??0,clientY:e.clientY??0};if(e.activeTool==="hand")return{kind:"no-op"};if(e.activeTool==="inspect")return{kind:"select",mode:"replace",deep:!0,clientX:e.clientX??0,clientY:e.clientY??0};if(e.activeTool==="browse"){if(!at(e)){if(e.previewLabel)return{kind:"select",mode:e.shiftKey?"add":"replace",deep:!1,clientX:e.clientX??0,clientY:e.clientY??0};return{kind:"no-op"}}return{kind:"select",mode:e.shiftKey?"add":"replace",deep:!0,clientX:e.clientX??0,clientY:e.clientY??0}}let t=at(e);return{kind:"select",mode:!!e.shiftKey?"add":"replace",deep:t,clientX:e.clientX??0,clientY:e.clientY??0}}return{kind:"no-op"}}function Ht(e){if(!e||!e.tagName)return!1;let t=e,n=t.tagName;if(n==="INPUT"||n==="TEXTAREA"||n==="SELECT")return!0;if(t.isContentEditable)return!0;let o=t.getAttribute?.("contenteditable");if(o==="true"||o==="plaintext-only"||o==="")return!0;return!1}function ct(e){if(!e||!e.closest)return!1;let t=e;if(t.closest(".dc-world"))return!1;return!!t.closest(".cm-composer, .cm-thread, .cm-mention-popup, .cm-pin, [data-mediaref-player], [data-vplay], .dc-tool-palette, .dc-zoom-tb, .dc-mm, .dc-context-menu")}function ms(e){if(!e||typeof e.closest!=="function")return!1;let t=e;return!!t.closest("[data-dc-screen]")&&!t.closest(".dc-artboard-body")}function is(e,t){if(!t||!pt(t,"live-design")||!e||typeof e.closest!=="function")return!1;return!!e.closest("button.dc-artboard-label")}function as(e,t,n){return e.kind==="select"&&!n.metaKey&&!n.ctrlKey&&(ms(t)||fc(t,n.clientX,n.clientY))}function fc(e,t,n){if(!e||typeof e.closest!=="function")return!1;let o=e;if(!o.closest(".dc-artboard-body")||typeof t!=="number"||typeof n!=="number")return!1;let r=Ft(o.ownerDocument,t,n,{deep:!1});return!!r&&r.cdId===null&&r.el.hasAttribute("data-dc-screen")}function gc(e,t,n){return e==="select"&&!n.metaKey&&!n.ctrlKey&&ms(t)}var hc="maude:toolbar-insert",bc=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,yc=/^[A-Za-z0-9_-]{1,64}$/;function wc(e,t){if(!pt(t.mode,"live-design")||t.button!==0||t.mod||t.shift)return null;let n=e?.closest?.("[data-cd-link]"),o=n?.getAttribute("data-cd-id");if(!n||!o||o.length>48||!bc.test(o)||/^[0-9a-f]{8}$/.test(o))return null;let r=n.closest("[data-dc-screen]")?.getAttribute("data-dc-screen")??null;return{elementId:o,artboardId:r&&yc.test(r)?r:null}}var ls=new WeakSet;function vc(e){if(typeof window>"u"||window.parent===window)return!1;let t=wc(e.target,{mode:ve(window).get()?.mode??null,button:e.button,mod:e.metaKey||e.ctrlKey,shift:e.shiftKey});if(!t)return!1;if(e.preventDefault(),ls.has(e))return!0;ls.add(e);try{window.parent.postMessage({dgn:"link-follow",elementId:t.elementId,artboardId:t.artboardId},"*")}catch{}return!0}function cs(e){if(typeof window>"u"||window.parent===window)return;if(!ve(window).claimRequest(`${e.mode}|${e.tool??""}`))return;try{window.parent.postMessage(e.tool?{dgn:"mode-request",mode:e.mode,tool:e.tool,cause:e.cause}:{dgn:"mode-request",mode:e.mode,cause:e.cause},"*")}catch{}}function ds(e){if(typeof window>"u"||window.parent===window)return;try{let t=document.querySelector(`[data-testid="toolbar-slot-${e}"]`);Un(),window.parent.postMessage(jn(e,t),"*")}catch{}}function fs(e){let{hostRef:t,getActiveTool:n,isSpaceHeld:o,callbacks:r,enabled:s=!0,claimableActions:a}=e;lc(()=>{if(!s)return;let c=t.current;if(!c)return;let p=(i)=>a&&i.kind!=="no-op"&&!a.has(i.kind)?{kind:"no-op"}:i,f=(i)=>{switch(i.kind){case"hover":r.onHover?.(i);break;case"select":r.onSelect?.(i);break;case"drop-comment":r.onDropComment?.(i);break;case"context-menu":r.onContextMenu?.(i);break;case"tool":r.onTool?.(i);break;case"escape":{let b=r.onEscape?.();if(i.back&&b!==!0)cs({mode:"back",cause:"esc"});break}case"mode-request":if(cs(i),i.panel)ds(i.panel);break;case"insert":if(typeof document<"u")document.dispatchEvent(new CustomEvent(hc,{detail:{kind:i.insert}}));break;case"panel":ds(i.panel);break;case"undo":r.onUndo?.();break;case"redo":r.onRedo?.();break;case"no-op":break}},x=()=>typeof window<"u"?ve(window).get().mode:null,g=(i)=>{let b=p(lt({type:"pointermove",button:i.button,metaKey:i.metaKey,ctrlKey:i.ctrlKey,shiftKey:i.shiftKey,altKey:i.altKey,clientX:i.clientX,clientY:i.clientY,spaceHeld:o?.()??!1,activeTool:n()}));f(b)},w=(i)=>{if(ct(i.target))return;if(Ht(i.target))return;let b=p(lt({type:"pointerdown",button:i.button,metaKey:i.metaKey,ctrlKey:i.ctrlKey,shiftKey:i.shiftKey,altKey:i.altKey,clientX:i.clientX,clientY:i.clientY,spaceHeld:o?.()??!1,activeTool:n(),previewLabel:is(i.target,x())})),E=as(b,i.target,i)||b.kind==="select"&&n()==="inspect";if(b.kind!=="no-op"){if(i.preventDefault(),!E)i.stopImmediatePropagation()}f(b)},A=(i)=>{if(ct(i.target))return;if(Ht(i.target))return;let b=p(lt({type:"pointerdown",button:i.button,metaKey:i.metaKey,ctrlKey:i.ctrlKey,shiftKey:i.shiftKey,altKey:i.altKey,clientX:i.clientX,clientY:i.clientY,spaceHeld:o?.()??!1,activeTool:n(),previewLabel:is(i.target,x())})),E=as(b,i.target,i);if(b.kind!=="no-op"){if(i.preventDefault(),!E)i.stopImmediatePropagation();if(b.kind==="select")try{window.focus()}catch{}}},m=(i)=>{if(ct(i.target))return;if(Ht(i.target))return;if(vc(i))return;let b=n(),E=i.metaKey||i.ctrlKey,L=b==="comment"?"drop-comment":(b==="move"||b==="inspect")&&i.button===0?"select":(us(b)||b==="browse")&&E&&i.button===0?"select":i.button===2?"context-menu":null;if(L&&(!a||a.has(L))){let O=gc(L,i.target,i);if(i.preventDefault(),!O)i.stopImmediatePropagation()}},h=(i)=>{let b=p(lt({type:"contextmenu",clientX:i.clientX,clientY:i.clientY,metaKey:i.metaKey,ctrlKey:i.ctrlKey,shiftKey:i.shiftKey,altKey:i.altKey,activeTool:n()}));if(b.kind==="no-op")return;i.preventDefault(),i.stopImmediatePropagation(),f(b)},S=(i)=>{let b=typeof window<"u"?ve(window).get():null,E=p(lt({type:"keydown",key:i.key,code:i.code,metaKey:i.metaKey,ctrlKey:i.ctrlKey,shiftKey:i.shiftKey,altKey:i.altKey,isEditable:Ht(i.target),activeTool:n(),mode:b?.mode??null,caps:b?.caps??null,markerTip:Zr(),singleKeys:b?.singleKeys??!0}));if(E.kind==="escape"&&Gr(c.ownerDocument??document))return;if(E.kind==="tool"||E.kind==="mode-request"||E.kind==="insert"||E.kind==="panel"||E.kind==="escape"&&!dn()||E.kind==="undo"||E.kind==="redo")i.preventDefault();f(E)};c.addEventListener("pointermove",g,{passive:!0}),c.addEventListener("pointerdown",w,{capture:!0}),c.addEventListener("mousedown",A,{capture:!0}),c.addEventListener("click",m,{capture:!0}),c.addEventListener("contextmenu",h,{capture:!0});let y=c.ownerDocument??document;return y.addEventListener("keydown",S,!0),()=>{c.removeEventListener("pointermove",g),c.removeEventListener("pointerdown",w,{capture:!0}),c.removeEventListener("mousedown",A,{capture:!0}),c.removeEventListener("click",m,{capture:!0}),c.removeEventListener("contextmenu",h,{capture:!0}),y.removeEventListener("keydown",S,!0)}},[s,t,n,o,r,a])}function xc(e,t=(n)=>n.getBoundingClientRect()){let n=e.querySelector("[data-cd-id]");if(!n)return null;for(let s=n;s&&s!==e;s=s.parentElement)for(let a=s.nextElementSibling;a;a=a.nextElementSibling)if(a.hasAttribute("data-cd-id")||a.querySelector("[data-cd-id]"))return null;let o=t(e),r=t(n);if(!(o.width>0&&o.height>0))return null;if(r.width<o.width*0.98||r.height<o.height*0.98)return null;return n}function Ft(e,t,n,o){let r=e.elementFromPoint(t,n);if(!r)return null;if(r.closest?.(".dc-mm, .dc-zoom-tb, .dc-tool-palette, .dc-context-menu, .dc-cv-group-bbox"))return null;let s=r.closest?.("[data-dc-screen]")??null,a=s?.getAttribute("data-dc-screen")??null,c=r.closest?.(".dc-artboard-body")??null;if(!c){if(s&&a)return{el:s,cdId:null,artboardId:a};return null}if(r===c){if(s&&a)return{el:s,cdId:null,artboardId:a};return null}if(o.deep){let A=r.getAttribute?.("data-cd-id")??null;return{el:r,cdId:A,artboardId:a}}let p=r,f=null,x=null;while(p&&p!==c){if(p.hasAttribute?.("data-cd-id"))x=f,f=p;p=p.parentElement}if(f&&xc(c)===f){if(!x)return s&&a?{el:s,cdId:null,artboardId:a}:null;f=x}let g=f??r,w=g.getAttribute?.("data-cd-id")??null;return{el:g,cdId:w,artboardId:a}}import{useCallback as Nc,useEffect as Ts,useRef as Ut}from"react";var kc=!1;function gs(){return kc}import{createContext as Cc,useCallback as qe,useContext as Ss,useEffect as dt,useMemo as ws,useRef as Le,useState as $t}from"react";function Se(e,t,n,o){return`url("data:image/svg+xml,${encodeURIComponent(e.trim())}") ${t} ${n}, ${o}`}var Bn="width='24' height='24' viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'",Xn="#1f1f1f",Wn="stroke='#ffffff' stroke-linejoin='round' stroke-linecap='round'";function $e(e,t,n){let o=n?`<g transform='${n}'>`:"";return`<svg ${Bn}>${o}<path fill='#ffffff' d='${e}'/><path fill='${Xn}' d='${t}'/>${n?"</g>":""}</svg>`}var ys="translate(0,32) scale(1,-1)",hs=Se($e("M10.25 8.25 L10.05 8.65 10 9 10 23.1 10.05 23.4 10.25 23.75 10.8 24 11.45 23.85 11.6 23.7 11.75 23.45 14.65 19.8 14.85 19.65 14.95 19.5 15.4 19.2 15.95 19.1 21.05 19.1 21.2 19.1 21.35 19.05 21.65 18.9 21.9 18.6 22 18.3 22 17.9 21.9 17.65 21.75 17.35 21.65 17.3 21.55 17.15 11.5 8.25 11.25 8.05 10.95 8 10.6 8.05 10.25 8.25 M9.15 6.6 L9.7 6.25 10 6.15 10.95 6 11.9 6.15 13 6.9 22.9 15.65 23 15.8 23.2 15.95 23.75 16.75 24 17.9 24 18.3 23.9 18.95 23.8 19.25 23.6 19.7 23.1 20.35 22.75 20.6 22.1 20.9 22.05 20.95 22 20.95 21.2 21.1 21.05 21.1 16.2 21.1 16.1 21.25 16.05 21.25 13.4 24.6 13.05 25.15 12.9 25.3 12.55 25.55 Q11.6 26.15 10.55 26 L10.5 26 Q9.65 25.85 9 25.3 L8.45 24.65 8.4 24.5 8.15 24.05 8 23.1 8 9 Q8 8.45 8.15 8.05 L8.25 7.75 8.45 7.35 9.15 6.6","M10.25 8.25 L10.6 8.05 10.95 8 11.25 8.05 11.5 8.25 21.55 17.15 21.65 17.3 21.75 17.35 21.9 17.65 22 17.9 22 18.3 21.9 18.6 21.65 18.9 21.35 19.05 21.2 19.1 21.05 19.1 15.95 19.1 15.4 19.2 14.95 19.5 14.85 19.65 14.65 19.8 11.75 23.45 11.6 23.7 11.45 23.85 10.8 24 10.25 23.75 10.05 23.4 10 23.1 10 9 10.05 8.65 10.25 8.25"),8,5,"default"),Sc=Se($e("M28.55 17.8 Q29.4 20.3 28.75 22.8 L28.7 23 28.15 24.55 28.05 24.75 Q26.4 28.2 22.75 29.4 L22.45 29.5 18 29.9 17.75 29.85 Q15.8 29.25 13.8 28.1 L13.45 27.95 Q12 27.05 10.35 26.8 L10.25 26.75 7.9 26.7 7.8 26.7 Q6.1 26.9 4.8 25.8 L4.75 25.8 4.65 25.7 4.6 25.65 Q3.25 24.5 3.05 22.85 L3 22.75 Q2.8 20.95 4 19.5 5.05 18.15 6.75 17.95 L8.4 17.9 7.5 15.55 7.3 15.2 7.2 15 5 10.95 Q3.9 9.15 4.3 7.75 L4.4 7.5 Q4.75 6.15 6.45 5.2 9 3.65 11 5 11.05 4.1 11.5 3.45 12.15 2.1 14.2 1.6 L14.35 1.6 Q18.05 0.6 19.6 4.4 L19.65 4.55 Q20.75 3.65 22.7 3.75 L22.75 3.75 Q26.75 4 27 8.15 L27 8.25 27 8.35 27 8.45 Q26.9 10.75 27.1 12.6 27.15 14.65 28.2 16.75 L28.55 17.8 M26.65 18.4 L26.1 16.8 26.1 16.85 Q24.8 13.7 25 8.35 L25 8.25 Q24.85 5.9 22.6 5.75 20.7 5.65 20.4 7.35 L20.1 7.95 19.5 8.2 18.85 8.05 18.45 7.5 17.75 5.15 Q16.85 2.95 14.7 3.55 L14.65 3.55 Q12.55 4.05 13.15 6.15 L13.85 8.75 13.75 9.45 13.25 9.95 12.55 9.95 12 9.55 10.9 7.7 Q9.5 5.7 7.45 6.9 6.5 7.45 6.25 8.15 6.1 8.9 6.7 9.85 9.2 13.9 10.8 18.65 L10.8 19.3 10.4 19.8 9.75 19.95 Q8.35 19.8 6.95 19.95 6.1 20.05 5.55 20.75 4.9 21.55 5 22.55 5.15 23.55 6 24.2 L6.05 24.25 Q6.75 24.85 7.65 24.7 L7.7 24.7 10.65 24.8 Q12.7 25.15 14.45 26.2 L14.5 26.2 Q16.4 27.35 18.3 27.9 L22.05 27.5 22.1 27.5 Q24.95 26.55 26.25 23.85 L26.8 22.3 Q27.3 20.35 26.65 18.4","M26.65 18.4 Q27.3 20.35 26.8 22.3 L26.25 23.85 Q24.95 26.55 22.1 27.5 L22.05 27.5 18.3 27.9 Q16.4 27.35 14.5 26.2 L14.45 26.2 Q12.7 25.15 10.65 24.8 L7.7 24.7 7.65 24.7 Q6.75 24.85 6.05 24.25 L6 24.2 Q5.15 23.55 5 22.55 4.9 21.55 5.55 20.75 6.1 20.05 6.95 19.95 8.35 19.8 9.75 19.95 L10.4 19.8 10.8 19.3 10.8 18.65 Q9.2 13.9 6.7 9.85 6.1 8.9 6.25 8.15 6.5 7.45 7.45 6.9 9.5 5.7 10.9 7.7 L12 9.55 12.55 9.95 13.25 9.95 13.75 9.45 13.85 8.75 13.15 6.15 Q12.55 4.05 14.65 3.55 L14.7 3.55 Q16.85 2.95 17.75 5.15 L18.45 7.5 18.85 8.05 19.5 8.2 20.1 7.95 20.4 7.35 Q20.7 5.65 22.6 5.75 24.85 5.9 25 8.25 L25 8.35 Q24.8 13.7 26.1 16.85 L26.1 16.8 26.65 18.4"),12,12,"grab"),Ec=Se($e("M28 14 Q28 9.85 24.45 6.9 20.95 4 16 4 11.05 4 7.5 6.9 L7.45 7 Q4 9.9 4 14 4 18.15 7.55 21.05 L7.5 21.05 Q9.2 22.45 11.2 23.2 L15.3 27.3 16 27.6 16.7 27.3 20.85 23.2 Q22.7 22.45 24.3 21.15 L24.45 21.05 Q28 18.15 28 14 M25.75 5.35 Q30.05 8.95 30 14 30.05 19.05 25.75 22.6 L25.4 22.85 Q23.8 24.1 22 24.9 L18.1 28.75 18.15 28.75 Q17.2 29.6 16 29.6 14.8 29.6 13.85 28.75 L13.9 28.75 10 24.9 6.6 22.85 6.25 22.6 Q1.95 19.05 2 14 1.95 8.95 6.25 5.35 10.3 2 16 2 21.7 2 25.75 5.35","M28 14 Q28 18.15 24.45 21.05 L24.3 21.15 Q22.7 22.45 20.85 23.2 L16.7 27.3 16 27.6 15.3 27.3 11.2 23.2 Q9.2 22.45 7.5 21.05 L7.55 21.05 Q4 18.15 4 14 4 9.9 7.45 7 L7.5 6.9 Q11.05 4 16 4 20.95 4 24.45 6.9 28 9.85 28 14"),12,21,"crosshair"),Tc=Se($e("M4 13.1 L4 6 Q4 5.15 4.6 4.6 5.15 4 6 4 L13.1 4 Q13.95 4 14.55 4.6 L28.65 18.75 Q29.8 19.9 29.75 21.45 L29.75 21.6 29.75 21.7 Q29.75 23.2 28.7 24.35 L24.45 28.65 24.35 28.75 Q23.15 29.85 21.65 29.8 L21.55 29.8 21.4 29.8 Q20.2 29.8 19.25 29.15 L18 29.35 Q16.6 29.4 15.25 28 L15.2 27.95 8.2 20.95 Q7.6 20.35 7.6 19.55 7.6 18.7 8.2 18.1 L4.6 14.5 Q4 13.9 4 13.1 M19.5 26.65 L20.1 27.25 Q20.7 27.85 21.5 27.8 22.35 27.85 23 27.25 L27.25 22.95 Q27.8 22.35 27.75 21.55 27.8 20.75 27.2 20.15 L13.1 6 6 6 6 13.1 12.35 19.45 9.6 19.5 16.65 26.55 Q18.05 28.05 19.5 26.65 M8.05 12.3 L8 8 12.25 8.05 13.8 9.6 9.6 13.85 8.05 12.3 M15.25 11.05 L23 18.8 18.8 23.05 11.05 15.3 15.25 11.05","M15.25 11.05 L11.05 15.3 18.8 23.05 23 18.8 15.25 11.05 M12.35 19.45 L6 13.1 6 6 13.1 6 27.2 20.15 Q27.8 20.75 27.75 21.55 27.8 22.35 27.25 22.95 L23 27.25 Q22.35 27.85 21.5 27.8 20.7 27.85 20.1 27.25 L19.5 26.65 12.35 19.45 M8.05 12.3 L9.6 13.85 13.8 9.6 12.25 8.05 8 8 8.05 12.3",ys),6,18,"crosshair"),Mc=Se($e("M5.15 10.85 Q4 9.65 4 8.1 L4 7.95 4 7.85 Q3.95 6.2 5.1 5.15 6.25 4 7.85 4 L7.95 4 8.1 4 Q9.65 4 10.85 5.15 L11 5.3 14.3 5.25 Q15.15 5.25 15.75 5.85 L29.9 20 Q31 21.15 31 22.75 L31 22.85 31 23 Q31.05 24.5 29.9 25.7 L29.55 25.95 25.65 29.9 25.65 29.95 Q24.45 31.1 22.75 31.1 21.2 31.15 20 29.95 L5.85 15.8 Q5.25 15.2 5.25 14.35 L5.25 10.95 5.15 10.85 M19.95 24.2 L18.55 22.8 22.8 18.55 24.2 19.95 19.95 24.2 M28.45 21.4 L14.3 7.25 10.15 7.3 9.4 6.55 Q8.8 5.95 7.95 6 7.1 5.95 6.5 6.55 5.95 7.1 6 7.95 5.95 8.8 6.55 9.4 L7.25 10.1 7.25 14.35 21.4 28.5 Q22 29.1 22.75 29.1 23.6 29.1 24.2 28.5 L28.45 24.25 Q29.05 23.65 29 22.85 29.05 22 28.45 21.4 M9.25 13.5 L9.25 9.3 13.5 9.25 14.3 10.05 10.05 14.3 9.25 13.5 M17.15 21.4 L11.5 15.75 15.75 11.5 21.4 17.15 17.15 21.4","M17.15 21.4 L21.4 17.15 15.75 11.5 11.5 15.75 17.15 21.4 M28.45 21.4 Q29.05 22 29 22.85 29.05 23.65 28.45 24.25 L24.2 28.5 Q23.6 29.1 22.75 29.1 22 29.1 21.4 28.5 L7.25 14.35 7.25 10.1 6.55 9.4 Q5.95 8.8 6 7.95 5.95 7.1 6.5 6.55 7.1 5.95 7.95 6 8.8 5.95 9.4 6.55 L10.15 7.3 14.3 7.25 28.45 21.4 M19.95 24.2 L24.2 19.95 22.8 18.55 18.55 22.8 19.95 24.2 M9.25 13.5 L10.05 14.3 14.3 10.05 13.5 9.25 9.25 9.3 9.25 13.5",ys),6,18,"crosshair"),he=Se($e("M17 2 Q18.2 2 19.15 2.9 20 3.8 20 5 L20 12 27 12 Q28.2 12 29.15 12.9 30 13.8 30 15 L30 17 Q30 18.2 29.15 19.15 28.2 20 27 20 L20 20 20 27 Q20 28.2 19.15 29.15 18.2 30 17 30 L15 30 Q13.8 30 12.9 29.15 12 28.2 12 27 L12 20 5 20 Q3.8 20 2.9 19.15 2 18.2 2 17 L2 15 Q2 13.8 2.9 12.9 3.8 12 5 12 L12 12 12 5 Q12 3.8 12.9 2.9 13.8 2 15 2 L17 2 M14 27 L14.3 27.7 Q14.6 28 15 28 L17 28 17.7 27.7 18 27 18 18.05 18.05 18 27 18 Q27.4 18 27.7 17.7 L28 17 28 15 27.7 14.3 Q27.4 14 27 14 L18 14 18 5 17.7 4.3 17 4 15 4 Q14.6 4 14.3 4.3 14 4.6 14 5 L14 14 5 14 Q4.6 14 4.3 14.3 4 14.6 4 15 L4 17 Q4 17.4 4.3 17.7 4.6 18 5 18 L14 18 14 27","M14 27 L14 18 5 18 Q4.6 18 4.3 17.7 4 17.4 4 17 L4 15 Q4 14.6 4.3 14.3 4.6 14 5 14 L14 14 14 5 Q14 4.6 14.3 4.3 14.6 4 15 4 L17 4 17.7 4.3 18 5 18 14 27 14 Q27.4 14 27.7 14.3 L28 15 28 17 27.7 17.7 Q27.4 18 27 18 L18.05 18 18 18.05 18 27 17.7 27.7 17 28 15 28 Q14.6 28 14.3 27.7 L14 27"),12,12,"crosshair"),Ac=Se($e("M3.9 11.35 Q2.3 12.5 3.7 13.9 L16.4 26.65 Q17.85 28.05 19.45 26.9 L27.65 21.15 Q29.3 20 27.85 18.6 L15.15 5.85 Q13.75 4.45 12.1 5.6 L3.9 11.35 M1.05 12.4 Q1 10.95 2.75 9.75 L10.95 4 10.95 3.95 Q14 1.85 16.6 4.45 L29.3 17.2 Q30.8 18.65 30.55 20.1 30.55 21.55 28.8 22.8 L20.6 28.55 20.65 28.55 Q17.7 30.65 15 28.1 L15 28.05 2.3 15.3 2.3 15.35 Q0.8 13.85 1.05 12.4 M13.5 7 L19.85 13.35 11.65 19.15 5.3 12.75 13.5 7","M13.5 7 L5.3 12.75 11.65 19.15 19.85 13.35 13.5 7 M3.9 11.35 L12.1 5.6 Q13.75 4.45 15.15 5.85 L27.85 18.6 Q29.3 20 27.65 21.15 L19.45 26.9 Q17.85 28.05 16.4 26.65 L3.7 13.9 Q2.3 12.5 3.9 11.35"),6,14,"cell"),bs=Se(`<svg ${Bn}><path d='M16 4V28M11 4H21M11 28H21' fill='none' ${Wn} stroke-width='5'/><path d='M16 4V28M11 4H21M11 28H21' fill='none' stroke='${Xn}' stroke-width='2.25' stroke-linecap='round'/></svg>`,12,12,"text"),Rc=Se(`<svg ${Bn}><path d='M6 5H21L26 10V27H6Z' fill='${Xn}' ${Wn} stroke-width='2.5'/><path d='M21 5V11H26' fill='none' ${Wn} stroke-width='2.25'/></svg>`,5,5,"crosshair"),ne=Object.freeze({browse:"default",move:hs,inspect:hs,hand:Sc,comment:Ec,pen:Tc,section:he,highlighter:Mc,shape:he,rect:he,ellipse:he,sticky:Rc,arrow:he,text:bs,"el-text":bs,frame:he,"el-shape":he,line:he,polygon:he,slice:he,"el-pen":he,crop:he,eraser:Ac});import{jsx as Qn,Fragment as Oc}from"react/jsx-runtime";function vs(e,t){if(typeof window>"u"||window.parent===window)return;if(!ve(window).claimRequest(`${e}|${t??""}`))return;try{window.parent.postMessage(t?{dgn:"mode-request",mode:e,tool:t,cause:"toolbar"}:{dgn:"mode-request",mode:e,cause:"toolbar"},"*")}catch{}}var qt="maude:tool-sync",xs=Object.freeze({preview:"browse",edit:"move"});function ks(e){if(e==="browse")return"preview";if(e==="move")return"edit";return null}var Ic=Object.freeze([{id:"browse",label:"Browse",shortcut:"",cursor:ne.browse},{id:"move",label:"Select",shortcut:"V",cursor:ne.move},{id:"inspect",label:"Inspect",shortcut:"",cursor:ne.inspect},{id:"hand",label:"Hand",shortcut:"H",cursor:ne.hand},{id:"comment",label:"Comment",shortcut:"C",cursor:ne.comment},{id:"pen",label:"Pen",shortcut:"B",cursor:ne.pen},{id:"highlighter",label:"Highlighter",shortcut:"I",cursor:ne.highlighter},{id:"shape",label:"Shape",shortcut:"R",cursor:ne.shape},{id:"sticky",label:"Sticky",shortcut:"N",cursor:ne.sticky},{id:"section",label:"Section",shortcut:"⇧S",cursor:ne.shape},{id:"arrow",label:"Arrow",shortcut:"A",cursor:ne.arrow},{id:"text",label:"Text",shortcut:"T",cursor:ne.text},{id:"el-text",label:"Text",shortcut:"T",cursor:ne["el-text"]},{id:"frame",label:"Frame",shortcut:"F",cursor:ne.frame},{id:"el-shape",label:"Shape",shortcut:"R",cursor:ne["el-shape"]},{id:"ellipse",label:"Ellipse",shortcut:"",cursor:ne.ellipse},{id:"line",label:"Line",shortcut:"",cursor:ne.line},{id:"polygon",label:"Polygon",shortcut:"",cursor:ne.polygon},{id:"slice",label:"Export area",shortcut:"",cursor:ne.slice},{id:"el-pen",label:"Pen",shortcut:"P",cursor:ne["el-pen"]},{id:"crop",label:"Crop",shortcut:"",cursor:ne.crop},{id:"eraser",label:"Eraser",shortcut:"E",cursor:ne.eraser}]),Pc=new Set(["browse","move","hand","inspect"]);function _c(e,t,n=!1){return t?e.filter((o)=>Pc.has(o.id)||n&&o.id==="comment"):e}var Yn=Cc(null);function Lc({children:e,tools:t=Ic,initial:n,initialMode:o,governed:r=!1}){let s=Re(),a=s&&Ue(),c=ws(()=>_c(t,s,a),[t,s,a]),p=n??(s?"browse":"move"),f=o??ks(p)??(s?"preview":"edit"),[x,g]=$t(p),w=Le(p),A=qe((M)=>{w.current=M,g(M)},[]),m=qe(()=>w.current,[]),[h,S]=$t(f),[y,i]=$t(()=>({tool:null,locked:!1})),b=Le(null),E=qe((M)=>{if(!c.some((j)=>j.id===M))return;let K=b.current;if(K){let j=et(M,K.caps,K.mode);if(j&&j!==K.mode){if(K.mode!=="present")vs(j,M);return}A(M),i((Y)=>Y.locked&&Y.tool===M?Y:{tool:null,locked:!1});return}A(M);let F=ks(M);if(F)S(F);i((j)=>j.locked&&j.tool===M?j:{tool:null,locked:!1})},[c]),L=qe((M)=>{let K=b.current;if(K){vs(M==="edit"?so(K.caps):"preview");return}let F=xs[M];if(!c.some((j)=>j.id===F))return;S(M),A(F),i((j)=>j.locked&&j.tool===F?j:{tool:null,locked:!1})},[c]),O=qe(()=>{let M=b.current;E(M?Yt[M.mode]:xs[h])},[h,E]),z=Le(h);z.current=h;let G=Le(x);G.current=x;let D=Le(x);dt(()=>{let M=os(D.current,x);if(D.current=x,M)ns(M)},[x]),dt(()=>{if(!r||typeof window>"u")return;let M=ve(window),K=-1,F=null,j=()=>{let Y=M.get();if(Y.mode===null||!Y.caps||Y.modeSeq<=K)return;K=Y.modeSeq,b.current={mode:Y.mode,caps:Y.caps};let Ee=ao[Y.mode],Te=F===null?z.current!==Ee:F!==Y.mode;F=Y.mode;let Me=Yt[Y.mode],Oe=(Ae)=>!!Ae&&c.some((ut)=>ut.id===Ae),N=Y.tool??(Te?Me:null),Z=Oe(N)?N:Te&&Oe(Me)?Me:null;if(S(Ee),Z)A(Z),G.current=Z;if(Te)i({tool:null,locked:!1});if(M.claimEcho(Y.modeSeq)&&window.parent!==window)try{window.parent.postMessage({dgn:"mode-changed",seq:Y.modeSeq,mode:Y.mode,tool:Z??G.current,present:Y.present,cause:Y.clamped?"clamp":"set-mode"},"*")}catch{}};return j(),M.subscribe(j)},[c,r]);let W=qe((M)=>{i((K)=>{if(K.locked&&K.tool===M)return{tool:null,locked:!1};return{tool:M,locked:!0}}),A(M)},[]),Q=qe(()=>{i({tool:null,locked:!1})},[]),[ee,oe]=$t("rounded"),te=Le(Math.random().toString(36).slice(2)),k=Le(x);k.current=x;let T=Le(!1);dt(()=>{if(!T.current){T.current=!0;return}if(typeof document>"u")return;document.dispatchEvent(new CustomEvent(qt,{detail:{tool:x,from:te.current}}))},[x]),dt(()=>{if(typeof document>"u")return;let M=(K)=>{let F=K.detail;if(!F||F.from===te.current||typeof F.tool!=="string")return;if(F.tool===k.current)return;let j=b.current;if(j){let Y=et(F.tool,j.caps,j.mode);if(Y&&Y!==j.mode){document.dispatchEvent(new CustomEvent(qt,{detail:{tool:k.current,from:te.current}}));return}}E(F.tool)};return document.addEventListener(qt,M),()=>document.removeEventListener(qt,M)},[E]),dt(()=>{if(typeof document>"u")return;let M=c.find((j)=>j.id===x);if(!M)return;let K=document.body.style.cursor,F=document.getElementById("dc-tool-cursor");if(!F)F=document.createElement("style"),F.id="dc-tool-cursor",document.head.appendChild(F);if(x==="browse"){if(document.body.style.cursor="",F.textContent="",typeof window<"u"&&window.parent&&window.parent!==window)try{window.parent.postMessage({dgn:"tool-cursor",tool:x},"*")}catch{}return()=>{document.body.style.cursor=K}}if(document.body.style.cursor=M.cursor,F.textContent=`* { cursor: ${M.cursor} !important; }`,typeof window<"u"&&window.parent&&window.parent!==window)try{window.parent.postMessage({dgn:"tool-cursor",tool:x},"*")}catch{}return()=>{document.body.style.cursor=K;let j=document.getElementById("dc-tool-cursor");if(j)j.textContent=""}},[x,c]);let I=ws(()=>({tool:x,getTool:m,setTool:E,tools:c,mode:h,setMode:L,resetTool:O,sticky:y,toggleSticky:W,clearSticky:Q,shapeKind:ee,setShapeKind:oe}),[x,m,E,c,h,L,O,y,W,Q,ee]);return Qn(Yn.Provider,{value:I,children:e})}function Es({children:e,initial:t,initialMode:n,governed:o}){if(Ss(Yn))return Qn(Oc,{children:e});return Qn(Lc,{initial:t,initialMode:n,governed:o,children:e})}function jt(){let e=Ss(Yn);if(!e)throw Error("useToolMode must be used inside <ToolProvider>");return e}import{jsx as Bc}from"react/jsx-runtime";var Dc=`
2
2
  .dc-el-resize-handle {
3
3
  position: fixed;
4
4
  width: 8px;
5
5
  height: 8px;
6
- background: var(--maude-hud-accent, oklch(0.680 0.180 268));
7
- border: 1px solid var(--maude-hud-accent-fg, oklch(0.180 0.030 268));
8
- border-radius: 3px;
6
+ box-sizing: border-box;
7
+ /* P8 C5 (14 R2, board .ed-h): a bg-2 square with a 1.5 px inset accent, no radius — the same 8 x 8 on edges */
8
+ background: var(--maude-chrome-bg-2, #ffffff);
9
+ border: 0;
10
+ box-shadow: inset 0 0 0 1.5px var(--maude-hud-accent, oklch(0.53 0.175 238));
11
+ border-radius: 0;
9
12
  z-index: 6;
10
13
  pointer-events: auto;
11
14
  touch-action: none;
@@ -14,8 +17,8 @@ import{Component as eo,createElement as $e,useCallback as ze,useEffect as Q,useM
14
17
  }
15
18
  .dc-el-resize-handle[data-corner="nw"], .dc-el-resize-handle[data-corner="se"] { cursor: nwse-resize !important; }
16
19
  .dc-el-resize-handle[data-corner="ne"], .dc-el-resize-handle[data-corner="sw"] { cursor: nesw-resize !important; }
17
- .dc-el-resize-handle[data-corner="n"], .dc-el-resize-handle[data-corner="s"] { cursor: ns-resize !important; width: 14px; height: 6px; }
18
- .dc-el-resize-handle[data-corner="e"], .dc-el-resize-handle[data-corner="w"] { cursor: ew-resize !important; width: 6px; height: 14px; }
20
+ .dc-el-resize-handle[data-corner="n"], .dc-el-resize-handle[data-corner="s"] { cursor: ns-resize !important; }
21
+ .dc-el-resize-handle[data-corner="e"], .dc-el-resize-handle[data-corner="w"] { cursor: ew-resize !important; }
19
22
  /* Rotation lives in INVISIBLE zones just outside each CORNER (FigJam / mirrors
20
23
  the annotation .dc-annot-rotate-zone) — the cursor flips to a rotate glyph and
21
24
  dragging turns the element. z-index BELOW the corner squares so the resize
@@ -33,7 +36,7 @@ import{Component as eo,createElement as $e,useCallback as ze,useEffect as Q,useM
33
36
  .dc-el-resize-readout {
34
37
  position: fixed;
35
38
  transform: translate(-50%, 12px);
36
- font-family: var(--maude-chrome-font-mono, ui-monospace, SFMono-Regular, monospace);
39
+ font-family: var(--maude-chrome-font-body, system-ui, -apple-system, sans-serif);
37
40
  font-size: 11px;
38
41
  padding: 3px 7px;
39
42
  background: var(--maude-hud-accent, oklch(0.680 0.180 268));
@@ -50,10 +53,10 @@ import{Component as eo,createElement as $e,useCallback as ze,useEffect as Q,useM
50
53
  /* INV-2 — reveal/settle collapses to 1ms, same idiom as every other overlay
51
54
  stylesheet in this codebase (equal-spacing-handles.tsx, etc). This overlay
52
55
  is mounted inside the canvas iframe's OWN document, which never loads the
53
- shell's 1-tokens-maude.css — the prefers-reduced-motion guard has to be
56
+ shell's 1-tokens-shell.css — the prefers-reduced-motion guard has to be
54
57
  re-declared per injected stylesheet, it doesn't cascade in from the shell.
55
58
  Comment stays backtick-free — it lives inside the template literal. */
56
59
  @media (prefers-reduced-motion: reduce) {
57
60
  .dc-el-resize-handle, .dc-el-resize-readout { transition-duration: 1ms; }
58
61
  }
59
- `.trim();function Un(){if(typeof document>"u")return;if(document.getElementById("dc-el-resize-css"))return;let e=document.createElement("style");e.id="dc-el-resize-css",e.textContent=Fn,document.head.appendChild(e)}var Yn=["nw","n","ne","e","se","s","sw","w"];function Bn(e){return{movesLeft:e==="nw"||e==="w"||e==="sw",movesRight:e==="ne"||e==="e"||e==="se",movesTop:e==="nw"||e==="n"||e==="ne",movesBottom:e==="sw"||e==="s"||e==="se"}}var V=(e)=>Math.round(e*100)/100,ye=1;function Wn(e,t,n,o,r,s){let{movesLeft:a,movesRight:c,movesTop:m,movesBottom:v}=Bn(e),x=r.center,{w:f,h:u}=t;if(c)f=t.w+(x?2*n:n);else if(a)f=t.w-(x?2*n:n);if(v)u=t.h+(x?2*o:o);else if(m)u=t.h-(x?2*o:o);if(r.aspect&&t.w>0&&t.h>0){let d=t.w/t.h;if((a||c)&&(m||v)){let S=Math.abs(f-t.w)/t.w,i=Math.abs(u-t.h)/t.h;if(S>=i)u=f/d;else f=u*d}else if(a||c)u=f/d;else if(m||v)f=u*d}if(f<ye)f=ye;if(u<ye)u=ye;let h={width:V(f),height:V(u)};if(x){if(s.canMoveLeft&&(a||c))h.left=V(t.left+(t.w-f)/2);if(s.canMoveTop&&(m||v))h.top=V(t.top+(t.h-u)/2)}else{if(s.canMoveLeft&&a)h.left=V(t.left+t.w-f);if(s.canMoveTop&&m)h.top=V(t.top+t.h-u)}return h}function Tt(e){if(!e||e==="none")return 0;let t=/matrix\(([^)]+)\)/.exec(e);if(!t)return 0;let n=t[1].split(",").map(Number),o=n[0]??1,r=n[1]??0;return Math.round(Math.atan2(r,o)*(180/Math.PI)*100)/100}function qn(e){if(!e||e==="none")return 1;let t=/matrix\(([^)]+)\)/.exec(e);if(!t)return 1;let n=t[1].split(",").map(Number),o=n[0]??1,r=n[1]??0,s=Math.hypot(o,r);return s>0?s:1}function Xn(e){let t=e.closest(".dc-world");if(!t)return 1;let n=getComputedStyle(t),o=Number.parseFloat(n.zoom||"1")||1;return qn(n.transform)*o}function Lt(e,t,n){let o=n*Math.PI/180,r=Math.cos(o),s=Math.sin(o);return[e*r-t*s,e*s+t*r]}function kt(e,t,n,o){return Math.atan2(o-t,n-e)}function Vn(e,t,n,o){let r=e+(n-t)*(180/Math.PI);while(r>180)r-=360;while(r<=-180)r+=360;if(o)r=Math.round(r/15)*15;return Math.round(r*100)/100}function jn(e,t){let n={width:`${t.width}px`,height:`${t.height}px`};if(typeof t.left==="number")n.left=`${t.left}px`;if(typeof t.top==="number")n.top=`${t.top}px`;try{window.parent.postMessage({dgn:"resize-request",id:e.cdId,patch:n,before:e.before,idIndex:e.idIndex},"*")}catch{}}function Gn(e,t){if(!e.artboardId)return;try{window.parent.postMessage({dgn:"resize-artboard-request",artboardId:e.artboardId,width:t.width,height:t.height},"*")}catch{}}function Zn(e,t){try{window.parent.postMessage({dgn:"resize-request",id:e.cdId,patch:{transform:t},before:e.before,idIndex:e.idIndex},"*")}catch{}}function Rt(){Un();let{selected:e}=me(),{tool:t}=he(),n=ge(null),o=ge(null),r=ge(null),s=ge(null),a=e.length===1?e[0]:null,c=a&&typeof a.id==="string"?a.id:null,m=a&&!c&&typeof a.artboardId==="string"?a.artboardId:null,v=t==="move"&&(!!c||!!m);Ct(()=>{let f=n.current;if(!f)return;let u=()=>{for(let d of Array.from(f.children)){let w=d;w.style.opacity="0",w.style.pointerEvents="none"}};if(!v||!a){u();return}let h=()=>{if(o.current=null,yt()){u(),o.current=requestAnimationFrame(h);return}let d=ve(document,a);if(!d){u(),o.current=requestAnimationFrame(h);return}let w=d.getBoundingClientRect();if(w.width<=0&&w.height<=0){u(),o.current=requestAnimationFrame(h);return}let S=m?["e","s","se"]:Yn,i=m?[]:["rot-nw","rot-ne","rot-sw","rot-se"],p=S.length+i.length+1;while(f.children.length<p)f.appendChild(document.createElement("div"));while(f.children.length>p)f.lastChild&&f.removeChild(f.lastChild);let E=w.left+w.width/2,g=w.top+w.height/2,l=Tt(getComputedStyle(d).transform),y=Xn(d),T=d.offsetWidth*y/2,b=d.offsetHeight*y/2,C={nw:[-T,-b],n:[0,-b],ne:[T,-b],e:[T,0],se:[T,b],s:[0,b],sw:[-T,b],w:[-T,0],"rot-nw":[-T,-b],"rot-ne":[T,-b],"rot-sw":[-T,b],"rot-se":[T,b]},k=[...i,...S];for(let K=0;K<k.length;K++){let I=k[K],N=f.children[K],[Y,W]=C[I]??[0,0],[Nt,Ot]=Lt(Y,W,l),Dt=E+Nt,Ht=g+Ot,be=I.startsWith("rot-"),Fe=I==="n"||I==="s",Ue=I==="e"||I==="w",Pt=be?10:Fe?7:Ue?3:4,zt=be?10:Fe?3:Ue?7:4;N.className="dc-el-resize-handle",N.dataset.corner=I,N.style.opacity="1",N.style.pointerEvents="auto",N.style.left=`${Math.round(Dt-Pt)}px`,N.style.top=`${Math.round(Ht-zt)}px`,N.style.transform=be?"":`rotate(${l}deg)`}let L=f.children[k.length],M=r.current;if(M&&M.el===d&&!M.corner.startsWith("rot-")){let K=M.lastResult?.width??d.offsetWidth,I=M.lastResult?.height??d.offsetHeight,N=`${Math.round(K)} × ${Math.round(I)}`,Y=M.lastResult?.left,W=M.lastResult?.top;if(typeof Y==="number"||typeof W==="number")N+=` · ${Math.round(Y??M.start.left)}, ${Math.round(W??M.start.top)}`;L.className="dc-el-resize-readout",L.textContent=N,L.style.opacity="1",L.style.left=`${Math.round(E)}px`,L.style.top=`${Math.round(g+b)}px`}else L.style.opacity="0";o.current=requestAnimationFrame(h)};return o.current=requestAnimationFrame(h),()=>{if(o.current!=null)cancelAnimationFrame(o.current)}},[v,a,m]);let x=Qn((f,u)=>{if(f.el.style.width=`${u.width}px`,f.el.style.height=`${u.height}px`,typeof u.left==="number")f.el.style.left=`${u.left}px`;if(typeof u.top==="number")f.el.style.top=`${u.top}px`;f.lastResult=u},[]);return Ct(()=>{let f=n.current;if(!f)return;let u=(i,p)=>{let[E,g]=Lt(p.clientX-i.startClientX,p.clientY-i.startClientY,-i.angle);return Wn(i.corner,i.start,E/i.elZoom,g/i.elZoom,{aspect:!!p.shiftKey,center:!i.artboardId&&!!p.altKey},i.flags)},h=(i)=>{let p=i.target;if(!p?.classList.contains("dc-el-resize-handle"))return;let E=p.dataset.corner;if(!E||!a)return;let g=typeof a.id==="string"?a.id:null,l=!g&&typeof a.artboardId==="string"?a.artboardId:null;if(!g&&!l)return;let y=ve(document,a);if(!y)return;i.preventDefault(),i.stopPropagation();let T=y.getBoundingClientRect(),b=y.offsetWidth?T.width/y.offsetWidth:1,C=getComputedStyle(y),k=!l&&(C.position==="absolute"||C.position==="fixed"),L=l?Number.NaN:Number.parseFloat(y.style.left),M=l?Number.NaN:Number.parseFloat(y.style.top),K=l?0:Tt(C.transform),I=b>0?b:1,N=T.left+T.width/2,Y=T.top+T.height/2,W={pointerId:i.pointerId,corner:E,el:y,cdId:g??"",artboardId:l,idIndex:g?Je(document,g,y):0,startClientX:i.clientX,startClientY:i.clientY,elZoom:I,angle:K,cx:N,cy:Y,rotStartPointer:kt(N,Y,i.clientX,i.clientY),start:{w:(K?y.offsetWidth:T.width/I)||T.width/I,h:(K?y.offsetHeight:T.height/I)||T.height/I,left:L,top:M},flags:{canMoveLeft:k&&Number.isFinite(L),canMoveTop:k&&Number.isFinite(M)},before:{width:y.style.width||null,height:y.style.height||null,left:y.style.left||null,top:y.style.top||null,transform:y.style.transform||null},lastResult:null,lastTransform:null};r.current=W;try{p.setPointerCapture(i.pointerId)}catch{}},d=(i)=>{let p=r.current;if(!p||i.pointerId!==p.pointerId)return;if(i.preventDefault(),p.corner.startsWith("rot-")){let g=`rotate(${Vn(p.angle,p.rotStartPointer,kt(p.cx,p.cy,i.clientX,i.clientY),!!i.shiftKey)}deg)`;p.el.style.transform=g,p.lastTransform=g;return}x(p,u(p,i))},w=(i)=>{let p=r.current;if(!p||i.pointerId!==p.pointerId)return;if(r.current=null,p.corner.startsWith("rot-")){let l=p.lastTransform;if(!l||l===p.before.transform)return;s.current={el:p.el,before:p.before},Zn(p,l);return}let E=p.lastResult??u(p,i);if(!(`${E.width}px`!==p.before.width||`${E.height}px`!==p.before.height||typeof E.left==="number"&&`${E.left}px`!==p.before.left||typeof E.top==="number"&&`${E.top}px`!==p.before.top))return;if(s.current={el:p.el,before:p.before},p.artboardId)Gn(p,E);else jn(p,E)},S=(i)=>{let p=i.data;if(p?.dgn!=="resize-failed"&&p?.dgn!=="resize-artboard-failed")return;if(i.source!==window.parent)return;let E=s.current;if(!E)return;if(E.el.style.width=E.before.width??"",E.el.style.height=E.before.height??"",E.before.left!==null||E.el.style.left)E.el.style.left=E.before.left??"";if(E.before.top!==null||E.el.style.top)E.el.style.top=E.before.top??"";if(E.before.transform!==null||E.el.style.transform)E.el.style.transform=E.before.transform??"";s.current=null};return f.addEventListener("pointerdown",h),window.addEventListener("pointermove",d),window.addEventListener("pointerup",w),window.addEventListener("pointercancel",w),window.addEventListener("message",S),()=>{f.removeEventListener("pointerdown",h),window.removeEventListener("pointermove",d),window.removeEventListener("pointerup",w),window.removeEventListener("pointercancel",w),window.removeEventListener("message",S)}},[a,x]),Jn("div",{ref:n,"aria-hidden":"true"})}import{jsx as D,jsxs as It,Fragment as fo}from"react/jsx-runtime";var oo=new Set(["drop-comment","tool","escape","hover"]);function se(){return typeof document<"u"&&!document.querySelector(".dc-canvas")}function Qe(e,t){if(typeof document>"u")return null;let n=document.elementFromPoint(e,t);if(!n)return null;if(n.closest(".cm-composer, .cm-thread, .cm-mention-popup, .cm-pin, [data-mc-hover-halo], [data-mc-selection-halo], .dc-el-resize-handle"))return null;let o=n.tagName;if(o==="HTML"||o==="BODY")return null;return n}function ro(e,t){let n=Qe(e,t);if(!n)return null;return n.closest("[data-cd-id]")??n}function io({children:e,file:t}){let{tool:n,setTool:o}=he(),r=me(),s=F(null),[a,c]=ie(null),m=F(n);m.current=n;let v=to(()=>()=>m.current,[]);Q(()=>{if(n!=="comment")c(null)},[n]);let[x,f]=ie(null),[u,h]=ie(!1);return Q(()=>{let d=()=>h(se());d();let w=requestAnimationFrame(d),S=setTimeout(d,120);return()=>{cancelAnimationFrame(w),clearTimeout(S)}},[]),Q(()=>{if(typeof document>"u")return;let d=(w)=>{if(w.button!==0||!(w.metaKey||w.ctrlKey))return;if(!se())return;if(ne(w.target))return;let S=ro(w.clientX,w.clientY);if(!S)return;w.preventDefault(),w.stopImmediatePropagation();let i=S.getAttribute("data-cd-id"),p=xe({el:S,cdId:i,artboardId:null});if(w.shiftKey)r.add(p);else r.replace(p);f(S)};return document.addEventListener("pointerdown",d,!0),()=>document.removeEventListener("pointerdown",d,!0)},[r]),Q(()=>{if(r.selected.length===0)f(null)},[r.selected]),Q(()=>{let d=s.current;if(d)d.setAttribute("data-active-tool",n);if(typeof document<"u"&&document.body)document.body.setAttribute("data-active-tool",n);return()=>{d?.removeAttribute("data-active-tool")}},[n]),Q(()=>{if(typeof window>"u")return;let d=(w)=>{let S=w.data;if(!S||typeof S!=="object"||S.dgn!=="tool-set")return;if(typeof S.tool==="string")o(S.tool)};return window.addEventListener("message",d),()=>window.removeEventListener("message",d)},[o]),gt({hostRef:s,getActiveTool:v,claimableActions:oo,callbacks:{onHover:({clientX:d,clientY:w})=>{if(m.current!=="comment"||!se()){c(null);return}let S=Qe(d,w);c((i)=>i===S?i:S)},onTool:({tool:d})=>o(d),onEscape:()=>{if(m.current!=="move")o("move");if(c(null),r.clear(),typeof window<"u")try{window.parent.postMessage({dgn:"force-clear"},"*")}catch{}},onDropComment:({clientX:d,clientY:w})=>ao(d,w,r,t)}}),It("div",{"data-mc-host":!0,ref:s,style:{display:"contents"},children:[e,a?D(lo,{el:a}):null,x?D(so,{el:x}):null,u?D(Rt,{}):null,D(ft,{})]})}function so({el:e}){let t=F(null),n=F(e);n.current=e;let o=F(null);return Q(()=>{let r=()=>{o.current=null;let s=t.current,a=n.current;if(s&&a?.isConnected){let c=a.getBoundingClientRect();if(c.width===0&&c.height===0)s.style.display="none";else s.style.display="block",s.style.left=`${Math.round(c.left)}px`,s.style.top=`${Math.round(c.top)}px`,s.style.width=`${Math.round(c.width)}px`,s.style.height=`${Math.round(c.height)}px`}else if(s)s.style.display="none";o.current=requestAnimationFrame(r)};return o.current=requestAnimationFrame(r),()=>{if(o.current!=null)cancelAnimationFrame(o.current)}},[]),D("div",{ref:t,"aria-hidden":"true","data-mc-selection-halo":"",style:{position:"fixed",display:"none",pointerEvents:"none",zIndex:2147483645,border:"1.5px solid var(--maude-hud-accent, oklch(0.680 0.180 268))",borderRadius:"3px",boxSizing:"border-box"}})}function lo({el:e}){let t=F(null),n=F(e);n.current=e;let o=F(null);return Q(()=>{let r=()=>{o.current=null;let s=t.current,a=n.current;if(s&&a?.isConnected){let c=a.getBoundingClientRect();if(c.width===0&&c.height===0)s.style.display="none";else s.style.display="block",s.style.left=`${Math.round(c.left)}px`,s.style.top=`${Math.round(c.top)}px`,s.style.width=`${Math.round(c.width)}px`,s.style.height=`${Math.round(c.height)}px`}else if(s)s.style.display="none";o.current=requestAnimationFrame(r)};return o.current=requestAnimationFrame(r),()=>{if(o.current!=null)cancelAnimationFrame(o.current)}},[]),D("div",{ref:t,"aria-hidden":"true","data-mc-hover-halo":"",style:{position:"fixed",display:"none",pointerEvents:"none",zIndex:2147483646,border:"2px solid var(--maude-hud-accent, #d63b1f)",borderRadius:"3px",boxSizing:"border-box"}})}function ao(e,t,n,o){if(typeof document>"u")return;let r=We(e,t)??void 0,s=Xe(e,t);if(s){let m=le(s),v=m?.getBoundingClientRect(),x={file:o,id:void 0,selector:"",artboardId:null,tag:m?.getAttribute("data-tool")??"annotation",classes:"",text:"",dom_path:[],bounds:v?{x:v.left,y:v.top,w:v.width,h:v.height}:{x:e-12,y:t-12,w:24,h:24},html:"",annotationId:s,...r?{world:r}:{}};Ke(x,e,t);return}let a=Me(document,e,t,{deep:!0});if(!a)a=Me(document,e,t,{deep:!1});if(!a&&!se()&&typeof document.elementsFromPoint==="function"){let m=document.elementsFromPoint(e,t);for(let v of m){let x=v.closest?.("[data-cd-id]");if(!x)continue;if(!x.closest(".dc-artboard-body"))continue;let f=x.closest("[data-dc-screen]");a={el:x,cdId:x.getAttribute("data-cd-id"),artboardId:f?.getAttribute("data-dc-screen")??null};break}}if(!a&&se()){let m=Qe(e,t);if(m)a={el:m,cdId:m.getAttribute("data-cd-id"),artboardId:null}}if(!a){let m={file:o,id:void 0,selector:"",artboardId:null,tag:"",classes:"",text:"",dom_path:[],bounds:{x:e-12,y:t-12,w:24,h:24},html:"",...r?{world:r}:{}};Ke(m,e,t);return}let c=xe(a,o);n.replace(c),Ke(c,e,t)}function Ke(e,t,n){if(typeof document<"u")try{document.dispatchEvent(new CustomEvent("cm:open-composer",{detail:{selection:e,clientX:t,clientY:n}}))}catch{}if(typeof window<"u")try{window.parent.postMessage({dgn:"comment-compose",selection:e},"*")}catch{}}function At(e,t){return D(St,{initial:"browse",children:D(st,{children:D(io,{file:t,children:D(e,{})})})})}function Er(e,t){let n=no(t.rootEl);if(!t.commentsEnabled){n.render($e(e));return}let o=t.file??we();n.render($e(mo,{initialCanvas:e,file:o}))}var Mt="__maudeCanvasRuntime";function co({Canvas:e,file:t,onOk:n}){return Q(()=>{n()},[]),At(e,t)}class _t extends eo{state={hasError:!1};static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(){this.props.onError()}componentDidUpdate(e){if(e.attempt!==this.props.attempt&&this.state.hasError)this.setState({hasError:!1})}render(){if(this.state.hasError)return this.props.fallback();return this.props.children}}function uo({message:e}){return $e("div",{className:"dc-hmr-holding",role:"status","aria-live":"polite",title:e?`Holding last working render — ${e}`:"Holding last working render"},"⏸ build error — držím poslední funkční verzi")}function mo({initialCanvas:e,file:t}){let[{canvas:n,attempt:o},r]=ie({canvas:e,attempt:0}),[s,a]=ie({on:!1}),c=F(null),m=F(n);m.current=n,Q(()=>{let u={remount:(h)=>r((d)=>({canvas:h,attempt:d.attempt+1})),setHolding:(h,d)=>a(h?{on:!0,message:d}:{on:!1})};return window[Mt]=u,()=>{window[Mt]=void 0}},[]);let v=ze(()=>{if(c.current=m.current,a((u)=>u.on?{on:!1}:u),o>0&&t)try{window.parent.postMessage({dgn:"loaded",file:t},"*")}catch{}},[o,t]),x=ze(()=>{a({on:!0,message:"render error"})},[]),f=ze(()=>{let u=c.current;return u?At(u,t):null},[t]);return It(fo,{children:[D(_t,{attempt:o,onError:x,fallback:f,children:D(co,{Canvas:n,file:t,onOk:v},o)}),s.on?D(uo,{message:s.message}):null]})}export{_t as CanvasErrorBoundary,se as isBareSpecimen,Er as mountCanvas,ro as pickSpecimenSelectEl};
62
+ `.trim();function Kc(){if(typeof document>"u")return;if(document.getElementById("dc-el-resize-css"))return;let e=document.createElement("style");e.id="dc-el-resize-css",e.textContent=Dc,document.head.appendChild(e)}var zc=["nw","n","ne","e","se","s","sw","w"];function Vc(e){return{movesLeft:e==="nw"||e==="w"||e==="sw",movesRight:e==="ne"||e==="e"||e==="se",movesTop:e==="nw"||e==="n"||e==="ne",movesBottom:e==="sw"||e==="s"||e==="se"}}var Ye=(e)=>Math.round(e*100)/100,Wt=1;function Hc(e,t,n,o,r,s){let{movesLeft:a,movesRight:c,movesTop:p,movesBottom:f}=Vc(e),x=r.center,{w:g,h:w}=t;if(c)g=t.w+(x?2*n:n);else if(a)g=t.w-(x?2*n:n);if(f)w=t.h+(x?2*o:o);else if(p)w=t.h-(x?2*o:o);if(r.aspect&&t.w>0&&t.h>0){let m=t.w/t.h;if((a||c)&&(p||f)){let S=Math.abs(g-t.w)/t.w,y=Math.abs(w-t.h)/t.h;if(S>=y)w=g/m;else g=w*m}else if(a||c)w=g/m;else if(p||f)g=w*m}if(g<Wt)g=Wt;if(w<Wt)w=Wt;let A={width:Ye(g),height:Ye(w)};if(x){if(s.canMoveLeft&&(a||c))A.left=Ye(t.left+(t.w-g)/2);if(s.canMoveTop&&(p||f))A.top=Ye(t.top+(t.h-w)/2)}else{if(s.canMoveLeft&&a)A.left=Ye(t.left+t.w-g);if(s.canMoveTop&&p)A.top=Ye(t.top+t.h-w)}return A}function Ms(e){if(!e||e==="none")return 0;let t=/matrix\(([^)]+)\)/.exec(e);if(!t)return 0;let n=t[1].split(",").map(Number),o=n[0]??1,r=n[1]??0;return Math.round(Math.atan2(r,o)*(180/Math.PI)*100)/100}function Fc(e){if(!e||e==="none")return 1;let t=/matrix\(([^)]+)\)/.exec(e);if(!t)return 1;let n=t[1].split(",").map(Number),o=n[0]??1,r=n[1]??0,s=Math.hypot(o,r);return s>0?s:1}function $c(e){let t=e.closest(".dc-world");if(!t)return 1;let n=getComputedStyle(t),o=Number.parseFloat(n.zoom||"1")||1;return Fc(n.transform)*o}function As(e,t,n){let o=n*Math.PI/180,r=Math.cos(o),s=Math.sin(o);return[e*r-t*s,e*s+t*r]}function Rs(e,t,n,o){return Math.atan2(o-t,n-e)}function qc(e,t,n,o){let r=e+(n-t)*(180/Math.PI);while(r>180)r-=360;while(r<=-180)r+=360;if(o)r=Math.round(r/15)*15;return Math.round(r*100)/100}function jc(e,t){let n={width:`${t.width}px`,height:`${t.height}px`};if(typeof t.left==="number")n.left=`${t.left}px`;if(typeof t.top==="number")n.top=`${t.top}px`;try{window.parent.postMessage({dgn:"resize-request",id:e.cdId,patch:n,before:e.before,idIndex:e.idIndex},"*")}catch{}}function Uc(e,t){if(!e.artboardId)return;try{window.parent.postMessage({dgn:"resize-artboard-request",artboardId:e.artboardId,width:t.width,height:t.height},"*")}catch{}}function Wc(e,t){try{window.parent.postMessage({dgn:"resize-request",id:e.cdId,patch:{transform:t},before:e.before,idIndex:e.idIndex},"*")}catch{}}function Cs(){Kc();let{selected:e}=Dt(),{tool:t}=jt(),n=Ut(null),o=Ut(null),r=Ut(null),s=Ut(null),a=e.length===1?e[0]:null,c=a&&typeof a.id==="string"?a.id:null,p=a&&!c&&typeof a.artboardId==="string"?a.artboardId:null,f=t==="move"&&!!c;Ts(()=>{let g=n.current;if(!g)return;let w=()=>{for(let m of Array.from(g.children)){let h=m;h.style.opacity="0",h.style.pointerEvents="none"}};if(!f||!a){w();return}let A=()=>{if(o.current=null,gs()){w(),o.current=requestAnimationFrame(A);return}let m=En(document,a);if(!m){w(),o.current=requestAnimationFrame(A);return}let h=m.getBoundingClientRect();if(h.width<=0&&h.height<=0){w(),o.current=requestAnimationFrame(A);return}let S=p?["e","s","se"]:zc,y=p?[]:["rot-nw","rot-ne","rot-sw","rot-se"],i=S.length+y.length+1;while(g.children.length<i)g.appendChild(document.createElement("div"));while(g.children.length>i)g.lastChild&&g.removeChild(g.lastChild);let b=h.left+h.width/2,E=h.top+h.height/2,L=Ms(getComputedStyle(m).transform),O=$c(m),z=m.offsetWidth*O/2,G=m.offsetHeight*O/2,D={nw:[-z,-G],n:[0,-G],ne:[z,-G],e:[z,0],se:[z,G],s:[0,G],sw:[-z,G],w:[-z,0],"rot-nw":[-z,-G],"rot-ne":[z,-G],"rot-sw":[-z,G],"rot-se":[z,G]},W=[...y,...S];for(let oe=0;oe<W.length;oe++){let te=W[oe],k=g.children[oe],[T,I]=D[te]??[0,0],[M,K]=As(T,I,L),F=b+M,j=E+K,Y=te.startsWith("rot-"),Ee=te==="n"||te==="s",Te=te==="e"||te==="w",Me=Y?10:Ee?7:Te?3:4,Oe=Y?10:Ee?3:Te?7:4;k.className="dc-el-resize-handle",k.dataset.corner=te,k.style.opacity="1",k.style.pointerEvents="auto",k.style.left=`${Math.round(F-Me)}px`,k.style.top=`${Math.round(j-Oe)}px`,k.style.transform=Y?"":`rotate(${L}deg)`}let Q=g.children[W.length],ee=r.current;if(ee&&ee.el===m&&!ee.corner.startsWith("rot-")){let oe=ee.lastResult?.width??m.offsetWidth,te=ee.lastResult?.height??m.offsetHeight,k=`${Math.round(oe)} × ${Math.round(te)}`,T=ee.lastResult?.left,I=ee.lastResult?.top;if(typeof T==="number"||typeof I==="number")k+=` · ${Math.round(T??ee.start.left)}, ${Math.round(I??ee.start.top)}`;Q.className="dc-el-resize-readout",Q.textContent=k,Q.style.opacity="1",Q.style.left=`${Math.round(b)}px`,Q.style.top=`${Math.round(E+G)}px`}else Q.style.opacity="0";o.current=requestAnimationFrame(A)};return o.current=requestAnimationFrame(A),()=>{if(o.current!=null)cancelAnimationFrame(o.current)}},[f,a,p]);let x=Nc((g,w)=>{if(g.el.style.width=`${w.width}px`,g.el.style.height=`${w.height}px`,typeof w.left==="number")g.el.style.left=`${w.left}px`;if(typeof w.top==="number")g.el.style.top=`${w.top}px`;g.lastResult=w},[]);return Ts(()=>{let g=n.current;if(!g)return;let w=(y,i)=>{let[b,E]=As(i.clientX-y.startClientX,i.clientY-y.startClientY,-y.angle);return Hc(y.corner,y.start,b/y.elZoom,E/y.elZoom,{aspect:!!i.shiftKey,center:!y.artboardId&&!!i.altKey},y.flags)},A=(y)=>{let i=y.target;if(!i?.classList.contains("dc-el-resize-handle"))return;let b=i.dataset.corner;if(!b||!a)return;let E=typeof a.id==="string"?a.id:null,L=!E&&typeof a.artboardId==="string"?a.artboardId:null;if(!E&&!L)return;let O=En(document,a);if(!O)return;y.preventDefault(),y.stopPropagation();let z=O.getBoundingClientRect(),G=O.offsetWidth?z.width/O.offsetWidth:1,D=getComputedStyle(O),W=!L&&(D.position==="absolute"||D.position==="fixed"),Q=L?Number.NaN:Number.parseFloat(O.style.left),ee=L?Number.NaN:Number.parseFloat(O.style.top),oe=L?0:Ms(D.transform),te=G>0?G:1,k=z.left+z.width/2,T=z.top+z.height/2,I={pointerId:y.pointerId,corner:b,el:O,cdId:E??"",artboardId:L,idIndex:E?ur(document,E,O):0,startClientX:y.clientX,startClientY:y.clientY,elZoom:te,angle:oe,cx:k,cy:T,rotStartPointer:Rs(k,T,y.clientX,y.clientY),start:{w:(oe?O.offsetWidth:z.width/te)||z.width/te,h:(oe?O.offsetHeight:z.height/te)||z.height/te,left:Q,top:ee},flags:{canMoveLeft:W&&Number.isFinite(Q),canMoveTop:W&&Number.isFinite(ee)},before:{width:O.style.width||null,height:O.style.height||null,left:O.style.left||null,top:O.style.top||null,transform:O.style.transform||null},lastResult:null,lastTransform:null};r.current=I;try{i.setPointerCapture(y.pointerId)}catch{}},m=(y)=>{let i=r.current;if(!i||y.pointerId!==i.pointerId)return;if(y.preventDefault(),i.corner.startsWith("rot-")){let E=`rotate(${qc(i.angle,i.rotStartPointer,Rs(i.cx,i.cy,y.clientX,y.clientY),!!y.shiftKey)}deg)`;i.el.style.transform=E,i.lastTransform=E;return}x(i,w(i,y))},h=(y)=>{let i=r.current;if(!i||y.pointerId!==i.pointerId)return;if(r.current=null,i.corner.startsWith("rot-")){let L=i.lastTransform;if(!L||L===i.before.transform)return;s.current={el:i.el,before:i.before},Wc(i,L);return}let b=i.lastResult??w(i,y);if(!(`${b.width}px`!==i.before.width||`${b.height}px`!==i.before.height||typeof b.left==="number"&&`${b.left}px`!==i.before.left||typeof b.top==="number"&&`${b.top}px`!==i.before.top))return;if(s.current={el:i.el,before:i.before},i.artboardId)Uc(i,b);else jc(i,b)},S=(y)=>{let i=y.data;if(i?.dgn!=="resize-failed"&&i?.dgn!=="resize-artboard-failed")return;if(y.source!==window.parent)return;let b=s.current;if(!b)return;if(b.el.style.width=b.before.width??"",b.el.style.height=b.before.height??"",b.before.left!==null||b.el.style.left)b.el.style.left=b.before.left??"";if(b.before.top!==null||b.el.style.top)b.el.style.top=b.before.top??"";if(b.before.transform!==null||b.el.style.transform)b.el.style.transform=b.before.transform??"";s.current=null};return g.addEventListener("pointerdown",A),window.addEventListener("pointermove",m),window.addEventListener("pointerup",h),window.addEventListener("pointercancel",h),window.addEventListener("message",S),()=>{g.removeEventListener("pointerdown",A),window.removeEventListener("pointermove",m),window.removeEventListener("pointerup",h),window.removeEventListener("pointercancel",h),window.removeEventListener("message",S)}},[a,x]),Bc("div",{ref:n,"aria-hidden":"true"})}import{jsx as me,jsxs as Ls,Fragment as cd}from"react/jsx-runtime";var Gc=new Set(["drop-comment","tool","escape","hover"]);function Zc(e,t){if(!e)return!0;t();return}function Ge(){return typeof document<"u"&&!document.querySelector(".dc-canvas")}function eo(e,t){if(typeof document>"u")return null;let n=document.elementFromPoint(e,t);if(!n)return null;if(n.closest(".cm-composer, .cm-thread, .cm-mention-popup, .cm-pin, [data-mc-hover-halo], [data-mc-selection-halo], .dc-el-resize-handle"))return null;let o=n.tagName;if(o==="HTML"||o==="BODY")return null;return n}function Jc(e,t){let n=eo(e,t);if(!n)return null;return n.closest("[data-cd-id]")??n}function ed({children:e,file:t}){let{tool:n,setTool:o,getTool:r}=jt(),s=Dt(),a=we(null),[c,p]=Ze(null),f=we(n);f.current=n;let x=Qc(()=>()=>r?.()??f.current,[r]);ye(()=>{if(n!=="comment")p(null)},[n]);let[g,w]=Ze(null),[A,m]=Ze(!1);return ye(()=>{let h=()=>m(Ge());h();let S=requestAnimationFrame(h),y=setTimeout(h,120);return()=>{cancelAnimationFrame(S),clearTimeout(y)}},[]),ye(()=>{if(typeof document>"u")return;let h=(S)=>{if(S.button!==0||!(S.metaKey||S.ctrlKey))return;if(!Ge())return;if(ct(S.target))return;let y=Jc(S.clientX,S.clientY);if(!y)return;S.preventDefault(),S.stopImmediatePropagation();let i=y.getAttribute("data-cd-id"),b=Tn({el:y,cdId:i,artboardId:null});if(S.shiftKey)s.add(b);else s.replace(b);w(y)};return document.addEventListener("pointerdown",h,!0),()=>document.removeEventListener("pointerdown",h,!0)},[s]),ye(()=>{if(s.selected.length===0)w(null)},[s.selected]),ye(()=>{let h=a.current;if(h)h.setAttribute("data-active-tool",n);if(typeof document<"u"&&document.body)document.body.setAttribute("data-active-tool",n);return()=>{h?.removeAttribute("data-active-tool")}},[n]),ye(()=>{if(typeof window>"u")return;let h=(S)=>{let y=S.data;if(!y||typeof y!=="object"||y.dgn!=="tool-set")return;if(S.source!==window.parent)return;if(typeof y.tool==="string")o(y.tool)};return window.addEventListener("message",h),()=>window.removeEventListener("message",h)},[o]),fs({hostRef:a,getActiveTool:x,claimableActions:Gc,callbacks:{onHover:({clientX:h,clientY:S})=>{if(f.current!=="comment"||!Ge()){p(null);return}let y=eo(h,S);p((i)=>i===y?i:y)},onTool:({tool:h})=>o(h),onEscape:()=>Zc(Ge(),()=>{if(f.current!=="move")o("move");if(p(null),s.clear(),typeof window<"u")try{window.parent.postMessage({dgn:"force-clear"},"*")}catch{}}),onDropComment:({clientX:h,clientY:S})=>od(h,S,s,t)}}),Ls("div",{"data-mc-host":!0,ref:a,style:{display:"contents"},children:[e,c?me(nd,{el:c}):null,g?me(td,{el:g}):null,A?me(Cs,{}):null,me(Kr,{})]})}function td({el:e}){let t=we(null),n=we(e);n.current=e;let o=we(null);return ye(()=>{let r=()=>{o.current=null;let s=t.current,a=n.current;if(s&&a?.isConnected){let c=a.getBoundingClientRect();if(c.width===0&&c.height===0)s.style.display="none";else s.style.display="block",s.style.left=`${Math.round(c.left)}px`,s.style.top=`${Math.round(c.top)}px`,s.style.width=`${Math.round(c.width)}px`,s.style.height=`${Math.round(c.height)}px`}else if(s)s.style.display="none";o.current=requestAnimationFrame(r)};return o.current=requestAnimationFrame(r),()=>{if(o.current!=null)cancelAnimationFrame(o.current)}},[]),me("div",{ref:t,"aria-hidden":"true","data-mc-selection-halo":"",style:{position:"fixed",display:"none",pointerEvents:"none",zIndex:2147483645,border:"1.5px solid var(--maude-hud-accent, oklch(0.680 0.180 268))",borderRadius:"3px",boxSizing:"border-box"}})}function nd({el:e}){let t=we(null),n=we(e);n.current=e;let o=we(null);return ye(()=>{let r=()=>{o.current=null;let s=t.current,a=n.current;if(s&&a?.isConnected){let c=a.getBoundingClientRect();if(c.width===0&&c.height===0)s.style.display="none";else s.style.display="block",s.style.left=`${Math.round(c.left)}px`,s.style.top=`${Math.round(c.top)}px`,s.style.width=`${Math.round(c.width)}px`,s.style.height=`${Math.round(c.height)}px`}else if(s)s.style.display="none";o.current=requestAnimationFrame(r)};return o.current=requestAnimationFrame(r),()=>{if(o.current!=null)cancelAnimationFrame(o.current)}},[]),me("div",{ref:t,"aria-hidden":"true","data-mc-hover-halo":"",style:{position:"fixed",display:"none",pointerEvents:"none",zIndex:2147483646,border:"2px solid var(--maude-hud-accent, #d63b1f)",borderRadius:"3px",boxSizing:"border-box"}})}function od(e,t,n,o){if(typeof document>"u")return;let r=Lo(e,t)??void 0,s=No(e,t);if(s){let p=xt(s),f=p?.getBoundingClientRect(),x={file:o,id:void 0,selector:"",artboardId:null,tag:p?.getAttribute("data-tool")??"annotation",classes:"",text:"",dom_path:[],bounds:f?{x:f.left,y:f.top,w:f.width,h:f.height}:{x:e-12,y:t-12,w:24,h:24},html:"",annotationId:s,...r?{world:r}:{}};Zn(x,e,t);return}let a=Ft(document,e,t,{deep:!0});if(!a)a=Ft(document,e,t,{deep:!1});if(!a&&!Ge()&&typeof document.elementsFromPoint==="function"){let p=document.elementsFromPoint(e,t);for(let f of p){let x=f.closest?.("[data-cd-id]");if(!x)continue;if(!x.closest(".dc-artboard-body"))continue;let g=x.closest("[data-dc-screen]");a={el:x,cdId:x.getAttribute("data-cd-id"),artboardId:g?.getAttribute("data-dc-screen")??null};break}}if(!a&&Ge()){let p=eo(e,t);if(p)a={el:p,cdId:p.getAttribute("data-cd-id"),artboardId:null}}if(!a){let p={file:o,id:void 0,selector:"",artboardId:null,tag:"",classes:"",text:"",dom_path:[],bounds:{x:e-12,y:t-12,w:24,h:24},html:"",...r?{world:r}:{}};Zn(p,e,t);return}let c=Tn(a,o);n.replace(c),Zn(c,e,t)}function Zn(e,t,n){if(typeof document<"u")try{document.dispatchEvent(new CustomEvent("cm:open-composer",{detail:{selection:e,clientX:t,clientY:n}}))}catch{}if(typeof window<"u")try{window.parent.postMessage({dgn:"comment-compose",selection:e},"*")}catch{}}function Ps(e,t){return me(Es,{initial:"browse",children:me(vr,{children:me(ed,{file:t,children:me(e,{})})})})}function Vm(e,t){let n=Yc(t.rootEl);if(!t.commentsEnabled){n.render(Jn(e));return}let o=t.file??Sn();n.render(Jn(ld,{initialCanvas:e,file:o}))}var Is="__maudeCanvasRuntime";function rd({Canvas:e,file:t,onOk:n}){return ye(()=>{n()},[]),Ps(e,t)}class _s extends Xc{state={hasError:!1};static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e){this.props.onError(e)}componentDidUpdate(e){if(e.attempt!==this.props.attempt&&this.state.hasError)this.setState({hasError:!1})}render(){if(this.state.hasError)return this.props.fallback();return this.props.children}}var sd=300;function id(e){let t="";try{t=e instanceof Error?e.message:String(e??"")}catch{}return(t.replace(/\s+/g," ").trim()||"The canvas stopped while drawing.").slice(0,sd)}function ad({message:e}){return Jn("div",{className:"dc-hmr-holding",role:"status","aria-live":"polite",title:e?`Showing the last version that worked — ${e}`:"Showing the last version that worked"},"This canvas has an error. Showing the last version that worked.")}function ld({initialCanvas:e,file:t}){let[{canvas:n,attempt:o},r]=Ze({canvas:e,attempt:0}),[s,a]=Ze({on:!1}),[c,p]=Ze(!1);ye(()=>{let h=(S)=>{if(S.source!==window.parent)return;if(S.data?.dgn!=="ai-runs")return;let y=vt(S,window);if(y&&y.dgn==="ai-runs")p(Object.values(y.artboards).some((i)=>i.state!=="done"))};return window.addEventListener("message",h),()=>window.removeEventListener("message",h)},[]);let f=we(null),x=we(null),g=we(n);g.current=n,ye(()=>{let h={remount:(S)=>r((y)=>({canvas:S,attempt:y.attempt+1})),setHolding:(S,y)=>a(S?{on:!0,message:y,source:"build"}:{on:!1})};return window[Is]=h,()=>{window[Is]=void 0}},[]);let w=Gn(()=>{if(f.current=g.current,x.current=null,t)try{window.parent.postMessage({dgn:"render-ok",file:t},"*")}catch{}if(a((h)=>h.on?{on:!1}:h),o>0&&t)try{window.parent.postMessage({dgn:"loaded",file:t},"*")}catch{}},[o,t]),A=Gn((h)=>{let S=id(h);if(a({on:!0,message:"render error",source:"render"}),x.current===g.current)return;if(x.current=g.current,t)try{window.parent.postMessage({dgn:"render-error",file:t,message:S},"*")}catch{}},[t]),m=Gn(()=>{let h=f.current;return h?Ps(h,t):null},[t]);return Ls(cd,{children:[me(_s,{attempt:o,onError:A,fallback:m,children:me(rd,{Canvas:n,file:t,onOk:w},o)}),s.on&&(s.source!=="render"||c)?me(ad,{message:s.message}):null]})}export{_s as CanvasErrorBoundary,Zc as commentMountEscape,id as describeRenderFailure,Ge as isBareSpecimen,Vm as mountCanvas,Jc as pickSpecimenSelectEl};