@baique/pi-web-sky 0.1.38 → 0.1.40

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 (379) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-path-routes-manifest.json +7 -12
  3. package/.next/build-manifest.json +3 -3
  4. package/.next/prerender-manifest.json +3 -3
  5. package/.next/react-loadable-manifest.json +51 -51
  6. package/.next/required-server-files.js +1 -1
  7. package/.next/required-server-files.json +1 -1
  8. package/.next/routes-manifest.json +3 -45
  9. package/.next/server/app/_global-error/page.js +2 -2
  10. package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  11. package/.next/server/app/_global-error.html +1 -1
  12. package/.next/server/app/_global-error.rsc +1 -1
  13. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  14. package/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  15. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  16. package/.next/server/app/_not-found/page.js +1 -1
  17. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  18. package/.next/server/app/_not-found.html +1 -1
  19. package/.next/server/app/_not-found.rsc +3 -3
  20. package/.next/server/app/_not-found.segments/_full.segment.rsc +3 -3
  21. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +3 -3
  22. package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  23. package/.next/server/app/api/agent/[id]/bash-output/route.js +2 -2
  24. package/.next/server/app/api/agent/[id]/events/route.js +2 -2
  25. package/.next/server/app/api/agent/[id]/route.js +2 -2
  26. package/.next/server/app/api/agent/new/route.js +1 -1
  27. package/.next/server/app/api/agent/new/route.js.nft.json +1 -1
  28. package/.next/server/app/api/agent/running/route.js +1 -1
  29. package/.next/server/app/api/app-update/route.js +1 -1
  30. package/.next/server/app/api/auth/all-providers/route.js +1 -1
  31. package/.next/server/app/api/auth/api-key/[provider]/route.js +1 -1
  32. package/.next/server/app/api/auth/login/[provider]/route.js +1 -1
  33. package/.next/server/app/api/auth/logout/[provider]/route.js +1 -1
  34. package/.next/server/app/api/auth/providers/route.js +1 -1
  35. package/.next/server/app/api/boards/[id]/reconcile/route.js +1 -0
  36. package/.next/server/app/api/boards/[id]/reconcile/route_client-reference-manifest.js +1 -0
  37. package/.next/server/app/api/boards/[id]/route.js +1 -1
  38. package/.next/server/app/api/boards/purge-orphans/route.js +1 -1
  39. package/.next/server/app/api/boards/reorder/route.js +1 -1
  40. package/.next/server/app/api/boards/route.js +1 -1
  41. package/.next/server/app/api/cwd/browse/route.js +1 -1
  42. package/.next/server/app/api/cwd/validate/route.js +2 -2
  43. package/.next/server/app/api/default-cwd/route.js +2 -2
  44. package/.next/server/app/api/file-index/route.js +2 -2
  45. package/.next/server/app/api/files/[...path]/route.js +3 -3
  46. package/.next/server/app/api/files/[...path]/route.js.nft.json +1 -1
  47. package/.next/server/app/api/git/diff/route.js +1 -1
  48. package/.next/server/app/api/git/status/route.js +1 -1
  49. package/.next/server/app/api/home/route.js +1 -1
  50. package/.next/server/app/api/mcp/route.js +1 -1
  51. package/.next/server/app/api/models/route.js +2 -2
  52. package/.next/server/app/api/models-config/catalog/route.js +1 -1
  53. package/.next/server/app/api/models-config/discover/route.js +1 -1
  54. package/.next/server/app/api/models-config/route.js +1 -1
  55. package/.next/server/app/api/models-config/test/route.js +1 -1
  56. package/.next/server/app/api/plugins/route.js +2 -2
  57. package/.next/server/app/api/project-trust/route.js +2 -2
  58. package/.next/server/app/api/quota/route.js +1 -1
  59. package/.next/server/app/api/search/route.js +2 -2
  60. package/.next/server/app/api/sessions/[id]/auto-name/route.js +3 -3
  61. package/.next/server/app/api/sessions/[id]/context/route.js +2 -2
  62. package/.next/server/app/api/sessions/[id]/entries/[entryId]/thinking/route.js +2 -2
  63. package/.next/server/app/api/sessions/[id]/export/route.js +2 -2
  64. package/.next/server/app/api/sessions/[id]/route.js +1 -1
  65. package/.next/server/app/api/sessions/[id]/state/route.js +2 -2
  66. package/.next/server/app/api/sessions/[id]/todos/route.js +2 -2
  67. package/.next/server/app/api/sessions/route.js +2 -2
  68. package/.next/server/app/api/skills/check/route.js +1 -1
  69. package/.next/server/app/api/skills/install/route.js +2 -2
  70. package/.next/server/app/api/skills/route.js +1 -1
  71. package/.next/server/app/api/skills/search/route.js +1 -1
  72. package/.next/server/app/api/skills/update/route.js +1 -1
  73. package/.next/server/app/api/task-card-questions/[id]/answer/route.js +1 -1
  74. package/.next/server/app/api/task-card-questions/route.js +1 -1
  75. package/.next/server/app/api/task-cards/[id]/route.js +1 -1
  76. package/.next/server/app/api/task-cards/route.js +1 -1
  77. package/.next/server/app/api/task-scheduler/status/route.js +1 -1
  78. package/.next/server/app/api/tasks/[id]/board/route.js +1 -1
  79. package/.next/server/app/api/tasks/[id]/route.js +1 -1
  80. package/.next/server/app/api/tasks/reorder/route.js +1 -1
  81. package/.next/server/app/api/tasks/route.js +1 -1
  82. package/.next/server/app/api/terminal/[id]/events/route.js +2 -2
  83. package/.next/server/app/api/terminal/[id]/route.js +2 -2
  84. package/.next/server/app/api/terminal/route.js +2 -2
  85. package/.next/server/app/api/worktrees/route.js +2 -2
  86. package/.next/server/app/favicon.ico/route.js +1 -1
  87. package/.next/server/app/index.html +1 -1
  88. package/.next/server/app/index.rsc +5 -5
  89. package/.next/server/app/index.segments/__PAGE__.segment.rsc +5 -5
  90. package/.next/server/app/index.segments/_full.segment.rsc +5 -5
  91. package/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  92. package/.next/server/app/manifest.webmanifest/route.js +2 -2
  93. package/.next/server/app/page.js +7 -7
  94. package/.next/server/app/page_client-reference-manifest.js +1 -1
  95. package/.next/server/app-paths-manifest.json +7 -12
  96. package/.next/server/chunks/1094.js +2 -2
  97. package/.next/server/chunks/1601.js +1 -1
  98. package/.next/server/chunks/1860.js +1 -1
  99. package/.next/server/chunks/2075.js +1 -1
  100. package/.next/server/chunks/2169.js +1 -1
  101. package/.next/server/chunks/2404.js +1 -1
  102. package/.next/server/chunks/2524.js +1 -0
  103. package/.next/server/chunks/3012.js +1 -1
  104. package/.next/server/chunks/{5760.js → 3379.js} +1 -1
  105. package/.next/server/chunks/3500.js +1 -1
  106. package/.next/server/chunks/4226.js +5 -2
  107. package/.next/server/chunks/4267.js +1 -1
  108. package/.next/server/chunks/4563.js +1 -1
  109. package/.next/server/chunks/5318.js +1 -1
  110. package/.next/server/chunks/542.js +3 -44
  111. package/.next/server/chunks/5794.js +1 -1
  112. package/.next/server/chunks/6052.js +1 -1
  113. package/.next/server/chunks/6253.js +1 -1
  114. package/.next/server/chunks/6288.js +1 -1
  115. package/.next/server/chunks/6366.js +1 -1
  116. package/.next/server/chunks/673.js +1 -1
  117. package/.next/server/chunks/6916.js +2 -2
  118. package/.next/server/chunks/7128.js +43 -0
  119. package/.next/server/chunks/7265.js +2 -2
  120. package/.next/server/chunks/7799.js +1 -1
  121. package/.next/server/chunks/8106.js +1 -1
  122. package/.next/server/chunks/8333.js +1 -1
  123. package/.next/server/chunks/8604.js +1 -1
  124. package/.next/server/chunks/861.js +1 -0
  125. package/.next/server/chunks/8713.js +1 -1
  126. package/.next/server/chunks/8782.js +2 -2
  127. package/.next/server/chunks/898.js +1 -1
  128. package/.next/server/chunks/922.js +2 -2
  129. package/.next/server/chunks/9280.js +6 -6
  130. package/.next/server/chunks/9510.js +1 -1
  131. package/.next/server/instrumentation.js +1 -1
  132. package/.next/server/instrumentation.js.nft.json +1 -1
  133. package/.next/server/middleware-build-manifest.js +1 -1
  134. package/.next/server/middleware-react-loadable-manifest.js +1 -1
  135. package/.next/server/pages/404.html +1 -1
  136. package/.next/server/pages/500.html +1 -1
  137. package/.next/server/server-reference-manifest.json +1 -1
  138. package/.next/static/chunks/{103.23142a67b02246a8.js → 103.6c91a059aa01d92c.js} +2 -2
  139. package/.next/static/chunks/{1032.12b382a9096ab2a4.js → 1032.9e8f793d46f463f8.js} +1 -1
  140. package/.next/static/chunks/{1063.775c442bdbeef08b.js → 1063.470df8a037dc8409.js} +1 -1
  141. package/.next/static/chunks/1a258343.f4fc2c133917ded8.js +2 -0
  142. package/.next/static/chunks/{1ba63609.b2ae90f43319a29e.js → 1ba63609.569928c7234f832c.js} +1 -1
  143. package/.next/static/chunks/{2181.ba21239d3ac39f81.js → 2181.b8dda21843ef5e74.js} +1 -1
  144. package/.next/static/chunks/{2325.23caf22075e51aa5.js → 2325.23e538886331cf64.js} +1 -1
  145. package/.next/static/chunks/{2356.523277bb8c6bf72a.js → 2356.b7312589c345edec.js} +1 -1
  146. package/.next/static/chunks/{268.72794ee2773c2060.js → 268.a1d90aca268be18a.js} +1 -1
  147. package/.next/static/chunks/{2695.6f49435bae1e6f33.js → 2695.5624aa3aae540e87.js} +1 -1
  148. package/.next/static/chunks/{2703.495a65ed14b2f094.js → 2703.097bc88286733740.js} +1 -1
  149. package/.next/static/chunks/{2821.934bcf60fbdc28c6.js → 2821.d2392a93d192fe92.js} +1 -1
  150. package/.next/static/chunks/3308.2cd6f20e6c0f4e92.js +73 -0
  151. package/.next/static/chunks/{3336.a76f9485fe7cb762.js → 3336.9b1dc9ec3507d64f.js} +1 -1
  152. package/.next/static/chunks/3546.779d2c7646aa77cc.js +1 -0
  153. package/.next/static/chunks/{370.8e8f3cf8eb0e29dd.js → 370.cde2a84caa84054f.js} +1 -1
  154. package/.next/static/chunks/{3716.72bf4c9d7325debd.js → 3716.5bac496cea32ca8f.js} +1 -1
  155. package/.next/static/chunks/{3995.eca0f5bef1fc3ae5.js → 3995.cd112debcd64c610.js} +1 -1
  156. package/.next/static/chunks/{4004.74b9bcf5478b1663.js → 4004.a8f79ef62f32aa30.js} +2 -2
  157. package/.next/static/chunks/{4202.8440832386f023c7.js → 4202.96f5b1beb8b3e3f5.js} +1 -1
  158. package/.next/static/chunks/{4238.6f102dcbcf2ae339.js → 4238.28efbf9aa0c82d90.js} +1 -1
  159. package/.next/static/chunks/{4405.7a19458960a1058e.js → 4405.cda46a596a02aef7.js} +1 -1
  160. package/.next/static/chunks/54a60aa6.5e4421e7afde4de8.js +78 -0
  161. package/.next/static/chunks/{6121.eb9023b1cbc78ee2.js → 6121.5e650e714b402b6f.js} +1 -1
  162. package/.next/static/chunks/{6195.1153369f5f8b13a2.js → 6195.1b7f9dc127381bbc.js} +1 -1
  163. package/.next/static/chunks/6380.d148a8e2c701ad78.js +68 -0
  164. package/.next/static/chunks/6582.efef0ed269bacae2.js +1 -0
  165. package/.next/static/chunks/6be7e44c.00d0163f409986f0.js +1 -0
  166. package/.next/static/chunks/{7331.2add3c4e125a2dba.js → 7331.4afa66d6353c8e07.js} +1 -1
  167. package/.next/static/chunks/752.f41a9dcb0e6548eb.js +1 -0
  168. package/.next/static/chunks/{8200.a36b9f8c983c6b9e.js → 8200.350d650649b977eb.js} +1 -1
  169. package/.next/static/chunks/{8885.cf60cac98bf8b70c.js → 8885.2c060cb45c85547b.js} +1 -1
  170. package/.next/static/chunks/{918.6a9bbe564e4a2d0f.js → 918.593eb466d35cb8ad.js} +1 -1
  171. package/.next/static/chunks/{9698.4d09a99b9d99f3e5.js → 9698.758755d0387e0e22.js} +2 -2
  172. package/.next/static/chunks/97.fb73c551e14b3612.js +2 -0
  173. package/.next/static/chunks/{993e5495.8797001fcfcf2889.js → 993e5495.12cdfbc3af5c79e9.js} +1 -1
  174. package/.next/static/chunks/{9974.9a0f79beca65e8c4.js → 9974.5ee982e074ad047e.js} +1 -1
  175. package/.next/static/chunks/app/_global-error/page-bb8f79f321e26750.js +1 -0
  176. package/.next/static/chunks/app/api/agent/[id]/bash-output/route-bb8f79f321e26750.js +1 -0
  177. package/.next/static/chunks/app/api/agent/[id]/events/route-bb8f79f321e26750.js +1 -0
  178. package/.next/static/chunks/app/api/agent/[id]/route-bb8f79f321e26750.js +1 -0
  179. package/.next/static/chunks/app/api/agent/new/route-bb8f79f321e26750.js +1 -0
  180. package/.next/static/chunks/app/api/agent/running/route-bb8f79f321e26750.js +1 -0
  181. package/.next/static/chunks/app/api/app-update/route-bb8f79f321e26750.js +1 -0
  182. package/.next/static/chunks/app/api/auth/all-providers/route-bb8f79f321e26750.js +1 -0
  183. package/.next/static/chunks/app/api/auth/api-key/[provider]/route-bb8f79f321e26750.js +1 -0
  184. package/.next/static/chunks/app/api/auth/login/[provider]/route-bb8f79f321e26750.js +1 -0
  185. package/.next/static/chunks/app/api/auth/logout/[provider]/route-bb8f79f321e26750.js +1 -0
  186. package/.next/static/chunks/app/api/auth/providers/route-bb8f79f321e26750.js +1 -0
  187. package/.next/static/chunks/app/api/boards/[id]/reconcile/route-bb8f79f321e26750.js +1 -0
  188. package/.next/static/chunks/app/api/boards/[id]/route-bb8f79f321e26750.js +1 -0
  189. package/.next/static/chunks/app/api/boards/purge-orphans/route-bb8f79f321e26750.js +1 -0
  190. package/.next/static/chunks/app/api/boards/reorder/route-bb8f79f321e26750.js +1 -0
  191. package/.next/static/chunks/app/api/boards/route-bb8f79f321e26750.js +1 -0
  192. package/.next/static/chunks/app/api/cwd/browse/route-bb8f79f321e26750.js +1 -0
  193. package/.next/static/chunks/app/api/cwd/validate/route-bb8f79f321e26750.js +1 -0
  194. package/.next/static/chunks/app/api/default-cwd/route-bb8f79f321e26750.js +1 -0
  195. package/.next/static/chunks/app/api/file-index/route-bb8f79f321e26750.js +1 -0
  196. package/.next/static/chunks/app/api/files/[...path]/route-bb8f79f321e26750.js +1 -0
  197. package/.next/static/chunks/app/api/git/diff/route-bb8f79f321e26750.js +1 -0
  198. package/.next/static/chunks/app/api/git/status/route-bb8f79f321e26750.js +1 -0
  199. package/.next/static/chunks/app/api/home/route-bb8f79f321e26750.js +1 -0
  200. package/.next/static/chunks/app/api/mcp/route-bb8f79f321e26750.js +1 -0
  201. package/.next/static/chunks/app/api/models/route-bb8f79f321e26750.js +1 -0
  202. package/.next/static/chunks/app/api/models-config/catalog/route-bb8f79f321e26750.js +1 -0
  203. package/.next/static/chunks/app/api/models-config/discover/route-bb8f79f321e26750.js +1 -0
  204. package/.next/static/chunks/app/api/models-config/route-bb8f79f321e26750.js +1 -0
  205. package/.next/static/chunks/app/api/models-config/test/route-bb8f79f321e26750.js +1 -0
  206. package/.next/static/chunks/app/api/plugins/route-bb8f79f321e26750.js +1 -0
  207. package/.next/static/chunks/app/api/project-trust/route-bb8f79f321e26750.js +1 -0
  208. package/.next/static/chunks/app/api/quota/route-bb8f79f321e26750.js +1 -0
  209. package/.next/static/chunks/app/api/search/route-bb8f79f321e26750.js +1 -0
  210. package/.next/static/chunks/app/api/sessions/[id]/auto-name/route-bb8f79f321e26750.js +1 -0
  211. package/.next/static/chunks/app/api/sessions/[id]/context/route-bb8f79f321e26750.js +1 -0
  212. package/.next/static/chunks/app/api/sessions/[id]/entries/[entryId]/thinking/route-bb8f79f321e26750.js +1 -0
  213. package/.next/static/chunks/app/api/sessions/[id]/export/route-bb8f79f321e26750.js +1 -0
  214. package/.next/static/chunks/app/api/sessions/[id]/route-bb8f79f321e26750.js +1 -0
  215. package/.next/static/chunks/app/api/sessions/[id]/state/route-bb8f79f321e26750.js +1 -0
  216. package/.next/static/chunks/app/api/sessions/[id]/todos/route-bb8f79f321e26750.js +1 -0
  217. package/.next/static/chunks/app/api/sessions/route-bb8f79f321e26750.js +1 -0
  218. package/.next/static/chunks/app/api/skills/check/route-bb8f79f321e26750.js +1 -0
  219. package/.next/static/chunks/app/api/skills/install/route-bb8f79f321e26750.js +1 -0
  220. package/.next/static/chunks/app/api/skills/route-bb8f79f321e26750.js +1 -0
  221. package/.next/static/chunks/app/api/skills/search/route-bb8f79f321e26750.js +1 -0
  222. package/.next/static/chunks/app/api/skills/update/route-bb8f79f321e26750.js +1 -0
  223. package/.next/static/chunks/app/api/task-card-questions/[id]/answer/route-bb8f79f321e26750.js +1 -0
  224. package/.next/static/chunks/app/api/task-card-questions/route-bb8f79f321e26750.js +1 -0
  225. package/.next/static/chunks/app/api/task-cards/[id]/route-bb8f79f321e26750.js +1 -0
  226. package/.next/static/chunks/app/api/task-cards/route-bb8f79f321e26750.js +1 -0
  227. package/.next/static/chunks/app/api/task-scheduler/status/route-bb8f79f321e26750.js +1 -0
  228. package/.next/static/chunks/app/api/tasks/[id]/board/route-bb8f79f321e26750.js +1 -0
  229. package/.next/static/chunks/app/api/tasks/[id]/route-bb8f79f321e26750.js +1 -0
  230. package/.next/static/chunks/app/api/tasks/reorder/route-bb8f79f321e26750.js +1 -0
  231. package/.next/static/chunks/app/api/tasks/route-bb8f79f321e26750.js +1 -0
  232. package/.next/static/chunks/app/api/terminal/[id]/events/route-bb8f79f321e26750.js +1 -0
  233. package/.next/static/chunks/app/api/terminal/[id]/route-bb8f79f321e26750.js +1 -0
  234. package/.next/static/chunks/app/api/terminal/route-bb8f79f321e26750.js +1 -0
  235. package/.next/static/chunks/app/api/worktrees/route-bb8f79f321e26750.js +1 -0
  236. package/.next/static/chunks/app/{layout-8d43a5f5cb228adb.js → layout-702d3c97d297c42d.js} +1 -1
  237. package/.next/static/chunks/app/manifest.webmanifest/route-bb8f79f321e26750.js +1 -0
  238. package/.next/static/chunks/app/page-fd18462c3c937a50.js +89 -0
  239. package/.next/static/chunks/next/dist/client/components/builtin/app-error-bb8f79f321e26750.js +1 -0
  240. package/.next/static/chunks/next/dist/client/components/builtin/forbidden-bb8f79f321e26750.js +1 -0
  241. package/.next/static/chunks/next/dist/client/components/builtin/not-found-bb8f79f321e26750.js +1 -0
  242. package/.next/static/chunks/next/dist/client/components/builtin/unauthorized-bb8f79f321e26750.js +1 -0
  243. package/.next/static/chunks/webpack-d17b4dde91b96c63.js +1 -0
  244. package/.next/static/css/0c7244f7214af81f.css +1 -0
  245. package/.next/static/css/12456255969ac8de.css +31 -0
  246. package/.next/trace +43 -48
  247. package/.next/trace-build +1 -1
  248. package/.next/types/app/api/boards/[id]/{reconcile-task-edges → reconcile}/route.ts +3 -3
  249. package/.next/types/routes.d.ts +2 -7
  250. package/.next/types/validator.ts +3 -48
  251. package/README.md +6 -9
  252. package/THIRD_PARTY_NOTICES.md +10 -82
  253. package/bin/pi-web-sky.js +3 -3
  254. package/lib/board-reconcile-scheduler.ts +56 -0
  255. package/lib/board-reconcile.test.mjs +252 -0
  256. package/lib/board-reconcile.ts +422 -0
  257. package/lib/board-store.test.mjs +26 -4
  258. package/lib/board-store.ts +44 -6
  259. package/lib/i18n/messages/en.ts +1 -1
  260. package/lib/i18n/messages/zh-CN.ts +1 -1
  261. package/lib/session-delete.ts +5 -0
  262. package/lib/sqlite-db.ts +13 -1
  263. package/lib/task-card-store.ts +26 -1
  264. package/lib/task-scheduler.test.mjs +79 -0
  265. package/lib/task-scheduler.ts +195 -21
  266. package/lib/yjs-room-server.mjs +139 -0
  267. package/package.json +12 -9
  268. package/server.mjs +7 -7
  269. package/.next/server/app/api/boards/[id]/canvas/route.js +0 -1
  270. package/.next/server/app/api/boards/[id]/canvas/route_client-reference-manifest.js +0 -1
  271. package/.next/server/app/api/boards/[id]/edges/[eid]/route.js +0 -1
  272. package/.next/server/app/api/boards/[id]/edges/[eid]/route.js.nft.json +0 -1
  273. package/.next/server/app/api/boards/[id]/edges/[eid]/route_client-reference-manifest.js +0 -1
  274. package/.next/server/app/api/boards/[id]/edges/route.js +0 -1
  275. package/.next/server/app/api/boards/[id]/edges/route.js.nft.json +0 -1
  276. package/.next/server/app/api/boards/[id]/edges/route_client-reference-manifest.js +0 -1
  277. package/.next/server/app/api/boards/[id]/nodes/[nid]/route.js +0 -1
  278. package/.next/server/app/api/boards/[id]/nodes/[nid]/route.js.nft.json +0 -1
  279. package/.next/server/app/api/boards/[id]/nodes/[nid]/route_client-reference-manifest.js +0 -1
  280. package/.next/server/app/api/boards/[id]/nodes/route.js +0 -1
  281. package/.next/server/app/api/boards/[id]/nodes/route.js.nft.json +0 -1
  282. package/.next/server/app/api/boards/[id]/nodes/route_client-reference-manifest.js +0 -1
  283. package/.next/server/app/api/boards/[id]/reconcile-task-edges/route.js +0 -1
  284. package/.next/server/app/api/boards/[id]/reconcile-task-edges/route.js.nft.json +0 -1
  285. package/.next/server/app/api/boards/[id]/reconcile-task-edges/route_client-reference-manifest.js +0 -1
  286. package/.next/static/chunks/3308.857c554428b3294e.js +0 -73
  287. package/.next/static/chunks/333.bf0651c789b2eb33.js +0 -1
  288. package/.next/static/chunks/5315.dba7515ae6e139ae.js +0 -4
  289. package/.next/static/chunks/54a60aa6.0e43cde7298ebcb7.js +0 -78
  290. package/.next/static/chunks/7999.879d5a20e8641752.js +0 -259
  291. package/.next/static/chunks/app/_global-error/page-d6f52627eddf9119.js +0 -1
  292. package/.next/static/chunks/app/api/agent/[id]/bash-output/route-d6f52627eddf9119.js +0 -1
  293. package/.next/static/chunks/app/api/agent/[id]/events/route-d6f52627eddf9119.js +0 -1
  294. package/.next/static/chunks/app/api/agent/[id]/route-d6f52627eddf9119.js +0 -1
  295. package/.next/static/chunks/app/api/agent/new/route-d6f52627eddf9119.js +0 -1
  296. package/.next/static/chunks/app/api/agent/running/route-d6f52627eddf9119.js +0 -1
  297. package/.next/static/chunks/app/api/app-update/route-d6f52627eddf9119.js +0 -1
  298. package/.next/static/chunks/app/api/auth/all-providers/route-d6f52627eddf9119.js +0 -1
  299. package/.next/static/chunks/app/api/auth/api-key/[provider]/route-d6f52627eddf9119.js +0 -1
  300. package/.next/static/chunks/app/api/auth/login/[provider]/route-d6f52627eddf9119.js +0 -1
  301. package/.next/static/chunks/app/api/auth/logout/[provider]/route-d6f52627eddf9119.js +0 -1
  302. package/.next/static/chunks/app/api/auth/providers/route-d6f52627eddf9119.js +0 -1
  303. package/.next/static/chunks/app/api/boards/[id]/canvas/route-d6f52627eddf9119.js +0 -1
  304. package/.next/static/chunks/app/api/boards/[id]/edges/[eid]/route-d6f52627eddf9119.js +0 -1
  305. package/.next/static/chunks/app/api/boards/[id]/edges/route-d6f52627eddf9119.js +0 -1
  306. package/.next/static/chunks/app/api/boards/[id]/nodes/[nid]/route-d6f52627eddf9119.js +0 -1
  307. package/.next/static/chunks/app/api/boards/[id]/nodes/route-d6f52627eddf9119.js +0 -1
  308. package/.next/static/chunks/app/api/boards/[id]/reconcile-task-edges/route-d6f52627eddf9119.js +0 -1
  309. package/.next/static/chunks/app/api/boards/[id]/route-d6f52627eddf9119.js +0 -1
  310. package/.next/static/chunks/app/api/boards/purge-orphans/route-d6f52627eddf9119.js +0 -1
  311. package/.next/static/chunks/app/api/boards/reorder/route-d6f52627eddf9119.js +0 -1
  312. package/.next/static/chunks/app/api/boards/route-d6f52627eddf9119.js +0 -1
  313. package/.next/static/chunks/app/api/cwd/browse/route-d6f52627eddf9119.js +0 -1
  314. package/.next/static/chunks/app/api/cwd/validate/route-d6f52627eddf9119.js +0 -1
  315. package/.next/static/chunks/app/api/default-cwd/route-d6f52627eddf9119.js +0 -1
  316. package/.next/static/chunks/app/api/file-index/route-d6f52627eddf9119.js +0 -1
  317. package/.next/static/chunks/app/api/files/[...path]/route-d6f52627eddf9119.js +0 -1
  318. package/.next/static/chunks/app/api/git/diff/route-d6f52627eddf9119.js +0 -1
  319. package/.next/static/chunks/app/api/git/status/route-d6f52627eddf9119.js +0 -1
  320. package/.next/static/chunks/app/api/home/route-d6f52627eddf9119.js +0 -1
  321. package/.next/static/chunks/app/api/mcp/route-d6f52627eddf9119.js +0 -1
  322. package/.next/static/chunks/app/api/models/route-d6f52627eddf9119.js +0 -1
  323. package/.next/static/chunks/app/api/models-config/catalog/route-d6f52627eddf9119.js +0 -1
  324. package/.next/static/chunks/app/api/models-config/discover/route-d6f52627eddf9119.js +0 -1
  325. package/.next/static/chunks/app/api/models-config/route-d6f52627eddf9119.js +0 -1
  326. package/.next/static/chunks/app/api/models-config/test/route-d6f52627eddf9119.js +0 -1
  327. package/.next/static/chunks/app/api/plugins/route-d6f52627eddf9119.js +0 -1
  328. package/.next/static/chunks/app/api/project-trust/route-d6f52627eddf9119.js +0 -1
  329. package/.next/static/chunks/app/api/quota/route-d6f52627eddf9119.js +0 -1
  330. package/.next/static/chunks/app/api/search/route-d6f52627eddf9119.js +0 -1
  331. package/.next/static/chunks/app/api/sessions/[id]/auto-name/route-d6f52627eddf9119.js +0 -1
  332. package/.next/static/chunks/app/api/sessions/[id]/context/route-d6f52627eddf9119.js +0 -1
  333. package/.next/static/chunks/app/api/sessions/[id]/entries/[entryId]/thinking/route-d6f52627eddf9119.js +0 -1
  334. package/.next/static/chunks/app/api/sessions/[id]/export/route-d6f52627eddf9119.js +0 -1
  335. package/.next/static/chunks/app/api/sessions/[id]/route-d6f52627eddf9119.js +0 -1
  336. package/.next/static/chunks/app/api/sessions/[id]/state/route-d6f52627eddf9119.js +0 -1
  337. package/.next/static/chunks/app/api/sessions/[id]/todos/route-d6f52627eddf9119.js +0 -1
  338. package/.next/static/chunks/app/api/sessions/route-d6f52627eddf9119.js +0 -1
  339. package/.next/static/chunks/app/api/skills/check/route-d6f52627eddf9119.js +0 -1
  340. package/.next/static/chunks/app/api/skills/install/route-d6f52627eddf9119.js +0 -1
  341. package/.next/static/chunks/app/api/skills/route-d6f52627eddf9119.js +0 -1
  342. package/.next/static/chunks/app/api/skills/search/route-d6f52627eddf9119.js +0 -1
  343. package/.next/static/chunks/app/api/skills/update/route-d6f52627eddf9119.js +0 -1
  344. package/.next/static/chunks/app/api/task-card-questions/[id]/answer/route-d6f52627eddf9119.js +0 -1
  345. package/.next/static/chunks/app/api/task-card-questions/route-d6f52627eddf9119.js +0 -1
  346. package/.next/static/chunks/app/api/task-cards/[id]/route-d6f52627eddf9119.js +0 -1
  347. package/.next/static/chunks/app/api/task-cards/route-d6f52627eddf9119.js +0 -1
  348. package/.next/static/chunks/app/api/task-scheduler/status/route-d6f52627eddf9119.js +0 -1
  349. package/.next/static/chunks/app/api/tasks/[id]/board/route-d6f52627eddf9119.js +0 -1
  350. package/.next/static/chunks/app/api/tasks/[id]/route-d6f52627eddf9119.js +0 -1
  351. package/.next/static/chunks/app/api/tasks/reorder/route-d6f52627eddf9119.js +0 -1
  352. package/.next/static/chunks/app/api/tasks/route-d6f52627eddf9119.js +0 -1
  353. package/.next/static/chunks/app/api/terminal/[id]/events/route-d6f52627eddf9119.js +0 -1
  354. package/.next/static/chunks/app/api/terminal/[id]/route-d6f52627eddf9119.js +0 -1
  355. package/.next/static/chunks/app/api/terminal/route-d6f52627eddf9119.js +0 -1
  356. package/.next/static/chunks/app/api/worktrees/route-d6f52627eddf9119.js +0 -1
  357. package/.next/static/chunks/app/manifest.webmanifest/route-d6f52627eddf9119.js +0 -1
  358. package/.next/static/chunks/app/page-c18559cf60413a65.js +0 -89
  359. package/.next/static/chunks/e3e7ddb2.a35db430b3564999.js +0 -1
  360. package/.next/static/chunks/next/dist/client/components/builtin/app-error-d6f52627eddf9119.js +0 -1
  361. package/.next/static/chunks/next/dist/client/components/builtin/forbidden-d6f52627eddf9119.js +0 -1
  362. package/.next/static/chunks/next/dist/client/components/builtin/not-found-d6f52627eddf9119.js +0 -1
  363. package/.next/static/chunks/next/dist/client/components/builtin/unauthorized-d6f52627eddf9119.js +0 -1
  364. package/.next/static/chunks/webpack-4bbf04891e910713.js +0 -1
  365. package/.next/static/css/422c7dc0faa04d89.css +0 -1
  366. package/.next/static/css/80c818c5781fbadc.css +0 -4
  367. package/.next/types/app/api/boards/[id]/canvas/route.ts +0 -353
  368. package/.next/types/app/api/boards/[id]/edges/[eid]/route.ts +0 -353
  369. package/.next/types/app/api/boards/[id]/edges/route.ts +0 -353
  370. package/.next/types/app/api/boards/[id]/nodes/[nid]/route.ts +0 -353
  371. package/.next/types/app/api/boards/[id]/nodes/route.ts +0 -353
  372. package/lib/board-search.test.mjs +0 -110
  373. package/lib/board-search.ts +0 -63
  374. package/lib/file-explorer-state.test.mjs +0 -63
  375. package/lib/file-explorer-state.ts +0 -36
  376. package/lib/sync-room-server.mjs +0 -137
  377. /package/.next/server/app/api/boards/[id]/{canvas → reconcile}/route.js.nft.json +0 -0
  378. /package/.next/static/{uMxGf7jVVswENHUfDPlFN → 12RFLqhiUZG8Sj49T1KKQ}/_buildManifest.js +0 -0
  379. /package/.next/static/{uMxGf7jVVswENHUfDPlFN → 12RFLqhiUZG8Sj49T1KKQ}/_ssgManifest.js +0 -0
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3051],{94833:(e,t,i)=>{i.d(t,{K:()=>ea});var s=i(83102),r=i(54530),n=i(81467),a=i(24167),o=i(64411),h=i(43631),l=i(36649),p=i(52800),d=i(43336),g=i(97986),u=i(15727),c=i(48077),S=i(2311),f=i(19065),m=i(84469),y=i(89658),I=i(65390),P=i(59830),C=i(58347),w=i(75567),_=i(81962),x=i(54939),T=i(93286),b=i(46195),v=i(28879),E=i(23919),k=i(11421),A=i(4343),B=i(48877),M=i(69409),F=i(4599),U=i(20026),R=i(92599),O=i(1793),z=i(98466),L=i(49450),K=i(68935),D=i(32314),V=i(79224),W=i(98626),H=i(49402),N=i(51286),Z=i(8810),G=i(12318),X=i(99714),Y=i(73578),q=i(17858),j=i(2642),Q=i(43502),$=i(31832),J=i(40002),ee=i(13004),et=i(61307),ei=i(78943),es=Object.defineProperty,er=Object.getOwnPropertyDescriptor,en=(e,t,i,s)=>{for(var r,n=s>1?void 0:s?er(t,i):t,a=e.length-1;a>=0;a--)(r=e[a])&&(n=(s?r(t,i,n):r(n))||n);return s&&n&&es(t,i,n),n};class ea extends o{id=(0,a.NF)();constructor({store:e,user:t,shapeUtils:i,bindingUtils:r,assetUtils:o,overlayUtils:g,tools:c,getContainer:S,cameraOptions:f,initialState:m,autoFocus:y,options:P,textOptions:C,getShapeVisibility:w,colorScheme:_,fontAssetUrls:x,themes:T,initialTheme:b}){super(),this._getShapeVisibility=w;const v=C?{...P,text:P?.text??C}:P;this.options={...I._,...v},this.store=e,this.history=new Z.c({store:e,annotateError:e=>{this.annotateError(e,{origin:"history.batch",willCrashApp:!0}),this.crash(e)}}),this.snaps=new q.m(this),this._spatialIndex=new j.i(this),this.disposables.add(()=>this._spatialIndex.dispose()),this.disposables.add(this.timers.dispose),this._cameraOptions.set({...u.zd,...f,...v?.camera}),this.getContainer=S,this._textOptions=(0,s.eU)("text options",v?.text??null),this.user=new ee.f(t??(0,h.b)(),_??"light"),this.disposables.add(()=>this.user.dispose()),this.textMeasure=new Q.T(this),this.disposables.add(()=>this.textMeasure.dispose()),this._themeManager=new $.N(this,{themes:(0,$.P)(T),initial:b??"default"}),this.disposables.add(()=>this._themeManager.dispose()),this._tickManager=new J.D(this),this.disposables.add(()=>this._tickManager.dispose()),this.disposables.add(()=>{this._setCameraState("idle")}),this.fonts=new N.L(this,x),this.disposables.add(()=>this.fonts.dispose()),this.inputs=new G.v(this),this.disposables.add(()=>this.inputs.dispose()),this.performance=new X._(this),this.disposables.add(()=>this.performance.dispose()),this.collaborators=new V.f(this);class E extends ei.y{static initial=m??""}this.root=new E(this),this.root.children={},this.markEventAsHandled=this.markEventAsHandled.bind(this);const k=(0,d.u)(i),A={},B={},M=new Map;for(const e of k){const t=new e(this);A[e.type]=t;const i=(0,n.lg)(e.props??{});for(const t of(B[e.type]=i,i.keys()))if(M.has(t.id)){if(M.get(t.id)!==t)throw Error(`Multiple style props with id "${t.id}" in use. Style prop IDs must be unique.`)}else M.set(t.id,t)}this.shapeUtils=A,this.styleProps=B;const F={};for(const e of k){const t=e.handledAssetTypes;if(t)for(const i of t)F[i]=A[e.type]}this._shapeUtilsByAssetType=F;const U=(0,p.t)(r),R={};for(const e of U){const t=new e(this);R[e.type]=t}if(this.bindingUtils=R,o){const e=(0,l.U)(o),t={};for(const i of e){const e=new i(this);t[i.type]=e}this.assetUtils=t}for(const e of[...c]){if((0,a.mQ)(this.root.children,e.id))throw Error(`Can't override tool with id "${e.id}"`);this.root.children[e.id]=new e(this,this.root)}if(this.scribbles=new Y.y(this),this.overlays=new et.Q(this),this.disposables.add(()=>this.overlays.dispose()),g)for(const e of g){const t=new e(this);this.overlays.registerUtil(t)}const O=(e,t)=>{let i=null,s=e.selectedShapeIds.filter(e=>!t.has(e));s.length!==e.selectedShapeIds.length&&(i||(i={...e}),i.selectedShapeIds=s);let r=e.erasingShapeIds.filter(e=>!t.has(e));r.length!==e.erasingShapeIds.length&&(i||(i={...e}),i.erasingShapeIds=r),e.hoveredShapeId&&t.has(e.hoveredShapeId)&&(i||(i={...e}),i.hoveredShapeId=null),e.editingShapeId&&t.has(e.editingShapeId)&&(i||(i={...e}),i.editingShapeId=null);let n=e.hintingShapeIds.filter(e=>!t.has(e));return n.length!==e.hintingShapeIds.length&&(i||(i={...e}),i.hintingShapeIds=n),e.focusedGroupId&&t.has(e.focusedGroupId)&&(i||(i={...e}),i.focusedGroupId=null),i};this.sideEffects=this.store.sideEffects;let z=new Map;const D=new Set,es=new Set,er=new Set;let en=new Set;if(this.disposables.add(this.sideEffects.registerOperationCompleteHandler(()=>{let e=D.size?new Set(D):null;if(D.clear(),e){let t=(0,a.oE)(this.getPageStates().map(t=>O(t,e)));t.length&&this.store.put(t)}let t=new Set(er);for(let e of(er.clear(),es)){if(es.delete(e),t.has(e))continue;let i=this.getShape(e);if(!i)continue;let s=this.getShapeUtil(i),r=s.onChildrenChange?.(i);r?.length&&this.updateShapes(r)}if(en.size){let e=en;for(let t of(en=new Set,e)){let e=this.getBindingUtil(t);e.onOperationComplete?.()}}if(z.size){let e=z;for(let t of(z=new Map,e.values()))this.getBindingUtil(t.binding).onAfterDelete?.(t)}this.emit("update")})),this.disposables.add(this.sideEffects.register({shape:{afterCreate:e=>{er.add(e.id),e.parentId&&(0,n.vc)(e.parentId)&&es.add(e.parentId)},afterChange:(e,t)=>{for(let i of this.getBindingsInvolvingShape(t))en.add(i.type),i.fromId===t.id&&this.getBindingUtil(i).onAfterChangeFromShape?.({binding:i,shapeBefore:e,shapeAfter:t,reason:"self"}),i.toId===t.id&&this.getBindingUtil(i).onAfterChangeToShape?.({binding:i,shapeBefore:e,shapeAfter:t,reason:"self"});if(e.parentId!==t.parentId){let e=e=>{let t=this.getShape(e);if(t)for(let e of this.getBindingsInvolvingShape(t))en.add(e.type),e.fromId===t.id&&this.getBindingUtil(e).onAfterChangeFromShape?.({binding:e,shapeBefore:t,shapeAfter:t,reason:"ancestry"}),e.toId===t.id&&this.getBindingUtil(e).onAfterChangeToShape?.({binding:e,shapeBefore:t,shapeAfter:t,reason:"ancestry"})};e(t.id),this.visitDescendants(t.id,e)}if(e.parentId!==t.parentId&&(0,n.xh)(t.parentId)){let i=new Set([e.id]);for(let s of(this.visitDescendants(e.id,e=>{i.add(e)}),this.getPageStates())){if(s.pageId===t.parentId)continue;let e=O(s,i);e&&this.store.put([e])}}e.parentId&&(0,n.vc)(e.parentId)&&es.add(e.parentId),t.parentId!==e.parentId&&(0,n.vc)(t.parentId)&&es.add(t.parentId)},beforeDelete:e=>{if(D.has(e.id))return;e.parentId&&(0,n.vc)(e.parentId)&&es.add(e.parentId),D.add(e.id);let t=[];for(let i of this.getBindingsInvolvingShape(e)){en.add(i.type),t.push(i.id);let s=this.getBindingUtil(i);i.fromId===e.id?(s.onBeforeIsolateToShape?.({binding:i,removedShape:e}),s.onBeforeDeleteFromShape?.({binding:i,shape:e})):(s.onBeforeIsolateFromShape?.({binding:i,removedShape:e}),s.onBeforeDeleteToShape?.({binding:i,shape:e}))}t.length&&this.deleteBindings(t)}},binding:{beforeCreate:e=>{let t=this.getBindingUtil(e).onBeforeCreate?.({binding:e});return t||e},afterCreate:e=>{en.add(e.type),this.getBindingUtil(e).onAfterCreate?.({binding:e})},beforeChange:(e,t)=>{let i=this.getBindingUtil(t).onBeforeChange?.({bindingBefore:e,bindingAfter:t});return i||t},afterChange:(e,t)=>{en.add(t.type),this.getBindingUtil(t).onAfterChange?.({bindingBefore:e,bindingAfter:t})},beforeDelete:e=>{this.getBindingUtil(e).onBeforeDelete?.({binding:e})},afterDelete:e=>{this.getBindingUtil(e).onAfterDelete?.({binding:e}),en.add(e.type)}},page:{afterCreate:e=>{let t=n.Xu.createId(e.id),i=n.jA.createId(e.id);this.store.has(t)||this.store.put([n.Xu.create({id:t})]),this.store.has(i)||this.store.put([n.jA.create({id:i,pageId:e.id})])},afterDelete:(e,t)=>{if(this.getInstanceState()?.currentPageId===e.id){let i=this.getPages().find(t=>t.id!==e.id)?.id;i?this.store.put([{...this.getInstanceState(),currentPageId:i}]):"user"===t&&this.store.ensureStoreIsUsable()}let i=n.Xu.createId(e.id),s=n.jA.createId(e.id);this.store.remove([i,s])}},instance:{afterChange:(e,t,i)=>{if(!this.store.has(t.currentPageId)){let s=this.store.has(e.currentPageId)?e.currentPageId:this.getPages()[0]?.id;s?this.store.update(t.id,e=>({...e,currentPageId:s})):"user"===i&&this.store.ensureStoreIsUsable()}}},instance_page_state:{afterChange:(e,t)=>{if(e?.focusedGroupId!==t?.focusedGroupId&&this.cancelDoubleClick(),e?.selectedShapeIds!==t?.selectedShapeIds){let e=t.selectedShapeIds.filter(e=>{let i=this.getShape(e)?.parentId;for(;(0,n.vc)(i);){if(t.selectedShapeIds.includes(i))return!1;i=this.getShape(i)?.parentId}return!0}),i=null;if(e.length>0){let t=this.findCommonAncestor((0,a.oE)(e.map(e=>this.getShape(e))),e=>this.isShapeOfType(e,"group"));t&&(i=t)}else t?.focusedGroupId&&(i=t.focusedGroupId);(e.length!==t.selectedShapeIds.length||i!==t.focusedGroupId)&&this.store.put([{...t,selectedShapeIds:e,focusedGroupId:i??null}])}}}})),this._currentPageShapeIds=(0,K.A)(this.store,()=>this.getCurrentPageId()),this._parentIdsToChildIds=(0,L.i)(this.store),this.disposables.add(this.store.listen(e=>{this.emit("change",e)})),this.disposables.add(this.history.dispose),this.run(()=>{this.store.ensureStoreIsUsable(),this._updateCurrentPageState({editingShapeId:null,hoveredShapeId:null,erasingShapeIds:[]})},{history:"ignore"}),m&&void 0===this.root.children[m])throw Error(`No state found for initialState "${m}".`);if(this.root.enter(void 0,"initial"),this.edgeScrollManager=new W.w(this),this.focusManager=new H.c(this,y),this.disposables.add(()=>this.focusManager.dispose()),this.getInstanceState().followingUserId&&this.stopFollowingUser(),this.on("tick",this._flushEventsForTick),this.on("mount",()=>{this._isMounted.set(!0)}),this.on("unmount",()=>{this._isMounted.set(!1)}),this.timers.requestAnimationFrame(()=>{this._tickManager.start()}),this.performanceTracker=new a.f6,this.store.props.collaboration?.mode){const e=this.store.props.collaboration.mode;this.disposables.add((0,s.wv)("update collaboration mode",()=>{this.store.put([{...this.getInstanceState(),isReadonly:"readonly"===e.get()}])}))}this.disposables.add((0,s.wv)("sync current user record",()=>{let e=this.store.props.users.currentUser.get();e&&this._ensureUserRecord(e)}))}_getShapeVisibility;getIsShapeHiddenCache(){return this._getShapeVisibility?this.store.createComputedCache("isShapeHidden",e=>{let t=this._getShapeVisibility(e,this);return!n.tv.isId(e.parentId)&&this.isShapeHidden(e.parentId)?"visible"!==t:"hidden"===t}):null}isShapeHidden(e){return!!this._getShapeVisibility&&!!this.getIsShapeHiddenCache().get("string"==typeof e?e:e.id)}options;licenseManager;contextId=(0,a.NF)();store;root;setTool(e,t){if(t??=this.root,(0,a.mQ)(t.children,e.id))throw Error(`Can't override tool with id "${e.id}"`);t.children[e.id]=new e(this,t)}removeTool(e,t){t??=this.root,(0,a.mQ)(t.children,e.id)&&delete t.children[e.id]}disposables=new Set;isDisposed=!1;_isMounted=(0,s.eU)("isMounted",!1);getIsMounted(){return this._isMounted.get()}_tickManager;inputs;snaps;performance;_spatialIndex;timers=y.s.forContext(this.contextId);collaborators;user;_themeManager;textMeasure;fonts;scribbles;overlays;sideEffects;edgeScrollManager;focusManager;getContainer;getContainerDocument(){return this.getContainer().ownerDocument}getContainerWindow(){return(0,c.mD)(this.getContainer())}dispose(){this._isMounted.get()&&this.emit("unmount"),this.stopCameraAnimation(),this.getInstanceState().followingUserId&&this.stopFollowingUser(),this.disposables.forEach(e=>e()),this.disposables.clear(),this.menus.clearOpenMenus(),this.store.dispose(),this.isDisposed=!0,this.emit("dispose"),this.removeAllListeners()}getColorMode(){return this._themeManager.getColorMode()}setColorMode(e){return this.user.updateUserPreferences({colorScheme:e}),this}getCurrentThemeId(){return this._themeManager.getCurrentThemeId()}getCurrentTheme(){return this._themeManager.getCurrentTheme()}setCurrentTheme(e){return this._themeManager.setCurrentTheme(e),this}getThemes(){return this._themeManager.getThemes()}getTheme(e){return this._themeManager.getTheme(e)}updateThemes(e){return this._themeManager.updateThemes(e),this}updateTheme(e){return this._themeManager.updateTheme(e),this}shapeUtils;_shapeUtilsByAssetType={};styleProps;getShapeUtil(e){let t="string"==typeof e?e:e.type,i=(0,a.g5)(this.shapeUtils,t);return(0,a.vA)(i,`No shape util found for type "${t}"`),i}hasShapeUtil(e){let t="string"==typeof e?e:e.type;return(0,a.mQ)(this.shapeUtils,t)}getShapeUtilForAssetType(e){return(0,a.g5)(this._shapeUtilsByAssetType,e)}bindingUtils;getBindingUtil(e){let t="string"==typeof e?e:e.type,i=(0,a.g5)(this.bindingUtils,t);return(0,a.vA)(i,`No binding util found for type "${t}"`),i}assetUtils={};getAssetUtil(e){let t="string"==typeof e?e:e.type,i=(0,a.g5)(this.assetUtils,t);return(0,a.vA)(i,`No asset util found for type "${t}"`),i}hasAssetUtil(e){let t="string"==typeof e?e:e.type;return(0,a.mQ)(this.assetUtils,t)}getAssetUtilForMimeType(e){for(let t of Object.values(this.assetUtils))if(t&&t.acceptsMimeType(e))return t;return null}history;undo(){return this._flushEventsForTick(0),this.complete(),this.history.undo(),this.performance._notifyUndoRedo("undo",this.history.getNumUndos(),this.history.getNumRedos()),this}canUndo(){return this.history.getNumUndos()>0}getCanUndo(){return this.canUndo()}redo(){return this._flushEventsForTick(0),this.complete(),this.history.redo(),this.performance._notifyUndoRedo("redo",this.history.getNumUndos(),this.history.getNumRedos()),this}canRedo(){return this.history.getNumRedos()>0}getCanRedo(){return this.canRedo()}clearHistory(){return this.history.clear(),this}markHistoryStoppingPoint(e){let t=`[${e??"stop"}]_${(0,a.NF)()}`;return this.history._mark(t),t}getMarkIdMatching(e){return this.history.getMarkIdMatching(e)}isReplayingHistory(){return this.history.isReplaying()}squashToMark(e){return this.history.squashToMark(e),this}bail(){return this.history.bail(),this}bailToMark(e){return this.history.bailToMark(e),this}_shouldIgnoreShapeLock=!1;run(e,t){let i=this._shouldIgnoreShapeLock;this._shouldIgnoreShapeLock=t?.ignoreShapeLock??i;try{this.history.batch(e,t)}finally{this._shouldIgnoreShapeLock=i}return this}annotateError(e,{origin:t,willCrashApp:i,tags:s,extras:r}){let n=this.createErrorAnnotations(t,i);return(0,a.TF)(e,{tags:{...n.tags,...s},extras:{...n.extras,...r}}),i&&this.store.markAsPossiblyCorrupted(),this}createErrorAnnotations(e,t){try{let i=this.getEditingShapeId();return{tags:{origin:e,willCrashApp:t},extras:{activeStateNode:this.root.getPath(),selectedShapes:this.getSelectedShapes().map(e=>{let{props:t,...i}=e,{text:s,richText:r,...n}=t;return{...i,props:n}}),selectionCount:this.getSelectedShapes().length,editingShape:i?this.getShape(i):void 0,inputs:this.inputs.toJson(),pageState:this.getCurrentPageState(),instanceState:this.getInstanceState(),collaboratorCount:this.getCollaboratorsOnCurrentPage().length}}}catch{return{tags:{origin:e,willCrashApp:t},extras:{}}}}_crashingError=null;getCrashingError(){return this._crashingError}crash(e){return this._crashingError=e,this.store.markAsPossiblyCorrupted(),this.emit("crash",{error:e}),this}getPath(){return this.root.getPath().split("root.")[1]}isIn(e){let t=e.split(".").reverse(),i=this.root;for(;t.length>0;){let e=t.pop();if(!e)return!0;let s=i.getCurrent();if(s?.id===e){if(0===t.length)return!0;i=s;continue}break}return!1}isInAny(...e){return e.some(e=>this.isIn(e))}setCurrentTool(e,t={}){return this.root.transition(e,t),this}getCurrentTool(){return this.root.getCurrent()}getCurrentToolId(){let e=this.getCurrentTool();return e?e.getCurrentToolIdMask()??e.id:""}getStateDescendant(e){let t=e.split(".").reverse(),i=this.root;for(;t.length>0;){let e=t.pop();if(!e)break;let s=i.children?.[e];if(!s)return;i=s}return i}getDocumentSettings(){return this.store.get(n.yI)}updateDocumentSettings(e){return this.run(()=>{this.store.put([{...this.getDocumentSettings(),...e}])},{history:"ignore"}),this}getInstanceState(){return this.store.get(n.O9)}updateInstanceState(e,t){return this._updateInstanceState(e,{history:"ignore",...t}),void 0!==e.isChangingStyle&&(clearTimeout(this._isChangingStyleTimeout),!0===e.isChangingStyle&&(this._isChangingStyleTimeout=this.timers.setTimeout(()=>{this._updateInstanceState({isChangingStyle:!1},{history:"ignore"})},1e3))),this}_updateInstanceState(e,t){this.run(()=>{this.store.put([{...this.getInstanceState(),...e}])},t)}_isChangingStyleTimeout=-1;menus=m.N.forContext(this.contextId);setCursor(e){let t=this.getInstanceState().cursor;return(void 0===e.type||e.type===t.type)&&(void 0===e.rotation||e.rotation===t.rotation)||this.updateInstanceState({cursor:{...t,...e}}),this}getPageStates(){return this._getPageStatesQuery().get()}_getPageStatesQuery(){return this.store.query.records("instance_page_state")}getCurrentPageState(){return this.store.get(this._getCurrentPageStateId())}_getCurrentPageStateId(){return n.jA.createId(this.getCurrentPageId())}updateCurrentPageState(e){return this._updateCurrentPageState(e),this}_updateCurrentPageState(e){this.store.update(e.id??this.getCurrentPageState().id,t=>({...t,...e}))}getSelectedShapeIds(){return this.getCurrentPageState().selectedShapeIds}getSelectedShapes(){return(0,a.oE)(this.getSelectedShapeIds().map(e=>this.store.get(e)))}setSelectedShapes(e){return this.run(()=>{let t=e.map(e=>"string"==typeof e?e:e.id),{selectedShapeIds:i}=this.getCurrentPageState(),s=new Set(i);if(t.length===s.size&&t.every(e=>s.has(e)))return null;this.store.put([{...this.getCurrentPageState(),selectedShapeIds:t}])},{history:"record-preserveRedoStack"})}isAncestorSelected(e){let t="string"==typeof e?e:e?.id??null,i=this.getShape(t);if(!i)return!1;let s=this.getSelectedShapeIds();return!!this.findShapeAncestor(i,e=>s.includes(e.id))}select(...e){let t="string"==typeof e[0]?e:e.map(e=>e.id);return this.setSelectedShapes(t),this}deselect(...e){let t="string"==typeof e[0]?e:e.map(e=>e.id),i=this.getSelectedShapeIds();return i.length>0&&t.length>0&&this.setSelectedShapes(i.filter(e=>!t.includes(e))),this}selectAll(){let e=null,t=this.getSelectedShapeIds();if(t.length>0)for(let i of t){let t=this.getShape(i);if(t){if(null===e)e=t.parentId;else if(e!==t.parentId)return this}}e||(e=this.getCurrentPageId());let i=this.getSortedChildIdsForParent(e);return i.length<=0||this.setSelectedShapes(this._getUnlockedShapeIds(i)),this}selectAdjacentShape(e){let t,i=this.getSelectedShapeIds(),s=i[0]?this.getShape(i[0])?.parentId:null,r=s&&i.every(e=>this.getShape(e)?.parentId===s)&&!(0,n.xh)(s),a=r?this.getCurrentPageShapes().filter(e=>e.parentId===s):this.getCurrentPageShapes().filter(e=>(0,n.xh)(e.parentId)),o=r?this._getShapesInReadingOrder(a):this.getCurrentPageShapesInReadingOrder(),h=1===i.length?i[0]:o.find(e=>i.includes(e.id))?.id;if("next"===e||"prev"===e){let i=o.map(e=>e.id),s=((h?i.indexOf(h):-1)+("next"===e?1:-1)+i.length)%i.length;t=i[s]}else{if(!h)return;t=this.getNearestAdjacentShape(a,h,e)}let l=this.getShape(t);l&&this._selectShapesAndZoom([l.id])}getCurrentPageShapesInReadingOrder(){let e=this.getCurrentPageShapes().filter(e=>(0,n.xh)(e.parentId));return this._getShapesInReadingOrder(e)}_getShapesInReadingOrder(e){let t=e.filter(e=>this.getShapeUtil(e).canTabTo(e));if(t.length<=1)return t;let i=t.map(e=>({shape:e,center:this.getShapePageBounds(e).center}));i.sort((e,t)=>e.center.y-t.center.y);let s=[];for(let e of i){let t=-1;for(let i=s.length-1;i>=0;i--){let r=s[i],n=r[r.length-1];if(100>Math.abs(e.center.y-n.center.y)){t=i;break}}-1===t?s.push([e]):s[t].push(e)}for(let e of s)e.sort((e,t)=>e.center.x-t.center.x);for(let e of s)if(!(e.length<=2))for(let t=0;t<e.length-2;t++){let i=e[t],s=e[t+1],r=e[t+2],n=b.l.Dist2(i.center,s.center);b.l.Dist2(i.center,r.center)<.9*n&&20>=Math.abs(b.l.Angle(i.center,r.center)*(180/Math.PI))&&([e[t+1],e[t+2]]=[e[t+2],e[t+1]])}return s.flat().map(e=>e.shape)}getNearestAdjacentShape(e,t,i){let s={right:0,left:180,down:90,up:270},r=this.getShape(t);if(!r)return t;let n=e.filter(e=>this.getShapeUtil(e).canTabTo(e)&&e.id!==t);if(!n.length)return t;let o=this.getShapePageBounds(r).center,h=n.map(e=>({shape:e,center:this.getShapePageBounds(e).center})).filter(({center:e})=>{let t=e.x>o.x,s=e.y>o.y,r=e.x-o.x,n=e.y-o.y,a=Math.abs(n)<2*Math.abs(r),h=Math.abs(r)<2*Math.abs(n);return"left"===i||"right"===i?a&&("right"===i?t:!t):"up"===i||"down"===i?h&&("down"===i?s:!s):void 0});return 0===h.length?t:(0,a.wq)(h,({center:e})=>{let t=b.l.Dist2(o,e),r=["left","right"].includes(i)?"x":"y",n=Math.abs(e[r]-o[r]),a=["left","right"].includes(i)?"y":"x";return+t+2*Math.abs(e[a]-o[a])+(t-n)*1.5+.5*Math.abs(Math.abs(b.l.Angle(o,e)*(180/Math.PI))-s[i])}).shape.id}selectParentShape(){let e=this.getOnlySelectedShape();if(!e)return;let t=this.getShape(e.parentId);t&&this._selectShapesAndZoom([t.id])}selectFirstChildShape(){let e=this.getSelectedShapes();if(!e.length)return;let t=e[0],i=this.getSortedChildIdsForParent(t.id).map(e=>this.getShape(e)).filter(e=>e),s=this._getShapesInReadingOrder(i);0!==s.length&&this._selectShapesAndZoom([s[0].id])}_selectShapesAndZoom(e){this.setSelectedShapes(e),this.zoomToSelectionIfOffscreen(256,{animation:{duration:this.options.animationMediumMs},inset:0})}selectNone(){return this.getSelectedShapeIds().length>0&&this.setSelectedShapes([]),this}getOnlySelectedShapeId(){return this.getOnlySelectedShape()?.id??null}getOnlySelectedShape(){let e=this.getSelectedShapes();return 1===e.length?e[0]:null}getShapesPageBounds(e){let t=(0,a.oE)(e.map(e=>this.getShapePageBounds(e)));return 0===t.length?null:P.az.Common(t)}getSelectionPageBounds(){return this.getShapesPageBounds(this.getSelectedShapeIds())}getSelectionScreenBounds(){let e=this.getSelectionPageBounds();if(!e)return;let{x:t,y:i}=this.pageToScreen(e.point),s=this.getZoomLevel();return new P.az(t,i,e.width*s,e.height*s)}getShapesSharedRotation(e){let t=!1,i=0;for(let s=0,r=e.length;s<r;s++){let r=this.getShapePageTransform(e[s]);if(r)if(t){if(r.rotation()!==i)return 0}else t=!0,i=r.rotation()}return i}getSelectionRotation(){return this.getShapesSharedRotation(this.getSelectedShapeIds())}getShapesRotatedPageBounds(e){if(0===e.length)return;let t=this.getShapesSharedRotation(e);if(0===t)return this.getShapesPageBounds(e)??void 0;if(1===e.length){let t=this.getShapeGeometry(e[0]).bounds.clone();return t.point=this.getShapePageTransform(e[0]).applyToPoint(t.point),t}let i=P.az.FromPoints(e.flatMap(e=>{let t=this.getShapePageTransform(e);return t?t.applyToPoints(this.getShapeGeometry(e).bounds.corners):[]}).map(e=>e.rot(-t)));return i.point=i.point.rot(t),i}getSelectionRotatedPageBounds(){return this.getShapesRotatedPageBounds(this.getSelectedShapeIds())}getSelectionRotatedScreenBounds(){let e=this.getSelectionRotatedPageBounds();if(!e)return;let{x:t,y:i}=this.pageToScreen(e.point),s=this.getZoomLevel();return new P.az(t,i,e.width*s,e.height*s)}getFocusedGroupId(){return this.getCurrentPageState().focusedGroupId??this.getCurrentPageId()}getFocusedGroup(){let e=this.getFocusedGroupId();return e?this.getShape(e):void 0}setFocusedGroup(e){let t="string"==typeof e?e:e?.id??null;if(null!==t){let e=this.getShape(t);if(!e)throw Error(`Editor.setFocusedGroup: Shape with id ${t} does not exist`);if(!this.isShapeOfType(e,"group"))throw Error(`Editor.setFocusedGroup: Cannot set focused group to shape of type ${e.type}`)}return t===this.getFocusedGroupId()?this:this.run(()=>{this.store.update(this.getCurrentPageState().id,e=>({...e,focusedGroupId:t}))},{history:"record-preserveRedoStack"})}popFocusedGroupId(){let e=this.getFocusedGroup();if(e){let t=this.findShapeAncestor(e,e=>this.isShapeOfType(e,"group"));this.setFocusedGroup(t?.id??null),this.select(e.id)}else this.setFocusedGroup(null),this.selectNone();return this}getEditingShapeId(){return this.getCurrentPageState().editingShapeId}getEditingShape(){let e=this.getEditingShapeId();return e?this.getShape(e):void 0}canEditShape(e,t){let i="string"==typeof e?e:e?.id??null;if(!i||i===this.getEditingShapeId())return!1;let s=this.getShape(i);if(!s)return!1;let r=this.getShapeUtil(s);return!(!r.canEdit(s,t??{type:"unknown"})||this.getIsReadonly()&&!r.canEditInReadonly(s)||this.isShapeOrAncestorLocked(s)&&!r.canEditWhileLocked(s))}setEditingShape(e){let t="string"==typeof e?e:e?.id??null;return t?this.canEditShape(t)&&this.run(()=>{let e=this.getEditingShapeId();if(e){let t=this.getShape(e);t&&this.getShapeUtil(t).onEditEnd?.(t)}this._updateCurrentPageState({editingShapeId:null}),this._currentRichTextEditor.set(null),this.select(t),this._updateCurrentPageState({editingShapeId:t});let i=this.getShape(t);this.getShapeUtil(i).onEditStart?.(i)},{history:"ignore"}):this.run(()=>{let e=this.getEditingShapeId();if(e){let t=this.getShape(e);t&&this.getShapeUtil(t).onEditEnd?.(t)}this._updateCurrentPageState({editingShapeId:null}),this._currentRichTextEditor.set(null)},{history:"ignore"}),this}_currentRichTextEditor=(0,s.eU)("rich text editor",null);getRichTextEditor(){return this._currentRichTextEditor.get()}setRichTextEditor(e){return this._currentRichTextEditor.set(e),this}getHoveredShapeId(){return this.getCurrentPageState().hoveredShapeId}getHoveredShape(){let e=this.getHoveredShapeId();return e?this.getShape(e):void 0}setHoveredShape(e){let t="string"==typeof e?e:e?.id??null;return t===this.getHoveredShapeId()||this.run(()=>{this.updateCurrentPageState({hoveredShapeId:t})},{history:"ignore"}),this}getHintingShapeIds(){return this.getCurrentPageState().hintingShapeIds}getHintingShape(){let e=this.getHintingShapeIds();return(0,a.oE)(e.map(e=>this.getShape(e)))}setHintingShapes(e){let t="string"==typeof e[0]?e:e.map(e=>e.id);return this.run(()=>{this._updateCurrentPageState({hintingShapeIds:(0,a.Qq)(t)})},{history:"ignore"}),this}getErasingShapeIds(){return this.getCurrentPageState().erasingShapeIds}getErasingShapes(){let e=this.getErasingShapeIds();return(0,a.oE)(e.map(e=>this.getShape(e)))}setErasingShapes(e){let t="string"==typeof e[0]?e:e.map(e=>e.id);t.sort();let i=this.getErasingShapeIds();return this.run(()=>{if(t.length===i.length){for(let e=0;e<t.length;e++)if(t[e]!==i[e]){this._updateCurrentPageState({erasingShapeIds:t});break}}else this._updateCurrentPageState({erasingShapeIds:t})},{history:"ignore"}),this}getCroppingShapeId(){return this.getCurrentPageState().croppingShapeId}canCropShape(e){if(!e)return!1;let t="string"==typeof e?e:e?.id??null;if(!t)return!1;let i=this.getShape(t);return!(!i||!this.getShapeUtil(i).canCrop(i)||this.isShapeOrAncestorLocked(i))}setCroppingShape(e){let t="string"==typeof e?e:e?.id??null;return t!==this.getCroppingShapeId()&&this.run(()=>{t?this.canCropShape(t)&&this.updateCurrentPageState({croppingShapeId:t}):this.updateCurrentPageState({croppingShapeId:null})},{history:"ignore"}),this}_textOptions;getTextOptions(){return(0,a.Z1)(this._textOptions.get(),"Cannot use text without setting textOptions")}_unsafe_getCameraId(){return n.Xu.createId(this.getCurrentPageId())}getCamera(){let e=this.store.get(this._unsafe_getCameraId());if(this._isLockedOnFollowingUser.get()){let t=this.getCameraForFollowing();if(t)return{...e,...t}}return e}_getFollowingPresence(e){let t=[this.user.getRecordId()],i=this.getCollaborators(),s=null;for(;e&&!t.includes(e);)s=i.find(t=>t.userId===e)??null,e=s?.followingUserId??null,s&&t.push(s.userId);return s}getViewportPageBoundsForFollowing(){let e=this._getFollowingPresence(this.getInstanceState().followingUserId);if(!e?.camera||!e?.screenBounds)return null;let{w:t,h:i}=e.screenBounds,{x:s,y:r,z:n}=e.camera,a=new P.az(-s,-r,t/n,i/n),o=this.getViewportScreenBounds().clone(),h=o.width/o.height;return o.width=a.width,o.height=o.width/h,o.height<a.height&&(o.height=a.height,o.width=o.height*h),o.center=a.center,o}getCameraForFollowing(){let e=this.getViewportPageBoundsForFollowing();return e?{x:-e.x,y:-e.y,z:this.getViewportScreenBounds().w/e.width}:null}getZoomLevel(){return this.getCamera().z}getResizeScaleFactor(){return this.user.getIsDynamicResizeMode()?1/this.getZoomLevel():1}_debouncedZoomLevel=(0,s.eU)("debounced zoom level",1);getDebouncedZoomLevel(){if(this.options.debouncedZoom&&"idle"!==this.getCameraState())return this._debouncedZoomLevel.get();return this.getZoomLevel()}_getAboveDebouncedZoomThreshold(){return this.getCurrentPageShapeIds().size>this.options.debouncedZoomThreshold}getEfficientZoomLevel(){return this._getAboveDebouncedZoomThreshold()?this.getDebouncedZoomLevel():this.getZoomLevel()}getInitialZoom(){let e=this.getCameraOptions();if(!e.constraints||"default"===e.constraints.initialZoom)return 1;let{zx:t,zy:i}=ep(this,e);switch(e.constraints.initialZoom){case"fit-min":return Math.max(t,i);case"fit-max":return Math.min(t,i);case"fit-x":return t;case"fit-y":return i;case"fit-min-100":return Math.min(1,Math.max(t,i));case"fit-max-100":return Math.min(1,Math.min(t,i));case"fit-x-100":return Math.min(1,t);case"fit-y-100":return Math.min(1,i);default:throw(0,a.h6)(e.constraints.initialZoom)}}getBaseZoom(){let e=this.getCameraOptions();if(!e.constraints||"default"===e.constraints.baseZoom)return 1;let{zx:t,zy:i}=ep(this,e);switch(e.constraints.baseZoom){case"fit-min":return Math.max(t,i);case"fit-max":return Math.min(t,i);case"fit-x":return t;case"fit-y":return i;case"fit-min-100":return Math.min(1,Math.max(t,i));case"fit-max-100":return Math.min(1,Math.min(t,i));case"fit-x-100":return Math.min(1,t);case"fit-y-100":return Math.min(1,i);default:throw(0,a.h6)(e.constraints.baseZoom)}}_cameraOptions=(0,s.eU)("camera options",u.zd);getCameraOptions(){return this._cameraOptions.get()}setCameraOptions(e){let t=(0,a.pN)({...this._cameraOptions.__unsafe__getWithoutCapture(),...e});return t.zoomSteps?.length<1&&(t.zoomSteps=[1]),this._cameraOptions.set(t),this.setCamera(this.getCamera()),this}getConstrainedCamera(e,t){let i=this.getCamera(),{x:s,y:r,z:n=i.z}=e,o=(e,t,s,r)=>{let n=i.z;return s===n?e:e+(t-e)*(1/r-1/n)/(1/s-1/n)};if(!t?.force){let e=this.getCameraOptions(),h=e.zoomSteps[0],l=(0,a.HV)(e.zoomSteps),p=this.getViewportScreenBounds();if(e.constraints){let{constraints:d}=e,g=Math.min(d.padding.y,p.w/2),u=Math.min(d.padding.x,p.h/2),c=P.az.From(e.constraints.bounds),S=(p.w-2*u)/c.w,f=(p.h-2*g)/c.h,m=this.getBaseZoom(),y=l*m,I=h*m;if(t?.reset&&(n=this.getInitialZoom()),n<I||n>y){let e=n;n=(0,T.qE)(n,I,y),s=o(i.x,s,e,n),r=o(i.y,r,e,n)}let C=u/n-c.x,w=g/n-c.y,_=(p.w-2*u)/n-c.w,x=(p.h-2*g)/n-c.h,b=C+_*d.origin.x,v=w+x*d.origin.y,E="string"==typeof d.behavior?d.behavior:d.behavior.x,k="string"==typeof d.behavior?d.behavior:d.behavior.y;if(t?.reset)s=b,r=v;else{switch(E){case"fixed":s=b;break;case"contain":s=n<S?b:(0,T.qE)(s,C+_,C);break;case"inside":s=n<S?(0,T.qE)(s,C,(p.w-u)/n-c.w):(0,T.qE)(s,C+_,C);break;case"outside":s=(0,T.qE)(s,u/n-c.w,(p.w-u)/n);break;case"free":break;default:throw(0,a.h6)(E)}switch(k){case"fixed":r=v;break;case"contain":r=n<f?v:(0,T.qE)(r,w+x,w);break;case"inside":r=n<f?(0,T.qE)(r,w,(p.h-g)/n-c.h):(0,T.qE)(r,w+x,w);break;case"outside":r=(0,T.qE)(r,g/n-c.h,(p.h-g)/n);break;case"free":break;default:throw(0,a.h6)(k)}}}else if(n>l||n<h){let e=n;n=(0,T.qE)(n,h,l),s=o(i.x,s,e,n),r=o(i.y,r,e,n)}}return{x:s,y:r,z:n}}_setCamera(e,t){let i=this.getCamera(),{x:r,y:n,z:a}=this.getConstrainedCamera(e,t);return i.x===r&&i.y===n&&i.z===a||(0,s.hL)(()=>{let e={...i,x:r,y:n,z:a};this.run(()=>{this.store.put([e])},{history:"ignore"});let s=this.inputs.getCurrentScreenPoint(),o=this.inputs.getCurrentPagePoint();(s.x/a-r!==o.x||s.y/a-n!==o.y)&&this.updatePointer({immediate:t?.immediate,pointerId:u.zm.CAMERA_MOVE}),this._tickCameraState()}),this}setCamera(e,t){let{isLocked:i}=this._cameraOptions.__unsafe__getWithoutCapture();if(i&&!t?.force)return this;this.stopCameraAnimation(),this.getInstanceState().followingUserId&&this.stopFollowingUser();let s=b.l.Cast(e);Number.isFinite(s.x)||(s.x=0),Number.isFinite(s.y)||(s.y=0),void 0!==s.z&&Number.isFinite(s.z)||(e.z=this.getZoomLevel());let r=this.getConstrainedCamera(s,t);if(t?.animation){let{width:e,height:i}=this.getViewportScreenBounds();this._animateToViewport(new P.az(-r.x,-r.y,e/r.z,i/r.z),t)}else this._setCamera(r,{...t,force:!0});return this}centerOnPoint(e,t){let{isLocked:i}=this.getCameraOptions();if(i&&!t?.force)return this;let{width:s,height:r}=this.getViewportPageBounds();return this.setCamera(new b.l(-(e.x-s/2),-(e.y-r/2),this.getCamera().z),t),this}zoomToFit(e){let t=[...this.getCurrentPageShapeIds()].filter(e=>!this.isShapeHidden(e));if(t.length<=0)return this;let i=P.az.Common((0,a.oE)(t.map(e=>this.getShapePageBounds(e))));return this.zoomToBounds(i,e),this}resetZoom(e=this.getViewportScreenCenter(),t){let{isLocked:i,constraints:s}=this.getCameraOptions();if(i&&!t?.force)return this;let{x:r,y:n,z:a}=this.getCamera(),{x:o,y:h}=e,l=1;if(s){let e=this.getInitialZoom();a!==e&&(l=e)}return this.setCamera(new b.l(r+(o/l-o)-(o/a-o),n+(h/l-h)-(h/a-h),l),t),this}zoomIn(e=this.getViewportScreenCenter(),t){let{isLocked:i}=this.getCameraOptions();if(i&&!t?.force)return this;let{x:s,y:r,z:n}=this.getCamera(),{zoomSteps:o}=this.getCameraOptions();if(null!==o&&o.length>1){let i=this.getBaseZoom(),h=(0,a.HV)(o)*i;for(let e=1;e<o.length;e++){let t=o[e-1]*i,s=o[e]*i;if(!(s-n<=(s-t)/2)){h=s;break}}this.setCamera(new b.l(s+(e.x/h-e.x)-(e.x/n-e.x),r+(e.y/h-e.y)-(e.y/n-e.y),h),t)}return this}zoomOut(e=this.getViewportScreenCenter(),t){let{isLocked:i}=this.getCameraOptions();if(i&&!t?.force)return this;let{zoomSteps:s}=this.getCameraOptions();if(null!==s&&s.length>1){let i=this.getBaseZoom(),{x:r,y:n,z:a}=this.getCamera(),o=s[0]*i;for(let e=s.length-1;e>0;e--){let t=s[e-1]*i,r=s[e]*i;if(!(r-a>=(r-t)/2)){o=t;break}}this.setCamera(new b.l(r+(e.x/o-e.x)-(e.x/a-e.x),n+(e.y/o-e.y)-(e.y/a-e.y),o),t)}return this}zoomToSelection(e){let{isLocked:t}=this.getCameraOptions();if(t&&!e?.force)return this;let i=this.getSelectionPageBounds();return i&&(.01>Math.abs(this.getZoomLevel()-1)?this.zoomToBounds(i,e):this.zoomToBounds(i,{targetZoom:1,...e})),this}zoomToSelectionIfOffscreen(e=16,t){let i=this.getSelectionPageBounds(),s=this.getViewportPageBounds();if(i&&!s.contains(i)){let r=i.clone().expandBy(e/this.getZoomLevel()).expand(s),n=s.clone().translate({x:(r.center.x-s.center.x)*2,y:(r.center.y-s.center.y)*2});this.zoomToBounds(n,t)}}zoomToBounds(e,t){let i=this._cameraOptions.__unsafe__getWithoutCapture();if(i.isLocked&&!t?.force)return this;let s=this.getViewportScreenBounds(),r=t?.inset??Math.min(this.options.zoomToFitPadding,.28*s.width),n=this.getBaseZoom(),o=i.zoomSteps[0],h=(0,a.HV)(i.zoomSteps),l=(0,T.qE)(Math.min((s.width-r)/e.w,(s.height-r)/e.h),o*n,h*n);return t?.targetZoom!==void 0&&(l=Math.min(t.targetZoom,l)),this.setCamera(new b.l(-e.x+(s.width-e.w*l)/2/l,-e.y+(s.height-e.h*l)/2/l,l),t),this}stopCameraAnimation(){return this.emit("stop-camera-animation"),this}_viewportAnimation=null;_animateViewport(e){if(!this._viewportAnimation)return;this._viewportAnimation.elapsed+=e;let{elapsed:t,easing:i,duration:s,start:r,end:n}=this._viewportAnimation;if(t>s){this.off("tick",this._animateViewport),this._viewportAnimation=null,this._setCamera(new b.l(-n.x,-n.y,this.getViewportScreenBounds().width/n.width));return}let a=i(1-(s-t)/s),o=r.minX+(n.minX-r.minX)*a,h=r.minY+(n.minY-r.minY)*a,l=r.maxX+(n.maxX-r.maxX)*a;this._setCamera(new b.l(-o,-h,this.getViewportScreenBounds().width/(l-o)),{force:!0})}_animateToViewport(e,t={animation:u.mp}){let{animation:i,...s}=t;if(!i)return;let{duration:r=0,easing:n=C.Z.easeInOutCubic}=i,a=this.user.getAnimationSpeed(),o=this.getViewportPageBounds();return(this.stopCameraAnimation(),this.getInstanceState().followingUserId&&this.stopFollowingUser(),0===r||0===a)?this._setCamera(new b.l(-e.x,-e.y,this.getViewportScreenBounds().width/e.width),{...s}):(this._viewportAnimation={elapsed:0,duration:r/a,easing:n,start:o.clone(),end:e.clone()},this.once("stop-camera-animation",()=>{this.off("tick",this._animateViewport),this._viewportAnimation=null}),this.on("tick",this._animateViewport),this)}slideCamera(e={}){let{isLocked:t}=this.getCameraOptions();if(t&&!e?.force||0===this.user.getAnimationSpeed())return this;this.stopCameraAnimation();let{speed:i,friction:s=this.options.cameraSlideFriction,direction:r,speedThreshold:n=.01}=e,a=Math.min(i,1),o=()=>{this.off("tick",l),this.off("stop-camera-animation",o)};this.once("stop-camera-animation",o);let h=r.z??0,l=e=>{let{x:t,y:i,z:l}=this.getCamera(),p=r.x*(a*e)/l,d=r.y*(a*e)/l,g=t+p,u=i+d,c=l;if(0!==h){c=l*(1+h*a*e);let t=this.getViewportScreenCenter();g+=t.x/c-t.x/l,u+=t.y/c-t.y/l}(a*=1-s)<n?o():this._setCamera(new b.l(g,u,c))};return this.on("tick",l),this}zoomToUser(e,t={animation:{duration:500}}){let i=this.getCollaborators().find(t=>t.userId===e);if(!i)return this;let s=i.cursor;return s&&this.run(()=>{null!==this.getInstanceState().followingUserId&&this.stopFollowingUser();let r=i.currentPageId===this.getCurrentPageId();r||this.setCurrentPage(i.currentPageId),t&&t.animation&&!r&&(t.animation=void 0),this.centerOnPoint(s,t);let{highlightedUserIds:n}=this.getInstanceState();this.updateInstanceState({highlightedUserIds:[...n,e]}),this.timers.setTimeout(()=>{let t=[...this.getInstanceState().highlightedUserIds],i=t.indexOf(e);i<0||(t.splice(i,1),this.updateInstanceState({highlightedUserIds:t}))},this.options.collaboratorIdleTimeoutMs)}),this}_willSetInitialBounds=!0;updateViewportScreenBounds(e,t=!1){if(e instanceof P.az)e.width=Math.max(e.width,1),e.height=Math.max(e.height,1);else{let t=e.getBoundingClientRect();e=new P.az(t.left||t.x,t.top||t.y,Math.max(t.width,1),Math.max(t.height,1))}let i=this.getContainerDocument();if(!i.body)return this;let s=[0!==e.minY,!(0,T.YY)(i.body.scrollWidth,e.maxX,1),!(0,T.YY)(i.body.scrollHeight,e.maxY,1),0!==e.minX],{_willSetInitialBounds:r}=this;this._willSetInitialBounds=!1;let{screenBounds:n,insets:a}=this.getInstanceState();if(e.equals(n)&&s.every((e,t)=>e===a[t]))return this;if(r)this.updateInstanceState({screenBounds:e.toJson(),insets:s}),this.emit("resize",e.toJson()),this.setCamera(this.getCamera());else if(t&&!this.getInstanceState().followingUserId){let t=this.getViewportPageBounds().center;this.updateInstanceState({screenBounds:e.toJson(),insets:s}),this.emit("resize",e.toJson()),this.centerOnPoint(t)}else this.updateInstanceState({screenBounds:e.toJson(),insets:s}),this.emit("resize",e.toJson()),this._setCamera(b.l.From({...this.getCamera()}));return this}getViewportScreenBounds(){let{x:e,y:t,w:i,h:s}=this.getInstanceState().screenBounds;return new P.az(e,t,i,s)}getViewportScreenCenter(){let e=this.getViewportScreenBounds();return new b.l(e.w/2,e.h/2)}getViewportPageBounds(){let{w:e,h:t}=this.getViewportScreenBounds(),{x:i,y:s,z:r}=this.getCamera();return new P.az(-i,-s,e/r,t/r)}screenToPage(e){let{screenBounds:t}=this.store.unsafeGetWithoutCapture(n.O9),{x:i,y:s,z:r=1}=this.getCamera();return new b.l((e.x-t.x)/r-i,(e.y-t.y)/r-s,e.z??.5)}pageToScreen(e){let{screenBounds:t}=this.store.unsafeGetWithoutCapture(n.O9),{x:i,y:s,z:r=1}=this.getCamera();return new b.l((e.x+i)*r+t.x,(e.y+s)*r+t.y,e.z??.5)}pageToViewport(e){let{x:t,y:i,z:s=1}=this.getCamera();return new b.l((e.x+t)*s,(e.y+i)*s,e.z??.5)}getCollaborators(){return this.collaborators.getCollaborators()}getCollaboratorsOnCurrentPage(){return this.collaborators.getCollaboratorsOnCurrentPage()}getVisibleCollaborators(){return this.collaborators.getVisibleCollaborators()}getVisibleCollaboratorsOnCurrentPage(){return this.collaborators.getVisibleCollaboratorsOnCurrentPage()}getAttributionUserId(){let e=this.store.props.users.currentUser.get();return e?(this._ensureUserRecord(e),n.XA.parseId(e.id)):null}_ensureUserRecord(e){let t=this.store.get(e.id);t&&t.name===e.name&&t.color===e.color&&t.imageUrl===e.imageUrl&&t.meta===e.meta||this.run(()=>{this.store.put([e])},{history:"ignore"})}getAttributionDisplayName(e){return e?this.store.props.users.resolve(e).get()?.name??this.store.get((0,n.dB)(e))?.name??null:null}getAttributionUser(e){return e?this.store.props.users.resolve(e).get()??this.store.get((0,n.dB)(e))??null:null}_getReferencedUserIds(e){let t=new Set;for(let i of e)for(let e of this.getShapeUtil(i).getReferencedUserIds(i))t.add(e);return t}_isLockedOnFollowingUser=(0,s.eU)("isLockedOnFollowingUser",!1);startFollowingUser(e){if(this.stopFollowingUser(),this.user.getExternalId()||console.warn("You should set the userId for the current instance before following a user"),!this._getFollowingPresence(e))return this;let t=(0,s.EW)("latestLeaderPresence",()=>this._getFollowingPresence(e));return(0,s.hL)(()=>{this.updateInstanceState({followingUserId:e},{history:"ignore"});let i=(0,s.wv)("update current page",()=>{let e=t.get();e?e.currentPageId!==this.getCurrentPageId()&&this.getPage(e.currentPageId)&&this.run(()=>{this.store.put([{...this.getInstanceState(),currentPageId:e.currentPageId}]),this._isLockedOnFollowingUser.set(!0)},{history:"ignore"}):this.stopFollowingUser()}),r=()=>{i(),this._isLockedOnFollowingUser.set(!1),this.off("frame",n),this.off("stop-following",r)},n=()=>{if(!t.get())return void this.stopFollowingUser();if(this._isLockedOnFollowingUser.get())return;let e=this.user.getAnimationSpeed();if(0===e)return void this._isLockedOnFollowingUser.set(!0);let i=this.getViewportPageBoundsForFollowing();if(!i)return void this.stopFollowingUser();let s=this.getViewportPageBounds(),r=Math.abs(i.minX-s.minX)+Math.abs(i.maxX-s.maxX),n=Math.abs(i.minY-s.minY)+Math.abs(i.maxY-s.maxY);if(r<this.options.followChaseViewportSnap&&n<this.options.followChaseViewportSnap)return void this._isLockedOnFollowingUser.set(!0);let o=(0,T.qE)(.5*e,.1,.8),h=new P.az((0,a.Cc)(s.minX,i.minX,o),(0,a.Cc)(s.minY,i.minY,o),(0,a.Cc)(s.width,i.width,o),(0,a.Cc)(s.height,i.height,o)),l=new b.l(-h.x,-h.y,this.getViewportScreenBounds().width/h.width);this.stopCameraAnimation(),this._setCamera(l)};this.once("stop-following",r),this.addListener("frame",n),n()}),this}stopFollowingUser(){return this.run(()=>{this.store.put([this.getCamera()]),this._isLockedOnFollowingUser.set(!1),this.updateInstanceState({followingUserId:null}),this.emit("stop-following")},{history:"ignore"}),this}getUnorderedRenderingShapes(e){let t=[],i=2*this.options.maxShapesPerPage,s=this.options.maxShapesPerPage,r=this.getErasingShapeIds(),n=(a,o,h)=>{let l=this.getShape(a);if(!l)return;if(this.isShapeHidden(l)){let e=h||r.includes(a);for(let t of this.getSortedChildIdsForParent(a))n(t,o,e);return}o*=l.opacity;let p=!1,d=this.getShapeUtil(l);e&&(p=!h&&r.includes(a))&&(o*=.32),t.push({id:a,shape:l,util:d,index:i,backgroundIndex:s,opacity:o}),i+=1,s+=1;let g=this.getSortedChildIdsForParent(a);if(!g.length)return;let u=null;for(let e of(d.providesBackgroundForChildren(l)&&(u=s,s=i,i+=this.options.maxShapesPerPage),g))n(e,o,h||p);null!==u&&(s=u)};for(let t of e?[this.getCurrentPage()]:this.getPages())for(let e of this.getSortedChildIdsForParent(t.id))n(e,1,!1);return t}_cameraStateTimeoutRemaining=0;_decayCameraStateTimeout(e){this._cameraStateTimeoutRemaining-=e,this._cameraStateTimeoutRemaining>0||(this.off("tick",this._decayCameraStateTimeout),this._setCameraState("idle"))}_tickCameraState(){this._cameraStateTimeoutRemaining=this.options.cameraMovingTimeoutMs,"idle"===this.getInstanceState().cameraState&&(this._setCameraState("moving"),this._debouncedZoomLevel.set((0,s.Pm)(()=>this.getCamera().z)),this.on("tick",this._decayCameraStateTimeout))}_setCameraState(e){this.updateInstanceState({cameraState:e},{history:"ignore"})}getCameraState(){return this.getInstanceState().cameraState}getRenderingShapes(){let e=this.getUnorderedRenderingShapes(!0);if(e.length<=100)return this._renderingShapesSortCache=null,e.sort(a.rb);let t=this._renderingShapesSortCache;if(null!==t&&t.size===e.length){let i=Array(e.length),s=!0;for(let r=0;r<e.length;r++){let n=e[r],a=t.get(n.id);if(void 0===a){s=!1;break}i[a]=n}if(s)return i}e.sort(a.rb);let i=new Map;for(let t=0;t<e.length;t++)i.set(e[t].id,t);return this._renderingShapesSortCache=i,e}_renderingShapesSortCache=null;_getAllPagesQuery(){return this.store.query.records("page")}getPages(){return Array.from(this._getAllPagesQuery().get()).sort(a.Ky)}getCurrentPage(){return this.getPage(this.getCurrentPageId())}getCurrentPageId(){return this.getInstanceState().currentPageId}getPage(e){return this.store.get("string"==typeof e?e:e.id)}_currentPageShapeIds;getCurrentPageShapeIds(){return this._currentPageShapeIds.get()}getCurrentPageShapeIdsSorted(){return Array.from(this.getCurrentPageShapeIds()).sort()}getPageShapeIds(e){let t="string"==typeof e?e:e.id,i=this.store.query.exec("shape",{parentId:{eq:t}});return this.getShapeAndDescendantIds(i.map(e=>e.id))}setCurrentPage(e){let t="string"==typeof e?e:e.id;return this.store.has(t)?(this.stopFollowingUser(),this.complete(),this.run(()=>{this.store.put([{...this.getInstanceState(),currentPageId:t}]),this.setCamera(this.getCamera())},{history:"record-preserveRedoStack"})):(console.error("Tried to set the current page id to a page that doesn't exist."),this)}updatePage(e){return this.getIsReadonly()||!this.getPage(e.id)?this:this.run(()=>this.store.update(e.id,t=>({...t,...e})))}createPage(e){return this.run(()=>{if(this.getIsReadonly()||this.getPages().length>=this.options.maxPages)return;let t=this.getPages(),i=(0,B.g)(e.name??"Page 1",t.map(e=>e.name)),s=e.index;(!s||t.some(e=>e.index===s))&&(s=(0,a.AQ)(t[t.length-1].index));let r=n.tv.create({meta:{},...e,name:i,index:s});this.store.put([r])}),this}deletePage(e){let t="string"==typeof e?e:e.id;return this.run(()=>{if(this.getIsReadonly())return;let e=this.getPages();if(1===e.length)return;let i=this.getPage(t);if(!i)return;if(t===this.getCurrentPageId()){let i=e.findIndex(e=>e.id===t),s=e[i-1]??e[i+1];this.setCurrentPage(s.id)}let s=this.getSortedChildIdsForParent(i.id);this.deleteShapes(s),this.store.remove([i.id])},{ignoreShapeLock:!0}),this}duplicatePage(e,t=n.tv.createId()){if(this.getPages().length>=this.options.maxPages)return this;let i="string"==typeof e?e:e.id,s=this.getPage(i);if(!s)return this;let r={...this.getCamera()},o=this.getContentFromCurrentPage(this.getSortedChildIdsForParent(s.id));return this.run(()=>{let e=this.getPages(),i=(0,a.HE)(s.index,e[e.indexOf(s)+1]?.index);if(this.createPage({name:s.name+" Copy",id:t,index:i}),this.setCurrentPage(t),this.setCamera(r),o)return this.putContentOntoCurrentPage(o)}),this}renamePage(e,t){let i="string"==typeof e?e:e.id;return this.getIsReadonly()||this.updatePage({id:i,name:t}),this}_getAllAssetsQuery(){return this.store.query.records("asset")}getAssets(){return this._getAllAssetsQuery().get()}createAssets(e){return this.getIsReadonly()||e.length<=0||this.run(()=>this.store.put(e),{history:"ignore"}),this}updateAssets(e){return this.getIsReadonly()||e.length<=0||this.run(()=>{this.store.put(e.map(e=>({...this.store.get(e.id),...e})))},{history:"ignore"}),this}deleteAssets(e){if(this.getIsReadonly())return this;let t="string"==typeof e[0]?e:e.map(e=>e.id);return t.length<=0||this.run(()=>{this.store.props.assets.remove?.(t),this.store.remove(t)},{history:"ignore"}),this}getAsset(e){return this.store.get("string"==typeof e?e:e.id)}async resolveAssetUrl(e,t){if(!e)return null;let i=this.getAsset(e);if(!i)return null;let{screenScale:s=1,shouldResolveToOriginal:r=!1,dpr:n=this.getInstanceState().devicePixelRatio}=t,a=Math.pow(2,Math.ceil(Math.log2(s))),o="connection"in navigator?navigator.connection?.effectiveType??null:null;return await this.store.props.assets.resolve(i,{screenScale:s||1,steppedScreenScale:a,dpr:n,networkEffectiveType:o,shouldResolveToOriginal:r})}async uploadAsset(e,t,i){return await this.store.props.assets.upload(e,t,i)}_shapeGeometryCaches={};getShapeGeometry(e,t){let i=t?.context??"none";return this._shapeGeometryCaches[i]||(this._shapeGeometryCaches[i]=this.store.createComputedCache("bounds",e=>(this.fonts.trackFontsForShape(e),this.getShapeUtil(e).getGeometry(e,t)),{areRecordsEqual:v.E})),this._shapeGeometryCaches[i].get("string"==typeof e?e:e.id)}_getShapeHandlesCache(){return this.store.createComputedCache("handles",e=>this.getShapeUtil(e).getHandles?.(e),{areRecordsEqual:v.E})}getShapeHandles(e){return this._getShapeHandlesCache().get("string"==typeof e?e:e.id)}getShapeLocalTransform(e){let t="string"==typeof e?e:e.id,i=this.getShape(t);if(!i)throw Error("Editor.getTransform: shape not found");return x.V.Identity().translate(i.x,i.y).rotate(i.rotation)}_getShapePageTransformCache(){return this.store.createComputedCache("pageTransformCache",e=>{if((0,n.xh)(e.parentId))return this.getShapeLocalTransform(e);let t=this._getShapePageTransformCache().get(e.parentId)??x.V.Identity();return x.V.Compose(t,this.getShapeLocalTransform(e))})}getShapeParentTransform(e){let t="string"==typeof e?e:e.id,i=this.getShape(t);return!i||(0,n.xh)(i.parentId)?x.V.Identity():this._getShapePageTransformCache().get(i.parentId)??x.V.Identity()}getShapePageTransform(e){let t="string"==typeof e?e:e.id;return this._getShapePageTransformCache().get(t)??x.V.Identity()}_getShapePageBoundsCache(){return this.store.createComputedCache("pageBoundsCache",e=>{let t=this.getShapePageTransform(e);if(t)return P.az.FromPoints(t.applyToPoints(this.getShapeGeometry(e).boundsVertices))})}getShapePageBounds(e){return this._getShapePageBoundsCache().get("string"==typeof e?e:e.id)}_getShapeClipPathCache(){return this.store.createComputedCache("clipPathCache",e=>{let t=this._getShapeMaskCache().get(e.id);if(!t)return;if(0===t.length)return"polygon(0px 0px, 0px 0px, 0px 0px)";let i=this._getShapePageTransformCache().get(e.id);if(!i)return;let s=x.V.applyToPoints(x.V.Inverse(i),t);return`polygon(${s.map(e=>`${e.x}px ${e.y}px`).join(",")})`})}getShapeClipPath(e){return this._getShapeClipPathCache().get("string"==typeof e?e:e.id)}_getShapeMaskCache(){return this.store.createComputedCache("pageMaskCache",e=>{if((0,n.xh)(e.parentId))return;let t=[];for(let i of this.getShapeAncestors(e.id)){let s=this.getShapeUtil(i),r=s.getClipPath?.(i);if(!r||s.shouldClipChild?.(e)===!1)continue;let n=this.getShapePageTransform(i.id);t.push(n.applyToPoints(r))}if(0!==t.length)return t.reduce((e,t)=>{let i=(0,_.oQ)(e,t);return i?i.map(b.l.Cast):[]})})}getShapeMask(e){return this._getShapeMaskCache().get("string"==typeof e?e:e.id)}getShapeMaskedPageBounds(e){return"string"!=typeof e&&(e=e.id),this._getShapeMaskedPageBoundsCache().get(e)}_getShapeMaskedPageBoundsCache(){return this.store.createComputedCache("shapeMaskedPageBoundsCache",e=>{let t=this._getShapePageBoundsCache().get(e.id);if(!t)return;let i=this._getShapeMaskCache().get(e.id);if(i){if(0===i.length)return;let{corners:e}=t;if(e.every((e,t)=>e&&b.l.Equals(e,i[t])))return t.clone();let s=(0,_.oQ)(i,e);if(!s)return;return P.az.FromPoints(s)}return t})}getShapeAncestors(e,t=[]){let i="string"==typeof e?e:e.id,s=this.getShape(i);if(!s)return t;let r=s.parentId;if((0,n.xh)(r))return t.reverse(),t;let a=this.store.get(r);return a?(t.push(a),this.getShapeAncestors(a,t)):t}findShapeAncestor(e,t){let i="string"==typeof e?e:e.id,s=this.getShape(i);if(!s)return;let r=s.parentId;if((0,n.xh)(r))return;let a=this.getShape(r);if(a)return t(a)?a:this.findShapeAncestor(a,t)}hasAncestor(e,t){let i="string"==typeof e?e:e?.id,s=i&&this.getShape(i);return!!s&&(s.parentId===t||this.hasAncestor(this.getShapeParent(s),t))}findCommonAncestor(e,t){if(0===e.length)return;let i="string"==typeof e[0]?e:e.map(e=>e.id),s=(0,a.oE)(i.map(e=>this.getShape(e)));if(1===s.length){let e=s[0].parentId;if((0,n.xh)(e))return;return t?this.findShapeAncestor(s[0],t)?.id:e}let[r,...o]=s,h=this.getShapeParent(r);for(;h;){if(t&&!t(h)){h=this.getShapeParent(h);continue}if(o.every(e=>this.hasAncestor(e,h.id)))return h.id;h=this.getShapeParent(h)}}isShapeOrAncestorLocked(e){let t=e&&this.getShape(e);return void 0!==t&&(!!t.isLocked||this.isShapeOrAncestorLocked(this.getShapeParent(t)))}getNotVisibleShapes(){return this._notVisibleShapes.get()}_notVisibleShapes=(0,z.s)(this);_culledShapesCache=null;getCulledShapes(){let e=this.getNotVisibleShapes(),t=this.getSelectedShapeIds(),i=this.getEditingShapeId(),s=new Set(e);i&&s.delete(i),t.forEach(e=>{s.delete(e)});let r=this._culledShapesCache;if(r){if(r.size!==s.size)return this._culledShapesCache=s,s;for(let e of r)if(!s.has(e))return this._culledShapesCache=s,s;return r}return this._culledShapesCache=s,s}getCurrentPageBounds(){let e;return this.getCurrentPageShapeIdsSorted().forEach(t=>{if(this.isShapeHidden(t))return;let i=this.getShapeMaskedPageBounds(t);i&&(e=e?e.expand(i):i.clone())}),e}getHitTestMargin(){let{hitTestMargin:e,coarseHitTestMargin:t}=this.options;return(this.getInstanceState().isCoarsePointer?t:e)/this.getZoomLevel()}getSelectedShapeAtPoint(e){let t=this.getSelectedShapeIds(),i=this.options.hitTestMargin/this.getZoomLevel(),s=this.getCurrentPageShapesSorted();for(let r=s.length-1;r>=0;r--){let n=s[r];if("group"!==n.type&&t.includes(n.id)&&this.getShapeGeometry(n).hitTestPoint(this.getPointInShapeSpace(n,e),i,!0))return n}}getShapeAtPoint(e,t={}){let i=this.getViewportPageBounds(),{filter:s,margin:r=0,hitLocked:n=!1,hitLabels:a=!1,hitInside:o=!1,hitFrameInside:h=!1}=t,[l,p]=Array.isArray(r)?r:[r,r],d=1/0,g=null,u=1/0,c=null,S=Math.max(l,p,this.getHitTestMargin()),f=this._spatialIndex.getShapeIdsAtPoint(e,S),m=(t.renderingOnly?this.getCurrentPageRenderingShapesSorted():this.getCurrentPageShapesSorted()).filter(t=>{if(!f.has(t.id)&&!this.isShapeFrameLike(t)||t.isLocked&&!n||this.isShapeHidden(t)||this.isShapeOfType(t,"group"))return!1;let i=this.getShapeMask(t);return(!i||!!(0,T.s3)(e,i))&&(!s||!!s(t))});for(let t=m.length-1;t>=0;t--){let s,r=m[t],n=this.getShapeGeometry(r),S=n instanceof w.I,f=this.getPointInShapeSpace(r,e),y=this.getShapeUtil(r),I=this.isShapeFrameLike(r);if(I||(this.isShapeOfType(r,"note")||this.isShapeOfType(r,"arrow")||this.isShapeOfType(r,"geo")&&"none"===r.props.fill)&&y.getText(r)?.trim()){for(let e of n.children)if(e.isLabel&&e.isPointInBounds(f))return r}if(I){let e=n.distanceToPoint(f,h);if(h?e>0&&e<=p||e<=0&&e>-l:e>0&&e<=p)return c||r;if(n.hitTestPoint(f,0,!0))return c||g||(h?r:void 0);continue}if(S){let e=1/0;for(let t of n.children){if(t.isLabel&&!a)continue;let i=t.distanceToPoint(f,o);i<e&&(e=i)}s=e}else s=0===p&&(n.bounds.w<1||n.bounds.h<1)||n.bounds.containsPoint(f,p)?n.distanceToPoint(f,o):1/0;if(n.isClosed){if(s<=p||o&&s<=0&&s>-l)if(n.isFilled||S&&n.children[0].isFilled){if(n.ignoreHit(f))continue;return c||r}else{if(this.getShapePageBounds(r).contains(i))continue;if(o?s>0&&s<=p||s<=0&&s>-l:Math.abs(s)<=Math.max(l,p))Math.abs(s)<u&&(u=Math.abs(s),c=r);else if(!c){let{area:e}=n;e<d&&(d=e,g=r)}}}else if(s<this.getHitTestMargin())return r}return c||g||void 0}getShapesAtPoint(e,t={}){let i=t.margin??0,s=this._spatialIndex.getShapeIdsAtPoint(e,i);return this.getCurrentPageShapesSorted().filter(i=>!this.isShapeHidden(i)&&(!!s.has(i.id)||!!this.isShapeFrameLike(i))&&this.isPointInShape(i,e,t)).reverse()}getShapeIdsInsideBounds(e){return this._spatialIndex.getShapeIdsInsideBounds(e)}isPointInShape(e,t,i={}){let{hitInside:s=!1,margin:r=0}=i,n="string"==typeof e?e:e.id,a=this.getShapeMask(n);return(!a||!!(0,T.s3)(t,a))&&this.getShapeGeometry(n).hitTestPoint(this.getPointInShapeSpace(e,t),r,s)}getPointInShapeSpace(e,t){let i="string"==typeof e?e:e.id;return this._getShapePageTransformCache().get(i).clone().invert().applyToPoint(t)}getPointInParentSpace(e,t){let i="string"==typeof e?e:e.id,s=this.getShape(i);if(!s)return new b.l(0,0);if((0,n.xh)(s.parentId))return b.l.From(t);let r=this.getShapePageTransform(s.parentId);return r?r.clone().invert().applyToPoint(t):b.l.From(t)}getCurrentPageShapes(){return Array.from(this.getCurrentPageShapeIds(),e=>this.store.get(e))}getCurrentPageShapesSorted(){let e=[],t=this.getSortedChildIdsForParent(this.getCurrentPageId());for(let i=0,s=t.length;i<s;i++)!function e(t,i,s){let r=t.getShape(i);if(!r)return;s.push(r);let n=t.getSortedChildIdsForParent(i);for(let i=0,r=n.length;i<r;i++)e(t,n[i],s)}(this,t[i],e);return e}getCurrentPageRenderingShapesSorted(){let e=this.getCulledShapes();return this.getCurrentPageShapesSorted().filter(({id:t})=>!e.has(t)&&!this.isShapeHidden(t))}isShapeOfType(e,t){let i="string"==typeof e?this.getShape(e):e;return!!i&&i.type===t}isShapeFrameLike(e){let t="string"==typeof e?this.getShape(e):e;return!!t&&this.getShapeUtil(t).isFrameLike(t)}getShape(e){let t="string"==typeof e?e:e.id;if((0,n.vc)(t))return this.store.get(t)}getShapeParent(e){let t="string"==typeof e?e:e?.id;if(!t)return;let i=this.getShape(t);if(void 0!==i&&(0,n.vc)(i.parentId))return this.getShape(i.parentId)}getShapeNearestSibling(e,t){return t?t.parentId===e.parentId?t:this.findShapeAncestor(t,t=>t.parentId===e.parentId):void 0}isShapeInPage(e,t=this.getCurrentPageId()){let i="string"==typeof e?e:e.id,s=this.getShape(i);if(!s)return!1;let r=!1;if(s.parentId===t)r=!0;else{let e=this.getShape(s.parentId);for(;e;){if(e.parentId===t){r=!0;break}e=this.getShape(e.parentId)}}return r}getAncestorPageId(e){let t="string"==typeof e?e:e?.id,i=t&&this.getShape(t);if(i)if((0,n.xh)(i.parentId))return i.parentId;else return this.getAncestorPageId(this.getShape(i.parentId))}_parentIdsToChildIds;reparentShapes(e,t,i){let s="string"==typeof e[0]?e:e.map(e=>e.id);if(0===s.length)return this;let r=[],o=(0,n.xh)(t)?x.V.Identity():this.getShapePageTransform(t),h=o.rotation(),l=[],p=(0,a.oE)(this.getSortedChildIdsForParent(t).map(e=>this.getShape(e)));if(i){let e=p.find(e=>e.index===i);if(e){let t=p[p.indexOf(e)+1];l=t?(0,a.MT)(i,t.index,s.length):(0,a.Zo)(i,s.length)}else{let e=p.sort(a.Ky).find(e=>e.index>i);l=e?(0,a.MT)(i,e.index,s.length):(0,a.Zo)(i,s.length)}}else{let e=p.length&&p[p.length-1];l=e?(0,a.Zo)(e.index,s.length):(0,a.uu)(s.length)}let d=o.clone().invert(),g=(0,a.oE)(s.map(e=>this.getShape(e))).sort(a.Ky);return this.run(()=>{for(let e=0;e<g.length;e++){let i=g[e],s=this.getShapePageTransform(i);if(!s)continue;let n=s.point();if(!n)continue;let a=d.applyToPoint(n),o=s.rotation()-h;if(i.id===t)throw Error("Attempted to reparent a shape to itself!");r.push({id:i.id,type:i.type,parentId:t,x:a.x,y:a.y,rotation:o,index:l[e]})}this.updateShapes(r)},{ignoreShapeLock:!0}),this}getHighestIndexForParent(e){let t="string"==typeof e?e:e.id,i=this._parentIdsToChildIds.get()[t];if(!i||0===i.length)return(0,a.AQ)(a.as);let s=this.getShape(i[i.length-1]);return(0,a.AQ)(s.index)}getSortedChildIdsForParent(e){let t="string"==typeof e?e:e.id,i=this._parentIdsToChildIds.get()[t];return i||s.Ml}visitDescendants(e,t){for(let i of this.getSortedChildIdsForParent(e))!1!==t(i)&&this.visitDescendants(i,t);return this}getShapeAndDescendantIds(e){let t=new Set;for(let i of e.map(e=>this.getShape(e)).sort(a.Ky))t.add(i.id),this.visitDescendants(i,e=>{t.add(e)});return t}getDraggingOverShape(e,t){let i=(0,a.oE)(t.map(e=>this.getShape(e))).filter(e=>!e.isLocked&&!this.isShapeHidden(e));for(let s of this.getShapesAtPoint(e,{hitInside:!0,margin:0}).filter(e=>!t.includes(e)&&!e.isLocked&&!this.isShapeHidden(e)&&!i.includes(e))){let e=this.getShapeUtil(s);if(e.onDragShapesOver||e.onDragShapesIn||e.onDragShapesOut||e.onDropShapesOver)return s}}getOutermostSelectableShape(e,t){let i="string"==typeof e?e:e.id,s=this.getShape(i),r=s,n=s,a=this.getFocusedGroup();for(;n;){if(this.isShapeOfType(n,"group")&&a?.id!==n.id&&!this.hasAncestor(a,n.id)&&(t?.(n)??!0))r=n;else if(a?.id===n.id)break;n=this.getShapeParent(n)}return r}_getBindingsIndexCache(){let e=(0,O.V)(this);return this.store.createComputedCache("bindingsIndex",t=>e.get().get(t.id),{areRecordsEqual:()=>!0})}getBinding(e){return this.store.get(e)}getBindingsFromShape(e,t){let i="string"==typeof e?e:e.id;return this.getBindingsInvolvingShape(i).filter(e=>e.fromId===i&&e.type===t)}getBindingsToShape(e,t){let i="string"==typeof e?e:e.id;return this.getBindingsInvolvingShape(i).filter(e=>e.toId===i&&e.type===t)}getBindingsInvolvingShape(e,t){let i="string"==typeof e?e:e.id,r=this._getBindingsIndexCache().get(i)??s.Ml;return t?r.filter(e=>e.type===t):r}createBindings(e){let t=[];for(let i of e){let e=this.getShape(i.fromId),s=this.getShape(i.toId);if(!e||!s||!this.canBindShapes({fromShape:e,toShape:s,binding:i}))continue;let r=this.getBindingUtil(i.type).getDefaultProps(),a=this.store.schema.types.binding.create({...i,id:i.id??(0,n.BN)(),props:{...r,...i.props}});t.push(a)}return this.store.put(t),this}createBinding(e){return this.createBindings([e])}updateBindings(e){let t=[];for(let i of e){if(!i)continue;let e=this.getBinding(i.id);if(!e)continue;let s=eh(e,i);if(s===e)continue;let r=this.getShape(s.fromId),n=this.getShape(s.toId);r&&n&&this.canBindShapes({fromShape:r,toShape:n,binding:s})&&t.push(s)}return this.store.put(t),this}updateBinding(e){return this.updateBindings([e])}deleteBindings(e,{isolateShapes:t=!1}={}){let i=e.map(e=>"string"==typeof e?e:e.id);return t?this.store.atomic(()=>{for(let e of i){let t=this.getBinding(e);if(!t)continue;let i=this.getBindingUtil(t);i.onBeforeIsolateFromShape?.({binding:t,removedShape:this.getShape(t.toId)}),i.onBeforeIsolateToShape?.({binding:t,removedShape:this.getShape(t.fromId)}),this.store.remove([e])}}):this.store.remove(i),this}deleteBinding(e,t){return this.deleteBindings([e],t)}canBindShapes({fromShape:e,toShape:t,binding:i}){let s="string"==typeof e?e:e.type,r="string"==typeof t?t:t.type,n={fromShape:"string"==typeof e?{type:e}:e,toShape:"string"==typeof t?{type:t}:t,bindingType:"string"==typeof i?i:i.type,fromShapeType:s,toShapeType:r};return s===r?this.getShapeUtil(s).canBind(n):this.getShapeUtil(s).canBind(n)&&this.getShapeUtil(r).canBind(n)}rotateShapesBy(e,t,i){let s="string"==typeof e[0]?e:e.map(e=>e.id);if(s.length<=0)return this;let r=(0,U.f)({editor:this,ids:s});return r&&(0,U._)({delta:t,snapshot:r,editor:this,stage:"one-off",centerOverride:i?.center}),this}getChangesToTranslateShape(e,t){let i=e,s=this.getShapeUtil(e),r=s.onTranslateStart?.(i);r&&(i=eh(i,r)),i=eh(i,{id:e.id,type:e.type,x:t.x,y:t.y});let n=s.onTranslate?.(e,i);n&&(i=eh(i,n));let a=s.onTranslateEnd?.(e,i);return a&&(i=eh(i,a)),i}nudgeShapes(e,t){let i="string"==typeof e[0]?e:e.map(e=>e.id);if(i.length<=0)return this;let s=[];for(let e of i){let i=this.getShape(e),r=b.l.From(t),n=this.getShapeParentTransform(i);n&&r.rot(-n.rotation()),s.push(this.getChangesToTranslateShape(i,r.add(i)))}return this.updateShapes(s),this}duplicateShapes(e,t){return this.run(()=>{let i="string"==typeof e[0]?e:e.map(e=>e.id),s=this._shouldIgnoreShapeLock?i:this._getUnlockedShapeIds(i);if(s.length<=0)return this;let r=new Set(s),o=this.getShapeAndDescendantIds(s),h=[...o].reverse(),l=new Map;for(let e of o)l.set(e,(0,n.n6)());let{shapesToCreateWithOriginals:p,bindingsToCreate:d}=el(this,o,e=>{let i=[];for(let t of e){let e=this.getBinding(t);if(!e)continue;let s=(0,n.BN)();i.push({...e,id:s,fromId:(0,a.Z1)(l.get(e.fromId)),toId:(0,a.Z1)(l.get(e.toId))})}let s=[];for(let e of h){let i=(0,a.Z1)(l.get(e)),n=this.getShape(e);if(!n)continue;let o=0,h=0;if(t&&r.has(e)){let e=this.getShapeParentTransform(n),i=new b.l(t.x,t.y).rot(-e.rotation());o=i.x,h=i.y}s.push({shape:{...n,id:i,x:n.x+o,y:n.y+h,index:"a1",parentId:l.get(n.parentId)??n.parentId},originalShape:n})}return{shapesToCreateWithOriginals:s,bindingsToCreate:i}});p.forEach(({shape:e,originalShape:t})=>{let i=t.parentId,s=this.getSortedChildIdsForParent(i),r=s.indexOf(t.id),n=s[r+1],o=n?this.getShape(n):void 0;e.index=(0,a.HE)(t.index,o?.index)});let g=p.map(({shape:e,originalShape:t})=>this.getShapeUtil(e).onBeforeDuplicate?.(t,e)??e);if(!this.canCreateShapes(g))return void eo(this);if(this.createShapes(g),this.createBindings(d),this.setSelectedShapes((0,a.oE)(s.map(e=>{let t=l.get(e);return t&&this.getShape(t)?t:null}))),void 0!==t){let e=this.getSelectionPageBounds(),t=this.getViewportPageBounds();e&&!t.contains(e)&&this.centerOnPoint(e.center,{animation:{duration:this.options.animationMediumMs}})}}),this}moveShapesToPage(e,t){let i="string"==typeof e[0]?e:e.map(e=>e.id);if(0===i.length||this.getIsReadonly()||t===this.getCurrentPageId()||!this.store.has(t))return this;let s=this.getContentFromCurrentPage(i);if(!s)return this;if(this.getPageShapeIds(t).size+s.shapes.length>this.options.maxShapesPerPage)return eo(this,t),this;let r=this.getCamera().z;return this.run(()=>{this.deleteShapes(i),this.setCurrentPage(t),this.setFocusedGroup(null),this.selectNone(),this.putContentOntoCurrentPage(s,{select:!0,preserveIds:!0,preservePosition:!0}),this.setCamera({...this.getCamera(),z:r}),this.centerOnPoint(this.getSelectionRotatedPageBounds().center)}),this}toggleLock(e){let t="string"==typeof e[0]?e:e.map(e=>e.id);if(this.getIsReadonly()||0===t.length)return this;let i=!0,s=!0,r=[];for(let e of t){let t=this.getShape(e);t&&(r.push(t),t.isLocked?s=!1:i=!1)}return this.run(()=>{s?(this.updateShapes(r.map(e=>({id:e.id,type:e.type,isLocked:!0}))),this.setSelectedShapes([])):i?this.updateShapes(r.map(e=>({id:e.id,type:e.type,isLocked:!1}))):this.updateShapes(r.map(e=>({id:e.id,type:e.type,isLocked:!0})))}),this}sendToBack(e){let t="string"==typeof e[0]?e:e.map(e=>e.id),i=(0,M.T)(this,"toBack",t,{considerAllShapes:!0});return i&&this.updateShapes(i),this}sendBackward(e,t={}){let i="string"==typeof e[0]?e:e.map(e=>e.id),s=(0,M.T)(this,"backward",i,t);return s&&this.updateShapes(s),this}bringForward(e,t={}){let i="string"==typeof e[0]?e:e.map(e=>e.id),s=(0,M.T)(this,"forward",i,t);return s&&this.updateShapes(s),this}bringToFront(e){let t="string"==typeof e[0]?e:e.map(e=>e.id),i=(0,M.T)(this,"toFront",t);return i&&this.updateShapes(i),this}getShapeClusters(e,t,i){let s="string"==typeof e[0]?e:e.map(e=>e.id),r=(0,a.oE)(s.map(e=>this.getShape(e)));i?.filterAxisAligned&&(r=r.filter(e=>this.getShapePageTransform(e)?.rotation()%(T.PI/2)==0));let n=[],o=[],h=new Set;for(let e of r){if(h.has(e.id))continue;h.add(e.id);let i=this.getShapePageBounds(e);if(!i||!this.getShapeUtil(e).canBeLaidOut?.(e,{type:t,shapes:r}))continue;let s=[e],a=[i];this.collectShapesViaArrowBindings({bindings:this.getBindingsToShape(e.id,"arrow"),initialShapes:r,resultShapes:s,resultBounds:a,visited:h});let l=P.az.Common(a);l&&(n.push({shapes:s,pageBounds:l}),o.push(l))}return{clusters:n,allBounds:o}}collectShapesViaArrowBindings(e){let{initialShapes:t,resultShapes:i,resultBounds:s,bindings:r,visited:n}=e;for(let a of r)for(let r of[a.fromId,a.toId])if(!n.has(r)){let a=t.find(e=>e.id===r);if(a&&!n.has(a.id)){n.add(a.id);let t=this.getShapePageBounds(a);if(!t)continue;i.push(a),s.push(t),this.collectShapesViaArrowBindings({...e,bindings:this.getBindingsInvolvingShape(a,"arrow")})}}}flipShapes(e,t){if(this.getIsReadonly())return this;let i="string"==typeof e[0]?e:e.map(e=>e.id),s=(0,a.oE)(i.map(e=>this.getShape(e)));for(let e of s)if(this.isShapeOfType(e,"group")){let t=(0,a.oE)(this.getSortedChildIdsForParent(e.id).map(e=>this.getShape(e)));s.push(...t)}let r=[],n=[];for(let e of s){let t=this.getShapeUtil(e);if(!t.canBeLaidOut(e,{type:"flip",shapes:s}))continue;let i=this.getShapePageBounds(e),a=this.getShapeGeometry(e).bounds,o=this.getShapePageTransform(e.id);i&&a&&o&&(r.push({shape:e,localBounds:a,pageTransform:o,isAspectRatioLocked:t.isAspectRatioLocked(e)}),n.push(i))}if(!r.length)return this;let o=P.az.Common(n).center;return this.run(()=>{for(let{shape:e,localBounds:i,pageTransform:s,isAspectRatioLocked:n}of r)this.resizeShape(e.id,{x:"horizontal"===t?-1:1,y:"vertical"===t?-1:1},{initialBounds:i,initialPageTransform:s,initialShape:e,isAspectRatioLocked:n,mode:"scale_shape",scaleOrigin:o,scaleAxisRotation:0})}),this}stackShapes(e,t,i){let s,r,n,a,o=i??this.options.adjacentShapeMargin;if(this.getIsReadonly())return this;let{clusters:h}=this.getShapeClusters(e,"stack"),l=h.length;if(0===o&&l<3||l<2)return this;"horizontal"===t?(s="x",r="minX",n="maxX",a="width"):(s="y",r="minY",n="maxY",a="height");let p=0;if(0===o){let e={};h.sort((e,t)=>e.pageBounds[r]-t.pageBounds[r]);for(let t=0;t<l-1;t++){let i=h[t],s=h[t+1].pageBounds[r]-i.pageBounds[n];e[s]||(e[s]=0),e[s]++}let t=1;for(let[i,s]of Object.entries(e))s>t&&(t=s,p=parseFloat(i));if(1===t){let t=0;for(let[i,s]of Object.entries(e))p+=parseFloat(i)*s,t+=s;p/=t}}else p=o;let d=[],g=h[0].pageBounds[n];for(let e=1;e<h.length;e++){let{shapes:t,pageBounds:i}=h[e],r=new b.l;for(let e of(r[s]=g+p-i[s],t)){let t=r.clone(),i=this.getShapeParent(e);if(i){let e=this.getShapePageTransform(i);e&&t.rot(-e.rotation())}t.add(e),d.push(this.getChangesToTranslateShape(e,t))}g+=i[a]+p}return this.updateShapes(d),this}packShapes(e,t){let i,s;if(this.getIsReadonly())return this;let r=t??this.options.adjacentShapeMargin,{clusters:n,allBounds:a}=this.getShapeClusters(e,"pack"),o=n.map(e=>({...e,nextPageBounds:e.pageBounds.clone()}));if(o.length<2)return this;let h=0;for(let{pageBounds:e}of o)h+=e.width*e.height;let l=P.az.Common(a),p=l.width;o.sort((e,t)=>e.pageBounds.width-t.pageBounds.width).sort((e,t)=>e.pageBounds.height-t.pageBounds.height);let d=Math.max(Math.ceil(Math.sqrt(h/.95)),p),g=[new P.az(l.x,l.y,d,1/0)],u=0,c=0;for(let{nextPageBounds:e}of o)for(let t=g.length-1;t>=0;t--)if(i=g[t],!(e.width>i.width)&&!(e.height>i.height)){e.x=i.x,e.y=i.y,c=Math.max(c,e.maxY),u=Math.max(u,e.maxX),e.width===i.width&&e.height===i.height?(s=g.pop(),t<g.length&&(g[t]=s)):e.height===i.height?(i.x+=e.width+r,i.width-=e.width+r):(e.width===i.width||g.push(new P.az(i.x+(e.width+r),i.y,i.width-(e.width+r),e.height)),i.y+=e.height+r,i.height-=e.height+r);break}let S=P.az.Common(o.map(e=>e.nextPageBounds)),f=b.l.Sub(l.center,S.center),m=[];for(let{shapes:e,pageBounds:t,nextPageBounds:i}of o){let s=b.l.Sub(i.point,t.point).add(f);for(let t of e){let e=s.clone();if(this.getShapeParent(t)){let i=this.getShapeParentTransform(t);i&&e.rot(-i.rotation())}e.add(t),m.push(this.getChangesToTranslateShape(t,e))}}return m.length&&this.updateShapes(m),this}alignShapes(e,t){if(this.getIsReadonly())return this;let{clusters:i,allBounds:s}=this.getShapeClusters(e,"align");if(i.length<2)return this;let r=P.az.Common(s),n=[];return i.forEach(({shapes:e,pageBounds:i})=>{let s=new b.l;switch(t){case"top":s.y=r.minY-i.minY;break;case"center-vertical":s.y=r.midY-i.minY-i.height/2;break;case"bottom":s.y=r.maxY-i.minY-i.height;break;case"left":s.x=r.minX-i.minX;break;case"center-horizontal":s.x=r.midX-i.minX-i.width/2;break;case"right":s.x=r.maxX-i.minX-i.width}for(let t of e){let e=s.clone(),i=this.getShapeParent(t);if(i){let t=this.getShapePageTransform(i);t&&e.rot(-t.rotation())}e.add(t),n.push(this.getChangesToTranslateShape(t,e))}}),this.updateShapes(n),this}distributeShapes(e,t){let i,s,r,n;if(this.getIsReadonly())return this;let{clusters:a}=this.getShapeClusters(e,"distribute");if(a.length<3)return this;"horizontal"===t?(i="x",s="minX",r="maxX",n="width"):(i="y",s="minY",r="maxY",n="height");let o=[],h=a.sort((e,t)=>e.pageBounds[s]-t.pageBounds[s])[0],l=a.sort((e,t)=>t.pageBounds[r]-e.pageBounds[r])[0];if(h===l){let i=new Set(h.shapes.map(e=>e.id)),s="string"==typeof e[0]?e:e.map(e=>e.id);return this.distributeShapes(s.filter(e=>!i.has(e)),t)}let p=a.filter(e=>e!==h&&e!==l).sort((e,t)=>e.pageBounds[s]===t.pageBounds[s]?e.shapes[0].id<t.shapes[0].id?-1:1:e.pageBounds[s]-t.pageBounds[s]),d=h.pageBounds[r],g=(l.pageBounds[s]-d-p.reduce((e,t)=>e+t.pageBounds[n],0))/(p.length+1);for(let e=d+g,t=0;t<p.length;t++){let{shapes:s,pageBounds:a}=p[t],h=new b.l;for(let t of(h[i]=e-a[i],e+a[n]>l.pageBounds[r]-1&&(h[i]=l.pageBounds[r]-a[r]-1),s)){let e=h.clone(),i=this.getShapeParent(t);if(i){let t=this.getShapePageTransform(i);t&&e.rot(-t.rotation())}e.add(t),o.push(this.getChangesToTranslateShape(t,e))}e+=a[n]+g}return this.updateShapes(o),this}stretchShapes(e,t){let i,s,r;if(this.getIsReadonly())return this;let{clusters:n,allBounds:a}=this.getShapeClusters(e,"stretch",{filterAxisAligned:!0});if(n.length<2)return this;let o=P.az.Common(a);return"horizontal"===t?(i="x",s="minX",r="width"):(i="y",s="minY",r="height"),this.run(()=>{n.forEach(({shapes:e,pageBounds:t})=>{let n=new b.l;n[i]=o[s]-t[s];let a=t.center.clone();a[i]=o[s];let h=new b.l(1,1);for(let s of(h[i]=o[r]/t[r],e)){let e=n.clone(),t=this.getShapeParentTransform(s);t&&e.rot(-t.rotation()),e.add(s);let i=this.getChangesToTranslateShape(s,e);this.updateShape(i),this.resizeShape(s.id,h,{initialBounds:this.getShapeGeometry(s).bounds,scaleOrigin:a,isAspectRatioLocked:this.getShapeUtil(s).isAspectRatioLocked(s),scaleAxisRotation:0})}})}),this}resizeToBounds(e,t){if(this.getIsReadonly())return this;let i=P.az.From(t),{clusters:s,allBounds:r}=this.getShapeClusters(e,"resize_to_bounds",{filterAxisAligned:!0});if(0===s.length)return this;let n=P.az.Common(r);if(!n||0===n.width||0===n.height)return this;let a=i.width/n.width,o=i.height/n.height,h=new b.l(a,o);return s.forEach(({shapes:e,pageBounds:t})=>{let s=new b.l(i.minX-n.minX+(t.minX-n.minX)*(a-1),i.minY-n.minY+(t.minY-n.minY)*(o-1)),r=new b.l(i.minX+(t.minX-n.minX)*a,i.minY+(t.minY-n.minY)*o);for(let t of e){let e=s.clone(),i=this.getShapeParentTransform(t);i&&e.rot(-i.rotation()),e.add(t);let n=this.getChangesToTranslateShape(t,e);this.updateShape(n),this.resizeShape(t.id,h,{initialBounds:this.getShapeGeometry(t).bounds,scaleOrigin:r,isAspectRatioLocked:this.getShapeUtil(t).isAspectRatioLocked(t),scaleAxisRotation:0})}}),this}resizeShape(e,t,i={}){let s=this.getResizeShapePartial(e,t,i);return s&&this.updateShapes([s]),this}getResizeShapePartial(e,t,i={}){let s="string"==typeof e?e:e.id;if(this.getIsReadonly())return null;Number.isFinite(t.x)||(t=new b.l(1,t.y)),Number.isFinite(t.y)||(t=new b.l(t.x,1));let r=i.initialShape??this.getShape(s);if(!r)return null;let n=i.scaleOrigin??this.getShapePageBounds(s)?.center;if(!n)return null;let a=i.initialPageTransform?x.V.Cast(i.initialPageTransform):this.getShapePageTransform(s);if(!a)return null;let o=a.rotation();if(null==o)return null;let h=i.scaleAxisRotation??o,l=i.initialBounds??this.getShapeGeometry(s).bounds;if(!l)return null;let p=i.isAspectRatioLocked??this.getShapeUtil(r).isAspectRatioLocked(r);if(!(0,T.jw)(o,h))return this._resizeUnalignedShape(s,t,{...i,initialBounds:l,scaleOrigin:n,scaleAxisRotation:h,initialPageTransform:a,isAspectRatioLocked:p,initialShape:r}),null;let d=this.getShapeUtil(r);p&&(t=Math.abs(t.x)>Math.abs(t.y)?new b.l(t.x,Math.sign(t.y)*Math.abs(t.x)):new b.l(Math.sign(t.x)*Math.abs(t.y),t.y));let g=null;if(d.onResize&&d.canResize(r)){let e=this._scalePagePoint(x.V.applyToPoint(a,new b.l(0,0)),n,t,h),p=this.getPointInParentSpace(r.id,e),u=new b.l(t.x,t.y),c=(0,T.YY)((o-h)%Math.PI,0);u.x=c?t.x:t.y,u.y=c?t.y:t.x;let S=x.V.applyToPoint(a,new b.l),{x:f,y:m}=this.getPointInParentSpace(r.id,S);g=r,i.skipStartAndEndCallbacks||(g=eh(r,d.onResizeStart?.(r)??void 0));let y=d.onResize({...r,x:f,y:m},{newPoint:p,handle:i.dragHandle??"bottom_right",mode:i.mode??"scale_shape",scaleX:u.x,scaleY:u.y,initialBounds:l,initialShape:r});if(g=eh(g,{id:s,type:r.type,x:p.x,y:p.y,...y}),i.skipStartAndEndCallbacks||(g=eh(g,d.onResizeEnd?.(r,g)??void 0)),y)return g}let u=x.V.applyToPoint(a,l.center),c=this._scalePagePoint(u,n,t,h),S=this.getPointInParentSpace(r.id,u),f=this.getPointInParentSpace(r.id,c),m=b.l.Sub(f,S);return g?{...g,x:r.x+m.x,y:r.y+m.y}:{id:s,type:r.type,x:r.x+m.x,y:r.y+m.y}}_scalePagePoint(e,t,i,s){let r=b.l.RotWith(e,t,-s).sub(t),n=b.l.MulV(r,i);return b.l.Add(n,t).rotWith(t,s)}_resizeUnalignedShape(e,t,i){let{type:s}=i.initialShape,r=new b.l(t.x,t.y);if(Math.abs(t.x)>Math.abs(t.y)?r.x=Math.sign(t.x)*Math.abs(t.y):r.y=Math.sign(t.y)*Math.abs(t.x),this.resizeShape(e,r,{initialShape:i.initialShape,initialBounds:i.initialBounds,isAspectRatioLocked:i.isAspectRatioLocked,initialPageTransform:i.initialPageTransform}),Math.sign(t.x)*Math.sign(t.y)<0){let t=this.getShapeParentTransform(e).rotation(),r=-i.initialShape.rotation-2*t;this.updateShapes([{id:e,type:s,rotation:r}])}let n=x.V.applyToPoint(i.initialPageTransform,i.initialBounds.center),a=this._scalePagePoint(n,i.scaleOrigin,t,i.scaleAxisRotation),o=this.getShapePageTransform(e),h=this.getShapeGeometry(e).bounds,l=x.V.applyToPoint(o,h.center),p=o.point();if(!l||!p)return this;let d=b.l.Sub(a,l),g=b.l.Add(p,d),{x:u,y:c}=this.getPointInParentSpace(e,g);return this.updateShapes([{id:e,type:s,x:u,y:c}]),this}getInitialMetaForShape(e){return{}}canCreateShape(e){return this.canCreateShapes([e])}canCreateShapes(e){return e.length+this.getCurrentPageShapeIds().size<=this.options.maxShapesPerPage}createShape(e){return this.createShapes([e]),this}createShapes(e){if(!Array.isArray(e))throw Error("Editor.createShapes: must provide an array of shapes or shape partials");if(this.getIsReadonly()||e.length<=0)return this;let t=this.getCurrentPageShapeIds();if(e.length+t.size>this.options.maxShapesPerPage)return eo(this),this;let i=this.getFocusedGroupId();return this.run(()=>{let t=this.getCurrentPageShapesSorted(),s=e.map(s=>{if(s.id||(s={id:(0,n.n6)(),...s}),!s.parentId||!(this.store.has(s.parentId)||e.some(e=>e.id===s.parentId))){let e=this.getFocusedGroupId();if(void 0!==s.x&&void 0!==s.y)for(let i=t.length-1;i>=0;i--){let r=t[i];if(this.getShapeUtil(r).canReceiveNewChildrenOfType(r,s.type)&&!this.isShapeHidden(r)&&this.isPointInShape(r,{x:s.x??0,y:s.y??0},{margin:0,hitInside:!0})){e=r.id;break}}let r=s.parentId;if(e===s.id&&(e=i),e!==r&&((s={...s}).parentId=e,(0,n.vc)(e))){let t=this.getPointInShapeSpace(this.getShape(e),{x:s.x??0,y:s.y??0});s.x=t.x,s.y=t.y,s.rotation=-this.getShapePageTransform(e).rotation()+(s.rotation??0)}}return s}),r=new Map,o=[],{opacityForNextShape:h}=this.getInstanceState();for(let e of s){let t=this.getShapeUtil(e),s=e.index;if(!s){let t=e.parentId??i;r.has(t)||r.set(t,this.getHighestIndexForParent(t)),s=r.get(t),r.set(t,(0,a.AQ)(s))}let n=t.getDefaultProps();for(let[t,i]of this.styleProps[e.type])n[i]=this.getStyleForNextShape(t);let l=this.store.schema.types.shape.create({...e,index:s,opacity:e.opacity??h,parentId:e.parentId??i,props:"props"in e?{...n,...e.props}:n});if(void 0===l.index)throw Error("no index!");let p=this.getShapeUtil(l).onBeforeCreate?.(l);p&&(l=p),o.push(l)}o.forEach(e=>{e.meta={...this.getInitialMetaForShape(e),...e.meta}}),this.emit("created-shapes",o),this.emit("edit"),this.store.put(o)}),this}animatingShapes=new Map;animateShape(e,t={animation:u.mp}){return this.animateShapes([e],t)}animateShapes(e,t={animation:u.mp}){let i,s,r;if(!t.animation)return this;let{duration:n=500,easing:o=C.Z.linear}=t.animation,h=(0,a.NF)(),l=n,p=[];for(let t=0,i=e.length;t<i;t++){if(!(s=e[t]))continue;let i=this.getShape(s.id);i&&(r={start:(0,a.pN)(i),end:eh((0,a.pN)(i),s)},p.push(r),this.animatingShapes.set(i.id,h))}let d=t=>{if((l-=t)<0){let{animatingShapes:t}=this,i=e.filter(e=>e&&t.get(e.id)===h);i.length&&this.updateShapes(i),this.off("tick",d);return}i=o(1-l/n);let{animatingShapes:s}=this,r=[];for(let e=0,t=p.length;e<t;e++){let{start:t,end:n}=p[e];s.get(t.id)===h&&r.push({...n,x:t.x+(n.x-t.x)*i,y:t.y+(n.y-t.y)*i,opacity:t.opacity+(n.opacity-t.opacity)*i,rotation:t.rotation+(n.rotation-t.rotation)*i,props:this.getShapeUtil(n).getInterpolatedProps?.(t,n,i)??n.props})}this._updateShapes(r)};return this.on("tick",d),this}groupShapes(e,t={}){let{groupId:i=(0,n.n6)(),select:s=!0}=t;if(!Array.isArray(e))throw Error("Editor.groupShapes: must provide an array of shapes or shape ids");if(this.getIsReadonly())return this;let r="string"==typeof e[0]?e:e.map(e=>e.id);if(r.length<=1)return this;let o=(0,a.oE)((this._shouldIgnoreShapeLock?r:this._getUnlockedShapeIds(r)).map(e=>this.getShape(e))),h=o.sort(a.Ky).map(e=>e.id),l=(0,a.oE)(o.map(e=>this.getShapePageBounds(e))),p=P.az.Common(l);if(!p.isValid())throw Error("Editor.groupShapes: group bounds are invalid (NaN).");let{x:d,y:g}=p.point,u=this.findCommonAncestor(o)??this.getCurrentPageId();if("select"!==this.getCurrentToolId())return this;this.isIn("select.idle")||this.cancel();let c=o.filter(e=>e.parentId===u).sort(a.Ky),S=c[c.length-1]?.index;return this.run(()=>{this.createShapes([{id:i,type:"group",parentId:u,index:S,x:d,y:g,opacity:1,props:{}}]),this.reparentShapes(h,i),s&&this.select(i)}),this}ungroupShapes(e,t={}){if(this.getIsReadonly())return this;let{select:i=!0}=t,s="string"==typeof e[0]?e:e.map(e=>e.id),r=(0,a.oE)((this._shouldIgnoreShapeLock?s:this._getUnlockedShapeIds(s)).map(e=>this.getShape(e)));if(0===r.length||"select"!==this.getCurrentToolId())return this;this.isIn("select.idle")||this.cancel();let n=new Set,o=[];return r.forEach(e=>{this.isShapeOfType(e,"group")?o.push(e):n.add(e.id)}),0===o.length||this.run(()=>{let e;for(let t=0,i=o.length;t<i;t++){e=o[t];let i=this.getSortedChildIdsForParent(e.id);for(let e=0,t=i.length;e<t;e++)n.add(i[e]);this.reparentShapes(i,e.parentId,e.index)}this.deleteShapes(o.map(e=>e.id)),i&&this.select(...n)}),this}updateShape(e){return this.updateShapes([e]),this}updateShapes(e){let t=Array(e.length);for(let i=0,s=e.length;i<s;i++){let s=e[i];if(!s)continue;let r=this.getShape(s.id);if(r){if(!this._shouldIgnoreShapeLock){if(r.isLocked){if(!(Object.hasOwn(s,"isLocked")&&!s.isLocked))continue}else if(this.isShapeOrAncestorLocked(r))continue}this.animatingShapes.delete(s.id),t.push(s)}}return this._updateShapes(t),this}_updateShapes(e){this.getIsReadonly()||this.run(()=>{let t,i,s=[];for(let r=0,n=e.length;r<n;r++){let n=e[r];n&&(t=this.getShape(n.id))&&(i=eh(t,n))!==t&&(i=this.getShapeUtil(t).onBeforeUpdate?.(t,i)??i,s.push(i))}this.emit("edited-shapes",s),this.emit("edit"),this.store.put(s)})}_getUnlockedShapeIds(e){return e.filter(e=>!this.getShape(e)?.isLocked)}deleteShapes(e){if(this.getIsReadonly())return this;if(!Array.isArray(e))throw Error("Editor.deleteShapes: must provide an array of shapes or shapeIds");let t="string"==typeof e[0]?e:e.map(e=>e.id),i=this._shouldIgnoreShapeLock?t:this._getUnlockedShapeIds(t);if(0===i.length)return this;let s=new Set(i);for(let e of i)this.visitDescendants(e,e=>{s.add(e)});return this.emit("deleted-shapes",[...s]),this.emit("edit"),this.run(()=>this.store.remove([...s]))}deleteShape(e){return this.deleteShapes(["string"==typeof e?e:e.id]),this}_extractSharedStyles(e,t){if(this.isShapeOfType(e,"group")){let i=this._parentIdsToChildIds.get()[e.id];if(i)for(let e=0,s=i.length;e<s;e++)this._extractSharedStyles(this.getShape(i[e]),t)}else for(let[i,s]of this.styleProps[e.type])t.applyValue(i,(0,a.g5)(e.props,s))}_getSelectionSharedStyles(){let e=this.getSelectedShapes(),t=new R.b;for(let i of e)this._extractSharedStyles(i,t);return t}getStyleForNextShape(e){let t=this.getInstanceState().stylesForNextShape[e.id];return void 0===t?e.defaultValue:t}getShapeStyleIfExists(e,t){let i=this.styleProps[e.type].get(t);if(void 0!==i)return(0,a.g5)(e.props,i)}getSharedStyles(){if(this.isIn("select")&&this.getSelectedShapeIds().length>0)return this._getSelectionSharedStyles();let e=this.root.getCurrent(),t=new R.b;if(!e)return t;if(e.shapeType)if("frame"!==e.shapeType||this.getShapeUtil("frame").options.showColors)for(let i of this.styleProps[e.shapeType].keys())t.applyValue(i,this.getStyleForNextShape(i));else for(let i of this.styleProps[e.shapeType].keys())"tldraw:color"!==i.id&&t.applyValue(i,this.getStyleForNextShape(i));return t}getSharedOpacity(){if(this.isIn("select")&&this.getSelectedShapeIds().length>0){let e=[],t=i=>{let s=this.getShape(i);if(s)if(this.isShapeOfType(s,"group"))for(let e of this.getSortedChildIdsForParent(s.id))t(e);else e.push(s)};for(let e of this.getSelectedShapeIds())t(e);let i=null;for(let t of e)if(null===i)i=t.opacity;else if(i!==t.opacity)return{type:"mixed"};if(null!==i)return{type:"shared",value:i}}return{type:"shared",value:this.getInstanceState().opacityForNextShape}}setOpacityForNextShapes(e,t){return this.updateInstanceState({opacityForNextShape:e},t),this}setOpacityForSelectedShapes(e){let t=this.getSelectedShapes();if(t.length>0){let i=[],s=e=>{if(this.isShapeOfType(e,"group"))for(let t of this.getSortedChildIdsForParent(e))s(this.getShape(t));else i.push(e)};for(let e of t)s(e);this.updateShapes(i.map(t=>({id:t.id,type:t.type,opacity:e})))}return this}setStyleForNextShapes(e,t,i){let s=this.getInstanceState().stylesForNextShape;return this.updateInstanceState({stylesForNextShape:{...s,[e.id]:t}},i),this}setStyleForSelectedShapes(e,t){let i=this.getSelectedShapes();if(i.length>0){let s=[],r=i=>{if(this.isShapeOfType(i,"group"))for(let e of this.getSortedChildIdsForParent(i.id))r(this.getShape(e));else{let r=this.getShapeUtil(i),n=this.styleProps[i.type].get(e);if(n){let e={id:i.id,type:i.type,props:{[n]:t}};s.push({util:r,originalShape:i,updatePartial:e})}}};for(let e of i)r(e);this.updateShapes(s.map(({updatePartial:e})=>e))}return this}externalAssetContentHandlers={file:null,url:null};temporaryAssetPreview=new Map;registerExternalAssetHandler(e,t){return this.externalAssetContentHandlers[e]=t,this}createTemporaryAssetPreview(e,t){if(this.temporaryAssetPreview.has(e))return this.temporaryAssetPreview.get(e);let i=URL.createObjectURL(t);return this.temporaryAssetPreview.set(e,i),setTimeout(()=>{this.temporaryAssetPreview.delete(e),URL.revokeObjectURL(i)},this.options.temporaryAssetPreviewLifetimeMs),i}getTemporaryAssetPreview(e){return this.temporaryAssetPreview.get(e)}async getAssetForExternalContent(e){return await this.externalAssetContentHandlers[e.type]?.(e)}hasExternalAssetHandler(e){return!!this.externalAssetContentHandlers[e]}externalContentHandlers={text:null,files:null,"file-replace":null,embed:null,"svg-text":null,url:null,tldraw:null,excalidraw:null};registerExternalContentHandler(e,t){return this.externalContentHandlers[e]=t,this}async putExternalContent(e,t={}){if(!(!t.force&&this.getIsReadonly()))return this.externalContentHandlers[e.type]?.(e)}async replaceExternalContent(e,t={}){if(!(!t.force&&this.getIsReadonly()))return this.externalContentHandlers[e.type]?.(e)}getContentFromCurrentPage(e){let t="string"==typeof e[0]?e:e.map(e=>e.id);if(!t||0===t.length)return;let i=this.getShapeAndDescendantIds(t);return el(this,i,e=>{let t=[];for(let i of e){let e=this.getBinding(i);e&&t.push(e)}let s=[],r=[];for(let e of i){let t=this.getShape(e);if(t)if(i.has(t.parentId))r.push(t);else{let e=this.getShapePageTransform(t.id),i=e.point();r.push({...t,x:i.x,y:i.y,rotation:e.rotation(),parentId:this.getCurrentPageId()}),s.push(t.id)}}let a=[],o=new Set;for(let e of r){if(!("assetId"in e.props))continue;let t=e.props.assetId;if(!t||o.has(t))continue;o.add(t);let i=this.getAsset(t);i&&a.push(i)}let h=[],l=new Set;for(let e of this._getReferencedUserIds(r)){let t=(0,n.dB)(e);if(l.has(t))continue;l.add(t);let i=this.store.get(t);i&&h.push(i)}return{schema:this.store.schema.serialize(),shapes:r,rootShapeIds:s,bindings:t,assets:a,users:h}})}async resolveAssetsInContent(e){if(!e)return;let t=[];return await Promise.allSettled(e.assets.map(async e=>{if("image"!==e.type&&"video"!==e.type||e.props.src?.startsWith("data:image")||e.props.src?.startsWith("data:video")||e.props.src?.startsWith("http"))t.push(e);else{let i=(0,a.pN)(e),s=await this.store.props.assets.resolve(e,{screenScale:1,steppedScreenScale:1,dpr:1,networkEffectiveType:null,shouldResolveToOriginal:!0});i.props.src=await a.Sm.blobToDataUrl(await (0,a.hd)(s).then(e=>e.blob())),t.push(i)}})),e.assets=t,e}putContentOntoCurrentPage(e,t={}){if(this.getIsReadonly())return this;if(!e.schema)throw Error("Could not put content:\ncontent is missing a schema.");let{select:i=!1,preserveIds:s=!1,preservePosition:r=!1}=t,{point:o}=t,h=this.getCurrentPageId(),{rootShapeIds:l}=e,p=[],d=[],g=[],u=[],c={store:{...Object.fromEntries(e.assets.map(e=>[e.id,e])),...Object.fromEntries(e.shapes.map(e=>[e.id,e])),...Object.fromEntries(e.bindings?.map(e=>[e.id,e])??[]),...Object.fromEntries(e.users?.map(e=>[e.id,e])??[])},schema:e.schema},S=this.store.schema.migrateStoreSnapshot(c);if("error"===S.type)throw Error("Could not put content: could not migrate content");for(let e of Object.values(S.value))switch(e.typeName){case"asset":p.push(e);break;case"shape":d.push(e);break;case"binding":g.push(e);break;case"user":u.push(e)}if(u.length>0){let e=new Set(this.store.allRecords().filter(e=>"user"===e.typeName).map(e=>e.id)),t=u.filter(t=>!e.has(t.id));t.length>0&&this.store.put(t)}let f=new Map(s?d.map(e=>[e.id,e.id]):d.map(e=>[e.id,(0,n.n6)()])),m=new Map(s?g.map(e=>[e.id,e.id]):g.map(e=>[e.id,(0,n.BN)()])),y=h,I=new Map(d.map(e=>[e.id,e])),C=(0,a.oE)(l.map(e=>I.get(e)));if(o){if(C.length>0){let e=this.getShapeAtPoint(o,{hitInside:!0,hitFrameInside:!0,hitLocked:!0,filter:e=>{let t=this.getShapeUtil(e);return C.every(i=>t.canReceiveNewChildrenOfType?.(e,i.type))}});y=e?.id??h}}else if(!r){let e=this.getSelectedShapes(),t=null,i=e=>{let t=this.getShapeUtil(e);return C.every(i=>t.canReceiveNewChildrenOfType?.(e,i.type))};for(let s of e){let e=i(s)?s:this.findShapeAncestor(s,i)??((0,n.vc)(s.parentId)?this.getShape(s.parentId):null);if(!e){t=null;break}if(t){if(t.id!==e.id){let s=this.getShapeAncestors(t);i(t)&&s.push(t);let r=s.filter(i),n=new Set([e.id,...this.getShapeAncestors(e).map(e=>e.id)]),a=null;for(let e=r.length-1;e>=0;e--)if(n.has(r[e].id)){a=r[e];break}if(!(t=a))break}}else t=e}t&&f.has(t.id)&&(t=null),t&&(y=t.id)}let w=this.getHighestIndexForParent(y),_=[],T=d.map(e=>{let t=f.get(e.id),i={...e,id:t};return s||(i=this.getShapeUtil(i).onBeforeDuplicate?.(e,i)??i),l.includes(e.id)&&(i.parentId=h,_.push(i)),f.has(i.parentId)?i.parentId=f.get(e.parentId):(l.push(i.id),i.index=w,w=(0,a.AQ)(w)),i});if(T.length+this.getCurrentPageShapeIds().size>this.options.maxShapesPerPage)return eo(this),this;let v=g.map(e=>({...e,id:(0,a.Z1)(m.get(e.id)),fromId:(0,a.Z1)(f.get(e.fromId)),toId:(0,a.Z1)(f.get(e.toId))})),k=[],A=[];for(let e of p)this.store.has(e.id)||(("image"===e.type&&e.props.src?.startsWith("data:image")||"video"===e.type&&e.props.src?.startsWith("data:video"))&&(A.push((0,a.pN)(e)),e.props.src=null),k.push(e));return Promise.allSettled(A.map(async e=>{let t=await (0,E.b)(e.props.src,e.props.name,e.props.mimeType??"image/png"),i=await this.getAssetForExternalContent({type:"file",file:t,assetId:e.id});i?this.updateAssets([{...i,id:e.id}]):this.deleteAssets([e.id])})),this.run(()=>{k.length>0&&this.createAssets(k),this.createShapes(T),this.createBindings(v),i&&this.select(..._.map(e=>e.id)),y!==h&&this.reparentShapes(_.map(e=>e.id),y);let e=P.az.Common((0,a.oE)(_.map(e=>this.getShapePageBounds(e.id))));if(void 0===o)if((0,n.xh)(y))if(r)o=e.center;else{let t=this.getViewportPageBounds();o=_.some(e=>{let i=this.getShapePageBounds(e.id);return i&&t.collides(i)})?e.center:t.center}else{let e=this.getShape(y);o=x.V.applyToPoint(this.getShapePageTransform(e),this.getShapeGeometry(e).bounds.center)}let t=P.az.Common((0,a.oE)(_.map(({id:e})=>this.getShapePageBounds(e)))).center,s=b.l.Sub(o,t);if((0!==s.x||0!==s.y)&&this.updateShapes(_.map(({id:e})=>{let t=this.getShape(e),i=this.getShapeParentTransform(e).decompose().rotation,r=b.l.Rot(s,-i);return{id:t.id,type:t.type,x:t.x+r.x,y:t.y+r.y}})),(0,n.xh)(y)){let e=(0,a.oE)(_.map(e=>this.getShape(e.id))),{reparenting:t}=(0,F.d)(this,e,(e,t)=>{if(f.has(t.id))return!1;let i=this.getShapePageBounds(e),s=this.getShapePageBounds(t);return!!i&&!!s&&s.containsPoint(i.center)});t.forEach((e,t)=>{0!==e.length&&this.reparentShapes(e.map(e=>e.id),t)})}let l=new Set(T.map(e=>e.id)),p=_.map(e=>e.id).filter(e=>{let t=this.getShape(e);return!(!t||(0,n.xh)(t.parentId))&&!this.getSortedChildIdsForParent(e).some(e=>l.has(e))});p.length>0&&(0,F.I)(this,p)}),this}async getSvgElement(e,t={}){let i=0===e.length?this.getCurrentPageShapeIdsSorted():"string"==typeof e[0]?e:e.map(e=>e.id);if(0!==i.length)return await this.fonts.loadRequiredFontsForCurrentPage(this.options.maxFontsToLoadBeforeRender),(0,S.W)(this,i,t)}async getSvgString(e,t={}){let i=await this.getSvgElement(e,t);if(i)return{svg:new XMLSerializer().serializeToString(i.svg),width:i.width,height:i.height,trimPadding:i.trimPadding}}async toImage(e,t={}){let i={format:"png",scale:1,pixelRatio:"svg"===t.format?void 0:2,...t},s=await this.getSvgString(e,i);if(!s)throw Error("Could not create SVG");switch(i.format){case"svg":{let e=s.svg,t=s.width,r=s.height;if(s.trimPadding>0){let n=await (0,f.XN)(e,{width:t,height:r,trimPadding:s.trimPadding,scale:i.scale});n&&(e=n.svg,t=n.width,r=n.height)}return{blob:new Blob([e],{type:"image/svg+xml"}),width:t,height:r}}case"jpeg":case"png":case"webp":{let e=await (0,f.q1)(s.svg,{type:i.format,quality:i.quality,pixelRatio:i.pixelRatio,width:s.width,height:s.height,trimPadding:s.trimPadding,scale:i.scale});if(!e)throw Error("Could not construct image.");return e}default:(0,a.h6)(i.format)}}async toImageDataUrl(e,t={}){let{blob:i,width:s,height:r}=await this.toImage(e,t);return{url:await a.Sm.blobToDataUrl(i),width:s,height:r}}cancel(){return this.dispatch({type:"misc",name:"cancel"}),this}interrupt(){return this.dispatch({type:"misc",name:"interrupt"}),this}complete(){return this.dispatch({type:"misc",name:"complete"}),this}updatePointer(e){let t={type:"pointer",target:"canvas",name:"pointer_move",point:e?.point??b.l.Add(this.inputs.getCurrentScreenPoint(),this.store.unsafeGetWithoutCapture(n.O9).screenBounds),pointerId:e?.pointerId??0,button:e?.button??0,isPen:e?.isPen??this.inputs.getIsPen(),shiftKey:e?.shiftKey??this.inputs.getShiftKey(),altKey:e?.altKey??this.inputs.getAltKey(),ctrlKey:e?.ctrlKey??this.inputs.getCtrlKey(),metaKey:e?.metaKey??this.inputs.getMetaKey(),accelKey:!1};return t.accelKey=e?.accelKey??this.inputs.getAccelKey(),e?.immediate?this._flushEventForTick(t):this.dispatch(t),this}focus({focusContainer:e=!0}={}){return this.getIsFocused()||(e&&this.focusManager.focus(),this.updateInstanceState({isFocused:!0})),this}blur({blurContainer:e=!0}={}){return this.getIsFocused()&&(this.focusManager.blur({blurContainer:e}),this.updateInstanceState({isFocused:!1})),this}getIsFocused(){return this.getInstanceState().isFocused}getIsReadonly(){return this.getInstanceState().isReadonly}getSnapshot(){return(0,g.d)(this.store)}loadSnapshot(e,t){return(0,g.N)(this.store,e,t),this}_zoomToFitPageContentAt100Percent(){let e=this.getCurrentPageBounds();e&&this.zoomToBounds(e,{immediate:!0,targetZoom:this.getBaseZoom()})}_navigateToDeepLink(e){this.run(()=>{switch(e.type){case"page":{let t=this.getPage(e.pageId);t&&this.setCurrentPage(t),this._zoomToFitPageContentAt100Percent();return}case"shapes":{let t=(0,a.oE)(e.shapeIds.map(e=>this.getShape(e))),i={};for(let e of t){let t=this.getAncestorPageId(e);t&&(i[t]??=[],i[t].push(e))}let[s,r]=Object.entries(i).sort(([e,t],[i,s])=>s.length-t.length)[0]??["",[]];if(s&&r.length){this.setCurrentPage(s);let e=P.az.Common(r.map(e=>this.getShapePageBounds(e)));this.zoomToBounds(e,{immediate:!0,targetZoom:this.getBaseZoom()})}else this._zoomToFitPageContentAt100Percent();return}case"viewport":if(e.pageId){if(!this.getPage(e.pageId))return void this._zoomToFitPageContentAt100Percent();this.setCurrentPage(e.pageId)}this.zoomToBounds(e.bounds,{immediate:!0,inset:0});return;default:(0,a.h6)(e)}})}navigateToDeepLink(e){if(e&&"type"in e)return this._navigateToDeepLink(e),this;let t=new URL(e?.url??window.location.href).searchParams.get(e?.param??"d");if(!t)return this._zoomToFitPageContentAt100Percent(),this;try{this._navigateToDeepLink((0,A.H)(t))}catch(e){console.warn(e),this._zoomToFitPageContentAt100Percent()}return this}createDeepLink(e){let t=new URL(e?.url??window.location.href);return t.searchParams.set(e?.param??"d",(0,A.w)(e?.to??{type:"viewport",pageId:1===this.options.maxPages?void 0:this.getCurrentPageId(),bounds:this.getViewportPageBounds()})),t}registerDeepLinkListener(e){if(e?.getUrl&&!e?.onChange)throw Error("[tldraw:urlStateSync] If you specify getUrl, you must also specify the onChange callback.");let t=(0,s.EW)("url with state",()=>{let t=e?.getUrl?.(this)??window.location.href;return this.createDeepLink({param:e?.param,url:t,to:e?.getTarget?.(this)}).toString()}),i=e?.onChange??(()=>{let t=this.createDeepLink({param:e?.param,to:e?.getTarget?.(this)});window.history.replaceState({},this.getContainerDocument().title,t.toString())}),r=(0,a.sg)(e=>e(),e?.debounceMs??500),n=(0,s.wv)("update url on state change",()=>i(new URL(t.get()),this),{scheduleEffect:r});return()=>{n(),r.cancel()}}_clickManager=new D.s(this);cancelDoubleClick(){this._clickManager.cancelDoubleClickTimeout()}_prevCursor="default";_shiftKeyTimeout=-1;_setShiftKeyTimeout(){this.inputs.setShiftKey(!1),this.dispatch({type:"keyboard",name:"key_up",key:"Shift",shiftKey:this.inputs.getShiftKey(),ctrlKey:this.inputs.getCtrlKey(),altKey:this.inputs.getAltKey(),metaKey:this.inputs.getMetaKey(),accelKey:this.inputs.getAccelKey(),code:"ShiftLeft"})}_altKeyTimeout=-1;_setAltKeyTimeout(){this.inputs.setAltKey(!1),this.dispatch({type:"keyboard",name:"key_up",key:"Alt",shiftKey:this.inputs.getShiftKey(),ctrlKey:this.inputs.getCtrlKey(),altKey:this.inputs.getAltKey(),metaKey:this.inputs.getMetaKey(),accelKey:this.inputs.getAccelKey(),code:"AltLeft"})}_ctrlKeyTimeout=-1;_setCtrlKeyTimeout(){this.inputs.setCtrlKey(!1),this.dispatch({type:"keyboard",name:"key_up",key:"Ctrl",shiftKey:this.inputs.getShiftKey(),ctrlKey:this.inputs.getCtrlKey(),altKey:this.inputs.getAltKey(),metaKey:this.inputs.getMetaKey(),accelKey:this.inputs.getAccelKey(),code:"ControlLeft"})}_metaKeyTimeout=-1;_setMetaKeyTimeout(){this.inputs.setMetaKey(!1),this.dispatch({type:"keyboard",name:"key_up",key:"Meta",shiftKey:this.inputs.getShiftKey(),ctrlKey:this.inputs.getCtrlKey(),altKey:this.inputs.getAltKey(),metaKey:this.inputs.getMetaKey(),accelKey:this.inputs.getAccelKey(),code:"MetaLeft"})}_restoreToolId="select";_didPinch=!1;_selectedShapeIdsAtPointerDown=[];_didCaptureSelectionAtPointerDown=!1;_longPressTimeout=-1;capturedPointerId=null;performanceTracker;performanceTrackerTimeout=-1;handledEvents=new WeakSet;markEventAsHandled(e){let t="nativeEvent"in e?e.nativeEvent:e;this.handledEvents.add(t)}wasEventAlreadyHandled(e){let t="nativeEvent"in e?e.nativeEvent:e;return this.handledEvents.has(t)}dispatch(e){return this._pendingEventsForNextTick.push(e),("pointer"!==e.type||"pointer_move"!==e.name)&&"wheel"!==e.type&&"pinch"!==e.type&&this._flushEventsForTick(0),this}_pendingEventsForNextTick=[];_flushEventsForTick(e){this.run(()=>{if(this._pendingEventsForNextTick.length>0){let e=[...this._pendingEventsForNextTick];for(let t of(this._pendingEventsForNextTick.length=0,e))this._flushEventForTick(t)}e>0&&this.root.handleEvent({type:"misc",name:"tick",elapsed:e}),this.scribbles.tick(e)})}_flushEventForTick(e){if(this.getCrashingError())return this;this.emit("before-event",e);let{inputs:t}=this,{type:i}=e;if("misc"===e.type){("cancel"===e.name||"complete"===e.name)&&(this.inputs.setIsDragging(!1),this.inputs.getIsPanning()&&(this.inputs.setIsPanning(!1),this.inputs.setIsSpacebarPanning(!1),this.setCursor({type:this._prevCursor,rotation:0}))),this.root.handleEvent(e),this.emit("event",e);return}e.shiftKey?(clearTimeout(this._shiftKeyTimeout),this._shiftKeyTimeout=-1,t.setShiftKey(!0)):!e.shiftKey&&t.getShiftKey()&&-1===this._shiftKeyTimeout&&(this._shiftKeyTimeout=this.timers.setTimeout(this._setShiftKeyTimeout,150)),e.altKey?(clearTimeout(this._altKeyTimeout),this._altKeyTimeout=-1,t.setAltKey(!0)):!e.altKey&&t.getAltKey()&&-1===this._altKeyTimeout&&(this._altKeyTimeout=this.timers.setTimeout(this._setAltKeyTimeout,150)),e.ctrlKey?(clearTimeout(this._ctrlKeyTimeout),this._ctrlKeyTimeout=-1,t.setCtrlKey(!0)):!e.ctrlKey&&t.getCtrlKey()&&-1===this._ctrlKeyTimeout&&(this._ctrlKeyTimeout=this.timers.setTimeout(this._setCtrlKeyTimeout,150)),e.metaKey&&"key_up"!==e.name?(clearTimeout(this._metaKeyTimeout),this._metaKeyTimeout=-1,t.setMetaKey(!0)):!e.metaKey&&t.getMetaKey()&&-1===this._metaKeyTimeout&&(this._metaKeyTimeout=this.timers.setTimeout(this._setMetaKeyTimeout,150)),t.getIsPointing()||t.setIsDragging(!1);let r=this.store.unsafeGetWithoutCapture(n.O9),a=this.store.get(this._getCurrentPageStateId()),o=this._cameraOptions.__unsafe__getWithoutCapture();switch(i){case"pinch":if(o.isLocked)return;switch(clearTimeout(this._longPressTimeout),this.inputs.updateFromEvent(e),e.name){case"pinch_start":if(t.getIsPinching())return;!t.getIsEditing()&&(this._didCaptureSelectionAtPointerDown||(this._selectedShapeIdsAtPointerDown=[...a.selectedShapeIds]),this._didPinch=!0,t.setIsPinching(!0),this.interrupt(),this._didCaptureSelectionAtPointerDown&&this.setSelectedShapes(this._selectedShapeIdsAtPointerDown)),this.emit("event",e);return;case"pinch":{if(!t.getIsPinching())return;let{point:{z:i=1},delta:{x:n,y:a}}=e,{x:h,y:l}=b.l.SubXY(e.point,r.screenBounds.x,r.screenBounds.y);this.stopCameraAnimation(),r.followingUserId&&this.stopFollowingUser();let{x:p,y:d,z:g}=(0,s.Pm)(()=>this.getCamera()),{panSpeed:u}=o;this._setCamera(new b.l(p+n*u/g-h/g+h/i,d+a*u/g-l/g+l/i,i),{immediate:!0}),this.performance._notifyCameraOperation("zooming"),this.emit("event",e);return}case"pinch_end":{if(!t.getIsPinching())return this;t.setIsPinching(!1);let{_selectedShapeIdsAtPointerDown:i}=this;this.setSelectedShapes(this._selectedShapeIdsAtPointerDown),this._selectedShapeIdsAtPointerDown=[],this._didCaptureSelectionAtPointerDown=!1,this._didPinch&&(this._didPinch=!1,i.length>0&&this.once("tick",()=>{this._didPinch||this.setSelectedShapes(i)})),this.emit("event",e);return}}case"wheel":{if(o.isLocked)return;this.inputs.updateFromEvent(e);let{panSpeed:t,zoomSpeed:i}=o,n=o.wheelBehavior,a=this.user.getUserPreferences().inputMode;if(null!==a&&(n="trackpad"===a?"pan":"zoom"),"none"!==n){this.stopCameraAnimation(),r.followingUserId&&this.stopFollowingUser();let{x:o,y:h,z:l}=(0,s.Pm)(()=>this.getCamera()),{x:p,y:d,z:g=0}=e.delta,u=n;switch(e.ctrlKey&&(u="pan"===n?"zoom":"pan"),u){case"zoom":{let{x:t,y:s}=this.inputs.getCurrentScreenPoint(),r=g;"zoom"===n&&(r=Math.abs(d)>10?10*Math.sign(d)/100:d/100);let p=(this.user.getUserPreferences().isZoomDirectionInverted&&"mouse"===a)??!1,u=r??0,c=l+(p?-u:u)*i*l;this._setCamera(new b.l(o+t/c-t/l,h+s/c-s/l,c),{immediate:!0}),this.maybeTrackPerformance("Zooming"),this.performance._notifyCameraOperation("zooming"),this.root.handleEvent(e),this.emit("event",e);return}case"pan":this._setCamera(new b.l(o+p*t/l,h+d*t/l,l),{immediate:!0}),this.maybeTrackPerformance("Panning"),this.performance._notifyCameraOperation("panning"),this.root.handleEvent(e),this.emit("event",e);return}}break}case"pointer":{if(t.getIsPinching())return;this.inputs.updateFromEvent(e);let{isPen:i}=e,{isPenMode:n}=r;switch(e.name){case"pointer_down":if(n&&!i)return;if(this.inputs.getIsPanning()||(this._longPressTimeout=this.timers.setTimeout(()=>{let t=this.getViewportScreenBounds();this.dispatch({...e,point:this.inputs.getOriginScreenPoint().clone().addXY(t.x,t.y),name:"long_press"})},this.options.longPressDurationMs)),this._didCaptureSelectionAtPointerDown||(this._selectedShapeIdsAtPointerDown=this.getSelectedShapeIds(),this._didCaptureSelectionAtPointerDown=!0),e.button===u.bH&&(this.capturedPointerId=e.pointerId),t.buttons.add(e.button),t.setIsPointing(!0),t.setIsDragging(!1),!n&&e.isPenDirect&&(this.updateInstanceState({isPenMode:!0}),this.interrupt()),e.button===u.Tf)this._restoreToolId=this.getCurrentToolId(),this.complete(),this.setCurrentTool("eraser");else if(e.button===u.R_)this.inputs.getIsPanning()||(this._prevCursor=this.getInstanceState().cursor.type),this.inputs.setIsPanning(!0),clearTimeout(this._longPressTimeout);else if(e.button===u.EI&&this.options.rightClickPanning)return this.inputs.setIsRightPointing(!0),clearTimeout(this._longPressTimeout),this;if(this.inputs.getIsPanning())return this.stopCameraAnimation(),this.setCursor({type:"grabbing",rotation:0}),this;break;case"pointer_move":{if(!i&&n)return;let{x:e,y:a,z:o}=(0,s.Pm)(()=>this.getCamera());if(this.inputs.getIsRightPointing()&&!this.inputs.getIsPanning()){let t=this.inputs.getCurrentScreenPoint(),i=this.inputs.getOriginScreenPoint();if(b.l.Dist2(i,t)>this.options.dragDistanceSquared){this._prevCursor=this.getInstanceState().cursor.type,this.inputs.setIsPanning(!0),this.setCursor({type:"grabbing",rotation:0}),this.stopCameraAnimation();let s=b.l.Sub(t,i);this.setCamera(new b.l(e+s.x/o,a+s.y/o,o),{immediate:!0}),this.maybeTrackPerformance("Panning")}return}if(this.inputs.getIsPanning()&&this.inputs.getIsPointing()){let t=this.inputs.getCurrentScreenPoint(),i=this.inputs.getPreviousScreenPoint(),s=b.l.Sub(t,i);this.setCamera(new b.l(e+s.x/o,a+s.y/o,o),{immediate:!0}),this.maybeTrackPerformance("Panning"),this.performance._notifyCameraOperation("panning");return}t.getIsPointing()&&!t.getIsDragging()&&b.l.Dist2(t.getOriginPagePoint(),t.getCurrentPagePoint())*this.getZoomLevel()>(r.isCoarsePointer?this.options.coarseDragDistanceSquared:this.options.dragDistanceSquared)/o&&(t.setIsDragging(!0),clearTimeout(this._longPressTimeout));break}case"pointer_up":if(t.setIsDragging(!1),t.setIsPointing(!1),clearTimeout(this._longPressTimeout),t.buttons.delete(e.button),r.isPenMode&&!i)return;if(this.inputs.getIsRightPointing()&&!this.inputs.getIsPanning()){this.inputs.setIsRightPointing(!1),this._selectedShapeIdsAtPointerDown=[],this._didCaptureSelectionAtPointerDown=!1;break}if(this.inputs.setIsRightPointing(!1),this.capturedPointerId===e.pointerId&&(this.capturedPointerId=null,e.button=0),t.getIsPanning()){t.keys.has("Space")||(t.setIsPanning(!1),t.setIsSpacebarPanning(!1));let i=this.inputs.getPointerVelocity(),s=Math.min(2,i.len());switch(e.button){case u.bH:this.setCursor({type:"grab",rotation:0});break;case u.R_:this.inputs.keys.has("Space")?this.setCursor({type:"grab",rotation:0}):this.setCursor({type:this._prevCursor,rotation:0});break;case u.EI:return this.inputs.keys.has("Space")?this.setCursor({type:"grab",rotation:0}):this.setCursor({type:this._prevCursor,rotation:0}),s>0&&this.slideCamera({speed:s,direction:{x:i.x,y:i.y,z:0}}),this._selectedShapeIdsAtPointerDown=[],this._didCaptureSelectionAtPointerDown=!1,this}s>0&&this.slideCamera({speed:s,direction:{x:i.x,y:i.y,z:0}})}else e.button===u.Tf&&(this.complete(),this.setCurrentTool(this._restoreToolId));this._selectedShapeIdsAtPointerDown=[],this._didCaptureSelectionAtPointerDown=!1}break}case"keyboard":switch("ShiftRight"===e.key&&(e.key="ShiftLeft"),"AltRight"===e.key&&(e.key="AltLeft"),"ControlRight"===e.code&&(e.code="ControlLeft"),"MetaRight"===e.code&&(e.code="MetaLeft"),e.name){case"key_down":if(t.keys.add(e.code),this.options.spacebarPanning&&("Space"!==e.code||e.ctrlKey||(this.inputs.getIsPanning()||(this._prevCursor=r.cursor.type),this.inputs.setIsPanning(!0),this.inputs.setIsSpacebarPanning(!0),clearTimeout(this._longPressTimeout),this.setCursor({type:this.inputs.getIsPointing()?"grabbing":"grab",rotation:0})),this.inputs.getIsSpacebarPanning())){let t;switch(e.code){case"ArrowUp":t=new b.l(0,-1);break;case"ArrowRight":t=new b.l(1,0);break;case"ArrowDown":t=new b.l(0,1);break;case"ArrowLeft":t=new b.l(-1,0)}if(t){let e=this.getViewportPageBounds(),i=e.clone().translate(t.mulV({x:e.w,y:e.h}));this._animateToViewport(i,{animation:{duration:320}})}}break;case"key_up":t.keys.delete(e.code),this.options.spacebarPanning&&"Space"===e.code&&(this.inputs.buttons.has(u.R_)||(this.inputs.setIsPanning(!1),this.inputs.setIsSpacebarPanning(!1),this.setCursor({type:this._prevCursor,rotation:0})))}}if("pointer"===e.type){e.button===u.R_?e.name="middle_click":e.button===u.EI&&(e.name="right_click"),"right_click"===e.name&&"select"!==this.getCurrentToolId()&&this.getStateDescendant("select")&&this.setCurrentTool("select");let{isPenMode:t}=this.store.unsafeGetWithoutCapture(n.O9);if(e.isPen===t){let t=this._clickManager.handlePointerEvent(e);if(e.name!==t.name){this.root.handleEvent(e),this.emit("event",e),this.root.handleEvent(t),this.emit("event",t);return}}}return this.root.handleEvent(e),this.emit("event",e),"pointer"===e.type&&"pointer_down"===e.name&&this.menus.clearOpenMenus(),this}maybeTrackPerformance(e){k.bG.measurePerformance.get()&&(this.performanceTracker.isStarted()?clearTimeout(this.performanceTrackerTimeout):this.performanceTracker.start(e),this.performanceTrackerTimeout=this.timers.setTimeout(()=>{this.performanceTracker.stop()},50))}}function eo(e,t=e.getCurrentPageId()){let i=e.getPage(t).name;e.emit("max-shapes",{name:i,pageId:t,count:e.options.maxShapesPerPage})}function eh(e,t){if(!t)return e;let i=null,s=Object.entries(t);for(let t=0,r=s.length;t<r;t++){let[r,n]=s[t];if(void 0!==n&&"id"!==r&&"type"!==r&&"typeName"!==r&&n!==e[r]){if(i||(i={...e}),"props"===r||"meta"===r){for(let[t,s]of(i[r]={...e[r]},Object.entries(n)))i[r][t]=s;continue}i[r]=n}}return i||e}function el(e,t,i){let s;if(e.run(()=>{let n=e.store.extractingChanges(()=>{let r=new Set,n=new Set;for(let i of t)if(e.getShape(i))for(let s of e.getBindingsInvolvingShape(i)){let e=t.has(s.fromId),i=t.has(s.toId);if(e&&i){r.add(s.id);continue}e&&i||n.add(s.id)}e.deleteBindings([...n],{isolateShapes:!0});try{s=a.Q7.ok(i(r))}catch(e){s=a.Q7.err(e)}});e.store.applyDiff((0,r.E8)(n),{runCallbacks:!1})},{history:"ignore"}),s.ok)return s.value;throw s.error}function ep(e,t){if(!t.constraints)throw Error("Should have constraints here");let{padding:{x:i,y:s}}=t.constraints,r=e.getViewportScreenBounds(),n=P.az.From(t.constraints.bounds);return{zx:(r.w-2*i)/n.w,zy:(r.h-2*s)/n.h}}en([s.EW],ea.prototype,"getIsShapeHiddenCache",1),en([s.EW],ea.prototype,"getIsMounted",1),en([s.EW],ea.prototype,"canUndo",1),en([s.EW],ea.prototype,"canRedo",1),en([s.EW],ea.prototype,"getPath",1),en([s.EW],ea.prototype,"getCurrentTool",1),en([s.EW],ea.prototype,"getCurrentToolId",1),en([s.EW],ea.prototype,"getDocumentSettings",1),en([s.EW],ea.prototype,"getInstanceState",1),en([s.EW],ea.prototype,"getPageStates",1),en([s.EW],ea.prototype,"_getPageStatesQuery",1),en([s.EW],ea.prototype,"getCurrentPageState",1),en([s.EW],ea.prototype,"_getCurrentPageStateId",1),en([s.EW],ea.prototype,"getSelectedShapeIds",1),en([s.EW],ea.prototype,"getSelectedShapes",1),en([s.EW],ea.prototype,"getCurrentPageShapesInReadingOrder",1),en([s.EW],ea.prototype,"getOnlySelectedShapeId",1),en([s.EW],ea.prototype,"getOnlySelectedShape",1),en([s.EW],ea.prototype,"getSelectionPageBounds",1),en([s.EW],ea.prototype,"getSelectionRotation",1),en([s.EW],ea.prototype,"getSelectionRotatedPageBounds",1),en([s.EW],ea.prototype,"getSelectionRotatedScreenBounds",1),en([s.EW],ea.prototype,"getFocusedGroupId",1),en([s.EW],ea.prototype,"getFocusedGroup",1),en([s.EW],ea.prototype,"getEditingShapeId",1),en([s.EW],ea.prototype,"getEditingShape",1),en([s.EW],ea.prototype,"getRichTextEditor",1),en([s.EW],ea.prototype,"getHoveredShapeId",1),en([s.EW],ea.prototype,"getHoveredShape",1),en([s.EW],ea.prototype,"getHintingShapeIds",1),en([s.EW],ea.prototype,"getHintingShape",1),en([s.EW],ea.prototype,"getErasingShapeIds",1),en([s.EW],ea.prototype,"getErasingShapes",1),en([s.EW],ea.prototype,"_unsafe_getCameraId",1),en([s.EW],ea.prototype,"getCamera",1),en([s.EW],ea.prototype,"getViewportPageBoundsForFollowing",1),en([s.EW],ea.prototype,"getCameraForFollowing",1),en([s.EW],ea.prototype,"getZoomLevel",1),en([s.EW],ea.prototype,"getResizeScaleFactor",1),en([s.EW],ea.prototype,"getDebouncedZoomLevel",1),en([s.EW],ea.prototype,"_getAboveDebouncedZoomThreshold",1),en([s.EW],ea.prototype,"getEfficientZoomLevel",1),en([s.EW],ea.prototype,"getViewportScreenBounds",1),en([s.EW],ea.prototype,"getViewportScreenCenter",1),en([s.EW],ea.prototype,"getViewportPageBounds",1),en([s.EW],ea.prototype,"getRenderingShapes",1),en([s.EW],ea.prototype,"_getAllPagesQuery",1),en([s.EW],ea.prototype,"getPages",1),en([s.EW],ea.prototype,"getCurrentPageId",1),en([s.EW],ea.prototype,"getCurrentPageShapeIdsSorted",1),en([s.EW],ea.prototype,"_getAllAssetsQuery",1),en([s.EW],ea.prototype,"_getShapeHandlesCache",1),en([s.EW],ea.prototype,"_getShapePageTransformCache",1),en([s.EW],ea.prototype,"_getShapePageBoundsCache",1),en([s.EW],ea.prototype,"_getShapeClipPathCache",1),en([s.EW],ea.prototype,"_getShapeMaskCache",1),en([s.EW],ea.prototype,"_getShapeMaskedPageBoundsCache",1),en([s.EW],ea.prototype,"getNotVisibleShapes",1),en([s.EW],ea.prototype,"getCulledShapes",1),en([s.EW],ea.prototype,"getCurrentPageBounds",1),en([s.EW],ea.prototype,"getHitTestMargin",1),en([s.EW],ea.prototype,"getCurrentPageShapes",1),en([s.EW],ea.prototype,"getCurrentPageShapesSorted",1),en([s.EW],ea.prototype,"getCurrentPageRenderingShapesSorted",1),en([s.EW],ea.prototype,"_getBindingsIndexCache",1),en([s.EW],ea.prototype,"_getSelectionSharedStyles",1),en([(0,s.EW)({isEqual:(e,t)=>e.equals(t)})],ea.prototype,"getSharedStyles",1),en([s.EW],ea.prototype,"getSharedOpacity",1),en([s.EW],ea.prototype,"getIsFocused",1),en([s.EW],ea.prototype,"getIsReadonly",1),en([a.oI],ea.prototype,"_setShiftKeyTimeout",1),en([a.oI],ea.prototype,"_setAltKeyTimeout",1),en([a.oI],ea.prototype,"_setCtrlKeyTimeout",1),en([a.oI],ea.prototype,"_setMetaKeyTimeout",1)}}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[90,356,552,658,683,782,827,976,1004,1097,1337,1541,1651,1960,2053,2138,2453,2504,2614,2639,2835,2837,3379,3432,3507,3851,3933,3943,3955,4016,4037,4387,4515,4524,4896,5221,5843,5907,6202,6252,6450,6456,6541,6709,6819,6831,6849,6919,6988,7067,7483,7769,7812,7851,8167,8197,8278,8429,8499,8548,8658,8743,8933,9044,9156,9183,9742,9747,9787,9822,9968],{84441:()=>{}},_=>{_.O(0,[8441,3794,7358],()=>_(_.s=84441)),_N_E=_.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[90,356,552,658,683,782,827,976,1004,1097,1337,1541,1651,1960,2053,2138,2453,2504,2614,2639,2835,2837,3379,3432,3507,3851,3933,3943,3955,4016,4037,4387,4515,4524,4896,5221,5843,5907,6202,6252,6450,6456,6541,6709,6819,6831,6849,6919,6988,7067,7483,7769,7812,7851,8167,8197,8278,8429,8499,8548,8658,8743,8933,9044,9156,9183,9742,9747,9787,9822,9968],{84441:()=>{}},_=>{_.O(0,[8441,3794,7358],()=>_(_.s=84441)),_N_E=_.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[90,356,552,658,683,782,827,976,1004,1097,1337,1541,1651,1960,2053,2138,2453,2504,2614,2639,2835,2837,3379,3432,3507,3851,3933,3943,3955,4016,4037,4387,4515,4524,4896,5221,5843,5907,6202,6252,6450,6456,6541,6709,6819,6831,6849,6919,6988,7067,7483,7769,7812,7851,8167,8197,8278,8429,8499,8548,8658,8743,8933,9044,9156,9183,9742,9747,9787,9822,9968],{84441:()=>{}},_=>{_.O(0,[8441,3794,7358],()=>_(_.s=84441)),_N_E=_.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[90,356,552,658,683,782,827,976,1004,1097,1337,1541,1651,1960,2053,2138,2453,2504,2614,2639,2835,2837,3379,3432,3507,3851,3933,3943,3955,4016,4037,4387,4515,4524,4896,5221,5843,5907,6202,6252,6450,6456,6541,6709,6819,6831,6849,6919,6988,7067,7483,7769,7812,7851,8167,8197,8278,8429,8499,8548,8658,8743,8933,9044,9156,9183,9742,9747,9787,9822,9968],{84441:()=>{}},_=>{_.O(0,[8441,3794,7358],()=>_(_.s=84441)),_N_E=_.O()}]);
@@ -1 +0,0 @@
1
- (()=>{"use strict";var e,t,a,r,c,d,f,o,n,b={},i={};function l(e){var t=i[e];if(void 0!==t)return t.exports;var a=i[e]={id:e,loaded:!1,exports:{}},r=!0;try{b[e].call(a.exports,a,a.exports,l),r=!1}finally{r&&delete i[e]}return a.loaded=!0,a.exports}l.m=b,e=[],l.O=(t,a,r,c)=>{if(a){c=c||0;for(var d=e.length;d>0&&e[d-1][2]>c;d--)e[d]=e[d-1];e[d]=[a,r,c];return}for(var f=1/0,d=0;d<e.length;d++){for(var[a,r,c]=e[d],o=!0,n=0;n<a.length;n++)(!1&c||f>=c)&&Object.keys(l.O).every(e=>l.O[e](a[n]))?a.splice(n--,1):(o=!1,c<f&&(f=c));if(o){e.splice(d--,1);var b=r();void 0!==b&&(t=b)}}return t},l.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return l.d(t,{a:t}),t},a=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,l.t=function(e,r){if(1&r&&(e=this(e)),8&r||"object"==typeof e&&e&&(4&r&&e.__esModule||16&r&&"function"==typeof e.then))return e;var c=Object.create(null);l.r(c);var d={};t=t||[null,a({}),a([]),a(a)];for(var f=2&r&&e;"object"==typeof f&&!~t.indexOf(f);f=a(f))Object.getOwnPropertyNames(f).forEach(t=>d[t]=()=>e[t]);return d.default=()=>e,l.d(c,d),c},l.d=(e,t)=>{for(var a in t)l.o(t,a)&&!l.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},l.f={},l.e=e=>Promise.all(Object.keys(l.f).reduce((t,a)=>(l.f[a](e,t),t),[])),l.u=e=>"static/chunks/"+(({277:"54a60aa6",988:"993e5495",1048:"db9d41be",3051:"e3e7ddb2",3888:"e868780c",5004:"70e0d97a",8133:"1ba63609",8747:"90542734",8924:"da12927c",9425:"bf2ff291"})[e]||e)+"."+({103:"23142a67b02246a8",268:"72794ee2773c2060",277:"0e43cde7298ebcb7",333:"bf0651c789b2eb33",370:"8e8f3cf8eb0e29dd",398:"ffa02af9062a3950",869:"7152372b662e31af",918:"6a9bbe564e4a2d0f",934:"9006461bd0548660",973:"88e865b52eff479a",988:"8797001fcfcf2889",1032:"12b382a9096ab2a4",1048:"e72ce090a86a3691",1063:"775c442bdbeef08b",1327:"09252bb80616cc3a",1708:"d029f8776e4578de",1781:"866132cea8e77cd0",2081:"47b6e9391094055f",2181:"ba21239d3ac39f81",2258:"4defa30121ef44a5",2325:"23caf22075e51aa5",2356:"523277bb8c6bf72a",2418:"b5d9e177e10a686e",2480:"cf27ca02e5b19761",2539:"c5a4f2fd8e421c70",2619:"9431a3f48da8eef4",2695:"6f49435bae1e6f33",2703:"495a65ed14b2f094",2821:"934bcf60fbdc28c6",3051:"a35db430b3564999",3251:"0dce7a0a0ff67235",3266:"a491c09b3f6b57e6",3308:"857c554428b3294e",3336:"a76f9485fe7cb762",3716:"72bf4c9d7325debd",3888:"1584512c612787d7",3995:"eca0f5bef1fc3ae5",4004:"74b9bcf5478b1663",4202:"8440832386f023c7",4238:"6f102dcbcf2ae339",4405:"7a19458960a1058e",4424:"fd0c93a807a333e1",4866:"d1060b4faf2ae1e2",4970:"8a63b4953b0e4946",5004:"337966195abe6fe0",5020:"9ac8d0dc8390bb6e",5137:"f163e94c74a94d01",5242:"7b643c6b3394cac1",5315:"dba7515ae6e139ae",5361:"afc00ab2626bacbf",5521:"cfdf2cfc6db31407",5526:"ff46471041fdcb79",5681:"dd0e66b0de16e54b",6121:"eb9023b1cbc78ee2",6161:"4836cd7d031026bf",6195:"1153369f5f8b13a2",6294:"24f510c0c3e3714c",6654:"16f727522ec47f5a",6794:"f746d8fbbf248ecf",7256:"e07cf52d87d40252",7268:"7bf6d531e3905a52",7331:"2add3c4e125a2dba",7543:"89f7b805ed0f2901",7999:"879d5a20e8641752",8133:"b2ae90f43319a29e",8200:"a36b9f8c983c6b9e",8747:"ae439f2382f58c51",8863:"fa0320ea586efb3b",8885:"cf60cac98bf8b70c",8901:"e117d206a917bda0",8924:"476aa688a637649c",9425:"3a109dffc1fe84af",9522:"c7c6e9c330f9ba6b",9614:"3221013d7f0af27f",9698:"4d09a99b9d99f3e5",9705:"40a82b97f214e28b",9764:"2669775c6e107a01",9793:"4567af813117ad25",9974:"9a0f79beca65e8c4"})[e]+".js",l.miniCssF=e=>"static/css/"+({1838:"659eccb5db697b76",6009:"80c818c5781fbadc"})[e]+".css",l.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),l.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r={},l.l=(e,t,a,c)=>{if(r[e])return void r[e].push(t);if(void 0!==a)for(var d,f,o=document.getElementsByTagName("script"),n=0;n<o.length;n++){var b=o[n];if(b.getAttribute("src")==e||b.getAttribute("data-webpack")=="_N_E:"+a){d=b;break}}d||(f=!0,(d=document.createElement("script")).charset="utf-8",d.timeout=120,l.nc&&d.setAttribute("nonce",l.nc),d.setAttribute("data-webpack","_N_E:"+a),d.src=l.tu(e)),r[e]=[t];var i=(t,a)=>{d.onerror=d.onload=null,clearTimeout(u);var c=r[e];if(delete r[e],d.parentNode&&d.parentNode.removeChild(d),c&&c.forEach(e=>e(a)),t)return t(a)},u=setTimeout(i.bind(null,void 0,{type:"timeout",target:d}),12e4);d.onerror=i.bind(null,d.onerror),d.onload=i.bind(null,d.onload),f&&document.head.appendChild(d)},l.r=e=>{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},l.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),l.tt=()=>(void 0===c&&(c={createScriptURL:e=>e},"u">typeof trustedTypes&&trustedTypes.createPolicy&&(c=trustedTypes.createPolicy("nextjs#bundler",c))),c),l.tu=e=>l.tt().createScriptURL(e),l.p="/_next/",d={8068:0},l.f.miniCss=(e,t)=>{if(d[e])t.push(d[e]);else 0!==d[e]&&({1838:1,6009:1})[e]&&t.push(d[e]=new Promise((t,a)=>{var r=l.miniCssF(e),c=l.p+r;if(((e,t)=>{for(var a=document.getElementsByTagName("link"),r=0;r<a.length;r++){var c=a[r],d=c.getAttribute("data-href")||c.getAttribute("href");if("stylesheet"===c.rel&&(d===e||d===t))return c}for(var f=document.getElementsByTagName("style"),r=0;r<f.length;r++){var c=f[r],d=c.getAttribute("data-href");if(d===e||d===t)return c}})(r,c))return t();((e,t,a,r)=>{var c=document.createElement("link");c.rel="stylesheet",c.type="text/css",c.onerror=c.onload=d=>{if(c.onerror=c.onload=null,"load"===d.type)a();else{var f=d&&("load"===d.type?"missing":d.type),o=d&&d.target&&d.target.href||t,n=Error("Loading CSS chunk "+e+" failed.\n("+o+")");n.code="CSS_CHUNK_LOAD_FAILED",n.type=f,n.request=o,c.parentNode.removeChild(c),r(n)}},c.href=t;if("function"==typeof _N_E_STYLE_LOAD){var d=c.href,f=c.onload,o=c.onerror;_N_E_STYLE_LOAD(0===d.indexOf(window.location.origin)?new URL(d).pathname:d).then(function(){f&&f.call(c,{type:"load"})},function(){o&&o.call(c,{})})}else document.head.appendChild(c)})(e,c,t,a)}).then(()=>{d[e]=0},t=>{throw delete d[e],t}))},f={8068:0,7389:0,7513:0,3578:0},l.f.j=(e,t)=>{var a=l.o(f,e)?f[e]:void 0;if(0!==a)if(a)t.push(a[2]);else if(/^((183|357|806)8|6009|7389|7513)$/.test(e))f[e]=0;else{var r=new Promise((t,r)=>a=f[e]=[t,r]);t.push(a[2]=r);var c=l.p+l.u(e),d=Error();l.l(c,t=>{if(l.o(f,e)&&(0!==(a=f[e])&&(f[e]=void 0),a)){var r=t&&("load"===t.type?"missing":t.type),c=t&&t.target&&t.target.src;d.message="Loading chunk "+e+" failed.\n("+r+": "+c+")",d.name="ChunkLoadError",d.type=r,d.request=c,a[1](d)}},"chunk-"+e,e)}},l.O.j=e=>0===f[e],o=(e,t)=>{var a,r,[c,d,o]=t,n=0;if(c.some(e=>0!==f[e])){for(a in d)l.o(d,a)&&(l.m[a]=d[a]);if(o)var b=o(l)}for(e&&e(t);n<c.length;n++)r=c[n],l.o(f,r)&&f[r]&&f[r][0](),f[r]=0;return l.O(b)},(n=self.webpackChunk_N_E=self.webpackChunk_N_E||[]).forEach(o.bind(null,0)),n.push=o.bind(null,n.push.bind(n)),l.nc=void 0})();
@@ -1 +0,0 @@
1
- /*! tailwindcss v4.2.2 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,::backdrop,:after,:before{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-border-style:solid;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-ease:initial}}}@layer theme{:host,:root{--font-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--color-red-400:oklch(70.4% .191 22.216);--spacing:.25rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--ease-in:cubic-bezier(.4,0,1,1);--ease-out:cubic-bezier(0,0,.2,1);--ease-in-out:cubic-bezier(.4,0,.2,1);--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono);--color-text-muted:var(--text-muted)}}@layer base{*,::backdrop,:after,:before{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}:host,html{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}menu,ol,ul{list-style:none}audio,canvas,embed,iframe,img,object,svg,video{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,optgroup,select,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit,::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-millisecond-field,::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.\@container{container-type:inline-size}.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.visible{visibility:visible}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{inset:calc(var(--spacing) * 0)}.start{inset-inline-start:var(--spacing)}.end{inset-inline-end:var(--spacing)}.z-50{z-index:50}.container{width:100%}@media (min-width:40rem){.container{max-width:40rem}}@media (min-width:48rem){.container{max-width:48rem}}@media (min-width:64rem){.container{max-width:64rem}}@media (min-width:80rem){.container{max-width:80rem}}@media (min-width:96rem){.container{max-width:96rem}}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.mb-\[4px\]{margin-bottom:4px}.block{display:block}.contents{display:contents}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.table{display:table}.h-\[720px\]{height:720px}.h-full{height:100%}.w-\[720px\]{width:720px}.w-full{width:100%}.max-w-\[820px\]{max-width:820px}.min-w-0{min-width:calc(var(--spacing) * 0)}.flex-1{flex:1}.grow{flex-grow:1}.border-collapse{border-collapse:collapse}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.animate-\[drop-ripple_2\.4s_ease-out_infinite_backwards\]{animation:drop-ripple 2.4s ease-out infinite backwards}.animate-\[drop-zone-in_0\.15s_ease_both\]{animation:drop-zone-in .15s both}.resize{resize:both}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-center{justify-content:center}.overflow-hidden{overflow:hidden}.overflow-visible{overflow:visible}.overflow-x-hidden{overflow-x:hidden}.overflow-y-auto{overflow-y:auto}.rounded-full{border-radius:3.40282e+38px}.border{border-style:var(--tw-border-style);border-width:1px}.border-\[1\.5px\]{border-style:var(--tw-border-style);border-width:1.5px}.border-solid{--tw-border-style:solid;border-style:solid}.border-\[rgba\(37\,99\,235\,0\.5\)\]{border-color:#2563eb80}.bg-\[rgba\(37\,99\,235\,0\.06\)\]{background-color:#2563eb0f}.px-4{padding-inline:calc(var(--spacing) * 4)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-8{padding-block:calc(var(--spacing) * 8)}.pt-4{padding-top:calc(var(--spacing) * 4)}.pb-\[4px\]{padding-bottom:4px}.text-center{text-align:center}.font-mono{font-family:var(--font-mono)}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.break-all{word-break:break-all}.text-red-400{color:var(--color-red-400)}.text-text-muted{color:var(--color-text-muted)}.capitalize{text-transform:capitalize}.uppercase{text-transform:uppercase}.italic{font-style:italic}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.line-through{text-decoration-line:line-through}.underline{text-decoration-line:underline}.ring{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.blur{--tw-blur:blur(8px)}.blur,.drop-shadow-\[0_6px_18px_rgba\(37\,99\,235\,0\.18\)\]{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.drop-shadow-\[0_6px_18px_rgba\(37\,99\,235\,0\.18\)\]{--tw-drop-shadow-size:drop-shadow(0 6px 18px var(--tw-drop-shadow-color,#2563eb2e));--tw-drop-shadow:var(--tw-drop-shadow-size)}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.backdrop-blur-\[1px\]{--tw-backdrop-blur:blur(1px)}.backdrop-blur-\[1px\],.backdrop-filter{-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.ease-in{--tw-ease:var(--ease-in);transition-timing-function:var(--ease-in)}.ease-in-out{--tw-ease:var(--ease-in-out);transition-timing-function:var(--ease-in-out)}.ease-out{--tw-ease:var(--ease-out);transition-timing-function:var(--ease-out)}.\[migrate\:debug\]{migrate:debug}.\[scrollbar-width\:none\]{scrollbar-width:none}.\[sync\:room\]{sync:room}.\[tool\:read\]{tool:read}}:root{--bg:#fff;--bg-panel:#f5f5f5;--bg-hover:#eee;--bg-selected:#e8e8e8;--border:var(--text)}@supports (color:color-mix(in lab,red,red)){:root{--border:color-mix(in srgb,var(--text) 20%,transparent)}}:root{--text:#0f172a;--text-muted:#3f4c5f;--text-dim:#8b95a3;--text-meta:#1e293beb;--msg-tool-text:#000}@supports (color:color-mix(in lab,red,red)){:root{--msg-tool-text:color-mix(in srgb,#000 85%,var(--text-muted))}}:root{--accent:#3184f8;--accent-hover:#1d4ed8;--user-bg:#eff6ff;--assistant-bg:#fff;--tool-bg:#f9fafb;--bg-subtle:#0000000a;--side-hover:var(--text)}@supports (color:color-mix(in lab,red,red)){:root{--side-hover:color-mix(in srgb,var(--text) 6%,transparent)}}:root{--side-active:var(--text)}@supports (color:color-mix(in lab,red,red)){:root{--side-active:color-mix(in srgb,var(--text) 10%,transparent)}}:root{--side-selected:var(--accent)}@supports (color:color-mix(in lab,red,red)){:root{--side-selected:color-mix(in srgb,var(--accent) 12%,transparent)}}:root{--side-input:var(--glass-bg-strong)}@supports (color:color-mix(in lab,red,red)){:root{--side-input:color-mix(in srgb,var(--glass-bg-strong) 60%,transparent)}}:root{--frame-glass:#ffffffc2;--side-panel:var(--frame-glass);--popover-glass:#ffffffdb;--app-bg-scrim:#0000000d;--glass-bg:#fafafba6;--glass-bg-strong:#ffffffc7;--glass-bg-input:#fafafb85;--panel-glass:#fafafbe0;--panel-glass-todo:#fafafbbf;--panel-glass-minimap:#fafafbbf;--timeline-rail:linear-gradient(to bottom,transparent,var(--text) 8%,var(--text) 92%,transparent)}@supports (color:color-mix(in lab,red,red)){:root{--timeline-rail:linear-gradient(to bottom,transparent,color-mix(in srgb,var(--text) 22%,transparent) 8%,color-mix(in srgb,var(--text) 22%,transparent) 92%,transparent)}}:root{--timeline-dot-bg:var(--text)}@supports (color:color-mix(in lab,red,red)){:root{--timeline-dot-bg:color-mix(in srgb,var(--text) 16%,transparent)}}:root{--timeline-dot-border:var(--text)}@supports (color:color-mix(in lab,red,red)){:root{--timeline-dot-border:color-mix(in srgb,var(--text) 30%,transparent)}}:root{--timeline-dot-active-bg:var(--accent)}@supports (color:color-mix(in lab,red,red)){:root{--timeline-dot-active-bg:color-mix(in srgb,var(--accent) 55%,transparent)}}:root{--timeline-dot-active-border:var(--accent)}@supports (color:color-mix(in lab,red,red)){:root{--timeline-dot-active-border:color-mix(in srgb,var(--accent) 85%,transparent)}}:root{--timeline-dot-active-glow:0 0 0 3px var(--accent)}@supports (color:color-mix(in lab,red,red)){:root{--timeline-dot-active-glow:0 0 0 3px color-mix(in srgb,var(--accent) 16%,transparent)}}:root{--file-panel:var(--side-panel);--file-panel-chrome:var(--text)}@supports (color:color-mix(in lab,red,red)){:root{--file-panel-chrome:color-mix(in srgb,var(--text) 5%,transparent)}}:root{--file-panel-gutter:var(--text)}@supports (color:color-mix(in lab,red,red)){:root{--file-panel-gutter:color-mix(in srgb,var(--text) 3%,transparent)}}:root{--file-panel-paper:var(--bg)}@supports (color:color-mix(in lab,red,red)){:root{--file-panel-paper:color-mix(in srgb,var(--bg) 60%,transparent)}}:root{--board-card-glass:rgba(250,250,251,var(--bubble-alpha));--board-blur:12px;--board-scrim-alpha:0;--board-scrim-bg:rgba(0,0,0,var(--board-scrim-alpha));--board-scrim-blur:2px;--glass-blur:8px;--glass-blur-heavy:12px;--glass-blur-panel:10px;--glass-blur-popover:10px;--steer-active:#f97316;--follow-active:#8b5cf6;--user-bg-rgb:219,234,254;--assistant-bg-rgb:252,252,253;--tool-bg-rgb:248,248,250;--bubble-alpha:.44;--user-bg-glass:rgba(var(--user-bg-rgb),var(--bubble-alpha));--user-border-glass:#3b82f638;--assistant-card-glass:rgba(var(--assistant-bg-rgb),var(--bubble-alpha));--tool-bg-glass:rgba(var(--tool-bg-rgb),var(--bubble-alpha));--glass-blur-bubble:8px;--bubble-pad-x:14px;--bubble-pad-y:7px;--bubble-pad-end:8px;--bubble-gap:8px;--bubble-radius:12px;--bubble-inner-radius:7px;--bubble-meta-fs:11px;--bubble-title-fs:12px;--bubble-border:var(--border)}@supports (color:color-mix(in lab,red,red)){:root{--bubble-border:color-mix(in srgb,var(--border) 60%,transparent)}}:root{--bubble-hairline:var(--border)}@supports (color:color-mix(in lab,red,red)){:root{--bubble-hairline:color-mix(in srgb,var(--border) 55%,transparent)}}:root{--bubble-tool-bg:var(--tool-bg-glass)}@supports (color:color-mix(in lab,red,red)){:root{--bubble-tool-bg:color-mix(in srgb,var(--tool-bg-glass) 58%,transparent)}}:root{--bubble-tool-bg-hover:var(--tool-bg-glass)}@supports (color:color-mix(in lab,red,red)){:root{--bubble-tool-bg-hover:color-mix(in srgb,var(--tool-bg-glass) 80%,transparent)}}:root{--bubble-tool-bg-fold:var(--tool-bg-glass)}@supports (color:color-mix(in lab,red,red)){:root{--bubble-tool-bg-fold:color-mix(in srgb,var(--tool-bg-glass) 28%,transparent)}}:root{--bubble-code-bg:var(--tool-bg-glass)}@supports (color:color-mix(in lab,red,red)){:root{--bubble-code-bg:color-mix(in srgb,var(--tool-bg-glass) 58%,transparent)}}:root{--bubble-th-bg:var(--tool-bg-glass)}@supports (color:color-mix(in lab,red,red)){:root{--bubble-th-bg:color-mix(in srgb,var(--tool-bg-glass) 45%,transparent)}}:root{--bubble-file-bg:var(--bg)}@supports (color:color-mix(in lab,red,red)){:root{--bubble-file-bg:color-mix(in srgb,var(--bg) 98%,var(--bg-panel))}}:root{--bubble-file-chrome:var(--bg)}@supports (color:color-mix(in lab,red,red)){:root{--bubble-file-chrome:color-mix(in srgb,var(--bg) 93%,var(--bg-panel))}}:root{--glass-saturate:80%}html.dark{--bg:#1a1a1a;--bg-panel:#242424;--bg-hover:#2e2e2e;--bg-selected:#383838;--border:var(--text)}@supports (color:color-mix(in lab,red,red)){html.dark{--border:color-mix(in srgb,var(--text) 25%,transparent)}}html.dark{--text:#f5f7fa;--text-muted:#c7d0da;--text-dim:#8a93a0;--text-meta:#e8eef7eb;--msg-tool-text:var(--text)}@supports (color:color-mix(in lab,red,red)){html.dark{--msg-tool-text:color-mix(in srgb,var(--text) 32%,var(--text-muted))}}html.dark{--accent:#60a5fa;--accent-hover:#93c5fd;--side-hover:var(--text)}@supports (color:color-mix(in lab,red,red)){html.dark{--side-hover:color-mix(in srgb,var(--text) 6%,transparent)}}html.dark{--side-active:var(--text)}@supports (color:color-mix(in lab,red,red)){html.dark{--side-active:color-mix(in srgb,var(--text) 10%,transparent)}}html.dark{--side-selected:var(--accent)}@supports (color:color-mix(in lab,red,red)){html.dark{--side-selected:color-mix(in srgb,var(--accent) 14%,transparent)}}html.dark{--side-input:var(--glass-bg-strong)}@supports (color:color-mix(in lab,red,red)){html.dark{--side-input:color-mix(in srgb,var(--glass-bg-strong) 60%,transparent)}}html.dark{--frame-glass:#1c1c1fad;--side-panel:var(--frame-glass);--popover-glass:#1c1c1fcc;--user-bg:#1e293b;--assistant-bg:#1a1a1a;--tool-bg:#1f2937;--bg-subtle:#ffffff0d;--app-bg-scrim:#0000000f;--board-card-glass:rgba(34,34,37,var(--bubble-alpha));--glass-bg:#1e1e21a6;--glass-bg-strong:#222225c7;--glass-saturate:140%;--glass-bg-input:#22222585;--panel-glass:#222225e0;--panel-glass-todo:#222225bf;--panel-glass-minimap:#222225bf;--glass-blur:8px;--glass-blur-heavy:12px;--steer-active:#d97706;--follow-active:#818cf8;--user-bg-rgb:30,58,95;--assistant-bg-rgb:36,36,39;--tool-bg-rgb:36,36,39;--bubble-alpha:.55;--user-bg-glass:rgba(var(--user-bg-rgb),var(--bubble-alpha));--user-border-glass:#60a5fa47;--assistant-card-glass:rgba(var(--assistant-bg-rgb),var(--bubble-alpha));--tool-bg-glass:rgba(var(--tool-bg-rgb),var(--bubble-alpha));--glass-blur-bubble:6px}.catppuccin-file-icon{background:50%/contain no-repeat var(--catppuccin-icon-light);flex-shrink:0;display:block}html.dark .catppuccin-file-icon{background-image:var(--catppuccin-icon-dark)}@supports ((-webkit-mask-image:url("mask.svg")) or (mask-image:url("mask.svg"))){.catppuccin-file-icon{background:var(--text-dim);mask:center/contain no-repeat var(--catppuccin-icon-light);-webkit-mask:center/contain no-repeat var(--catppuccin-icon-light)}html.dark .catppuccin-file-icon{background:var(--text-dim);mask-image:var(--catppuccin-icon-dark);-webkit-mask-image:var(--catppuccin-icon-dark)}}::view-transition-old(root){mix-blend-mode:normal;animation:none}::view-transition-new(root){mix-blend-mode:normal;animation:none}::view-transition-old(root){z-index:1}::view-transition-new(root){z-index:2}*{box-sizing:border-box}body,html{width:100%;height:100dvh;height:var(--app-viewport-height,100dvh);background:var(--bg);color:var(--text);overscroll-behavior:none;margin:0;padding:0;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif;font-size:14px;overflow:hidden}body{background-color:var(--bg);background-image:linear-gradient(var(--app-bg-scrim),var(--app-bg-scrim)),var(--app-bg-image,none),var(--app-bg-fill,none);background-size:100% 100%,var(--app-bg-size,cover),100% 100%;background-position:50%,var(--app-bg-pos-x,center) center,50%;background-repeat:no-repeat,var(--app-bg-repeat,no-repeat),no-repeat;flex-direction:column;display:flex}::-webkit-scrollbar{width:4px;height:4px}::-webkit-scrollbar-track{background:0 0}::-webkit-scrollbar-thumb{background:var(--border);border-radius:2px}.glass-panel{background:var(--panel-glass);-webkit-backdrop-filter:blur(var(--glass-blur-panel)) saturate(var(--glass-saturate));transform:translateZ(0)}.glass-canvas{background-color:var(--frame-glass);background-image:linear-gradient(var(--frame-glass),var(--frame-glass)),var(--glass-bg-image-heavy,none);background-position:0 0,0 0;background-repeat:no-repeat,no-repeat;background-size:100% 100%,100% 100%;background-attachment:fixed}.glass-popover{background:var(--glass-bg-strong)}@supports (color:color-mix(in lab,red,red)){.glass-popover{background:color-mix(in srgb,var(--glass-bg-strong) 60%,transparent)}}.glass-popover{-webkit-backdrop-filter:blur(var(--glass-blur-popover)) saturate(var(--glass-saturate));transform:translateZ(0)}[data-glass-scope=board] .extension-status-shelf,[data-glass-scope=board] .glass-canvas{background-image:none}.glass-top-panel{background:var(--frame-glass);-webkit-backdrop-filter:blur(var(--glass-blur-heavy)) saturate(var(--glass-saturate));border:1px solid var(--border);transform:translateZ(0)}@supports (color:color-mix(in lab,red,red)){.glass-top-panel{border:1px solid color-mix(in srgb,var(--border) 60%,transparent)}}.glass-top-panel{border-top:none;border-radius:0 0 12px 12px;box-shadow:0 1px 2px #0f172a0a,0 4px 16px -8px #0f172a1a}.extension-status-shelf{border-top:1px solid var(--border);flex-wrap:nowrap;flex-shrink:0;align-items:stretch;min-width:0;display:flex;position:relative}@supports (color:color-mix(in lab,red,red)){.extension-status-shelf{border-top:1px solid color-mix(in srgb,var(--border) 60%,transparent)}}.extension-status-shelf{background-color:var(--frame-glass);background-image:linear-gradient(var(--frame-glass),var(--frame-glass)),var(--glass-bg-image-heavy,none);background-position:0 0,0 0;background-repeat:no-repeat,no-repeat;background-size:100% 100%,100% 100%;background-attachment:fixed}.extension-status-left{flex-wrap:wrap;flex:auto;align-items:stretch;min-width:0;display:flex}.extension-status-right{flex:0 auto;justify-content:center;align-items:stretch;min-width:0;display:flex}.extension-widget-panels{z-index:60;overscroll-behavior:contain;scrollbar-gutter:stable;border:1px solid var(--border);flex-direction:column;max-height:min(144px,18dvh);display:flex;position:absolute;bottom:100%;left:0;right:0;overflow:hidden auto}@supports (color:color-mix(in lab,red,red)){.extension-widget-panels{border:1px solid color-mix(in srgb,var(--border) 78%,transparent)}}.extension-widget-panels{background:var(--frame-glass);-webkit-backdrop-filter:blur(var(--glass-blur-heavy)) saturate(var(--glass-saturate));border-radius:8px 8px 0 0;box-shadow:0 -4px 16px #0000001a}.extension-widget-panel{background:0 0;flex-shrink:0;min-width:0;overflow:hidden}.extension-widget-panel-heading{height:26px;color:var(--text);font-family:var(--font-mono);text-overflow:ellipsis;white-space:nowrap;padding:5px 12px 0;font-size:11px;font-weight:600;overflow:hidden}.extension-widget-triggers{overscroll-behavior-x:contain;scrollbar-width:none;flex:0 auto;align-items:stretch;min-width:0;height:35px;display:flex;overflow:auto hidden}.extension-widget-triggers::-webkit-scrollbar{display:none}.extension-status-shelf.has-widgets.has-status .extension-widget-triggers{border-right:1px solid var(--border)}@supports (color:color-mix(in lab,red,red)){.extension-status-shelf.has-widgets.has-status .extension-widget-triggers{border-right:1px solid color-mix(in srgb,var(--border) 78%,transparent)}}.extension-widget-trigger{border:0;border-right:1px solid var(--border);flex:0 0 108px;align-items:center;gap:5px;width:108px;height:35px;padding:0 7px;display:flex;position:relative;overflow:hidden}@supports (color:color-mix(in lab,red,red)){.extension-widget-trigger{border-right:1px solid color-mix(in srgb,var(--border) 78%,transparent)}}.extension-widget-trigger{color:var(--text-muted);font-family:var(--font-mono);text-align:left;background:0 0;font-size:11px}.extension-widget-update-pulse{z-index:0;opacity:0;pointer-events:none;transition:opacity .18s ease-out;position:absolute;inset:0}.extension-widget-update-pulse:before{background:var(--accent);content:"";opacity:.12;position:absolute;inset:0}.extension-widget-trigger.is-updating .extension-widget-update-pulse{opacity:1}.extension-widget-trigger.is-updating .extension-widget-update-pulse:before{animation:extension-widget-update-pulse .9s ease-in-out infinite alternate}@keyframes extension-widget-update-pulse{0%{opacity:.18}to{opacity:.06}}button.extension-widget-trigger{cursor:pointer;transition:background .12s,color .12s}.extension-widget-trigger.is-expanded,button.extension-widget-trigger:hover{background:var(--bg-hover);color:var(--text)}button.extension-widget-trigger:focus-visible{outline:2px solid var(--accent);outline-offset:-2px}.extension-widget-placement{z-index:1;width:10px;color:var(--text-dim);flex:0 0 10px;justify-content:center;align-items:center;display:flex;position:relative}.extension-widget-placement-icon{fill:currentColor;flex:0 0 8px;width:8px;height:6px;display:block}.extension-widget-key{z-index:1;min-width:0;color:var(--text);text-overflow:ellipsis;white-space:nowrap;flex:1;font-weight:600;position:relative;overflow:hidden}.subagent-widget-card{cursor:pointer}.subagent-widget-card:hover{color:var(--text)}.subagent-widget-card.is-expanded{color:var(--text);background:var(--bg-selected);border-top:2px solid var(--accent)}.subagent-widget-card:focus-visible{outline:2px solid var(--accent);outline-offset:-2px}@media (prefers-reduced-motion:reduce){.extension-widget-update-pulse{transition:none}.extension-widget-trigger.is-updating .extension-widget-update-pulse:before{opacity:.12;animation:none}}.extension-widget-content{color:var(--text-muted);font-family:var(--font-mono);overflow-wrap:anywhere;white-space:pre-wrap;margin:0;padding:3px 12px 8px;font-size:14px;line-height:1.45}.extension-status-line{flex:0 auto;align-items:center;min-width:0;height:35px;padding:0 12px;display:flex}.extension-status-text{min-width:0;color:var(--text-muted);font-family:var(--font-mono);text-overflow:ellipsis;white-space:nowrap;font-size:11px;overflow:hidden}@media (max-width:640px){.extension-status-right:not(.has-tools){display:none}}::-webkit-scrollbar-thumb:hover{background:var(--text-dim)}:root{--font-mono:ui-monospace,"SF Mono",SFMono-Regular,Menlo,Consolas,"PingFang SC","Microsoft YaHei",monospace}.markdown-body,code,pre{font-family:var(--font-mono)}.markdown-body{min-width:0;max-width:100%;color:var(--text);word-break:break-word;font-size:14px;line-height:1.7;overflow-x:hidden}.markdown-body p{margin:0 0 8px}.markdown-body p:last-child{margin-bottom:0}.markdown-body h1,.markdown-body h2,.markdown-body h3,.markdown-body h4,.markdown-body h5,.markdown-body h6{color:var(--text);letter-spacing:0;margin:10px 0 5px;font-weight:600;line-height:1.35}.markdown-body h1{font-size:1.16em}.markdown-body h2{font-size:1.08em}.markdown-body h3{color:var(--text);font-size:.98em}@supports (color:color-mix(in lab,red,red)){.markdown-body h3{color:color-mix(in srgb,var(--text) 88%,var(--text-muted))}}.markdown-body ul{padding-left:22px}.markdown-body ol,.markdown-body ul{margin:5px 0 8px;list-style-position:outside}.markdown-body ol{padding-left:30px}.markdown-body li{margin:3px 0;padding-left:2px}.markdown-body ul>li{list-style-type:disc}.markdown-body ol>li{list-style-type:decimal}.markdown-body li>p{margin:0}.markdown-body li::marker{color:var(--accent)}@supports (color:color-mix(in lab,red,red)){.markdown-body li::marker{color:color-mix(in srgb,var(--accent) 72%,var(--text-muted))}}.markdown-body li::marker{font-weight:600}.markdown-body strong{color:var(--text)}@supports (color:color-mix(in lab,red,red)){.markdown-body strong{color:color-mix(in srgb,var(--text) 88%,var(--accent))}}.markdown-body strong{font-weight:700}.markdown-body em{color:var(--text-muted)}.markdown-body a{color:var(--accent);text-underline-offset:3px;text-decoration:underline;text-decoration-thickness:1px;-webkit-text-decoration-color:var(--accent);text-decoration-color:var(--accent)}@supports (color:color-mix(in lab,red,red)){.markdown-body a{-webkit-text-decoration-color:color-mix(in srgb,var(--accent) 45%,transparent);text-decoration-color:color-mix(in srgb,var(--accent) 45%,transparent)}}.markdown-body a:hover{-webkit-text-decoration-color:var(--accent);text-decoration-color:var(--accent)}.markdown-body img{border-radius:6px;max-width:100%;height:auto;margin:8px 0;display:block}.markdown-body .markdown-inline-code{background:var(--bg-subtle);color:var(--text);font-family:var(--font-mono);box-shadow:inset 0 0 0 1px var(--border);border-radius:5px;padding:1px 5px;font-size:.92em}@supports (color:color-mix(in lab,red,red)){.markdown-body .markdown-inline-code{box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--border) 70%,transparent)}}.markdown-body .contains-task-list{padding-left:0;list-style:none}.markdown-body .task-list-item{padding-left:25px;display:block;position:relative}.markdown-body .task-list-item::marker{content:""}.markdown-body .task-list-item>input[type=checkbox],.markdown-body .task-list-item>p:first-child>input[type=checkbox]:first-child{appearance:none;border:1px solid var(--border);background:var(--bg);border-radius:4px;place-content:center;width:14px;height:14px;margin:0;display:inline-grid;position:absolute;top:.35em;left:0}.markdown-body .task-list-item>input[type=checkbox]:checked,.markdown-body .task-list-item>p:first-child>input[type=checkbox]:first-child:checked{border-color:var(--accent)}@supports (color:color-mix(in lab,red,red)){.markdown-body .task-list-item>input[type=checkbox]:checked,.markdown-body .task-list-item>p:first-child>input[type=checkbox]:first-child:checked{border-color:color-mix(in srgb,var(--accent) 55%,var(--border))}}.markdown-body .task-list-item>input[type=checkbox]:checked,.markdown-body .task-list-item>p:first-child>input[type=checkbox]:first-child:checked{background:var(--accent)}@supports (color:color-mix(in lab,red,red)){.markdown-body .task-list-item>input[type=checkbox]:checked,.markdown-body .task-list-item>p:first-child>input[type=checkbox]:first-child:checked{background:color-mix(in srgb,var(--accent) 10%,var(--bg))}}.markdown-body .task-list-item>input[type=checkbox]:checked:before,.markdown-body .task-list-item>p:first-child>input[type=checkbox]:first-child:checked:before{content:"";border:solid var(--accent);border-width:0 1.5px 1.5px 0;width:4px;height:8px;transform:rotate(45deg)translateY(-1px)}.markdown-body blockquote{border-left:3px solid var(--border)}@supports (color:color-mix(in lab,red,red)){.markdown-body blockquote{border-left:3px solid color-mix(in srgb,var(--border) 75%,var(--text-muted))}}.markdown-body blockquote{background:var(--bg-subtle);color:var(--text-muted);border-radius:0 6px 6px 0;margin:6px 0;padding:6px 11px}.markdown-table-wrap{border:1px solid var(--border);border-radius:var(--bubble-inner-radius);width:100%;margin:8px 0;overflow:auto hidden}.markdown-body table{border-collapse:separate;border-spacing:0;min-width:100%;font-size:13px}.markdown-body td,.markdown-body th{border:0;border-bottom:1px solid var(--border);text-align:left;vertical-align:top;padding:6px 10px}.markdown-body tr:last-child td{border-bottom:0}.markdown-body th{background:var(--bubble-th-bg);color:var(--text)}@supports (color:color-mix(in lab,red,red)){.markdown-body th{color:color-mix(in srgb,var(--text) 88%,var(--text-muted))}}.markdown-body th{font-weight:650}.markdown-body tbody tr:nth-child(2n) td{background:var(--bg-subtle)}.markdown-body hr{background:linear-gradient(90deg,transparent,var(--border),transparent);border:none;height:1px;margin:12px 0}.markdown-body .katex-display{margin:.6em 0;padding:2px 0;overflow:auto hidden}.markdown-body .katex{font-size:1.05em}.markdown-user-message p{white-space:pre-wrap}.markdown-skill-body,.markdown-skill-body a,.markdown-skill-body h1,.markdown-skill-body h2,.markdown-skill-body h3,.markdown-skill-body h4,.markdown-skill-body h5,.markdown-skill-body h6{color:var(--text-muted)}.markdown-skill-body a{-webkit-text-decoration-color:var(--text-muted);text-decoration-color:var(--text-muted)}@supports (color:color-mix(in lab,red,red)){.markdown-skill-body a{-webkit-text-decoration-color:color-mix(in srgb,var(--text-muted) 40%,transparent);text-decoration-color:color-mix(in srgb,var(--text-muted) 40%,transparent)}}.markdown-skill-body a:hover{-webkit-text-decoration-color:var(--text-muted);text-decoration-color:var(--text-muted)}.markdown-skill-body code{color:var(--text-muted)}.markdown-custom-message{line-height:1.32}.markdown-custom-message p{margin:0}.markdown-custom-message h1,.markdown-custom-message h2,.markdown-custom-message h3,.markdown-custom-message h4,.markdown-custom-message h5,.markdown-custom-message h6{margin:4px 0 2px;line-height:1.18}.markdown-custom-message ol,.markdown-custom-message ul{margin:2px 0 3px}.markdown-custom-message li{margin:0}.markdown-custom-message blockquote{margin:3px 0;padding:4px 8px}.markdown-custom-message .markdown-code-block,.markdown-custom-message .markdown-table-wrap{margin:4px 0}.markdown-compaction-message{line-height:1.5}.markdown-compaction-message p{margin:0 0 7px}.markdown-compaction-message h1,.markdown-compaction-message h2,.markdown-compaction-message h3,.markdown-compaction-message h4,.markdown-compaction-message h5,.markdown-compaction-message h6{margin:8px 0 3px;line-height:1.25}.markdown-compaction-message ol,.markdown-compaction-message ul{margin:4px 0 8px}.markdown-compaction-message li{margin:2px 0}.markdown-compaction-message .markdown-code-block,.markdown-compaction-message .markdown-table-wrap{margin:6px 0}.compaction-file-details{border-top:1px solid var(--border);color:var(--text-muted);margin-top:10px;padding-top:8px;font-size:12px}.compaction-file-details summary{cursor:pointer;font-weight:600;line-height:1.4}.compaction-file-section{margin-top:8px}.compaction-file-title{color:var(--text);margin-bottom:4px;font-size:11px;font-weight:650}.compaction-file-list{border:1px solid var(--border);background:var(--bg-panel);max-height:180px;font-family:var(--font-mono);border-radius:6px;margin:0;padding:7px 8px;font-size:11px;line-height:1.45;list-style:none;overflow:auto}.compaction-file-list li{overflow-wrap:anywhere}.compaction-file-list li+li{margin-top:3px}.markdown-code-block{border:1px solid var(--border);border-radius:var(--bubble-inner-radius);background:var(--bubble-code-bg);width:100%;min-width:0;max-width:100%;box-shadow:0 1px 0 var(--border);margin:6px 0;position:relative;overflow:hidden}@supports (color:color-mix(in lab,red,red)){.markdown-code-block{box-shadow:0 1px 0 color-mix(in srgb,var(--border) 42%,transparent)}}.markdown-code-header{background:var(--bubble-th-bg);border-bottom:1px solid var(--border);color:var(--text-dim);justify-content:space-between;align-items:center;gap:8px;padding:5px 10px;font-size:11px;display:flex}.markdown-code-lang{color:var(--text-muted);font-family:var(--font-mono);font-weight:650}.markdown-code-actions{align-items:center;gap:6px;display:flex}.markdown-code-action{border:1px solid var(--border);background:var(--bg);color:var(--text-muted);cursor:pointer;font:inherit;border-radius:5px;padding:2px 7px;font-size:11px;line-height:1.25}.markdown-code-action:hover:not(:disabled){color:var(--text);border-color:var(--border)}@supports (color:color-mix(in lab,red,red)){.markdown-code-action:hover:not(:disabled){border-color:color-mix(in srgb,var(--border) 70%,var(--text-muted))}}.markdown-code-action:disabled{color:var(--text-dim);cursor:not-allowed;opacity:.75}.markdown-code-action.is-active{background:var(--bg-selected);color:var(--text)}.mermaid-block{background:var(--bubble-code-bg);padding:12px;overflow-x:auto}.mermaid-block svg{max-width:none;display:block}.mermaid-block-loading{min-height:120px}.mermaid-block-error{color:var(--text-muted);font-family:var(--font-mono);font-size:12px}.mermaid-preview-button{width:100%;color:inherit;cursor:zoom-in;text-align:left;border:0}.mermaid-preview-button:hover{opacity:.85}.mermaid-preview-button:focus-visible{outline:2px solid var(--accent);outline-offset:-2px}.image-preview-dialog{width:100vw;max-width:none;height:100dvh;max-height:none;padding:max(16px,env(safe-area-inset-top)) max(16px,env(safe-area-inset-right)) max(16px,env(safe-area-inset-bottom)) max(16px,env(safe-area-inset-left));color:var(--text);background:0 0;border:0;margin:0;position:fixed;inset:0;overflow:hidden}.image-preview-dialog[open]{justify-content:center;align-items:center;display:flex}.image-preview-dialog::backdrop{background:#000000b8}.image-preview-image{object-fit:contain;border-radius:8px;max-width:100%;max-height:100%;display:block;box-shadow:0 20px 60px #0006}.image-preview-close{top:max(12px,env(safe-area-inset-top));right:max(12px,env(safe-area-inset-right));z-index:1;border:1px solid var(--border);background:var(--bg-panel);width:36px;height:36px;color:var(--text-muted);cursor:pointer;touch-action:manipulation;border-radius:6px;justify-content:center;align-items:center;padding:0;transition:background-color .12s,color .12s;display:inline-flex;position:absolute;box-shadow:0 2px 10px #00000047}.image-preview-close:hover{background:var(--bg-hover);color:var(--text)}.image-preview-close:focus-visible{outline:2px solid var(--accent);outline-offset:2px}@media (pointer:coarse){.image-preview-close{width:44px;height:44px}}.mermaid-zoom-dialog{background:var(--bg);width:100vw;max-width:none;height:100dvh;max-height:none;color:var(--text);border:0;margin:0;padding:0}.mermaid-zoom-dialog::backdrop{background:#00000059}.mermaid-zoom-layout{grid-template-rows:auto minmax(0,1fr);height:100%;display:grid}.mermaid-zoom-toolbar{background:var(--bg-panel);border-bottom:1px solid var(--border);align-items:center;gap:10px;min-height:40px;padding:7px 10px;display:flex}.mermaid-zoom-title{min-width:0;color:var(--text-muted);font-family:var(--font-mono);text-overflow:ellipsis;white-space:nowrap;font-size:11px;font-weight:600;overflow:hidden}.mermaid-zoom-actions{align-items:center;gap:6px;margin-left:auto;display:flex}.mermaid-zoom-stepper{border:1px solid var(--border);background:var(--bg);border-radius:5px;align-items:center;height:24px;display:flex;overflow:hidden}.mermaid-zoom-icon-button,.mermaid-zoom-stepper button{width:24px;height:24px;color:var(--text-muted);cursor:pointer;touch-action:manipulation;background:0 0;border:0;justify-content:center;align-items:center;padding:0;display:inline-flex}.mermaid-zoom-stepper button{height:22px}.mermaid-zoom-stepper button+.mermaid-zoom-value,.mermaid-zoom-value+button{border-left:1px solid var(--border)}.mermaid-zoom-icon-button{border:1px solid var(--border);border-radius:5px;flex:0 0 24px}.mermaid-zoom-icon-button:hover,.mermaid-zoom-stepper button:hover:not(:disabled){background:var(--bg-hover);color:var(--text)}.mermaid-zoom-stepper button:disabled{opacity:.35;cursor:default}.mermaid-zoom-icon-button:focus-visible,.mermaid-zoom-stepper button:focus-visible{outline:2px solid var(--accent);outline-offset:-2px}.mermaid-zoom-value{min-width:48px;height:22px;color:var(--text-muted);font-family:var(--font-mono);text-align:center;-webkit-user-select:none;user-select:none;font-size:12px;line-height:22px}.mermaid-zoom-viewport{background:var(--bg);-webkit-overflow-scrolling:touch;min-width:0;min-height:0;padding:24px;overflow:auto}.mermaid-zoom-canvas{border:1px solid var(--border);background:var(--bg-panel);border-radius:7px;margin:0 auto;padding:12px;transition:width .15s}.mermaid-zoom-canvas svg{height:auto;display:block;width:100%!important;max-width:none!important}@media (max-width:480px){.mermaid-zoom-toolbar{padding-inline:8px}.mermaid-zoom-title{font-size:10px}.mermaid-zoom-viewport{padding:12px}}.file-viewer-toolbar{min-width:0;min-height:35px}.file-viewer-path{flex:auto;min-width:48px}.file-viewer-meta,.file-viewer-path{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.file-viewer-meta{flex:0 auto;min-width:0}.file-viewer-live-indicator{border-radius:50%;flex:0 0 7px;width:7px;height:7px}.file-viewer-controls{gap:6px}.file-viewer-actions,.file-viewer-controls{flex-shrink:0;align-items:center;display:flex}.file-viewer-actions{order:-1;gap:4px;height:24px}.file-viewer-mode-switch{border:1px solid var(--border);border-radius:5px;height:24px;display:flex;overflow:hidden}.file-viewer-mode-button{border:0;border-left:1px solid var(--border);height:22px;font:inherit;letter-spacing:0;cursor:pointer;white-space:nowrap;padding:0 8px;font-size:11px;font-weight:500}.file-viewer-mode-button:first-child{border-left:0}.file-viewer-mode-button:hover{filter:brightness(1.08)}.file-viewer-icon-button{box-sizing:border-box;border:1px solid var(--border);width:24px;height:24px;color:var(--text-muted);cursor:pointer;background:0 0;border-radius:5px;flex:0 0 24px;justify-content:center;align-items:center;padding:0;text-decoration:none;display:inline-flex}.file-viewer-icon-button:hover{color:var(--text);background:var(--side-hover)!important}.file-viewer-icon-button:disabled{color:var(--text-dim);cursor:not-allowed;opacity:.55}.file-viewer-icon-button:disabled:hover{color:var(--text-dim);background:0 0!important}.file-viewer-icon-button:focus-visible,.file-viewer-mode-button:focus-visible{outline:2px solid var(--accent);outline-offset:-2px}.directory-picker-path:focus-visible{box-shadow:0 0 0 3px var(--accent);border-color:var(--accent)!important}@supports (color:color-mix(in lab,red,red)){.directory-picker-path:focus-visible{box-shadow:0 0 0 3px color-mix(in srgb,var(--accent) 18%,transparent)}}@media (max-width:640px){.file-viewer-meta{display:none}}@media (max-width:380px){.file-viewer-toolbar{gap:6px!important;padding-inline:8px!important}.file-viewer-mode-button{padding-inline:6px}}.markdown-file-preview h1{font-size:1.8em}.markdown-file-preview h2{font-size:1.4em}.markdown-file-preview h3{font-size:1.15em}.markdown-file-preview p{margin:0 0 12px}.markdown-file-preview pre{background:var(--bubble-code-bg);border:1px solid var(--border);font-family:var(--font-mono);border-radius:6px;margin:12px 0;padding:12px 16px;font-size:13px;overflow-x:auto}.markdown-file-preview code{font-family:var(--font-mono);background:var(--bg-subtle);border-radius:3px;padding:1px 5px;font-size:.9em}.markdown-file-preview pre code{background:0 0;padding:0}.markdown-frontmatter{border:1px solid var(--border);background:var(--bubble-code-bg);border-radius:8px;margin-bottom:20px;padding:14px 16px 12px}.markdown-frontmatter-title{color:var(--text);font-size:1.3em;font-weight:600;line-height:1.35}.markdown-frontmatter-tags{flex-wrap:wrap;gap:6px;margin-top:8px;display:flex}.markdown-frontmatter-tag{color:var(--text-muted);background:var(--bg-subtle);border:1px solid var(--border);border-radius:999px;padding:0 10px;font-size:12px;line-height:1.6}.markdown-frontmatter-rows{grid-template-columns:auto 1fr;gap:5px 14px;margin:10px 0 0;font-size:13px;line-height:1.55;display:grid}.markdown-frontmatter-row{display:contents}.markdown-frontmatter-row dt{color:var(--text-muted);font-family:var(--font-mono);white-space:nowrap;font-size:.92em}.markdown-frontmatter-row dd{color:var(--text);word-break:break-word;min-width:0;margin:0}.markdown-frontmatter-row dd a{color:var(--accent);text-underline-offset:2px;text-decoration:underline}.markdown-body span.linenumber,span.linenumber{color:var(--text-dim)!important;font-style:normal!important}span.token.table{display:inline}@keyframes drop-zone-in{0%{opacity:0;transform:scale(.97)}to{opacity:1;transform:scale(1)}}@keyframes drop-icon-float{0%,to{transform:translateY(0)}50%{transform:translateY(-6px)}}@keyframes drop-ring-pulse{0%,to{opacity:.5;transform:scale(1)}50%{opacity:1;transform:scale(1.06)}}@keyframes drop-ripple{0%{opacity:.6;transform:scale(0)}to{opacity:0;transform:scale(1)}}@keyframes blink{0%,to{opacity:1}50%{opacity:.3}}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(1turn)}}@keyframes toast-in{0%{opacity:0;transform:translate(-50%)translateY(-6px)}to{opacity:1;transform:translate(-50%)translateY(0)}}@keyframes board-search-glow{0%{box-shadow:0 0 0 3px var(--accent),0 0 24px color-mix(in srgb,var(--accent) 45%,transparent)}to{box-shadow:0 0 0 3px color-mix(in srgb,var(--accent) 0%,transparent),0 0 24px color-mix(in srgb,var(--accent) 0%,transparent)}}@keyframes pulse{0%,to{opacity:1}50%{opacity:.5}}@keyframes compaction-breathe{0%,to{box-shadow:0 0 0 0 color-mix(in srgb,var(--accent) 0%,transparent)}50%{box-shadow:0 0 16px 1px color-mix(in srgb,var(--accent) 22%,transparent)}}@keyframes compaction-dot-breathe{0%,to{opacity:1;transform:scale(1)}50%{opacity:.35;transform:scale(.85)}}@keyframes notice-shelf-in{0%{opacity:0;transform:translateY(8px)scale(.98)}to{opacity:1;transform:translateY(0)scale(1)}}@keyframes notice-shelf-out{0%{opacity:1;transform:translateY(0)scale(1)}to{opacity:0;transform:translateY(8px)scale(.98)}}@keyframes notice-flash{0%{box-shadow:0 0 0 0 color-mix(in srgb,var(--accent) 55%,transparent)}40%{box-shadow:0 0 0 7px color-mix(in srgb,var(--accent) 0%,transparent);transform:scale(1.03)}60%{box-shadow:0 0 0 0 color-mix(in srgb,var(--accent) 55%,transparent);transform:scale(1)}to{box-shadow:0 0 0 0 color-mix(in srgb,var(--accent) 0%,transparent);transform:scale(1)}}@keyframes notice-drawer-in{0%{opacity:0;transform:translateY(8px)scale(.98)}to{opacity:1;transform:translateY(0)scale(1)}}@media (prefers-reduced-motion:reduce){.notice-shelf-item{animation-duration:.001ms!important}.notice-pill{animation:none!important}.notice-drawer,.notice-drawer-item{animation-duration:.001ms!important}.compaction-status,.compaction-status-dot{animation:none!important}}@keyframes saved-pop{0%{transform:scale(1);box-shadow:0 0 #4ade808c}40%{transform:scale(1.08);box-shadow:0 0 0 6px #4ade8040}to{transform:scale(1);box-shadow:0 0 #4ade8000}}@keyframes saved-check-draw{0%{stroke-dashoffset:18px;opacity:0}to{stroke-dashoffset:0;opacity:1}}.panel-resize-handle{z-index:220;cursor:col-resize;touch-action:none;outline:none;flex:0 0 12px;width:12px;margin:0 -6px;position:relative}.panel-resize-handle:after{content:"";pointer-events:none;background:0 0;width:2px;transition:background .12s;position:absolute;top:0;bottom:0;left:5px}.panel-resize-handle.is-resizing:after,.panel-resize-handle:focus-visible:after,.panel-resize-handle:hover:after{background:var(--text-muted)}@supports (color:color-mix(in lab,red,red)){.panel-resize-handle.is-resizing:after,.panel-resize-handle:focus-visible:after,.panel-resize-handle:hover:after{background:color-mix(in srgb,var(--text-muted) 70%,var(--border))}}.right-panel-overlay-backdrop{display:none}@media (min-width:641px){.sidebar-overlay-backdrop{display:none!important}.sidebar-container{transition:width .2s,min-width .2s;position:relative;overflow:hidden}.sidebar-container.sidebar-open{width:var(--sidebar-width,260px);min-width:var(--sidebar-width,260px)}.sidebar-container.sidebar-closed{width:0;min-width:0;border-right:none!important}.sidebar-container>*{width:var(--sidebar-width,260px);min-width:var(--sidebar-width,260px)}.sidebar-container.sidebar-resizing,.sidebar-container.sidebar-resizing>*{transition:none!important}}@media (min-width:960px){.right-panel-container{flex-shrink:0;transition:width .2s,min-width .2s;overflow:hidden}.right-panel-container.right-panel-open{width:var(--right-panel-width,clamp(360px,42vw,640px));min-width:300px}.right-panel-container.right-panel-closed{width:0;min-width:0;border-left:none!important}.right-panel-container>*{width:var(--right-panel-width,clamp(360px,42vw,640px));min-width:300px}.right-panel-container.right-panel-resizing,.right-panel-container.right-panel-resizing>*{transition:none!important}}@media (min-width:641px) and (max-width:959px){.right-panel-resize-handle{display:none}.right-panel-overlay-backdrop{z-index:240;opacity:0;pointer-events:none;background:#0000003d;transition:opacity .2s;display:block;position:fixed;inset:0}.right-panel-overlay-backdrop.is-open{opacity:1;pointer-events:auto}.right-panel-container{top:0;right:env(safe-area-inset-right);z-index:250;width:min(560px,100vw - 48px);min-width:300px;transition:transform .2s;position:fixed;bottom:0;overflow:hidden;box-shadow:-12px 0 32px #0000002e}.right-panel-container.right-panel-open{transform:translate(0)}.right-panel-container.right-panel-closed{pointer-events:none;transform:translate(100%)}.right-panel-container>*{width:100%;min-width:0}}@media (max-width:640px){.chat-stats-center{display:none!important}.sidebar-container{top:0;left:env(safe-area-inset-left);width:280px;max-width:85vw;height:var(--app-viewport-height,100dvh);transition:transform .25s,box-shadow .25s;bottom:0;position:fixed!important}.sidebar-container.sidebar-open{transform:translate(0);box-shadow:4px 0 20px #00000026}.sidebar-container.sidebar-closed{transform:translateX(calc(-100% - env(safe-area-inset-left)));box-shadow:none}.right-panel-container{inset:0 env(safe-area-inset-right) 0 env(safe-area-inset-left);height:var(--app-viewport-height,100dvh);z-index:250;transition:transform .2s;position:fixed;overflow:hidden}.right-panel-container.right-panel-open{width:auto;min-width:0}.right-panel-container.right-panel-closed{border-left:none!important;width:0!important;min-width:0!important;display:none!important}.right-panel-container>*{width:100%;min-width:0}.panel-resize-handle,.right-panel-overlay-backdrop{display:none}.directory-picker-action,.directory-picker-back,.directory-picker-entry{min-height:44px!important}.directory-picker-back{min-width:44px!important}.directory-picker-footer{flex-wrap:wrap;padding-bottom:max(10px,env(safe-area-inset-bottom))!important}input,select,textarea{font-size:16px!important}}@media (prefers-reduced-transparency:reduce){:root,html.dark{--app-bg-scrim:#fff;--glass-bg:var(--bg);--glass-bg-strong:var(--bg);--frame-glass:var(--bg);--side-panel:var(--frame-glass);--popover-glass:var(--bg);--panel-glass:var(--bg);--panel-glass-todo:var(--bg);--panel-glass-minimap:var(--bg);--glass-blur:0px;--glass-blur-heavy:0px;--glass-blur-panel:0px;--glass-blur-popover:0px;--glass-blur-bubble:0px}html.dark{--app-bg-scrim:#000}}@media (prefers-contrast:more){:root,html.dark{--glass-bg:var(--bg);--glass-bg-strong:var(--bg);--frame-glass:var(--bg);--side-panel:var(--frame-glass);--popover-glass:var(--bg);--panel-glass:var(--bg);--panel-glass-todo:var(--bg);--panel-glass-minimap:var(--bg);--glass-blur:0px;--glass-blur-heavy:0px;--glass-blur-panel:0px;--glass-blur-popover:0px;--glass-blur-bubble:0px}}@keyframes back-to-latest-in{0%{opacity:0;transform:translateY(4px)scale(.92)}to{opacity:1;transform:translateY(0)scale(1)}}.terminal-panel{border:1px solid var(--border);border-radius:10px;flex-direction:column;display:flex;overflow:hidden}@keyframes terminal-panel-in-top{0%{opacity:0;transform:translateY(-6px)scale(.97)}to{opacity:1;transform:translateY(0)scale(1)}}@keyframes terminal-panel-in-bottombar{0%{opacity:0;transform:translateY(6px)scale(.97)}to{opacity:1;transform:translateY(0)scale(1)}}.terminal-panel-top{transform-origin:100% 0;animation:terminal-panel-in-top .15s ease-out both;border-top:none!important;border-radius:0 0 10px 10px!important}.terminal-panel-bottombar{transform-origin:100% 100%;animation:terminal-panel-in-bottombar .15s ease-out both;border-bottom:none!important;border-radius:10px 10px 0 0!important}.terminal-panel-dragged{border-top:1px solid var(--border)!important;border-bottom:1px solid var(--border)!important;border-radius:10px!important}.terminal-panel-hidden{display:none}.terminal-panel-mobile{animation:terminal-panel-in-bottombar .15s ease-out both;inset:10px;width:auto!important;height:auto!important}@media (prefers-reduced-motion:reduce){.terminal-panel-bottombar,.terminal-panel-mobile,.terminal-panel-top{animation:none}}.terminal-tabs{border-bottom:1px solid var(--text);flex-shrink:0;align-items:stretch;gap:2px;height:34px;padding-left:6px;display:flex}@supports (color:color-mix(in lab,red,red)){.terminal-tabs{border-bottom:1px solid color-mix(in srgb,var(--text) 8%,transparent)}}html.dark .terminal-tabs{border-bottom-color:var(--text)}@supports (color:color-mix(in lab,red,red)){html.dark .terminal-tabs{border-bottom-color:color-mix(in srgb,var(--text) 6%,transparent)}}.terminal-tab-scroll{scrollbar-width:none;flex:1;align-items:stretch;gap:10px;min-width:0;display:flex;overflow-x:auto}.terminal-tab-scroll::-webkit-scrollbar{display:none}.terminal-group{flex-shrink:0;align-items:stretch;gap:2px;display:flex}.terminal-group-label{letter-spacing:.07em;text-transform:uppercase;color:var(--text);align-items:center;font-size:10px;font-weight:600;display:flex}@supports (color:color-mix(in lab,red,red)){.terminal-group-label{color:color-mix(in srgb,var(--text) 45%,transparent)}}.terminal-group-label{white-space:nowrap}.terminal-chip{cursor:pointer;color:var(--text);border-radius:5px;align-items:center;gap:5px;margin:4px 0;padding:0 4px 0 8px;display:flex}@supports (color:color-mix(in lab,red,red)){.terminal-chip{color:color-mix(in srgb,var(--text) 75%,transparent)}}.terminal-chip{white-space:nowrap;-webkit-user-select:none;user-select:none;font-size:11px;transition:background .1s}.terminal-chip:hover{background:var(--text)}@supports (color:color-mix(in lab,red,red)){.terminal-chip:hover{background:color-mix(in srgb,var(--text) 8%,transparent)}}.terminal-chip.is-active{background:var(--accent)}@supports (color:color-mix(in lab,red,red)){.terminal-chip.is-active{background:color-mix(in srgb,var(--accent) 26%,transparent)}}.terminal-chip.is-active{color:var(--text)}.terminal-chip.is-dead{opacity:.55}.terminal-dot{background:#34d399;border-radius:50%;flex-shrink:0;width:6px;height:6px}.terminal-dot.is-dead{background:#6b7280}.terminal-dot.is-disconnected{background:#f59e0b;box-shadow:0 0 0 1px #f59e0b66}.terminal-chip-cwd{text-overflow:ellipsis;max-width:130px;overflow:hidden}.terminal-chip-close,.terminal-close,.terminal-new{color:var(--text);background:0 0;border:none;justify-content:center;align-items:center;display:flex}@supports (color:color-mix(in lab,red,red)){.terminal-chip-close,.terminal-close,.terminal-new{color:color-mix(in srgb,var(--text) 50%,transparent)}}.terminal-chip-close,.terminal-close,.terminal-new{cursor:pointer;border-radius:4px;flex-shrink:0;transition:color .1s,background .1s}.terminal-chip-close{width:16px;height:16px;margin-left:2px}.terminal-chip-close:hover,.terminal-close:hover{color:var(--text);background:var(--text)}@supports (color:color-mix(in lab,red,red)){.terminal-chip-close:hover,.terminal-close:hover{background:color-mix(in srgb,var(--text) 12%,transparent)}}.terminal-close,.terminal-new{align-self:center;width:30px;height:24px;margin-right:2px}.terminal-new:hover{color:var(--text);background:var(--text)}@supports (color:color-mix(in lab,red,red)){.terminal-new:hover{background:color-mix(in srgb,var(--text) 12%,transparent)}}.terminal-close{color:#f87171cc}.terminal-close:hover{color:#fff;background:#ef4444d9}.terminal-chip-close:hover{color:#fff;background:#ef4444cc}.terminal-chip.is-disconnected{opacity:.72}.terminal-cleanup{color:#f59e0bd9;cursor:pointer;background:0 0;border:none;border-radius:4px;flex-shrink:0;justify-content:center;align-self:center;align-items:center;width:30px;height:24px;margin-right:2px;transition:color .1s,background .1s;display:flex}.terminal-cleanup:hover{color:#f59e0b;background:#f59e0b24}.terminal-all-select{appearance:none;max-width:150px;height:24px;color:var(--text);color-scheme:light;background-color:var(--text);align-self:center;margin-right:2px;padding:0 22px 0 8px;font-family:inherit;font-size:11px}@supports (color:color-mix(in lab,red,red)){.terminal-all-select{background-color:color-mix(in srgb,var(--text) 7%,transparent)}}.terminal-all-select{border:1px solid var(--text);background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");background-position:right 6px center;background-repeat:no-repeat;background-size:10px 10px}@supports (color:color-mix(in lab,red,red)){.terminal-all-select{border:1px solid color-mix(in srgb,var(--text) 12%,transparent)}}.terminal-all-select{cursor:pointer;border-radius:5px;outline:none;flex-shrink:0;transition:background-color .1s,border-color .1s}html.dark .terminal-all-select{color-scheme:dark;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%23a1a1aa' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E")}.terminal-all-select:hover{background-color:var(--text)}@supports (color:color-mix(in lab,red,red)){.terminal-all-select:hover{background-color:color-mix(in srgb,var(--text) 11%,transparent)}}.terminal-all-select:hover{border-color:var(--text)}@supports (color:color-mix(in lab,red,red)){.terminal-all-select:hover{border-color:color-mix(in srgb,var(--text) 20%,transparent)}}.terminal-all-select:focus-visible{border-color:var(--accent)}.terminal-all-select optgroup,.terminal-all-select option{color:var(--text);background:var(--bg-panel)}.terminal-error{color:#f87171;border-bottom:1px solid var(--text);flex-shrink:0;padding:6px 12px;font-size:11px}@supports (color:color-mix(in lab,red,red)){.terminal-error{border-bottom:1px solid color-mix(in srgb,var(--text) 8%,transparent)}}.terminal-body{flex:1;min-height:0;padding:6px 8px 8px;position:relative}.terminal-body .xterm,.terminal-body .xterm-screen,.terminal-body .xterm-viewport{background:0 0!important}.terminal-body .xterm{height:100%}.terminal-body .xterm.terminal-attaching{opacity:0}.terminal-body .xterm-viewport{background-color:#0000!important}.terminal-placeholder{justify-content:center;align-items:center;display:flex;position:absolute;inset:0}.terminal-placeholder button{border:1px dashed var(--text);border-radius:7px;padding:7px 16px}@supports (color:color-mix(in lab,red,red)){.terminal-placeholder button{border:1px dashed color-mix(in srgb,var(--text) 25%,transparent)}}.terminal-placeholder button{background:var(--text)}@supports (color:color-mix(in lab,red,red)){.terminal-placeholder button{background:color-mix(in srgb,var(--text) 5%,transparent)}}.terminal-placeholder button{color:var(--text)}@supports (color:color-mix(in lab,red,red)){.terminal-placeholder button{color:color-mix(in srgb,var(--text) 85%,transparent)}}.terminal-placeholder button{cursor:pointer;font-size:12px}.terminal-placeholder button:hover{background:var(--text)}@supports (color:color-mix(in lab,red,red)){.terminal-placeholder button:hover{background:color-mix(in srgb,var(--text) 10%,transparent)}}.terminal-tabs{cursor:default}.terminal-tabs:active{cursor:move}.terminal-resize-handle{z-index:3;cursor:nwse-resize;touch-action:none;width:18px;height:18px;position:absolute;bottom:0;right:0}.terminal-resize-handle:after{content:"";opacity:0;border-bottom:1.5px solid #0000;border-right:1.5px solid #0000;width:7px;height:7px;transition:opacity .12s,border-color .12s;position:absolute;bottom:3px;right:3px}.terminal-resize-handle:hover:after{opacity:1;border-color:var(--text)}@supports (color:color-mix(in lab,red,red)){.terminal-resize-handle:hover:after{border-color:color-mix(in srgb,var(--text) 35%,transparent)}}.terminal-panel-hidden .terminal-resize-handle{display:none}.bottom-band{align-items:stretch;min-width:0;height:36px;display:flex}.bottom-band .extension-status-shelf{flex:auto;min-width:0}.extension-actions{border-top:1px solid var(--border);flex:none;justify-content:center;align-items:stretch;min-width:0;display:flex}@supports (color:color-mix(in lab,red,red)){.extension-actions{border-top:1px solid color-mix(in srgb,var(--border) 60%,transparent)}}.extension-actions{background:var(--frame-glass);-webkit-backdrop-filter:blur(var(--glass-blur-heavy)) saturate(var(--glass-saturate))}.board-workbench .bottom-band{height:36px;overflow:visible}.board-workbench .extension-status-left{flex-wrap:nowrap;min-width:0;overflow:visible}.board-workbench .extension-status-right{flex-shrink:0}.board-workbench .extension-status-right>div{padding:0 6px}.board-workbench .extension-status-line,.board-workbench .extension-widget-triggers{min-width:0;overflow:hidden}.board-workbench .terminal-bar-toggle{display:none}.terminal-bar-toggle{width:110px;color:var(--text-muted);white-space:nowrap;cursor:pointer;background:0 0;border:none;flex-shrink:0;justify-content:center;align-items:center;gap:5px;padding:0 10px;font-size:11px;transition:color .1s,background .1s;display:flex}.terminal-bar-toggle:hover{color:var(--text);background:var(--bg-hover)}.terminal-bar-toggle.is-open{color:var(--accent);background:var(--bg-selected)}@media (prefers-reduced-transparency:reduce){.terminal-bar-toggle{background:var(--bg-panel)}}.tl-watermark_SEE-LICENSE{display:none!important}.tl-background,.tl-canvas,.tl-container{background:0 0!important}.tl-container .board-workbench,.tl-container .board-workbench *,.tl-container [data-testid^=sticky-note] .markdown-body,.tl-container [data-testid^=sticky-note] .markdown-body *{-webkit-user-select:text;user-select:text}@media (prefers-reduced-transparency:reduce){:root,html.dark{--board-card-glass:rgba(250,250,251,var(--bubble-alpha));--board-blur:12px}html.dark{--board-card-glass:rgba(34,34,37,var(--bubble-alpha))}}.sticky-note-input::placeholder{color:var(--text)}@supports (color:color-mix(in lab,red,red)){.sticky-note-input::placeholder{color:color-mix(in srgb,var(--text) 18%,transparent)}}html.dark .sticky-note-input::placeholder{color:var(--text)}@supports (color:color-mix(in lab,red,red)){html.dark .sticky-note-input::placeholder{color:color-mix(in srgb,var(--text) 28%,transparent)}}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}